@tscircuit/runframe 0.0.2825 → 0.0.2827
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/standalone.min.js
CHANGED
|
@@ -1065,7 +1065,7 @@ ${u.map(B=>B.spiceString).join(`
|
|
|
1065
1065
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
1066
1066
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
1067
1067
|
`);const f=_.state[a];if(f==null)return;JSON.stringify(i.getState())!==JSON.stringify(f)&&h(f);return}i.dispatchFromDevtools&&typeof i.dispatch=="function"&&i.dispatch(_)});case"DISPATCH":switch(p.payload.type){case"RESET":return h(d),a===void 0?l?.init(i.getState()):l?.init(que(A.name));case"COMMIT":if(a===void 0){l?.init(i.getState());return}return l?.init(que(A.name));case"ROLLBACK":return ZMe(p.state,_=>{if(a===void 0){h(_),l?.init(i.getState());return}h(_[a]),l?.init(que(A.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return ZMe(p.state,_=>{if(a===void 0){h(_);return}JSON.stringify(i.getState())!==JSON.stringify(_[a])&&h(_[a])});case"IMPORT_STATE":{const{nextLiftedState:_}=p.payload,f=(m=_.computedStates.slice(-1)[0])==null?void 0:m.state;if(!f)return;h(a===void 0?f:f[a]),l?.send(null,_);return}case"PAUSE_RECORDING":return g=!g}return}}),d},ZMe=(t,e)=>{let n;try{n=JSON.parse(t)}catch(o){console.error("[zustand devtools middleware] Could not parse the received json",o)}n!==void 0&&e(n)},QC=window.TSCIRCUIT_FILESERVER_API_BASE_URL??"/api",SFo=[".tsx",".ts",".jsx",".js",".mjs",".json",".kicad_pcb",".kicad_sym",".kicad_sch",".kicad_prl",".kicad_pro"],eDe=t=>SFo.some(e=>t.endsWith(e)),f$=jkt.extend("store");async function lFt(t,e){return(await(await fetch(`${QC}/files/upsert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:t,text_content:e})})).json()).file}async function tDe(t){return(await(await fetch(`${QC}/files/get?file_path=${encodeURIComponent(t)}`)).json()).file}async function QFo(t){const e=t?`${QC}/events/list?since=${encodeURIComponent(t)}`:`${QC}/events/list`;return(await(await fetch(e)).json()).event_list}async function vFo(){const t=await fetch(`${QC}/files/list`),{file_list:e}=await t.json(),n=new Map;for(const o of e){if(eDe(o.file_path)){const i=await tDe(o.file_path);n.set(o.file_path,i.text_content);continue}n.set(o.file_path,"__STATIC_ASSET__")}return n}const wFo=["manual-edits.json","manual_edits.json"],md=AFt()(cFt((t,e)=>({fsMap:new Map,lastEventTime:new Date().toISOString(),isPolling:!1,error:null,circuitJson:null,lastManualEditsChangeSentAt:0,recentEvents:[],simulateScenarioOrder:void 0,currentMainComponentPath:null,recentlySavedFiles:[],loadInitialFiles:async()=>{const n=await vFo();f$("loaded initial files",{fsMap:n}),t({fsMap:n})},upsertFile:async(n,o)=>{try{const i=await lFt(n,o);t(r=>({fsMap:new Map(r.fsMap).set(i.file_path,i.text_content)}))}catch(i){t({error:i})}},getFile:async n=>{try{const o=await tDe(n);t(i=>({fsMap:new Map(i.fsMap).set(o.file_path,o.text_content)}))}catch(o){t({error:o})}},setCircuitJson:n=>{n!==e().circuitJson&&t({circuitJson:n})},addRecentlySavedFile:n=>{t(o=>{if(wFo.includes(n)||!eDe(n))return o;const i=o.recentlySavedFiles.filter(r=>r!==n);return{recentlySavedFiles:[n,...i].slice(0,10)}})},startPolling:()=>{const n=async()=>{const o=e();if(o.isPolling){try{const i=await QFo(o.lastEventTime);if(i.length>0){const r=i[i.length-1].created_at;f$("received events",i.map(A=>A.event_type)),t(A=>({recentEvents:[...A.recentEvents,...i].slice(0,100),lastEventTime:r}));let s=0;const a=new Map(o.fsMap);for(const A of i)if(A.event_type==="FILE_UPDATED"){s++;const c=await tDe(A.file_path);if(A.file_path==="manual_edits.json"&&Date.now()-o.lastManualEditsChangeSentAt<1e3)continue;eDe(c.file_path)?a.set(c.file_path,c.text_content??""):a.set(c.file_path,"__STATIC_ASSET__"),e().addRecentlySavedFile(A.file_path)}else A.event_type==="FILE_DELETED"&&(s++,a.delete(A.file_path));s>0&&(f$("updating fsMap, fsUpdateCount:",s),t({fsMap:a}))}}catch(i){t({error:i})}setTimeout(n,1e3)}};t({isPolling:!0}),n()},stopPolling:()=>{t({isPolling:!1})},pushEvent:async n=>{await fetch(`${QC}/events/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},applyEditEventsAndUpdateManualEditsJson:async n=>{f$("applyEditEventsAndUpdateManualEditsJson",{editEvents:n});const o=e();if(!o.circuitJson)return;const i=o.fsMap.get("manual-edits.json"),r=i?JSON.parse(i):{},s=LRt({circuitJson:o.circuitJson,editEvents:n,manualEditsFile:r});f$("updatedManualEditsFileContent",s),t(a=>({lastManualEditsChangeSentAt:Date.now(),fsMap:new Map(a.fsMap).set("manual-edits.json",JSON.stringify(s))})),await lFt("manual-edits.json",JSON.stringify(s,null,2))},setSimulateScenarioOrder:n=>t({simulateScenarioOrder:n}),setCurrentMainComponentPath:n=>t({currentMainComponentPath:n})}),{name:"run-frame-store"})),PFo=jkt.extend("useEditEventController"),MFo=()=>{const t=md(h=>h.applyEditEventsAndUpdateManualEditsJson),[e,n]=ee.useState([]),[o,i]=ee.useState(!1),r=e.filter(h=>!h._applied),s=e.filter(h=>h._applied),a=o?e:r,A=ee.useCallback(h=>{n(d=>[...d,{...h,_applied:!1}])},[]),c=ee.useCallback(h=>{n(d=>d.map(p=>p===h?{...p,_applied:!0}:p))},[]),l=ee.useCallback(()=>{n(h=>h.map(d=>({...d,_applied:!0})))},[]),u=ee.useCallback(()=>{i(!0),e.length!==0&&(PFo("removing edit events that are applied"),n(h=>h.filter(d=>!d._applied)))},[e]),g=ee.useCallback(()=>{i(!1)},[]);return ee.useEffect(()=>{if(e.filter(d=>!d._applied).length===0)return;const h=setTimeout(()=>{l(),t(e)},1e3);return()=>clearTimeout(h)},[e]),{unappliedEditEvents:r,appliedEditEvents:s,editEventsForRender:a,pushEditEvent:A,markEditEventApplied:c,markRenderStarted:u,markRenderComplete:g,markAllEditEventsApplied:l}},nDe=vc("run-frame:useHasReceivedInitialFilesLoaded"),DFo=()=>{const[t,e]=ee.useState(!1),n=md(i=>i.recentEvents),o=md(i=>i.loadInitialFiles);return ee.useEffect(()=>{(async()=>{await o();try{const r=await fetch(`${QC}/events/list?event_type=INITIAL_FILES_UPLOADED`);if(r.ok){const{event_list:s}=await r.json();if(s.length>0){nDe("INITIAL_FILES_UPLOADED found in history. Assuming ready."),e(!0);return}}}catch(r){console.error("Failed to check for event history",r)}nDe("No INITIAL_FILES_UPLOADED in history, waiting for polling.")})()},[o]),ee.useEffect(()=>{t||n.some(i=>i.event_type==="INITIAL_FILES_UPLOADED")&&(nDe("INITIAL_FILES_UPLOADED received via polling. Assuming ready."),e(!0))},[n,t]),t};function TO(t,e,n){const[o,i]=ee.useState(()=>{if(n!==void 0)return n;try{const r=window.localStorage.getItem(t);return r?JSON.parse(r):e}catch(r){return console.error("Error reading from localStorage:",r),e}});return ee.useEffect(()=>{try{window.localStorage.setItem(t,JSON.stringify(o))}catch(r){console.error("Error writing to localStorage:",r)}},[t,o]),[o,i]}var NFo=Object.defineProperty,kO=(t,e)=>NFo(t,"name",{value:e,configurable:!0}),uFt=!!(typeof window<"u"&&window.document&&window.document.createElement);function ar(t,e,{checkForDefaultPrevented:n=!0}={}){return kO(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}kO(ar,"composeEventHandlers");function RFo(t){if(!uFt)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}kO(RFo,"getOwnerWindow");function oDe(t){if(!uFt)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}kO(oDe,"getOwnerDocument");function gFt(t,e=!1){const{activeElement:n}=oDe(t);if(!n?.nodeName)return null;if(dFt(n)&&n.contentDocument)return gFt(n.contentDocument.body,e);if(e){const o=n.getAttribute("aria-activedescendant");if(o){const i=oDe(n).getElementById(o);if(i)return i}}return n}kO(gFt,"getActiveElement");function dFt(t){return t.tagName==="IFRAME"}kO(dFt,"isFrame");var TFo=Object.defineProperty,o4=(t,e)=>TFo(t,"name",{value:e,configurable:!0});function kFo(t,e){const n=ee.createContext(e);n.displayName=t+"Context";const o=o4(r=>{const{children:s,...a}=r,A=ee.useMemo(()=>a,Object.values(a));return K.jsx(n.Provider,{value:A,children:s})},"Provider");o.displayName=t+"Provider";function i(r,s={}){const{optional:a=!1}=s,A=ee.useContext(n);if(A)return A;if(e!==void 0)return e;if(!a)throw new Error(`\`${r}\` must be used within \`${t}\``)}return o4(i,"useContext"),[o,i]}o4(kFo,"createContext");function Dx(t,e=[]){let n=[];function o(r,s){const a=ee.createContext(s);a.displayName=r+"Context";const A=n.length;n=[...n,s];const c=o4(u=>{const{scope:g,children:h,...d}=u,p=g?.[t]?.[A]||a,m=ee.useMemo(()=>d,Object.values(d));return K.jsx(p.Provider,{value:m,children:h})},"Provider");c.displayName=r+"Provider";function l(u,g,h={}){const{optional:d=!1}=h,p=g?.[t]?.[A]||a,m=ee.useContext(p);if(m)return m;if(s!==void 0)return s;if(!d)throw new Error(`\`${u}\` must be used within \`${r}\``)}return o4(l,"useContext"),[c,l]}o4(o,"createContext");const i=o4(()=>{const r=n.map(s=>ee.createContext(s));return o4(function(a){const A=a?.[t]||r;return ee.useMemo(()=>({[`__scope${t}`]:{...a,[t]:A}}),[a,A])},"useScope")},"createScope");return i.scopeName=t,[o,hFt(i,...e)]}o4(Dx,"createContextScope");function hFt(...t){const e=t[0];if(t.length===1)return e;const n=o4(()=>{const o=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return o4(function(r){const s=o.reduce((a,{useScope:A,scopeName:c})=>{const u=A(r)[`__scope${c}`];return{...a,...u}},{});return ee.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}o4(hFt,"composeContextScopes");var FFo=Object.defineProperty,iDe=(t,e)=>FFo(t,"name",{value:e,configurable:!0});function rDe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}iDe(rDe,"setRef");function hR(...t){return e=>{let n=!1;const o=t.map(i=>{const r=rDe(i,e);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<o.length;i++){const r=o[i];typeof r=="function"?r():rDe(t[i],null)}}}}iDe(hR,"composeRefs");function $A(...t){return ee.useCallback(hR(...t),t)}iDe($A,"useComposedRefs");var LFo=Object.defineProperty,wB=(t,e)=>LFo(t,"name",{value:e,configurable:!0});function PB(t){const e=ee.forwardRef((n,o)=>{let{children:i,...r}=n,s=null,a=!1;const A=[];sDe(i)&&typeof Xue=="function"&&(i=Xue(i._payload)),ee.Children.forEach(i,g=>{if(IFt(g)){a=!0;const h=g;let d="child"in h.props?h.props.child:h.props.children;sDe(d)&&typeof Xue=="function"&&(d=Xue(d._payload)),s=OFo(h,d),A.push(s?.props?.children)}else A.push(g)}),s?s=ee.cloneElement(s,void 0,A):!a&&ee.Children.count(i)===1&&ee.isValidElement(i)&&(s=i);const c=s?fFt(s):void 0,l=$A(o,c);if(!s){if(i||i===0)throw new Error(a?UFo(t):YFo(t));return i}const u=_Ft(r,s.props??{});return s.type!==ee.Fragment&&(u.ref=o?l:c),ee.cloneElement(s,u)});return e.displayName=`${t}.Slot`,e}wB(PB,"createSlot");var HFo=PB("Slot"),pFt=Symbol.for("radix.slottable");function mFt(t){const e=wB(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=pFt,e}wB(mFt,"createSlottable");var OFo=wB((t,e)=>{if("child"in t.props){const n=t.props.child;return ee.isValidElement(n)?ee.cloneElement(n,void 0,t.props.children(n.props.children)):null}return ee.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function _Ft(t,e){const n={...e};for(const o in e){const i=t[o],r=e[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...a)=>{const A=r(...a);return i(...a),A}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"&&(n[o]=[i,r].filter(Boolean).join(" "))}return{...t,...n}}wB(_Ft,"mergeProps");function fFt(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}wB(fFt,"getElementRef");function IFt(t){return ee.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===pFt}wB(IFt,"isSlottable");var GFo=Symbol.for("react.lazy");function sDe(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===GFo&&"_payload"in t&&CFt(t._payload)}wB(sDe,"isLazyComponent");function CFt(t){return typeof t=="object"&&t!==null&&"then"in t}wB(CFt,"isPromiseLike");var YFo=wB(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),UFo=wB(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Xue=B5[" use ".trim().toString()],KFo=Object.defineProperty,o1=(t,e)=>KFo(t,"name",{value:e,configurable:!0});function Zue(t){const e=t+"CollectionProvider",[n,o]=Dx(e),[i,r]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=o1(p=>{const{scope:m,children:_}=p,f=ee.useRef(null),I=ee.useRef(new Map).current;return K.jsx(i,{scope:m,itemMap:I,collectionRef:f,children:_})},"CollectionProvider");s.displayName=e;const a=t+"CollectionSlot",A=PB(a),c=ee.forwardRef((p,m)=>{const{scope:_,children:f}=p,I=r(a,_),C=$A(m,I.collectionRef);return K.jsx(A,{ref:C,children:f})});c.displayName=a;const l=t+"CollectionItemSlot",u="data-radix-collection-item",g=PB(l),h=ee.forwardRef((p,m)=>{const{scope:_,children:f,...I}=p,C=ee.useRef(null),y=$A(m,C),x=r(l,_);return ee.useEffect(()=>(x.itemMap.set(C,{ref:C,...I}),()=>{x.itemMap.delete(C)})),K.jsx(g,{[u]:"",ref:y,children:f})});h.displayName=l;function d(p){const m=r(t+"CollectionConsumer",p);return ee.useCallback(()=>{const f=m.collectionRef.current;if(!f)return[];const I=Array.from(f.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((x,E)=>I.indexOf(x.ref.current)-I.indexOf(E.ref.current))},[m.collectionRef,m.itemMap])}return o1(d,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},d,o]}o1(Zue,"createCollection");var yFt=new WeakMap,aDe=(HE=class extends Map{constructor(n){super(n);oit(this,h_);Hte(this,h_,[...super.keys()]),yFt.set(this,!0)}set(n,o){return yFt.get(this)&&(this.has(n)?P0(this,h_)[P0(this,h_).indexOf(n)]=n:P0(this,h_).push(n)),super.set(n,o),this}insert(n,o,i){const r=this.has(o),s=P0(this,h_).length,a=ADe(n);let A=a>=0?a:s+a;const c=A<0||A>=s?-1:A;if(c===this.size||r&&c===this.size-1||c===-1)return this.set(o,i),this;const l=this.size+(r?0:1);a<0&&A++;const u=[...P0(this,h_)];let g,h=!1;for(let d=A;d<l;d++)if(A===d){let p=u[d];u[d]===o&&(p=u[d+1]),r&&this.delete(o),g=this.get(p),this.set(o,i)}else{!h&&u[d-1]===o&&(h=!0);const p=u[h?d:d-1],m=g;g=this.get(p),this.delete(p),this.set(p,m)}return this}with(n,o,i){const r=new HE(this);return r.insert(n,o,i),r}before(n){const o=P0(this,h_).indexOf(n)-1;if(!(o<0))return this.entryAt(o)}setBefore(n,o,i){const r=P0(this,h_).indexOf(n);return r===-1?this:this.insert(r,o,i)}after(n){let o=P0(this,h_).indexOf(n);if(o=o===-1||o===this.size-1?-1:o+1,o!==-1)return this.entryAt(o)}setAfter(n,o,i){const r=P0(this,h_).indexOf(n);return r===-1?this:this.insert(r+1,o,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Hte(this,h_,[]),super.clear()}delete(n){const o=super.delete(n);return o&&P0(this,h_).splice(P0(this,h_).indexOf(n),1),o}deleteAt(n){const o=this.keyAt(n);return o!==void 0?this.delete(o):!1}at(n){const o=ege(P0(this,h_),n);if(o!==void 0)return this.get(o)}entryAt(n){const o=ege(P0(this,h_),n);if(o!==void 0)return[o,this.get(o)]}indexOf(n){return P0(this,h_).indexOf(n)}keyAt(n){return ege(P0(this,h_),n)}from(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return r;i++}}findIndex(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return i;i++}return-1}filter(n,o){const i=[];let r=0;for(const s of this)Reflect.apply(n,o,[s,r,this])&&i.push(s),r++;return new HE(i)}map(n,o){const i=[];let r=0;for(const s of this)i.push([s[0],Reflect.apply(n,o,[s,r,this])]),r++;return new HE(i)}reduce(...n){const[o,i]=n;let r=0,s=i??this.at(0);for(const a of this)r===0&&n.length===1?s=a:s=Reflect.apply(o,this,[s,a,r,this]),r++;return s}reduceRight(...n){const[o,i]=n;let r=i??this.at(-1);for(let s=this.size-1;s>=0;s--){const a=this.at(s);s===this.size-1&&n.length===1?r=a:r=Reflect.apply(o,this,[r,a,s,this])}return r}toSorted(n){const o=[...this.entries()].sort(n);return new HE(o)}toReversed(){const n=new HE;for(let o=this.size-1;o>=0;o--){const i=this.keyAt(o),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const o=[...this.entries()];return o.splice(...n),new HE(o)}slice(n,o){const i=new HE;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),o!==void 0&&o>0&&(r=o-1);for(let s=n;s<=r;s++){const a=this.keyAt(s),A=this.get(a);i.set(a,A)}return i}every(n,o){let i=0;for(const r of this){if(!Reflect.apply(n,o,[r,i,this]))return!1;i++}return!0}some(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return!0;i++}return!1}},h_=new WeakMap,o1(HE,"OrderedDict"),HE);function ege(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=xFt(t,e);return n===-1?void 0:t[n]}o1(ege,"at");function xFt(t,e){const n=t.length,o=ADe(e),i=o>=0?o:n+o;return i<0||i>=n?-1:i}o1(xFt,"toSafeIndex");function ADe(t){return t!==t||t===0?0:Math.trunc(t)}o1(ADe,"toSafeInteger");function VFo(t){const e=t+"CollectionProvider",[n,o]=Dx(e),[i,r]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new aDe,setItemMap:o1(()=>{},"setItemMap")}),s=o1(({state:I,...C})=>I?K.jsx(A,{...C,state:I}):K.jsx(a,{...C}),"CollectionProvider");s.displayName=e;const a=o1(I=>{const C=m();return K.jsx(A,{...I,state:C})},"CollectionInit");a.displayName=e+"Init";const A=o1(I=>{const{scope:C,children:y,state:x}=I,E=ee.useRef(null),[B,S]=ee.useState(null),Q=$A(E,S),[w,M]=x;return ee.useEffect(()=>{if(!B)return;const k=bFt(()=>{});return k.observe(B,{childList:!0,subtree:!0}),()=>{k.disconnect()}},[B]),K.jsx(i,{scope:C,itemMap:w,setItemMap:M,collectionRef:Q,collectionRefObject:E,collectionElement:B,children:y})},"CollectionProviderImpl");A.displayName=e+"Impl";const c=t+"CollectionSlot",l=PB(c),u=ee.forwardRef((I,C)=>{const{scope:y,children:x}=I,E=r(c,y),B=$A(C,E.collectionRef);return K.jsx(l,{ref:B,children:x})});u.displayName=c;const g=t+"CollectionItemSlot",h="data-radix-collection-item",d=PB(g),p=ee.forwardRef((I,C)=>{const{scope:y,children:x,...E}=I,B=ee.useRef(null),[S,Q]=ee.useState(null),w=$A(C,B,Q),M=r(g,y),{setItemMap:k}=M,R=ee.useRef(E);EFt(R.current,E)||(R.current=E);const F=R.current;return ee.useEffect(()=>{const O=F;return k(U=>S?U.has(S)?U.set(S,{...O,element:S}).toSorted(cDe):(U.set(S,{...O,element:S}),U.toSorted(cDe)):U),()=>{k(U=>!S||!U.has(S)?U:(U.delete(S),new aDe(U)))}},[S,F,k]),K.jsx(d,{[h]:"",ref:w,children:x})});p.displayName=g;function m(){return ee.useState(new aDe)}o1(m,"useInitCollection");function _(I){const{itemMap:C}=r(t+"CollectionConsumer",I);return C}return o1(_,"useCollection"),[{Provider:s,Slot:u,ItemSlot:p},{createCollectionScope:o,useCollection:_,useInitCollection:m}]}o1(VFo,"createCollection");function EFt(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}o1(EFt,"shallowEqual");function BFt(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}o1(BFt,"isElementPreceding");function cDe(t,e){return!t[1].element||!e[1].element?0:BFt(t[1].element,e[1].element)?-1:1}o1(cDe,"sortByDocumentPosition");function bFt(t){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){t();return}})}o1(bFt,"getChildListObserver");var Ep=globalThis?.document?ee.useLayoutEffect:()=>{},zFo=Object.defineProperty,JFo=(t,e)=>zFo(t,"name",{value:e,configurable:!0}),WFo=B5[" useId ".trim().toString()]||(()=>{}),jFo=0;function t_(t){const[e,n]=ee.useState(WFo());return Ep(()=>{t||n(o=>o??String(jFo++))},[t]),t||(e?`radix-${e}`:"")}JFo(t_,"useId");var A6=Wye();const SFt=my(A6);var $Fo=Object.defineProperty,qFo=(t,e)=>$Fo(t,"name",{value:e,configurable:!0}),XFo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Na=XFo.reduce((t,e)=>{const n=PB(`Primitive.${e}`),o=ee.forwardRef((i,r)=>{const{asChild:s,...a}=i,A=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),K.jsx(A,{...a,ref:r})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function lDe(t,e){t&&A6.flushSync(()=>t.dispatchEvent(e))}qFo(lDe,"dispatchDiscreteCustomEvent");var ZFo=Object.defineProperty,eLo=(t,e)=>ZFo(t,"name",{value:e,configurable:!0});function AE(t){const e=ee.useRef(t);return ee.useEffect(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}eLo(AE,"useCallbackRef");var tLo=Object.defineProperty,nLo=(t,e)=>tLo(t,"name",{value:e,configurable:!0}),QFt=B5[" useEffectEvent ".trim().toString()],vFt=B5[" useInsertionEffect ".trim().toString()];function wFt(t){if(typeof QFt=="function")return QFt(t);const e=ee.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof vFt=="function"?vFt(()=>{e.current=t}):Ep(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}nLo(wFt,"useEffectEvent");var oLo=Object.defineProperty,I$=(t,e)=>oLo(t,"name",{value:e,configurable:!0}),iLo=B5[" useInsertionEffect ".trim().toString()]||Ep;function MB({prop:t,defaultProp:e,onChange:n=I$(()=>{},"onChange"),caller:o}){const[i,r,s]=PFt({defaultProp:e,onChange:n}),a=t!==void 0,A=a?t:i,c=ee.useCallback(l=>{if(a){const u=MFt(l)?l(t):l;u!==t&&s.current?.(u)}else r(l)},[a,t,r,s]);return[A,c]}I$(MB,"useControllableState");function PFt({defaultProp:t,onChange:e}){const[n,o]=ee.useState(t),i=ee.useRef(n),r=ee.useRef(e);return iLo(()=>{r.current=e},[e]),ee.useEffect(()=>{i.current!==n&&(r.current?.(n),i.current=n)},[n,i]),[n,o,r]}I$(PFt,"useUncontrolledState");function MFt(t){return typeof t=="function"}I$(MFt,"isFunction");var DFt=Symbol("RADIX:SYNC_STATE");function rLo(t,e,n,o){const{prop:i,defaultProp:r,onChange:s,caller:a}=e,A=i!==void 0,c=wFt(s),l=[{...n,state:r}];o&&l.push(o);const[u,g]=ee.useReducer((m,_)=>{if(_.type===DFt)return{...m,state:_.state};const f=t(m,_);return A&&!Object.is(f.state,m.state)&&c(f.state),f},...l),h=u.state,d=ee.useRef(h);ee.useEffect(()=>{d.current!==h&&(d.current=h,A||c(h))},[h,d,A]);const p=ee.useMemo(()=>i!==void 0?{...u,state:i}:u,[u,i]);return ee.useEffect(()=>{A&&!Object.is(i,u.state)&&g({type:DFt,state:i})},[i,u.state,A]),[p,g]}I$(rLo,"useControllableStateReducer");var sLo=Object.defineProperty,aLo=(t,e)=>sLo(t,"name",{value:e,configurable:!0}),ALo=ee.createContext(void 0);function C$(t){const e=ee.useContext(ALo);return t||e||"ltr"}aLo(C$,"useDirection");var cLo=Object.defineProperty,uDe=(t,e)=>cLo(t,"name",{value:e,configurable:!0}),gDe=!1;function NFt(){const[t,e]=ee.useState(gDe);return ee.useEffect(()=>{gDe||(gDe=!0,e(!0))},[]),t}uDe(NFt,"useIsHydrated");var RFt=B5[" useSyncExternalStore ".trim().toString()];function TFt(){return()=>{}}uDe(TFt,"subscribe");function kFt(){return RFt(TFt,()=>!0,()=>!1)}uDe(kFt,"useIsHydratedModern");var lLo=typeof RFt=="function"?kFt:NFt,uLo=Object.defineProperty,pR=(t,e)=>uLo(t,"name",{value:e,configurable:!0}),dDe="rovingFocusGroup.onEntryFocus",gLo={bubbles:!1,cancelable:!0},tge="RovingFocusGroup",[hDe,FFt,dLo]=Zue(tge),[hLo,nge]=Dx(tge,[dLo]),[pLo,mLo]=hLo(tge),_Lo=ee.forwardRef(pR(function(e,n){return K.jsx(hDe.Provider,{scope:e.__scopeRovingFocusGroup,children:K.jsx(hDe.Slot,{scope:e.__scopeRovingFocusGroup,children:K.jsx(fLo,{...e,ref:n})})})},"RovingFocusGroup")),fLo=ee.forwardRef(pR(function(e,n){const{__scopeRovingFocusGroup:o,orientation:i,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:A,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...g}=e,h=ee.useRef(null),d=$A(n,h),p=C$(s),[m,_]=MB({prop:a,defaultProp:A??null,onChange:c,caller:tge}),[f,I]=ee.useState(!1),C=AE(l),y=FFt(o),x=ee.useRef(!1),[E,B]=ee.useState(0);return ee.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(dDe,C),()=>S.removeEventListener(dDe,C)},[C]),K.jsx(pLo,{scope:o,orientation:i,dir:p,loop:r,currentTabStopId:m,onItemFocus:ee.useCallback(S=>_(S),[_]),onItemShiftTab:ee.useCallback(()=>I(!0),[]),onFocusableItemAdd:ee.useCallback(()=>B(S=>S+1),[]),onFocusableItemRemove:ee.useCallback(()=>B(S=>S-1),[]),children:K.jsx(Na.div,{tabIndex:f||E===0?-1:0,"data-orientation":i,...g,ref:d,style:{outline:"none",...e.style},onMouseDown:ar(e.onMouseDown,()=>{x.current=!0}),onFocus:ar(e.onFocus,S=>{const Q=!x.current;if(S.target===S.currentTarget&&Q&&!f){const w=new CustomEvent(dDe,gLo);if(S.currentTarget.dispatchEvent(w),!w.defaultPrevented){const M=y().filter(U=>U.focusable),k=M.find(U=>U.active),R=M.find(U=>U.id===m),O=[k,R,...M].filter(Boolean).map(U=>U.ref.current);pDe(O,u)}}x.current=!1}),onBlur:ar(e.onBlur,()=>I(!1))})})},"RovingFocusGroupImpl")),ILo="RovingFocusGroupItem",CLo=ee.forwardRef(pR(function(e,n){const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:s,children:a,...A}=e,c=t_(),l=s||c,u=mLo(ILo,o),g=u.currentTabStopId===l,h=FFt(o),{onFocusableItemAdd:d,onFocusableItemRemove:p,currentTabStopId:m}=u,_=lLo();return Ep(()=>{if(!(!_||!i))return d(),()=>p()},[_,i,d,p]),ee.useEffect(()=>{if(!(_||!i))return d(),()=>p()},[_,i,d,p]),K.jsx(hDe.ItemSlot,{scope:o,id:l,focusable:i,active:r,children:K.jsx(Na.span,{tabIndex:g?0:-1,"data-orientation":u.orientation,...A,ref:n,onMouseDown:ar(e.onMouseDown,f=>{i?u.onItemFocus(l):f.preventDefault()}),onFocus:ar(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:ar(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){u.onItemShiftTab();return}if(f.target!==f.currentTarget)return;const I=HFt(f,u.orientation,u.dir);if(I!==void 0){if(f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;f.preventDefault();let y=h().filter(x=>x.focusable).map(x=>x.ref.current);if(I==="last")y.reverse();else if(I==="prev"||I==="next"){I==="prev"&&y.reverse();const x=y.indexOf(f.currentTarget);y=u.loop?OFt(y,x+1):y.slice(x+1)}setTimeout(()=>pDe(y))}}),children:typeof a=="function"?a({isCurrentTabStop:g,hasTabStop:m!=null}):a})})},"RovingFocusGroupItem")),yLo={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function LFt(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}pR(LFt,"getDirectionAwareKey");function HFt(t,e,n){const o=LFt(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return yLo[o]}pR(HFt,"getFocusIntent");function pDe(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}pR(pDe,"focusFirst");function OFt(t,e){return t.map((n,o)=>t[(e+o)%t.length])}pR(OFt,"wrapArray");var GFt=_Lo,YFt=CLo,xLo=Object.defineProperty,Fb=(t,e)=>xLo(t,"name",{value:e,configurable:!0});function UFt(t,e){return ee.useReducer((n,o)=>e[n][o]??n,t)}Fb(UFt,"useStateMachine");var cE=Fb(t=>{const{present:e,children:n}=t,o=KFt(e),i=typeof n=="function"?n({present:o.isPresent}):ee.Children.only(n),r=VFt(o.ref,zFt(i));return typeof n=="function"||o.isPresent?ee.cloneElement(i,{ref:r}):null},"Presence");function KFt(t){const[e,n]=ee.useState(),o=ee.useRef(null),i=ee.useRef(t),r=ee.useRef("none"),s=ee.useRef(void 0),a=t?"mounted":"unmounted",[A,c]=UFt(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ee.useEffect(()=>{A==="mounted"?(r.current=s.current??FO(o.current),s.current=void 0):r.current="none"},[A]),Ep(()=>{const l=o.current,u=i.current;if(u!==t){const h=r.current,d=FO(l);t?(s.current=d,c("MOUNT")):d==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),Ep(()=>{if(e){let l;const u=e.ownerDocument.defaultView??window,g=Fb(d=>{const m=FO(o.current).includes(CSS.escape(d.animationName));if(d.target===e&&m&&(c("ANIMATION_END"),!i.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",l=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},"handleAnimationEnd"),h=Fb(d=>{d.target===e&&(r.current=FO(o.current))},"handleAnimationStart");return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{u.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(A),ref:ee.useCallback(l=>{if(l){const u=getComputedStyle(l);o.current=u,s.current=FO(u)}else o.current=null;n(l)},[])}}Fb(KFt,"usePresence");function mDe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Fb(mDe,"setRef");function VFt(...t){const e=ee.useRef(t);return e.current=t,ee.useCallback(n=>{const o=e.current;let i=!1;const r=o.map(s=>{const a=mDe(s,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():mDe(o[s],null)}}},[])}Fb(VFt,"useStableComposedRefs");function FO(t){return t?.animationName||"none"}Fb(FO,"getAnimationName");function zFt(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Fb(zFt,"getElementRef");var ELo=Object.defineProperty,LO=(t,e)=>ELo(t,"name",{value:e,configurable:!0}),_De="Tabs",[BLo,Shr]=Dx(_De,[nge]),JFt=nge(),[bLo,fDe]=BLo(_De),SLo=ee.forwardRef(LO(function(e,n){const{__scopeTabs:o,value:i,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:A,activationMode:c="automatic",...l}=e,u=C$(A),[g,h]=MB({prop:i,onChange:r,defaultProp:s??"",caller:_De});return K.jsx(bLo,{scope:o,baseId:t_(),value:g,onValueChange:h,orientation:a,dir:u,activationMode:c,children:K.jsx(Na.div,{dir:u,"data-orientation":a,...l,ref:n})})},"Tabs")),QLo="TabsList",vLo=ee.forwardRef(LO(function(e,n){const{__scopeTabs:o,loop:i=!0,...r}=e,s=fDe(QLo,o),a=JFt(o);return K.jsx(GFt,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:i,children:K.jsx(Na.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:n})})},"TabsList")),wLo="TabsTrigger",PLo=ee.forwardRef(LO(function(e,n){const{__scopeTabs:o,value:i,disabled:r=!1,...s}=e,a=fDe(wLo,o),A=JFt(o),c=IDe(a.baseId,i),l=CDe(a.baseId,i),u=i===a.value;return K.jsx(YFt,{asChild:!0,...A,focusable:!r,active:u,children:K.jsx(Na.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":l,"data-state":u?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...s,ref:n,onMouseDown:ar(e.onMouseDown,g=>{!r&&g.button===0&&g.ctrlKey===!1?a.onValueChange(i):g.preventDefault()}),onKeyDown:ar(e.onKeyDown,g=>{r||g.target!==g.currentTarget||[" ","Enter"].includes(g.key)&&a.onValueChange(i)}),onFocus:ar(e.onFocus,()=>{const g=a.activationMode!=="manual";!u&&!r&&g&&a.onValueChange(i)})})})},"TabsTrigger")),MLo="TabsContent",DLo=ee.forwardRef(LO(function(e,n){const{__scopeTabs:o,value:i,forceMount:r,children:s,...a}=e,A=fDe(MLo,o),c=IDe(A.baseId,i),l=CDe(A.baseId,i),u=i===A.value,g=ee.useRef(u);return ee.useEffect(()=>{const h=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(h)},[]),K.jsx(cE,{present:r||u,children:({present:h})=>K.jsx(Na.div,{"data-state":u?"active":"inactive","data-orientation":A.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:l,tabIndex:0,...a,ref:n,style:{...e.style,animationDuration:g.current?"0s":void 0},children:h&&s})})},"TabsContent"));function IDe(t,e){return`${t}-trigger-${e}`}LO(IDe,"makeTriggerId");function CDe(t,e){return`${t}-content-${e}`}LO(CDe,"makeContentId");var NLo=SLo,WFt=vLo,jFt=PLo,$Ft=DLo;function qFt(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=qFt(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function DB(){for(var t,e,n=0,o="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=qFt(t))&&(o&&(o+=" "),o+=e);return o}const yDe="-",RLo=t=>{const e=kLo(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:s=>{const a=s.split(yDe);return a[0]===""&&a.length!==1&&a.shift(),XFt(a,e)||TLo(s)},getConflictingClassGroupIds:(s,a)=>{const A=n[s]||[];return a&&o[s]?[...A,...o[s]]:A}}},XFt=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),i=o?XFt(t.slice(1),o):void 0;if(i)return i;if(e.validators.length===0)return;const r=t.join(yDe);return e.validators.find(({validator:s})=>s(r))?.classGroupId},ZFt=/^\[(.+)\]$/,TLo=t=>{if(ZFt.test(t)){const e=ZFt.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},kLo=t=>{const{theme:e,prefix:n}=t,o={nextPart:new Map,validators:[]};return LLo(Object.entries(t.classGroups),n).forEach(([r,s])=>{xDe(s,o,r,e)}),o},xDe=(t,e,n,o)=>{t.forEach(i=>{if(typeof i=="string"){const r=i===""?e:eLt(e,i);r.classGroupId=n;return}if(typeof i=="function"){if(FLo(i)){xDe(i(o),e,n,o);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([r,s])=>{xDe(s,eLt(e,r),n,o)})})},eLt=(t,e)=>{let n=t;return e.split(yDe).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},FLo=t=>t.isThemeGetter,LLo=(t,e)=>e?t.map(([n,o])=>{const i=o.map(r=>typeof r=="string"?e+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,a])=>[e+s,a])):r);return[n,i]}):t,HLo=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,o=new Map;const i=(r,s)=>{n.set(r,s),e++,e>t&&(e=0,o=n,n=new Map)};return{get(r){let s=n.get(r);if(s!==void 0)return s;if((s=o.get(r))!==void 0)return i(r,s),s},set(r,s){n.has(r)?n.set(r,s):i(r,s)}}},tLt="!",OLo=t=>{const{separator:e,experimentalParseClassName:n}=t,o=e.length===1,i=e[0],r=e.length,s=a=>{const A=[];let c=0,l=0,u;for(let m=0;m<a.length;m++){let _=a[m];if(c===0){if(_===i&&(o||a.slice(m,m+r)===e)){A.push(a.slice(l,m)),l=m+r;continue}if(_==="/"){u=m;continue}}_==="["?c++:_==="]"&&c--}const g=A.length===0?a:a.substring(l),h=g.startsWith(tLt),d=h?g.substring(1):g,p=u&&u>l?u-l:void 0;return{modifiers:A,hasImportantModifier:h,baseClassName:d,maybePostfixModifierPosition:p}};return n?a=>n({className:a,parseClassName:s}):s},GLo=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(o=>{o[0]==="["?(e.push(...n.sort(),o),n=[]):n.push(o)}),e.push(...n.sort()),e},YLo=t=>({cache:HLo(t.cacheSize),parseClassName:OLo(t),...RLo(t)}),ULo=/\s+/,KLo=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=e,r=[],s=t.trim().split(ULo);let a="";for(let A=s.length-1;A>=0;A-=1){const c=s[A],{modifiers:l,hasImportantModifier:u,baseClassName:g,maybePostfixModifierPosition:h}=n(c);let d=!!h,p=o(d?g.substring(0,h):g);if(!p){if(!d){a=c+(a.length>0?" "+a:a);continue}if(p=o(g),!p){a=c+(a.length>0?" "+a:a);continue}d=!1}const m=GLo(l).join(":"),_=u?m+tLt:m,f=_+p;if(r.includes(f))continue;r.push(f);const I=i(p,d);for(let C=0;C<I.length;++C){const y=I[C];r.push(_+y)}a=c+(a.length>0?" "+a:a)}return a};function VLo(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=nLt(e))&&(o&&(o+=" "),o+=n);return o}const nLt=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=nLt(t[o]))&&(n&&(n+=" "),n+=e);return n};function zLo(t,...e){let n,o,i,r=s;function s(A){const c=e.reduce((l,u)=>u(l),t());return n=YLo(c),o=n.cache.get,i=n.cache.set,r=a,a(A)}function a(A){const c=o(A);if(c)return c;const l=KLo(A,n);return i(A,l),l}return function(){return r(VLo.apply(null,arguments))}}const _d=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},oLt=/^\[(?:([a-z-]+):)?(.+)\]$/i,JLo=/^\d+\/\d+$/,WLo=new Set(["px","full","screen"]),jLo=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$Lo=/\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$/,qLo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XLo=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZLo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lb=t=>HO(t)||WLo.has(t)||JLo.test(t),bw=t=>OO(t,"length",aHo),HO=t=>!!t&&!Number.isNaN(Number(t)),EDe=t=>OO(t,"number",HO),y$=t=>!!t&&Number.isInteger(Number(t)),eHo=t=>t.endsWith("%")&&HO(t.slice(0,-1)),LA=t=>oLt.test(t),Sw=t=>jLo.test(t),tHo=new Set(["length","size","percentage"]),nHo=t=>OO(t,tHo,iLt),oHo=t=>OO(t,"position",iLt),iHo=new Set(["image","url"]),rHo=t=>OO(t,iHo,cHo),sHo=t=>OO(t,"",AHo),x$=()=>!0,OO=(t,e,n)=>{const o=oLt.exec(t);return o?o[1]?typeof e=="string"?o[1]===e:e.has(o[1]):n(o[2]):!1},aHo=t=>$Lo.test(t)&&!qLo.test(t),iLt=()=>!1,AHo=t=>XLo.test(t),cHo=t=>ZLo.test(t),lHo=zLo(()=>{const t=_d("colors"),e=_d("spacing"),n=_d("blur"),o=_d("brightness"),i=_d("borderColor"),r=_d("borderRadius"),s=_d("borderSpacing"),a=_d("borderWidth"),A=_d("contrast"),c=_d("grayscale"),l=_d("hueRotate"),u=_d("invert"),g=_d("gap"),h=_d("gradientColorStops"),d=_d("gradientColorStopPositions"),p=_d("inset"),m=_d("margin"),_=_d("opacity"),f=_d("padding"),I=_d("saturate"),C=_d("scale"),y=_d("sepia"),x=_d("skew"),E=_d("space"),B=_d("translate"),S=()=>["auto","contain","none"],Q=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto",LA,e],M=()=>[LA,e],k=()=>["",Lb,bw],R=()=>["auto",HO,LA],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",LA],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>[HO,LA];return{cacheSize:500,separator:":",theme:{colors:[x$],spacing:[Lb,bw],blur:["none","",Sw,LA],brightness:j(),borderColor:[t],borderRadius:["none","","full",Sw,LA],borderSpacing:M(),borderWidth:k(),contrast:j(),grayscale:W(),hueRotate:j(),invert:W(),gap:M(),gradientColorStops:[t],gradientColorStopPositions:[eHo,bw],inset:w(),margin:w(),opacity:j(),padding:M(),saturate:j(),scale:j(),sepia:W(),skew:j(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",LA]}],container:["container"],columns:[{columns:[Sw]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"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:[...F(),LA]}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",y$,LA]}],basis:[{basis:w()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",LA]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",y$,LA]}],"grid-cols":[{"grid-cols":[x$]}],"col-start-end":[{col:["auto",{span:["full",y$,LA]},LA]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[x$]}],"row-start-end":[{row:["auto",{span:[y$,LA]},LA]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",LA]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",LA]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[f]}],px:[{px:[f]}],py:[{py:[f]}],ps:[{ps:[f]}],pe:[{pe:[f]}],pt:[{pt:[f]}],pr:[{pr:[f]}],pb:[{pb:[f]}],pl:[{pl:[f]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",LA,e]}],"min-w":[{"min-w":[LA,e,"min","max","fit"]}],"max-w":[{"max-w":[LA,e,"none","full","min","max","fit","prose",{screen:[Sw]},Sw]}],h:[{h:[LA,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[LA,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[LA,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[LA,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Sw,bw]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",EDe]}],"font-family":[{font:[x$]}],"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",LA]}],"line-clamp":[{"line-clamp":["none",HO,EDe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Lb,LA]}],"list-image":[{"list-image":["none",LA]}],"list-style-type":[{list:["none","disc","decimal",LA]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Lb,bw]}],"underline-offset":[{"underline-offset":["auto",Lb,LA]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",LA]}],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",LA]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),oHo]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",nHo]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},rHo]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[d]}],"gradient-via-pos":[{via:[d]}],"gradient-to-pos":[{to:[d]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:O()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[Lb,LA]}],"outline-w":[{outline:[Lb,bw]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Lb,bw]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Sw,sHo]}],"shadow-color":[{shadow:[x$]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[A]}],"drop-shadow":[{"drop-shadow":["","none",Sw,LA]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[u]}],saturate:[{saturate:[I]}],sepia:[{sepia:[y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[A]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",LA]}],duration:[{duration:j()}],ease:[{ease:["linear","in","out","in-out",LA]}],delay:[{delay:j()}],animate:[{animate:["none","spin","ping","pulse","bounce",LA]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[y$,LA]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",LA]}],accent:[{accent:["auto",t]}],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",LA]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",LA]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Lb,bw,EDe]}],stroke:[{stroke:[t,"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"]}}}),Ln="u">typeof window?window:void 0,vC="u">typeof globalThis?globalThis:Ln,tf=vC?.navigator,No=vC?.document,fd=vC?.location,E$=vC?.fetch,BDe=vC?.XMLHttpRequest&&"withCredentials"in new vC.XMLHttpRequest?vC.XMLHttpRequest:void 0,rLt=vC?.AbortController,uHo=vC?.CompressionStream,Wy=tf?.userAgent;function sLt(){return!(!Ln||Ln.navigator.onLine===!1)}const B$=typeof globalThis<"u"?globalThis:Ln;B$&&typeof self>"u"&&(B$.self=B$),B$&&typeof File>"u"&&(B$.File=function(){});const Vr=Ln??{},gHo="0.9.0",Hb={DEBUG:!1,LIB_VERSION:gHo,LIB_NAME:"browser-common"};var c6=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),bDe=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({});const dHo=["$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"],hHo=["token"];function Is(t,e){return t.indexOf(e)!==-1}const oge=function(t){return t.trim()},SDe=function(t){return t.replace(/^\$/,"")};function aLt(t){var e;const n=[];return(e=JSON.stringify(t,function(o,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return"[Circular]";n.push(i)}return i}}))!==null&&e!==void 0?e:"null"}const ALt=Object.prototype,QDe=ALt.hasOwnProperty,ige=ALt.toString,as=Array.isArray||function(t){return ige.call(t)==="[object Array]"},nf=t=>typeof t=="function",QA=t=>t===Object(t)&&!as(t),Nx=t=>{if(QA(t)){for(const e in t)if(QDe.call(t,e))return!1;return!0}return!1},Bo=t=>t===void 0,rA=t=>ige.call(t)=="[object String]",b$=t=>rA(t)&&t.trim().length===0,Id=t=>t===null,Us=t=>Bo(t)||Id(t),sh=t=>ige.call(t)=="[object Number]"&&t==t,Ob=t=>sh(t)&&t>0,jy=t=>ige.call(t)==="[object Boolean]",pHo=t=>Is(dHo,t),mHo=t=>Is(hHo,t);function cLt(t){return t===null||typeof t!="object"}function rge(t,e){return{}.toString.call(t)===`[object ${e}]`}function GO(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return lLt(t,Error)}}function vDe(t){return"u">typeof Event&&lLt(t,Event)}function lLt(t,e){try{return t instanceof e}catch{return!1}}const _Ho=[!0,"true",1,"1","yes"],wDe=t=>Is(_Ho,t),fHo=[!1,"false",0,"0","no"];function uLt(t,e,n,o,i,r,s){try{var a=t[r](s),A=a.value}catch(c){return void n(c)}a.done?e(A):Promise.resolve(A).then(o,i)}function eg(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var r=t.apply(e,n);function s(A){uLt(r,o,i,s,a,"next",A)}function a(A){uLt(r,o,i,s,a,"throw",A)}s(void 0)})}}const IHo=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],gLt=function(t,e=[]){if(!t)return!1;const n=t.toLowerCase();return IHo.concat(e).some(o=>{const i=o.toLowerCase();return n.indexOf(i)!==-1})};function l6(t,e,n,o,i){return e>n&&(o.warn("min cannot be greater than max."),e=n),sh(t)?t>n?(o.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(o.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(o.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),l6(i??n,e,n,o))}var CHo=class{constructor(e){this.C={},this.I=e.I,this.R=l6(e.bucketSize,0,100,e.$),this.A=l6(e.refillRate,0,this.R,e.$),this.O=l6(e.refillInterval,0,864e5,e.$)}F(e,n){const o=Math.floor((n-e.lastAccess)/this.O);o>0&&(e.tokens=Math.min(e.tokens+o*this.A,this.R),e.lastAccess=e.lastAccess+o*this.O)}consumeRateLimit(e){var n;const o=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,o):(r={tokens:this.R,lastAccess:o},this.C[i]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((n=this.I)===null||n===void 0||n.call(this,e)),r.tokens===0)}stop(){this.C={}}};const YO="Mobile",S$="Android",sge="Tablet",dLt="Android Tablet",hLt="iPad",pLt="Apple Watch",age="Safari",Age="BlackBerry",mLt="Samsung Internet",cge="Chrome",_Lt="Chrome iOS",fLt="Internet Explorer",ILt="Internet Explorer Mobile",CLt="Opera",yLt="Microsoft Edge",lge="Firefox",xLt="Firefox iOS",uge="Nintendo",gge="PlayStation",dge="Xbox",ELt="Android Mobile",BLt="Mobile Safari",PDe="Windows",bLt="Windows Phone",SLt="Nokia",MDe="Ouya",yHo="Generic "+YO.toLowerCase(),QLt="Generic "+sge.toLowerCase(),DDe="Konqueror",vLt="Oculus Browser",wLt="Vivaldi",PLt="Yandex",MLt="Whale",DLt="DuckDuckGo",NLt="Pale Moon",RLt="Waterfox",NDe="Brave",TLt="Claude",kLt="Codex",FLt="ChatGPT",LLt="Google Search App",RDe=new RegExp("Version/(\\d+(\\.\\d+)?)"),TDe=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),xHo=new RegExp(dge,"i"),EHo=new RegExp("PlayStation \\w+","i"),BHo=new RegExp("Nintendo \\w+","i"),kDe=new RegExp("BlackBerry|PlayBook|BB10","i"),bHo={"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"},HLt=function(t,e,n,o){return e=e||"",(function(r){return r?.brave?NDe:null})(n)||(o?.detectGoogleSearchApp&&Is(t,"GSA/")?LLt:Is(t," OPR/")&&Is(t,"Mini")?"Opera Mini":Is(t," OPR/")?CLt:kDe.test(t)?Age:Is(t,"IEMobile")||Is(t,"WPDesktop")?ILt:Is(t,"OculusBrowser")?vLt:Is(t,"SamsungBrowser")?mLt:Is(t,"Edge")||Is(t,"Edg/")?yLt:Is(t,"Vivaldi/")?wLt:Is(t,"YaBrowser/")?PLt:Is(t,"Whale/")?MLt:Is(t,"DuckDuckGo/")||Is(t,"Ddg/")?DLt:Is(t,"Claude/")?TLt:Is(t,"Codex/")?kLt:Is(t,"ChatGPT/")?FLt:Is(t,"FBIOS")?"Facebook Mobile":Is(t,"UCWEB")||Is(t,"UCBrowser")?"UC Browser":Is(t,"CriOS")?_Lt:Is(t,"CrMo")||Is(t,cge)?cge:Is(t,S$)&&Is(t,age)?ELt:Is(t,"FxiOS")?xLt:Is(t.toLowerCase(),DDe.toLowerCase())?DDe:Is(t,"Brave/")?NDe:((r,s)=>s&&Is(s,"Apple")||(function(a){return Is(a,age)&&!Is(a,cge)&&!Is(a,S$)})(r))(t,e)?Is(t,YO)?BLt:age:Is(t,"PaleMoon/")?NLt:Is(t,"Waterfox/")?RLt:Is(t,lge)?lge:Is(t,"MSIE")||Is(t,"Trident/")?fLt:Is(t,"Gecko")?lge:"")},SHo={[ILt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[yLt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[cge]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[_Lt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[age]:[RDe],[BLt]:[RDe],[CLt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[lge]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[xLt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[DDe]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Age]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),RDe],[ELt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[mLt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[vLt]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[wLt]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[PLt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[MLt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[NDe]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[TLt]:[TDe],[kLt]:[TDe],[FLt]:[TDe],[DLt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[NLt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[RLt]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[LLt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[fLt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},QHo=function(t,e,n,o){const i=HLt(t,e,n,o),r=SHo[i];if(Bo(r))return null;for(let s=0;r.length>s;s++){const a=t.match(r[s]);if(a)return parseFloat(a[a.length-2])}return null},OLt=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[dge,t&&t[1]||""]],[new RegExp(uge,"i"),[uge,""]],[new RegExp(gge,"i"),[gge,""]],[kDe,[Age,""]],[new RegExp(PDe,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[bLt,""];if(new RegExp(YO).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){let o=bHo[n[1]]||"";return/arm/i.test(e)&&(o="RT"),[PDe,o]}return[PDe,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Bo(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[S$,[t[2],t[3],t[4]||"0"].join(".")]:[S$,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],GLt=function(t){for(let e=0;OLt.length>e;e++){const[n,o]=OLt[e],i=n.exec(t),r=i&&(nf(o)?o(i,t):o);if(r)return r}return["",""]},YLt=function(t){return BHo.test(t)?uge:EHo.test(t)?gge:xHo.test(t)?dge:new RegExp(MDe,"i").test(t)?MDe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?bLt:/iPad/.test(t)?hLt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?pLt:kDe.test(t)?Age:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(SLt,"i").test(t)?SLt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(YO).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?S$:dLt:new RegExp("(pda|Mobile)","i").test(t)?yHo:new RegExp(sge,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?QLt:""},vHo=function(t,e){var n;const o=YLt(t);return o===hLt||o===dLt||o==="Kobo"||o==="Kindle Fire"||o===QLt?sge:o===uge||o===dge||o===gge||o===MDe?"Console":o===pLt?"Wearable":o?YO:e?.userAgentDataPlatform==="Android"&&((n=e?.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((i=e?.screenWidth)!==null&&i!==void 0?i:0,(r=e?.screenHeight)!==null&&r!==void 0?r:0)/((s=e?.devicePixelRatio)!==null&&s!==void 0?s:1)?YO:sge:"Desktop";var i,r,s},FDe=/\bFBAV\/(\d+(?:\.\d+)*)/i,ULt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",FDe],[/\bFBAN\/EMA\b/i,"Facebook Lite",FDe],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",FDe],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],LDe="[Truncated]",Q$="[Unserializable]";function UO(t){let e="";for(let n=0;t.length>n;n++){const o=t.charCodeAt(n);if(55296>o||o>56319)e+=56320>o||o>57343?t[n]:"�";else{const i=t.charCodeAt(n+1);56320>i||i>57343?e+="�":(e+=t[n]+t[n+1],n++)}}return e}function KLt(t,e){if(!e)return t;let n=[];try{n=Object.keys(e)}catch{n=[]}for(const o of n){let i;try{i=e[o]}catch{i=Q$}Object.defineProperty(t,o,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}const hge=3e5;var VLt=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const n=this.isOpen(),o=Date.now(),i=Math.min(e.retryAfterMs,hge);if(!n)return this.ts=o,void(this.es=o+i);this.es=Math.max(this.es,Math.min(o+i,this.ts+hge))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const n=Math.min(hge,Math.max(0,this.es-e));return n===0&&this.reset(),n}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const wHo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function zLt(t,e){return typeof(n=t)=="string"&&wHo.test(n)?t:e();var n}function JLt(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Qw(t){return t&&t.split("#")[0]}function WLt(t){try{return t()}catch{return}}function jLt(t,e){const n=setTimeout(t,e);return n!=null&&n.unref&&n?.unref(),n}function $Lt(t,e,n){return qLt.apply(this,arguments)}function qLt(){return(qLt=eg(function*(t,e,n){let o;try{return yield Promise.race([t,new Promise((i,r)=>{o=jLt(()=>{try{n?.(),i()}catch(s){r(s)}},e)})])}finally{clearTimeout(o)}})).apply(this,arguments)}let pge,XLt,HDe;function PHo(t){const e=globalThis._posthogChunkIds;if(!e)return;const n=Object.keys(e);return HDe&&n.length===XLt||(XLt=n.length,HDe=n.reduce((o,i)=>{pge||(pge={});const r=pge[i];if(r)o[r[0]]=r[1];else{const s=t(i);for(let a=s.length-1;a>=0;a--){const A=s[a],c=A?.filename,l=e[i];if(c&&l){o[c]=l,pge[i]=[c,l];break}}}return o},{})),HDe}function v$(t){return v$=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v$(t)}function MHo(t,e,n){return(e=(function(o){var i=(function(r){if(v$(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var a=s.call(r,"string");if(v$(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(o);return v$(i)=="symbol"?i:i+""})(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZLt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function sn(t){for(var e=1;arguments.length>e;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZLt(Object(n),!0).forEach(function(o){MHo(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZLt(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}var DHo=class{constructor(e,n,o=[]){this.coercers=e,this.stackParser=n,this.modifiers=o}buildFromUnknown(e,n={}){const o=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(o,n,0).apply(e),r=this.buildParsingContext(n),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,o),$exception_level:"error"}}modifyFrames(e){var n=this;return eg(function*(){for(const o of e)o.stacktrace&&o.stacktrace.frames&&as(o.stacktrace.frames)&&(o.stacktrace.frames=yield n.applyModifiers(o.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var o;let i,r;if(e.cause!=null&&(i=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)}catch{}return sn(sn({},e),{},{cause:i,stack:r,errors:(o=e.errors)===null||o===void 0?void 0:o.map(s=>this.parseStacktrace(s,n))})}applyChunkIds(e,n){return e.map(o=>(o.filename&&n&&(o.chunk_id=n[o.filename]),o))}applyCoercers(e,n){for(const o of this.coercers)if(o.match(e))return o.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return eg(function*(){let o=e;for(const i of n.modifiers)o=yield i(o);return o})()}convertToExceptionList(e,n){const o=[],i=(r,s,a)=>{var A;const c=o.length,l=s===void 0?sn(sn({type:typeof n.type=="string"&&n.type.length>0?n.type:"generic"},typeof n.handled=="boolean"?{handled:n.handled}:n.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof n.synthetic=="boolean"?n.synthetic:r.synthetic,exception_id:c}):{type:"chained",source:a,synthetic:r.synthetic,exception_id:c,parent_id:s},u={type:r.type,value:r.value,mechanism:l};r.stack&&(u.stacktrace={type:"raw",frames:r.stack}),o.push(u),r.cause&&i(r.cause,c,"cause");for(const g of(A=r.errors)!==null&&A!==void 0?A:[])i(g,c,"member")};return i(e),o}buildParsingContext(e){var n;return{chunkIdMap:PHo(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}getAggregateErrors(e){try{if(GO(e)){let o=Object.getPrototypeOf(e);for(let i=0;o&&100>i;i++){var n;const r=(n=Object.getOwnPropertyDescriptor(o,"constructor"))===null||n===void 0?void 0:n.value;if(typeof r=="function"&&r.name==="AggregateError"){const s=e.errors;return as(s)?s:void 0}o=Object.getPrototypeOf(o)}}}catch{}}buildCoercingContext(e,n,o=0){let i=0,r=0,s=!1;const a=new Set,A=[],c={},l=(h,d,p=0)=>{const m=u(d,p),_=m.apply;if(m.apply=E=>{A.push(h);try{return _(E)}finally{A.pop()}},p>4||p>0&&A.indexOf(h)!==-1)return this.coerceFallback(m);const f=typeof h=="object"&&h!==null||typeof h=="function";if(p===0&&i>=50||f&&a.has(h))return;f&&a.add(h),p===0&&i++;const I=this.getAggregateErrors(h);let C,y;s||(s=!!I);try{if(C=this.applyCoercers(h,m),!C)throw c}catch(E){if(E===c)return void(p===0&&i--);if(!s)throw E;C=this.coerceFallback(m)}if(!I||i>=50)return C;try{y=I.length}catch{return C}if(!Number.isInteger(y)||0>y||y>4294967295)return C;const x=[];for(let E=0;50>i&&1e3>r&&y>E;E++){let B;r++;try{B=m.next(I[E])}catch{i++,B=this.coerceFallback(u(d+1))}B&&x.push(B)}return sn(sn({},C),{},{errors:x})},u=(h,d=0)=>sn(sn({},n),{},{syntheticException:h==0?n.syntheticException:void 0,mechanism:h==0?e:{},apply(p){const m=l(p,h,d+1);if(!m)throw c;return m},next:p=>l(p,h+1)}),g=u(o);return sn(sn({},g),{},{apply:h=>{var d;return(d=l(h,o))!==null&&d!==void 0?d:this.coerceFallback(g)}})}};const NHo=/^([a-z][a-z0-9.+-]+):/i,RHo=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function THo(t){if(!t||t==="<anonymous>")return!1;const e=NHo.exec(t);return!e||RHo.includes(e[1].toLowerCase())}function ODe(t,e,n,o,i){const r={platform:t,filename:e,function:n==="<anonymous>"?"?":n,in_app:THo(e)};return Bo(o)||(r.lineno=o),Bo(i)||(r.colno=i),r}const eHt=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,o=t.indexOf("safari-web-extension")!==-1;return n||o?[t.indexOf("@")!==-1?t.split("@")[0]:"?",n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},kHo=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,FHo=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,LHo=/\((\S*)(?::(\d+))(?::(\d+))\)/,HHo=(t,e)=>{const n=kHo.exec(t);if(n){const[,i,r,s]=n;return ODe(e,i,"?",+r,+s)}const o=FHo.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){const s=LHo.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}const[i,r]=eHt(o[1]||"?",o[2]);return ODe(e,r,i,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},OHo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,GHo=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,YHo=(t,e)=>{const n=OHo.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const r=GHo.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}let o=n[3],i=n[1]||"?";return[i,o]=eHt(i,o),ODe(e,o,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},tHt=/\(error: (.*)\)/;function GDe(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function UHo(t){for(let e=1;10>=e;e++){const n=t.length-2*e;if(0>n)break;let o=!0;for(let i=0;e>i;i++)if(!GDe(t[n+i],t[n+e+i])){o=!1;break}if(o){for(let i=0;e>i;i++)t[n+i]=t[n+e+i];return t.length=n+e,{start:n,length:e}}}}function KHo(t,e){const n=e.start+e.length,o=oHt(t,e);o&&t.splice(n+o===t.length?n:e.start,o)}function nHt(t,e){let n=e.start;for(;n>0&&GDe(t[n-1],t[n-1+e.length]);)n--;return e.start-n}function oHt(t,e){const n=e.start+e.length;let o=n;for(;t.length>o&&GDe(t[o],t[o-e.length]);)o++;return o-n}function VHo(t,e){const n=e[0];let o=t.length-(n?nHt(t,n):0);for(const i of e)o-=oHt(t,i);return o}function zHo(t,e,n){for(let o=0;t.length>o;o++){const i=t[(e+o)%t.length],r=t[(n+o)%t.length];if(i!==r)return r>i}return!1}var JHo=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){const o=rA(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:o?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${n}: ${e.message}`:n}isDOMException(e){return rge(e,"DOMException")}isDOMError(e){return rge(e,"DOMError")}},WHo=class{match(e){return GO(e)}coerce(e,n){var o;const i=this.getStack(e),r=i===void 0?(o=n.syntheticException)===null||o===void 0?void 0:o.stack:void 0,s=!!r;return{type:this.getType(e),value:this.getMessage(e,n),stack:i??r,cause:e.cause?n.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,n){const o=e.message;return String(o.error&&typeof o.error.message=="string"?o.error.message:o)}getStack(e){try{const n=e.stacktrace;if(typeof n=="string"&&n.length>0)return n;const o=e.stack;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}},jHo=class{match(e){return!!rge(e,"ErrorEvent")&&(e.error!=null||this.ur(e))}coerce(e,n){var o;if(e.error!=null)return n.apply(e.error);const i=n.apply(e.message);return sn(sn({},i),{},{stack:(o=this.cr(e))!==null&&o!==void 0?o:i.stack,synthetic:!0})}ur(e){return rA(e.message)&&e.message.length>0}cr(e){var n,o;const i=e,r=(n=i.lineno)!==null&&n!==void 0?n:0,s=(o=i.colno)!==null&&o!==void 0?o:0;if(rA(i.filename)&&i.filename.length!==0&&r!==0)return`Error
|
|
1068
|
-
at ${i.filename}:${r}:${s}`}};const $Ho=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var qHo=class{match(e){return typeof e=="string"}coerce(e,n){var o;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}getInfos(e){let n="Error",o=e;const i=e.match($Ho);return i&&(n=i[1],o=i[2]),[n,o]}};const XHo=["fatal","error","warning","log","info","debug"];function iHt(t,e=40){const n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(e>=i.length)return o===n.length?i:i.length>e?`${i.slice(0,e)}...`:i}return""}var ZHo=class{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var o,i;const r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(o=this.getStack(e))!==null&&o!==void 0?o:(i=n.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(vDe(e))return e.constructor.name;const n="name"in e?e.name:void 0;return rA(n)&&!b$(n)?n:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let o=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(o+=` with message: '${e.message}'`),o}if("message"in e&&typeof e.message=="string")return e.message;const n=this.getObjectClassName(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${iHt(e)}`}isSeverityLevel(e){return rA(e)&&!b$(e)&&XHo.indexOf(e)>=0}getStack(e){try{return rA(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:rA(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(GO(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},eOo=class{match(e){return vDe(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${iHt(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},tOo=class{match(e){return cLt(e)}coerce(e,n){var o;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},nOo=class{match(e){return rge(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!vDe(e))return!1;try{const n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var o;const i=this.getUnhandledRejectionReason(e);return cLt(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const mge="$message",_ge="$timestamp",oOo=new Set([mge,_ge]),YDe={enabled:!0,max_bytes:32768};function fge(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:YDe.enabled,max_bytes:rOo(t.max_bytes,YDe.max_bytes)}:sn({},YDe)}var iOo=class{constructor(e){this.ns=[],this.ss=0,this.Rr=fge(e)}setConfig(e){this.Rr=fge(e),this.rs()}add(e){const n=(function(i){let r;try{r=aLt(i)}catch{return}try{const s=JSON.parse(r);if(!QA(s))return;const a=s,A=a[mge],c=a[_ge];return!rA(A)||A.trim().length===0||!rA(c)&&!sh(c)?void 0:{step:a,json:r}}catch{return}})(e);if(!n)return;const o=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let s=0;for(let a=0;r.length>a;a++)r[a]==="%"?(s+=1,a+=2):s+=1;return s})(n.json);o>this.Rr.max_bytes||(this.ns.push({step:n.step,bytes:o}),this.ss+=o,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function rOo(t,e){if(!sh(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const rHt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function sHt(t){return typeof t=="string"||t}function aHt(t){return typeof t=="string"?t:void 0}const sOo=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],AHt="NativeGzipValidationError",UDe=t=>t.length>=2&&t[0]===31&&t[1]===139,cHt=(t,e)=>t===bDe.GZipJS||e===bDe.GZipJS||e==="gzip",lHt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let w$;const Ige=t=>{throw JLt(AHt,`Native gzip produced invalid output: ${t}`)},aOo=(uHt=eg(function*(t,e){18>t.size&&Ige("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());UDe(n)&&n[2]===8||Ige("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(w$)return w$;w$=[];for(let A=0;256>A;A++){let c=A;for(let l=0;8>l;l++)c=1&c?3988292384^c>>>1:c>>>1;w$[A]=c>>>0}return w$})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&Ige("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&Ige("invalid-size")}),function(t,e){return uHt.apply(this,arguments)});var uHt;function KDe(){return KDe=eg(function*(t,e=!0,n){try{const i=new TextEncoder().encode(t),r=new globalThis.CompressionStream("gzip"),s=r.writable.getWriter(),a=s.write(i).then(()=>s.close()).catch((o=eg(function*(l){try{yield s.abort(l)}catch{}throw l}),function(l){return o.apply(this,arguments)})),A=new Response(r.readable).blob(),[c]=yield Promise.all([A,a]);return yield aOo(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),KDe.apply(this,arguments)}function gHt(t,e){if(t==null)return{};var n,o,i=(function(s,a){if(s==null)return{};var A={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.includes(c))continue;A[c]=s[c]}return A})(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;r.length>o;o++)e.includes(n=r[o])||{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}const AOo={}.propertyIsEnumerable;function Cge(t,e){try{return dHt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function VDe(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:LDe};if(n.remainingNodes--,jy(t))return{boolValue:t};if(typeof t=="bigint")return(function(i,r){const s=i.toString(),a=BigInt("9223372036854775808");return i>=a||-a>i?(r?.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}})(t,e);if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=9223372036854776e3||-9223372036854776e3>t?(e?.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:UO(t)};if(typeof t=="function")return{stringValue:"[Function]"};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:"[Circular]"};if(o>=20)return{stringValue:LDe};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?UO(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return VDe(i.call(t),e,n,o+1)}catch{}return as(t)?{arrayValue:{values:cOo(t,e,n,o+1)}}:{kvlistValue:{values:dHt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:UO(String(t))}}function cOo(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(Us(a))continue;i.push(VDe(a,e,n,o))}catch{i.push({stringValue:Q$})}return t.length>s&&i.push({stringValue:LDe}),i}function dHt(t,e,n,o){const i=[];for(const r in t)if(AOo.call(t,r)){if(!r){e?.debug("Dropping an attribute with an empty key");continue}if(i.length>=1e3||0>=n.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const s=t[r];if(Id(s)||Bo(s))continue;i.push({key:UO(r),value:VDe(s,e,n,o)})}catch{i.push({key:UO(r),value:{stringValue:Q$}})}}return i}function hHt(t,e,n){return sn(sn(sn(sn({},KLt({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}const lOo=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function pHt(t,e){const n=KLt({},t),o={};for(const i of lOo)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...Cge(n,e),...Cge(o,e)]}const mHt={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},_Ht={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},uOo=_Ht.info;function gOo(t){try{return UO(String(t))}catch{return Q$}}function dOo(t,e,n,o){const i=t.level||"info",{text:r,number:s}=_Ht[i]||uOo,a=(function(g=Date.now()){return String(g)+"000000"})(sh(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Us(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Us(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=sn({},A),l=t.attributes;if(l){let g=[];try{g=Object.keys(l)}catch{g=[]}for(const h of g){let d;try{d=l[h]}catch{d=Q$}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const u={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:gOo(t.body)},attributes:Cge(c,n)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),Bo(t.trace_flags)||(u.flags=t.trace_flags),u}function fHt(t,e,n){return hHt(t,e,n)}function IHt(t,e,n,o){return{resourceLogs:[{resource:{attributes:pHt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var CHt=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=jLt(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function yHt(){return .75+.5*Math.random()}function xHt(t,e,n,o){const i=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,i);return Math.round(Math.min(r,Math.max(o,t))*n)}var hOo=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Rr=n,this.$=o,this.cs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new CHt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new VLt,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=n.maxBufferSize,this.Is=Math.max((A=n.maxQueueSize)!==null&&A!==void 0?A:n.maxBufferSize,n.maxBufferSize),this.Ms=n.flushIntervalMs,this.Es=n.maxBatchRecordsPerPost,this.Ps=n.rateCapWindowMs,this.Rs=n.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(c6.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:dOo(i,(o=n?.context)!==null&&o!==void 0?o:this.cs(),this.$,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=as(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return eg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return eg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(c6.LogsQueue))!==null&&n!==void 0?n:[];if(o.length===0)return;const i=o.length;let r=0;for(;o.length>0&&i>r;){var s,a;const A=e._s;e.bs=0;const c=Math.min(o.length,e.Es),l=o.slice(0,c),u=IHt(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.js(u);if(e._s!==A)return;if(g.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(g),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),g.kind==="retry-later"||(g.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):g.kind==="ok"&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(c6.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,g.kind==="fatal"))throw g.error}})()}Bs(e){var n=this;return eg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(c6.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(c6.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return fHt(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(c6.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(c6.LogsQueue,o),this.Ts>o.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(xHt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(c6.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return eg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield $Lt(o,e):yield o})()}flushWithTimeout(e){var n=this;return eg(function*(){const o=n.flush();yield $Lt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=yHt(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const zDe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function EHt(t){return String(t)+"000000"}function BHt(t,e,n,o){let i="";return o&&(i=Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(o[r])}`).join(",")),`${t}\0${e}\0${n??""}\0${i}`}var pOo=class{constructor(e,n,o){this._instance=e,this.Rr=n,this.$=o,this.zs=new Map,this.ps=new CHt(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new VLt,this.ks=0,this.Ss=1,this.Gs=0}count(e,n=1,o){this.Zs({name:e,type:"count",value:n,unit:o?.unit,attributes:o?.attributes})}gauge(e,n,o){this.Zs({name:e,type:"gauge",value:n,unit:o?.unit,attributes:o?.attributes})}histogram(e,n,o){this.Zs({name:e,type:"histogram",value:n,unit:o?.unit,attributes:o?.attributes})}flush(){var e=this;const n=this.ys,o=(function(){var i=eg(function*(){n&&(yield n.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===o&&(this.ys=null)});return this.ys=o,o}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const n=this.Os(e);if(n===null)return;if(!n.name||typeof n.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.$.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.$.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?sn({},n.attributes):void 0,i=BHt(n.type,n.name,n.unit,o)}catch(a){return void this.$.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:n.name,type:n.type,unit:n.unit,attributes:o,windowStartMs:Date.now()},this.zs.set(i,r)}const s=this.Ws.get(n.name);s===void 0?this.Ws.set(n.name,n.type):s===n.type||this.Vs.has(n.name)||(this.Vs.add(n.name),this.$.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,n){switch(e.type){case"count":var o;e.total=((o=e.total)!==null&&o!==void 0?o:0)+n;break;case"gauge":e.last=n;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:n,max:n,bucketCounts:new Array(zDe.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=n,i.min=Math.min(i.min,n),i.max=Math.max(i.max,n),i.bucketCounts[(function(r,s){for(let a=0;s.length>a;a++)if(s[a]>=r)return a;return s.length})(n,zDe)]+=1;break}}}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=as(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(xHt(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return eg(function*(){if(e.ps.clear(),e.zs.size===0)return;const n=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const o=e.Gs,i=yield e._instance.Ys(e.Js(n));if(o===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=yHt()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.ho(n),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.vo(e),o=(function(s,a,A){return hHt(s,a,A)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:pHt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}vo(e){const n=EHt(Date.now()),o=new Map;for(const a of e.values()){var i;const A=BHt(a.type,a.name,a.unit,void 0);let c=o.get(A);c||(c=sn({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},o.set(A,c));const l=Cge((i=a.attributes)!==null&&i!==void 0?i:{},this.$),u=EHt(a.windowStartMs);if(a.type==="count"){var r;const g={attributes:l,startTimeUnixNano:u,timeUnixNano:n,asDouble:(r=a.total)!==null&&r!==void 0?r:0};c.sum.dataPoints.push(g)}else if(a.type==="gauge"){var s;const g={attributes:l,timeUnixNano:n,asDouble:(s=a.last)!==null&&s!==void 0?s:0};c.gauge.dataPoints.push(g)}else a.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:n,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:zDe})}return Array.from(o.values())}ho(e){for(const[i,r]of e){const s=this.zs.get(i);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,r.windowStartMs),s.type){case"count":var n,o;s.total=((n=s.total)!==null&&n!==void 0?n:0)+((o=r.total)!==null&&o!==void 0?o:0);break;case"gauge":break;case"histogram":if(r.hist)if(s.hist){s.hist.count+=r.hist.count,s.hist.sum+=r.hist.sum,s.hist.min=Math.min(s.hist.min,r.hist.min),s.hist.max=Math.max(s.hist.max,r.hist.max);for(let a=0;s.hist.bucketCounts.length>a;a++)s.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else s.hist=r.hist}else this.Ks()&&this.zs.set(i,r)}}};const bHt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Ln&&(Hb.DEBUG||Ln.POSTHOG_DEBUG||e)&&!Bo(Ln.console)&&Ln.console&&("__rrweb_original__"in Ln.console[o]?Ln.console[o].__rrweb_original__:Ln.console[o])(t,...i)},debug(...o){n.N("debug",...o)},info(...o){n.N("log",...o)},warn(...o){n.N("warn",...o)},error(...o){n.N("error",...o)},critical(...o){console.error(t,...o)},uninitializedWarning(o){n.error(`You must initialize PostHog before calling ${o}`)},createLogger:(o,i)=>bHt(`${t} ${o}`,i)};return n},ui=bHt("[PostHog.js]"),Cd=ui.createLogger,mOo=Cd("[ExternalScriptsLoader]"),yge=t=>{const e=No?.querySelectorAll("script");if(e){for(let n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},mR=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return mOo.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=yge(e);if(o){if(o.__posthog_loading_callback_fired)return n();const r=o.__posthog_loading_error;return r?n(r):(o.addEventListener("load",s=>{o.__posthog_loading_callback_fired=!0,n(void 0,s)}),void o.addEventListener("error",s=>{o.__posthog_loading_error=s,n(s)}))}const i=()=>{if(!No)return n("document not found");if(yge(e))return mR(t,e,n);let r=No.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=a=>{r.__posthog_loading_callback_fired=!0,n(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,n(a)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")No.head.appendChild(r);else{const a=No.querySelectorAll("body > script");var s;a.length>0?(s=a[0].parentNode)===null||s===void 0||s.insertBefore(r,a[0]):No.body.appendChild(r)}};No?.body?i():No?.addEventListener("DOMContentLoaded",i)},JDe={},SHt=(t,e)=>{let n=`/static/${e}.js?v=${t.version}`;return e==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),t.requestRouter.endpointFor("assets",n)};Vr.__PosthogExtensions__=Vr.__PosthogExtensions__||{},Vr.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void mR(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=JDe[i];if(o==="fallback"&&r){if(yge(r))return void mR(t,r,n);delete JDe[i]}return void mR(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=SHt(t,e);JDe[i]=c;const l=yge(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),mR(t,c,n)}else n(void 0,a)}:n)}mR(t,SHt(t,e),n)},Vr.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);mR(t,o,n)},Hb.DEBUG=!1,Hb.LIB_VERSION="1.434.15",Hb.LIB_NAME="web";var n_=Hb;const _Oo="$people_distinct_id",NB="distinct_id",WDe="$device_id",jDe="$device_model",xge="__alias",fOo="__cmpns",QHt="$fbc",KO="$fbc_persistence",vHt="$fbp",P$="$fbp_persistence",$De="__timers",wHt="$autocapture_disabled_server_side",qDe="$heatmaps_enabled_server_side",XDe="$exception_capture_enabled_server_side",PHt="$error_tracking_suppression_rules",ZDe="$error_tracking_capture_extension_exceptions",eNe="$web_vitals_enabled_server_side",tNe="$dead_clicks_enabled_server_side",nNe="$product_tours_enabled_server_side",MHt="$logs_capture_enabled_server_side",DHt="$web_vitals_allowed_metrics",M$="$session_recording_remote_config",IOo="$session_recording_enabled_server_side",COo="$replay_sample_rate",yOo="$replay_override_sampling",xOo="$replay_override_linked_flag",EOo="$replay_override_url_trigger",BOo="$replay_override_event_trigger",VO="$sesid",NHt="$session_is_sampled",bOo="$session_past_minimum_duration",SOo="$session_recording_url_trigger_activated_session",QOo="$session_recording_event_trigger_activated_session",vOo="$debug_first_full_snapshot_timestamp",wOo="$sess_rec_flush_size",RB="$enabled_feature_flags",Gb="$active_feature_flags",oNe="$early_access_features",_R="$feature_flag_details",vw="$feature_flag_payloads",fR="$feature_flag_request_id",D$="$minimal_flag_called_events",u6="$override_feature_flags",IR="$override_feature_flag_payloads",ww="$stored_person_properties",Pw="$stored_group_properties",RHt="$groups",iNe="$surveys",Ege="$surveys_loaded_at",THt="$surveys_activated",kHt="$surveys_activated_session",FHt="$surveys_activated_timestamps",rNe="ph_product_tours",POo="$product_tours_activated",MOo="$product_tours_activated_session",DOo="$conversations_widget_session_id",NOo="$conversations_ticket_id",ROo="$conversations_widget_state",TOo="$conversations_user_traits",Mw="$flag_call_reported",N$="$flag_call_reported_session_id",R$="$feature_flag_errors",Dw="$feature_flag_evaluated_at",$y="$user_state",sNe="$client_session_props",kOo="$capture_rate_limit",LHt="$initial_campaign_params",HHt="$initial_referrer_info",zO="$initial_person_info",aNe="$epp",ANe="$posthog_cookieless",OHt="$cookieless_mode",GHt="$sdk_debug_extensions_init_method",YHt="$sdk_debug_extensions_init_time_ms",UHt="$sdk_debug_recording_script_not_loaded",KHt="$sdk_debug_replay_stale_config",FOo="$sdk_debug_replay_event_trigger_status",LOo="$sdk_debug_replay_linked_flag_trigger_status",HOo="$sdk_debug_replay_matched_recording_trigger_groups",OOo="$sdk_debug_replay_pending_trigger_conditions",GOo="$sdk_debug_replay_remote_trigger_matching_config",YOo="$sdk_debug_replay_trigger_groups_count",UOo="$sdk_debug_replay_url_trigger_status",KOo="$session_recording_start_reason",cNe="PostHog loadExternalDependency extension not found.",Yb="anonymous",Bge="identified",VHt="identified_only",T$="visibilitychange",bge="beforeunload",lNe="$pageview",zHt="$pageleave",JHt="$identify",WHt="$groupidentify";function JO(t,e){as(t)&&t.forEach(e)}function Tl(t,e){if(!Us(t))if(as(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)QDe.call(t,n)&&e(t[n],n)}const Mu=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function Sge(t){const e=Object.keys(t);let n=e.length;const o=new Array(n);for(;n--;)o[n]=[e[n],t[e[n]]];return o}const VOo=function(t){return function(...e){try{return t.apply(this,e)}catch(n){ui.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ui.critical(n)}}},uNe=function(t){const e={};return Tl(t,function(n,o){(rA(n)&&n.length>0||sh(n))&&(e[o]=n)}),e};function jHt(t){const e=sn({},t);for(const n of["name","message","stack","cause","errors"])try{n in t&&(e[n]=t[n])}catch{}return e}const zOo=["herokuapp.com","vercel.app","netlify.app"];function JOo(t){const e=t?.hostname;if(!rA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of zOo)if(n===o)return!1;return!0}function Cl(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function gNe(t){return t.name==="ph_toolbar_internal"}const k$=t=>{if(No){try{const e=t+"=",n=No.cookie.split(";").filter(o=>o.length);for(let o=0;n.length>o;o++){let i=n[o];for(;i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return sh(t)&&isFinite(t)&&Math.floor(t)===t});var WOo=class pit{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,o,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(o)||!Number.isInteger(i)||0>e||0>n||0>o||0>i||e>0xffffffffffff||n>4095||o>1073741823||i>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|n>>>8,r[7]=n,r[8]=128|o>>>24,r[9]=o>>>16,r[10]=o>>>8,r[11]=o,r[12]=i>>>24,r[13]=i>>>16,r[14]=i>>>8,r[15]=i,new pit(r)}toString(){let e="";for(let n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new pit(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;16>n;n++){const o=this.bytes[n]-e.bytes[n];if(o!==0)return Math.sign(o)}return 0}},jOo=class{generate(){const e=this.generateOrAbort();if(!Bo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Bo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return sh(n)&&isFinite(n)?Math.min(Math.max(Math.floor(n),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return WOo.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new $Oo}};let $Ht=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Ln&&!Bo(Ln.crypto)&&crypto.getRandomValues&&($Ht=t=>crypto.getRandomValues(t));var $Oo=class{nextUint32(){return this.Rt.length>this.$t||($Ht(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let qHt;const TB=()=>qOo().toString(),qOo=()=>(qHt||(qHt=new jOo)).generate();let F$="";const XOo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let WO=null;const yd={Et(){if(!Id(WO))return WO;if(WO=!1,No)try{const t=`__ph_cookie_support_${TB()}`;yd.At(t,"xyz"),WO=k$(t)==='"xyz"',yd.Lt(t)}catch{WO=!1}return WO},Pt(t){ui.error("cookieStore error: "+t)},Ot:k$,Dt(t){let e;try{e=JSON.parse(yd.Ot(t))||{}}catch{}return e},At(t,e,n,o,i){if(!No)return!1;try{let r="",s="";const a=(function(c,l){if(l){let u=(function(g,h=No){if(F$)return F$;if(!h||["localhost","127.0.0.1"].includes(g))return"";const d=g.split(".");let p=Math.min(d.length,8);const m="dmn_chk_"+TB();for(;!F$&&p--;){const _=d.slice(p).join("."),f=m+"=1;domain=."+_+";path=/";h.cookie=f+";max-age=3",h.cookie.includes(m)&&(h.cookie=f+";max-age=0",F$=_)}return F$})(c);if(!u){const g=(h=>{const d=h.match(XOo);return d?d[0]:""})(c);g!==u&&ui.info("Warning: cookie subdomain discovery mismatch",g,u),u=g}return u?"; domain=."+u:""}return""})(No.location.hostname,o);if(n){const c=new Date;c.setTime(c.getTime()+864e5*n),r="; expires="+c.toUTCString()}i&&(s="; secure");const A=t+"="+encodeURIComponent(JSON.stringify(e))+r+"; SameSite=Lax; path=/"+a+s;return A.length>3686.4&&ui.warn("cookieStore warning: large cookie, len="+A.length),No.cookie=A,!0}catch{return!1}},Lt(t,e){if(No?.cookie&&(!e||!Id(k$(t))))try{yd.At(t,"",-1,e)}catch{return}}};let dNe=null;const hc={Et(){if(!Id(dNe))return dNe;let t=!0;if(Bo(Ln))t=!1;else try{const e="__mplssupport__";hc.At(e,"xyz"),hc.Ot(e)!=='"xyz"'&&(t=!1),hc.Lt(e)}catch{t=!1}return t||ui.error("localStorage unsupported; falling back to cookie store"),dNe=t,t},Pt(t){ui.error("localStorage error: "+t)},Ot(t){try{return Ln?.localStorage.getItem(t)}catch(e){hc.Pt(e)}return null},Dt(t){try{return JSON.parse(hc.Ot(t))||{}}catch{}return null},At(t,e){try{return Ln?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){hc.Pt(n)}return!1},Lt(t){try{Ln?.localStorage.removeItem(t)}catch(e){hc.Pt(e)}}},hNe=[ww,Gb,RB,_R,vw,fR,Dw,R$,Mw],CR=[WDe,NB,VO,NHt,aNe,zO,KO,$y],Qge=t=>t+"_cpm",ZOo=["__proto__","constructor","prototype"],pNe=t=>{if(!QA(t))return{};const e={};return Object.keys(t).forEach(n=>{ZOo.indexOf(n)===-1&&(e[n]=t[n])}),e},mNe=(t,e=[])=>{const n={};return[...CR,...e].forEach(o=>{const i=t[o];Bo(i)||Id(i)||i===""||(n[o]=i)}),n},XHt=t=>{let e=5381,n=2166136261;for(let o=0;t.length>o;o++){const i=t.charCodeAt(o);e=33*e^i,n=Math.imul(n^i,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},ZHt=(t,e)=>({p:e,f:XHt(JSON.stringify(t))}),eOt=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=yd.Dt(Qge(t)),o=n?.f===XHt(e)&&as(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},_Ne=(t,e)=>e+"|"+(yd.Ot(Qge(t))||""),jO={},fNe={Et:()=>!0,Pt(t){ui.error("memoryStorage error: "+t)},Ot:t=>t in jO?jO[t]:null,Dt:t=>t in jO?jO[t]:null,At:(t,e)=>(jO[t]=e,!0),Lt(t){delete jO[t]}};let yR=null;const nu={Et(){if(!Id(yR))return yR;if(yR=!0,Bo(Ln))yR=!1;else try{const t="__support__";nu.At(t,"xyz"),nu.Ot(t)!=='"xyz"'&&(yR=!1),nu.Lt(t)}catch{yR=!1}return yR},Pt(t){ui.error("sessionStorage error: ",t)},Ot(t){try{return Ln?.sessionStorage.getItem(t)}catch(e){nu.Pt(e)}return null},Dt(t){try{return JSON.parse(nu.Ot(t))||null}catch{}return null},At(t,e){try{return Ln?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){nu.Pt(n)}return!1},Lt(t){try{Ln?.sessionStorage.removeItem(t)}catch(e){nu.Pt(e)}}};var eGo=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get No(){const e=this.qo.Ot(this.jo);return wDe(e)?1:Is(fHo,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,n=e==="localStorage"?hc:yd,o=n.Et()?n:fNe;if(!this.Bo||this.Bo!==o){this.Bo=o;const i=e==="localStorage"?yd:hc;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(wDe(i.Ot(this.jo))),i.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[tf?.doNotTrack,tf?.msDoNotTrack,Vr.doNotTrack,tf?.globalPrivacyControl].some(e=>wDe(e))}};function tOt(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!nf(o))return e;try{const i=o(e);return rA(i)&&i?i:e}catch(i){return ui.error("Error in get_current_url, falling back to window.location.href",i),e}}function nOt(t){var e;return t instanceof Element&&(t.id==="__POSTHOG_TOOLBAR__"||!!(!((e=t.closest)===null||e===void 0)&&e.call(t,".toolbar-global-fade-container")))}function g6(t){return!!t&&t.nodeType===1}function AI(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function oOt(t){return!!t&&t.nodeType===3}function INe(t){return!!t&&t.nodeType===11&&g6(t.host)}function CNe(t){return t?oge(t).split(/\s+/):[]}function iOt(t,e){const n=(function(o){var i;const r=Ln==null||(i=Ln.location)===null||i===void 0?void 0:i.href;return Bo(r)?void 0:tOt(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function $O(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return CNe(e)}function rOt(t){return Us(t)?null:oge(t).split(/(\s+)/).filter(e=>G$(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function L$(t){let e="";return qO(t)&&!O$(t)&&t.childNodes&&t.childNodes.length&&Tl(t.childNodes,function(n){var o;oOt(n)&&n.textContent&&(e+=(o=rOt(n.textContent))!==null&&o!==void 0?o:"")}),oge(e)}function H$(t){var e;return Bo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const yNe=["a","button","form","input","select","textarea","label"];function xNe(t,e){const n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!n&&n.call(t,e)}catch{return!1}}function ENe(t,e){if(Bo(e))return!0;for(const n of t)if(e.some(o=>xNe(n,o)))return!0;return!1}function sOt(t){const e=t.parentNode;return!(!e||!g6(e))&&e}const BNe=[".ph-no-autocapture","[data-ph-no-autocapture]"],aOt=["next","previous","prev",">","<"],tGo=[...aOt,"+","-","−","–"],AOt=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,cOt=[".ph-no-rageclick",".ph-no-capture"],nGo=["","text","search","email","password","url","tel","number"];function lOt(t,e){if(!Ln||bNe(t))return!1;let n,o,i;var r,s;if(jy(e)?(n=!!e&&cOt,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:cOt,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!g6(A))&&(!!AI(A,"textarea")||(AI(A,"input")?Is(nGo,(A.getAttribute("type")||"").toLowerCase()):(function(c){var l;if(c.isContentEditable)return!0;const u=(l=c.getAttribute)===null||l===void 0?void 0:l.call(c,"contenteditable");return u==="true"||u===""})(A)))})(t))return!1;const{targetElementList:a}=uOt(t,!1);return!(function(A,c){if(A===!1||Bo(A))return!1;let l;if(A===!0)l=aOt;else{if(!as(A))return!1;if(A.length>10)return ui.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;l=A.map(u=>u.toLowerCase())}return c.some(({safeText:u,ariaLabel:g})=>l.some(h=>AOt(u,h)||AOt(g,h)))})(o,a.map(A=>{var c;return{safeText:L$(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!ENe(a,n)}const bNe=t=>!t||AI(t,"html")||!g6(t),uOt=(t,e)=>{if(!Ln||bNe(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!AI(i,"body");){if(INe(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=sOt(i);if(!r)break;if(e||yNe.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Ln.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function qO(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!AI(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=$O(r);if(Is(s,"ph-sensitive")||Is(s,"ph-no-capture"))return!1}if(Is($O(t),"ph-include"))return!0;const o=t.type||"";if(rA(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!rA(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function O$(t){return!!(AI(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||AI(t,"select")||AI(t,"textarea")||t.getAttribute("contenteditable")==="true")}const gOt=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),dOt=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,oGo=[16,15,14,13],iGo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),hOt=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),pOt=/[0-9A-Za-z_]/;function rGo(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function G$(t,e=!0){return!(Us(t)||rA(t)&&(t=oge(t),(e?gOt.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(dOt.lastIndex=0;o=dOt.exec(n);){const i=o[2];if(!i)continue;const r=i.replace(/[- ]/g,"");for(let s=0;r.length>s;s++)for(const a of oGo){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(gOt.test(c)&&rGo(c))return!0}}}return!1})(t))||(e?iGo.test(t):(function(n){let o;for(hOt.lastIndex=0;o=hOt.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&pOt.test(i)&&pOt.test(r)))return!0}return!1})(t))))}function mOt(t){let e=L$(t);return e=`${e} ${_Ot(t)}`.trim(),G$(e)?e:""}function _Ot(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Tl(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=L$(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${_Ot(n)}`.trim())}catch(i){ui.error("[AutoCapture]",i)}}),e}function fOt(t){return t.replace(/"|\\"/g,'\\"')}function sGo(t){const e=t.attr__class;if(e)return as(e)?e:CNe(e)}const vge=Cd("[Dead Clicks]"),aGo=()=>!0,AGo=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(tNe)),o=t.instance.config.capture_dead_clicks;return jy(o)?o:!!QA(o)||n};var IOt=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[tNe]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var n,o,i;!((n=Vr.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Vr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?vge.error("failed to load script",r):e()})}Uo(){var e;if(No){if(!this.Ho&&(!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=QA(this.instance.config.capture_dead_clicks)?sn({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Ho=Vr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ho.start(No),vge.info("starting...")}}else vge.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,vge.info("stopping..."))}};const Y$=Cd("[SegmentIntegration]");function COt(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>nf(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const u=h=>{const d=()=>h.anonymousId()||TB();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property($y,Bge)),c(l?void 0:h.anonymousId()||void 0)},g=A.user();"then"in g&&nf(g.then)?g.then(u):u(g)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||Y$.warn("This browser does not have Promise support, and can not use the segment integration");const u=(g,h)=>{if(!h)return g;const d=!!c&&g.event.anonymousId===c&&!g.event.userId;d||g.event.userId||g.event.anonymousId===A.get_distinct_id()||(Y$.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),g.event.userId&&g.event.userId!==A.get_distinct_id()&&(Y$.info("UserId set, identifying with PostHog"),A.identify(g.event.userId));let p=A.calculateEventProperties(h,g.event.properties);if(!Us(l)){const m=g.event.properties||{},_={};for(const I of Object.keys(p))QDe.call(m,I)||(_[I]=p[I]);const f=((I,C)=>{const y=as(I)?I:[I];let x=sn({},C);for(const E of y)try{if(x=E(x),Us(x))return null}catch(B){return Y$.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Us(f))return g;p=f}return g.event.properties=Object.assign({},p,g.event.properties),g};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(g){return u(g,g.event.event)},page(g){return u(g,lNe)},identify(g){return u(g,JHt)},screen(g){return u(g,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{Y$.error("Failed to register the Segment integration",A),e()})},n)}const yOt="posthog-js";function xOt(t,{organization:e,projectId:n,prefix:o,severityAllowList:i=["error"],sendExceptionsToPostHog:r=!0}={}){return s=>{var a,A,c,l,u;if(i!=="*"&&!i.includes(s.level)||!t.__loaded)return s;s.tags||(s.tags={});const g=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);s.tags["PostHog Person URL"]=g,t.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const h=((a=s.exception)===null||a===void 0?void 0:a.values)||[],d=h.map(_=>sn(sn({},_),{},{stacktrace:_.stacktrace?sn(sn({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(f=>sn(sn({},f),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:((A=h[0])===null||A===void 0?void 0:A.value)||s.message,$exception_type:(c=h[0])===null||c===void 0?void 0:c.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((l=h[0])===null||l===void 0?void 0:l.value)||s.message,$sentry_exception_type:(u=h[0])===null||u===void 0?void 0:u.type,$sentry_tags:s.tags};var m;return e&&n&&(p.$sentry_url=(o||"https://sentry.io/organizations/")+e+"/issues/?project="+n+"&query="+s.event_id),r&&((m=t.exceptions)===null||m===void 0||m.sendExceptionEvent(p)),s}}var cGo=class{constructor(e,n,o,i,r,s){this.name=yOt,this.setupOnce=function(a){a(xOt(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},EOt=class{constructor(e){this.Wo=(n,o,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ui.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){var e;this.Zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)===null||e===void 0||e.call(this),this.Zo=void 0}doPageView(e,n){var o;const i=this.Qo(e,n);return this.Vo={pathname:(o=Ln?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Qo(e,(n=this.Vo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,n){const o=this.Vo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:u}=r;if(!(Bo(s)||Bo(a)||Bo(A)||Bo(c)||Bo(l)||Bo(u))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);const g=s>1?l6(a/s,0,1,ui):1,h=s>1?l6(A/s,0,1,ui):1,d=c>1?l6(l/c,0,1,ui):1,p=c>1?l6(u/c,0,1,ui):1;i=Mu(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:g,$prev_pageview_max_scroll:A,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return o.pathname&&(i.$prev_pageview_pathname=o.pathname),o.timestamp&&(i.$prev_pageview_duration=(e.getTime()-o.timestamp.getTime())/1e3),i}};const U$=["flags","surveys"],lGo={[_Oo]:{exposure:"hidden"},[xge]:{exposure:"hidden"},[fOo]:{exposure:"hidden"},[$De]:{exposure:"hidden"},[KO]:{exposure:"hidden"},[P$]:{exposure:"hidden"},[wHt]:{exposure:"event"},[qDe]:{exposure:"hidden"},[MHt]:{exposure:"hidden"},[XDe]:{exposure:"event"},[PHt]:{exposure:"hidden"},[ZDe]:{exposure:"event"},[eNe]:{exposure:"event"},[tNe]:{exposure:"event"},[nNe]:{exposure:"hidden"},[DHt]:{exposure:"event"},[M$]:{exposure:"hidden"},[IOo]:{exposure:"hidden"},[VO]:{exposure:"hidden"},[NHt]:{exposure:"event"},[COo]:{exposure:"event",shouldSkipFromEventProperties:t=>Id(t)},[bOo]:{exposure:"event"},[SOo]:{exposure:"event"},[QOo]:{exposure:"event"},[vOo]:{exposure:"event"},[wOo]:{exposure:"hidden"},[RB]:{exposure:"hidden",storageGroup:"flags"},[Gb]:{exposure:"hidden",storageGroup:"flags"},[oNe]:{exposure:"hidden"},[_R]:{exposure:"hidden",storageGroup:"flags"},[vw]:{exposure:"hidden",storageGroup:"flags"},[fR]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[D$]:{exposure:"hidden",storageGroup:"flags"},[u6]:{exposure:"hidden"},[IR]:{exposure:"hidden"},[ww]:{exposure:"hidden"},[Pw]:{exposure:"hidden"},[iNe]:{exposure:"hidden",storageGroup:"surveys"},[Ege]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[THt]:{exposure:"event"},[kHt]:{exposure:"hidden"},[FHt]:{exposure:"hidden"},[rNe]:{exposure:"hidden"},[POo]:{exposure:"hidden"},[MOo]:{exposure:"hidden"},[DOo]:{exposure:"event"},[NOo]:{exposure:"event"},[ROo]:{exposure:"event"},[TOo]:{exposure:"event"},[Mw]:{exposure:"hidden"},[N$]:{exposure:"hidden"},[RHt]:{exposure:"event"},[R$]:{exposure:"hidden"},[Dw]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[$y]:{exposure:"hidden"},[sNe]:{exposure:"hidden"},[kOo]:{exposure:"hidden"},[LHt]:{exposure:"hidden"},[HHt]:{exposure:"hidden"},[zO]:{exposure:"hidden"},[aNe]:{exposure:"hidden"},[yOo]:{exposure:"event"},[xOo]:{exposure:"event"},[EOo]:{exposure:"event"},[BOo]:{exposure:"event"},[GHt]:{exposure:"event"},[YHt]:{exposure:"event"},[UHt]:{exposure:"event"},[KHt]:{exposure:"event"},[FOo]:{exposure:"event"},[LOo]:{exposure:"event"},[HOo]:{exposure:"event"},[OOo]:{exposure:"event"},[GOo]:{exposure:"event"},[YOo]:{exposure:"event"},[UOo]:{exposure:"event"},[KOo]:{exposure:"event"}},uGo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],i1=t=>{const e=lGo[t];if(e)return e;for(const[n,o]of uGo)if(t.indexOf(n)===0)return o},XO=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return GO(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,jHt(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return aLt(t)}},Ub=t=>{const e=No?.createElement("a");return Bo(e)?null:(e.href=t,e)},ZO=function(t,e){const n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let o;for(let i=0;n.length>i;i++){const r=n[i].split("=");if(r[0]===e){o=r;break}}if(!as(o)||2>o.length)return"";{let i=o[1];try{i=decodeURIComponent(i)}catch{ui.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")}},K$=function(t,e,n){if(!t||!e||!e.length)return t;const o=t.split("#"),i=o[1],r=(o[0]||"").split("?"),s=r[1],a=r[0],A=(s||"").split("&"),c=[];for(let u=0;A.length>u;u++){const g=A[u].split("=");as(g)&&(e.includes(g[0])?c.push(g[0]+"="+n):c.push(A[u]))}let l=a;return s!=null&&(l+="?"+c.join("&")),i!=null&&(l+="#"+i),l},wge=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},BOt=(t,e)=>t>=e&&sLt(),bOt=(t,e,n,o)=>{if(t===0){if(sLt()){const i=e+1;return i===n&&o(),i}return e}return 0},eG=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],gGo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...eG],V$="<masked>",dGo=["li_fat_id"];function SOt(t,e,n){if(!No)return{};const o=e?[...eG,...n||[]]:[],i=QOt(K$(No.URL,o,V$),t),r=(function(){const s={};return Tl(dGo,function(a){const A=k$(a);s[a]=A||null}),s})();return Mu(r,i)}function QOt(t,e){const n=gGo.concat(e||[]),o={};return Tl(n,function(i){const r=ZO(t,i);o[i]=r||null}),o}function vOt(t){const e=(function(i){return i?i.search("https?://(.*)google.([^/?]*)")===0?"google":i.search("https?://(.*)bing.com")===0?"bing":i.search("https?://(.*)yahoo.com")===0?"yahoo":i.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",o={};if(!Id(e)){o.$search_engine=e;const i=No?ZO(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function wOt(){return navigator.language||navigator.userLanguage}function hGo(){const t=wOt();return typeof t=="string"?t.split("-")[0]:void 0}const Pge="$direct";function POt(){return No?.referrer||Pge}function MOt(t,e,n=!1){const o=t?[...eG,...e||[]]:[],i=n?Qw(fd?.href):fd?.href,r=i?.substring(0,1e3);return{r:POt().substring(0,1e3),u:r?K$(r,o,V$):void 0}}function DOt(t,e=!1){var n;const{r:o,u:i}=t,r=e?Qw(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==Pge?Pge:(n=Ub(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=Ub(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=QOt(r);Mu(s,A)}if(o){const a=vOt(o);Mu(s,a)}return s}function NOt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function pGo(){try{return new Date().getTimezoneOffset()}catch{return}}const mGo={flags:Dw,surveys:Ege},_Go=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Mge=t=>`${t}_cookie_identity_change_pending`,Dge=t=>{let e="",n=0;for(const o of t){const i=encodeURIComponent(JSON.stringify(o).slice(1,-1)).length;if(n+i>1e3)break;e+=o,n+=i}return e},o_="main",Kb=[RB,Gb,_R,vw,fR,Dw,D$,ww],SNe=t=>Kb.indexOf(t)!==-1,ROt=[KO,P$],TOt=t=>ROt.indexOf(t)!==-1,Nw=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},tG=t=>{if(!t)return{};const e=JSON.parse(t);return QA(e)?e:{}},kOt=(t,e)=>{Tl(t,(n,o)=>{const i=i1(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var QNe=class{constructor(e,n,o=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=o,this.props={},this.ua=void 0,this.ha=(i=>{let r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&ui.info("Persistence loaded",e.persistence,sn({},this.props)),this.update_config(e,e,n),this.save(),Ln){const i=()=>this.flush();Cl(Ln,"beforeunload",i,{capture:!1}),Cl(Ln,"pagehide",i,{capture:!1}),this.fa=r=>{if(this.Ko&&(!r.storageArea||r.storageArea===Ln?.localStorage)&&r.key)if(r.key!==this.ha){if(this.Yo){const s=U$.find(a=>r.key===this.pa(a));s&&this.ga(r.key,s)}}else this.ga(r.key,o_)},Cl(Ln,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ia.get(n);if(!SNe(n)||i===!0)return;if(o===!0)return void this.ma(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ma(n,r)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&Ln&&(Ln.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,n,o=!0){if(this.mi)return!1;let i,r;try{if(r=hc.Ot(e),Id(r)){const A=this.ya(n);return A.storageValue=null,n!==o_&&(A.persisted=!1),!1}i=tG(r)}catch{return!1}const s=n===o_?i:hc.Dt(this.ha);if(s&&this.ba(s))return!1;const a=this._a(i,n,o);return n===o_&&this.Yo&&!Nw(this.wa().main,i)||this.ka(i,n,!0,r),a}ba(e){const n=this.props[NB],o=e[NB];return!Bo(n)&&!Bo(o)&&n!==o}ka(e,n,o,i){const r=this.ya(n);r.storageValue=i,n!==o_&&(r.persisted=o);try{r.fingerprint=this.Sa(e,n)}catch{r.fingerprint=void 0}}_a(e,n,o){let i=!1;return Kb.forEach(r=>{var s;const a=(s=i1(r))===null||s===void 0?void 0:s.storageGroup;if(n===o_&&this.Yo&&a||n!==o_&&a!==n)return;const A=r in e,c=this.xa(r,A?e[r]:void 0),l=this.ia.has(r)?r in this.props:A;l===r in this.props&&Nw(c,this.props[r])||(l?this.Ca(r,c,!1):this.$a(r,!1),i=!0)}),i&&o&&this.aa.forEach(r=>r()),i}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const e=hc.Ot(this.ha),n=this.ya(o_);let o,i=!1,r=!1;if(e!==n.storageValue)if(Id(e))n.storageValue=null;else{if(o=tG(e),this.ra=!this.sa&&this.ba(o),this.ra)return!1;r=this._a(o,o_,!1),!this.Yo||Nw(this.wa().main,o)?this.ka(o,o_,!0,e):n.storageValue=e,i=!0}return this.Yo&&U$.forEach(s=>{const a=hc.Ot(this.pa(s)),A=this.ya(s),c=o||{},l=i&&Kb.some(g=>{var h;return((h=i1(g))===null||h===void 0?void 0:h.storageGroup)===s&&g in c});if(a===A.storageValue&&!l)return;if(Id(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this._a(c,s,!1)||r));const u=tG(a);r=this._a(u,s,!1)||r,this.ka(u,s,!0,a)}),r}catch{return!1}}ma(e,n){this.ia.set(e,n);const o=i1(e);o?.volatile||(this.ya((this.Yo?o?.storageGroup:void 0)||o_).fingerprint=void 0,this.Ia(e))}Ma(){Kb.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=hc.Ot(this.ha),n=tG(e);this.ya(o_).storageValue=e,Kb.forEach(o=>{var i;const r=this.Yo?(i=i1(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?hc.Ot(this.pa(r)):null;if(r){const A=this.ya(r);A.storageValue=s,A.persisted=!Id(s)}const a=r&&!Id(s)?tG(s):n;o in this.props?this.Ea(o,a[o],this.props[o]):o in a&&this.ma(o,!0)})}catch{}}xa(e,n){const o=this.ia.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(as(n)?n:[]),a=new Set(as(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=QA(n)?sn({},n):{},r=QA(this.props[e])?this.props[e]:{};return o.forEach(s=>{s in r?i[s]=r[s]:delete i[s]}),i}Ea(e,n,o){if(!SNe(e))return;const i=this.ia.get(e);if(i===!0)return;let r=n;if(this.Ko)try{var s;const A=this.Yo?(s=i1(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.pa(A):this.ha;r=tG(hc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Bo(n)&&!as(n)||!Bo(r)&&!as(r)||!as(o))return void this.ma(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(u=>{A.has(u)!==l.has(u)&&a.add(u)}),a.forEach(u=>{c.has(u)===l.has(u)&&a.delete(u)})}else{if(!QA(o))return void(Nw(r,o)?this.ia.delete(e):this.ma(e,!0));{if(!Bo(n)&&!QA(n)||Bo(n)&&Nx(o)&&Bo(r))return void this.ma(e,!0);const A=QA(n)?n:{},c=QA(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&Nw(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&Nw(c[l],o[l])&&a.delete(l)})}}a.size?this.ma(e,a):this.ia.delete(e)}Pa(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return sh(n)&&n>0?n:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=mNe(e,this.Rr.cookie_persisted_properties||[]),o=ZHt(n,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=yd.Ot(this.ha)||void 0;r&&_Ne(this.ha,r)===i&&(this.Aa=i,this.Fa=r)}catch{}else try{const n=yd.Ot(this.ha)||void 0;this.Aa=n?_Ne(this.ha,n):void 0,this.Fa=n}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,n=!1){if(this.mi&&!n||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=yd.Ot(this.ha)||void 0}catch{}if(!o||o===this.Fa)return!1;const i=_Ne(this.ha,o);let r;try{r=pNe(JSON.parse(o))}catch{return!1}if((yd.Ot(this.ha)||void 0)!==o)return!1;this.Aa=i,this.Fa=o;const s=eOt(this.ha,o),a=[...CR,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Bo(_)||Id(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[m]=!0,delete r[m])}),Nx(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,u=l[NB],g=l[$y],h=Mu({},l);[...CR,...e.cookie_persisted_properties||[]].forEach(m=>{if(a.indexOf(m)!==-1&&!(m in r)&&!A[m]&&(c||m!=="distinct_id"&&m!=="$user_state")){const _=h[m];(s.isValid||CR.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=Mu(h,r),Kb.forEach(m=>{const _=m in this.props;m in l===_&&Nw(l[m],this.props[m])||(_?this.Ea(m,l[m],this.props[m]):this.ma(m,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.Ca($y,Yb);const d=this.props[NB],p=this.props[$y];return!c||d===u&&p===g||(this.sa=!0,this.ta=!0,nu.At(Mge(this.ha),!0),this.$a(ww),this.$a(Gb),this.$a(RB),this.$a(_R),this.$a(vw),this.$a(fR),this.$a(Dw),this.$a(R$),this.$a(Mw),p!=="anonymous"||g!=="identified"&&r.$user_state!=="anonymous"&&(Bo(u)||d===u)||(kOt(this.props,r),this.$a(Pw)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(xge)),!0}consumeCookieIdentityChange(){const e=Mge(this.ha),n=this.ta||!!nu.Ot(e);return this.ta=!1,n&&nu.Lt(e),n}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[o_],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){_Go.indexOf(e.persistence.toLowerCase())===-1&&(ui.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const n=((a=[],A=!1)=>{const c=[...CR,...a];return sn(sn({},hc),{},{Dt(l){try{let g,h={};try{g=yd.Ot(l)||void 0,h=g?pNe(JSON.parse(g)):{}}catch{}const d=JSON.parse(hc.Ot(l)||"{}");let p;if(A){const m=eOt(l,g),_=[...CR,...m.properties],f={};Object.keys(h).forEach(C=>{const y=h[C];Id(y)||y===""||C==="$user_state"&&y!=="anonymous"&&y!=="identified"||(f[C]=y)});const I="distinct_id"in f||f.$user_state==="anonymous"||f.$user_state==="identified";if(Object.keys(f).length>0){var u;const C=d[NB],y=(u=d.$user_state)!==null&&u!==void 0?u:Yb;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||CR.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[$y]=Yb),!I||("distinct_id"in f?f[NB]:d[NB])===C&&("$user_state"in f?f[$y]:d[$y])===y||(hNe.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[NB]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[RHt],delete d[Pw]),delete d.__alias)}p=Mu(d,f)}else p=Mu(h,d);return hc.At(l,p),p}catch{}return null},At(l,u,g,h,d,p){const m=hc.At(l,u,void 0,void 0,p);try{const _=mNe(u,a);if(Object.keys(_).length){if(A){const f=Qge(l),I=ZHt(_,a);if(yd.At(f,I,g,h,d,p),yd.Ot(f)!==JSON.stringify(I)){yd.Lt(f,h);const C=mNe(u);return yd.At(l,C,g,h,d,p),m}}yd.At(l,_,g,h,d,p)}}catch(_){hc.Pt(_)}return m},Lt(l,u){try{Ln?.localStorage.removeItem(l),yd.Lt(l,u),yd.Lt(Qge(l),u)}catch(g){hc.Pt(g)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&hc.Et()?(o=hc,r=!0):s==="localstorage+cookie"&&n.Et()?(o=n,r=!0,i=!0):s==="sessionstorage"&&nu.Et()?o=nu:s==="memory"?o=fNe:s==="cookie"&&yd.Et()?(o=yd,i=!0):n.Et()?(o=n,r=!0,i=!0):yd.Et()?(o=yd,i=!0):o=fNe,this.Ko=r,this.Xo=i,o}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){const e={};return Tl(this.props,(n,o)=>{const i=i1(o);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,n))return;e[o]=n}}),e}load(e=!1){if(this.mi&&!e)return;const n=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",o=n?hc.Dt(this.ha):null;let i={};if(n)try{i=pNe(yd.Dt(this.ha)),Tl(i,(A,c)=>{(Bo(A)||Id(A)||A==="")&&delete i[c]})}catch{}const r=this.qo.Dt(this.ha);if(r&&(this.props=Mu({},r)),this.Yo&&this.Ba(),n&&r){var s,a;const A=o?.[NB],c=(s=o?.$user_state)!==null&&s!==void 0?s:Yb,l=r[NB],u=(a=r.$user_state)!==null&&a!==void 0?a:Yb;if(l!==A||u!==c){this.ta=!0,nu.At(Mge(this.ha),!0);const g=Mu({},this.props);hNe.forEach(d=>delete g[d]),u!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Bo(A)||l===A)||(kOt(g,i),delete g[Pw]),this.props=g;const h=new Set;hNe.forEach(d=>{var p;const m=(p=i1(d))===null||p===void 0?void 0:p.storageGroup;m&&h.add(m)}),h.forEach(d=>{const p={};Tl(this.props,(m,_)=>{var f;((f=i1(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),Nx(p)?(hc.Lt(this.pa(d)),this.Jo[d]={}):hc.At(this.pa(d),p)&&(this.Jo[d]={persisted:!0,fingerprint:this.Sa(p,d)})})}}nu.Ot(Mge(this.ha))&&(this.ta=!0)}Ba(){for(const e of U$){const n=hc.Dt(this.pa(e));if(n&&!Nx(n)){const o=this.ya(e);o.persisted=!0,this.Ha(e)||(o.fingerprint=this.Sa(n,e)),this.za(e,n)||Mu(this.props,n)}}}Ha(e){return Object.keys(this.props).some(n=>{var o;return((o=i1(n))===null||o===void 0?void 0:o.storageGroup)===e})}za(e,n){const o=mGo[e];if(!o)return!1;const i=n[o],r=this.props[o];return sh(i)&&sh(r)&&r>i}refreshKey(e){var n;if(this.mi||this.oa.has(e))return;const o=this.Yo?(n=i1(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?hc.Dt(this.pa(o)):this.qo.Dt(this.ha);if(i&&e in i)this.Ca(e,i[e],!1);else{if(o){const r=this.qo.Dt(this.ha);if(r&&e in r)return void this.Ca(e,r[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;const e=this.Pa();e>0?Bo(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||ROt.forEach(r=>this.refreshKey(r)));const n=!e&&!this.na;n||(this.ra=!1);const o=!!n&&this.Ta();if(this.ra)return void(this.Rr.debug&&ui.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(o&&this.aa.forEach(r=>r()));const i=this.Wa(this.qo,this.ha,this.props,o_);i==="written"&&this.Ra(this.props),i!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),o&&this.aa.forEach(r=>r())}Ua(){const{main:e,groups:n}=this.wa(),o=this.Wa(this.qo,this.ha,e,o_);o==="written"&&this.Ra(e),o!=="failed"&&(this.sa=!1,this.oa.clear(),Kb.forEach(r=>{var s;!((s=i1(r))===null||s===void 0)&&s.storageGroup||this.ia.delete(r)}));for(const r of U$){var i;const s=n[r];if(Nx(s)&&!(!((i=this.Jo[r])===null||i===void 0)&&i.persisted)){Kb.forEach(A=>{var c;((c=i1(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ia.delete(A)});continue}const a=this.Wa(hc,this.pa(r),s,r);a!=="failed"&&Kb.forEach(A=>{const c=i1(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ia.delete(A)})}}wa(){const e={},n={flags:{},surveys:{}};return Tl(this.props,(o,i)=>{var r;const s=(r=i1(i))===null||r===void 0?void 0:r.storageGroup;s?n[s][i]=o:e[i]=o}),{main:e,groups:n}}Sa(e,n){if(n===o_)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const o={};return Tl(e,(i,r)=>{var s;o[r]=!((s=i1(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Wa(e,n,o,i){const r=this.ya(i);if(i!==o_&&!r.dirty&&!Bo(r.fingerprint))return"skipped";let s;try{if(s=this.Sa(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.At(n,o,this.Va,this.Ga,this.Za,this.Rr.debug)?(r.dirty=!1,i!==o_&&(r.persisted=!0),Bo(s)||(r.fingerprint=s),this.Ko&&(r.storageValue=hc.Ot(n)),"written"):(this.Rr.debug&&ui.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(const n of U$)hc.Lt(this.pa(n));e?delete this.Jo[o_]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(QA(e)){this.syncCookieProperties(),Bo(n)&&(n="None"),this.Va=Bo(o)?this.Qa:o;let i=!1;if(Tl(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.Ca(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(QA(e)){this.syncCookieProperties(),this.Va=Bo(n)?this.Qa:n;let o=!1;if(Tl(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||QA(i)||as(i))&&(this.Ca(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.$a(i),o=!0);o&&this.save()}update_campaign_params(){const e=No?.URL;if(e===this.ua)return;const n=SOt(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),o=!Nx(uNe(n));return o&&this.register(n),this.ua=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=No?.referrer;return e?vOt(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:POt(),$referring_domain:No?.referrer&&((e=Ub(No.referrer))===null||e===void 0?void 0:e.host)||Pge},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=MOt(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[zO]:this.Xo?{r:Dge(e.r),u:e.u?Dge(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Tl([HHt,LHt],o=>{const i=this.props[o];i&&Tl(i,function(r,s){e["$initial_"+SDe(s)]=r})});const n=this.props[zO];if(n){const o=(function(i,r=!1){const s=DOt(i,r),a={};return Tl(s,function(A,c){a[`$initial_${SDe(c)}`]=A}),a})(n,this.Rr.disable_capture_url_hashes);Mu(e,o)}return e}safe_merge(e){return Tl(this.props,function(n,o){o in e||(e[o]=n)}),e}update_config(e,n,o){const i=e.persistence!==n.persistence,r=!((d,p)=>{if(d.length!==p.length)return!1;const m=[...d].sort(),_=[...p].sort();return m.every((f,I)=>f===_[I])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=i||r,a=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,A=e.disable_persistence||!!o,c=!!this.mi&&!A;A||this.Oa(n,c),this.Rr=e,!A&&(i||r||a)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(sn(sn({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ca(e):this.qo;this.Ja();const u=this.da(e),g=s||u!==this.Yo,h=!A&&(g||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(c);this.na=g;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),g){const d=this.props;this.clear(),this.qo=l,this.Yo=u,this.props=d,this.save()}else a&&(this.qo=l,A||(delete this.Jo[o_],this.qa()))}finally{this.na=!1,h&&this.ja()}}Ja(){const e=this.props[zO];if(!this.Xo||!QA(e)||typeof e.r!="string")return;const n=Dge(e.r),o=typeof e.u=="string"?Dge(e.u):e.u;n===e.r&&o===e.u||this.Ca(zO,sn(sn({},e),{},{r:n,u:o}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.Ca($De,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Bo(o)||(delete n[e],this.Ca($De,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.Ca(e,n),this.save()}Ca(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.sa=!0),TOt(e)&&!Nw(r,n)&&this.oa.add(e),this.Ea(e,r,n),!((i=i1(e))===null||i===void 0)&&i.volatile||this.Ia(e))}$a(e,n=!0){delete this.props[e],n&&(SNe(e)&&this.ma(e,!0),TOt(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var n;const o=(n=i1(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ya(o).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}};const lE={GZipJS:"gzip-js",Base64:"base64"},z$={Activation:"events",Cancellation:"cancelEvents"},vNe={Popover:"popover",API:"api",Widget:"widget"},Vb={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},wNe={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},PNe={Popover:"popover",Inline:"inline"};function Nge(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&nf(n.then)&&n.then(void 0,()=>{})}}}}const fGo={SHOWN:"product tour shown"},FOt={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},LOt=Cd("[RateLimiter]");var IGo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{const o=n.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(i=>{LOt.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void LOt.warn(`could not rate limit - continuing. Error: "${i?.message}"`,{text:o})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var n,o,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:s}=this,a=new Date().getTime(),A=(n=(o=this.instance.persistence)===null||o===void 0?void 0:o.get_property("$capture_rate_limit"))!==null&&n!==void 0?n:{tokens:r,last:a};A.tokens+=(a-A.last)/1e3*s,A.last=a,A.tokens>r&&(A.tokens=r);const c=1>A.tokens;if(c||e||(A.tokens=Math.max(0,A.tokens-1)),c&&!e){const l=(sh(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ka(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Xa(e){const n=this.instance.config.property_denylist;return!as(n)||!n.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&fd?.pathname)return`${(e=fd.origin)!==null&&e!==void 0?e:""}${fd.pathname}`}Ka(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Ya(),a=this.Xa("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const Rw=Cd("[RemoteConfig]");var HOt=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Vr._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}tl(e){var n,o,i;!((n=Vr.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Vr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Rw.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void Rw.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return Rw.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(n=>{this.il(n.json,n)});this.il(e)})}catch(e){Rw.error("Error loading remote config",e),this.il()}}il(e,n){!e&&n&&(n.statusCode===0?n.error||Rw.warn("Failed to fetch remote config from PostHog."):Rw.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){Rw.error("Error applying remote config",i)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var o;(o=this._instance.featureFlags)===null||o===void 0||o.ensureFlagsLoaded()}catch(i){Rw.error("Error loading feature flags",i)}}},i4=Uint8Array,Rx=Uint16Array,nG=Uint32Array,MNe=new i4([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]),DNe=new i4([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]),OOt=new i4([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),GOt=function(t,e){for(var n=new Rx(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new nG(n[30]);for(o=1;30>o;++o)for(var r=n[o];n[o+1]>r;++r)i[r]=r-n[o]<<5|o;return[n,i]},YOt=GOt(MNe,2),NNe=YOt[1];YOt[0][28]=258,NNe[258]=28;for(var UOt=GOt(DNe,0)[1],KOt=new Rx(32768),xd=0;32768>xd;++xd){var oG=(43690&xd)>>>1|(21845&xd)<<1;KOt[xd]=((65280&(oG=(61680&(oG=(52428&oG)>>>2|(13107&oG)<<2))>>>4|(3855&oG)<<4))>>>8|(255&oG)<<8)>>>1}var J$=function(t,e,n){for(var o=t.length,i=0,r=new Rx(e);o>i;++i)++r[t[i]-1];var s,a=new Rx(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new Rx(o),i=0;o>i;++i)s[i]=KOt[a[t[i]-1]++]>>>15-t[i];return s},xR=new i4(288);for(xd=0;144>xd;++xd)xR[xd]=8;for(xd=144;256>xd;++xd)xR[xd]=9;for(xd=256;280>xd;++xd)xR[xd]=7;for(xd=280;288>xd;++xd)xR[xd]=8;var Rge=new i4(32);for(xd=0;32>xd;++xd)Rge[xd]=5;var CGo=J$(xR,9),yGo=J$(Rge,5),VOt=function(t){return(t/8|0)+(7&t&&1)},zOt=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof Rx?Rx:t instanceof nG?nG:i4)(n-e);return o.set(t.subarray(e,n)),o},zb=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},W$=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},RNe=function(t,e){for(var n=[],o=0;t.length>o;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return[new i4(0),0];if(i==1){var s=new i4(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,u=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[u].f>n[c].f?c++:u++],A=n[c!=l&&n[u].f>n[c].f?c++:u++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};var g=r[0].s;for(o=1;i>o;++o)r[o].s>g&&(g=r[o].s);var h=new Rx(g+1),d=TNe(n[l-1],h,0);if(d>e){o=0;var p=0,m=d-e,_=1<<m;for(r.sort(function(y,x){return h[x.s]-h[y.s]||y.f-x.f});i>o;++o){var f=r[o].s;if(e>=h[f])break;p+=_-(1<<d-h[f]),h[f]=e}for(p>>>=m;p>0;){var I=r[o].s;e>h[I]?p-=1<<e-h[I]++-1:++o}for(;o>=0&&p;--o){var C=r[o].s;h[C]==e&&(--h[C],++p)}d=e}return[new i4(h),d]},TNe=function(t,e,n){return t.s==-1?Math.max(TNe(t.l,e,n+1),TNe(t.r,e,n+1)):e[t.s]=n},JOt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Rx(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;e>=a;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return[n.subarray(0,o),e]},j$=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},kNe=function(t,e,n){var o=n.length,i=VOt(e+2);t[i]=255&o,t[i+1]=o>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var r=0;o>r;++r)t[i+r+4]=n[r];return 8*(i+4+o)},WOt=function(t,e,n,o,i,r,s,a,A,c,l){zb(e,l++,n),++i[256];for(var u=RNe(i,15),g=u[0],h=u[1],d=RNe(r,15),p=d[0],m=d[1],_=JOt(g),f=_[0],I=_[1],C=JOt(p),y=C[0],x=C[1],E=new Rx(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var S=RNe(E,7),Q=S[0],w=S[1],M=19;M>4&&!Q[OOt[M-1]];--M);var k,R,F,O,U=c+5<<3,Y=j$(i,xR)+j$(r,Rge)+s,W=j$(i,g)+j$(r,p)+s+14+3*M+j$(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&W>=U)return kNe(e,l,t.subarray(A,A+c));if(zb(e,l,1+(Y>W)),l+=2,Y>W){k=J$(g,h),R=g,F=J$(p,m),O=p;var te=J$(Q,w);for(zb(e,l,I-257),zb(e,l+5,x-1),zb(e,l+10,M-4),l+=14,B=0;M>B;++B)zb(e,l+3*B,Q[OOt[B]]);l+=3*M;for(var j=[f,y],J=0;2>J;++J){var ie=j[J];for(B=0;ie.length>B;++B)zb(e,l,te[oe=31&ie[B]]),l+=Q[oe],oe>15&&(zb(e,l,ie[B]>>>5&127),l+=ie[B]>>>12)}}else k=CGo,R=xR,F=yGo,O=Rge;for(B=0;a>B;++B)if(o[B]>255){var oe;W$(e,l,k[257+(oe=o[B]>>>18&31)]),l+=R[oe+257],oe>7&&(zb(e,l,o[B]>>>23&31),l+=MNe[oe]);var ne=31&o[B];W$(e,l,F[ne]),l+=O[ne],ne>3&&(W$(e,l,o[B]>>>5&8191),l+=DNe[ne])}else W$(e,l,k[o[B]]),l+=R[o[B]];return W$(e,l,k[256]),l+R[256]},xGo=new nG([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),EGo=(function(){for(var t=new nG(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),FNe=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function BGo(t,e){e===void 0&&(e={});var n=(function(){var u=4294967295;return{p(g){for(var h=u,d=0;g.length>d;++d)h=EGo[255&h^g[d]]^h>>>8;u=h},d(){return 4294967295^u}}})(),o=t.length;n.p(t);var i,r,s,a,A,c=(a=10+((i=e).filename&&i.filename.length+1||0),A=8,(function(u,g,h,d,p,m){var _=u.length,f=new i4(d+_+5*(1+Math.floor(_/7e3))+p),I=f.subarray(d,f.length-p),C=0;if(!g||8>_)for(var y=0;_>=y;y+=65535){var x=y+65535;_>x?C=kNe(I,C,u.subarray(y,x)):(I[y]=m,C=kNe(I,C,u.subarray(y,_)))}else{for(var E=xGo[g-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,w=new Rx(32768),M=new Rx(Q+1),k=Math.ceil(h/3),R=2*k,F=function(Ce){return(u[Ce]^u[Ce+1]<<k^u[Ce+2]<<R)&Q},O=new nG(25e3),U=new Rx(288),Y=new Rx(32),W=0,te=0,j=(y=0,0),J=0,ie=0;_>y;++y){var oe=F(y),ne=32767&y,ge=M[oe];if(w[ne]=ge,M[oe]=ne,y>=J){var ue=_-y;if((W>7e3||j>24576)&&ue>423){C=WOt(u,I,0,O,U,Y,te,j,ie,y-ie,C),j=W=te=0,ie=y;for(var _e=0;286>_e;++_e)U[_e]=0;for(_e=0;30>_e;++_e)Y[_e]=0}var le=2,fe=0,he=S,ye=ne-ge&32767;if(ue>2&&oe==F(y-ye))for(var Qe=Math.min(B,ue)-1,we=Math.min(32767,y),pe=Math.min(258,ue);we>=ye&&--he&&ne!=ge;){if(u[y+le]==u[y+le-ye]){for(var ve=0;pe>ve&&u[y+ve]==u[y+ve-ye];++ve);if(ve>le){if(le=ve,fe=ye,ve>Qe)break;var Me=Math.min(ye,ve-2),Pe=0;for(_e=0;Me>_e;++_e){var He=y-ye+_e+32768&32767,Re=He-w[He]+32768&32767;Re>Pe&&(Pe=Re,ge=He)}}}ye+=(ne=ge)-(ge=w[ne])+32768&32767}if(fe){O[j++]=268435456|NNe[le]<<18|UOt[fe];var Ee=31&NNe[le],Te=31&UOt[fe];te+=MNe[Ee]+DNe[Te],++U[257+Ee],++Y[Te],J=y+le,++W}else O[j++]=u[y],++U[u[y]]}}C=WOt(u,I,m,O,U,Y,te,j,ie,y-ie,C)}return zOt(f,0,d+VOt(C)+p)})(r=t,(s=e).level==null?6:s.level,s.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+s.mem,a,A,!0)),l=c.length;return(function(u,g){var h=g.filename;if(u[0]=31,u[1]=139,u[2]=8,u[8]=2>g.level?4:g.level==9?2:0,u[9]=3,g.mtime!=0&&FNe(u,4,Math.floor(new Date(g.mtime||Date.now())/1e3)),h){u[3]=8;for(var d=0;h.length>=d;++d)u[d+10]=h.charCodeAt(d)}})(c,e),FNe(c,l-8,n.d()),FNe(c,l-4,o),c}const bGo=!!BDe||!!E$,jOt=new WeakMap,$Ot="text/plain";let LNe=0,Tge=!1;const qOt=(t,e)=>{const[n,o]=t.split("#"),[i,r]=n.split("?");if(!r)return t;const s=r.split("&").filter(a=>a.split("=")[0]!==e).join("&");return`${i}${s?`?${s}`:""}${o?`#${o}`:""}`},$$=(t,e,n=!0)=>{var o;const[i,r]=t.split("?"),s=sn({},e),a=(o=r?.split("&").map(c=>{var l;const[u,g]=c.split("="),h=n&&(l=s[u])!==null&&l!==void 0?l:g;return delete s[u],`${u}=${h}`}))!==null&&o!==void 0?o:[],A=(function(c,l="&"){let u,g;const h=[];return Tl(c,function(d,p){Bo(d)||Bo(p)||p==="undefined"||(u=encodeURIComponent((m=>m instanceof File)(d)?d.name:d.toString()),g=encodeURIComponent(p),h[h.length]=g+"="+u)}),h.join(l)})(s);return A&&a.push(A),a.length>0?`${i}?${a.join("&")}`:i},HNe=t=>{if(t.sl)return t.sl;const{data:e,compression:n}=t;if(!e)return;if(n===lE.GZipJS){const i=BGo((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new i4(r.length+(r.length>>>1)),A=0,c=function(h){a[A++]=h},l=0;s>l;++l){if(A+5>a.length){var u=new i4(A+8+(s-l<<1));u.set(a),a=u}var g=r.charCodeAt(l);128>g?c(g):2048>g?(c(192|g>>>6),c(128|63&g)):g>55295&&57344>g?(c(240|(g=65536+(1047552&g)|1023&r.charCodeAt(++l))>>>18),c(128|g>>>12&63),c(128|g>>>6&63),c(128|63&g)):(c(224|g>>>12),c(128|g>>>6&63),c(128|63&g))}return zOt(a,0,A)})(XO(e)),{mtime:0});return{contentType:$Ot,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===lE.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(XO(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:XO(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=XO(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},XOt=t=>{const e=()=>t.transport==="sendBeacon"?{url:$$(t.url,{compression:lE.Base64}),encodedBody:HNe(sn(sn({},t),{},{compression:lE.Base64,sl:void 0}))}:{url:qOt(t.url,"compression"),encodedBody:HNe(sn(sn({},t),{},{compression:void 0,sl:void 0}))};let n;try{n=HNe(t)}catch(i){if(cHt(t.compression,ZO(t.url,"compression")))return ui.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&cHt(t.compression,ZO(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?UDe(new Uint8Array(o)):ArrayBuffer.isView(o)&&UDe(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(Tge=!0,e()):{url:t.url,encodedBody:n};var o},ZOt=t=>{try{return XOt(t)}catch(n){var e;return ui.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},SGo=(function(){var t=eg(function*(e){const n=yield(function(i){return KDe.apply(this,arguments)})(XO(e.data),n_.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{sl:{contentType:$Ot,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),QGo=/Failed to fetch|NetworkError|Load failed/i,eGt=t=>t?.name==="TypeError"&&QGo.test(t?.message||""),tGt=t=>{try{const e=(function(n,o=Date.now()){if(typeof n!="string"||!n)return;const i=n.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){const A=1e3*Math.min(Number(r),300);return A>0?A:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;const s=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(s)-o;return Number.isFinite(a)&&a>0?Math.min(a,hge):void 0})(t());return Bo(e)?void 0:Math.min(e,3e4)}catch{return}},nGt=t=>{const e=ZOt(t);if(!e)return;const n=new BDe;jOt.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};Tl(t.headers,function(a,A){n.setRequestHeader(A,a)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a;const A={statusCode:n.status,text:n.responseText};if(n.status===200)try{A.json=JSON.parse(n.responseText)}catch{}(a=t.callback)===null||a===void 0||a.call(t,A,tGt(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},oGt=t=>{const e=ZOt(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;Tl(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(rLt){const d=new rLt;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(JLt("AbortError","PostHog request timed out"+((p=t.timeout)?` after ${p}ms`:"")))}catch(m){u(m)}var p},t.timeout)}}let l=!1;const u=d=>{var p;l||(l=!0,c&&d?.name==="AbortError"||eGt(d)?ui.warn(d):ui.error(d),(p=t.callback)===null||p===void 0||p.call(t,{statusCode:0,error:d}))};let g=0;const h=()=>{LNe-=g,g=0,A&&clearTimeout(A.timeout)};try{const d=sn({method:t?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:A?.signal},t.fetchOptions),p=s??(Bo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.rl&&d.keepalive!==!1&&d.body===r&&!Bo(p)&&p>=0&&52428.8>LNe+p,d.keepalive&&(g=p,LNe+=g),E$(n,d).then(m=>m.text().then(_=>{var f;if(l)return;const I={statusCode:m.status,text:_};if(m.status===200)try{I.json=JSON.parse(_)}catch(C){ui.error(C)}l=!0,h(),(f=t.callback)===null||f===void 0||f.call(t,I,tGt(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),u(m)}).finally(h)}catch(d){h(),u(d)}},ONe=t=>{try{var e;const{url:n,encodedBody:o}=XOt(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(tf.sendBeacon(n,a))return;const A=as(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(as(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=u=>as(t.data)?u:sn(sn({},t.data),{},{batch:u});return ONe(sn(sn({},t),{},{data:l(A.slice(0,c))})),void ONe(sn(sn({},t),{},{data:l(A.slice(c))}))}ui.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${E$?"fetch":"XHR"}`),E$?oGt(sn(sn({},t),{},{rl:!0})):nGt(t)}catch(n){ui.warn("Beacon send failed",n)}},iGt=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return $$(n===lE.GZipJS?qOt(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===lE.GZipJS?{}:{compression:n}))},vGo=(()=>{const t=[];return E$&&t.push({transport:"fetch",method:oGt}),BDe&&t.push({transport:"XHR",method:nGt}),tf?.sendBeacon&&t.push({transport:"sendBeacon",method:ONe}),t})();let rGt=!bGo&&Wy?.indexOf("MSIE")===-1&&Wy?.indexOf("Mozilla")===-1;function sGt(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?rGt?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&((i=e.callback)===null||i===void 0||i.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=sn(sn({},t.config.request_headers),e.headers),e.compression=e.compression==="best-available"?(o=t.compression)!==null&&o!==void 0?o:e.compressionFallback:e.compression,(Bo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const u=sn(sn({},s),{},{callback:a??(m=>{var _;return(_=s.callback)===null||_===void 0?void 0:_.call(s,m)})});u.timeout=u.timeout||6e4;const g=(A=u.transport)!==null&&A!==void 0?A:"fetch";g==="sendBeacon"&&Bo(u.compression)&&u.data&&(u.compression=lE.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data=(m=>{var _,f;const I=(as(m)?m:[m]).map(y=>sn(sn({},y),y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})),C=I[0];return{api_key:(_=C==null||(f=C.properties)===null||f===void 0?void 0:f.token)!==null&&_!==void 0?_:C?.token,batch:I,sent_at:new Date().toISOString()}})(u.data):u.timestampMode==="body"&&(u.data=((m,_=new Date().toISOString())=>as(m)?m.map(f=>sn(sn({},f),{},{sent_at:_})):sn(sn({},m),{},{sent_at:_}))(u.data))),u.url=iGt(u.url,u.method,u.compression,u.timestampMode);const h=vGo.filter(m=>!u.disableTransport||!m.transport||!u.disableTransport.includes(m.transport)),d=(c=(l=(function(m,_){for(let f=0;m.length>f;f++)if(_(m[f]))return m[f]})(h,m=>m.transport===g))===null||l===void 0?void 0:l.method)!==null&&c!==void 0?c:h[0].method;if(!d)throw new Error("No available transport method");const p=m=>{try{d(m)}catch(f){var _;eGt(f)?ui.warn(f):ui.error(f),(_=u.callback)===null||_===void 0||_.call(u,{statusCode:0,error:f})}};g!=="sendBeacon"&&!u.preferSyncCompression&&u.data&&u.compression===lE.GZipJS&&uHo&&typeof Promise<"u"&&!Tge?SGo(u).then(m=>{p(m)}).catch(m=>{if(lHt(m))return Tge=!0,void p(sn(sn({},u),{},{compression:void 0,url:iGt(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return lHt(_)||f===AHt})(m)&&(Tge=!0),p(u)}):p(u)})(e,(s,a)=>{var A,c,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||(A=(c=t.config).on_request_error)===null||A===void 0||A.call(c,s),n?n(s,a):(l=e.callback)===null||l===void 0||l.call(e,s)})):e.fireCallbackOnDrop&&((r=e.callback)===null||r===void 0||r.call(e,{statusCode:0}))}var wGo=class{constructor(e,n){this.ol=!0,this.al=[],this.ll=l6(n?.flush_interval_ms||3e3,250,5e3,ui.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();const e=this.al.length>0?this.vl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.fl(o,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const e=this.vl();for(const n in e)this.fl(e[n])}},this.ll))}fl(e,n){try{this.ul(e,n)}catch(o){ui.error(o)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const e={};return Tl(this.al,n=>{var o;const i=n,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");Bo(e[r])&&(e[r]=sn(sn({},i),{},{data:[]})),(o=e[r].data)===null||o===void 0||o.push(i.data)}),this.al=[],e}};const PGo=["retriesPerformedSoFar"];var MGo=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Bo(Ln)&&"onLine"in Ln.navigator){if(this.ml=Ln.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},Cl(Ln,"online",this.yl),Cl(Ln,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=gHt(e,PGo);Ob(o)&&(i.url=$$(i.url,{retry_count:o})),sGt(this._instance,n?sn(sn({},i),{},{transport:n}):i,(r,s)=>{var a;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(o??0))return void this.Ls(sn({retriesPerformedSoFar:o},i),s);r.statusCode===0&&ui.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${o??0} retries.`)}(a=i.callback)===null||a===void 0||a.call(i,r)})}Ls(e,n){const o=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=o+1;const i=Math.max((function(a){const A=3e3*Math.pow(2,a),c=A/2,l=Math.min(18e5,A),u=(Math.random()-.5)*(l-c);return Math.ceil(l+u)})(o),n??0),r=Date.now()+i;this.al.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),ui.warn(s),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const e=Date.now(),n=[],o=this.al.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.al=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,Bo(Ln)||(this.yl&&(Ln.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(Ln.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:e}of this.al)try{this._instance._send_request(sn(sn({},e),{},{transport:"sendBeacon"}))}catch(n){ui.error(n)}this.al=[]}},DGo=class{constructor(e){this._instance=e,this.Sl=()=>{var n,o,i,r;this.xl||(this.xl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.xl.lastScrollY=Math.ceil(a),this.xl.maxScrollY=Math.max(a,(n=this.xl.maxScrollY)!==null&&n!==void 0?n:0),this.xl.maxScrollHeight=Math.max(A,(o=this.xl.maxScrollHeight)!==null&&o!==void 0?o:0),this.xl.lastContentY=c,this.xl.maxContentY=Math.max(c,(i=this.xl.maxContentY)!==null&&i!==void 0?i:0),this.xl.maxContentHeight=Math.max(l,(r=this.xl.maxContentHeight)!==null&&r!==void 0?r:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){Cl(Ln,"scroll",this.Sl,{capture:!0}),Cl(Ln,"scrollend",this.Sl,{capture:!0}),Cl(Ln,"resize",this.Sl)}scrollElement(){if(this.Cl){const o=as(this.Cl)?this.Cl:[this.Cl];for(const i of o){var e;const r=Ln==null||(e=Ln.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Ln==null||(n=Ln.document)===null||n===void 0?void 0:n.documentElement}$l(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.Cl){const r=this.scrollElement();return r&&r[i]||0}return Ln?e==="y"?Ln.scrollY||Ln.pageYOffset||((n=Ln.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Ln.scrollX||Ln.pageXOffset||((o=Ln.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const NGo=t=>MOt(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var aGt=class{constructor(e,n,o,i){this.Be=r=>{const s=this.Tl();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Il(this._instance)};this.Ml.register({[sNe]:a})},this._instance=e,this.El=n,this.Ml=o,this.Il=i||NGo,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[sNe]}getSetOnceProps(){var e;const n=(e=this.Tl())===null||e===void 0?void 0:e.props;return n?"r"in n?DOt(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){const e={};return Tl(uNe(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${SDe(o)}`]=n}),e}},kge=class{on(t,e){return this.Pl[t]||(this.Pl[t]=[]),this.Pl[t].push(e),()=>{this.Pl[t]=this.Pl[t].filter(n=>n!==e)}}emit(t,e){for(const n of this.Pl[t]||[])n(e);for(const n of this.Pl["*"]||[])n(t,e)}constructor(){this.Pl={}}};const iG=Cd("[SessionId]"),AGt=864e5;var cGt=class{on(e,n){return this.Rl.on(e,n)}constructor(e,n,o){var i;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new kge,this.Nl=(s,a)=>!(!Ob(s)||!Ob(a))&&Math.abs(s-a)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=n||TB,this.Bl=o||TB;const r=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*l6(this.Rr.session_idle_timeout_seconds||1800,60,36e3,iG.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+r+"_window_id",this.Ul="ph_"+r+"_primary_window_exists",this.Wl()){const s=nu.Dt(this.zl),a=nu.Dt(this.Ul);s&&!a?this.He=s:nu.Lt(this.zl),nu.At(this.Ul,!0)}!((i=this.Rr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Bo(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(n=>n!==e)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&nu.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&nu.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?nu.Dt(this.zl):null}Ql(e){const n=this.Al;return!Id(n)&&!Id(e)&&5e3>Math.abs(e-n)}Jl(e,n,o){const i=n!==this._sessionActivityTimestamp,r=!(e!==this.Xt||o!==this._sessionStartTimestamp);this._sessionStartTimestamp=o,this._sessionActivityTimestamp=n,this.Xt=e,r&&!i||r&&this.Ql(n)||(this.Al=n,this.Ml.register({[VO]:[n,e,o]}))}Kl(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Ob(n)&&n>0}Xl(){this.Kl()?this.Ml.refreshKey(VO):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(Id(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,n,o]=this.tu();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[VO]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),n=Ob(e)?e:0,o=Ob(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){const e=this.Ml.props[VO];return as(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,n=!1){const o=((i,r=new Date().getTime())=>{try{const s=(a=>{const A=a.replace(/-/g,"");if(A.length!==32)throw new Error("Not a valid UUID");if(A[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(A.substring(0,12),16)})(i);return s>r+6e4?void iG.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void iG.error("Invalid sessionID in bootstrap",s)}})(e);return!Bo(o)&&(n?this.ql={sessionId:e,sessionStartTimestamp:o}:this.Jl(e,new Date().getTime(),o),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&Ln&&(Ln.removeEventListener(bge,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&nu.Lt(this.Ul)},Cl(Ln,bge,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Rr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Fl=i;else if(Id(this.Fl)||this.Fl>i||i-this.Fl>=1e3){var s,a;(s=(a=this.Ml).syncCookieProperties)===null||s===void 0||s.call(a),this.Fl=i}let[,A,c]=this.tu();const l=!Bo(r)&&A!==r,u=this.eu();let g=this.Zl();const h=this.ql,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>AGt),p=h?d:Ob(c)&&Math.abs(i-c)>AGt;let m=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Nl(i,u);if(C&&(C=this.iu(i),C||iG.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.tu(),C||(f=!A||!!h)),f||C||p){_=!1;const B=h&&!d;A=B?h.sessionId:this.jl(),g=this.Bl(),iG.info("new session ID assigned",{sessionId:A,windowId:g,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p}}),c=B?h.sessionStartTimestamp:i,this.ql=void 0,m=!0}else g||(g=this.Bl(),m=!0),_=_||A!==I,_&&(iG.info("adopted cross-tab session id",{sessionId:A,windowId:g}),m=!0);const y=Ob(u)&&e&&!p?u:i,x=Ob(c)?c:new Date().getTime();this.Gl(g),this.Jl(A,y,x),e||this.Hl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p,crossTabAdoption:_};return m&&this.Ol.forEach(B=>B(A,g,E)),{sessionId:A,windowId:g,sessionStartTimestamp:x,changeReason:m?E:void 0,lastActivityTimestamp:u}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.Hl()},1.1*this.sessionTimeoutMs))}};const lGt=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&gLt(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>gLt(i?.brand,e)))return!0}catch{}return!!t.webdriver};function uGt(){return(uGt=eg(function*(){const t=tf?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return rA(n)&&n.length>0?n:void 0}catch(e){return void ui.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function RGo(t,e){let n=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(n=`$survey_${e}/${t.id}/${t.current_iteration}`),n}function gGt(t){var e;return!!(!((e=t.conditions)===null||e===void 0||(e=e.events)===null||e===void 0||(e=e.values)===null||e===void 0)&&e.length)}const Fge=(t,e)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},Lge=t=>t.toLowerCase(),dGt={exact:(t,e)=>e.some(n=>t.some(o=>n===o)),is_not:(t,e)=>e.every(n=>t.every(o=>n!==o)),regex:(t,e)=>e.some(n=>t.some(o=>Fge(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!Fge(n,o))),icontains:(t,e)=>e.map(Lge).some(n=>t.map(Lge).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(Lge).every(n=>t.map(Lge).every(o=>!n.includes(o))),gt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o>parseFloat(i))}),lt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o<parseFloat(i))})};function hGt(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=dGt[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function GNe(t,e,n){return XO({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const YNe="custom",pGt="i.posthog.com",TGo=/^\/static\//,kGo=["/s/","/e/","/i/"];var FGo=class{constructor(t){this.su={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${pGt}`,".posthog.com")),e==="https://app.posthog.com"?"https://us.posthog.com":e}get region(){return this.su[this.apiHost]||(this.su[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":YNe),this.su[this.apiHost]}ru(t){if(!TGo.test(t))return;const e=this.instance.config.asset_host;return typeof e=="string"&&e.trim().replace(/\/$/,"")||void 0}ou(t){const e=Ub(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}au(t,e,n){if(t==="ui")return n;let o=n;const i=this.instance.config.rewriteRequestPath;if(i){var r;const s=((r=Ub(n))===null||r===void 0?void 0:r.href)||n;o=i(new URL(s)).toString()}if(i&&t==="api"&&kGo.some(s=>e.indexOf(s)===0)){const s=this.ou(o);if(s){const a=this.apiHost;let A=this.lu;A?.apiHost===a&&A.rewriteRequestPath===i||(A={apiHost:a,rewriteRequestPath:i,urls:new Set},this.lu=A),A.urls.add(s)}}return o}isIngestionEndpoint(t){const e=this.lu,n=this.ou(t);return e?.apiHost===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&e.urls.has(n)}endpointFor(t,e=""){if(e&&(e=e[0]==="/"?e:`/${e}`),t==="ui")return this.au(t,e,this.uiHost+e);if(t==="flags")return this.au(t,e,this.flagsApiHost+e);if(t==="assets"){const o=this.ru(e);if(o)return this.au(t,e,`${o}${e}`)}if(this.region===YNe)return this.au(t,e,this.apiHost+e);const n=pGt+e;switch(t){case"assets":return this.au(t,e,`https://${this.region}-assets.${n}`);case"api":return this.au(t,e,`https://${this.region}.${n}`)}}};const kl=Cd("[Surveys]"),mGt=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){kl.error("Failed to persist survey seen state",e)}},LGo=[vNe.Popover,vNe.Widget,vNe.API],HGo={ignoreConditions:!1,ignoreDelay:!1,displayType:PNe.Popover},OGo=Cd("[PostHog ExternalIntegrations]"),GGo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var YGo=class{constructor(t){this._instance=t}zo(t,e){var n,o;(n=Vr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,t,i=>{if(i)return OGo.error("failed to load script",i);e()})}startIfEnabledOrStop(){var t;for(const[i,r]of Object.entries((t=this._instance.config.integrations)!==null&&t!==void 0?t:{})){var e,n,o;r&&!(!((e=Vr.__PosthogExtensions__)===null||e===void 0||(e=e.integrations)===null||e===void 0)&&e[i])&&this.zo(GGo[i],()=>{var s;(s=Vr.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[i])===null||s===void 0||s.start(this._instance)}),!r&&(!((n=Vr.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[i])&&((o=Vr.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[i])===null||o===void 0||o.stop())}}},UGo=class{constructor(e,n){this.$=e,this.wo=n,this.uu=new Map,this.Io=!1}add(e){var n=this;return eg(function*(){if(n.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.uu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.uu.set(e.name,e);try{const o=e.setup(n.wo);o&&(yield o)}catch(o){const i=n.uu.get(e.name)===e;i&&n.uu.delete(e.name),n.$.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;const e=Array.from(this.uu.values()).reverse();this.uu.clear();for(const n of e)this.hu(n)}hu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&nf(o.then)&&o.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.$.error(`Failed to dispose browser extension "${e.name}"`,o)}}},KGo=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if(typeof t=="string")return e?.get_property(t);const n={};for(const o of t){const i=e?.get_property(o);Bo(i)||(n[o]=i)}return n}set(t,e){var n;(n=this._instance.persistence)===null||n===void 0||n.register(typeof t=="string"?{[t]:e}:t)}remove(t){var e;(e=this._instance.persistence)===null||e===void 0||e.unregister(t)}};const _Gt="extensionsRemoteConfig";var VGo=class{constructor(t){this.instance=t,this.Io=!1,this.$=ui,this.cu=t.du,this.kv=new KGo(t),this.onEvent=e=>Nge(this.instance.on("eventCaptured",n=>{try{e({event:n.event,properties:n.properties})}catch(o){this.$.error("Browser extension event listener failed",o)}})),this.onRemoteConfig=e=>{if(this.Io)return Nge(()=>{});const n=i=>{try{e(i)}catch(r){this.$.error("Browser extension remote config listener failed",r)}},o=this.instance.vu.on(_Gt,n);return this.cu&&n(this.cu),Nge(o)},this.fu=new UGo(ui.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property("$device_id"))!==null&&t!==void 0?t:this.distinctId}get deviceId(){const t=this.instance.get_property(WDe);return typeof t=="string"?t:void 0}get library(){return{name:n_.LIB_NAME,version:n_.LIB_VERSION}}get initialPersonProperties(){var t,e;return(t=(e=this.instance.persistence)===null||e===void 0?void 0:e.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,n,o;const i=(t=this.instance.sessionManager)===null||t===void 0?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(e=i?.sessionId)!==null&&e!==void 0?e:"",windowId:(n=i?.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(o=i?.sessionStartTimestamp)!==null&&o!==void 0?o:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.fu.add(t)}getExtension(t){return this.fu.getExtension(t)}capture(t,e,n){n?this.instance.capture(t,e,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):this.instance.capture(t,e)}registerDynamicEventProperties(t){return Nge(this.instance.pu(t))}handleRemoteConfig(t){this.Io||(this.cu=t,this.instance.vu.emit(_Gt,t))}sendRequest(t){var e=this;return eg(function*(n,o={}){var i;const r=e.instance.requestRouter.endpointFor((i=o.target)!==null&&i!==void 0?i:"api",n),s={method:o.method,url:o.query?$$(r,o.query):r,data:o.body,headers:o.headers,timeout:o.timeoutMs,fireCallbackOnDrop:!0,transport:o.transport,compression:o.compression,compressionFallback:o.target==="flags"&&o.compression==="best-available"?bDe.Base64:void 0,timestampMode:o.sentAt};return o.transport==="sendBeacon"?(e.instance._send_request(s),{statusCode:202}):new Promise(a=>{s.callback=a,e.instance._send_request(s)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const q$={};let UNe=0;const X$=()=>{},fGt='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Z$="Surveys module not available",IGt="sanitize_properties is deprecated. Use before_send instead",CGt="Invalid value for property_denylist config: ",zGo=/^[A-Za-z0-9_-]{1,400}$/,yGt=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,xGt=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,JGo=["token","distinct_id",OHt],eq="posthog",WGo=t=>{const e={};return t&&t!=="unset"&&("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0)),e},KNe=t=>{var e;return sn({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:JOo(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:X$,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:fd&&rA(fd?.search)&&fd.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(Ln==null||(e=Ln.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){ui.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:VHt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:X$},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:tGo,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:WGo(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},jGo=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],EGt=t=>{const e={};for(const[i,r]of jGo)Bo(t[i])||(e[r]=t[i]);const n=Mu({},e,t),o=t.__preview_external_dependency_versioned_paths;return Bo(o)||(Bo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),rA(o)&&Bo(t.asset_host)&&(n.asset_host=o)),as(t.property_blacklist)&&(Bo(t.property_denylist)?n.property_denylist=t.property_blacklist:as(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ui.error(CGt+t.property_denylist)),n};var $Go=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(t){ui.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},tq=class GM{mu(e){if(!e)return;const n=this.uu.indexOf(e);n!==-1&&this.uu.splice(n,1)}yu(e,n){var o;return this.mu(e),this.uu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.ku)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;const e=this.persistence;if(!e)return;this.xu()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(TB());this.register({distinct_id:o,$device_id:o}),e.set_property($y,Yb)}this.Cu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.$u=!1,this.Tu=!1,this.webPerformance=new $Go,this.Iu=!1,this.version=n_.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new kge,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=KNe(),this.SentryIntegration=cGo,this.sentryIntegration=o=>(function(i,r){const s=xOt(i,r);return{name:yOt,processEvent:a=>s(a)}})(this,o),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new DGo(this),this.pageViewManager=new EOt(this),this.rateLimiter=new IGo(this),this.requestRouter=new FGo(this),this.consent=new eGo(this),this.externalIntegrations=new YGo(this);const n=(e=GM.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(o,i,r)=>{const s=rA(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=rA(o)?{[o]:i}:o;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",o=>ui.info(`send "${o?.event}"`,o))}init(e,n,o){if(o&&o!==eq){var i;const r=(i=q$[o])!==null&&i!==void 0?i:new GM;return r._init(e,n,o),q$[o]=r,q$[eq][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=rA(e)?e.trim():"";if(!a)return ui.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var A;if(this.__loaded)return a!==((A=this.config)===null||A===void 0?void 0:A.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=KNe(n.defaults),n.debug=this.Du(n.debug),this.Lu=n,this.Nu=[],n.person_profiles?this.Fu=n.person_profiles:n.process_person&&(this.Fu=n.process_person);const c=KNe(n.defaults),l=EGt(n),u=Mu({},c,l,{name:o,token:a});QA(c.rageclick)&&QA(l.rageclick)&&(u.rageclick=Mu({},c.rageclick,l.rageclick)),QA(c.session_recording)&&QA(l.session_recording)&&(u.session_recording=Mu({},c.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&ui.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:lE.GZipJS;const g=this.xu();if(this.persistence=new QNe(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new QNe(sn(sn({},this.config),{},{persistence:"sessionStorage"}),g,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!g&&nu.Et()){const _=nu.Dt(this.Eu);as(_)&&_.forEach(f=>{rA(f)&&this.Mu.add(f)})}else nu.Lt(this.Eu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new wGo((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new MGo(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new cGt(this),this.sessionPropsManager=new aGt(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,f,I)=>{(I?.activityTimeout||I?.sessionPastMaximumLength||I?.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(ui.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(p)},0)):(ui.info("Initializing extensions synchronously"),this.Uu(p)),n_.DEBUG=n_.DEBUG||this.config.debug,n_.DEBUG&&ui.info("Starting in debug mode",{this:this,config:n,thisC:sn({},this.config),p:h,s:d}),this.config.identity_distinct_id&&!(!((i=n.bootstrap)===null||i===void 0)&&i.distinctID)&&(n.bootstrap=sn(sn({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=(r=n.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.ku=!!m&&!b$(m),(s=n.bootstrap)===null||s===void 0?void 0:s.distinctID){const _=n.bootstrap.distinctID,f=this.get_distinct_id(),I=this.persistence.get_property($y);if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="anonymous")this.identify(_);else if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="identified")ui.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const C=this.config.get_device_id(TB()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property($y,n.bootstrap.isIdentifiedID?Bge:Yb),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:ANe,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(TB());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property($y,Yb)}return Cl(Ln,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Cl(Ln,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?COt(this,()=>this.Wu()):this.Wu(),nf(this.config._onCapture)&&this.config._onCapture!==X$&&(ui.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&ui.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return uGt.apply(this,arguments)})().then(_=>{_&&this.register({[jDe]:_})}).catch(X$),this}Vu(e){const n=e;return rA(n.name)&&nf(n.setup)}Gu(e,n){this.Vu(e)?n.push(()=>{this.Zu().add(e).catch(()=>{var o;return(o=e.dispose)===null||o===void 0?void 0:o.call(e)}).catch(o=>{ui.error(`Failed to dispose browser extension "${e.name}"`,o)})}):this.uu.push(e)}zu(){var e,n,o;const i=(e=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:(o=GM.__defaultExtensionClasses)===null||o===void 0?void 0:o.featureFlags;var r,s,a;i&&(this.featureFlags&&this.featureFlags instanceof i||((r=this.Qu)===null||r===void 0||r.call(this),this.Qu=void 0,this.featureFlags=new i(this)),nf(this.featureFlags.onReloading)&&nf(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(s=(a=this.featureFlags).initialize)===null||s===void 0||s.call(a))}Uu(e){const n=performance.now(),o=sn(sn({},GM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,u;o.exceptions&&this.uu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.uu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.uu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.uu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.uu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.Gu(this.autocapture=new o.autocapture(this),i),o.surveys&&this.Gu(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new o.surveys(this),i),o.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new o.logs(this),i),o.metrics&&this.uu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.uu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.uu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.uu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.uu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,AGo)),o.toolbar&&this.uu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.uu.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new o.experiments(this)),this.uu.forEach(g=>{g.initialize&&i.push(()=>{var h;(h=g.initialize)===null||h===void 0||h.call(g)})}),i.push(()=>{if(this.Ju){const g=this.Ju;this.Ju=void 0,this.uu.forEach(h=>{var d;return(d=h.onRemoteConfig)===null||d===void 0?void 0:d.call(h,g)})}}),this.Ku(i,n)}Ku(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,n)},0);const i=e.shift();if(i)try{i()}catch(r){ui.error("Error initializing extension:",r)}}const o=Math.round(performance.now()-n);this.register_for_session({[GHt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[YHt]:o}),this.config.__preview_deferred_init_extensions&&ui.info(`PostHog extensions initialized (${o}ms)`)}il(e){var n;if(!No||!No.body)return ui.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.du=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=Is(i.supportedCompression,lE.GZipJS)?lE.GZipJS:Is(i.supportedCompression,lE.Base64)?lE.Base64:void 0),!((o=i.analytics)===null||o===void 0)&&o.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:VHt}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(e),this.uu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}Wu(){try{this.config.loaded(this)}catch(e){ui.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&fd?.hostname){const e=fd.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new HOt(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qu)===null||e===void 0||e.enable())}_dom_loaded(){this.is_capturing()&&JO(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,n,o,i,r,s;this.$u=!0,(e=this.surveys)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e),(o=this.metrics)===null||o===void 0||o.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(zHt),(i=this.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=this.qu)===null||r===void 0||r.unload(),(s=this.Bu)===null||s===void 0||s.unload()):this.ih()&&this.capture(zHt,null,{transport:"sendBeacon"})}_send_request(e){sGt(this,e)}ju(e,n){this.Bu?this.Bu.retriableRequest(e,n):this._send_request(n?sn(sn({},e),{},{transport:n}):e)}_execute_array(e){UNe++;try{let n;const o=[],i=[],r=[];JO(e,a=>{if(a)if(n=a[0],as(n))r.push(a);else if(nf(a))try{a.call(this)}catch(A){ui.error("Error executing queued PostHog call",a,A)}else as(a)&&n==="alias"?o.push(a):as(a)&&n.indexOf("capture")!==-1&&nf(this[n])?r.push(a):i.push(a)});const s=function(a,A){JO(a,function(c){try{if(as(c[0])){let l=A;Tl(c,function(u){l=l[u[0]].apply(l,u.slice(1))})}else A[c[0]].apply(A,c.slice(1))}catch(l){ui.error("Error executing queued PostHog call",c,l)}})};s(o,this),s(i,this),s(r,this)}finally{UNe--}}push(e){if(UNe>0&&as(e)&&rA(e[0])){const n=GM.prototype[e[0]];return void(nf(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:QHt,persistenceKey:KO,cookieName:"_fbc",pattern:yGt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[KO]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(KO)}}}get sh(){return{property:vHt,persistenceKey:P$,cookieName:"_fbp",pattern:xGt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[P$]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(P$)}}}rh(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return rA(o)&&e.pattern.test(o)?{value:o,delivered:!1}:QA(o)&&rA(o.value)&&e.pattern.test(o.value)?{value:o.value,delivered:o.delivered===!0}:void 0}oh(e,n,o){return n===o?.value?{value:n,pending:!o.delivered}:(e.register(n,!1),{value:n,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.bu())return;const n=k$(e.cookieName);return rA(n)&&e.pattern.test(n)?n:void 0}uh(e,n,o,i){if(!this.persistence)return;const r=this.nh;this.persistence.refreshKey(r.persistenceKey);const s=this.rh(r);if(i)return void r.unregister();if(o)return rA(n)&&yGt.test(n)?this.oh(r,n,s):void r.unregister();const a=rA(e)&&zGo.test(e)?e:void 0,A=this.ah(r);return A&&((c,l,u)=>{const g=c.split(".");if(l)return g[3]===l;if(!u)return!0;const h=u.value.split(".");return g[3]===h[3]||Number(g[2])>Number(h[2])})(A,a,s)?this.oh(r,A,s):a?s?.value.split(".")[3]===a?{value:s.value,pending:!s.delivered}:this.oh(r,`fb.1.${Date.now()}.${a}`,s):s?{value:s.value,pending:!s.delivered}:void 0}hh(e,n,o){if(!this.persistence)return;const i=this.sh;this.persistence.refreshKey(i.persistenceKey);const r=this.rh(i);if(o)return void i.unregister();if(n)return rA(e)&&xGt.test(e)?this.oh(i,e,r):void i.unregister();const s=this.ah(i);return s?this.oh(i,s,r):r?{value:r.value,pending:!r.delivered}:void 0}dh(e,n){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const o=this.rh(e);o?.value!==n||o.delivered||e.register(n,!0)}capture(e,n,o){var i,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void ui.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Bo(e)||!rA(e))return void ui.error("No event name provided to posthog.capture");this.Su();const s=!this.config.opt_out_useragent_filter&&this._is_bot();if(s&&!this.config.__preview_capture_bot_pageviews)return;const a=o?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void ui.critical("This capture call is ignored due to client rate limiting.");let A;n?.$current_url&&!rA(n?.$current_url)&&(ui.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||o?.fh||ui.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(A=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const c=new Date,l=o?.timestamp||c,u=zLt(o?.uuid,TB);let g={uuid:u,event:e,properties:this.calculateEventProperties(e,n||{},l,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),a&&(g.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const h=e==="$feature_flag_called"&&g.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;o?.$set&&!h&&(g.$set=o?.$set);const d=QA(n?.$set)?n.$set:void 0,p=as(n?.$unset)?n.$unset:[],m=o?.$unset||[],_=R=>{var F;const O=!!o?.$set&&R in o.$set;return{hasProvided:O||!!d&&R in d,provided:O?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:p.indexOf(R)!==-1||m.indexOf(R)!==-1}},f=_(QHt),I=_(vHt),C=[{channel:this.nh,hasProvided:f.hasProvided,update:this.uh(A?.fbclid,f.provided,f.hasProvided,f.unset)},{channel:this.sh,hasProvided:I.hasProvided,update:this.hh(I.provided,I.hasProvided,I.unset)}];for(const{channel:R,hasProvided:F,update:O}of C)O&&g.properties.$process_person_profile===!0&&O.pending&&!F&&!h&&(g.$set=sn({[R.property]:O.value},g.$set));const y=o?.$unset;y&&(g.$unset=y);const x=h?void 0:this.ph(o?.$set_once,e!==WHt,e===JHt);if(x&&(g.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,g=(function(R,F){const O=new Set;return(function U(Y,W){if(Y!==Object(Y))return F?F(Y):Y;if(O.has(Y))return;let te;if(O.add(Y),as(Y))te=[],JO(Y,j=>{te.push(U(j))});else{const j={};Tl(GO(Y)?jHt(Y):Y,(J,ie)=>{O.has(J)||(j[ie]=U(J))}),te=j}return te})(R)})(g,R=>rA(R)?R.slice(0,E):R)),g.timestamp=l,Bo(o?.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=c),h&&(g.properties=((R,F=[])=>{const O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return sOo.forEach(U),F.forEach(U),O})(g.properties,JGo)),e===Vb.DISMISSED||e===Vb.SENT){const R=n?.[wNe.SURVEY_ID],F=n?.[wNe.SURVEY_ITERATION];mGt({id:R,current_iteration:F}),g.$set=sn(sn({},g.$set),{},{[RGo({id:R,current_iteration:F},e===Vb.SENT?"responded":"dismissed")]:!0})}else e===Vb.SHOWN&&(g.$set=sn(sn({},g.$set),{},{[wNe.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===fGo.SHOWN){const R=n?.[FOt.TOUR_TYPE];R&&(g.$set=sn(sn({},g.$set),{},{[`${FOt.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},g.properties.$set),g.$set);if(Nx(B)||this.setPersonPropertiesForFlags(B),!Us(this.config.before_send)){const R=this.Os(g);if(!R)return;g=R,g.uuid=zLt(g.uuid,TB)}const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const W=(O=(U=g.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O:QA((Y=g.properties)===null||Y===void 0?void 0:Y.$set)?g.properties.$set[R.property]:void 0;return F?.pending&&W===F.value});this.vu.emit("eventCaptured",g);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:g,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=g.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:g.properties.$session_id+(g.properties.$window_id?`-${g.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:O}of S)this.dh(F,O.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly||S.length){var k;let R;!M.transport&&!M.callback&&Nx((k=this.config.request_headers)!==null&&k!==void 0?k:{})&&this.$u&&(R="sendBeacon"),this.ju(M,R)}else this.qu.enqueue(M);return g}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}getExtension(e){var n;return(n=this.Xu)===null||n===void 0?void 0:n.getExtension(e)}Zu(){var e;return(e=this.Xu)!==null&&e!==void 0?e:this.Xu=new VGo(this)}pu(e){this.Pu.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Pu.indexOf(e);o!==-1&&this.Pu.splice(o,1)}}gh(e=!0){var n,o,i;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((i=this.sessionPersistence)===null||i===void 0||i.clear(),this.Mu.clear(),this.mh()),(o=this.featureFlags)===null||o===void 0||o.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,o,i,r){if(o=o||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gh();const s=r?void 0:this.persistence.remove_event_timer(e);let a=sn({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.bu()&&(a[OHt]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!rA(a.distinct_id)&&!sh(a.distinct_id)||b$(a.distinct_id))&&ui.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const A=(function(f,I,C,y=!1){var x,E,B,S;if(!Wy)return{};const Q=f?[...eG,...I||[]]:[],[w,M]=GLt(Wy),[k,R]=(function(oe){for(let ne=0;ULt.length>ne;ne++){const[ge,ue,_e]=ULt[ne],le=oe.match(ge);if(le){const fe=_e&&oe.match(_e)||le;return[ue,fe?.[1]||""]}}return["",""]})(Wy),F=(function(){const oe="u">typeof navigator?navigator:void 0;return oe?.brave?{brave:!0}:{}})(),O={};Bo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,W=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,te=Ln==null||(B=Ln.screen)===null||B===void 0?void 0:B.width,j=Ln==null||(S=Ln.screen)===null||S===void 0?void 0:S.height,J=Ln?.devicePixelRatio;Bo(Y)||(U.userAgentDataPlatform=Y),Bo(W)||(U.maxTouchPoints=W),Bo(te)||(U.screenWidth=te),Bo(j)||(U.screenHeight=j),Bo(J)||(U.devicePixelRatio=J);const ie=Mu(uNe({$os:w,$os_version:M,$browser:HLt(Wy,navigator.vendor,F,O),$webview_app:k,$webview_app_version:R,$device:YLt(Wy),$device_type:vHo(Wy,U),$timezone:NOt(),$timezone_offset:pGo()}),{$current_url:K$(y?Qw(fd?.href):fd?.href,Q,V$),$host:fd?.host,$pathname:fd?.pathname,$raw_user_agent:Wy.length>1e3?Wy.substring(0,997)+"...":Wy,$browser_version:QHo(Wy,navigator.vendor,F,O),$browser_language:wOt(),$browser_language_prefix:hGo(),$screen_height:Ln?.screen.height,$screen_width:Ln?.screen.width,$viewport_height:Ln?.innerHeight,$viewport_width:Ln?.innerWidth,$lib:Hb.LIB_NAME,$lib_version:Hb.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Hb.SDK_DIST_CHANNEL&&(ie.$sdk_dist_channel=Hb.SDK_DIST_CHANNEL),ie})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:f,windowId:I}=this.sessionManager.checkAndGetSessionAndWindowId(r,o.getTime(),!0);a.$session_id=f,a.$window_id=I}this.sessionPropsManager&&Mu(a,this.sessionPropsManager.getSessionProps());try{var c;this.sessionRecording&&Mu(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(c=this.Bu)===null||c===void 0?void 0:c.length}catch(f){a.$sdk_debug_error_capturing_properties=String(f)}let l;if(this.requestRouter.region===YNe&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||r?e!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(o):this.pageViewManager.doPageView(o,i),a=Mu(a,l),e==="$pageview"&&No&&(a.title=No.title),!Bo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}Wy&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const u=this.persistence.properties(),g=this.sessionPersistence.properties(),h=a.$groups,d=u.$groups;QA(h)&&!Nx(h)&&(a.$groups=sn(sn({},QA(d)?d:{}),h)),Tl(["$referrer","$referring_domain"],f=>{f in u&&delete g[f]});const p={};if(this.Pu.length>0)for(const f of this.Pu.slice())try{Mu(p,f())}catch(I){ui.error("Failed to produce browser extension event properties",I)}a=Mu({},A,u,g,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),as(this.config.property_denylist)?Tl(this.config.property_denylist,function(f){delete a[f]}):ui.error(CGt+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(ui.error(IGt),a=m(a,e));const _=this.yh();return a.$process_person_profile=_,_&&!r&&this.bh("_calculate_event_properties"),a}ph(e,n=!0,o=!1){var i;if(!this.persistence||!this.yh()||this.Iu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=Mu({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(ui.error(IGt),a=A(a,"$set_once")),n&&(this.Iu=!0),Nx(a)?void 0:a}register(e,n){var o;(o=this.persistence)===null||o===void 0||o.register(e,n)}register_once(e,n,o){var i;(i=this.persistence)===null||i===void 0||i.register_once(e,n,o)}register_for_session(e){var n,o;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gh(),(o=this.sessionPersistence)===null||o===void 0||o.register(e),Object.keys(e).forEach(i=>this.Mu.add(i)),this.mh()}unregister(e){var n;(n=this.persistence)===null||n===void 0||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e),this.Mu.delete(e),this.mh()}_h(e,n){this.register({[e]:n})}Hu(){this.Mu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Mu.clear(),this.mh()}mh(){var e;if(!this.Eu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.mi||!nu.Et())return void nu.Lt(this.Eu);const n=[];this.Mu.forEach(o=>n.push(o)),n.length>0?nu.At(this.Eu,n):nu.Lt(this.Eu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.vu.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Z$}),()=>{})}onSessionId(e){var n,o;return(n=(o=this.sessionManager)===null||o===void 0?void 0:o.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n=!1){this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:Z$})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Z$})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=HGo){var o;(o=this.surveys)===null||o===void 0||o.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,o;return(n=(o=this.surveys)===null||o===void 0?void 0:o.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:Z$}}canRenderSurveyAsync(e,n=!1){var o,i;return(o=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurveyAsync(e,n))!==null&&o!==void 0?o:Promise.resolve({visible:!1,disabledReason:Z$})}wh(e){return!e||b$(e)?(ui.critical("Unique user id has not been set in posthog.identify"),!1):e==="$posthog_cookieless"?(ui.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(ui.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.`),!1)}identify(e,n,o){if(!this.__loaded||!this.persistence)return ui.uninitializedWarning("posthog.identify");if(sh(e)&&(e=e.toString(),ui.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(e)||!this.bh("posthog.identify"))return;this.Su();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.gh(!1),a=this.persistence.Da();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(xge),this.register({distinct_id:e}));const u=(this.persistence.get_property("$user_state")||"anonymous")===Yb,g=e!==l,h=!g&&u;if(g&&u){var c;const d=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property($y,Bge),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Ou=GNe(e,n,o)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(h){this.persistence.set_property($y,Bge);const d=n||{},p=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:d,$set_once:p})&&(this.Ou=GNe(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);g||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Mw)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.ja(A)}}setPersonProperties(e,n){if(!e&&!n||!this.bh("posthog.setPersonProperties"))return;const o=GNe(this.get_distinct_id(),e,n);this.Ou!==o?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}})&&(this.Ou=o)):ui.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var n;const o=(as(e)?e:[e]).filter(i=>rA(i)&&i.length>0);o.length!==0&&this.bh("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(o,!0),this.capture("$set",{$unset:o}),this.Ou=null)}group(e,n,o){var i;if(!e||!n)return void ui.error("posthog.group requires a group type and group key");(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.gh();const r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:sn(sn({},r),{},{[e]:n})}),(s||o)&&this.yh()){const a={$group_type:e,$group_key:n};o&&(a.$group_set=o),this.capture(WHt,a)}o&&this.setGroupPropertiesForFlags({[e]:o}),s&&!o&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n=!0){var o;(o=this.featureFlags)===null||o===void 0||o.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n=!0){var o;this.bh("posthog.setGroupPropertiesForFlags")&&((o=this.featureFlags)===null||o===void 0||o.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(e)}reset(e){const n=jy(e)?e:e?.resetDeviceID,o=jy(e)||e==null?void 0:e.bootstrap;this.kh(n,!1,o)}kh(e,n=!1,o){var i,r,s,a,A,c;if(ui.info("reset"),!this.__loaded)return ui.uninitializedWarning("posthog.reset");const l=o?.sessionID;this.config.bootstrap=o||((i=this.Lu)===null||i===void 0?void 0:i.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(s=r.updateConfig)===null||s===void 0||s.call(r,this.config,this.nl());const u=this.get_property(WDe),g=this.get_property(jDe),h=this.get_property(M$);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const d=this.is_capturing();this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const p=(A=this.persistence)===null||A===void 0||(c=A.Da)===null||c===void 0?void 0:c.call(A);let m=!1;try{var _,f,I,C,y,x,E,B,S,Q,w,M,k;if((_=this.persistence)===null||_===void 0||_.clear(),(f=this.sessionPersistence)===null||f===void 0||f.clear(),this.Mu.clear(),this.mh(),Bo(h)||(Q=this.persistence)===null||Q===void 0||Q.register({$session_recording_remote_config:h}),(I=this.surveys)===null||I===void 0||I.reset(),(C=this.featureFlags)===null||C===void 0||C.reset(),(y=this.conversations)===null||y===void 0||y.reset(),(x=this.logs)===null||x===void 0||x.reset(),(E=this.metrics)===null||E===void 0||E.reset(),(B=this.persistence)===null||B===void 0||B.set_property("$user_state","anonymous"),(S=this.sessionManager)===null||S===void 0||S.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ANe,$device_id:null},"");else{const O=this.config.get_device_id(TB());this.register_once({distinct_id:O,$device_id:e?O:u},""),e||Bo(g)||this.register({[jDe]:g})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.bu()&&((k=this.persistence)===null||k===void 0||k.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(w=this.featureFlags)===null||w===void 0||w.initialize(),!Us(l)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(l,!0)))){const O=sn({},o);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,F;p&&((R=this.persistence)===null||R===void 0||(F=R.ja)===null||F===void 0||F.call(R,m))}this.reloadFeatureFlags()}shutdown(e){var n=this;return eg(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.Tu=!0,n.Zu().dispose(),(o=n.sessionRecording)===null||o===void 0||o.dispose(),(i=n.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=n.metrics)===null||r===void 0||r.flush("sendBeacon"),(s=n.metrics)===null||s===void 0||s.dispose(),(a=n.qu)===null||a===void 0||a.unload(),(A=n.Bu)===null||A===void 0||A.unload();try{var u;(u=n.featureFlags)===null||u===void 0||u.destroy()}catch(g){ui.error("Error while destroying feature flags",g)}(c=n.persistence)===null||c===void 0||c.destroy(),(l=n.sessionPersistence)===null||l===void 0||l.destroy()}else ui.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,n){var o;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(o=this.conversations)===null||o===void 0||o.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)===null||e===void 0||e.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:o}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(e?.withTimestamp&&o){var r;const s=(r=e.timestampLookBack)!==null&&r!==void 0?r:10;if(!o)return i;i+=`?t=${Math.max(Math.floor((new Date().getTime()-o)/1e3)-s,0)}`}return i}alias(e,n){return e===this.get_property("$people_distinct_id")?(ui.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Bo(n)&&(n=this.get_distinct_id()),e!==n?(this._h(xge,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(ui.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const n=sn({},this.config);if(QA(e)){var o,i,r,s,a,A,c,l,u,g,h,d,p,m;Mu(this.config,EGt(e));const f=this.xu();(o=this.persistence)===null||o===void 0||o.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new QNe(sn(sn({},this.config),{},{persistence:"sessionStorage"}),f,!1);const I=this.Du(this.config.debug);var _;jy(I)&&(this.config.debug=I),jy(this.config.debug)&&(this.config.debug?(n_.DEBUG=!0,hc.Et()&&hc.At("ph_debug",!0),ui.info("set_config",{config:e,oldConfig:n,newConfig:sn({},this.config)})):(n_.DEBUG=!1,hc.Et()&&hc.Lt("ph_debug"))),(i=this.featureFlags)===null||i===void 0||(r=i.updateConfig)===null||r===void 0||r.call(i,this.config,this.nl()),(s=this.exceptionObserver)===null||s===void 0||s.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(A=this.metrics)===null||A===void 0||A.onConfigChange(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(l=this.tracingHeaders)===null||l===void 0||l.startIfEnabledOrStop(),(u=this.autocapture)===null||u===void 0||u.startIfEnabled(),(g=this.heatmaps)===null||g===void 0||g.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(h=this.exceptionObserver)===null||h===void 0||h.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)===null||d===void 0||d.startIfEnabledOrStop(),(p=this.surveys)===null||p===void 0||p.loadIfEnabled(),this.Cu(),(m=this.externalIntegrations)===null||m===void 0||m.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&COt(this,X$,!1)}}_overrideSDKInfo(e,n){n_.LIB_NAME=e,n_.LIB_VERSION=n}startSessionRecording(e){const n=e===!0,o={sampling:n||!!e?.sampling,linked_flag:n||!!e?.linked_flag,url_trigger:n||!!e?.url_trigger,event_trigger:n||!!e?.event_trigger};var i,r,s,a,A;Object.values(o).some(Boolean)&&((i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),o.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),o.linked_flag&&((s=this.sessionRecording)===null||s===void 0||s.overrideLinkedFlag()),o.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),o.event_trigger&&((A=this.sessionRecording)===null||A===void 0||A.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===void 0)&&e.started)}captureException(e,n){try{if(!this.exceptions)return;const o=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(sn(sn({},o),n))}catch{return}}addExceptionStep(e,n){var o;(o=this.exceptions)===null||o===void 0||o.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)===null||n===void 0||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&e!==void 0?e:GM.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,o;return(n=(o=this.toolbar)===null||o===void 0?void 0:o.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[e]}toString(){var e;let n=(e=this.config.name)!==null&&e!==void 0?e:eq;return n!==eq&&(n="posthog."+n),n}_isIdentified(){var e,n;return((e=this.persistence)===null||e===void 0?void 0:e.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}yh(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Nx(this.getGroups())&&!(!((e=this.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return this.config.person_profiles==="never"?(ui.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(aNe,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}Cu(){var e,n;const o=this.xu();var i,r,s;return this.is_capturing()||(i=this.logs)===null||i===void 0||i.$h(),((e=this.persistence)===null||e===void 0?void 0:e.mi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.mi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),o&&(this.Mu.clear(),this.mh()),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.bu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new cGt(this),this.pageViewManager=new EOt(this),this.persistence&&(this.sessionPropsManager=new aGt(this,this.sessionManager,this.persistence));const h=(s=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&s!==void 0?s:(A=GM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.yu(this.sessionRecording,new h(this)),this.du&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.du)))}var u,g;this.consent.optInOut(!0),this.Cu(),this.Yu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((u=this.surveys)===null||u===void 0||u.loadIfEnabled()),(Bo(e?.captureEventName)||e?.captureEventName)&&this.capture((g=e?.captureEventName)!==null&&g!==void 0?g:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else ui.warn(fGt)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void ui.warn(fGt);const e=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var n,o;e?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ANe,$device_id:null}),this.mu(e),this.sessionRecording=void 0,(n=this.sessionManager)===null||n===void 0||n.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Cu()}_is_bot(){return tf?lGt(tf,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(lNe,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(T$,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),Cl(No,T$,this.Au)))}debug(e){e===!1?(Ln?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ln?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}nl(){const e=this.Lu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(ui.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,o,i,r,s){const a=o in n&&!Us(n[o]),A=i in n&&!Us(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,ui)}Os(e){var n;if(Us(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(mHo),i=as(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=e;for(const s of i)try{if(r=s(r),Us(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return pHo(e.event)?ui.warn(`${a}. This can cause unexpected behavior.`):ui.info(a),null}r.properties&&!Nx(r.properties)||ui.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return ui.error(`Error in beforeSend function for event '${e.event}':`,a),null}for(const s of o)if(r.properties&&Us(r.properties[s]))return ui.warn(`Event '${e.event}' had its '${s}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var e;return(e=this.pageViewManager.Vo)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Du(e){const n=jy(e)&&!e,o=hc.Et()&&hc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};tq.__defaultExtensionClasses={},tq.Ch=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(let n=0;e.length>n;n++)t.prototype[e[n]]=VOo(t.prototype[e[n]])})(tq,["identify"]);var BGt=class{constructor(t){this.disabled=t===!1;const e=QA(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,n){if(this.disabled)return!1;const o=this.clicks[this.clicks.length-1];if(o&&Math.abs(t-o.x)+Math.abs(e-o.y)<this.thresholdPx&&this.timeoutMs>n-o.timestamp){if(this.clicks.push({x:t,y:e,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:n}];return!1}};const VNe="$copy_autocapture",zNe=Cd("[AutoCapture]");function JNe(t,e){return e.length>t?e.slice(0,t)+"...":e}function qGo(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!g6(e));return e}function XGo(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!g6(t))return{props:{}};const c=[t],l=new Set([t]);let u=t;for(;u.parentNode&&!AI(u,"body")&&1e3>c.length;){if(INe(u.parentNode)){const x=u.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),u=x;continue}if(!g6(u.parentNode)||l.has(u.parentNode))break;l.add(u.parentNode),c.push(u.parentNode),u=u.parentNode}const g=e.type==="click"&&t.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(x=>AI(x,"button")||AI(x,"a")):-1;g>0&&(o=o||c.slice(0,g+1).some(x=>!qO(x)||O$(x)));const h=[],d={};let p,m=!1,_=!1;if(Tl(c,x=>{const E=qO(x);if(AI(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&G$(B))&&(s?Qw(B):B)}Is($O(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,w,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};yNe.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?JNe(1024,mOt(B)):JNe(1024,L$(B)));const F=$O(B);S||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(W){return W!==""})),Tl(B.attributes,function(W){var te;if((!O$(B)||["name","id","class","aria-label"].indexOf(W.name)!==-1)&&!w?.includes(W.name)&&!S&&G$(W.value)&&(!rA(te=W.name)||te.substring(0,10)!=="_ngcontent"&&te.substring(0,7)!=="_nghost")){let j=W.value;W.name==="class"&&(j=CNe(j).join(" ")),R["attr__"+W.name]=JNe(1024,W.name==="href"&&M?Qw(j):j)}});let O=1,U=1,Y=B;for(;Y=qGo(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),Tl((function(B){if(!qO(B))return{};const S={};return Tl(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&G$(M)&&(S[w]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(g>0&&(t=c[g],h.splice(0,g)),o||(h[0].$el_text=AI(t,"a")||AI(t,"button")?mOt(t):L$(t)),m){var f,I;h[0].attr__href=m;const x=(f=Ub(m))===null||f===void 0?void 0:f.host,E=Ln==null||(I=Ln.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:Mu((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,as(C)?(function(x){return x.map(E=>{var B,S;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const k of E.attr_class)Q+=`.${k.replace(/"/g,"")}`}const w=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(S=E.nth_of_type)!==null&&S!==void 0?S:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return Sge(w).sort(([k],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(k,R)).forEach(([k,R])=>M[fOt(k.toString())]=fOt(R.toString())),Q+=":",Q+=Sge(M).map(([k,R])=>`${k}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,S;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(S=E.attr__href)===null||S===void 0?void 0:S.slice(0,2048),attr_class:sGo(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return Sge(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},p&&e.type==="click"?{$external_click_url:p}:{},d),target:t};var C,y}var ZGo=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(t){var e;if(!qO(t))return!0;const n=(e=this.bo().css_selector_ignorelist)!==null&&e!==void 0?e:BNe,o=new Set;let i=t;for(;i;){if(o.size>=1e3||o.has(i))return!0;o.add(i);const r=i,s=$O(r);if(Is(s,"ph-no-capture")||Is(s,"ph-sensitive")||O$(r)||n.some(A=>xNe(r,A)))return!0;const a=i.parentNode;i=INe(a)?a.host:a&&g6(a)?a:null}return!1}_o(t){if(!this.isEnabled||t.type==="pointercancel")return void this.fo();if(t.type==="pointerdown"){this.fo();const o=H$(t);var e;return void(t.isPrimary&&t.button===0&&!t.ctrlKey&&o&&g6(o)&&(this.po={target:o,excluded:this.yo(o),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:(e=this.wo)===null||e===void 0?void 0:e.distinctId}))}const n=this.po;n&&(t.pointerId!==n.id||Math.abs(t.clientX-n.x)>5||Math.abs(t.clientY-n.y)>5?this.fo():t.type==="pointerup"&&(n.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(t){var e;const n=this.po;this.fo();const o=H$(t);if(n?.released&&n.target.isConnected&&n.distinctId===((e=this.wo)===null||e===void 0?void 0:e.distinctId)&&t.pointerId===n.id&&(t.detail>0||t.pointerType==="touch"||t.pointerType==="pen")&&t.button===0&&5>=Math.abs(t.clientX-n.x)&&5>=Math.abs(t.clientY-n.y)&&o&&(AI(o,"html")||AI(o,"body"))){var i;if(n.excluded)return null;const r=(i=this.bo().css_selector_ignorelist)!==null&&i!==void 0?i:BNe;return[o,No?.documentElement,No?.body].some(s=>{if(!s)return!1;const a=$O(s);return Is(a,"ph-no-capture")||Is(a,"ph-sensitive")||!qO(s)||O$(s)||r.some(A=>xNe(s,A))})?null:n.target}}constructor(t){this.So=t,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new BGt(this.Rr.rageclick),this.Mo=null}setup(t){this.Eo(),this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?e.dispose():(this.Po=e,this.startIfEnabled())}dispose(){var t;this.Io||(this.Io=!0,this.wo=void 0,(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var t,e;return this.bo(),this.Rr.url_allowlist=(t=this.Rr.url_allowlist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),this.Rr.url_ignorelist=(e=this.Rr.url_ignorelist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),this.Rr}Ao(){if(!this.isBrowserSupported())return void zNe.info("Disabling Automatic Event Collection because this browser is not supported");if(!Ln||!No)return;const t=this.Fo=e=>{e=e||Ln?.event;try{if(e.type==="blur")return void this.fo();if(e.type.indexOf("pointer")===0)return void this._o(e);const n=e.type==="click"?this.ko(e):void 0;if(Id(n))return;this.Oo(e,"$autocapture",n)}catch(n){zNe.error("Failed to capture event",n)}};if(Cl(Ln,"blur",t),Cl(No,"submit",t,{capture:!0}),Cl(No,"change",t,{capture:!0}),Cl(No,"click",t,{capture:!0}),Tl(["pointerdown","pointermove","pointerup","pointercancel"],e=>{Cl(No,e,t,{capture:!0})}),this.bo().capture_copied_text){const e=this.Do=n=>{n=n||Ln?.event;try{this.Oo(n,VNe)}catch(o){zNe.error("Failed to capture clipboard event",o)}};Cl(No,"copy",e,{capture:!0}),Cl(No,"cut",e,{capture:!0}),Cl(No,"paste",e,{capture:!0})}}Ro(){this.fo(),this.Fo&&(Ln?.removeEventListener("blur",this.Fo),Tl(["pointerdown","pointermove","pointerup","pointercancel"],t=>{No?.removeEventListener(t,this.Fo,!0)}),No?.removeEventListener("submit",this.Fo,!0),No?.removeEventListener("change",this.Fo,!0),No?.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(No?.removeEventListener("copy",this.Do,!0),No?.removeEventListener("cut",this.Do,!0),No?.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(t){if(this.Io)return;if(this.$o=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.To=e.elementsChainAsString);const n=e.autocapture_opt_out;var o;jy(n)&&((o=this.wo)===null||o===void 0||o.kv.set("$autocapture_disabled_server_side",n),this.Co=n),this.startIfEnabled()}setElementSelectors(t){this.Mo=t}getElementSelectors(t,e){var n;const o=[];return(n=this.Mo)===null||n===void 0||n.forEach(i=>{const r=No?.querySelectorAll(i);r?.forEach(s=>{t!==s&&e!==s||Is(o,i)||o.push(i)})}),o}get isEnabled(){var t,e;if(this.Io)return!1;const n=(t=this.wo)===null||t===void 0?void 0:t.kv.get(wHt),o=this.Co,i=this.bo();if(!i.remoteRequestsDisabled&&!this.$o)return!1;const r=i.remoteRequestsDisabled&&!this.$o;if(Id(o)&&!jy(n)&&!r)return!1;const s=(e=this.Co)!==null&&e!==void 0?e:!!n;return!!i.enabled&&!s}Oo(t,e="$autocapture",n){if(!this.isEnabled)return void this.fo();let o=n||H$(t);oOt(o)&&(o=o.parentNode||null);const i=this.Eo();var r;e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&i.rageclick&&(!((r=this.rageclicks)===null||r===void 0)&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime()))&&lOt(o,i.rageclick)&&this.Oo(t,"$rageclick",n);const s=e===VNe,a=s?sn(sn({},i),{},{dom_event_allowlist:void 0}):i;if(o&&(function(u,g,h,d,p,m){var _;if(!Ln||bNe(u)||h?.url_allowlist&&!iOt(h.url_allowlist,m)||h?.url_ignorelist&&iOt(h.url_ignorelist,m))return!1;if(h?.dom_event_allowlist){const y=h.dom_event_allowlist;if(y&&!y.some(x=>g.type===x))return!1}const{parentIsUsefulElement:f,targetElementList:I}=uOt(u,d);if(!(function(y,x){const E=x?.element_allowlist;if(Bo(E))return!0;for(const B of y)if(E.some(S=>B.tagName.toLowerCase()===S))return!0;return!1})(I,h)||!ENe(I,h?.css_selector_allowlist)||ENe(I,(_=h?.css_selector_ignorelist)!==null&&_!==void 0?_:BNe))return!1;try{const y=Ln.getComputedStyle(u);if(y&&y.getPropertyValue("cursor")==="pointer"&&g.type==="click")return!0}catch{}const C=u.tagName.toLowerCase();switch(C){case"html":return!1;case"form":return(p||["submit"]).indexOf(g.type)>=0;case"input":case"select":case"textarea":return(p||["change","click"]).indexOf(g.type)>=0;default:return f?(p||["click"]).indexOf(g.type)>=0:(p||["click"]).indexOf(g.type)>=0&&(yNe.indexOf(C)>-1||u.getAttribute("contenteditable")==="true")}})(o,t,a,s,s?["copy","cut","paste"]:void 0,{config:{get_current_url:i.getCurrentUrl}})){var A;const{props:u,explicitNoCapture:g,target:h}=XGo(o,{e:t,maskAllElementAttributes:i.maskAllElementAttributes,maskAllText:i.maskAllText,elementAttributeIgnoreList:i.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:i.disableCaptureUrlHashes});if(g)return!1;const d=this.getElementSelectors(o,h);if(d&&d.length>0&&(u.$element_selectors=d),e===VNe){const p=t.type||"clipboard";if(p!=="paste"){var c,l;const m=Ln==null||(c=Ln.getSelection())===null||c===void 0?void 0:c.toString(),_=rOt(m);if(!_)return!1;u.$selected_content=_,u.$clipboard_text_length=(l=m?.length)!==null&&l!==void 0?l:0}u.$copy_type=p}return(A=this.wo)===null||A===void 0||A.capture(e,u),!0}}isBrowserSupported(){return nf(No?.querySelectorAll)}},eYo=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=QA(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const nq=Cd("[ExceptionAutocapture]"),bGt=()=>{},SGt=t=>{var e;if(nf(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function oq(t,e,n){try{if(!(e in t))return bGt;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return nf(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),t[e]=i,()=>{if(t[e]===i)return void(t[e]=o.next);let r=t[e],s=SGt(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=SGt(r)}}}catch{return bGt}}const tYo=Cd("[TracingHeaders]"),ER=Cd("[Web Vitals]"),QGt=9e5,vGt=["CLS","FCP","INP","LCP"],nYo=["INP","LCP"],oYo=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],WNe="disabled",wGt="lazy_loading",Jb=Cd("[SessionRecording]"),iYo=Cd("[Heatmaps]");function jNe(t){return QA(t)&&"clientX"in t&&"clientY"in t&&sh(t.clientX)&&sh(t.clientY)}const Hge=Cd("[Product Tours]"),$Ne=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(nNe))},rYo=["$set_once","$set"],d6=Cd("[SiteApps]"),PGt="Error while initializing PostHog app with config id ",MGt=(t,e)=>t?.then?t.then(e):e(t),rG="SDK is not enabled or survey functionality is not yet loaded",DGt="Disabled. Not loading surveys.";var sYo=class{constructor(e,n){this.So=e,this.Th=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=o=>{if(this.Io||this.Rr.disableSurveys)return;if(!o.ok)return kl.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Us(i))return kl.warn("Flags not loaded yet. Not loading surveys.");this.Ah=jy(i)?i:i.length>0,kl.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,MGt(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.Io?n.dispose():(this.Po=n,this.loadIfEnabled())})}dispose(){var e,n,o,i;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(r=>clearTimeout(r)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;const e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void kl.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void kl.info(DGt);if(e.cookielessMode&&this.So.isOptedOut())return void kl.info("Not loading surveys in cookieless mode without consent.");const n=this.So.getExtensions();if(!n)return void kl.error("PostHog Extensions not found.");if(Bo(this.Ah)&&!e.advancedEnableSurveys)return;const o=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{const i=n.generateSurveys;if(i)return this.Oh(i,o),void(this.Ih=!1);const r=n.loadExternalDependency;if(!r)return this.Dh(cNe),void(this.Ih=!1);r(s=>{try{if(this.Io)return;const a=this.So.getExtensions();s||!a?.generateSurveys?this.Dh("Could not load surveys script",s):this.Oh(a.generateSurveys,o)}finally{this.Ih=!1}})}catch(i){throw this.Ih=!1,this.Dh("Error initializing surveys",i),i}}Oh(e,n){this.Io||(this._surveyManager=e(n),this._surveyEventReceiver=this.So.createEventReceiver(),kl.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,n){kl.error(e,n),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.wo)!==null&&o!==void 0?o:this.Th;if(!i||this.Io)return;if(this.Rr.disableSurveys)return kl.info(DGt),e([]);const r=i.kv.get(iNe);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:A,context:c})=>{this.Io||e(A,c)}).catch(A=>kl.error("Error in survey callback",A));const s=this.qh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(A=>{try{return this.jh(i,A)}catch(c){return kl.error("Error processing surveys response",c),this.jh(i,{statusCode:0,error:c})}},A=>this.jh(i,{statusCode:0,error:A}));this.Eh=s;const a=()=>{this.Eh===s&&(this.Eh=null)};s.then(A=>{a(),this.Io||e(A.surveys,A.context)},a).catch(A=>kl.error("Error in survey callback",A))}qh(e,n){const o=this.wo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(rG)}))}jh(e,n){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:rG}};const o=n.statusCode;if(o!==200||!n.json){const a=`Surveys API could not be loaded, status: ${o}`;return o!==0?kl.error(a):n.error||kl.warn(a),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Ph=null;const i=n.json.surveys||[],r=i.filter(a=>(function(A){return!(!A.start_date||A.end_date)})(a)&&(gGt(a)||(function(A){var c;return!!(!((c=A.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0)&&c.length)})(a)));var s;return r.length>0&&((s=this._surveyEventReceiver)===null||s===void 0||s.register(r)),e.kv.set({[iNe]:i,[Ege]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,n;const o=(e=(n=this.wo)!==null&&n!==void 0?n:this.Th)===null||e===void 0?void 0:e.kv.get(Ege);return sh(o)&&Date.now()-o>3e5}Hh(){return sh(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};mGt(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(e){for(const n of this.Mh)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){kl.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Us(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);kl.warn("init was not called")}zh(e){let n=null;return this.getSurveys(o=>{var i;n=(i=o.find(r=>r.id===e))!==null&&i!==void 0?i:null}),n}Uh(e){if(Us(this._surveyManager))return{eligible:!1,reason:rG};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Us(this._surveyManager))return{eligible:!1,reason:rG};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Us(this._surveyManager))return kl.warn("init was not called"),{visible:!1,disabledReason:rG};const n=this.Wh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Us(this._surveyManager)?(kl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:rG})):new Promise(o=>{this.getSurveys(i=>{var r;const s=(r=i.find(a=>a.id===e))!==null&&r!==void 0?r:null;if(s){const a=this.Wh(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.So.isCapturing())return;if(Us(this._surveyManager))return void kl.warn("init was not called");const r=typeof e=="string"?this.zh(e):e;if(!r?.id)return void kl.warn("Survey not found");if(!LGo.includes(r.type))return void kl.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const s=No?.querySelector(n);if(s){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){kl.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Rh.delete(a),!this.Io&&this.So.isCapturing()&&(kl.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),kl.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else kl.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.So.isCapturing())return;if(Us(this._surveyManager))return void kl.warn("init was not called");const i=this.zh(e);if(!i)return void kl.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=sn(sn({},i),{},{appearance:sn(sn({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==PNe.Popover&&n.initialResponses&&kl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Uh(i);if(!s.eligible)return void kl.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==PNe.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Us(this._surveyManager)?kl.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function sG(t,e,n){if(Us(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var aYo=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new kge,this.Qh=(n,o)=>this.Jh(n,o)&&this.Kh(n,o)&&this.Xh(n,o)&&this.Yh(n,o),this.Jh=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Bo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.tc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e;(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,this.Zh=new kge}register(e){var n,o;if(!Bo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.Vh.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.Gh.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.Vh.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(n.event))&&this.Vh.forEach(o=>{this.ec(n,o)&&this.Zh.emit("actionCaptured",o.name)})}nc(e){this.onAction("actionCaptured",n=>e(n))}ec(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.Qh(e,o))return!0;return!1}onAction(e,n){return this.Zh.on(e,n)}Kh(e,n){if(n?.url){var o;const i=e==null||(o=e.properties)===null||o===void 0?void 0:o.$current_url;if(!i||typeof i!="string"||!sG(i,n.url,n.url_matching||"contains"))return!1}return!0}Xh(e,n){return!!this.sc(e,n)&&!!this.rc(e,n)&&!!this.oc(e,n)}sc(e,n){var o;if(!n?.href)return!0;const i=this.ac(e);if(i.length>0)return i.some(s=>sG(s.href,n.href,n.href_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&sG((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}rc(e,n){var o;if(!n?.text)return!0;const i=this.ac(e);if(i.length>0)return i.some(c=>sG(c.text,n.text,n.text_matching||"exact")||sG(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],u=/(?::|")text="(.*?)"/g;let g;for(;!Us(g=u.exec(c));)l.includes(g[1])||l.push(g[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>sG(c,a,A)));var s,a,A}oc(e,n){var o,i;if(!n?.selector)return!0;const r=e==null||(o=e.properties)===null||o===void 0?void 0:o.$element_selectors;if(r?.includes(n.selector))return!0;const s=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(n.selector_regex&&s)try{return new RegExp(n.selector_regex).test(s)}catch{return!1}return!1}ac(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}Yh(e,n){return!n?.properties||n.properties.length===0||hGt(n.properties.reduce((o,i)=>{const r=as(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return o[i.key]={values:r,operator:i.operator||"exact"},o},{}),e?.properties)}},AYo=class{constructor(e){var n,o;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(n=this._instance)===null||n===void 0||(o=n.onSessionId)===null||o===void 0?void 0:o.call(n,i=>this.vc(i))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,n){return!!e&&hGt(e.propertyFilters,n?.properties)}_c(e,n){const o=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[n])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(s=>{if(s?.name){const a=o.get(s.name)||[];a.push(i.id),o.set(s.name,a)}})}),o}wc(e,n,o){const i=(o===z$.Activation?this.uc:this.hc).get(e);let r=[];return this.kc(s=>{r=s.filter(a=>i?.includes(a.id))}),r.filter(s=>{var a;const A=(a=s.conditions)===null||a===void 0||(a=a[o])===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.find(c=>c.name===e);return this.bc(A,n)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,n){var o;Bo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.xc(e,n),this.Cc(e,n))}Cc(e,n){const o=e.filter(s=>{var a;return(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.length});var i;if(n&&this.cc.clear(),o.length===0)return void(n&&((i=this.$c)===null||i===void 0||i.replace([])));this.$c||(this.$c=new aYo(this._instance),this.$c.init(),this.$c.nc(s=>this.onAction(s)));const r=[];o.forEach(s=>{var a;(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||a.values.forEach(A=>{if(r.push(A),A.name){var c;const l=(c=this.cc.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this.cc.set(A.name,l)}})}),n?this.$c.replace(r):this.$c.register(r)}Tc(e,n){n.forEach((o,i)=>{var r;const s=(r=e.get(i))!==null&&r!==void 0?r:[];o.forEach(a=>{s.includes(a)||s.push(a)}),e.set(i,s)})}xc(e,n){var o,i;const r=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((u=c.conditions)===null||u===void 0||(u=u.events)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),s=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((u=c.conditions)===null||u===void 0||(u=u.cancelEvents)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),a=this._c(e,z$.Activation),A=this._c(e,z$.Cancellation);n?(this.uc=a,this.hc=A):(this.Tc(this.uc,a),this.Tc(this.hc,A)),(r.length!==0||s.length!==0)&&((o=this.tc)!==null&&o!==void 0||(this.tc=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,n){var o,i;const r=this.Ic(),s=(n==null||(o=n.properties)===null||o===void 0?void 0:o.$survey_id)||(n==null||(i=n.properties)===null||i===void 0?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){const A=this.Mc(e,s);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.Ec([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.Pc(s),void this.Rc([s])}if(this.hc.has(e)){const A=this.wc(e,n,z$.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.Ec(A.map(c=>c.id)),A.forEach(c=>this.Ac(c.id)))}if(!this.uc.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this.uc.get(e)});const a=this.wc(e,n,z$.Activation);this.Fc(a.map(A=>A.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var n,o;if(e.length===0)return;const i=!!(!((n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0)&&o.call(n)),r=[];for(const s of e)i&&this.fc(s)?this.Pc(s)&&this.Oc(s):r.push(s);r.length>0&&(this.lc=[...new Set([...this.lc,...r])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(o=>o!==e);const n=this.Dc();return!n.includes(e)&&(this.Lc([...n,e]),this.Nc(),!0)}Ec(e){const n=new Set(e);this.lc=this.lc.filter(r=>!n.has(r));const o=this.qc(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Lc(i),i.length===0&&this.jc()),this.Rc(e)}Bc(){var e;const n=this.gc();if(!n)return{};const o=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n];return o&&typeof o=="object"?o:{}}Oc(e){if(!this.gc())return;const n=this.Bc();this.mc(sn(sn({},n),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;const n=this.Bc(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(Nx(o)?this.yc():this.mc(o))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;const n=this.Bc()[e];return sh(n)?n:void 0}qc(){var e;const n=this.zc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Dc(){var e,n,o;const i=this.qc();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Uc()],s=(n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0?void 0:o.call(n);return s&&r===s?i:[]}Nc(){var e,n;const o=(e=this._instance)===null||e===void 0||(n=e.get_session_id)===null||n===void 0?void 0:n.call(e);o&&this.Wc(o)}jc(){this.Vc()}vc(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.Uc()];if(o&&o!==e){const i=this.qc(),r=this.Bc();i.length>0&&(this.Lc([]),i.filter(s=>sh(r[s])).forEach(s=>this.Ac(s))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,n,o;(e=this.dc)===null||e===void 0||e.call(this),this.dc=void 0,(n=this.tc)===null||n===void 0||n.call(this),this.tc=void 0,(o=this.$c)===null||o===void 0||o.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},cYo=class extends AYo{constructor(t){super(t)}zc(){return THt}Uc(){return kHt}gc(){return FHt}mc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated_timestamps:t})}yc(){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.unregister("$surveys_activated_timestamps")}fc(t){var e;let n;this.kc(i=>{n=i.find(r=>r.id===t)});const o=n==null||(e=n.appearance)===null||e===void 0?void 0:e.surveyPopupDelaySeconds;return sh(o)&&o>0}Qc(){return Vb.SHOWN}kc(t){var e;(e=this._instance)===null||e===void 0||e.getSurveys(t)}Ac(t){var e;(e=this._instance)===null||e===void 0||e.cancelPendingSurvey(t)}Ic(){return kl}Lc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated:t})}Wc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated_session:t})}Vc(){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.unregister("$surveys_activated_session")}Gc(){return!1}Mc(t,e){let n;return this.kc(o=>{n=o.find(i=>i.id===e)}),!n||(function(o){var i;return gGt(o)&&!!(!((i=o.conditions)===null||i===void 0||(i=i.events)===null||i===void 0)&&i.repeatedActivation)||o.schedule==="always"})(n)?t===Vb.SHOWN?"consume":"ignore":t===Vb.SHOWN?"persist":t===Vb.DISMISSED||t===Vb.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},lYo=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Bo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},uYo=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Vr?.__PosthogExtensions__;if(!e)return;const{generateSurveys:n,loadExternalDependency:o}=e;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:o?i=>o(this._instance,"surveys",i):void 0}}createEventReceiver(){return new cYo(this._instance)}};const gYo=Ln?.location?wge(Ln.location.hash,"__posthog")||wge(location.hash,"state"):null,NGt="_postHogToolbarParams",RGt=Cd("[Toolbar]"),TGt=Cd("[FeatureFlags]");var dYo=class{constructor(e,n=!1){this.Jc=!1,this.update(e,n)}update(e,n){this.Kc=((o,i)=>{var r,s,a,A,c,l,u,g;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Bo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(u=(g=o.evaluation_contexts)!==null&&g!==void 0?g:o.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:as(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(TGt.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),Bo(e.flag_keys)||as(e.flag_keys)||TGt.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const kGt=Cd("[FeatureFlags]"),BR=Cd("[FeatureFlags]",{debugEnabled:!0}),qNe=`" failed. Feature flags didn't load in time.`,hYo=[502,504],FGt=["click","keydown","wheel","touchstart","pointerdown"],LGt="connection_error",HGt=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},OGt=t=>{const e={};for(const[n,o]of Sge(t||{}))o&&(e[n]=o);return e},GGt=t=>GO(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),kB=Cd("[Error tracking]"),XNe="webkit-masked-url:",pYo=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],mYo=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",XNe],_Yo=["__firefox__","__gCrWeb"],YGt="Refusing to render web experiment since the viewer is a likely bot",fYo={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>Fge(e,t),not_regex:(t,e)=>!Fge(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},r4=Cd("[Conversations]"),bR="Conversations not available yet.";function UGt(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,u=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,g=Bo(u)?Math.max(l,2048):Math.max(l,u),h=sn(sn({},(function(){let d="",p="";try{const m=tf?.userAgent;m&&([d,p]=GLt(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(mHt,I)?mHt[I]:I})(m);return sn(sn({},f?{"os.name":f}:{}),_?{"os.version":_}:{})})(d,p)})()),t?.resourceAttributes);return{serviceName:(r=(s=h?.["service.name"])!==null&&s!==void 0?s:t?.serviceName)!==null&&r!==void 0?r:e?.serviceNameDefault,serviceVersion:(a=h?.["service.version"])!==null&&a!==void 0?a:t?.serviceVersion,environment:(A=h?.["deployment.environment"])!==null&&A!==void 0?A:t?.environment,resourceAttributes:h,beforeSend:t?.beforeSend,flushIntervalMs:c,maxBufferSize:l,maxQueueSize:g,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:u,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const IYo=["debug","log","warn","error","info"],CYo=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},KGt="console",VGt="__posthogHandledLogsRequestError",ZNe=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[VGt]=!0,n},zGt=t=>!!t&&typeof t=="object"&&t[VGt]===!0,Oge=Cd("[NetworkMetrics]"),eRe=()=>{var t;return!(Ln==null||(t=Ln.performance)===null||t===void 0)&&t.now?Ln.performance.now():Date.now()},yYo={"http:":80,"https:":443},xYo=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),JGt=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=Ub(o))===null||n===void 0?void 0:n.href)||o}},tRe=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,u=eRe()-o,g=Ub(e.url);if(g&&g.protocol!=="http:"&&g.protocol!=="https:")return;const h={url:g?.href||e.url,method:e.method},d=nf(c.name)?c.name(h):rA(c.name)?c.name:"http.client.request.duration";if(!d)return;const p=s&&!l?void 0:((_,f)=>_?400>_?void 0:String(_):f?.name||"_OTHER")(l,r),m=sn(sn(sn(sn(sn({},(_=>{const f=xYo.has(_)?_:"_OTHER";return sn({"http.request.method":f},f==="_OTHER"&&_!==f?{"http.request.method_original":_}:{})})(h.method)),g?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||yYo[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(f=_.pathname,f.split("/").map(I=>(C=>/^\d+$/.test(C)||C.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(C))(I)?":id":I).join("/"))};var f})(g):{}),l?{"http.response.status_code":l}:{}),p?{"error.type":p}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,h,{status:l,durationMs:u}));(A=t.metrics)===null||A===void 0||A.histogram(d,u,{unit:"ms",attributes:m})}catch(c){Oge.error("Failed to record network metric",c)}},WGt=()=>{},EYo=(t,e)=>nf(Ln?.fetch)?oq(Ln,"fetch",n=>function(...o){const i=eRe(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,u=JGt((s=(a=l?.method)!==null&&a!==void 0?a:c?.method)!==null&&s!==void 0?s:"GET",(A=c?.url)!==null&&A!==void 0?A:c);return r.then(g=>(tRe(t,u,g?.status,i,e,void 0,!0),g),g=>{throw tRe(t,u,void 0,i,e,g),g})}catch(c){return Oge.error("Failed to observe fetch",c),r}}):WGt,BYo=(t,e)=>{var n;const o=Ln==null||(n=Ln.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return WGt;const i=new WeakMap,r=oq(o,"open",a=>function(...A){try{jOt.has(this)||i.set(this,JGt(A[0],A[1]))}catch(c){Oge.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=oq(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const u=eRe();c=()=>{this.removeEventListener("loadend",c),tRe(t,l,this.status,u,e)},Cl(this,"loadend",c)}}catch(l){Oge.error("Failed to observe XHR send",l)}try{return a.apply(this,A)}catch(l){throw c&&this.removeEventListener("loadend",c),l}});return()=>{r(),s()}},Gge={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=kGt,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const e=this.vd();this.hd=0,e&&this.reloadFeatureFlags()},this.fd=()=>{var e,n;const o=this.pd,i=(e=this.gd)!==null&&e!==void 0?e:o;Bo(o)||Bo(i)||this.Rr.remoteRequestsDisabled||!No||No.visibilityState==="hidden"||Date.now()-((n=this.md)!==null&&n!==void 0?n:0)<i||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?o:Math.min(2*i,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{No?.visibilityState==="visible"&&this._d()},"get"in t?this.So=t:(this._instance=t,this.wd=new dYo(t.config,t.nl()),this.So=this.wd)}updateConfig(t,e){var n;(n=this.wd)===null||n===void 0||n.update(t,e),this.wo&&this.kd()}setup(t){return this.Fh=t,this.$=t.logger.createLogger("[FeatureFlags]"),MGt(t.kv.initialize(),()=>{this.Fh===t&&(this.Fh=void 0,this.wo=t,this.Sd(t))})}Sd(t){var e;if(this.wo===t)return Ln&&Cl(Ln,"online",this.an),this.kd(),this.xd=t.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const t=this.Rr.refreshIntervalMs,e=!this.Rr.remoteRequestsDisabled&&No&&!Bo(t)&&t>0?t:void 0;this.Rr.idleRefreshBackoff||(this.gd=e),e!==this.pd&&(this.Ed(),Bo(e)||(this.pd=e,this.gd=e,this.yd(),No?.addEventListener&&(Cl(No,T$,this.ln),JO(FGt,n=>{Cl(No,n,this.bd,{capture:!0})}))))}yd(){Bo(this.pd)||(Bo(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var t;Bo(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,No==null||(t=No.removeEventListener)===null||t===void 0||t.call(No,"visibilitychange",this.ln),JO(FGt,e=>{var n;No==null||(n=No.removeEventListener)===null||n===void 0||n.call(No,e,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var t,e;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(t=this.xd)===null||t===void 0||t.dispose(),this.xd=void 0,(e=this.$d)===null||e===void 0||e.call(this),this.$d=void 0,this.ed=[],Ln?.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(t){var e;return this.Od&&t in this.Od?this.Od[t]:(e=this.wo)===null||e===void 0?void 0:e.kv.get(t)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var t;return!Bo((t=this.wo)===null||t===void 0?void 0:t.kv.get("$enabled_feature_flags"))&&this.Td()}At(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.set(t)})}Nd(t,e,n){var o;if(!(!((o=this._instance)===null||o===void 0)&&o.persistence)||!t.$enabled_feature_flags)return;const i=this.Fd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},s=e.flags||e.featureFlags,a=e.flags?Object.entries(e.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],A=!!e.errorsWhileComputingFlags&&!!e.flags,c=A?a:n&&!as(s)?Object.keys(s||{}):Array.from(new Set([...Object.keys(i),...Object.keys(r)])),l=this.Fd("$feature_flag_payloads")||{},u=t.$feature_flag_payloads||{},g=A||n?c:Array.from(new Set([...Object.keys(l),...Object.keys(u)])),h=!A&&!n,d=!!h||c,p=!!h||g,m={[Gb]:d,[RB]:d,[vw]:p};t.$feature_flag_details&&(m[_R]=d);for(const _ of[fR,Dw,D$])Bo(t[_])||(m[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(m)}Lt(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.remove(t)})}Ld(t){try{t()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}Id(){const t={};for(const o of[Gb,vw,fR,u6]){const i=this.Fd(o);Bo(i)||(t[o]=i)}this.Yc=t;const e=sn({},t),n=this.Fd(RB);if(n)for(const[o,i]of Object.entries(n))e[`$feature/${o}`]=i;this.td=e}Cd(){const t=this.Rr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Fd(Dw);return typeof e!="number"||Date.now()-e>t}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const t=this.Rr.evaluationContexts;return t?.length?t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid evaluation context found:",e,"Expected non-empty string"),n}):[]}Bd(){const t=this.Rr.flagKeys;if(!Bo(t))return t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid flag key found:",e,"Expected non-empty string"),n})}initialize(){var t,e;const n=this.Rr,o=(t=(e=n.bootstrap)===null||e===void 0?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(o).length){var i,r;const s=(i=(r=n.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(o).filter(c=>!Bo(o[c])).reduce((c,l)=>(c[l]=o[l],c),{}),A=Object.keys(s).filter(c=>a[c]).reduce((c,l)=>(c[l]=s[l],c),{});return this.Hd({featureFlags:a,featureFlagPayloads:A},void 0,{persist:!1})}}updateFlags(t,e,n){var o,i;const r=n?.merge&&(o=this.Fd("$enabled_feature_flags"))!==null&&o!==void 0?o:{},s=n?.merge&&(i=this.Fd("$feature_flag_payloads"))!==null&&i!==void 0?i:{},a=sn(sn({},r),t),A=sn(sn({},s),e),c={};for(const[l,u]of Object.entries(a))c[l]={key:l,enabled:sHt(u),variant:aHt(u),reason:void 0,metadata:Bo(A?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:A[l]}};this.Hd({flags:c})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Fd(_R),e=this.Fd(u6),n=this.Fd(IR);if(!n&&!e)return t||{};const o=Mu({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(const a of i){var r;const A=o[a],c=e?.[a],l=Bo(c)?(r=A?.enabled)!==null&&r!==void 0&&r:!!c,u=Bo(c)?A?.variant:typeof c=="string"?c:void 0,g=n?.[a],h=sn(sn({},A),{},{enabled:l,variant:l?u??A?.variant:void 0});var s;l!==A?.enabled&&(h.original_enabled=A?.enabled),u!==A?.variant&&(h.original_variant=A?.variant),g&&(h.metadata=sn(sn({},A?.metadata),{},{payload:g,original_payload:A==null||(s=A.metadata)===null||s===void 0?void 0:s.payload})),o[a]=h}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:o}),this.Xc=!0),o}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(n=>{const o=t[n];return{key:n,enabled:sHt(o),variant:aHt(o),payload:rHt(e[n])}})}getFlagVariants(){const t=this.Fd(RB),e=this.Fd(u6);if(!e)return t||{};const n=Mu({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Xc=!0),n}getFlagPayloads(){const t=this.Fd(vw),e=this.Fd(IR);if(!e)return t||{};const n=Mu({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Xc=!0),n}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(t=>{try{t()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ed.push(t),()=>{this.ed=this.ed.filter(e=>e!==t)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.od=t}resetFlagCallReported(){this.Lt(Mw)}Ud(t){this.Ad();const e=this.wo;if(!e||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const n={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:sn(sn(sn({},e.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Fd(Pw),timezone:NOt()};Bo(e.deviceId)||(n.$device_id=e.deviceId),(t?.disableFlags||this.Rr.featureFlagsDisabled)&&(n.disable_flags=!0);const o=this.jd();o.length&&(n.evaluation_contexts=o);const i=this.Bd();Bo(i)||(n.flag_keys=i);const r=this.Rr.onlyEvaluateSurveyFeatureFlags,s="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;const A=()=>{this.ad&&(this.ad=!1,this.Ud())},c=d=>{var p,m;const _=(p=d.json)!==null&&p!==void 0?p:{},f=d.statusCode!==200;if(this.sd=!1,a!==this.rd)return void A();if(this.Wd(d.statusCode),f||this.ad||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.ad)return;this.ld=!f;const I=[];d.error?I.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?LGt:"unknown_error"):d.statusCode!==200&&I.push(`api_error_${d.statusCode}`),_.errorsWhileComputingFlags&&I.push("errors_while_computing_flags");const C=!!(!((m=_.quotaLimited)===null||m===void 0)&&m.includes("feature_flags"));C&&I.push("quota_limited"),this.At({[R$]:I}),C?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Hd(_,f,{partialResponse:r}),A()},l=d=>{this.sd=!1,a===this.rd&&(this.At({[R$]:[LGt]}),this.$.error("Feature flag request failed",d),this.Dd()&&this.Md(!0)),A()};let u=this.Rr.requestMaxRetries;const g=()=>u>0&&a===this.rd,h=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void A();try{e.sendRequest(s,{target:"flags",method:"POST",body:n,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(d=>{if((p=>hYo.includes(p.statusCode)||(m=>m.statusCode===0&&m.error instanceof Error&&m.error.name==="AbortError")(p))(d)&&g())return u--,void setTimeout(h,500);c(d)}).catch(l)}catch(d){l(d)}};h()}vd(){return BOt(this.hd,3)}Wd(t){this.hd=bOt(t,this.hd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var n;if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+qNe);if(this.qd())return;const o=this.getFeatureFlagResult(t,e);return(n=o?.variant)!==null&&n!==void 0?n:o?.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+qNe);if(this.qd())return;const n=this.getFlagVariants(),o=t in n,i=n[t],r=this.getFlagPayloads()[t],s=String(i),a=this.Fd("$feature_flag_request_id")||void 0,A=this.Fd("$feature_flag_evaluated_at")||void 0;let c,l=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var u;const S=(u=this.wo)===null||u===void 0?void 0:u.session.sessionId,Q=this.Fd(N$);S&&S!==Q&&(l={},c=S)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.At({[Mw]:l,[N$]:c});else{var g,h,d,p,m,_,f,I,C,y,x,E;as(l[t])?l[t].push(s):l[t]=[s],this.At(sn({[Mw]:l},c?{[N$]:c}:{}));const S=this.getFeatureFlagDetails(t),Q=[...(g=this.Fd("$feature_flag_errors"))!==null&&g!==void 0?g:[]];Bo(i)&&Q.push("flag_missing");const w={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:A,$feature_flag_bootstrapped_response:(h=(d=this.Rr.bootstrap)===null||d===void 0||(d=d.featureFlags)===null||d===void 0?void 0:d[t])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(p=(m=this.Rr.bootstrap)===null||m===void 0||(m=m.featureFlagPayloads)===null||m===void 0?void 0:m[t])!==null&&p!==void 0?p:null,$used_bootstrap_value:!this.ld};Bo(S==null||(_=S.metadata)===null||_===void 0?void 0:_.has_experiment)||(w.$feature_flag_has_experiment=S.metadata.has_experiment),Bo(S==null||(f=S.metadata)===null||f===void 0?void 0:f.version)||(w.$feature_flag_version=S.metadata.version);const M=(I=S==null||(C=S.reason)===null||C===void 0?void 0:C.description)!==null&&I!==void 0?I:S==null||(y=S.reason)===null||y===void 0?void 0:y.code;var B;M&&(w.$feature_flag_reason=M),!(S==null||(x=S.metadata)===null||x===void 0)&&x.id&&(w.$feature_flag_id=S.metadata.id),Bo(S?.original_variant)&&Bo(S?.original_enabled)||(w.$feature_flag_original_response=Bo(S.original_variant)?S.original_enabled:S.original_variant),!(S==null||(E=S.metadata)===null||E===void 0)&&E.original_payload&&(w.$feature_flag_original_payload=S==null||(B=S.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(w.$feature_flag_error=Q.join(",")),this.Vd(w)}else c&&this.At({[Mw]:l,[N$]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:rHt(r)}:void 0}Vd(t){try{var e;(e=this.wo)===null||e===void 0||e.capture("$feature_flag_called",t)}catch(n){this.$.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.Gd(t,e)}Gd(t,e){var n=this;return eg(function*(){const o=n.wo;if(!o)return;const i={distinct_id:o.distinctId,token:o.projectToken,person_properties:{$lib:o.library.name,$lib_version:o.library.version}},r=n.jd();r.length&&(i.evaluation_contexts=r);const s=n.Bd();let a;Bo(s)||(i.flag_keys=s);try{var A;const c=(A=(yield o.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:i,compression:n.Rr.compression,sentAt:"body",timeoutMs:n.Rr.requestTimeoutMs})).json)===null||A===void 0?void 0:A.featureFlagPayloads;a=c?.[t]||void 0}catch(c){return void n.$.error("Remote config feature flag request failed",c)}try{e(a)}catch(c){n.$.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.ld)return e.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+qNe),e.defaultValue;const n=this.getFeatureFlag(t,e);return Bo(n)?e.defaultValue:!!n}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){this.Hd(t,e,n)}Hd(t,e,n){if(!this.wo)return;this.nd=!0;const o=((i,r={},s={},a={},A,c=kGt)=>{const l=((I,C)=>{const y=I.flags;if(y){const x=Object.fromEntries(Object.keys(y).map(B=>{var S;return[B,(S=y[B].variant)!==null&&S!==void 0?S:y[B].enabled]})),E=Object.fromEntries(Object.keys(y).filter(B=>y[B].enabled).filter(B=>{var S;return!Bo((S=y[B].metadata)===null||S===void 0?void 0:S.payload)}).map(B=>{var S;return[B,(S=y[B].metadata)===null||S===void 0?void 0:S.payload]}));return sn(sn({},I),{},{featureFlags:x,featureFlagPayloads:E})}return I.featureFlags&&C.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),I})(i,c),u=l.flags,g=l.featureFlags,h=l.featureFlagPayloads;if(!g)return;const d=i.requestId,p=i.evaluatedAt;if(as(g)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const I={};if(g)for(let C=0;g.length>C;C++)I[g[C]]=!0;return{[Gb]:g,[RB]:I,[D$]:!1}}let m=g,_=h,f=u;if(A?.partialResponse){const I=Object.keys(m),C=_||{};m=sn(sn({},r),m),_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),f)}else if(i.errorsWhileComputingFlags)if(u){const I=new Set(Object.keys(u).filter(y=>{var x;return!(!((x=u[y])===null||x===void 0)&&x.failed)}));m=sn(sn({},r),Object.fromEntries(Object.entries(m).filter(([y])=>I.has(y))));const C=Object.fromEntries(Object.entries(_||{}).filter(([y])=>I.has(y)));_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),Object.fromEntries(Object.entries(f||{}).filter(([y])=>I.has(y))))}else m=sn(sn({},r),m),_=sn(sn({},s),_),f=sn(sn({},a),f);return sn(sn({[Gb]:Object.keys(OGt(m)),[RB]:m||{},[vw]:_||{},[_R]:f||{},[D$]:i.minimalFlagCalledEvents===!0},d?{[fR]:d}:{}),p?{[Dw]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(o)if(n?.persist===!1){const i=!Bo(this.wo.kv.get(RB));this.Od=o,i||this.At(o)}else this.Td(),this.Nd(o,t,!!n?.partialResponse),this.At(o);else e&&this.Dd();e||(this.ud=!1),this.Md(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.wo){if(t===!1)return this.Lt([u6,IR]),this.Md(),void BR.info("All overrides cleared");if(as(t))return this.At({[u6]:HGt(t)}),this.Md(),void BR.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e;const n=t;this.Xc=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);const o={},i=n.flags,r=n.payloads;return i&&(o[u6]=as(i)?HGt(i):i),r&&(o[IR]=r),Object.keys(o).length&&this.At(o),i===!1&&r===!1?this.Lt([u6,IR]):i===!1?this.Lt(u6):r===!1&&this.Lt(IR),this.Md(),i===!1?BR.info("Flag overrides cleared"):i&&BR.info("Flag overrides set",{flags:i}),void(r===!1?BR.info("Payload overrides cleared"):r&&BR.info("Payload overrides set",{payloads:r}))}if(t&&typeof t=="object")return this.At({[u6]:t}),this.Md(),void BR.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.nd){const{flags:e,flagVariants:n}=this.Qd();try{t(e,n)}catch(o){this.$.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var o;const i=(this.Fd("$early_access_features")||[]).find(c=>c.flagKey===t),r={[`$feature_enrollment/${t}`]:e},s={$feature_flag:t,$feature_enrollment:e,$set:r};i&&(s.$early_access_feature_name=i.name),n&&(s.$feature_enrollment_stage=n);const a=sn(sn({},this.getFlagVariants()),{},{[t]:e});(o=this._instance)===null||o===void 0||(o=o.persistence)===null||o===void 0||o.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[Gb]:Object.keys(OGt(a)),[RB]:a,[ww]:sn(sn({},this.Fd("$stored_person_properties")||{}),r)}),this.Md();try{var A;(A=this.wo)===null||A===void 0||A.capture("$feature_enrollment_update",s)}catch(c){this.$.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(t,e=!1,n){const o=this.Fd(oNe);!o||e?this.Jd(t,n):t(o)}Jd(t,e){var n=this;return eg(function*(){const o=n.wo;if(!o)return;const i=e?`&${e.map(s=>`stage=${s}`).join("&")}`:"";let r;try{const s=yield o.sendRequest(`/api/early_access_features/?token=${o.projectToken}${i}`,{target:"api",method:"GET",sentAt:"query"});if(!s.json)return;r=s.json.earlyAccessFeatures,n.At({[oNe]:r})}catch(s){return void n.$.error("Early access feature request failed",s)}try{t(r)}catch(s){n.$.error("Early access feature callback failed",s)}})()}Qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,o)=>(n[o]=e[o],n),{})}}Md(t){this.Id();const{flags:e,flagVariants:n}=this.Qd();this.featureFlagEventHandlers.forEach(o=>{try{o(e,n,{errorsLoading:t})}catch(i){this.$.error("Error while running feature flags callback",i)}})}setPersonPropertiesForFlags(t,e=!0){this.Kd(t,e)}Kd(t,e=!0){const n=this.Fd("$stored_person_properties")||{},o=t?.$set||(t?.$set_once?{}:t),i=t?.$set_once,r={};if(i)for(const s in i)({}).hasOwnProperty.call(i,s)&&(s in n||(r[s]=i[s]));this.At({[ww]:sn(sn(sn({},n),r),o)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const n=sn({},this.Fd("$stored_person_properties")||{});t.forEach(o=>{delete n[o]}),this.At({[ww]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(ww),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const n=this.Fd("$stored_group_properties")||{},o=sn({},n);for(const i of Object.keys(t))o[i]=sn(sn({},n[i]),t[i]);this.At({[Pw]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[Pw]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(Pw)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},bYo={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var t;return!!(!((t=this.Xd)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(t=(e=this.Xd)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.Yd}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=WNe,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Ln==null||(e=Ln.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.ln=()=>{var e,n;No?.visibilityState==="visible"&&(this.Xe=!0,(e=this.Xd)===null||e===void 0||(n=e.setDocumentWasEverVisible)===null||n===void 0||n.call(e,!0))},!this._instance.sessionManager)throw Jb.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');No?.addEventListener&&Cl(No,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.ev=!0,No==null||(e=No.removeEventListener)===null||e===void 0||e.call(No,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Rr.disable_session_recording,o=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return Ln&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this.ev||this.nv&&(!((e=this.Xd)===null||e===void 0)&&e.isStarted))return;const n=!Bo(Object.assign)&&!Bo(Array.from);this.nv&&n?(this.sv(t),Jb.info("starting")):(this.Yd=WNe,this.stopRecording())}sv(t){var e,n;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=wGt),(Vr==null||(e=Vr.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Vr.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.rv(t);else{var o,i;const r=this._instance.sessionManager;(o=Vr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,this.ov,s=>{if(!this.ev&&this.nv&&this._instance.sessionManager===r)return s?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Jb.error("could not load recorder",s)):void this.rv(t);this.Yd="disabled"})}}stopRecording(){var t,e;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(e=this.Xd)===null||e===void 0||e.stop()}iv(t=!1){var e,n;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(n=this.Xd)===null||n===void 0||n.discard({discardProducerEvents:t})}av(){var t,e;(t=this.Ml)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Ml)===null||e===void 0||e.unregister("$replay_sample_rate")}lv(t,e){if(Us(t))return null;const n=sh(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(Jb.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):n;var o}uv(t){if(this.Ml){var e,n;const o=this.Ml,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.lv((r=this.Rr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.lv(s?.sampleRate,"remote config sampleRate"),c=a??A;Us(c)&&this.av();const l=s?.minimumDurationMilliseconds;o.register({[M$]:sn(sn({cache_timestamp:Date.now(),enabled:!!s},s),{},{networkPayloadCapture:sn({capturePerformance:t.capturePerformance},s?.networkPayloadCapture),canvasRecording:{enabled:s?.recordCanvas,fps:s?.canvasFps,quality:s?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Bo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.tv)===null||e===void 0||e.call(this),this.tv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(i)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.uv(e),void this.iv()):(this.uv(e),void this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[KHt]:!0}),Jb.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.Xd)===null||n===void 0)&&n.log?this.Xd.log(t,e):Jb.warn("log called before recorder was ready")}get ov(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(M$);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(M$);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Jb.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Us(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(t){var e,n,o;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return Jb.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[UHt]:!0});var i;if(this.Xd||(this.Xd=(i=Vr.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv())return this.Yd==="missing_config"||this.Yd==="awaiting_config"?void 0:(this.Yd="awaiting_config",Jb.info("persisted remote config is stale, requesting fresh config before starting"),void new HOt(this._instance).load());this.Yd=wGt,(n=(o=this.Xd).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Xe),this.Xd.start(t)}else this.Yd=WNe}onRRwebEmit(t){var e,n;(e=this.Xd)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.Xd)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.Xd)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.Xd||(n=this.Ml)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.Xd)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Xd)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!!(!((n=this.Xd)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.Xd)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},SYo={autocapture:class extends ZGo{constructor(t){super(new eYo(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.dv=!1,this._instance=t,this.vv=this.fv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.pv();return!!(t.path||t.search||this.gv(t))}startIfEnabled(){this.isEnabled&&(ui.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.vv=this.fv(),this.startIfEnabled()}stop(){this.mv&&this.mv(),this.mv=void 0,this.yv&&this.yv(),this.yv=void 0,ui.info("History API monitoring stopped")}monitorHistoryChanges(){Ln&&Ln.history&&(this.bv("pushState"),this.bv("replaceState"),this._v(),this.gv()&&this.wv())}bv(t){var e;if(!Ln||!((e=Ln.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;oq(Ln.history,t,o=>function(i,r,s){var a;n.Sv(s)&&n.xv(),o.call(this,i,r,s),n.Cv(t,!n.dv&&(Ln==null||(a=Ln.event)===null||a===void 0?void 0:a.type)!=="popstate")})}fv(){const t=Ln?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}pv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:QA(t)?t:{}}gv(t=this.pv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}$v(t){const e=this.pv(),n=this.vv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.gv(e)&&t.hash!==n.hash))}Cv(t,e=!1){try{e||this.xv();const n=this.fv();if(!n)return;if(this.$v(n)){const o=()=>this._instance.capture(lNe,{navigation_type:t});e?(this.Tv=o,Promise.resolve().then(()=>this.xv())):o()}this.vv=n}catch(n){ui.error(`Error capturing ${t} pageview`,n)}}Sv(t){var e,n;return!(Us(t)||!Ln)&&((e=Ub(String(t)))===null||e===void 0?void 0:e.href)!==((n=Ln.location)===null||n===void 0?void 0:n.href)}xv(){const t=this.Tv;if(t){this.Tv=void 0,this.dv=!0;try{t()}catch(e){ui.error("Error capturing deferred pageview",e)}finally{this.dv=!1}this.vv=this.fv()}}_v(){if(this.mv)return;const t=()=>{this.Cv("popstate")};Cl(Ln,"popstate",t),this.mv=()=>{Ln&&Ln.removeEventListener("popstate",t)}}wv(){if(this.yv)return;const t=()=>{this.Cv("hashchange")};Cl(Ln,"hashchange",t),this.yv=()=>{Ln&&Ln.removeEventListener("hashchange",t)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.Iv=!1,this.xo=!1,this.Mv=null,this.instance=t,this.Iv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[qDe]),this.rageclicks=new BGt(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return QA(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Us(this.Rr.capture_heatmaps)?Us(this.Rr.enable_heatmaps)?this.Iv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;iYo.info("starting..."),this.Ev(),this.ln()}else{var t;clearInterval((t=this.Mv)!==null&&t!==void 0?t:void 0),this.Pv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[qDe]:n}),this.Iv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Rv(t){jNe(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Mv&&clearInterval(this.Mv),this.Mv=No?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}Ev(){Ln&&No&&(this.Av=this.bl.bind(this),Cl(Ln,bge,this.Av),this.Fv=t=>this.Tr(t||Ln?.event),Cl(No,"click",this.Fv,{capture:!0}),this.Ov=t=>this.Dv(t||Ln?.event),Cl(No,"mousemove",this.Ov,{capture:!0}),this.Lv=new IOt(this.instance,aGo,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Nv=this.ln.bind(this),Cl(No,T$,this.Nv),this.xo=!0)}Pv(){var t;Ln&&No&&(this.Av&&Ln.removeEventListener(bge,this.Av),this.Fv&&No.removeEventListener("click",this.Fv,{capture:!0}),this.Ov&&No.removeEventListener("mousemove",this.Ov,{capture:!0}),this.Nv&&No.removeEventListener(T$,this.Nv),clearTimeout(this.qv),(t=this.Lv)===null||t===void 0||t.stop(),this.xo=!1)}jv(t,e){const n=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),r=(function(s,a,A){let c=s;for(;c&&g6(c)&&!AI(c,"body");){if(c===A)return!1;let h;try{var l,u,g;h=(l=(u=(g=c.ownerDocument)===null||g===void 0?void 0:g.defaultView)!==null&&u!==void 0?u:Ln)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(Is(a,h))return!0;c=sOt(c)}return!1})(H$(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Tr(t,e="click"){var n;if(nOt(t.target)||!jNe(t))return;const o=this.jv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&lOt(H$(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Dv(t){!nOt(t.target)&&jNe(t)&&(clearTimeout(this.qv),this.qv=setTimeout(()=>{this.Zs(this.jv(t,"mousemove"))},500))}Zs(t){if(!Ln)return;const e=this.Rr.disable_capture_url_hashes?Qw(Ln.location.href):Ln.location.href,n=this.Rr.custom_personal_data_properties,o=this.Rr.mask_personal_data_properties?[...eG,...n||[]]:[],i=K$(e,o,V$);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}bl(){this.Rt&&!Nx(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:IOt,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Iv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Bv=()=>{clearTimeout(this.Hv),this.Hv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",sn({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,o)=>sn(sn({},n),{},{[`$web_vitals_${o.name}_event`]:sn({},o),[`$web_vitals_${o.name}_value`]:o.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.zv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Us(n?.name)||Us(n?.value))return void ER.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.Uv(i);if(Bo(r))return;const s=sh(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.Wv&&n.value>=this.Wv)return void ER.error("Ignoring metric with value >= "+this.Wv,n);this.Rt.navigationKey!==s&&(this.Bv(),this.Hv=setTimeout(this.Bv,this.flushToCaptureTimeoutMs)),Bo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Bo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=sn(sn(sn({},n),i?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete A.entries,QA(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of oYo){const u=l==="url"&&typeof n.attribution[l]=="string"?this.Uv(n.attribution[l]):n.attribution[l];Bo(u)||(c[l]=u)}A.attribution=c}else delete A.attribution;Bo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.Bv()},this.Vv=()=>{if(this.xo)return;let n,o,i,r,s=!1;const a=Vr.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.Gv]||(this.Gv==="web-vitals"&&Bo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Bo(c)){const g=c.withoutAttribution,h=this.attributionMetrics;s=!Bo(g),n=h.indexOf("LCP")>-1?c.onLCP:g?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:g?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:g?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:g?.onINP||c.onINP}if(!(n&&o&&i&&r))return void ER.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?sn(sn({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&n(this.zv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.zv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.zv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.zv.bind(this),u),this.xo=!0},this.Iv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[eNe]),this.startIfEnabled()}get Zv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=QA(this.Zv)?(t=this.Zv)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Us(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||vGt:n}get flushToCaptureTimeoutMs(){return(QA(this.Zv)?this.Zv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=QA(this.Zv)?this.Zv.web_vitals_attribution:void 0;return jy(t)?t?vGt:[]:as(t)?t:nYo}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=QA(this.Zv)?this.Zv.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Wv(){const t=QA(this.Zv)&&sh(this.Zv.__web_vitals_max_value)?this.Zv.__web_vitals_max_value:QGt;return t>0&&6e4>=t?QGt:t}get isEnabled(){const t=fd?.protocol;if(t!=="http:"&&t!=="https:")return ER.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=QA(this.Zv)?this.Zv.web_vitals:jy(this.Zv)?this.Zv:void 0;return jy(e)?e:this.Iv}startIfEnabled(){this.isEnabled&&!this.xo&&(ER.info("enabled, starting..."),this.zo(this.Vv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=QA(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=QA(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[eNe]:n}),this._instance.persistence.register({[DHt]:o})),this.Iv=n,this.startIfEnabled()}get Gv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const n=Vr.__PosthogExtensions__,o=this.Gv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Bo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?ER.error("failed to load script",r):t()})}Uv(t){const e=t||Ln?.location.href;if(!e)return void ER.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?Qw(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...eG,...o||[]]:[];return K$(n,i,V$)}}},QYo={exceptionObserver:class{constructor(t){var e;this.Vv=()=>{var n;if(!Ln||!this.isEnabled||!(!((n=Vr.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Vr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Vr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Vr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this.Rr.capture_unhandled_errors&&(this.Qv=o(this.captureException.bind(this))),!this.Jv&&this.Rr.capture_unhandled_rejections&&(this.Jv=i(this.captureException.bind(this))),!this.Kv&&this.Rr.capture_console_errors&&(this.Kv=r(this.captureException.bind(this)))}catch(s){nq.error("failed to start",s),this.Xv()}},this._instance=t,this.Yv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[XDe]),this.wt=new CHo(sn(sn({},(function(n={}){var o,i,r,s;return{refillRate:(o=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:1,bucketSize:(r=(s=n.exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:n.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:nq})),this.Rr=this.tf(),this.startIfEnabledOrStop()}tf(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return QA(t)?e=sn(sn({},e),t):(Bo(t)?this.Yv:t)&&(e=sn(sn({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(nq.info("enabled"),this.Xv(),this.zo(this.Vv)):this.Xv()}zo(t){var e,n,o;!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Vr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return nq.error("failed to load script",i);t()})}Xv(){var t,e,n;(t=this.Qv)===null||t===void 0||t.call(this),this.Qv=void 0,(e=this.Jv)===null||e===void 0||e.call(this),this.Jv=void 0,(n=this.Kv)===null||n===void 0||n.call(this),this.Kv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Yv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[XDe]:this.Yv}),this.Rr=this.tf(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.tf()}captureException(t){try{var e,n,o;const i=(e=t==null||(n=t.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(i))return void nq.info("Skipping exception capture because of client rate limiting.",{exception:i});(o=this._instance.exceptions)===null||o===void 0||o.sendExceptionEvent(t)}catch{}}},exceptions:class{constructor(t){var e,n;this.ef=[],this.if=new DHo([new JHo,new nOo,new jHo,new WHo,new eOo,new ZHo,new qHo,new tOo],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
|
|
1068
|
+
at ${i.filename}:${r}:${s}`}};const $Ho=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var qHo=class{match(e){return typeof e=="string"}coerce(e,n){var o;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}getInfos(e){let n="Error",o=e;const i=e.match($Ho);return i&&(n=i[1],o=i[2]),[n,o]}};const XHo=["fatal","error","warning","log","info","debug"];function iHt(t,e=40){const n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(e>=i.length)return o===n.length?i:i.length>e?`${i.slice(0,e)}...`:i}return""}var ZHo=class{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var o,i;const r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(o=this.getStack(e))!==null&&o!==void 0?o:(i=n.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(vDe(e))return e.constructor.name;const n="name"in e?e.name:void 0;return rA(n)&&!b$(n)?n:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let o=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(o+=` with message: '${e.message}'`),o}if("message"in e&&typeof e.message=="string")return e.message;const n=this.getObjectClassName(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${iHt(e)}`}isSeverityLevel(e){return rA(e)&&!b$(e)&&XHo.indexOf(e)>=0}getStack(e){try{return rA(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:rA(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(GO(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},eOo=class{match(e){return vDe(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${iHt(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},tOo=class{match(e){return cLt(e)}coerce(e,n){var o;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},nOo=class{match(e){return rge(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!vDe(e))return!1;try{const n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var o;const i=this.getUnhandledRejectionReason(e);return cLt(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const mge="$message",_ge="$timestamp",oOo=new Set([mge,_ge]),YDe={enabled:!0,max_bytes:32768};function fge(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:YDe.enabled,max_bytes:rOo(t.max_bytes,YDe.max_bytes)}:sn({},YDe)}var iOo=class{constructor(e){this.ns=[],this.ss=0,this.Rr=fge(e)}setConfig(e){this.Rr=fge(e),this.rs()}add(e){const n=(function(i){let r;try{r=aLt(i)}catch{return}try{const s=JSON.parse(r);if(!QA(s))return;const a=s,A=a[mge],c=a[_ge];return!rA(A)||A.trim().length===0||!rA(c)&&!sh(c)?void 0:{step:a,json:r}}catch{return}})(e);if(!n)return;const o=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let s=0;for(let a=0;r.length>a;a++)r[a]==="%"?(s+=1,a+=2):s+=1;return s})(n.json);o>this.Rr.max_bytes||(this.ns.push({step:n.step,bytes:o}),this.ss+=o,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function rOo(t,e){if(!sh(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const rHt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function sHt(t){return typeof t=="string"||t}function aHt(t){return typeof t=="string"?t:void 0}const sOo=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],AHt="NativeGzipValidationError",UDe=t=>t.length>=2&&t[0]===31&&t[1]===139,cHt=(t,e)=>t===bDe.GZipJS||e===bDe.GZipJS||e==="gzip",lHt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let w$;const Ige=t=>{throw JLt(AHt,`Native gzip produced invalid output: ${t}`)},aOo=(uHt=eg(function*(t,e){18>t.size&&Ige("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());UDe(n)&&n[2]===8||Ige("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(w$)return w$;w$=[];for(let A=0;256>A;A++){let c=A;for(let l=0;8>l;l++)c=1&c?3988292384^c>>>1:c>>>1;w$[A]=c>>>0}return w$})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&Ige("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&Ige("invalid-size")}),function(t,e){return uHt.apply(this,arguments)});var uHt;function KDe(){return KDe=eg(function*(t,e=!0,n){try{const i=new TextEncoder().encode(t),r=new globalThis.CompressionStream("gzip"),s=r.writable.getWriter(),a=s.write(i).then(()=>s.close()).catch((o=eg(function*(l){try{yield s.abort(l)}catch{}throw l}),function(l){return o.apply(this,arguments)})),A=new Response(r.readable).blob(),[c]=yield Promise.all([A,a]);return yield aOo(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),KDe.apply(this,arguments)}function gHt(t,e){if(t==null)return{};var n,o,i=(function(s,a){if(s==null)return{};var A={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.includes(c))continue;A[c]=s[c]}return A})(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;r.length>o;o++)e.includes(n=r[o])||{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}const AOo={}.propertyIsEnumerable;function Cge(t,e){try{return dHt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function VDe(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:LDe};if(n.remainingNodes--,jy(t))return{boolValue:t};if(typeof t=="bigint")return(function(i,r){const s=i.toString(),a=BigInt("9223372036854775808");return i>=a||-a>i?(r?.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}})(t,e);if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=9223372036854776e3||-9223372036854776e3>t?(e?.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:UO(t)};if(typeof t=="function")return{stringValue:"[Function]"};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:"[Circular]"};if(o>=20)return{stringValue:LDe};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?UO(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return VDe(i.call(t),e,n,o+1)}catch{}return as(t)?{arrayValue:{values:cOo(t,e,n,o+1)}}:{kvlistValue:{values:dHt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:UO(String(t))}}function cOo(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(Us(a))continue;i.push(VDe(a,e,n,o))}catch{i.push({stringValue:Q$})}return t.length>s&&i.push({stringValue:LDe}),i}function dHt(t,e,n,o){const i=[];for(const r in t)if(AOo.call(t,r)){if(!r){e?.debug("Dropping an attribute with an empty key");continue}if(i.length>=1e3||0>=n.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const s=t[r];if(Id(s)||Bo(s))continue;i.push({key:UO(r),value:VDe(s,e,n,o)})}catch{i.push({key:UO(r),value:{stringValue:Q$}})}}return i}function hHt(t,e,n){return sn(sn(sn(sn({},KLt({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}const lOo=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function pHt(t,e){const n=KLt({},t),o={};for(const i of lOo)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...Cge(n,e),...Cge(o,e)]}const mHt={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},_Ht={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},uOo=_Ht.info;function gOo(t){try{return UO(String(t))}catch{return Q$}}function dOo(t,e,n,o){const i=t.level||"info",{text:r,number:s}=_Ht[i]||uOo,a=(function(g=Date.now()){return String(g)+"000000"})(sh(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Us(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Us(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=sn({},A),l=t.attributes;if(l){let g=[];try{g=Object.keys(l)}catch{g=[]}for(const h of g){let d;try{d=l[h]}catch{d=Q$}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const u={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:gOo(t.body)},attributes:Cge(c,n)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),Bo(t.trace_flags)||(u.flags=t.trace_flags),u}function fHt(t,e,n){return hHt(t,e,n)}function IHt(t,e,n,o){return{resourceLogs:[{resource:{attributes:pHt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var CHt=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=jLt(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function yHt(){return .75+.5*Math.random()}function xHt(t,e,n,o){const i=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,i);return Math.round(Math.min(r,Math.max(o,t))*n)}var hOo=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Rr=n,this.$=o,this.cs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new CHt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new VLt,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=n.maxBufferSize,this.Is=Math.max((A=n.maxQueueSize)!==null&&A!==void 0?A:n.maxBufferSize,n.maxBufferSize),this.Ms=n.flushIntervalMs,this.Es=n.maxBatchRecordsPerPost,this.Ps=n.rateCapWindowMs,this.Rs=n.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(c6.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:dOo(i,(o=n?.context)!==null&&o!==void 0?o:this.cs(),this.$,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=as(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return eg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return eg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(c6.LogsQueue))!==null&&n!==void 0?n:[];if(o.length===0)return;const i=o.length;let r=0;for(;o.length>0&&i>r;){var s,a;const A=e._s;e.bs=0;const c=Math.min(o.length,e.Es),l=o.slice(0,c),u=IHt(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.js(u);if(e._s!==A)return;if(g.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(g),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),g.kind==="retry-later"||(g.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):g.kind==="ok"&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(c6.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,g.kind==="fatal"))throw g.error}})()}Bs(e){var n=this;return eg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(c6.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(c6.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return fHt(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(c6.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(c6.LogsQueue,o),this.Ts>o.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(xHt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(c6.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return eg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield $Lt(o,e):yield o})()}flushWithTimeout(e){var n=this;return eg(function*(){const o=n.flush();yield $Lt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=yHt(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const zDe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function EHt(t){return String(t)+"000000"}function BHt(t,e,n,o){let i="";return o&&(i=Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(o[r])}`).join(",")),`${t}\0${e}\0${n??""}\0${i}`}var pOo=class{constructor(e,n,o){this._instance=e,this.Rr=n,this.$=o,this.zs=new Map,this.ps=new CHt(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new VLt,this.ks=0,this.Ss=1,this.Gs=0}count(e,n=1,o){this.Zs({name:e,type:"count",value:n,unit:o?.unit,attributes:o?.attributes})}gauge(e,n,o){this.Zs({name:e,type:"gauge",value:n,unit:o?.unit,attributes:o?.attributes})}histogram(e,n,o){this.Zs({name:e,type:"histogram",value:n,unit:o?.unit,attributes:o?.attributes})}flush(){var e=this;const n=this.ys,o=(function(){var i=eg(function*(){n&&(yield n.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===o&&(this.ys=null)});return this.ys=o,o}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const n=this.Os(e);if(n===null)return;if(!n.name||typeof n.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.$.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.$.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?sn({},n.attributes):void 0,i=BHt(n.type,n.name,n.unit,o)}catch(a){return void this.$.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:n.name,type:n.type,unit:n.unit,attributes:o,windowStartMs:Date.now()},this.zs.set(i,r)}const s=this.Ws.get(n.name);s===void 0?this.Ws.set(n.name,n.type):s===n.type||this.Vs.has(n.name)||(this.Vs.add(n.name),this.$.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,n){switch(e.type){case"count":var o;e.total=((o=e.total)!==null&&o!==void 0?o:0)+n;break;case"gauge":e.last=n;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:n,max:n,bucketCounts:new Array(zDe.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=n,i.min=Math.min(i.min,n),i.max=Math.max(i.max,n),i.bucketCounts[(function(r,s){for(let a=0;s.length>a;a++)if(s[a]>=r)return a;return s.length})(n,zDe)]+=1;break}}}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=as(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(xHt(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return eg(function*(){if(e.ps.clear(),e.zs.size===0)return;const n=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const o=e.Gs,i=yield e._instance.Ys(e.Js(n));if(o===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=yHt()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.ho(n),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.vo(e),o=(function(s,a,A){return hHt(s,a,A)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:pHt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}vo(e){const n=EHt(Date.now()),o=new Map;for(const a of e.values()){var i;const A=BHt(a.type,a.name,a.unit,void 0);let c=o.get(A);c||(c=sn({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},o.set(A,c));const l=Cge((i=a.attributes)!==null&&i!==void 0?i:{},this.$),u=EHt(a.windowStartMs);if(a.type==="count"){var r;const g={attributes:l,startTimeUnixNano:u,timeUnixNano:n,asDouble:(r=a.total)!==null&&r!==void 0?r:0};c.sum.dataPoints.push(g)}else if(a.type==="gauge"){var s;const g={attributes:l,timeUnixNano:n,asDouble:(s=a.last)!==null&&s!==void 0?s:0};c.gauge.dataPoints.push(g)}else a.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:n,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:zDe})}return Array.from(o.values())}ho(e){for(const[i,r]of e){const s=this.zs.get(i);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,r.windowStartMs),s.type){case"count":var n,o;s.total=((n=s.total)!==null&&n!==void 0?n:0)+((o=r.total)!==null&&o!==void 0?o:0);break;case"gauge":break;case"histogram":if(r.hist)if(s.hist){s.hist.count+=r.hist.count,s.hist.sum+=r.hist.sum,s.hist.min=Math.min(s.hist.min,r.hist.min),s.hist.max=Math.max(s.hist.max,r.hist.max);for(let a=0;s.hist.bucketCounts.length>a;a++)s.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else s.hist=r.hist}else this.Ks()&&this.zs.set(i,r)}}};const bHt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Ln&&(Hb.DEBUG||Ln.POSTHOG_DEBUG||e)&&!Bo(Ln.console)&&Ln.console&&("__rrweb_original__"in Ln.console[o]?Ln.console[o].__rrweb_original__:Ln.console[o])(t,...i)},debug(...o){n.N("debug",...o)},info(...o){n.N("log",...o)},warn(...o){n.N("warn",...o)},error(...o){n.N("error",...o)},critical(...o){console.error(t,...o)},uninitializedWarning(o){n.error(`You must initialize PostHog before calling ${o}`)},createLogger:(o,i)=>bHt(`${t} ${o}`,i)};return n},ui=bHt("[PostHog.js]"),Cd=ui.createLogger,mOo=Cd("[ExternalScriptsLoader]"),yge=t=>{const e=No?.querySelectorAll("script");if(e){for(let n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},mR=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return mOo.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=yge(e);if(o){if(o.__posthog_loading_callback_fired)return n();const r=o.__posthog_loading_error;return r?n(r):(o.addEventListener("load",s=>{o.__posthog_loading_callback_fired=!0,n(void 0,s)}),void o.addEventListener("error",s=>{o.__posthog_loading_error=s,n(s)}))}const i=()=>{if(!No)return n("document not found");if(yge(e))return mR(t,e,n);let r=No.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=a=>{r.__posthog_loading_callback_fired=!0,n(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,n(a)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")No.head.appendChild(r);else{const a=No.querySelectorAll("body > script");var s;a.length>0?(s=a[0].parentNode)===null||s===void 0||s.insertBefore(r,a[0]):No.body.appendChild(r)}};No?.body?i():No?.addEventListener("DOMContentLoaded",i)},JDe={},SHt=(t,e)=>{let n=`/static/${e}.js?v=${t.version}`;return e==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),t.requestRouter.endpointFor("assets",n)};Vr.__PosthogExtensions__=Vr.__PosthogExtensions__||{},Vr.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void mR(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=JDe[i];if(o==="fallback"&&r){if(yge(r))return void mR(t,r,n);delete JDe[i]}return void mR(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=SHt(t,e);JDe[i]=c;const l=yge(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),mR(t,c,n)}else n(void 0,a)}:n)}mR(t,SHt(t,e),n)},Vr.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);mR(t,o,n)},Hb.DEBUG=!1,Hb.LIB_VERSION="1.434.16",Hb.LIB_NAME="web";var n_=Hb;const _Oo="$people_distinct_id",NB="distinct_id",WDe="$device_id",jDe="$device_model",xge="__alias",fOo="__cmpns",QHt="$fbc",KO="$fbc_persistence",vHt="$fbp",P$="$fbp_persistence",$De="__timers",wHt="$autocapture_disabled_server_side",qDe="$heatmaps_enabled_server_side",XDe="$exception_capture_enabled_server_side",PHt="$error_tracking_suppression_rules",ZDe="$error_tracking_capture_extension_exceptions",eNe="$web_vitals_enabled_server_side",tNe="$dead_clicks_enabled_server_side",nNe="$product_tours_enabled_server_side",MHt="$logs_capture_enabled_server_side",DHt="$web_vitals_allowed_metrics",M$="$session_recording_remote_config",IOo="$session_recording_enabled_server_side",COo="$replay_sample_rate",yOo="$replay_override_sampling",xOo="$replay_override_linked_flag",EOo="$replay_override_url_trigger",BOo="$replay_override_event_trigger",VO="$sesid",NHt="$session_is_sampled",bOo="$session_past_minimum_duration",SOo="$session_recording_url_trigger_activated_session",QOo="$session_recording_event_trigger_activated_session",vOo="$debug_first_full_snapshot_timestamp",wOo="$sess_rec_flush_size",RB="$enabled_feature_flags",Gb="$active_feature_flags",oNe="$early_access_features",_R="$feature_flag_details",vw="$feature_flag_payloads",fR="$feature_flag_request_id",D$="$minimal_flag_called_events",u6="$override_feature_flags",IR="$override_feature_flag_payloads",ww="$stored_person_properties",Pw="$stored_group_properties",RHt="$groups",iNe="$surveys",Ege="$surveys_loaded_at",THt="$surveys_activated",kHt="$surveys_activated_session",FHt="$surveys_activated_timestamps",rNe="ph_product_tours",POo="$product_tours_activated",MOo="$product_tours_activated_session",DOo="$conversations_widget_session_id",NOo="$conversations_ticket_id",ROo="$conversations_widget_state",TOo="$conversations_user_traits",Mw="$flag_call_reported",N$="$flag_call_reported_session_id",R$="$feature_flag_errors",Dw="$feature_flag_evaluated_at",$y="$user_state",sNe="$client_session_props",kOo="$capture_rate_limit",LHt="$initial_campaign_params",HHt="$initial_referrer_info",zO="$initial_person_info",aNe="$epp",ANe="$posthog_cookieless",OHt="$cookieless_mode",GHt="$sdk_debug_extensions_init_method",YHt="$sdk_debug_extensions_init_time_ms",UHt="$sdk_debug_recording_script_not_loaded",KHt="$sdk_debug_replay_stale_config",FOo="$sdk_debug_replay_event_trigger_status",LOo="$sdk_debug_replay_linked_flag_trigger_status",HOo="$sdk_debug_replay_matched_recording_trigger_groups",OOo="$sdk_debug_replay_pending_trigger_conditions",GOo="$sdk_debug_replay_remote_trigger_matching_config",YOo="$sdk_debug_replay_trigger_groups_count",UOo="$sdk_debug_replay_url_trigger_status",KOo="$session_recording_start_reason",cNe="PostHog loadExternalDependency extension not found.",Yb="anonymous",Bge="identified",VHt="identified_only",T$="visibilitychange",bge="beforeunload",lNe="$pageview",zHt="$pageleave",JHt="$identify",WHt="$groupidentify";function JO(t,e){as(t)&&t.forEach(e)}function Tl(t,e){if(!Us(t))if(as(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)QDe.call(t,n)&&e(t[n],n)}const Mu=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function Sge(t){const e=Object.keys(t);let n=e.length;const o=new Array(n);for(;n--;)o[n]=[e[n],t[e[n]]];return o}const VOo=function(t){return function(...e){try{return t.apply(this,e)}catch(n){ui.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ui.critical(n)}}},uNe=function(t){const e={};return Tl(t,function(n,o){(rA(n)&&n.length>0||sh(n))&&(e[o]=n)}),e};function jHt(t){const e=sn({},t);for(const n of["name","message","stack","cause","errors"])try{n in t&&(e[n]=t[n])}catch{}return e}const zOo=["herokuapp.com","vercel.app","netlify.app"];function JOo(t){const e=t?.hostname;if(!rA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of zOo)if(n===o)return!1;return!0}function Cl(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function gNe(t){return t.name==="ph_toolbar_internal"}const k$=t=>{if(No){try{const e=t+"=",n=No.cookie.split(";").filter(o=>o.length);for(let o=0;n.length>o;o++){let i=n[o];for(;i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return sh(t)&&isFinite(t)&&Math.floor(t)===t});var WOo=class pit{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,o,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(o)||!Number.isInteger(i)||0>e||0>n||0>o||0>i||e>0xffffffffffff||n>4095||o>1073741823||i>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|n>>>8,r[7]=n,r[8]=128|o>>>24,r[9]=o>>>16,r[10]=o>>>8,r[11]=o,r[12]=i>>>24,r[13]=i>>>16,r[14]=i>>>8,r[15]=i,new pit(r)}toString(){let e="";for(let n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new pit(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;16>n;n++){const o=this.bytes[n]-e.bytes[n];if(o!==0)return Math.sign(o)}return 0}},jOo=class{generate(){const e=this.generateOrAbort();if(!Bo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Bo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return sh(n)&&isFinite(n)?Math.min(Math.max(Math.floor(n),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return WOo.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new $Oo}};let $Ht=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Ln&&!Bo(Ln.crypto)&&crypto.getRandomValues&&($Ht=t=>crypto.getRandomValues(t));var $Oo=class{nextUint32(){return this.Rt.length>this.$t||($Ht(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let qHt;const TB=()=>qOo().toString(),qOo=()=>(qHt||(qHt=new jOo)).generate();let F$="";const XOo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let WO=null;const yd={Et(){if(!Id(WO))return WO;if(WO=!1,No)try{const t=`__ph_cookie_support_${TB()}`;yd.At(t,"xyz"),WO=k$(t)==='"xyz"',yd.Lt(t)}catch{WO=!1}return WO},Pt(t){ui.error("cookieStore error: "+t)},Ot:k$,Dt(t){let e;try{e=JSON.parse(yd.Ot(t))||{}}catch{}return e},At(t,e,n,o,i){if(!No)return!1;try{let r="",s="";const a=(function(c,l){if(l){let u=(function(g,h=No){if(F$)return F$;if(!h||["localhost","127.0.0.1"].includes(g))return"";const d=g.split(".");let p=Math.min(d.length,8);const m="dmn_chk_"+TB();for(;!F$&&p--;){const _=d.slice(p).join("."),f=m+"=1;domain=."+_+";path=/";h.cookie=f+";max-age=3",h.cookie.includes(m)&&(h.cookie=f+";max-age=0",F$=_)}return F$})(c);if(!u){const g=(h=>{const d=h.match(XOo);return d?d[0]:""})(c);g!==u&&ui.info("Warning: cookie subdomain discovery mismatch",g,u),u=g}return u?"; domain=."+u:""}return""})(No.location.hostname,o);if(n){const c=new Date;c.setTime(c.getTime()+864e5*n),r="; expires="+c.toUTCString()}i&&(s="; secure");const A=t+"="+encodeURIComponent(JSON.stringify(e))+r+"; SameSite=Lax; path=/"+a+s;return A.length>3686.4&&ui.warn("cookieStore warning: large cookie, len="+A.length),No.cookie=A,!0}catch{return!1}},Lt(t,e){if(No?.cookie&&(!e||!Id(k$(t))))try{yd.At(t,"",-1,e)}catch{return}}};let dNe=null;const hc={Et(){if(!Id(dNe))return dNe;let t=!0;if(Bo(Ln))t=!1;else try{const e="__mplssupport__";hc.At(e,"xyz"),hc.Ot(e)!=='"xyz"'&&(t=!1),hc.Lt(e)}catch{t=!1}return t||ui.error("localStorage unsupported; falling back to cookie store"),dNe=t,t},Pt(t){ui.error("localStorage error: "+t)},Ot(t){try{return Ln?.localStorage.getItem(t)}catch(e){hc.Pt(e)}return null},Dt(t){try{return JSON.parse(hc.Ot(t))||{}}catch{}return null},At(t,e){try{return Ln?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){hc.Pt(n)}return!1},Lt(t){try{Ln?.localStorage.removeItem(t)}catch(e){hc.Pt(e)}}},hNe=[ww,Gb,RB,_R,vw,fR,Dw,R$,Mw],CR=[WDe,NB,VO,NHt,aNe,zO,KO,$y],Qge=t=>t+"_cpm",ZOo=["__proto__","constructor","prototype"],pNe=t=>{if(!QA(t))return{};const e={};return Object.keys(t).forEach(n=>{ZOo.indexOf(n)===-1&&(e[n]=t[n])}),e},mNe=(t,e=[])=>{const n={};return[...CR,...e].forEach(o=>{const i=t[o];Bo(i)||Id(i)||i===""||(n[o]=i)}),n},XHt=t=>{let e=5381,n=2166136261;for(let o=0;t.length>o;o++){const i=t.charCodeAt(o);e=33*e^i,n=Math.imul(n^i,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},ZHt=(t,e)=>({p:e,f:XHt(JSON.stringify(t))}),eOt=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=yd.Dt(Qge(t)),o=n?.f===XHt(e)&&as(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},_Ne=(t,e)=>e+"|"+(yd.Ot(Qge(t))||""),jO={},fNe={Et:()=>!0,Pt(t){ui.error("memoryStorage error: "+t)},Ot:t=>t in jO?jO[t]:null,Dt:t=>t in jO?jO[t]:null,At:(t,e)=>(jO[t]=e,!0),Lt(t){delete jO[t]}};let yR=null;const nu={Et(){if(!Id(yR))return yR;if(yR=!0,Bo(Ln))yR=!1;else try{const t="__support__";nu.At(t,"xyz"),nu.Ot(t)!=='"xyz"'&&(yR=!1),nu.Lt(t)}catch{yR=!1}return yR},Pt(t){ui.error("sessionStorage error: ",t)},Ot(t){try{return Ln?.sessionStorage.getItem(t)}catch(e){nu.Pt(e)}return null},Dt(t){try{return JSON.parse(nu.Ot(t))||null}catch{}return null},At(t,e){try{return Ln?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){nu.Pt(n)}return!1},Lt(t){try{Ln?.sessionStorage.removeItem(t)}catch(e){nu.Pt(e)}}};var eGo=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get No(){const e=this.qo.Ot(this.jo);return wDe(e)?1:Is(fHo,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,n=e==="localStorage"?hc:yd,o=n.Et()?n:fNe;if(!this.Bo||this.Bo!==o){this.Bo=o;const i=e==="localStorage"?yd:hc;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(wDe(i.Ot(this.jo))),i.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[tf?.doNotTrack,tf?.msDoNotTrack,Vr.doNotTrack,tf?.globalPrivacyControl].some(e=>wDe(e))}};function tOt(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!nf(o))return e;try{const i=o(e);return rA(i)&&i?i:e}catch(i){return ui.error("Error in get_current_url, falling back to window.location.href",i),e}}function nOt(t){var e;return t instanceof Element&&(t.id==="__POSTHOG_TOOLBAR__"||!!(!((e=t.closest)===null||e===void 0)&&e.call(t,".toolbar-global-fade-container")))}function g6(t){return!!t&&t.nodeType===1}function AI(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function oOt(t){return!!t&&t.nodeType===3}function INe(t){return!!t&&t.nodeType===11&&g6(t.host)}function CNe(t){return t?oge(t).split(/\s+/):[]}function iOt(t,e){const n=(function(o){var i;const r=Ln==null||(i=Ln.location)===null||i===void 0?void 0:i.href;return Bo(r)?void 0:tOt(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function $O(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return CNe(e)}function rOt(t){return Us(t)?null:oge(t).split(/(\s+)/).filter(e=>G$(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function L$(t){let e="";return qO(t)&&!O$(t)&&t.childNodes&&t.childNodes.length&&Tl(t.childNodes,function(n){var o;oOt(n)&&n.textContent&&(e+=(o=rOt(n.textContent))!==null&&o!==void 0?o:"")}),oge(e)}function H$(t){var e;return Bo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const yNe=["a","button","form","input","select","textarea","label"];function xNe(t,e){const n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!n&&n.call(t,e)}catch{return!1}}function ENe(t,e){if(Bo(e))return!0;for(const n of t)if(e.some(o=>xNe(n,o)))return!0;return!1}function sOt(t){const e=t.parentNode;return!(!e||!g6(e))&&e}const BNe=[".ph-no-autocapture","[data-ph-no-autocapture]"],aOt=["next","previous","prev",">","<"],tGo=[...aOt,"+","-","−","–"],AOt=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,cOt=[".ph-no-rageclick",".ph-no-capture"],nGo=["","text","search","email","password","url","tel","number"];function lOt(t,e){if(!Ln||bNe(t))return!1;let n,o,i;var r,s;if(jy(e)?(n=!!e&&cOt,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:cOt,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!g6(A))&&(!!AI(A,"textarea")||(AI(A,"input")?Is(nGo,(A.getAttribute("type")||"").toLowerCase()):(function(c){var l;if(c.isContentEditable)return!0;const u=(l=c.getAttribute)===null||l===void 0?void 0:l.call(c,"contenteditable");return u==="true"||u===""})(A)))})(t))return!1;const{targetElementList:a}=uOt(t,!1);return!(function(A,c){if(A===!1||Bo(A))return!1;let l;if(A===!0)l=aOt;else{if(!as(A))return!1;if(A.length>10)return ui.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;l=A.map(u=>u.toLowerCase())}return c.some(({safeText:u,ariaLabel:g})=>l.some(h=>AOt(u,h)||AOt(g,h)))})(o,a.map(A=>{var c;return{safeText:L$(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!ENe(a,n)}const bNe=t=>!t||AI(t,"html")||!g6(t),uOt=(t,e)=>{if(!Ln||bNe(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!AI(i,"body");){if(INe(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=sOt(i);if(!r)break;if(e||yNe.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Ln.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function qO(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!AI(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=$O(r);if(Is(s,"ph-sensitive")||Is(s,"ph-no-capture"))return!1}if(Is($O(t),"ph-include"))return!0;const o=t.type||"";if(rA(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!rA(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function O$(t){return!!(AI(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||AI(t,"select")||AI(t,"textarea")||t.getAttribute("contenteditable")==="true")}const gOt=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),dOt=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,oGo=[16,15,14,13],iGo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),hOt=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),pOt=/[0-9A-Za-z_]/;function rGo(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function G$(t,e=!0){return!(Us(t)||rA(t)&&(t=oge(t),(e?gOt.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(dOt.lastIndex=0;o=dOt.exec(n);){const i=o[2];if(!i)continue;const r=i.replace(/[- ]/g,"");for(let s=0;r.length>s;s++)for(const a of oGo){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(gOt.test(c)&&rGo(c))return!0}}}return!1})(t))||(e?iGo.test(t):(function(n){let o;for(hOt.lastIndex=0;o=hOt.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&pOt.test(i)&&pOt.test(r)))return!0}return!1})(t))))}function mOt(t){let e=L$(t);return e=`${e} ${_Ot(t)}`.trim(),G$(e)?e:""}function _Ot(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Tl(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=L$(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${_Ot(n)}`.trim())}catch(i){ui.error("[AutoCapture]",i)}}),e}function fOt(t){return t.replace(/"|\\"/g,'\\"')}function sGo(t){const e=t.attr__class;if(e)return as(e)?e:CNe(e)}const vge=Cd("[Dead Clicks]"),aGo=()=>!0,AGo=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(tNe)),o=t.instance.config.capture_dead_clicks;return jy(o)?o:!!QA(o)||n};var IOt=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[tNe]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var n,o,i;!((n=Vr.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Vr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?vge.error("failed to load script",r):e()})}Uo(){var e;if(No){if(!this.Ho&&(!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=QA(this.instance.config.capture_dead_clicks)?sn({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Ho=Vr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ho.start(No),vge.info("starting...")}}else vge.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,vge.info("stopping..."))}};const Y$=Cd("[SegmentIntegration]");function COt(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>nf(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const u=h=>{const d=()=>h.anonymousId()||TB();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property($y,Bge)),c(l?void 0:h.anonymousId()||void 0)},g=A.user();"then"in g&&nf(g.then)?g.then(u):u(g)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||Y$.warn("This browser does not have Promise support, and can not use the segment integration");const u=(g,h)=>{if(!h)return g;const d=!!c&&g.event.anonymousId===c&&!g.event.userId;d||g.event.userId||g.event.anonymousId===A.get_distinct_id()||(Y$.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),g.event.userId&&g.event.userId!==A.get_distinct_id()&&(Y$.info("UserId set, identifying with PostHog"),A.identify(g.event.userId));let p=A.calculateEventProperties(h,g.event.properties);if(!Us(l)){const m=g.event.properties||{},_={};for(const I of Object.keys(p))QDe.call(m,I)||(_[I]=p[I]);const f=((I,C)=>{const y=as(I)?I:[I];let x=sn({},C);for(const E of y)try{if(x=E(x),Us(x))return null}catch(B){return Y$.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Us(f))return g;p=f}return g.event.properties=Object.assign({},p,g.event.properties),g};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(g){return u(g,g.event.event)},page(g){return u(g,lNe)},identify(g){return u(g,JHt)},screen(g){return u(g,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{Y$.error("Failed to register the Segment integration",A),e()})},n)}const yOt="posthog-js";function xOt(t,{organization:e,projectId:n,prefix:o,severityAllowList:i=["error"],sendExceptionsToPostHog:r=!0}={}){return s=>{var a,A,c,l,u;if(i!=="*"&&!i.includes(s.level)||!t.__loaded)return s;s.tags||(s.tags={});const g=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);s.tags["PostHog Person URL"]=g,t.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const h=((a=s.exception)===null||a===void 0?void 0:a.values)||[],d=h.map(_=>sn(sn({},_),{},{stacktrace:_.stacktrace?sn(sn({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(f=>sn(sn({},f),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:((A=h[0])===null||A===void 0?void 0:A.value)||s.message,$exception_type:(c=h[0])===null||c===void 0?void 0:c.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((l=h[0])===null||l===void 0?void 0:l.value)||s.message,$sentry_exception_type:(u=h[0])===null||u===void 0?void 0:u.type,$sentry_tags:s.tags};var m;return e&&n&&(p.$sentry_url=(o||"https://sentry.io/organizations/")+e+"/issues/?project="+n+"&query="+s.event_id),r&&((m=t.exceptions)===null||m===void 0||m.sendExceptionEvent(p)),s}}var cGo=class{constructor(e,n,o,i,r,s){this.name=yOt,this.setupOnce=function(a){a(xOt(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},EOt=class{constructor(e){this.Wo=(n,o,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ui.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){var e;this.Zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)===null||e===void 0||e.call(this),this.Zo=void 0}doPageView(e,n){var o;const i=this.Qo(e,n);return this.Vo={pathname:(o=Ln?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Qo(e,(n=this.Vo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,n){const o=this.Vo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:u}=r;if(!(Bo(s)||Bo(a)||Bo(A)||Bo(c)||Bo(l)||Bo(u))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);const g=s>1?l6(a/s,0,1,ui):1,h=s>1?l6(A/s,0,1,ui):1,d=c>1?l6(l/c,0,1,ui):1,p=c>1?l6(u/c,0,1,ui):1;i=Mu(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:g,$prev_pageview_max_scroll:A,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return o.pathname&&(i.$prev_pageview_pathname=o.pathname),o.timestamp&&(i.$prev_pageview_duration=(e.getTime()-o.timestamp.getTime())/1e3),i}};const U$=["flags","surveys"],lGo={[_Oo]:{exposure:"hidden"},[xge]:{exposure:"hidden"},[fOo]:{exposure:"hidden"},[$De]:{exposure:"hidden"},[KO]:{exposure:"hidden"},[P$]:{exposure:"hidden"},[wHt]:{exposure:"event"},[qDe]:{exposure:"hidden"},[MHt]:{exposure:"hidden"},[XDe]:{exposure:"event"},[PHt]:{exposure:"hidden"},[ZDe]:{exposure:"event"},[eNe]:{exposure:"event"},[tNe]:{exposure:"event"},[nNe]:{exposure:"hidden"},[DHt]:{exposure:"event"},[M$]:{exposure:"hidden"},[IOo]:{exposure:"hidden"},[VO]:{exposure:"hidden"},[NHt]:{exposure:"event"},[COo]:{exposure:"event",shouldSkipFromEventProperties:t=>Id(t)},[bOo]:{exposure:"event"},[SOo]:{exposure:"event"},[QOo]:{exposure:"event"},[vOo]:{exposure:"event"},[wOo]:{exposure:"hidden"},[RB]:{exposure:"hidden",storageGroup:"flags"},[Gb]:{exposure:"hidden",storageGroup:"flags"},[oNe]:{exposure:"hidden"},[_R]:{exposure:"hidden",storageGroup:"flags"},[vw]:{exposure:"hidden",storageGroup:"flags"},[fR]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[D$]:{exposure:"hidden",storageGroup:"flags"},[u6]:{exposure:"hidden"},[IR]:{exposure:"hidden"},[ww]:{exposure:"hidden"},[Pw]:{exposure:"hidden"},[iNe]:{exposure:"hidden",storageGroup:"surveys"},[Ege]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[THt]:{exposure:"event"},[kHt]:{exposure:"hidden"},[FHt]:{exposure:"hidden"},[rNe]:{exposure:"hidden"},[POo]:{exposure:"hidden"},[MOo]:{exposure:"hidden"},[DOo]:{exposure:"event"},[NOo]:{exposure:"event"},[ROo]:{exposure:"event"},[TOo]:{exposure:"event"},[Mw]:{exposure:"hidden"},[N$]:{exposure:"hidden"},[RHt]:{exposure:"event"},[R$]:{exposure:"hidden"},[Dw]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[$y]:{exposure:"hidden"},[sNe]:{exposure:"hidden"},[kOo]:{exposure:"hidden"},[LHt]:{exposure:"hidden"},[HHt]:{exposure:"hidden"},[zO]:{exposure:"hidden"},[aNe]:{exposure:"hidden"},[yOo]:{exposure:"event"},[xOo]:{exposure:"event"},[EOo]:{exposure:"event"},[BOo]:{exposure:"event"},[GHt]:{exposure:"event"},[YHt]:{exposure:"event"},[UHt]:{exposure:"event"},[KHt]:{exposure:"event"},[FOo]:{exposure:"event"},[LOo]:{exposure:"event"},[HOo]:{exposure:"event"},[OOo]:{exposure:"event"},[GOo]:{exposure:"event"},[YOo]:{exposure:"event"},[UOo]:{exposure:"event"},[KOo]:{exposure:"event"}},uGo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],i1=t=>{const e=lGo[t];if(e)return e;for(const[n,o]of uGo)if(t.indexOf(n)===0)return o},XO=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return GO(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,jHt(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return aLt(t)}},Ub=t=>{const e=No?.createElement("a");return Bo(e)?null:(e.href=t,e)},ZO=function(t,e){const n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let o;for(let i=0;n.length>i;i++){const r=n[i].split("=");if(r[0]===e){o=r;break}}if(!as(o)||2>o.length)return"";{let i=o[1];try{i=decodeURIComponent(i)}catch{ui.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")}},K$=function(t,e,n){if(!t||!e||!e.length)return t;const o=t.split("#"),i=o[1],r=(o[0]||"").split("?"),s=r[1],a=r[0],A=(s||"").split("&"),c=[];for(let u=0;A.length>u;u++){const g=A[u].split("=");as(g)&&(e.includes(g[0])?c.push(g[0]+"="+n):c.push(A[u]))}let l=a;return s!=null&&(l+="?"+c.join("&")),i!=null&&(l+="#"+i),l},wge=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},BOt=(t,e)=>t>=e&&sLt(),bOt=(t,e,n,o)=>{if(t===0){if(sLt()){const i=e+1;return i===n&&o(),i}return e}return 0},eG=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],gGo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...eG],V$="<masked>",dGo=["li_fat_id"];function SOt(t,e,n){if(!No)return{};const o=e?[...eG,...n||[]]:[],i=QOt(K$(No.URL,o,V$),t),r=(function(){const s={};return Tl(dGo,function(a){const A=k$(a);s[a]=A||null}),s})();return Mu(r,i)}function QOt(t,e){const n=gGo.concat(e||[]),o={};return Tl(n,function(i){const r=ZO(t,i);o[i]=r||null}),o}function vOt(t){const e=(function(i){return i?i.search("https?://(.*)google.([^/?]*)")===0?"google":i.search("https?://(.*)bing.com")===0?"bing":i.search("https?://(.*)yahoo.com")===0?"yahoo":i.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",o={};if(!Id(e)){o.$search_engine=e;const i=No?ZO(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function wOt(){return navigator.language||navigator.userLanguage}function hGo(){const t=wOt();return typeof t=="string"?t.split("-")[0]:void 0}const Pge="$direct";function POt(){return No?.referrer||Pge}function MOt(t,e,n=!1){const o=t?[...eG,...e||[]]:[],i=n?Qw(fd?.href):fd?.href,r=i?.substring(0,1e3);return{r:POt().substring(0,1e3),u:r?K$(r,o,V$):void 0}}function DOt(t,e=!1){var n;const{r:o,u:i}=t,r=e?Qw(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==Pge?Pge:(n=Ub(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=Ub(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=QOt(r);Mu(s,A)}if(o){const a=vOt(o);Mu(s,a)}return s}function NOt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function pGo(){try{return new Date().getTimezoneOffset()}catch{return}}const mGo={flags:Dw,surveys:Ege},_Go=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Mge=t=>`${t}_cookie_identity_change_pending`,Dge=t=>{let e="",n=0;for(const o of t){const i=encodeURIComponent(JSON.stringify(o).slice(1,-1)).length;if(n+i>1e3)break;e+=o,n+=i}return e},o_="main",Kb=[RB,Gb,_R,vw,fR,Dw,D$,ww],SNe=t=>Kb.indexOf(t)!==-1,ROt=[KO,P$],TOt=t=>ROt.indexOf(t)!==-1,Nw=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},tG=t=>{if(!t)return{};const e=JSON.parse(t);return QA(e)?e:{}},kOt=(t,e)=>{Tl(t,(n,o)=>{const i=i1(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var QNe=class{constructor(e,n,o=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=o,this.props={},this.ua=void 0,this.ha=(i=>{let r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&ui.info("Persistence loaded",e.persistence,sn({},this.props)),this.update_config(e,e,n),this.save(),Ln){const i=()=>this.flush();Cl(Ln,"beforeunload",i,{capture:!1}),Cl(Ln,"pagehide",i,{capture:!1}),this.fa=r=>{if(this.Ko&&(!r.storageArea||r.storageArea===Ln?.localStorage)&&r.key)if(r.key!==this.ha){if(this.Yo){const s=U$.find(a=>r.key===this.pa(a));s&&this.ga(r.key,s)}}else this.ga(r.key,o_)},Cl(Ln,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ia.get(n);if(!SNe(n)||i===!0)return;if(o===!0)return void this.ma(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ma(n,r)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&Ln&&(Ln.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,n,o=!0){if(this.mi)return!1;let i,r;try{if(r=hc.Ot(e),Id(r)){const A=this.ya(n);return A.storageValue=null,n!==o_&&(A.persisted=!1),!1}i=tG(r)}catch{return!1}const s=n===o_?i:hc.Dt(this.ha);if(s&&this.ba(s))return!1;const a=this._a(i,n,o);return n===o_&&this.Yo&&!Nw(this.wa().main,i)||this.ka(i,n,!0,r),a}ba(e){const n=this.props[NB],o=e[NB];return!Bo(n)&&!Bo(o)&&n!==o}ka(e,n,o,i){const r=this.ya(n);r.storageValue=i,n!==o_&&(r.persisted=o);try{r.fingerprint=this.Sa(e,n)}catch{r.fingerprint=void 0}}_a(e,n,o){let i=!1;return Kb.forEach(r=>{var s;const a=(s=i1(r))===null||s===void 0?void 0:s.storageGroup;if(n===o_&&this.Yo&&a||n!==o_&&a!==n)return;const A=r in e,c=this.xa(r,A?e[r]:void 0),l=this.ia.has(r)?r in this.props:A;l===r in this.props&&Nw(c,this.props[r])||(l?this.Ca(r,c,!1):this.$a(r,!1),i=!0)}),i&&o&&this.aa.forEach(r=>r()),i}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const e=hc.Ot(this.ha),n=this.ya(o_);let o,i=!1,r=!1;if(e!==n.storageValue)if(Id(e))n.storageValue=null;else{if(o=tG(e),this.ra=!this.sa&&this.ba(o),this.ra)return!1;r=this._a(o,o_,!1),!this.Yo||Nw(this.wa().main,o)?this.ka(o,o_,!0,e):n.storageValue=e,i=!0}return this.Yo&&U$.forEach(s=>{const a=hc.Ot(this.pa(s)),A=this.ya(s),c=o||{},l=i&&Kb.some(g=>{var h;return((h=i1(g))===null||h===void 0?void 0:h.storageGroup)===s&&g in c});if(a===A.storageValue&&!l)return;if(Id(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this._a(c,s,!1)||r));const u=tG(a);r=this._a(u,s,!1)||r,this.ka(u,s,!0,a)}),r}catch{return!1}}ma(e,n){this.ia.set(e,n);const o=i1(e);o?.volatile||(this.ya((this.Yo?o?.storageGroup:void 0)||o_).fingerprint=void 0,this.Ia(e))}Ma(){Kb.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=hc.Ot(this.ha),n=tG(e);this.ya(o_).storageValue=e,Kb.forEach(o=>{var i;const r=this.Yo?(i=i1(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?hc.Ot(this.pa(r)):null;if(r){const A=this.ya(r);A.storageValue=s,A.persisted=!Id(s)}const a=r&&!Id(s)?tG(s):n;o in this.props?this.Ea(o,a[o],this.props[o]):o in a&&this.ma(o,!0)})}catch{}}xa(e,n){const o=this.ia.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(as(n)?n:[]),a=new Set(as(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=QA(n)?sn({},n):{},r=QA(this.props[e])?this.props[e]:{};return o.forEach(s=>{s in r?i[s]=r[s]:delete i[s]}),i}Ea(e,n,o){if(!SNe(e))return;const i=this.ia.get(e);if(i===!0)return;let r=n;if(this.Ko)try{var s;const A=this.Yo?(s=i1(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.pa(A):this.ha;r=tG(hc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Bo(n)&&!as(n)||!Bo(r)&&!as(r)||!as(o))return void this.ma(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(u=>{A.has(u)!==l.has(u)&&a.add(u)}),a.forEach(u=>{c.has(u)===l.has(u)&&a.delete(u)})}else{if(!QA(o))return void(Nw(r,o)?this.ia.delete(e):this.ma(e,!0));{if(!Bo(n)&&!QA(n)||Bo(n)&&Nx(o)&&Bo(r))return void this.ma(e,!0);const A=QA(n)?n:{},c=QA(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&Nw(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&Nw(c[l],o[l])&&a.delete(l)})}}a.size?this.ma(e,a):this.ia.delete(e)}Pa(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return sh(n)&&n>0?n:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=mNe(e,this.Rr.cookie_persisted_properties||[]),o=ZHt(n,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=yd.Ot(this.ha)||void 0;r&&_Ne(this.ha,r)===i&&(this.Aa=i,this.Fa=r)}catch{}else try{const n=yd.Ot(this.ha)||void 0;this.Aa=n?_Ne(this.ha,n):void 0,this.Fa=n}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,n=!1){if(this.mi&&!n||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=yd.Ot(this.ha)||void 0}catch{}if(!o||o===this.Fa)return!1;const i=_Ne(this.ha,o);let r;try{r=pNe(JSON.parse(o))}catch{return!1}if((yd.Ot(this.ha)||void 0)!==o)return!1;this.Aa=i,this.Fa=o;const s=eOt(this.ha,o),a=[...CR,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Bo(_)||Id(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[m]=!0,delete r[m])}),Nx(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,u=l[NB],g=l[$y],h=Mu({},l);[...CR,...e.cookie_persisted_properties||[]].forEach(m=>{if(a.indexOf(m)!==-1&&!(m in r)&&!A[m]&&(c||m!=="distinct_id"&&m!=="$user_state")){const _=h[m];(s.isValid||CR.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=Mu(h,r),Kb.forEach(m=>{const _=m in this.props;m in l===_&&Nw(l[m],this.props[m])||(_?this.Ea(m,l[m],this.props[m]):this.ma(m,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.Ca($y,Yb);const d=this.props[NB],p=this.props[$y];return!c||d===u&&p===g||(this.sa=!0,this.ta=!0,nu.At(Mge(this.ha),!0),this.$a(ww),this.$a(Gb),this.$a(RB),this.$a(_R),this.$a(vw),this.$a(fR),this.$a(Dw),this.$a(R$),this.$a(Mw),p!=="anonymous"||g!=="identified"&&r.$user_state!=="anonymous"&&(Bo(u)||d===u)||(kOt(this.props,r),this.$a(Pw)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(xge)),!0}consumeCookieIdentityChange(){const e=Mge(this.ha),n=this.ta||!!nu.Ot(e);return this.ta=!1,n&&nu.Lt(e),n}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[o_],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){_Go.indexOf(e.persistence.toLowerCase())===-1&&(ui.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const n=((a=[],A=!1)=>{const c=[...CR,...a];return sn(sn({},hc),{},{Dt(l){try{let g,h={};try{g=yd.Ot(l)||void 0,h=g?pNe(JSON.parse(g)):{}}catch{}const d=JSON.parse(hc.Ot(l)||"{}");let p;if(A){const m=eOt(l,g),_=[...CR,...m.properties],f={};Object.keys(h).forEach(C=>{const y=h[C];Id(y)||y===""||C==="$user_state"&&y!=="anonymous"&&y!=="identified"||(f[C]=y)});const I="distinct_id"in f||f.$user_state==="anonymous"||f.$user_state==="identified";if(Object.keys(f).length>0){var u;const C=d[NB],y=(u=d.$user_state)!==null&&u!==void 0?u:Yb;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||CR.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[$y]=Yb),!I||("distinct_id"in f?f[NB]:d[NB])===C&&("$user_state"in f?f[$y]:d[$y])===y||(hNe.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[NB]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[RHt],delete d[Pw]),delete d.__alias)}p=Mu(d,f)}else p=Mu(h,d);return hc.At(l,p),p}catch{}return null},At(l,u,g,h,d,p){const m=hc.At(l,u,void 0,void 0,p);try{const _=mNe(u,a);if(Object.keys(_).length){if(A){const f=Qge(l),I=ZHt(_,a);if(yd.At(f,I,g,h,d,p),yd.Ot(f)!==JSON.stringify(I)){yd.Lt(f,h);const C=mNe(u);return yd.At(l,C,g,h,d,p),m}}yd.At(l,_,g,h,d,p)}}catch(_){hc.Pt(_)}return m},Lt(l,u){try{Ln?.localStorage.removeItem(l),yd.Lt(l,u),yd.Lt(Qge(l),u)}catch(g){hc.Pt(g)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&hc.Et()?(o=hc,r=!0):s==="localstorage+cookie"&&n.Et()?(o=n,r=!0,i=!0):s==="sessionstorage"&&nu.Et()?o=nu:s==="memory"?o=fNe:s==="cookie"&&yd.Et()?(o=yd,i=!0):n.Et()?(o=n,r=!0,i=!0):yd.Et()?(o=yd,i=!0):o=fNe,this.Ko=r,this.Xo=i,o}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){const e={};return Tl(this.props,(n,o)=>{const i=i1(o);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,n))return;e[o]=n}}),e}load(e=!1){if(this.mi&&!e)return;const n=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",o=n?hc.Dt(this.ha):null;let i={};if(n)try{i=pNe(yd.Dt(this.ha)),Tl(i,(A,c)=>{(Bo(A)||Id(A)||A==="")&&delete i[c]})}catch{}const r=this.qo.Dt(this.ha);if(r&&(this.props=Mu({},r)),this.Yo&&this.Ba(),n&&r){var s,a;const A=o?.[NB],c=(s=o?.$user_state)!==null&&s!==void 0?s:Yb,l=r[NB],u=(a=r.$user_state)!==null&&a!==void 0?a:Yb;if(l!==A||u!==c){this.ta=!0,nu.At(Mge(this.ha),!0);const g=Mu({},this.props);hNe.forEach(d=>delete g[d]),u!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Bo(A)||l===A)||(kOt(g,i),delete g[Pw]),this.props=g;const h=new Set;hNe.forEach(d=>{var p;const m=(p=i1(d))===null||p===void 0?void 0:p.storageGroup;m&&h.add(m)}),h.forEach(d=>{const p={};Tl(this.props,(m,_)=>{var f;((f=i1(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),Nx(p)?(hc.Lt(this.pa(d)),this.Jo[d]={}):hc.At(this.pa(d),p)&&(this.Jo[d]={persisted:!0,fingerprint:this.Sa(p,d)})})}}nu.Ot(Mge(this.ha))&&(this.ta=!0)}Ba(){for(const e of U$){const n=hc.Dt(this.pa(e));if(n&&!Nx(n)){const o=this.ya(e);o.persisted=!0,this.Ha(e)||(o.fingerprint=this.Sa(n,e)),this.za(e,n)||Mu(this.props,n)}}}Ha(e){return Object.keys(this.props).some(n=>{var o;return((o=i1(n))===null||o===void 0?void 0:o.storageGroup)===e})}za(e,n){const o=mGo[e];if(!o)return!1;const i=n[o],r=this.props[o];return sh(i)&&sh(r)&&r>i}refreshKey(e){var n;if(this.mi||this.oa.has(e))return;const o=this.Yo?(n=i1(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?hc.Dt(this.pa(o)):this.qo.Dt(this.ha);if(i&&e in i)this.Ca(e,i[e],!1);else{if(o){const r=this.qo.Dt(this.ha);if(r&&e in r)return void this.Ca(e,r[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;const e=this.Pa();e>0?Bo(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||ROt.forEach(r=>this.refreshKey(r)));const n=!e&&!this.na;n||(this.ra=!1);const o=!!n&&this.Ta();if(this.ra)return void(this.Rr.debug&&ui.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(o&&this.aa.forEach(r=>r()));const i=this.Wa(this.qo,this.ha,this.props,o_);i==="written"&&this.Ra(this.props),i!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),o&&this.aa.forEach(r=>r())}Ua(){const{main:e,groups:n}=this.wa(),o=this.Wa(this.qo,this.ha,e,o_);o==="written"&&this.Ra(e),o!=="failed"&&(this.sa=!1,this.oa.clear(),Kb.forEach(r=>{var s;!((s=i1(r))===null||s===void 0)&&s.storageGroup||this.ia.delete(r)}));for(const r of U$){var i;const s=n[r];if(Nx(s)&&!(!((i=this.Jo[r])===null||i===void 0)&&i.persisted)){Kb.forEach(A=>{var c;((c=i1(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ia.delete(A)});continue}const a=this.Wa(hc,this.pa(r),s,r);a!=="failed"&&Kb.forEach(A=>{const c=i1(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ia.delete(A)})}}wa(){const e={},n={flags:{},surveys:{}};return Tl(this.props,(o,i)=>{var r;const s=(r=i1(i))===null||r===void 0?void 0:r.storageGroup;s?n[s][i]=o:e[i]=o}),{main:e,groups:n}}Sa(e,n){if(n===o_)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const o={};return Tl(e,(i,r)=>{var s;o[r]=!((s=i1(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Wa(e,n,o,i){const r=this.ya(i);if(i!==o_&&!r.dirty&&!Bo(r.fingerprint))return"skipped";let s;try{if(s=this.Sa(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.At(n,o,this.Va,this.Ga,this.Za,this.Rr.debug)?(r.dirty=!1,i!==o_&&(r.persisted=!0),Bo(s)||(r.fingerprint=s),this.Ko&&(r.storageValue=hc.Ot(n)),"written"):(this.Rr.debug&&ui.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(const n of U$)hc.Lt(this.pa(n));e?delete this.Jo[o_]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(QA(e)){this.syncCookieProperties(),Bo(n)&&(n="None"),this.Va=Bo(o)?this.Qa:o;let i=!1;if(Tl(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.Ca(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(QA(e)){this.syncCookieProperties(),this.Va=Bo(n)?this.Qa:n;let o=!1;if(Tl(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||QA(i)||as(i))&&(this.Ca(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.$a(i),o=!0);o&&this.save()}update_campaign_params(){const e=No?.URL;if(e===this.ua)return;const n=SOt(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),o=!Nx(uNe(n));return o&&this.register(n),this.ua=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=No?.referrer;return e?vOt(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:POt(),$referring_domain:No?.referrer&&((e=Ub(No.referrer))===null||e===void 0?void 0:e.host)||Pge},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=MOt(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[zO]:this.Xo?{r:Dge(e.r),u:e.u?Dge(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Tl([HHt,LHt],o=>{const i=this.props[o];i&&Tl(i,function(r,s){e["$initial_"+SDe(s)]=r})});const n=this.props[zO];if(n){const o=(function(i,r=!1){const s=DOt(i,r),a={};return Tl(s,function(A,c){a[`$initial_${SDe(c)}`]=A}),a})(n,this.Rr.disable_capture_url_hashes);Mu(e,o)}return e}safe_merge(e){return Tl(this.props,function(n,o){o in e||(e[o]=n)}),e}update_config(e,n,o){const i=e.persistence!==n.persistence,r=!((d,p)=>{if(d.length!==p.length)return!1;const m=[...d].sort(),_=[...p].sort();return m.every((f,I)=>f===_[I])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=i||r,a=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,A=e.disable_persistence||!!o,c=!!this.mi&&!A;A||this.Oa(n,c),this.Rr=e,!A&&(i||r||a)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(sn(sn({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ca(e):this.qo;this.Ja();const u=this.da(e),g=s||u!==this.Yo,h=!A&&(g||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(c);this.na=g;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),g){const d=this.props;this.clear(),this.qo=l,this.Yo=u,this.props=d,this.save()}else a&&(this.qo=l,A||(delete this.Jo[o_],this.qa()))}finally{this.na=!1,h&&this.ja()}}Ja(){const e=this.props[zO];if(!this.Xo||!QA(e)||typeof e.r!="string")return;const n=Dge(e.r),o=typeof e.u=="string"?Dge(e.u):e.u;n===e.r&&o===e.u||this.Ca(zO,sn(sn({},e),{},{r:n,u:o}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.Ca($De,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Bo(o)||(delete n[e],this.Ca($De,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.Ca(e,n),this.save()}Ca(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.sa=!0),TOt(e)&&!Nw(r,n)&&this.oa.add(e),this.Ea(e,r,n),!((i=i1(e))===null||i===void 0)&&i.volatile||this.Ia(e))}$a(e,n=!0){delete this.props[e],n&&(SNe(e)&&this.ma(e,!0),TOt(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var n;const o=(n=i1(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ya(o).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}};const lE={GZipJS:"gzip-js",Base64:"base64"},z$={Activation:"events",Cancellation:"cancelEvents"},vNe={Popover:"popover",API:"api",Widget:"widget"},Vb={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},wNe={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},PNe={Popover:"popover",Inline:"inline"};function Nge(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&nf(n.then)&&n.then(void 0,()=>{})}}}}const fGo={SHOWN:"product tour shown"},FOt={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},LOt=Cd("[RateLimiter]");var IGo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{const o=n.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(i=>{LOt.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void LOt.warn(`could not rate limit - continuing. Error: "${i?.message}"`,{text:o})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var n,o,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:s}=this,a=new Date().getTime(),A=(n=(o=this.instance.persistence)===null||o===void 0?void 0:o.get_property("$capture_rate_limit"))!==null&&n!==void 0?n:{tokens:r,last:a};A.tokens+=(a-A.last)/1e3*s,A.last=a,A.tokens>r&&(A.tokens=r);const c=1>A.tokens;if(c||e||(A.tokens=Math.max(0,A.tokens-1)),c&&!e){const l=(sh(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ka(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Xa(e){const n=this.instance.config.property_denylist;return!as(n)||!n.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&fd?.pathname)return`${(e=fd.origin)!==null&&e!==void 0?e:""}${fd.pathname}`}Ka(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Ya(),a=this.Xa("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const Rw=Cd("[RemoteConfig]");var HOt=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Vr._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}tl(e){var n,o,i;!((n=Vr.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Vr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Rw.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void Rw.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return Rw.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(n=>{this.il(n.json,n)});this.il(e)})}catch(e){Rw.error("Error loading remote config",e),this.il()}}il(e,n){!e&&n&&(n.statusCode===0?n.error||Rw.warn("Failed to fetch remote config from PostHog."):Rw.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){Rw.error("Error applying remote config",i)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var o;(o=this._instance.featureFlags)===null||o===void 0||o.ensureFlagsLoaded()}catch(i){Rw.error("Error loading feature flags",i)}}},i4=Uint8Array,Rx=Uint16Array,nG=Uint32Array,MNe=new i4([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]),DNe=new i4([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]),OOt=new i4([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),GOt=function(t,e){for(var n=new Rx(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new nG(n[30]);for(o=1;30>o;++o)for(var r=n[o];n[o+1]>r;++r)i[r]=r-n[o]<<5|o;return[n,i]},YOt=GOt(MNe,2),NNe=YOt[1];YOt[0][28]=258,NNe[258]=28;for(var UOt=GOt(DNe,0)[1],KOt=new Rx(32768),xd=0;32768>xd;++xd){var oG=(43690&xd)>>>1|(21845&xd)<<1;KOt[xd]=((65280&(oG=(61680&(oG=(52428&oG)>>>2|(13107&oG)<<2))>>>4|(3855&oG)<<4))>>>8|(255&oG)<<8)>>>1}var J$=function(t,e,n){for(var o=t.length,i=0,r=new Rx(e);o>i;++i)++r[t[i]-1];var s,a=new Rx(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new Rx(o),i=0;o>i;++i)s[i]=KOt[a[t[i]-1]++]>>>15-t[i];return s},xR=new i4(288);for(xd=0;144>xd;++xd)xR[xd]=8;for(xd=144;256>xd;++xd)xR[xd]=9;for(xd=256;280>xd;++xd)xR[xd]=7;for(xd=280;288>xd;++xd)xR[xd]=8;var Rge=new i4(32);for(xd=0;32>xd;++xd)Rge[xd]=5;var CGo=J$(xR,9),yGo=J$(Rge,5),VOt=function(t){return(t/8|0)+(7&t&&1)},zOt=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof Rx?Rx:t instanceof nG?nG:i4)(n-e);return o.set(t.subarray(e,n)),o},zb=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},W$=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},RNe=function(t,e){for(var n=[],o=0;t.length>o;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return[new i4(0),0];if(i==1){var s=new i4(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,u=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[u].f>n[c].f?c++:u++],A=n[c!=l&&n[u].f>n[c].f?c++:u++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};var g=r[0].s;for(o=1;i>o;++o)r[o].s>g&&(g=r[o].s);var h=new Rx(g+1),d=TNe(n[l-1],h,0);if(d>e){o=0;var p=0,m=d-e,_=1<<m;for(r.sort(function(y,x){return h[x.s]-h[y.s]||y.f-x.f});i>o;++o){var f=r[o].s;if(e>=h[f])break;p+=_-(1<<d-h[f]),h[f]=e}for(p>>>=m;p>0;){var I=r[o].s;e>h[I]?p-=1<<e-h[I]++-1:++o}for(;o>=0&&p;--o){var C=r[o].s;h[C]==e&&(--h[C],++p)}d=e}return[new i4(h),d]},TNe=function(t,e,n){return t.s==-1?Math.max(TNe(t.l,e,n+1),TNe(t.r,e,n+1)):e[t.s]=n},JOt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Rx(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;e>=a;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return[n.subarray(0,o),e]},j$=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},kNe=function(t,e,n){var o=n.length,i=VOt(e+2);t[i]=255&o,t[i+1]=o>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var r=0;o>r;++r)t[i+r+4]=n[r];return 8*(i+4+o)},WOt=function(t,e,n,o,i,r,s,a,A,c,l){zb(e,l++,n),++i[256];for(var u=RNe(i,15),g=u[0],h=u[1],d=RNe(r,15),p=d[0],m=d[1],_=JOt(g),f=_[0],I=_[1],C=JOt(p),y=C[0],x=C[1],E=new Rx(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var S=RNe(E,7),Q=S[0],w=S[1],M=19;M>4&&!Q[OOt[M-1]];--M);var k,R,F,O,U=c+5<<3,Y=j$(i,xR)+j$(r,Rge)+s,W=j$(i,g)+j$(r,p)+s+14+3*M+j$(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&W>=U)return kNe(e,l,t.subarray(A,A+c));if(zb(e,l,1+(Y>W)),l+=2,Y>W){k=J$(g,h),R=g,F=J$(p,m),O=p;var te=J$(Q,w);for(zb(e,l,I-257),zb(e,l+5,x-1),zb(e,l+10,M-4),l+=14,B=0;M>B;++B)zb(e,l+3*B,Q[OOt[B]]);l+=3*M;for(var j=[f,y],J=0;2>J;++J){var ie=j[J];for(B=0;ie.length>B;++B)zb(e,l,te[oe=31&ie[B]]),l+=Q[oe],oe>15&&(zb(e,l,ie[B]>>>5&127),l+=ie[B]>>>12)}}else k=CGo,R=xR,F=yGo,O=Rge;for(B=0;a>B;++B)if(o[B]>255){var oe;W$(e,l,k[257+(oe=o[B]>>>18&31)]),l+=R[oe+257],oe>7&&(zb(e,l,o[B]>>>23&31),l+=MNe[oe]);var ne=31&o[B];W$(e,l,F[ne]),l+=O[ne],ne>3&&(W$(e,l,o[B]>>>5&8191),l+=DNe[ne])}else W$(e,l,k[o[B]]),l+=R[o[B]];return W$(e,l,k[256]),l+R[256]},xGo=new nG([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),EGo=(function(){for(var t=new nG(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),FNe=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function BGo(t,e){e===void 0&&(e={});var n=(function(){var u=4294967295;return{p(g){for(var h=u,d=0;g.length>d;++d)h=EGo[255&h^g[d]]^h>>>8;u=h},d(){return 4294967295^u}}})(),o=t.length;n.p(t);var i,r,s,a,A,c=(a=10+((i=e).filename&&i.filename.length+1||0),A=8,(function(u,g,h,d,p,m){var _=u.length,f=new i4(d+_+5*(1+Math.floor(_/7e3))+p),I=f.subarray(d,f.length-p),C=0;if(!g||8>_)for(var y=0;_>=y;y+=65535){var x=y+65535;_>x?C=kNe(I,C,u.subarray(y,x)):(I[y]=m,C=kNe(I,C,u.subarray(y,_)))}else{for(var E=xGo[g-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,w=new Rx(32768),M=new Rx(Q+1),k=Math.ceil(h/3),R=2*k,F=function(Ce){return(u[Ce]^u[Ce+1]<<k^u[Ce+2]<<R)&Q},O=new nG(25e3),U=new Rx(288),Y=new Rx(32),W=0,te=0,j=(y=0,0),J=0,ie=0;_>y;++y){var oe=F(y),ne=32767&y,ge=M[oe];if(w[ne]=ge,M[oe]=ne,y>=J){var ue=_-y;if((W>7e3||j>24576)&&ue>423){C=WOt(u,I,0,O,U,Y,te,j,ie,y-ie,C),j=W=te=0,ie=y;for(var _e=0;286>_e;++_e)U[_e]=0;for(_e=0;30>_e;++_e)Y[_e]=0}var le=2,fe=0,he=S,ye=ne-ge&32767;if(ue>2&&oe==F(y-ye))for(var Qe=Math.min(B,ue)-1,we=Math.min(32767,y),pe=Math.min(258,ue);we>=ye&&--he&&ne!=ge;){if(u[y+le]==u[y+le-ye]){for(var ve=0;pe>ve&&u[y+ve]==u[y+ve-ye];++ve);if(ve>le){if(le=ve,fe=ye,ve>Qe)break;var Me=Math.min(ye,ve-2),Pe=0;for(_e=0;Me>_e;++_e){var He=y-ye+_e+32768&32767,Re=He-w[He]+32768&32767;Re>Pe&&(Pe=Re,ge=He)}}}ye+=(ne=ge)-(ge=w[ne])+32768&32767}if(fe){O[j++]=268435456|NNe[le]<<18|UOt[fe];var Ee=31&NNe[le],Te=31&UOt[fe];te+=MNe[Ee]+DNe[Te],++U[257+Ee],++Y[Te],J=y+le,++W}else O[j++]=u[y],++U[u[y]]}}C=WOt(u,I,m,O,U,Y,te,j,ie,y-ie,C)}return zOt(f,0,d+VOt(C)+p)})(r=t,(s=e).level==null?6:s.level,s.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+s.mem,a,A,!0)),l=c.length;return(function(u,g){var h=g.filename;if(u[0]=31,u[1]=139,u[2]=8,u[8]=2>g.level?4:g.level==9?2:0,u[9]=3,g.mtime!=0&&FNe(u,4,Math.floor(new Date(g.mtime||Date.now())/1e3)),h){u[3]=8;for(var d=0;h.length>=d;++d)u[d+10]=h.charCodeAt(d)}})(c,e),FNe(c,l-8,n.d()),FNe(c,l-4,o),c}const bGo=!!BDe||!!E$,jOt=new WeakMap,$Ot="text/plain";let LNe=0,Tge=!1;const qOt=(t,e)=>{const[n,o]=t.split("#"),[i,r]=n.split("?");if(!r)return t;const s=r.split("&").filter(a=>a.split("=")[0]!==e).join("&");return`${i}${s?`?${s}`:""}${o?`#${o}`:""}`},$$=(t,e,n=!0)=>{var o;const[i,r]=t.split("?"),s=sn({},e),a=(o=r?.split("&").map(c=>{var l;const[u,g]=c.split("="),h=n&&(l=s[u])!==null&&l!==void 0?l:g;return delete s[u],`${u}=${h}`}))!==null&&o!==void 0?o:[],A=(function(c,l="&"){let u,g;const h=[];return Tl(c,function(d,p){Bo(d)||Bo(p)||p==="undefined"||(u=encodeURIComponent((m=>m instanceof File)(d)?d.name:d.toString()),g=encodeURIComponent(p),h[h.length]=g+"="+u)}),h.join(l)})(s);return A&&a.push(A),a.length>0?`${i}?${a.join("&")}`:i},HNe=t=>{if(t.sl)return t.sl;const{data:e,compression:n}=t;if(!e)return;if(n===lE.GZipJS){const i=BGo((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new i4(r.length+(r.length>>>1)),A=0,c=function(h){a[A++]=h},l=0;s>l;++l){if(A+5>a.length){var u=new i4(A+8+(s-l<<1));u.set(a),a=u}var g=r.charCodeAt(l);128>g?c(g):2048>g?(c(192|g>>>6),c(128|63&g)):g>55295&&57344>g?(c(240|(g=65536+(1047552&g)|1023&r.charCodeAt(++l))>>>18),c(128|g>>>12&63),c(128|g>>>6&63),c(128|63&g)):(c(224|g>>>12),c(128|g>>>6&63),c(128|63&g))}return zOt(a,0,A)})(XO(e)),{mtime:0});return{contentType:$Ot,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===lE.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(XO(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:XO(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=XO(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},XOt=t=>{const e=()=>t.transport==="sendBeacon"?{url:$$(t.url,{compression:lE.Base64}),encodedBody:HNe(sn(sn({},t),{},{compression:lE.Base64,sl:void 0}))}:{url:qOt(t.url,"compression"),encodedBody:HNe(sn(sn({},t),{},{compression:void 0,sl:void 0}))};let n;try{n=HNe(t)}catch(i){if(cHt(t.compression,ZO(t.url,"compression")))return ui.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&cHt(t.compression,ZO(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?UDe(new Uint8Array(o)):ArrayBuffer.isView(o)&&UDe(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(Tge=!0,e()):{url:t.url,encodedBody:n};var o},ZOt=t=>{try{return XOt(t)}catch(n){var e;return ui.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},SGo=(function(){var t=eg(function*(e){const n=yield(function(i){return KDe.apply(this,arguments)})(XO(e.data),n_.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{sl:{contentType:$Ot,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),QGo=/Failed to fetch|NetworkError|Load failed/i,eGt=t=>t?.name==="TypeError"&&QGo.test(t?.message||""),tGt=t=>{try{const e=(function(n,o=Date.now()){if(typeof n!="string"||!n)return;const i=n.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){const A=1e3*Math.min(Number(r),300);return A>0?A:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;const s=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(s)-o;return Number.isFinite(a)&&a>0?Math.min(a,hge):void 0})(t());return Bo(e)?void 0:Math.min(e,3e4)}catch{return}},nGt=t=>{const e=ZOt(t);if(!e)return;const n=new BDe;jOt.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};Tl(t.headers,function(a,A){n.setRequestHeader(A,a)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a;const A={statusCode:n.status,text:n.responseText};if(n.status===200)try{A.json=JSON.parse(n.responseText)}catch{}(a=t.callback)===null||a===void 0||a.call(t,A,tGt(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},oGt=t=>{const e=ZOt(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;Tl(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(rLt){const d=new rLt;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(JLt("AbortError","PostHog request timed out"+((p=t.timeout)?` after ${p}ms`:"")))}catch(m){u(m)}var p},t.timeout)}}let l=!1;const u=d=>{var p;l||(l=!0,c&&d?.name==="AbortError"||eGt(d)?ui.warn(d):ui.error(d),(p=t.callback)===null||p===void 0||p.call(t,{statusCode:0,error:d}))};let g=0;const h=()=>{LNe-=g,g=0,A&&clearTimeout(A.timeout)};try{const d=sn({method:t?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:A?.signal},t.fetchOptions),p=s??(Bo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.rl&&d.keepalive!==!1&&d.body===r&&!Bo(p)&&p>=0&&52428.8>LNe+p,d.keepalive&&(g=p,LNe+=g),E$(n,d).then(m=>m.text().then(_=>{var f;if(l)return;const I={statusCode:m.status,text:_};if(m.status===200)try{I.json=JSON.parse(_)}catch(C){ui.error(C)}l=!0,h(),(f=t.callback)===null||f===void 0||f.call(t,I,tGt(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),u(m)}).finally(h)}catch(d){h(),u(d)}},ONe=t=>{try{var e;const{url:n,encodedBody:o}=XOt(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(tf.sendBeacon(n,a))return;const A=as(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(as(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=u=>as(t.data)?u:sn(sn({},t.data),{},{batch:u});return ONe(sn(sn({},t),{},{data:l(A.slice(0,c))})),void ONe(sn(sn({},t),{},{data:l(A.slice(c))}))}ui.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${E$?"fetch":"XHR"}`),E$?oGt(sn(sn({},t),{},{rl:!0})):nGt(t)}catch(n){ui.warn("Beacon send failed",n)}},iGt=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return $$(n===lE.GZipJS?qOt(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===lE.GZipJS?{}:{compression:n}))},vGo=(()=>{const t=[];return E$&&t.push({transport:"fetch",method:oGt}),BDe&&t.push({transport:"XHR",method:nGt}),tf?.sendBeacon&&t.push({transport:"sendBeacon",method:ONe}),t})();let rGt=!bGo&&Wy?.indexOf("MSIE")===-1&&Wy?.indexOf("Mozilla")===-1;function sGt(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?rGt?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&((i=e.callback)===null||i===void 0||i.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=sn(sn({},t.config.request_headers),e.headers),e.compression=e.compression==="best-available"?(o=t.compression)!==null&&o!==void 0?o:e.compressionFallback:e.compression,(Bo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const u=sn(sn({},s),{},{callback:a??(m=>{var _;return(_=s.callback)===null||_===void 0?void 0:_.call(s,m)})});u.timeout=u.timeout||6e4;const g=(A=u.transport)!==null&&A!==void 0?A:"fetch";g==="sendBeacon"&&Bo(u.compression)&&u.data&&(u.compression=lE.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data=(m=>{var _,f;const I=(as(m)?m:[m]).map(y=>sn(sn({},y),y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})),C=I[0];return{api_key:(_=C==null||(f=C.properties)===null||f===void 0?void 0:f.token)!==null&&_!==void 0?_:C?.token,batch:I,sent_at:new Date().toISOString()}})(u.data):u.timestampMode==="body"&&(u.data=((m,_=new Date().toISOString())=>as(m)?m.map(f=>sn(sn({},f),{},{sent_at:_})):sn(sn({},m),{},{sent_at:_}))(u.data))),u.url=iGt(u.url,u.method,u.compression,u.timestampMode);const h=vGo.filter(m=>!u.disableTransport||!m.transport||!u.disableTransport.includes(m.transport)),d=(c=(l=(function(m,_){for(let f=0;m.length>f;f++)if(_(m[f]))return m[f]})(h,m=>m.transport===g))===null||l===void 0?void 0:l.method)!==null&&c!==void 0?c:h[0].method;if(!d)throw new Error("No available transport method");const p=m=>{try{d(m)}catch(f){var _;eGt(f)?ui.warn(f):ui.error(f),(_=u.callback)===null||_===void 0||_.call(u,{statusCode:0,error:f})}};g!=="sendBeacon"&&!u.preferSyncCompression&&u.data&&u.compression===lE.GZipJS&&uHo&&typeof Promise<"u"&&!Tge?SGo(u).then(m=>{p(m)}).catch(m=>{if(lHt(m))return Tge=!0,void p(sn(sn({},u),{},{compression:void 0,url:iGt(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return lHt(_)||f===AHt})(m)&&(Tge=!0),p(u)}):p(u)})(e,(s,a)=>{var A,c,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||(A=(c=t.config).on_request_error)===null||A===void 0||A.call(c,s),n?n(s,a):(l=e.callback)===null||l===void 0||l.call(e,s)})):e.fireCallbackOnDrop&&((r=e.callback)===null||r===void 0||r.call(e,{statusCode:0}))}var wGo=class{constructor(e,n){this.ol=!0,this.al=[],this.ll=l6(n?.flush_interval_ms||3e3,250,5e3,ui.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();const e=this.al.length>0?this.vl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.fl(o,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const e=this.vl();for(const n in e)this.fl(e[n])}},this.ll))}fl(e,n){try{this.ul(e,n)}catch(o){ui.error(o)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const e={};return Tl(this.al,n=>{var o;const i=n,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");Bo(e[r])&&(e[r]=sn(sn({},i),{},{data:[]})),(o=e[r].data)===null||o===void 0||o.push(i.data)}),this.al=[],e}};const PGo=["retriesPerformedSoFar"];var MGo=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Bo(Ln)&&"onLine"in Ln.navigator){if(this.ml=Ln.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},Cl(Ln,"online",this.yl),Cl(Ln,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=gHt(e,PGo);Ob(o)&&(i.url=$$(i.url,{retry_count:o})),sGt(this._instance,n?sn(sn({},i),{},{transport:n}):i,(r,s)=>{var a;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(o??0))return void this.Ls(sn({retriesPerformedSoFar:o},i),s);r.statusCode===0&&ui.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${o??0} retries.`)}(a=i.callback)===null||a===void 0||a.call(i,r)})}Ls(e,n){const o=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=o+1;const i=Math.max((function(a){const A=3e3*Math.pow(2,a),c=A/2,l=Math.min(18e5,A),u=(Math.random()-.5)*(l-c);return Math.ceil(l+u)})(o),n??0),r=Date.now()+i;this.al.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),ui.warn(s),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const e=Date.now(),n=[],o=this.al.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.al=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,Bo(Ln)||(this.yl&&(Ln.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(Ln.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:e}of this.al)try{this._instance._send_request(sn(sn({},e),{},{transport:"sendBeacon"}))}catch(n){ui.error(n)}this.al=[]}},DGo=class{constructor(e){this._instance=e,this.Sl=()=>{var n,o,i,r;this.xl||(this.xl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.xl.lastScrollY=Math.ceil(a),this.xl.maxScrollY=Math.max(a,(n=this.xl.maxScrollY)!==null&&n!==void 0?n:0),this.xl.maxScrollHeight=Math.max(A,(o=this.xl.maxScrollHeight)!==null&&o!==void 0?o:0),this.xl.lastContentY=c,this.xl.maxContentY=Math.max(c,(i=this.xl.maxContentY)!==null&&i!==void 0?i:0),this.xl.maxContentHeight=Math.max(l,(r=this.xl.maxContentHeight)!==null&&r!==void 0?r:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){Cl(Ln,"scroll",this.Sl,{capture:!0}),Cl(Ln,"scrollend",this.Sl,{capture:!0}),Cl(Ln,"resize",this.Sl)}scrollElement(){if(this.Cl){const o=as(this.Cl)?this.Cl:[this.Cl];for(const i of o){var e;const r=Ln==null||(e=Ln.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Ln==null||(n=Ln.document)===null||n===void 0?void 0:n.documentElement}$l(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.Cl){const r=this.scrollElement();return r&&r[i]||0}return Ln?e==="y"?Ln.scrollY||Ln.pageYOffset||((n=Ln.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Ln.scrollX||Ln.pageXOffset||((o=Ln.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const NGo=t=>MOt(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var aGt=class{constructor(e,n,o,i){this.Be=r=>{const s=this.Tl();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Il(this._instance)};this.Ml.register({[sNe]:a})},this._instance=e,this.El=n,this.Ml=o,this.Il=i||NGo,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[sNe]}getSetOnceProps(){var e;const n=(e=this.Tl())===null||e===void 0?void 0:e.props;return n?"r"in n?DOt(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){const e={};return Tl(uNe(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${SDe(o)}`]=n}),e}},kge=class{on(t,e){return this.Pl[t]||(this.Pl[t]=[]),this.Pl[t].push(e),()=>{this.Pl[t]=this.Pl[t].filter(n=>n!==e)}}emit(t,e){for(const n of this.Pl[t]||[])n(e);for(const n of this.Pl["*"]||[])n(t,e)}constructor(){this.Pl={}}};const iG=Cd("[SessionId]"),AGt=864e5;var cGt=class{on(e,n){return this.Rl.on(e,n)}constructor(e,n,o){var i;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new kge,this.Nl=(s,a)=>!(!Ob(s)||!Ob(a))&&Math.abs(s-a)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=n||TB,this.Bl=o||TB;const r=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*l6(this.Rr.session_idle_timeout_seconds||1800,60,36e3,iG.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+r+"_window_id",this.Ul="ph_"+r+"_primary_window_exists",this.Wl()){const s=nu.Dt(this.zl),a=nu.Dt(this.Ul);s&&!a?this.He=s:nu.Lt(this.zl),nu.At(this.Ul,!0)}!((i=this.Rr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Bo(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(n=>n!==e)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&nu.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&nu.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?nu.Dt(this.zl):null}Ql(e){const n=this.Al;return!Id(n)&&!Id(e)&&5e3>Math.abs(e-n)}Jl(e,n,o){const i=n!==this._sessionActivityTimestamp,r=!(e!==this.Xt||o!==this._sessionStartTimestamp);this._sessionStartTimestamp=o,this._sessionActivityTimestamp=n,this.Xt=e,r&&!i||r&&this.Ql(n)||(this.Al=n,this.Ml.register({[VO]:[n,e,o]}))}Kl(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Ob(n)&&n>0}Xl(){this.Kl()?this.Ml.refreshKey(VO):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(Id(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,n,o]=this.tu();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[VO]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),n=Ob(e)?e:0,o=Ob(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){const e=this.Ml.props[VO];return as(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,n=!1){const o=((i,r=new Date().getTime())=>{try{const s=(a=>{const A=a.replace(/-/g,"");if(A.length!==32)throw new Error("Not a valid UUID");if(A[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(A.substring(0,12),16)})(i);return s>r+6e4?void iG.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void iG.error("Invalid sessionID in bootstrap",s)}})(e);return!Bo(o)&&(n?this.ql={sessionId:e,sessionStartTimestamp:o}:this.Jl(e,new Date().getTime(),o),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&Ln&&(Ln.removeEventListener(bge,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&nu.Lt(this.Ul)},Cl(Ln,bge,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Rr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Fl=i;else if(Id(this.Fl)||this.Fl>i||i-this.Fl>=1e3){var s,a;(s=(a=this.Ml).syncCookieProperties)===null||s===void 0||s.call(a),this.Fl=i}let[,A,c]=this.tu();const l=!Bo(r)&&A!==r,u=this.eu();let g=this.Zl();const h=this.ql,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>AGt),p=h?d:Ob(c)&&Math.abs(i-c)>AGt;let m=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Nl(i,u);if(C&&(C=this.iu(i),C||iG.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.tu(),C||(f=!A||!!h)),f||C||p){_=!1;const B=h&&!d;A=B?h.sessionId:this.jl(),g=this.Bl(),iG.info("new session ID assigned",{sessionId:A,windowId:g,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p}}),c=B?h.sessionStartTimestamp:i,this.ql=void 0,m=!0}else g||(g=this.Bl(),m=!0),_=_||A!==I,_&&(iG.info("adopted cross-tab session id",{sessionId:A,windowId:g}),m=!0);const y=Ob(u)&&e&&!p?u:i,x=Ob(c)?c:new Date().getTime();this.Gl(g),this.Jl(A,y,x),e||this.Hl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p,crossTabAdoption:_};return m&&this.Ol.forEach(B=>B(A,g,E)),{sessionId:A,windowId:g,sessionStartTimestamp:x,changeReason:m?E:void 0,lastActivityTimestamp:u}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.Hl()},1.1*this.sessionTimeoutMs))}};const lGt=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&gLt(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>gLt(i?.brand,e)))return!0}catch{}return!!t.webdriver};function uGt(){return(uGt=eg(function*(){const t=tf?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return rA(n)&&n.length>0?n:void 0}catch(e){return void ui.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function RGo(t,e){let n=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(n=`$survey_${e}/${t.id}/${t.current_iteration}`),n}function gGt(t){var e;return!!(!((e=t.conditions)===null||e===void 0||(e=e.events)===null||e===void 0||(e=e.values)===null||e===void 0)&&e.length)}const Fge=(t,e)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},Lge=t=>t.toLowerCase(),dGt={exact:(t,e)=>e.some(n=>t.some(o=>n===o)),is_not:(t,e)=>e.every(n=>t.every(o=>n!==o)),regex:(t,e)=>e.some(n=>t.some(o=>Fge(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!Fge(n,o))),icontains:(t,e)=>e.map(Lge).some(n=>t.map(Lge).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(Lge).every(n=>t.map(Lge).every(o=>!n.includes(o))),gt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o>parseFloat(i))}),lt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o<parseFloat(i))})};function hGt(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=dGt[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function GNe(t,e,n){return XO({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const YNe="custom",pGt="i.posthog.com",TGo=/^\/static\//,kGo=["/s/","/e/","/i/"];var FGo=class{constructor(t){this.su={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${pGt}`,".posthog.com")),e==="https://app.posthog.com"?"https://us.posthog.com":e}get region(){return this.su[this.apiHost]||(this.su[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":YNe),this.su[this.apiHost]}ru(t){if(!TGo.test(t))return;const e=this.instance.config.asset_host;return typeof e=="string"&&e.trim().replace(/\/$/,"")||void 0}ou(t){const e=Ub(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}au(t,e,n){if(t==="ui")return n;let o=n;const i=this.instance.config.rewriteRequestPath;if(i){var r;const s=((r=Ub(n))===null||r===void 0?void 0:r.href)||n;o=i(new URL(s)).toString()}if(i&&t==="api"&&kGo.some(s=>e.indexOf(s)===0)){const s=this.ou(o);if(s){const a=this.apiHost;let A=this.lu;A?.apiHost===a&&A.rewriteRequestPath===i||(A={apiHost:a,rewriteRequestPath:i,urls:new Set},this.lu=A),A.urls.add(s)}}return o}isIngestionEndpoint(t){const e=this.lu,n=this.ou(t);return e?.apiHost===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&e.urls.has(n)}endpointFor(t,e=""){if(e&&(e=e[0]==="/"?e:`/${e}`),t==="ui")return this.au(t,e,this.uiHost+e);if(t==="flags")return this.au(t,e,this.flagsApiHost+e);if(t==="assets"){const o=this.ru(e);if(o)return this.au(t,e,`${o}${e}`)}if(this.region===YNe)return this.au(t,e,this.apiHost+e);const n=pGt+e;switch(t){case"assets":return this.au(t,e,`https://${this.region}-assets.${n}`);case"api":return this.au(t,e,`https://${this.region}.${n}`)}}};const kl=Cd("[Surveys]"),mGt=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){kl.error("Failed to persist survey seen state",e)}},LGo=[vNe.Popover,vNe.Widget,vNe.API],HGo={ignoreConditions:!1,ignoreDelay:!1,displayType:PNe.Popover},OGo=Cd("[PostHog ExternalIntegrations]"),GGo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var YGo=class{constructor(t){this._instance=t}zo(t,e){var n,o;(n=Vr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,t,i=>{if(i)return OGo.error("failed to load script",i);e()})}startIfEnabledOrStop(){var t;for(const[i,r]of Object.entries((t=this._instance.config.integrations)!==null&&t!==void 0?t:{})){var e,n,o;r&&!(!((e=Vr.__PosthogExtensions__)===null||e===void 0||(e=e.integrations)===null||e===void 0)&&e[i])&&this.zo(GGo[i],()=>{var s;(s=Vr.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[i])===null||s===void 0||s.start(this._instance)}),!r&&(!((n=Vr.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[i])&&((o=Vr.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[i])===null||o===void 0||o.stop())}}},UGo=class{constructor(e,n){this.$=e,this.wo=n,this.uu=new Map,this.Io=!1}add(e){var n=this;return eg(function*(){if(n.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.uu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.uu.set(e.name,e);try{const o=e.setup(n.wo);o&&(yield o)}catch(o){const i=n.uu.get(e.name)===e;i&&n.uu.delete(e.name),n.$.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;const e=Array.from(this.uu.values()).reverse();this.uu.clear();for(const n of e)this.hu(n)}hu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&nf(o.then)&&o.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.$.error(`Failed to dispose browser extension "${e.name}"`,o)}}},KGo=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if(typeof t=="string")return e?.get_property(t);const n={};for(const o of t){const i=e?.get_property(o);Bo(i)||(n[o]=i)}return n}set(t,e){var n;(n=this._instance.persistence)===null||n===void 0||n.register(typeof t=="string"?{[t]:e}:t)}remove(t){var e;(e=this._instance.persistence)===null||e===void 0||e.unregister(t)}};const _Gt="extensionsRemoteConfig";var VGo=class{constructor(t){this.instance=t,this.Io=!1,this.$=ui,this.cu=t.du,this.kv=new KGo(t),this.onEvent=e=>Nge(this.instance.on("eventCaptured",n=>{try{e({event:n.event,properties:n.properties})}catch(o){this.$.error("Browser extension event listener failed",o)}})),this.onRemoteConfig=e=>{if(this.Io)return Nge(()=>{});const n=i=>{try{e(i)}catch(r){this.$.error("Browser extension remote config listener failed",r)}},o=this.instance.vu.on(_Gt,n);return this.cu&&n(this.cu),Nge(o)},this.fu=new UGo(ui.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property("$device_id"))!==null&&t!==void 0?t:this.distinctId}get deviceId(){const t=this.instance.get_property(WDe);return typeof t=="string"?t:void 0}get library(){return{name:n_.LIB_NAME,version:n_.LIB_VERSION}}get initialPersonProperties(){var t,e;return(t=(e=this.instance.persistence)===null||e===void 0?void 0:e.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,n,o;const i=(t=this.instance.sessionManager)===null||t===void 0?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(e=i?.sessionId)!==null&&e!==void 0?e:"",windowId:(n=i?.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(o=i?.sessionStartTimestamp)!==null&&o!==void 0?o:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.fu.add(t)}getExtension(t){return this.fu.getExtension(t)}capture(t,e,n){n?this.instance.capture(t,e,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):this.instance.capture(t,e)}registerDynamicEventProperties(t){return Nge(this.instance.pu(t))}handleRemoteConfig(t){this.Io||(this.cu=t,this.instance.vu.emit(_Gt,t))}sendRequest(t){var e=this;return eg(function*(n,o={}){var i;const r=e.instance.requestRouter.endpointFor((i=o.target)!==null&&i!==void 0?i:"api",n),s={method:o.method,url:o.query?$$(r,o.query):r,data:o.body,headers:o.headers,timeout:o.timeoutMs,fireCallbackOnDrop:!0,transport:o.transport,compression:o.compression,compressionFallback:o.target==="flags"&&o.compression==="best-available"?bDe.Base64:void 0,timestampMode:o.sentAt};return o.transport==="sendBeacon"?(e.instance._send_request(s),{statusCode:202}):new Promise(a=>{s.callback=a,e.instance._send_request(s)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const q$={};let UNe=0;const X$=()=>{},fGt='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Z$="Surveys module not available",IGt="sanitize_properties is deprecated. Use before_send instead",CGt="Invalid value for property_denylist config: ",zGo=/^[A-Za-z0-9_-]{1,400}$/,yGt=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,xGt=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,JGo=["token","distinct_id",OHt],eq="posthog",WGo=t=>{const e={};return t&&t!=="unset"&&("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0)),e},KNe=t=>{var e;return sn({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:JOo(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:X$,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:fd&&rA(fd?.search)&&fd.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(Ln==null||(e=Ln.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){ui.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:VHt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:X$},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:tGo,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:WGo(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},jGo=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],EGt=t=>{const e={};for(const[i,r]of jGo)Bo(t[i])||(e[r]=t[i]);const n=Mu({},e,t),o=t.__preview_external_dependency_versioned_paths;return Bo(o)||(Bo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),rA(o)&&Bo(t.asset_host)&&(n.asset_host=o)),as(t.property_blacklist)&&(Bo(t.property_denylist)?n.property_denylist=t.property_blacklist:as(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ui.error(CGt+t.property_denylist)),n};var $Go=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(t){ui.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},tq=class GM{mu(e){if(!e)return;const n=this.uu.indexOf(e);n!==-1&&this.uu.splice(n,1)}yu(e,n){var o;return this.mu(e),this.uu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.ku)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;const e=this.persistence;if(!e)return;this.xu()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(TB());this.register({distinct_id:o,$device_id:o}),e.set_property($y,Yb)}this.Cu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.$u=!1,this.Tu=!1,this.webPerformance=new $Go,this.Iu=!1,this.version=n_.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new kge,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=KNe(),this.SentryIntegration=cGo,this.sentryIntegration=o=>(function(i,r){const s=xOt(i,r);return{name:yOt,processEvent:a=>s(a)}})(this,o),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new DGo(this),this.pageViewManager=new EOt(this),this.rateLimiter=new IGo(this),this.requestRouter=new FGo(this),this.consent=new eGo(this),this.externalIntegrations=new YGo(this);const n=(e=GM.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(o,i,r)=>{const s=rA(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=rA(o)?{[o]:i}:o;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",o=>ui.info(`send "${o?.event}"`,o))}init(e,n,o){if(o&&o!==eq){var i;const r=(i=q$[o])!==null&&i!==void 0?i:new GM;return r._init(e,n,o),q$[o]=r,q$[eq][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=rA(e)?e.trim():"";if(!a)return ui.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var A;if(this.__loaded)return a!==((A=this.config)===null||A===void 0?void 0:A.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=KNe(n.defaults),n.debug=this.Du(n.debug),this.Lu=n,this.Nu=[],n.person_profiles?this.Fu=n.person_profiles:n.process_person&&(this.Fu=n.process_person);const c=KNe(n.defaults),l=EGt(n),u=Mu({},c,l,{name:o,token:a});QA(c.rageclick)&&QA(l.rageclick)&&(u.rageclick=Mu({},c.rageclick,l.rageclick)),QA(c.session_recording)&&QA(l.session_recording)&&(u.session_recording=Mu({},c.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&ui.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:lE.GZipJS;const g=this.xu();if(this.persistence=new QNe(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new QNe(sn(sn({},this.config),{},{persistence:"sessionStorage"}),g,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!g&&nu.Et()){const _=nu.Dt(this.Eu);as(_)&&_.forEach(f=>{rA(f)&&this.Mu.add(f)})}else nu.Lt(this.Eu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new wGo((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new MGo(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new cGt(this),this.sessionPropsManager=new aGt(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,f,I)=>{(I?.activityTimeout||I?.sessionPastMaximumLength||I?.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(ui.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(p)},0)):(ui.info("Initializing extensions synchronously"),this.Uu(p)),n_.DEBUG=n_.DEBUG||this.config.debug,n_.DEBUG&&ui.info("Starting in debug mode",{this:this,config:n,thisC:sn({},this.config),p:h,s:d}),this.config.identity_distinct_id&&!(!((i=n.bootstrap)===null||i===void 0)&&i.distinctID)&&(n.bootstrap=sn(sn({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=(r=n.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.ku=!!m&&!b$(m),(s=n.bootstrap)===null||s===void 0?void 0:s.distinctID){const _=n.bootstrap.distinctID,f=this.get_distinct_id(),I=this.persistence.get_property($y);if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="anonymous")this.identify(_);else if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="identified")ui.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const C=this.config.get_device_id(TB()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property($y,n.bootstrap.isIdentifiedID?Bge:Yb),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:ANe,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(TB());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property($y,Yb)}return Cl(Ln,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Cl(Ln,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?COt(this,()=>this.Wu()):this.Wu(),nf(this.config._onCapture)&&this.config._onCapture!==X$&&(ui.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&ui.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return uGt.apply(this,arguments)})().then(_=>{_&&this.register({[jDe]:_})}).catch(X$),this}Vu(e){const n=e;return rA(n.name)&&nf(n.setup)}Gu(e,n){this.Vu(e)?n.push(()=>{this.Zu().add(e).catch(()=>{var o;return(o=e.dispose)===null||o===void 0?void 0:o.call(e)}).catch(o=>{ui.error(`Failed to dispose browser extension "${e.name}"`,o)})}):this.uu.push(e)}zu(){var e,n,o;const i=(e=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:(o=GM.__defaultExtensionClasses)===null||o===void 0?void 0:o.featureFlags;var r,s,a;i&&(this.featureFlags&&this.featureFlags instanceof i||((r=this.Qu)===null||r===void 0||r.call(this),this.Qu=void 0,this.featureFlags=new i(this)),nf(this.featureFlags.onReloading)&&nf(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(s=(a=this.featureFlags).initialize)===null||s===void 0||s.call(a))}Uu(e){const n=performance.now(),o=sn(sn({},GM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,u;o.exceptions&&this.uu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.uu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.uu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.uu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.uu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.Gu(this.autocapture=new o.autocapture(this),i),o.surveys&&this.Gu(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new o.surveys(this),i),o.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new o.logs(this),i),o.metrics&&this.uu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.uu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.uu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.uu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.uu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,AGo)),o.toolbar&&this.uu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.uu.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new o.experiments(this)),this.uu.forEach(g=>{g.initialize&&i.push(()=>{var h;(h=g.initialize)===null||h===void 0||h.call(g)})}),i.push(()=>{if(this.Ju){const g=this.Ju;this.Ju=void 0,this.uu.forEach(h=>{var d;return(d=h.onRemoteConfig)===null||d===void 0?void 0:d.call(h,g)})}}),this.Ku(i,n)}Ku(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,n)},0);const i=e.shift();if(i)try{i()}catch(r){ui.error("Error initializing extension:",r)}}const o=Math.round(performance.now()-n);this.register_for_session({[GHt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[YHt]:o}),this.config.__preview_deferred_init_extensions&&ui.info(`PostHog extensions initialized (${o}ms)`)}il(e){var n;if(!No||!No.body)return ui.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.du=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=Is(i.supportedCompression,lE.GZipJS)?lE.GZipJS:Is(i.supportedCompression,lE.Base64)?lE.Base64:void 0),!((o=i.analytics)===null||o===void 0)&&o.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:VHt}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(e),this.uu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}Wu(){try{this.config.loaded(this)}catch(e){ui.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&fd?.hostname){const e=fd.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new HOt(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qu)===null||e===void 0||e.enable())}_dom_loaded(){this.is_capturing()&&JO(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,n,o,i,r,s;this.$u=!0,(e=this.surveys)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e),(o=this.metrics)===null||o===void 0||o.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(zHt),(i=this.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=this.qu)===null||r===void 0||r.unload(),(s=this.Bu)===null||s===void 0||s.unload()):this.ih()&&this.capture(zHt,null,{transport:"sendBeacon"})}_send_request(e){sGt(this,e)}ju(e,n){this.Bu?this.Bu.retriableRequest(e,n):this._send_request(n?sn(sn({},e),{},{transport:n}):e)}_execute_array(e){UNe++;try{let n;const o=[],i=[],r=[];JO(e,a=>{if(a)if(n=a[0],as(n))r.push(a);else if(nf(a))try{a.call(this)}catch(A){ui.error("Error executing queued PostHog call",a,A)}else as(a)&&n==="alias"?o.push(a):as(a)&&n.indexOf("capture")!==-1&&nf(this[n])?r.push(a):i.push(a)});const s=function(a,A){JO(a,function(c){try{if(as(c[0])){let l=A;Tl(c,function(u){l=l[u[0]].apply(l,u.slice(1))})}else A[c[0]].apply(A,c.slice(1))}catch(l){ui.error("Error executing queued PostHog call",c,l)}})};s(o,this),s(i,this),s(r,this)}finally{UNe--}}push(e){if(UNe>0&&as(e)&&rA(e[0])){const n=GM.prototype[e[0]];return void(nf(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:QHt,persistenceKey:KO,cookieName:"_fbc",pattern:yGt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[KO]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(KO)}}}get sh(){return{property:vHt,persistenceKey:P$,cookieName:"_fbp",pattern:xGt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[P$]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(P$)}}}rh(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return rA(o)&&e.pattern.test(o)?{value:o,delivered:!1}:QA(o)&&rA(o.value)&&e.pattern.test(o.value)?{value:o.value,delivered:o.delivered===!0}:void 0}oh(e,n,o){return n===o?.value?{value:n,pending:!o.delivered}:(e.register(n,!1),{value:n,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.bu())return;const n=k$(e.cookieName);return rA(n)&&e.pattern.test(n)?n:void 0}uh(e,n,o,i){if(!this.persistence)return;const r=this.nh;this.persistence.refreshKey(r.persistenceKey);const s=this.rh(r);if(i)return void r.unregister();if(o)return rA(n)&&yGt.test(n)?this.oh(r,n,s):void r.unregister();const a=rA(e)&&zGo.test(e)?e:void 0,A=this.ah(r);return A&&((c,l,u)=>{const g=c.split(".");if(l)return g[3]===l;if(!u)return!0;const h=u.value.split(".");return g[3]===h[3]||Number(g[2])>Number(h[2])})(A,a,s)?this.oh(r,A,s):a?s?.value.split(".")[3]===a?{value:s.value,pending:!s.delivered}:this.oh(r,`fb.1.${Date.now()}.${a}`,s):s?{value:s.value,pending:!s.delivered}:void 0}hh(e,n,o){if(!this.persistence)return;const i=this.sh;this.persistence.refreshKey(i.persistenceKey);const r=this.rh(i);if(o)return void i.unregister();if(n)return rA(e)&&xGt.test(e)?this.oh(i,e,r):void i.unregister();const s=this.ah(i);return s?this.oh(i,s,r):r?{value:r.value,pending:!r.delivered}:void 0}dh(e,n){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const o=this.rh(e);o?.value!==n||o.delivered||e.register(n,!0)}capture(e,n,o){var i,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void ui.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Bo(e)||!rA(e))return void ui.error("No event name provided to posthog.capture");this.Su();const s=!this.config.opt_out_useragent_filter&&this._is_bot();if(s&&!this.config.__preview_capture_bot_pageviews)return;const a=o?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void ui.critical("This capture call is ignored due to client rate limiting.");let A;n?.$current_url&&!rA(n?.$current_url)&&(ui.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||o?.fh||ui.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(A=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const c=new Date,l=o?.timestamp||c,u=zLt(o?.uuid,TB);let g={uuid:u,event:e,properties:this.calculateEventProperties(e,n||{},l,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),a&&(g.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const h=e==="$feature_flag_called"&&g.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;o?.$set&&!h&&(g.$set=o?.$set);const d=QA(n?.$set)?n.$set:void 0,p=as(n?.$unset)?n.$unset:[],m=o?.$unset||[],_=R=>{var F;const O=!!o?.$set&&R in o.$set;return{hasProvided:O||!!d&&R in d,provided:O?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:p.indexOf(R)!==-1||m.indexOf(R)!==-1}},f=_(QHt),I=_(vHt),C=[{channel:this.nh,hasProvided:f.hasProvided,update:this.uh(A?.fbclid,f.provided,f.hasProvided,f.unset)},{channel:this.sh,hasProvided:I.hasProvided,update:this.hh(I.provided,I.hasProvided,I.unset)}];for(const{channel:R,hasProvided:F,update:O}of C)O&&g.properties.$process_person_profile===!0&&O.pending&&!F&&!h&&(g.$set=sn({[R.property]:O.value},g.$set));const y=o?.$unset;y&&(g.$unset=y);const x=h?void 0:this.ph(o?.$set_once,e!==WHt,e===JHt);if(x&&(g.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,g=(function(R,F){const O=new Set;return(function U(Y,W){if(Y!==Object(Y))return F?F(Y):Y;if(O.has(Y))return;let te;if(O.add(Y),as(Y))te=[],JO(Y,j=>{te.push(U(j))});else{const j={};Tl(GO(Y)?jHt(Y):Y,(J,ie)=>{O.has(J)||(j[ie]=U(J))}),te=j}return te})(R)})(g,R=>rA(R)?R.slice(0,E):R)),g.timestamp=l,Bo(o?.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=c),h&&(g.properties=((R,F=[])=>{const O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return sOo.forEach(U),F.forEach(U),O})(g.properties,JGo)),e===Vb.DISMISSED||e===Vb.SENT){const R=n?.[wNe.SURVEY_ID],F=n?.[wNe.SURVEY_ITERATION];mGt({id:R,current_iteration:F}),g.$set=sn(sn({},g.$set),{},{[RGo({id:R,current_iteration:F},e===Vb.SENT?"responded":"dismissed")]:!0})}else e===Vb.SHOWN&&(g.$set=sn(sn({},g.$set),{},{[wNe.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===fGo.SHOWN){const R=n?.[FOt.TOUR_TYPE];R&&(g.$set=sn(sn({},g.$set),{},{[`${FOt.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},g.properties.$set),g.$set);if(Nx(B)||this.setPersonPropertiesForFlags(B),!Us(this.config.before_send)){const R=this.Os(g);if(!R)return;g=R,g.uuid=zLt(g.uuid,TB)}const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const W=(O=(U=g.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O:QA((Y=g.properties)===null||Y===void 0?void 0:Y.$set)?g.properties.$set[R.property]:void 0;return F?.pending&&W===F.value});this.vu.emit("eventCaptured",g);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:g,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=g.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:g.properties.$session_id+(g.properties.$window_id?`-${g.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:O}of S)this.dh(F,O.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly||S.length){var k;let R;!M.transport&&!M.callback&&Nx((k=this.config.request_headers)!==null&&k!==void 0?k:{})&&this.$u&&(R="sendBeacon"),this.ju(M,R)}else this.qu.enqueue(M);return g}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}getExtension(e){var n;return(n=this.Xu)===null||n===void 0?void 0:n.getExtension(e)}Zu(){var e;return(e=this.Xu)!==null&&e!==void 0?e:this.Xu=new VGo(this)}pu(e){this.Pu.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Pu.indexOf(e);o!==-1&&this.Pu.splice(o,1)}}gh(e=!0){var n,o,i;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((i=this.sessionPersistence)===null||i===void 0||i.clear(),this.Mu.clear(),this.mh()),(o=this.featureFlags)===null||o===void 0||o.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,o,i,r){if(o=o||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gh();const s=r?void 0:this.persistence.remove_event_timer(e);let a=sn({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.bu()&&(a[OHt]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!rA(a.distinct_id)&&!sh(a.distinct_id)||b$(a.distinct_id))&&ui.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const A=(function(f,I,C,y=!1){var x,E,B,S;if(!Wy)return{};const Q=f?[...eG,...I||[]]:[],[w,M]=GLt(Wy),[k,R]=(function(oe){for(let ne=0;ULt.length>ne;ne++){const[ge,ue,_e]=ULt[ne],le=oe.match(ge);if(le){const fe=_e&&oe.match(_e)||le;return[ue,fe?.[1]||""]}}return["",""]})(Wy),F=(function(){const oe="u">typeof navigator?navigator:void 0;return oe?.brave?{brave:!0}:{}})(),O={};Bo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,W=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,te=Ln==null||(B=Ln.screen)===null||B===void 0?void 0:B.width,j=Ln==null||(S=Ln.screen)===null||S===void 0?void 0:S.height,J=Ln?.devicePixelRatio;Bo(Y)||(U.userAgentDataPlatform=Y),Bo(W)||(U.maxTouchPoints=W),Bo(te)||(U.screenWidth=te),Bo(j)||(U.screenHeight=j),Bo(J)||(U.devicePixelRatio=J);const ie=Mu(uNe({$os:w,$os_version:M,$browser:HLt(Wy,navigator.vendor,F,O),$webview_app:k,$webview_app_version:R,$device:YLt(Wy),$device_type:vHo(Wy,U),$timezone:NOt(),$timezone_offset:pGo()}),{$current_url:K$(y?Qw(fd?.href):fd?.href,Q,V$),$host:fd?.host,$pathname:fd?.pathname,$raw_user_agent:Wy.length>1e3?Wy.substring(0,997)+"...":Wy,$browser_version:QHo(Wy,navigator.vendor,F,O),$browser_language:wOt(),$browser_language_prefix:hGo(),$screen_height:Ln?.screen.height,$screen_width:Ln?.screen.width,$viewport_height:Ln?.innerHeight,$viewport_width:Ln?.innerWidth,$lib:Hb.LIB_NAME,$lib_version:Hb.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Hb.SDK_DIST_CHANNEL&&(ie.$sdk_dist_channel=Hb.SDK_DIST_CHANNEL),ie})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:f,windowId:I}=this.sessionManager.checkAndGetSessionAndWindowId(r,o.getTime(),!0);a.$session_id=f,a.$window_id=I}this.sessionPropsManager&&Mu(a,this.sessionPropsManager.getSessionProps());try{var c;this.sessionRecording&&Mu(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(c=this.Bu)===null||c===void 0?void 0:c.length}catch(f){a.$sdk_debug_error_capturing_properties=String(f)}let l;if(this.requestRouter.region===YNe&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||r?e!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(o):this.pageViewManager.doPageView(o,i),a=Mu(a,l),e==="$pageview"&&No&&(a.title=No.title),!Bo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}Wy&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const u=this.persistence.properties(),g=this.sessionPersistence.properties(),h=a.$groups,d=u.$groups;QA(h)&&!Nx(h)&&(a.$groups=sn(sn({},QA(d)?d:{}),h)),Tl(["$referrer","$referring_domain"],f=>{f in u&&delete g[f]});const p={};if(this.Pu.length>0)for(const f of this.Pu.slice())try{Mu(p,f())}catch(I){ui.error("Failed to produce browser extension event properties",I)}a=Mu({},A,u,g,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),as(this.config.property_denylist)?Tl(this.config.property_denylist,function(f){delete a[f]}):ui.error(CGt+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(ui.error(IGt),a=m(a,e));const _=this.yh();return a.$process_person_profile=_,_&&!r&&this.bh("_calculate_event_properties"),a}ph(e,n=!0,o=!1){var i;if(!this.persistence||!this.yh()||this.Iu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=Mu({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(ui.error(IGt),a=A(a,"$set_once")),n&&(this.Iu=!0),Nx(a)?void 0:a}register(e,n){var o;(o=this.persistence)===null||o===void 0||o.register(e,n)}register_once(e,n,o){var i;(i=this.persistence)===null||i===void 0||i.register_once(e,n,o)}register_for_session(e){var n,o;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gh(),(o=this.sessionPersistence)===null||o===void 0||o.register(e),Object.keys(e).forEach(i=>this.Mu.add(i)),this.mh()}unregister(e){var n;(n=this.persistence)===null||n===void 0||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e),this.Mu.delete(e),this.mh()}_h(e,n){this.register({[e]:n})}Hu(){this.Mu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Mu.clear(),this.mh()}mh(){var e;if(!this.Eu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.mi||!nu.Et())return void nu.Lt(this.Eu);const n=[];this.Mu.forEach(o=>n.push(o)),n.length>0?nu.At(this.Eu,n):nu.Lt(this.Eu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.vu.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Z$}),()=>{})}onSessionId(e){var n,o;return(n=(o=this.sessionManager)===null||o===void 0?void 0:o.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n=!1){this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:Z$})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Z$})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=HGo){var o;(o=this.surveys)===null||o===void 0||o.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,o;return(n=(o=this.surveys)===null||o===void 0?void 0:o.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:Z$}}canRenderSurveyAsync(e,n=!1){var o,i;return(o=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurveyAsync(e,n))!==null&&o!==void 0?o:Promise.resolve({visible:!1,disabledReason:Z$})}wh(e){return!e||b$(e)?(ui.critical("Unique user id has not been set in posthog.identify"),!1):e==="$posthog_cookieless"?(ui.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(ui.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.`),!1)}identify(e,n,o){if(!this.__loaded||!this.persistence)return ui.uninitializedWarning("posthog.identify");if(sh(e)&&(e=e.toString(),ui.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(e)||!this.bh("posthog.identify"))return;this.Su();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.gh(!1),a=this.persistence.Da();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(xge),this.register({distinct_id:e}));const u=(this.persistence.get_property("$user_state")||"anonymous")===Yb,g=e!==l,h=!g&&u;if(g&&u){var c;const d=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property($y,Bge),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Ou=GNe(e,n,o)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(h){this.persistence.set_property($y,Bge);const d=n||{},p=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:d,$set_once:p})&&(this.Ou=GNe(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);g||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Mw)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.ja(A)}}setPersonProperties(e,n){if(!e&&!n||!this.bh("posthog.setPersonProperties"))return;const o=GNe(this.get_distinct_id(),e,n);this.Ou!==o?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}})&&(this.Ou=o)):ui.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var n;const o=(as(e)?e:[e]).filter(i=>rA(i)&&i.length>0);o.length!==0&&this.bh("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(o,!0),this.capture("$set",{$unset:o}),this.Ou=null)}group(e,n,o){var i;if(!e||!n)return void ui.error("posthog.group requires a group type and group key");(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.gh();const r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:sn(sn({},r),{},{[e]:n})}),(s||o)&&this.yh()){const a={$group_type:e,$group_key:n};o&&(a.$group_set=o),this.capture(WHt,a)}o&&this.setGroupPropertiesForFlags({[e]:o}),s&&!o&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n=!0){var o;(o=this.featureFlags)===null||o===void 0||o.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n=!0){var o;this.bh("posthog.setGroupPropertiesForFlags")&&((o=this.featureFlags)===null||o===void 0||o.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(e)}reset(e){const n=jy(e)?e:e?.resetDeviceID,o=jy(e)||e==null?void 0:e.bootstrap;this.kh(n,!1,o)}kh(e,n=!1,o){var i,r,s,a,A,c;if(ui.info("reset"),!this.__loaded)return ui.uninitializedWarning("posthog.reset");const l=o?.sessionID;this.config.bootstrap=o||((i=this.Lu)===null||i===void 0?void 0:i.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(s=r.updateConfig)===null||s===void 0||s.call(r,this.config,this.nl());const u=this.get_property(WDe),g=this.get_property(jDe),h=this.get_property(M$);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const d=this.is_capturing();this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const p=(A=this.persistence)===null||A===void 0||(c=A.Da)===null||c===void 0?void 0:c.call(A);let m=!1;try{var _,f,I,C,y,x,E,B,S,Q,w,M,k;if((_=this.persistence)===null||_===void 0||_.clear(),(f=this.sessionPersistence)===null||f===void 0||f.clear(),this.Mu.clear(),this.mh(),Bo(h)||(Q=this.persistence)===null||Q===void 0||Q.register({$session_recording_remote_config:h}),(I=this.surveys)===null||I===void 0||I.reset(),(C=this.featureFlags)===null||C===void 0||C.reset(),(y=this.conversations)===null||y===void 0||y.reset(),(x=this.logs)===null||x===void 0||x.reset(),(E=this.metrics)===null||E===void 0||E.reset(),(B=this.persistence)===null||B===void 0||B.set_property("$user_state","anonymous"),(S=this.sessionManager)===null||S===void 0||S.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ANe,$device_id:null},"");else{const O=this.config.get_device_id(TB());this.register_once({distinct_id:O,$device_id:e?O:u},""),e||Bo(g)||this.register({[jDe]:g})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.bu()&&((k=this.persistence)===null||k===void 0||k.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(w=this.featureFlags)===null||w===void 0||w.initialize(),!Us(l)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(l,!0)))){const O=sn({},o);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,F;p&&((R=this.persistence)===null||R===void 0||(F=R.ja)===null||F===void 0||F.call(R,m))}this.reloadFeatureFlags()}shutdown(e){var n=this;return eg(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.Tu=!0,n.Zu().dispose(),(o=n.sessionRecording)===null||o===void 0||o.dispose(),(i=n.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=n.metrics)===null||r===void 0||r.flush("sendBeacon"),(s=n.metrics)===null||s===void 0||s.dispose(),(a=n.qu)===null||a===void 0||a.unload(),(A=n.Bu)===null||A===void 0||A.unload();try{var u;(u=n.featureFlags)===null||u===void 0||u.destroy()}catch(g){ui.error("Error while destroying feature flags",g)}(c=n.persistence)===null||c===void 0||c.destroy(),(l=n.sessionPersistence)===null||l===void 0||l.destroy()}else ui.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,n){var o;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(o=this.conversations)===null||o===void 0||o.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)===null||e===void 0||e.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:o}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(e?.withTimestamp&&o){var r;const s=(r=e.timestampLookBack)!==null&&r!==void 0?r:10;if(!o)return i;i+=`?t=${Math.max(Math.floor((new Date().getTime()-o)/1e3)-s,0)}`}return i}alias(e,n){return e===this.get_property("$people_distinct_id")?(ui.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Bo(n)&&(n=this.get_distinct_id()),e!==n?(this._h(xge,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(ui.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const n=sn({},this.config);if(QA(e)){var o,i,r,s,a,A,c,l,u,g,h,d,p,m;Mu(this.config,EGt(e));const f=this.xu();(o=this.persistence)===null||o===void 0||o.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new QNe(sn(sn({},this.config),{},{persistence:"sessionStorage"}),f,!1);const I=this.Du(this.config.debug);var _;jy(I)&&(this.config.debug=I),jy(this.config.debug)&&(this.config.debug?(n_.DEBUG=!0,hc.Et()&&hc.At("ph_debug",!0),ui.info("set_config",{config:e,oldConfig:n,newConfig:sn({},this.config)})):(n_.DEBUG=!1,hc.Et()&&hc.Lt("ph_debug"))),(i=this.featureFlags)===null||i===void 0||(r=i.updateConfig)===null||r===void 0||r.call(i,this.config,this.nl()),(s=this.exceptionObserver)===null||s===void 0||s.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(A=this.metrics)===null||A===void 0||A.onConfigChange(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(l=this.tracingHeaders)===null||l===void 0||l.startIfEnabledOrStop(),(u=this.autocapture)===null||u===void 0||u.startIfEnabled(),(g=this.heatmaps)===null||g===void 0||g.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(h=this.exceptionObserver)===null||h===void 0||h.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)===null||d===void 0||d.startIfEnabledOrStop(),(p=this.surveys)===null||p===void 0||p.loadIfEnabled(),this.Cu(),(m=this.externalIntegrations)===null||m===void 0||m.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&COt(this,X$,!1)}}_overrideSDKInfo(e,n){n_.LIB_NAME=e,n_.LIB_VERSION=n}startSessionRecording(e){const n=e===!0,o={sampling:n||!!e?.sampling,linked_flag:n||!!e?.linked_flag,url_trigger:n||!!e?.url_trigger,event_trigger:n||!!e?.event_trigger};var i,r,s,a,A;Object.values(o).some(Boolean)&&((i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),o.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),o.linked_flag&&((s=this.sessionRecording)===null||s===void 0||s.overrideLinkedFlag()),o.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),o.event_trigger&&((A=this.sessionRecording)===null||A===void 0||A.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===void 0)&&e.started)}captureException(e,n){try{if(!this.exceptions)return;const o=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(sn(sn({},o),n))}catch{return}}addExceptionStep(e,n){var o;(o=this.exceptions)===null||o===void 0||o.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)===null||n===void 0||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&e!==void 0?e:GM.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,o;return(n=(o=this.toolbar)===null||o===void 0?void 0:o.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[e]}toString(){var e;let n=(e=this.config.name)!==null&&e!==void 0?e:eq;return n!==eq&&(n="posthog."+n),n}_isIdentified(){var e,n;return((e=this.persistence)===null||e===void 0?void 0:e.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}yh(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Nx(this.getGroups())&&!(!((e=this.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return this.config.person_profiles==="never"?(ui.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(aNe,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}Cu(){var e,n;const o=this.xu();var i,r,s;return this.is_capturing()||(i=this.logs)===null||i===void 0||i.$h(),((e=this.persistence)===null||e===void 0?void 0:e.mi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.mi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),o&&(this.Mu.clear(),this.mh()),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.bu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new cGt(this),this.pageViewManager=new EOt(this),this.persistence&&(this.sessionPropsManager=new aGt(this,this.sessionManager,this.persistence));const h=(s=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&s!==void 0?s:(A=GM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.yu(this.sessionRecording,new h(this)),this.du&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.du)))}var u,g;this.consent.optInOut(!0),this.Cu(),this.Yu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((u=this.surveys)===null||u===void 0||u.loadIfEnabled()),(Bo(e?.captureEventName)||e?.captureEventName)&&this.capture((g=e?.captureEventName)!==null&&g!==void 0?g:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else ui.warn(fGt)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void ui.warn(fGt);const e=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var n,o;e?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ANe,$device_id:null}),this.mu(e),this.sessionRecording=void 0,(n=this.sessionManager)===null||n===void 0||n.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Cu()}_is_bot(){return tf?lGt(tf,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(lNe,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(T$,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),Cl(No,T$,this.Au)))}debug(e){e===!1?(Ln?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ln?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}nl(){const e=this.Lu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(ui.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,o,i,r,s){const a=o in n&&!Us(n[o]),A=i in n&&!Us(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,ui)}Os(e){var n;if(Us(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(mHo),i=as(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=e;for(const s of i)try{if(r=s(r),Us(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return pHo(e.event)?ui.warn(`${a}. This can cause unexpected behavior.`):ui.info(a),null}r.properties&&!Nx(r.properties)||ui.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return ui.error(`Error in beforeSend function for event '${e.event}':`,a),null}for(const s of o)if(r.properties&&Us(r.properties[s]))return ui.warn(`Event '${e.event}' had its '${s}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var e;return(e=this.pageViewManager.Vo)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Du(e){const n=jy(e)&&!e,o=hc.Et()&&hc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};tq.__defaultExtensionClasses={},tq.Ch=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(let n=0;e.length>n;n++)t.prototype[e[n]]=VOo(t.prototype[e[n]])})(tq,["identify"]);var BGt=class{constructor(t){this.disabled=t===!1;const e=QA(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,n){if(this.disabled)return!1;const o=this.clicks[this.clicks.length-1];if(o&&Math.abs(t-o.x)+Math.abs(e-o.y)<this.thresholdPx&&this.timeoutMs>n-o.timestamp){if(this.clicks.push({x:t,y:e,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:n}];return!1}};const VNe="$copy_autocapture",zNe=Cd("[AutoCapture]");function JNe(t,e){return e.length>t?e.slice(0,t)+"...":e}function qGo(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!g6(e));return e}function XGo(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!g6(t))return{props:{}};const c=[t],l=new Set([t]);let u=t;for(;u.parentNode&&!AI(u,"body")&&1e3>c.length;){if(INe(u.parentNode)){const x=u.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),u=x;continue}if(!g6(u.parentNode)||l.has(u.parentNode))break;l.add(u.parentNode),c.push(u.parentNode),u=u.parentNode}const g=e.type==="click"&&t.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(x=>AI(x,"button")||AI(x,"a")):-1;g>0&&(o=o||c.slice(0,g+1).some(x=>!qO(x)||O$(x)));const h=[],d={};let p,m=!1,_=!1;if(Tl(c,x=>{const E=qO(x);if(AI(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&G$(B))&&(s?Qw(B):B)}Is($O(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,w,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};yNe.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?JNe(1024,mOt(B)):JNe(1024,L$(B)));const F=$O(B);S||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(W){return W!==""})),Tl(B.attributes,function(W){var te;if((!O$(B)||["name","id","class","aria-label"].indexOf(W.name)!==-1)&&!w?.includes(W.name)&&!S&&G$(W.value)&&(!rA(te=W.name)||te.substring(0,10)!=="_ngcontent"&&te.substring(0,7)!=="_nghost")){let j=W.value;W.name==="class"&&(j=CNe(j).join(" ")),R["attr__"+W.name]=JNe(1024,W.name==="href"&&M?Qw(j):j)}});let O=1,U=1,Y=B;for(;Y=qGo(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),Tl((function(B){if(!qO(B))return{};const S={};return Tl(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&G$(M)&&(S[w]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(g>0&&(t=c[g],h.splice(0,g)),o||(h[0].$el_text=AI(t,"a")||AI(t,"button")?mOt(t):L$(t)),m){var f,I;h[0].attr__href=m;const x=(f=Ub(m))===null||f===void 0?void 0:f.host,E=Ln==null||(I=Ln.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:Mu((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,as(C)?(function(x){return x.map(E=>{var B,S;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const k of E.attr_class)Q+=`.${k.replace(/"/g,"")}`}const w=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(S=E.nth_of_type)!==null&&S!==void 0?S:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return Sge(w).sort(([k],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(k,R)).forEach(([k,R])=>M[fOt(k.toString())]=fOt(R.toString())),Q+=":",Q+=Sge(M).map(([k,R])=>`${k}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,S;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(S=E.attr__href)===null||S===void 0?void 0:S.slice(0,2048),attr_class:sGo(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return Sge(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},p&&e.type==="click"?{$external_click_url:p}:{},d),target:t};var C,y}var ZGo=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(t){var e;if(!qO(t))return!0;const n=(e=this.bo().css_selector_ignorelist)!==null&&e!==void 0?e:BNe,o=new Set;let i=t;for(;i;){if(o.size>=1e3||o.has(i))return!0;o.add(i);const r=i,s=$O(r);if(Is(s,"ph-no-capture")||Is(s,"ph-sensitive")||O$(r)||n.some(A=>xNe(r,A)))return!0;const a=i.parentNode;i=INe(a)?a.host:a&&g6(a)?a:null}return!1}_o(t){if(!this.isEnabled||t.type==="pointercancel")return void this.fo();if(t.type==="pointerdown"){this.fo();const o=H$(t);var e;return void(t.isPrimary&&t.button===0&&!t.ctrlKey&&o&&g6(o)&&(this.po={target:o,excluded:this.yo(o),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:(e=this.wo)===null||e===void 0?void 0:e.distinctId}))}const n=this.po;n&&(t.pointerId!==n.id||Math.abs(t.clientX-n.x)>5||Math.abs(t.clientY-n.y)>5?this.fo():t.type==="pointerup"&&(n.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(t){var e;const n=this.po;this.fo();const o=H$(t);if(n?.released&&n.target.isConnected&&n.distinctId===((e=this.wo)===null||e===void 0?void 0:e.distinctId)&&t.pointerId===n.id&&(t.detail>0||t.pointerType==="touch"||t.pointerType==="pen")&&t.button===0&&5>=Math.abs(t.clientX-n.x)&&5>=Math.abs(t.clientY-n.y)&&o&&(AI(o,"html")||AI(o,"body"))){var i;if(n.excluded)return null;const r=(i=this.bo().css_selector_ignorelist)!==null&&i!==void 0?i:BNe;return[o,No?.documentElement,No?.body].some(s=>{if(!s)return!1;const a=$O(s);return Is(a,"ph-no-capture")||Is(a,"ph-sensitive")||!qO(s)||O$(s)||r.some(A=>xNe(s,A))})?null:n.target}}constructor(t){this.So=t,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new BGt(this.Rr.rageclick),this.Mo=null}setup(t){this.Eo(),this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?e.dispose():(this.Po=e,this.startIfEnabled())}dispose(){var t;this.Io||(this.Io=!0,this.wo=void 0,(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var t,e;return this.bo(),this.Rr.url_allowlist=(t=this.Rr.url_allowlist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),this.Rr.url_ignorelist=(e=this.Rr.url_ignorelist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),this.Rr}Ao(){if(!this.isBrowserSupported())return void zNe.info("Disabling Automatic Event Collection because this browser is not supported");if(!Ln||!No)return;const t=this.Fo=e=>{e=e||Ln?.event;try{if(e.type==="blur")return void this.fo();if(e.type.indexOf("pointer")===0)return void this._o(e);const n=e.type==="click"?this.ko(e):void 0;if(Id(n))return;this.Oo(e,"$autocapture",n)}catch(n){zNe.error("Failed to capture event",n)}};if(Cl(Ln,"blur",t),Cl(No,"submit",t,{capture:!0}),Cl(No,"change",t,{capture:!0}),Cl(No,"click",t,{capture:!0}),Tl(["pointerdown","pointermove","pointerup","pointercancel"],e=>{Cl(No,e,t,{capture:!0})}),this.bo().capture_copied_text){const e=this.Do=n=>{n=n||Ln?.event;try{this.Oo(n,VNe)}catch(o){zNe.error("Failed to capture clipboard event",o)}};Cl(No,"copy",e,{capture:!0}),Cl(No,"cut",e,{capture:!0}),Cl(No,"paste",e,{capture:!0})}}Ro(){this.fo(),this.Fo&&(Ln?.removeEventListener("blur",this.Fo),Tl(["pointerdown","pointermove","pointerup","pointercancel"],t=>{No?.removeEventListener(t,this.Fo,!0)}),No?.removeEventListener("submit",this.Fo,!0),No?.removeEventListener("change",this.Fo,!0),No?.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(No?.removeEventListener("copy",this.Do,!0),No?.removeEventListener("cut",this.Do,!0),No?.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(t){if(this.Io)return;if(this.$o=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.To=e.elementsChainAsString);const n=e.autocapture_opt_out;var o;jy(n)&&((o=this.wo)===null||o===void 0||o.kv.set("$autocapture_disabled_server_side",n),this.Co=n),this.startIfEnabled()}setElementSelectors(t){this.Mo=t}getElementSelectors(t,e){var n;const o=[];return(n=this.Mo)===null||n===void 0||n.forEach(i=>{const r=No?.querySelectorAll(i);r?.forEach(s=>{t!==s&&e!==s||Is(o,i)||o.push(i)})}),o}get isEnabled(){var t,e;if(this.Io)return!1;const n=(t=this.wo)===null||t===void 0?void 0:t.kv.get(wHt),o=this.Co,i=this.bo();if(!i.remoteRequestsDisabled&&!this.$o)return!1;const r=i.remoteRequestsDisabled&&!this.$o;if(Id(o)&&!jy(n)&&!r)return!1;const s=(e=this.Co)!==null&&e!==void 0?e:!!n;return!!i.enabled&&!s}Oo(t,e="$autocapture",n){if(!this.isEnabled)return void this.fo();let o=n||H$(t);oOt(o)&&(o=o.parentNode||null);const i=this.Eo();var r;e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&i.rageclick&&(!((r=this.rageclicks)===null||r===void 0)&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime()))&&lOt(o,i.rageclick)&&this.Oo(t,"$rageclick",n);const s=e===VNe,a=s?sn(sn({},i),{},{dom_event_allowlist:void 0}):i;if(o&&(function(u,g,h,d,p,m){var _;if(!Ln||bNe(u)||h?.url_allowlist&&!iOt(h.url_allowlist,m)||h?.url_ignorelist&&iOt(h.url_ignorelist,m))return!1;if(h?.dom_event_allowlist){const y=h.dom_event_allowlist;if(y&&!y.some(x=>g.type===x))return!1}const{parentIsUsefulElement:f,targetElementList:I}=uOt(u,d);if(!(function(y,x){const E=x?.element_allowlist;if(Bo(E))return!0;for(const B of y)if(E.some(S=>B.tagName.toLowerCase()===S))return!0;return!1})(I,h)||!ENe(I,h?.css_selector_allowlist)||ENe(I,(_=h?.css_selector_ignorelist)!==null&&_!==void 0?_:BNe))return!1;try{const y=Ln.getComputedStyle(u);if(y&&y.getPropertyValue("cursor")==="pointer"&&g.type==="click")return!0}catch{}const C=u.tagName.toLowerCase();switch(C){case"html":return!1;case"form":return(p||["submit"]).indexOf(g.type)>=0;case"input":case"select":case"textarea":return(p||["change","click"]).indexOf(g.type)>=0;default:return f?(p||["click"]).indexOf(g.type)>=0:(p||["click"]).indexOf(g.type)>=0&&(yNe.indexOf(C)>-1||u.getAttribute("contenteditable")==="true")}})(o,t,a,s,s?["copy","cut","paste"]:void 0,{config:{get_current_url:i.getCurrentUrl}})){var A;const{props:u,explicitNoCapture:g,target:h}=XGo(o,{e:t,maskAllElementAttributes:i.maskAllElementAttributes,maskAllText:i.maskAllText,elementAttributeIgnoreList:i.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:i.disableCaptureUrlHashes});if(g)return!1;const d=this.getElementSelectors(o,h);if(d&&d.length>0&&(u.$element_selectors=d),e===VNe){const p=t.type||"clipboard";if(p!=="paste"){var c,l;const m=Ln==null||(c=Ln.getSelection())===null||c===void 0?void 0:c.toString(),_=rOt(m);if(!_)return!1;u.$selected_content=_,u.$clipboard_text_length=(l=m?.length)!==null&&l!==void 0?l:0}u.$copy_type=p}return(A=this.wo)===null||A===void 0||A.capture(e,u),!0}}isBrowserSupported(){return nf(No?.querySelectorAll)}},eYo=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=QA(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const nq=Cd("[ExceptionAutocapture]"),bGt=()=>{},SGt=t=>{var e;if(nf(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function oq(t,e,n){try{if(!(e in t))return bGt;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return nf(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),t[e]=i,()=>{if(t[e]===i)return void(t[e]=o.next);let r=t[e],s=SGt(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=SGt(r)}}}catch{return bGt}}const tYo=Cd("[TracingHeaders]"),ER=Cd("[Web Vitals]"),QGt=9e5,vGt=["CLS","FCP","INP","LCP"],nYo=["INP","LCP"],oYo=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],WNe="disabled",wGt="lazy_loading",Jb=Cd("[SessionRecording]"),iYo=Cd("[Heatmaps]");function jNe(t){return QA(t)&&"clientX"in t&&"clientY"in t&&sh(t.clientX)&&sh(t.clientY)}const Hge=Cd("[Product Tours]"),$Ne=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(nNe))},rYo=["$set_once","$set"],d6=Cd("[SiteApps]"),PGt="Error while initializing PostHog app with config id ",MGt=(t,e)=>t?.then?t.then(e):e(t),rG="SDK is not enabled or survey functionality is not yet loaded",DGt="Disabled. Not loading surveys.";var sYo=class{constructor(e,n){this.So=e,this.Th=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=o=>{if(this.Io||this.Rr.disableSurveys)return;if(!o.ok)return kl.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Us(i))return kl.warn("Flags not loaded yet. Not loading surveys.");this.Ah=jy(i)?i:i.length>0,kl.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,MGt(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.Io?n.dispose():(this.Po=n,this.loadIfEnabled())})}dispose(){var e,n,o,i;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(r=>clearTimeout(r)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;const e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void kl.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void kl.info(DGt);if(e.cookielessMode&&this.So.isOptedOut())return void kl.info("Not loading surveys in cookieless mode without consent.");const n=this.So.getExtensions();if(!n)return void kl.error("PostHog Extensions not found.");if(Bo(this.Ah)&&!e.advancedEnableSurveys)return;const o=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{const i=n.generateSurveys;if(i)return this.Oh(i,o),void(this.Ih=!1);const r=n.loadExternalDependency;if(!r)return this.Dh(cNe),void(this.Ih=!1);r(s=>{try{if(this.Io)return;const a=this.So.getExtensions();s||!a?.generateSurveys?this.Dh("Could not load surveys script",s):this.Oh(a.generateSurveys,o)}finally{this.Ih=!1}})}catch(i){throw this.Ih=!1,this.Dh("Error initializing surveys",i),i}}Oh(e,n){this.Io||(this._surveyManager=e(n),this._surveyEventReceiver=this.So.createEventReceiver(),kl.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,n){kl.error(e,n),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.wo)!==null&&o!==void 0?o:this.Th;if(!i||this.Io)return;if(this.Rr.disableSurveys)return kl.info(DGt),e([]);const r=i.kv.get(iNe);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:A,context:c})=>{this.Io||e(A,c)}).catch(A=>kl.error("Error in survey callback",A));const s=this.qh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(A=>{try{return this.jh(i,A)}catch(c){return kl.error("Error processing surveys response",c),this.jh(i,{statusCode:0,error:c})}},A=>this.jh(i,{statusCode:0,error:A}));this.Eh=s;const a=()=>{this.Eh===s&&(this.Eh=null)};s.then(A=>{a(),this.Io||e(A.surveys,A.context)},a).catch(A=>kl.error("Error in survey callback",A))}qh(e,n){const o=this.wo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(rG)}))}jh(e,n){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:rG}};const o=n.statusCode;if(o!==200||!n.json){const a=`Surveys API could not be loaded, status: ${o}`;return o!==0?kl.error(a):n.error||kl.warn(a),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Ph=null;const i=n.json.surveys||[],r=i.filter(a=>(function(A){return!(!A.start_date||A.end_date)})(a)&&(gGt(a)||(function(A){var c;return!!(!((c=A.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0)&&c.length)})(a)));var s;return r.length>0&&((s=this._surveyEventReceiver)===null||s===void 0||s.register(r)),e.kv.set({[iNe]:i,[Ege]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,n;const o=(e=(n=this.wo)!==null&&n!==void 0?n:this.Th)===null||e===void 0?void 0:e.kv.get(Ege);return sh(o)&&Date.now()-o>3e5}Hh(){return sh(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};mGt(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(e){for(const n of this.Mh)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){kl.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Us(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);kl.warn("init was not called")}zh(e){let n=null;return this.getSurveys(o=>{var i;n=(i=o.find(r=>r.id===e))!==null&&i!==void 0?i:null}),n}Uh(e){if(Us(this._surveyManager))return{eligible:!1,reason:rG};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Us(this._surveyManager))return{eligible:!1,reason:rG};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Us(this._surveyManager))return kl.warn("init was not called"),{visible:!1,disabledReason:rG};const n=this.Wh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Us(this._surveyManager)?(kl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:rG})):new Promise(o=>{this.getSurveys(i=>{var r;const s=(r=i.find(a=>a.id===e))!==null&&r!==void 0?r:null;if(s){const a=this.Wh(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.So.isCapturing())return;if(Us(this._surveyManager))return void kl.warn("init was not called");const r=typeof e=="string"?this.zh(e):e;if(!r?.id)return void kl.warn("Survey not found");if(!LGo.includes(r.type))return void kl.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const s=No?.querySelector(n);if(s){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){kl.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Rh.delete(a),!this.Io&&this.So.isCapturing()&&(kl.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),kl.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else kl.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.So.isCapturing())return;if(Us(this._surveyManager))return void kl.warn("init was not called");const i=this.zh(e);if(!i)return void kl.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=sn(sn({},i),{},{appearance:sn(sn({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==PNe.Popover&&n.initialResponses&&kl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Uh(i);if(!s.eligible)return void kl.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==PNe.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Us(this._surveyManager)?kl.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function sG(t,e,n){if(Us(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var aYo=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new kge,this.Qh=(n,o)=>this.Jh(n,o)&&this.Kh(n,o)&&this.Xh(n,o)&&this.Yh(n,o),this.Jh=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Bo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.tc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e;(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,this.Zh=new kge}register(e){var n,o;if(!Bo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.Vh.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.Gh.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.Vh.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(n.event))&&this.Vh.forEach(o=>{this.ec(n,o)&&this.Zh.emit("actionCaptured",o.name)})}nc(e){this.onAction("actionCaptured",n=>e(n))}ec(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.Qh(e,o))return!0;return!1}onAction(e,n){return this.Zh.on(e,n)}Kh(e,n){if(n?.url){var o;const i=e==null||(o=e.properties)===null||o===void 0?void 0:o.$current_url;if(!i||typeof i!="string"||!sG(i,n.url,n.url_matching||"contains"))return!1}return!0}Xh(e,n){return!!this.sc(e,n)&&!!this.rc(e,n)&&!!this.oc(e,n)}sc(e,n){var o;if(!n?.href)return!0;const i=this.ac(e);if(i.length>0)return i.some(s=>sG(s.href,n.href,n.href_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&sG((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}rc(e,n){var o;if(!n?.text)return!0;const i=this.ac(e);if(i.length>0)return i.some(c=>sG(c.text,n.text,n.text_matching||"exact")||sG(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],u=/(?::|")text="(.*?)"/g;let g;for(;!Us(g=u.exec(c));)l.includes(g[1])||l.push(g[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>sG(c,a,A)));var s,a,A}oc(e,n){var o,i;if(!n?.selector)return!0;const r=e==null||(o=e.properties)===null||o===void 0?void 0:o.$element_selectors;if(r?.includes(n.selector))return!0;const s=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(n.selector_regex&&s)try{return new RegExp(n.selector_regex).test(s)}catch{return!1}return!1}ac(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}Yh(e,n){return!n?.properties||n.properties.length===0||hGt(n.properties.reduce((o,i)=>{const r=as(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return o[i.key]={values:r,operator:i.operator||"exact"},o},{}),e?.properties)}},AYo=class{constructor(e){var n,o;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(n=this._instance)===null||n===void 0||(o=n.onSessionId)===null||o===void 0?void 0:o.call(n,i=>this.vc(i))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,n){return!!e&&hGt(e.propertyFilters,n?.properties)}_c(e,n){const o=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[n])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(s=>{if(s?.name){const a=o.get(s.name)||[];a.push(i.id),o.set(s.name,a)}})}),o}wc(e,n,o){const i=(o===z$.Activation?this.uc:this.hc).get(e);let r=[];return this.kc(s=>{r=s.filter(a=>i?.includes(a.id))}),r.filter(s=>{var a;const A=(a=s.conditions)===null||a===void 0||(a=a[o])===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.find(c=>c.name===e);return this.bc(A,n)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,n){var o;Bo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.xc(e,n),this.Cc(e,n))}Cc(e,n){const o=e.filter(s=>{var a;return(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.length});var i;if(n&&this.cc.clear(),o.length===0)return void(n&&((i=this.$c)===null||i===void 0||i.replace([])));this.$c||(this.$c=new aYo(this._instance),this.$c.init(),this.$c.nc(s=>this.onAction(s)));const r=[];o.forEach(s=>{var a;(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||a.values.forEach(A=>{if(r.push(A),A.name){var c;const l=(c=this.cc.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this.cc.set(A.name,l)}})}),n?this.$c.replace(r):this.$c.register(r)}Tc(e,n){n.forEach((o,i)=>{var r;const s=(r=e.get(i))!==null&&r!==void 0?r:[];o.forEach(a=>{s.includes(a)||s.push(a)}),e.set(i,s)})}xc(e,n){var o,i;const r=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((u=c.conditions)===null||u===void 0||(u=u.events)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),s=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((u=c.conditions)===null||u===void 0||(u=u.cancelEvents)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),a=this._c(e,z$.Activation),A=this._c(e,z$.Cancellation);n?(this.uc=a,this.hc=A):(this.Tc(this.uc,a),this.Tc(this.hc,A)),(r.length!==0||s.length!==0)&&((o=this.tc)!==null&&o!==void 0||(this.tc=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,n){var o,i;const r=this.Ic(),s=(n==null||(o=n.properties)===null||o===void 0?void 0:o.$survey_id)||(n==null||(i=n.properties)===null||i===void 0?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){const A=this.Mc(e,s);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.Ec([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.Pc(s),void this.Rc([s])}if(this.hc.has(e)){const A=this.wc(e,n,z$.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.Ec(A.map(c=>c.id)),A.forEach(c=>this.Ac(c.id)))}if(!this.uc.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this.uc.get(e)});const a=this.wc(e,n,z$.Activation);this.Fc(a.map(A=>A.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var n,o;if(e.length===0)return;const i=!!(!((n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0)&&o.call(n)),r=[];for(const s of e)i&&this.fc(s)?this.Pc(s)&&this.Oc(s):r.push(s);r.length>0&&(this.lc=[...new Set([...this.lc,...r])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(o=>o!==e);const n=this.Dc();return!n.includes(e)&&(this.Lc([...n,e]),this.Nc(),!0)}Ec(e){const n=new Set(e);this.lc=this.lc.filter(r=>!n.has(r));const o=this.qc(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Lc(i),i.length===0&&this.jc()),this.Rc(e)}Bc(){var e;const n=this.gc();if(!n)return{};const o=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n];return o&&typeof o=="object"?o:{}}Oc(e){if(!this.gc())return;const n=this.Bc();this.mc(sn(sn({},n),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;const n=this.Bc(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(Nx(o)?this.yc():this.mc(o))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;const n=this.Bc()[e];return sh(n)?n:void 0}qc(){var e;const n=this.zc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Dc(){var e,n,o;const i=this.qc();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Uc()],s=(n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0?void 0:o.call(n);return s&&r===s?i:[]}Nc(){var e,n;const o=(e=this._instance)===null||e===void 0||(n=e.get_session_id)===null||n===void 0?void 0:n.call(e);o&&this.Wc(o)}jc(){this.Vc()}vc(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.Uc()];if(o&&o!==e){const i=this.qc(),r=this.Bc();i.length>0&&(this.Lc([]),i.filter(s=>sh(r[s])).forEach(s=>this.Ac(s))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,n,o;(e=this.dc)===null||e===void 0||e.call(this),this.dc=void 0,(n=this.tc)===null||n===void 0||n.call(this),this.tc=void 0,(o=this.$c)===null||o===void 0||o.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},cYo=class extends AYo{constructor(t){super(t)}zc(){return THt}Uc(){return kHt}gc(){return FHt}mc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated_timestamps:t})}yc(){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.unregister("$surveys_activated_timestamps")}fc(t){var e;let n;this.kc(i=>{n=i.find(r=>r.id===t)});const o=n==null||(e=n.appearance)===null||e===void 0?void 0:e.surveyPopupDelaySeconds;return sh(o)&&o>0}Qc(){return Vb.SHOWN}kc(t){var e;(e=this._instance)===null||e===void 0||e.getSurveys(t)}Ac(t){var e;(e=this._instance)===null||e===void 0||e.cancelPendingSurvey(t)}Ic(){return kl}Lc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated:t})}Wc(t){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.register({$surveys_activated_session:t})}Vc(){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.unregister("$surveys_activated_session")}Gc(){return!1}Mc(t,e){let n;return this.kc(o=>{n=o.find(i=>i.id===e)}),!n||(function(o){var i;return gGt(o)&&!!(!((i=o.conditions)===null||i===void 0||(i=i.events)===null||i===void 0)&&i.repeatedActivation)||o.schedule==="always"})(n)?t===Vb.SHOWN?"consume":"ignore":t===Vb.SHOWN?"persist":t===Vb.DISMISSED||t===Vb.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},lYo=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Bo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},uYo=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Vr?.__PosthogExtensions__;if(!e)return;const{generateSurveys:n,loadExternalDependency:o}=e;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:o?i=>o(this._instance,"surveys",i):void 0}}createEventReceiver(){return new cYo(this._instance)}};const gYo=Ln?.location?wge(Ln.location.hash,"__posthog")||wge(location.hash,"state"):null,NGt="_postHogToolbarParams",RGt=Cd("[Toolbar]"),TGt=Cd("[FeatureFlags]");var dYo=class{constructor(e,n=!1){this.Jc=!1,this.update(e,n)}update(e,n){this.Kc=((o,i)=>{var r,s,a,A,c,l,u,g;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Bo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(u=(g=o.evaluation_contexts)!==null&&g!==void 0?g:o.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:as(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(TGt.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),Bo(e.flag_keys)||as(e.flag_keys)||TGt.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const kGt=Cd("[FeatureFlags]"),BR=Cd("[FeatureFlags]",{debugEnabled:!0}),qNe=`" failed. Feature flags didn't load in time.`,hYo=[502,504],FGt=["click","keydown","wheel","touchstart","pointerdown"],LGt="connection_error",HGt=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},OGt=t=>{const e={};for(const[n,o]of Sge(t||{}))o&&(e[n]=o);return e},GGt=t=>GO(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),kB=Cd("[Error tracking]"),XNe="webkit-masked-url:",pYo=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],mYo=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",XNe],_Yo=["__firefox__","__gCrWeb"],YGt="Refusing to render web experiment since the viewer is a likely bot",fYo={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>Fge(e,t),not_regex:(t,e)=>!Fge(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},r4=Cd("[Conversations]"),bR="Conversations not available yet.";function UGt(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,u=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,g=Bo(u)?Math.max(l,2048):Math.max(l,u),h=sn(sn({},(function(){let d="",p="";try{const m=tf?.userAgent;m&&([d,p]=GLt(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(mHt,I)?mHt[I]:I})(m);return sn(sn({},f?{"os.name":f}:{}),_?{"os.version":_}:{})})(d,p)})()),t?.resourceAttributes);return{serviceName:(r=(s=h?.["service.name"])!==null&&s!==void 0?s:t?.serviceName)!==null&&r!==void 0?r:e?.serviceNameDefault,serviceVersion:(a=h?.["service.version"])!==null&&a!==void 0?a:t?.serviceVersion,environment:(A=h?.["deployment.environment"])!==null&&A!==void 0?A:t?.environment,resourceAttributes:h,beforeSend:t?.beforeSend,flushIntervalMs:c,maxBufferSize:l,maxQueueSize:g,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:u,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const IYo=["debug","log","warn","error","info"],CYo=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},KGt="console",VGt="__posthogHandledLogsRequestError",ZNe=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[VGt]=!0,n},zGt=t=>!!t&&typeof t=="object"&&t[VGt]===!0,Oge=Cd("[NetworkMetrics]"),eRe=()=>{var t;return!(Ln==null||(t=Ln.performance)===null||t===void 0)&&t.now?Ln.performance.now():Date.now()},yYo={"http:":80,"https:":443},xYo=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),JGt=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=Ub(o))===null||n===void 0?void 0:n.href)||o}},tRe=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,u=eRe()-o,g=Ub(e.url);if(g&&g.protocol!=="http:"&&g.protocol!=="https:")return;const h={url:g?.href||e.url,method:e.method},d=nf(c.name)?c.name(h):rA(c.name)?c.name:"http.client.request.duration";if(!d)return;const p=s&&!l?void 0:((_,f)=>_?400>_?void 0:String(_):f?.name||"_OTHER")(l,r),m=sn(sn(sn(sn(sn({},(_=>{const f=xYo.has(_)?_:"_OTHER";return sn({"http.request.method":f},f==="_OTHER"&&_!==f?{"http.request.method_original":_}:{})})(h.method)),g?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||yYo[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(f=_.pathname,f.split("/").map(I=>(C=>/^\d+$/.test(C)||C.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(C))(I)?":id":I).join("/"))};var f})(g):{}),l?{"http.response.status_code":l}:{}),p?{"error.type":p}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,h,{status:l,durationMs:u}));(A=t.metrics)===null||A===void 0||A.histogram(d,u,{unit:"ms",attributes:m})}catch(c){Oge.error("Failed to record network metric",c)}},WGt=()=>{},EYo=(t,e)=>nf(Ln?.fetch)?oq(Ln,"fetch",n=>function(...o){const i=eRe(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,u=JGt((s=(a=l?.method)!==null&&a!==void 0?a:c?.method)!==null&&s!==void 0?s:"GET",(A=c?.url)!==null&&A!==void 0?A:c);return r.then(g=>(tRe(t,u,g?.status,i,e,void 0,!0),g),g=>{throw tRe(t,u,void 0,i,e,g),g})}catch(c){return Oge.error("Failed to observe fetch",c),r}}):WGt,BYo=(t,e)=>{var n;const o=Ln==null||(n=Ln.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return WGt;const i=new WeakMap,r=oq(o,"open",a=>function(...A){try{jOt.has(this)||i.set(this,JGt(A[0],A[1]))}catch(c){Oge.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=oq(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const u=eRe();c=()=>{this.removeEventListener("loadend",c),tRe(t,l,this.status,u,e)},Cl(this,"loadend",c)}}catch(l){Oge.error("Failed to observe XHR send",l)}try{return a.apply(this,A)}catch(l){throw c&&this.removeEventListener("loadend",c),l}});return()=>{r(),s()}},Gge={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=kGt,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const e=this.vd();this.hd=0,e&&this.reloadFeatureFlags()},this.fd=()=>{var e,n;const o=this.pd,i=(e=this.gd)!==null&&e!==void 0?e:o;Bo(o)||Bo(i)||this.Rr.remoteRequestsDisabled||!No||No.visibilityState==="hidden"||Date.now()-((n=this.md)!==null&&n!==void 0?n:0)<i||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?o:Math.min(2*i,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{No?.visibilityState==="visible"&&this._d()},"get"in t?this.So=t:(this._instance=t,this.wd=new dYo(t.config,t.nl()),this.So=this.wd)}updateConfig(t,e){var n;(n=this.wd)===null||n===void 0||n.update(t,e),this.wo&&this.kd()}setup(t){return this.Fh=t,this.$=t.logger.createLogger("[FeatureFlags]"),MGt(t.kv.initialize(),()=>{this.Fh===t&&(this.Fh=void 0,this.wo=t,this.Sd(t))})}Sd(t){var e;if(this.wo===t)return Ln&&Cl(Ln,"online",this.an),this.kd(),this.xd=t.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const t=this.Rr.refreshIntervalMs,e=!this.Rr.remoteRequestsDisabled&&No&&!Bo(t)&&t>0?t:void 0;this.Rr.idleRefreshBackoff||(this.gd=e),e!==this.pd&&(this.Ed(),Bo(e)||(this.pd=e,this.gd=e,this.yd(),No?.addEventListener&&(Cl(No,T$,this.ln),JO(FGt,n=>{Cl(No,n,this.bd,{capture:!0})}))))}yd(){Bo(this.pd)||(Bo(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var t;Bo(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,No==null||(t=No.removeEventListener)===null||t===void 0||t.call(No,"visibilitychange",this.ln),JO(FGt,e=>{var n;No==null||(n=No.removeEventListener)===null||n===void 0||n.call(No,e,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var t,e;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(t=this.xd)===null||t===void 0||t.dispose(),this.xd=void 0,(e=this.$d)===null||e===void 0||e.call(this),this.$d=void 0,this.ed=[],Ln?.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(t){var e;return this.Od&&t in this.Od?this.Od[t]:(e=this.wo)===null||e===void 0?void 0:e.kv.get(t)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var t;return!Bo((t=this.wo)===null||t===void 0?void 0:t.kv.get("$enabled_feature_flags"))&&this.Td()}At(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.set(t)})}Nd(t,e,n){var o;if(!(!((o=this._instance)===null||o===void 0)&&o.persistence)||!t.$enabled_feature_flags)return;const i=this.Fd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},s=e.flags||e.featureFlags,a=e.flags?Object.entries(e.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],A=!!e.errorsWhileComputingFlags&&!!e.flags,c=A?a:n&&!as(s)?Object.keys(s||{}):Array.from(new Set([...Object.keys(i),...Object.keys(r)])),l=this.Fd("$feature_flag_payloads")||{},u=t.$feature_flag_payloads||{},g=A||n?c:Array.from(new Set([...Object.keys(l),...Object.keys(u)])),h=!A&&!n,d=!!h||c,p=!!h||g,m={[Gb]:d,[RB]:d,[vw]:p};t.$feature_flag_details&&(m[_R]=d);for(const _ of[fR,Dw,D$])Bo(t[_])||(m[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(m)}Lt(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.remove(t)})}Ld(t){try{t()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}Id(){const t={};for(const o of[Gb,vw,fR,u6]){const i=this.Fd(o);Bo(i)||(t[o]=i)}this.Yc=t;const e=sn({},t),n=this.Fd(RB);if(n)for(const[o,i]of Object.entries(n))e[`$feature/${o}`]=i;this.td=e}Cd(){const t=this.Rr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Fd(Dw);return typeof e!="number"||Date.now()-e>t}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const t=this.Rr.evaluationContexts;return t?.length?t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid evaluation context found:",e,"Expected non-empty string"),n}):[]}Bd(){const t=this.Rr.flagKeys;if(!Bo(t))return t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid flag key found:",e,"Expected non-empty string"),n})}initialize(){var t,e;const n=this.Rr,o=(t=(e=n.bootstrap)===null||e===void 0?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(o).length){var i,r;const s=(i=(r=n.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(o).filter(c=>!Bo(o[c])).reduce((c,l)=>(c[l]=o[l],c),{}),A=Object.keys(s).filter(c=>a[c]).reduce((c,l)=>(c[l]=s[l],c),{});return this.Hd({featureFlags:a,featureFlagPayloads:A},void 0,{persist:!1})}}updateFlags(t,e,n){var o,i;const r=n?.merge&&(o=this.Fd("$enabled_feature_flags"))!==null&&o!==void 0?o:{},s=n?.merge&&(i=this.Fd("$feature_flag_payloads"))!==null&&i!==void 0?i:{},a=sn(sn({},r),t),A=sn(sn({},s),e),c={};for(const[l,u]of Object.entries(a))c[l]={key:l,enabled:sHt(u),variant:aHt(u),reason:void 0,metadata:Bo(A?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:A[l]}};this.Hd({flags:c})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Fd(_R),e=this.Fd(u6),n=this.Fd(IR);if(!n&&!e)return t||{};const o=Mu({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(const a of i){var r;const A=o[a],c=e?.[a],l=Bo(c)?(r=A?.enabled)!==null&&r!==void 0&&r:!!c,u=Bo(c)?A?.variant:typeof c=="string"?c:void 0,g=n?.[a],h=sn(sn({},A),{},{enabled:l,variant:l?u??A?.variant:void 0});var s;l!==A?.enabled&&(h.original_enabled=A?.enabled),u!==A?.variant&&(h.original_variant=A?.variant),g&&(h.metadata=sn(sn({},A?.metadata),{},{payload:g,original_payload:A==null||(s=A.metadata)===null||s===void 0?void 0:s.payload})),o[a]=h}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:o}),this.Xc=!0),o}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(n=>{const o=t[n];return{key:n,enabled:sHt(o),variant:aHt(o),payload:rHt(e[n])}})}getFlagVariants(){const t=this.Fd(RB),e=this.Fd(u6);if(!e)return t||{};const n=Mu({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Xc=!0),n}getFlagPayloads(){const t=this.Fd(vw),e=this.Fd(IR);if(!e)return t||{};const n=Mu({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Xc=!0),n}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(t=>{try{t()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ed.push(t),()=>{this.ed=this.ed.filter(e=>e!==t)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.od=t}resetFlagCallReported(){this.Lt(Mw)}Ud(t){this.Ad();const e=this.wo;if(!e||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const n={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:sn(sn(sn({},e.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Fd(Pw),timezone:NOt()};Bo(e.deviceId)||(n.$device_id=e.deviceId),(t?.disableFlags||this.Rr.featureFlagsDisabled)&&(n.disable_flags=!0);const o=this.jd();o.length&&(n.evaluation_contexts=o);const i=this.Bd();Bo(i)||(n.flag_keys=i);const r=this.Rr.onlyEvaluateSurveyFeatureFlags,s="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;const A=()=>{this.ad&&(this.ad=!1,this.Ud())},c=d=>{var p,m;const _=(p=d.json)!==null&&p!==void 0?p:{},f=d.statusCode!==200;if(this.sd=!1,a!==this.rd)return void A();if(this.Wd(d.statusCode),f||this.ad||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.ad)return;this.ld=!f;const I=[];d.error?I.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?LGt:"unknown_error"):d.statusCode!==200&&I.push(`api_error_${d.statusCode}`),_.errorsWhileComputingFlags&&I.push("errors_while_computing_flags");const C=!!(!((m=_.quotaLimited)===null||m===void 0)&&m.includes("feature_flags"));C&&I.push("quota_limited"),this.At({[R$]:I}),C?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Hd(_,f,{partialResponse:r}),A()},l=d=>{this.sd=!1,a===this.rd&&(this.At({[R$]:[LGt]}),this.$.error("Feature flag request failed",d),this.Dd()&&this.Md(!0)),A()};let u=this.Rr.requestMaxRetries;const g=()=>u>0&&a===this.rd,h=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void A();try{e.sendRequest(s,{target:"flags",method:"POST",body:n,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(d=>{if((p=>hYo.includes(p.statusCode)||(m=>m.statusCode===0&&m.error instanceof Error&&m.error.name==="AbortError")(p))(d)&&g())return u--,void setTimeout(h,500);c(d)}).catch(l)}catch(d){l(d)}};h()}vd(){return BOt(this.hd,3)}Wd(t){this.hd=bOt(t,this.hd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var n;if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+qNe);if(this.qd())return;const o=this.getFeatureFlagResult(t,e);return(n=o?.variant)!==null&&n!==void 0?n:o?.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+qNe);if(this.qd())return;const n=this.getFlagVariants(),o=t in n,i=n[t],r=this.getFlagPayloads()[t],s=String(i),a=this.Fd("$feature_flag_request_id")||void 0,A=this.Fd("$feature_flag_evaluated_at")||void 0;let c,l=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var u;const S=(u=this.wo)===null||u===void 0?void 0:u.session.sessionId,Q=this.Fd(N$);S&&S!==Q&&(l={},c=S)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.At({[Mw]:l,[N$]:c});else{var g,h,d,p,m,_,f,I,C,y,x,E;as(l[t])?l[t].push(s):l[t]=[s],this.At(sn({[Mw]:l},c?{[N$]:c}:{}));const S=this.getFeatureFlagDetails(t),Q=[...(g=this.Fd("$feature_flag_errors"))!==null&&g!==void 0?g:[]];Bo(i)&&Q.push("flag_missing");const w={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:A,$feature_flag_bootstrapped_response:(h=(d=this.Rr.bootstrap)===null||d===void 0||(d=d.featureFlags)===null||d===void 0?void 0:d[t])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(p=(m=this.Rr.bootstrap)===null||m===void 0||(m=m.featureFlagPayloads)===null||m===void 0?void 0:m[t])!==null&&p!==void 0?p:null,$used_bootstrap_value:!this.ld};Bo(S==null||(_=S.metadata)===null||_===void 0?void 0:_.has_experiment)||(w.$feature_flag_has_experiment=S.metadata.has_experiment),Bo(S==null||(f=S.metadata)===null||f===void 0?void 0:f.version)||(w.$feature_flag_version=S.metadata.version);const M=(I=S==null||(C=S.reason)===null||C===void 0?void 0:C.description)!==null&&I!==void 0?I:S==null||(y=S.reason)===null||y===void 0?void 0:y.code;var B;M&&(w.$feature_flag_reason=M),!(S==null||(x=S.metadata)===null||x===void 0)&&x.id&&(w.$feature_flag_id=S.metadata.id),Bo(S?.original_variant)&&Bo(S?.original_enabled)||(w.$feature_flag_original_response=Bo(S.original_variant)?S.original_enabled:S.original_variant),!(S==null||(E=S.metadata)===null||E===void 0)&&E.original_payload&&(w.$feature_flag_original_payload=S==null||(B=S.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(w.$feature_flag_error=Q.join(",")),this.Vd(w)}else c&&this.At({[Mw]:l,[N$]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:rHt(r)}:void 0}Vd(t){try{var e;(e=this.wo)===null||e===void 0||e.capture("$feature_flag_called",t)}catch(n){this.$.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.Gd(t,e)}Gd(t,e){var n=this;return eg(function*(){const o=n.wo;if(!o)return;const i={distinct_id:o.distinctId,token:o.projectToken,person_properties:{$lib:o.library.name,$lib_version:o.library.version}},r=n.jd();r.length&&(i.evaluation_contexts=r);const s=n.Bd();let a;Bo(s)||(i.flag_keys=s);try{var A;const c=(A=(yield o.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:i,compression:n.Rr.compression,sentAt:"body",timeoutMs:n.Rr.requestTimeoutMs})).json)===null||A===void 0?void 0:A.featureFlagPayloads;a=c?.[t]||void 0}catch(c){return void n.$.error("Remote config feature flag request failed",c)}try{e(a)}catch(c){n.$.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.ld)return e.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+qNe),e.defaultValue;const n=this.getFeatureFlag(t,e);return Bo(n)?e.defaultValue:!!n}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){this.Hd(t,e,n)}Hd(t,e,n){if(!this.wo)return;this.nd=!0;const o=((i,r={},s={},a={},A,c=kGt)=>{const l=((I,C)=>{const y=I.flags;if(y){const x=Object.fromEntries(Object.keys(y).map(B=>{var S;return[B,(S=y[B].variant)!==null&&S!==void 0?S:y[B].enabled]})),E=Object.fromEntries(Object.keys(y).filter(B=>y[B].enabled).filter(B=>{var S;return!Bo((S=y[B].metadata)===null||S===void 0?void 0:S.payload)}).map(B=>{var S;return[B,(S=y[B].metadata)===null||S===void 0?void 0:S.payload]}));return sn(sn({},I),{},{featureFlags:x,featureFlagPayloads:E})}return I.featureFlags&&C.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),I})(i,c),u=l.flags,g=l.featureFlags,h=l.featureFlagPayloads;if(!g)return;const d=i.requestId,p=i.evaluatedAt;if(as(g)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const I={};if(g)for(let C=0;g.length>C;C++)I[g[C]]=!0;return{[Gb]:g,[RB]:I,[D$]:!1}}let m=g,_=h,f=u;if(A?.partialResponse){const I=Object.keys(m),C=_||{};m=sn(sn({},r),m),_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),f)}else if(i.errorsWhileComputingFlags)if(u){const I=new Set(Object.keys(u).filter(y=>{var x;return!(!((x=u[y])===null||x===void 0)&&x.failed)}));m=sn(sn({},r),Object.fromEntries(Object.entries(m).filter(([y])=>I.has(y))));const C=Object.fromEntries(Object.entries(_||{}).filter(([y])=>I.has(y)));_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),Object.fromEntries(Object.entries(f||{}).filter(([y])=>I.has(y))))}else m=sn(sn({},r),m),_=sn(sn({},s),_),f=sn(sn({},a),f);return sn(sn({[Gb]:Object.keys(OGt(m)),[RB]:m||{},[vw]:_||{},[_R]:f||{},[D$]:i.minimalFlagCalledEvents===!0},d?{[fR]:d}:{}),p?{[Dw]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(o)if(n?.persist===!1){const i=!Bo(this.wo.kv.get(RB));this.Od=o,i||this.At(o)}else this.Td(),this.Nd(o,t,!!n?.partialResponse),this.At(o);else e&&this.Dd();e||(this.ud=!1),this.Md(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.wo){if(t===!1)return this.Lt([u6,IR]),this.Md(),void BR.info("All overrides cleared");if(as(t))return this.At({[u6]:HGt(t)}),this.Md(),void BR.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e;const n=t;this.Xc=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);const o={},i=n.flags,r=n.payloads;return i&&(o[u6]=as(i)?HGt(i):i),r&&(o[IR]=r),Object.keys(o).length&&this.At(o),i===!1&&r===!1?this.Lt([u6,IR]):i===!1?this.Lt(u6):r===!1&&this.Lt(IR),this.Md(),i===!1?BR.info("Flag overrides cleared"):i&&BR.info("Flag overrides set",{flags:i}),void(r===!1?BR.info("Payload overrides cleared"):r&&BR.info("Payload overrides set",{payloads:r}))}if(t&&typeof t=="object")return this.At({[u6]:t}),this.Md(),void BR.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.nd){const{flags:e,flagVariants:n}=this.Qd();try{t(e,n)}catch(o){this.$.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var o;const i=(this.Fd("$early_access_features")||[]).find(c=>c.flagKey===t),r={[`$feature_enrollment/${t}`]:e},s={$feature_flag:t,$feature_enrollment:e,$set:r};i&&(s.$early_access_feature_name=i.name),n&&(s.$feature_enrollment_stage=n);const a=sn(sn({},this.getFlagVariants()),{},{[t]:e});(o=this._instance)===null||o===void 0||(o=o.persistence)===null||o===void 0||o.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[Gb]:Object.keys(OGt(a)),[RB]:a,[ww]:sn(sn({},this.Fd("$stored_person_properties")||{}),r)}),this.Md();try{var A;(A=this.wo)===null||A===void 0||A.capture("$feature_enrollment_update",s)}catch(c){this.$.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(t,e=!1,n){const o=this.Fd(oNe);!o||e?this.Jd(t,n):t(o)}Jd(t,e){var n=this;return eg(function*(){const o=n.wo;if(!o)return;const i=e?`&${e.map(s=>`stage=${s}`).join("&")}`:"";let r;try{const s=yield o.sendRequest(`/api/early_access_features/?token=${o.projectToken}${i}`,{target:"api",method:"GET",sentAt:"query"});if(!s.json)return;r=s.json.earlyAccessFeatures,n.At({[oNe]:r})}catch(s){return void n.$.error("Early access feature request failed",s)}try{t(r)}catch(s){n.$.error("Early access feature callback failed",s)}})()}Qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,o)=>(n[o]=e[o],n),{})}}Md(t){this.Id();const{flags:e,flagVariants:n}=this.Qd();this.featureFlagEventHandlers.forEach(o=>{try{o(e,n,{errorsLoading:t})}catch(i){this.$.error("Error while running feature flags callback",i)}})}setPersonPropertiesForFlags(t,e=!0){this.Kd(t,e)}Kd(t,e=!0){const n=this.Fd("$stored_person_properties")||{},o=t?.$set||(t?.$set_once?{}:t),i=t?.$set_once,r={};if(i)for(const s in i)({}).hasOwnProperty.call(i,s)&&(s in n||(r[s]=i[s]));this.At({[ww]:sn(sn(sn({},n),r),o)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const n=sn({},this.Fd("$stored_person_properties")||{});t.forEach(o=>{delete n[o]}),this.At({[ww]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(ww),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const n=this.Fd("$stored_group_properties")||{},o=sn({},n);for(const i of Object.keys(t))o[i]=sn(sn({},n[i]),t[i]);this.At({[Pw]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[Pw]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(Pw)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},bYo={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var t;return!!(!((t=this.Xd)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(t=(e=this.Xd)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.Yd}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=WNe,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Ln==null||(e=Ln.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.ln=()=>{var e,n;No?.visibilityState==="visible"&&(this.Xe=!0,(e=this.Xd)===null||e===void 0||(n=e.setDocumentWasEverVisible)===null||n===void 0||n.call(e,!0))},!this._instance.sessionManager)throw Jb.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');No?.addEventListener&&Cl(No,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.ev=!0,No==null||(e=No.removeEventListener)===null||e===void 0||e.call(No,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Rr.disable_session_recording,o=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return Ln&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this.ev||this.nv&&(!((e=this.Xd)===null||e===void 0)&&e.isStarted))return;const n=!Bo(Object.assign)&&!Bo(Array.from);this.nv&&n?(this.sv(t),Jb.info("starting")):(this.Yd=WNe,this.stopRecording())}sv(t){var e,n;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=wGt),(Vr==null||(e=Vr.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Vr.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.rv(t);else{var o,i;const r=this._instance.sessionManager;(o=Vr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,this.ov,s=>{if(!this.ev&&this.nv&&this._instance.sessionManager===r)return s?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Jb.error("could not load recorder",s)):void this.rv(t);this.Yd="disabled"})}}stopRecording(){var t,e;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(e=this.Xd)===null||e===void 0||e.stop()}iv(t=!1){var e,n;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(n=this.Xd)===null||n===void 0||n.discard({discardProducerEvents:t})}av(){var t,e;(t=this.Ml)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Ml)===null||e===void 0||e.unregister("$replay_sample_rate")}lv(t,e){if(Us(t))return null;const n=sh(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(Jb.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):n;var o}uv(t){if(this.Ml){var e,n;const o=this.Ml,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.lv((r=this.Rr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.lv(s?.sampleRate,"remote config sampleRate"),c=a??A;Us(c)&&this.av();const l=s?.minimumDurationMilliseconds;o.register({[M$]:sn(sn({cache_timestamp:Date.now(),enabled:!!s},s),{},{networkPayloadCapture:sn({capturePerformance:t.capturePerformance},s?.networkPayloadCapture),canvasRecording:{enabled:s?.recordCanvas,fps:s?.canvasFps,quality:s?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Bo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.tv)===null||e===void 0||e.call(this),this.tv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(i)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.uv(e),void this.iv()):(this.uv(e),void this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[KHt]:!0}),Jb.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.Xd)===null||n===void 0)&&n.log?this.Xd.log(t,e):Jb.warn("log called before recorder was ready")}get ov(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(M$);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(M$);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Jb.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Us(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(t){var e,n,o;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return Jb.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[UHt]:!0});var i;if(this.Xd||(this.Xd=(i=Vr.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv())return this.Yd==="missing_config"||this.Yd==="awaiting_config"?void 0:(this.Yd="awaiting_config",Jb.info("persisted remote config is stale, requesting fresh config before starting"),void new HOt(this._instance).load());this.Yd=wGt,(n=(o=this.Xd).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Xe),this.Xd.start(t)}else this.Yd=WNe}onRRwebEmit(t){var e,n;(e=this.Xd)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.Xd)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.Xd)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.Xd||(n=this.Ml)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.Xd)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Xd)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!!(!((n=this.Xd)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.Xd)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},SYo={autocapture:class extends ZGo{constructor(t){super(new eYo(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.dv=!1,this._instance=t,this.vv=this.fv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.pv();return!!(t.path||t.search||this.gv(t))}startIfEnabled(){this.isEnabled&&(ui.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.vv=this.fv(),this.startIfEnabled()}stop(){this.mv&&this.mv(),this.mv=void 0,this.yv&&this.yv(),this.yv=void 0,ui.info("History API monitoring stopped")}monitorHistoryChanges(){Ln&&Ln.history&&(this.bv("pushState"),this.bv("replaceState"),this._v(),this.gv()&&this.wv())}bv(t){var e;if(!Ln||!((e=Ln.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;oq(Ln.history,t,o=>function(i,r,s){var a;n.Sv(s)&&n.xv(),o.call(this,i,r,s),n.Cv(t,!n.dv&&(Ln==null||(a=Ln.event)===null||a===void 0?void 0:a.type)!=="popstate")})}fv(){const t=Ln?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}pv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:QA(t)?t:{}}gv(t=this.pv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}$v(t){const e=this.pv(),n=this.vv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.gv(e)&&t.hash!==n.hash))}Cv(t,e=!1){try{e||this.xv();const n=this.fv();if(!n)return;if(this.$v(n)){const o=()=>this._instance.capture(lNe,{navigation_type:t});e?(this.Tv=o,Promise.resolve().then(()=>this.xv())):o()}this.vv=n}catch(n){ui.error(`Error capturing ${t} pageview`,n)}}Sv(t){var e,n;return!(Us(t)||!Ln)&&((e=Ub(String(t)))===null||e===void 0?void 0:e.href)!==((n=Ln.location)===null||n===void 0?void 0:n.href)}xv(){const t=this.Tv;if(t){this.Tv=void 0,this.dv=!0;try{t()}catch(e){ui.error("Error capturing deferred pageview",e)}finally{this.dv=!1}this.vv=this.fv()}}_v(){if(this.mv)return;const t=()=>{this.Cv("popstate")};Cl(Ln,"popstate",t),this.mv=()=>{Ln&&Ln.removeEventListener("popstate",t)}}wv(){if(this.yv)return;const t=()=>{this.Cv("hashchange")};Cl(Ln,"hashchange",t),this.yv=()=>{Ln&&Ln.removeEventListener("hashchange",t)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.Iv=!1,this.xo=!1,this.Mv=null,this.instance=t,this.Iv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[qDe]),this.rageclicks=new BGt(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return QA(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Us(this.Rr.capture_heatmaps)?Us(this.Rr.enable_heatmaps)?this.Iv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;iYo.info("starting..."),this.Ev(),this.ln()}else{var t;clearInterval((t=this.Mv)!==null&&t!==void 0?t:void 0),this.Pv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[qDe]:n}),this.Iv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Rv(t){jNe(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Mv&&clearInterval(this.Mv),this.Mv=No?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}Ev(){Ln&&No&&(this.Av=this.bl.bind(this),Cl(Ln,bge,this.Av),this.Fv=t=>this.Tr(t||Ln?.event),Cl(No,"click",this.Fv,{capture:!0}),this.Ov=t=>this.Dv(t||Ln?.event),Cl(No,"mousemove",this.Ov,{capture:!0}),this.Lv=new IOt(this.instance,aGo,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Nv=this.ln.bind(this),Cl(No,T$,this.Nv),this.xo=!0)}Pv(){var t;Ln&&No&&(this.Av&&Ln.removeEventListener(bge,this.Av),this.Fv&&No.removeEventListener("click",this.Fv,{capture:!0}),this.Ov&&No.removeEventListener("mousemove",this.Ov,{capture:!0}),this.Nv&&No.removeEventListener(T$,this.Nv),clearTimeout(this.qv),(t=this.Lv)===null||t===void 0||t.stop(),this.xo=!1)}jv(t,e){const n=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),r=(function(s,a,A){let c=s;for(;c&&g6(c)&&!AI(c,"body");){if(c===A)return!1;let h;try{var l,u,g;h=(l=(u=(g=c.ownerDocument)===null||g===void 0?void 0:g.defaultView)!==null&&u!==void 0?u:Ln)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(Is(a,h))return!0;c=sOt(c)}return!1})(H$(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Tr(t,e="click"){var n;if(nOt(t.target)||!jNe(t))return;const o=this.jv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&lOt(H$(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Dv(t){!nOt(t.target)&&jNe(t)&&(clearTimeout(this.qv),this.qv=setTimeout(()=>{this.Zs(this.jv(t,"mousemove"))},500))}Zs(t){if(!Ln)return;const e=this.Rr.disable_capture_url_hashes?Qw(Ln.location.href):Ln.location.href,n=this.Rr.custom_personal_data_properties,o=this.Rr.mask_personal_data_properties?[...eG,...n||[]]:[],i=K$(e,o,V$);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}bl(){this.Rt&&!Nx(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:IOt,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Iv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Bv=()=>{clearTimeout(this.Hv),this.Hv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",sn({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,o)=>sn(sn({},n),{},{[`$web_vitals_${o.name}_event`]:sn({},o),[`$web_vitals_${o.name}_value`]:o.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.zv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Us(n?.name)||Us(n?.value))return void ER.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.Uv(i);if(Bo(r))return;const s=sh(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.Wv&&n.value>=this.Wv)return void ER.error("Ignoring metric with value >= "+this.Wv,n);this.Rt.navigationKey!==s&&(this.Bv(),this.Hv=setTimeout(this.Bv,this.flushToCaptureTimeoutMs)),Bo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Bo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=sn(sn(sn({},n),i?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete A.entries,QA(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of oYo){const u=l==="url"&&typeof n.attribution[l]=="string"?this.Uv(n.attribution[l]):n.attribution[l];Bo(u)||(c[l]=u)}A.attribution=c}else delete A.attribution;Bo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.Bv()},this.Vv=()=>{if(this.xo)return;let n,o,i,r,s=!1;const a=Vr.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.Gv]||(this.Gv==="web-vitals"&&Bo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Bo(c)){const g=c.withoutAttribution,h=this.attributionMetrics;s=!Bo(g),n=h.indexOf("LCP")>-1?c.onLCP:g?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:g?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:g?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:g?.onINP||c.onINP}if(!(n&&o&&i&&r))return void ER.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?sn(sn({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&n(this.zv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.zv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.zv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.zv.bind(this),u),this.xo=!0},this.Iv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[eNe]),this.startIfEnabled()}get Zv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=QA(this.Zv)?(t=this.Zv)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Us(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||vGt:n}get flushToCaptureTimeoutMs(){return(QA(this.Zv)?this.Zv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=QA(this.Zv)?this.Zv.web_vitals_attribution:void 0;return jy(t)?t?vGt:[]:as(t)?t:nYo}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=QA(this.Zv)?this.Zv.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Wv(){const t=QA(this.Zv)&&sh(this.Zv.__web_vitals_max_value)?this.Zv.__web_vitals_max_value:QGt;return t>0&&6e4>=t?QGt:t}get isEnabled(){const t=fd?.protocol;if(t!=="http:"&&t!=="https:")return ER.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=QA(this.Zv)?this.Zv.web_vitals:jy(this.Zv)?this.Zv:void 0;return jy(e)?e:this.Iv}startIfEnabled(){this.isEnabled&&!this.xo&&(ER.info("enabled, starting..."),this.zo(this.Vv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=QA(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=QA(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[eNe]:n}),this._instance.persistence.register({[DHt]:o})),this.Iv=n,this.startIfEnabled()}get Gv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const n=Vr.__PosthogExtensions__,o=this.Gv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Bo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?ER.error("failed to load script",r):t()})}Uv(t){const e=t||Ln?.location.href;if(!e)return void ER.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?Qw(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...eG,...o||[]]:[];return K$(n,i,V$)}}},QYo={exceptionObserver:class{constructor(t){var e;this.Vv=()=>{var n;if(!Ln||!this.isEnabled||!(!((n=Vr.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Vr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Vr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Vr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this.Rr.capture_unhandled_errors&&(this.Qv=o(this.captureException.bind(this))),!this.Jv&&this.Rr.capture_unhandled_rejections&&(this.Jv=i(this.captureException.bind(this))),!this.Kv&&this.Rr.capture_console_errors&&(this.Kv=r(this.captureException.bind(this)))}catch(s){nq.error("failed to start",s),this.Xv()}},this._instance=t,this.Yv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[XDe]),this.wt=new CHo(sn(sn({},(function(n={}){var o,i,r,s;return{refillRate:(o=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:1,bucketSize:(r=(s=n.exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:n.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:nq})),this.Rr=this.tf(),this.startIfEnabledOrStop()}tf(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return QA(t)?e=sn(sn({},e),t):(Bo(t)?this.Yv:t)&&(e=sn(sn({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(nq.info("enabled"),this.Xv(),this.zo(this.Vv)):this.Xv()}zo(t){var e,n,o;!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Vr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return nq.error("failed to load script",i);t()})}Xv(){var t,e,n;(t=this.Qv)===null||t===void 0||t.call(this),this.Qv=void 0,(e=this.Jv)===null||e===void 0||e.call(this),this.Jv=void 0,(n=this.Kv)===null||n===void 0||n.call(this),this.Kv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Yv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[XDe]:this.Yv}),this.Rr=this.tf(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.tf()}captureException(t){try{var e,n,o;const i=(e=t==null||(n=t.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(i))return void nq.info("Skipping exception capture because of client rate limiting.",{exception:i});(o=this._instance.exceptions)===null||o===void 0||o.sendExceptionEvent(t)}catch{}}},exceptions:class{constructor(t){var e,n;this.ef=[],this.if=new DHo([new JHo,new nOo,new jHo,new WHo,new eOo,new ZHo,new qHo,new tOo],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
|
|
1069
1069
|
`),c=Math.min(A.length,s+1e3),l=[];for(let h=s;c>h;h++){const d=A[h];if(d.length>1024)continue;const p=tHt.test(d)?d.replace(tHt,"$1"):d;if(!p.match(/\S*Error: /)){for(const m of i){const _=m(p,o);if(_){a.push(_);const f=UHo(a);if(f){for(let I=l.length-1;I>=0;I--){const C=l[I];if(f.start>=C.start+C.length)break;l.pop()}l.push(f)}break}}if(VHo(a,l)>=50)break}}const u=[...l].sort((h,d)=>d.start-h.start),g=u[u.length-1];if(g){const h=nHt(a,g);a.splice(g.start-h,h);for(const d of u)d.start-=h}for(const h of u)KHo(a,h);return l.some(h=>h.start===0&&a.length===h.length)&&(function(h){const d=h.map(m=>`${m.function}|${m.filename}|${m.lineno}|${m.colno}|${m.module}`);let p=0;for(let m=1;d.length>m;m++)zHo(d,m,p)&&(p=m);h.push(...h.splice(0,p))})(a),(function(h){if(!h.length)return[];const d=Array.from(h);return d.reverse(),d.slice(0,50).map(p=>{return sn(sn({},p),{},{filename:p.filename||(m=d,m[m.length-1]||{}).filename,function:p.function||"?"});var m})})(a)}})("web:javascript",HHo,YHo)),this._instance=t,this.ef=(e=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&e!==void 0?e:[],this.nf=fge(this.sf()),this.rf=new iOo(this.nf)}onConfigChange(){this.nf=fge(this.sf()),this.rf.setConfig(this.nf)}onRemoteConfig(t){var e,n,o;if(!t.ok)return;const i=t.config;if(!("errorTracking"in i))return;const r=(e=(n=i.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],s=(o=i.errorTracking)===null||o===void 0?void 0:o.captureExtensionExceptions;this.ef=r,this._instance.persistence&&this._instance.persistence.register({[PHt]:this.ef,[ZDe]:s})}get af(){var t;const e=!!this._instance.get_property(ZDe),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.if.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.nf.enabled)try{if(!rA(t)||t.trim().length===0)return void kB.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:n,droppedKeys:o}=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};const r=[];return{sanitizedProperties:Object.keys(i).reduce((s,a)=>oOo.has(a)?(r.push(a),s):(s[a]=i[a],s),{}),droppedKeys:r}})(this.lf(e));o.length>0&&kB.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.rf.add(sn({[mge]:t,[_ge]:new Date().toISOString()},n))}catch(n){kB.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.uf(e)){if(this.hf(e))return this.cf("Exception dropped: matched a suppression rule"),void kB.info("Skipping exception capture because a suppression rule matched");if(!this.af&&this.df(e))return this.cf("Exception dropped: thrown by a browser extension"),void kB.info("Skipping exception capture because it was thrown by an extension");if(!this.af&&this.vf(e))return this.cf("Exception dropped: thrown by an injected browser script"),void kB.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ff(e))return this.cf("Exception dropped: thrown by the PostHog SDK"),void kB.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.nf.enabled&&Us(t.$exception_steps)?this.pf(t):t,o=(function(){const i=globalThis._posthogReleaseId;return typeof i=="string"&&i.length>0?i:void 0})();o&&(n.$release_id=o);try{const i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return i&&this.rf.clear(),i}catch(i){return GGt(i)||kB.error("Failed to capture exception event. Dropping this exception.",i),void this.rf.clear()}}catch(e){return void(GGt(e)||kB.error("Failed to process exception event. Ignoring this exception.",e))}}pf(t){try{const e=this.rf.getAttachable();return e.length===0?t:sn(sn({},t),{},{$exception_steps:e})}catch(e){return kB.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}cf(t){this.nf.enabled&&this.rf.add({[mge]:t,[_ge]:new Date().toISOString()})}lf(t){return QA(t)?sn({},t):{}}sf(){var t,e;return(t=(e=this._instance.config.error_tracking)===null||e===void 0?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}hf(t){if(t.length===0)return!1;try{const e=t.reduce((n,{type:o,value:i})=>(rA(o)&&o.length>0&&n.$exception_types.push(o),rA(i)&&i.length>0&&n.$exception_values.push(i),n),{$exception_types:[],$exception_values:[]});return this.ef.some(n=>{const o=n.values.map(i=>{const r=dGt[i.operator],s=e[i.key];if(!r||!s)return!1;const a=as(i.value)?i.value:[i.value];return a.length>0&&r(a,s)});return n.type==="OR"?o.some(Boolean):o.every(Boolean)})}catch(e){return kB.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}df(t){const e=t.flatMap(o=>{var i,r;return(i=(r=o.stacktrace)===null||r===void 0?void 0:r.frames)!==null&&i!==void 0?i:[]}),n=e.filter(({filename:o})=>!!o&&mYo.some(i=>o.startsWith(i)));return n.length!==0&&(!n.every(({filename:o})=>!!o&&o.startsWith(XNe))||t.some(({type:o,value:i})=>o==="NoResponse"||rA(i)&&pYo.some(({value:r,exact:s})=>s?i===r:i.includes(r)))&&!e.some(({in_app:o,filename:i})=>o&&!i?.startsWith(XNe)))}vf(t){return t.some(({value:e})=>rA(e)&&_Yo.some(n=>e.includes(n)))}ff(t){if(t.length>0){var e,n,o,i;const r=(e=(n=t[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&e!==void 0?e:[],s=r[r.length-1];return(o=s==null||(i=s.filename)===null||i===void 0?void 0:i.includes("posthog.com/static"))!==null&&o!==void 0&&o}return!1}uf(t){return!Us(t)&&as(t)}}},vYo=sn({productTours:class{get Ml(){return this._instance.persistence}constructor(t){this.gf=null,this.mf=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var n,o;if(this.Ml&&this.Ml.register({[nNe]:!!e.productTours}),!$Ne(this._instance))return!this.gf&&Us((n=this.Ml)===null||n===void 0?void 0:n.props.ph_product_tours)||Hge.info("product tours disabled; stopping and clearing cached tours"),(o=this.gf)===null||o===void 0||o.stop(),this.gf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.gf&&$Ne(this._instance)&&this.zo(()=>this.yf())}zo(t){var e,n,o;!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours?t():(n=Vr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"product-tours",i=>{i?Hge.error("Could not load product tours script",i):t()})}yf(){var t;!this.gf&&(!((t=Vr.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours)&&(this.gf=Vr.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(as(this.mf)&&!e)return void t(this.mf,{isLoaded:!0});const n=this.Ml;if(n){const o=n.props[rNe];if(as(o)&&!e)return this.mf=o,void t(o,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:o=>{if(!$Ne(this._instance))return void t([],{isLoaded:!0});const i=o.statusCode;if(i!==200||!o.json){const s=`Product Tours API could not be loaded, status: ${i}`;return i===0?o.error||Hge.warn(s):Hge.error(s),void t([],{isLoaded:!1,error:s})}const r=as(o.json.product_tours)?o.json.product_tours:[];this.mf=r,n&&n.register({[rNe]:r}),t(r,{isLoaded:!0})}})}getActiveProductTours(t){Us(this.gf)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.gf.getActiveProductTours(t)}showProductTour(t){var e;(e=this.gf)===null||e===void 0||e.showTourById(t)}previewTour(t){this.gf?this.gf.previewTour(t):this.zo(()=>{var e;this.yf(),(e=this.gf)===null||e===void 0||e.previewTour(t)})}dismissProductTour(){var t;(t=this.gf)===null||t===void 0||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.gf)===null||t===void 0||t.nextStep()}previousStep(){var t;(t=this.gf)===null||t===void 0||t.previousStep()}clearCache(){var t;this.mf=null,(t=this.Ml)===null||t===void 0||t.unregister("ph_product_tours")}resetTour(t){var e;(e=this.gf)===null||e===void 0||e.resetTour(t)}resetAllTours(){var t;(t=this.gf)===null||t===void 0||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.gf)===null||e===void 0||e.cancelPendingTour(t)}}},Gge),wYo={siteApps:class{constructor(t){this._instance=t,this.bf=0,this._f=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wf(t,e){if(!e)return;const n=this.globalsForEvent(e);this._f.push(n),this._f.length>1e3&&(this._f=this._f.slice(10))}get siteAppLoaders(){var t;return(t=Vr._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(t=t[this._instance.config.token])===null||t===void 0?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.wf.bind(this));this.kf=()=>{t(),this._f=[],this.kf=void 0}}}globalsForEvent(t){var e,n,o,i,r,s,a;if(!t)throw new Error("Event payload is required");const A={},c=this._instance.get_property("$groups")||[],l=this._instance.get_property("$stored_group_properties")||{};for(const[h,d]of Object.entries(l))A[h]={id:c[h],type:h,properties:d};const{$set_once:u,$set:g}=t;return{event:sn(sn({},gHt(t,rYo)),{},{properties:sn(sn(sn({},t.properties),g?{$set:sn(sn({},(e=(n=t.properties)===null||n===void 0?void 0:n.$set)!==null&&e!==void 0?e:{}),g)}:{}),u?{$set_once:sn(sn({},(o=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&o!==void 0?o:{}),u)}:{}),elements_chain:(r=(s=t.properties)===null||s===void 0?void 0:s.$elements_chain)!==null&&r!==void 0?r:"",distinct_id:(a=t.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:A}}Sf(t){var e;const n=(e=t.tagName)===null||e===void 0?void 0:e.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(d6.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(d6.error("prepare_external_dependency_script returned null"),null):t}xf(){var t,e,n,o,i,r,s,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const A=No?.defaultView,c=A==null||(t=A.Node)===null||t===void 0?void 0:t.prototype;if(!A||!c)return()=>{};if(this.bf++,this.Cf)return this.$f();const l=[],u=this,g=new WeakSet,h=(m,_,f)=>{if(!m?.[_])return;const I=m[_];m[_]=f(I),l.push(()=>{m[_]=I})},d=m=>{if(g.has(m))return m;const _=u.Sf(m);return _&&g.add(_),_},p=m=>m.map(_=>typeof _=="string"?_:d(_)).filter(_=>!Id(_));return h(c,"appendChild",m=>function(_){const f=d(_);return f?m.call(this,f):_}),h(c,"insertBefore",m=>function(_,f){const I=d(_);return I?m.call(this,I,f):_}),h(c,"replaceChild",m=>function(_,f){const I=d(_);return I?m.call(this,I,f):f}),[(e=A.Element)===null||e===void 0?void 0:e.prototype,(n=A.Document)===null||n===void 0?void 0:n.prototype,(o=A.DocumentFragment)===null||o===void 0?void 0:o.prototype].forEach(m=>{h(m,"append",_=>function(...f){return _.apply(this,p(f))}),h(m,"prepend",_=>function(...f){return _.apply(this,p(f))})}),[(i=A.Element)===null||i===void 0?void 0:i.prototype,(r=A.CharacterData)===null||r===void 0?void 0:r.prototype,(s=A.DocumentType)===null||s===void 0?void 0:s.prototype].forEach(m=>{h(m,"before",_=>function(...f){return _.apply(this,p(f))}),h(m,"after",_=>function(...f){return _.apply(this,p(f))}),h(m,"replaceWith",_=>function(...f){const I=p(f);return f.length&&!I.length?void 0:_.apply(this,I)})}),h((a=A.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",m=>function(_,f){const I=d(f);return I?m.call(this,_,I):null}),this.Cf=()=>{l.forEach(m=>m()),this.Cf=void 0},this.$f()}$f(){let t=!1;return()=>{var e;t||(t=!0,this.bf--,this.bf===0&&((e=this.Cf)===null||e===void 0||e.call(this)))}}Tf(t,e=!0){const n=this.xf();try{const o=t(n);return e&&n(),o}catch(o){throw n(),o}}setupSiteApp(t){const e=this.apps[t.id],n=()=>{var r;!e.errored&&this._f.length&&(d6.info(`Processing ${this._f.length} events for site app with id ${t.id}`),this._f.forEach(s=>this.Tf(()=>{var a;return(a=e.processEvent)===null||a===void 0?void 0:a.call(e,s)})),e.processedBuffer=!0),Object.values(this.apps).every(s=>s.processedBuffer||s.errored)&&((r=this.kf)===null||r===void 0||r.call(this))};let o=!1;const i=r=>{e.errored=!r,e.loaded=!0,d6.info(`Site app with id ${t.id} ${r?"loaded":"errored"}`),o&&n()};try{const{processEvent:r}=this.Tf(s=>t.init({posthog:this._instance,callback(a){s(),i(a)}}),!1);r&&(e.processEvent=r),o=!0}catch(r){d6.error(PGt+t.id,r),i(!1)}if(o&&e.loaded)try{n()}catch(r){d6.error(`Error while processing buffered events PostHog app with config id ${t.id}`,r),e.errored=!0}}If(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Mf(t){if(Object.keys(this.apps).length===0)return;const e=this.globalsForEvent(t);for(const n of Object.values(this.apps))try{this.Tf(()=>{var o;return(o=n.processEvent)===null||o===void 0?void 0:o.call(n,e)})}catch(o){d6.error(`Error while processing event ${t.event} for site app ${n.id}`,o)}}onRemoteConfig(t){var e,n,o;if(!((e=this.siteAppLoaders)===null||e===void 0)&&e.length)return this.isEnabled?(this.If(),void this._instance.on("eventCaptured",a=>this.Mf(a))):void d6.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.kf)===null||n===void 0||n.call(this),!t.ok)return;const i=t.config;if(!((o=i.siteApps)===null||o===void 0)&&o.length)if(this.isEnabled)for(const{id:a,url:A}of i.siteApps){var r,s;Vr[`__$$ph_site_app_${a}`]=this._instance,(r=Vr.__PosthogExtensions__)===null||r===void 0||(s=r.loadSiteApp)===null||s===void 0||s.call(r,this._instance,A,c=>{if(c)return d6.error(PGt+a,c)})}else d6.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},PYo={tracingHeaders:class{constructor(t){this._instance=t,this.Ef=void 0,this.Pf=void 0,this.Rf=void 0,this.Vv=()=>{const e=this.Af();var n,o;e?(Bo(this.Ef)&&(this.Ef=(n=Vr.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Bo(this.Pf)&&(this.Pf=(o=Vr.__PosthogExtensions__)===null||o===void 0||(o=o.tracingHeadersPatchFns)===null||o===void 0?void 0:o._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Xv()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,n,o;!((e=Vr.__PosthogExtensions__)===null||e===void 0)&&e.tracingHeadersPatchFns?t():(n=Vr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"tracing-headers",i=>{if(i)return tYo.error("failed to load script",i);t()})}Ff(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Af(){const t=this.Ff();return as(t)?(as(this.Rf)?this.Rf.splice(0,this.Rf.length,...t):this.Rf=[...t],t.length>0?this.Rf:void 0):(as(this.Rf)&&this.Rf.splice(0),this.Rf=t||void 0,this.Rf)}Xv(){var t,e;(t=this.Ef)===null||t===void 0||t.call(this),(e=this.Pf)===null||e===void 0||e.call(this),this.Ef=void 0,this.Pf=void 0}startIfEnabledOrStop(){this.Af()?this.zo(this.Vv):this.Xv()}}},MYo=sn({surveys:class extends sYo{constructor(t){var e;super(new uYo(t),(e=t,{get projectToken(){return e.config.token},kv:new lYo(e)})),this._instance=t}qh(t,e){const n=e.query?$$(t,e.query):t;return new Promise(o=>{var i;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((i=e.target)!==null&&i!==void 0?i:"api",n),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:o})})}}},Gge),DYo={toolbar:class{constructor(t){this.instance=t}Of(t){Vr.ph_toolbar_state=t}Df(){var t;return(t=Vr.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,e=void 0,n=void 0){var o,i;if(gNe(this.instance.config)||!Ln||!No)return!1;t=(o=t)!==null&&o!==void 0?o:Ln.location,n=(i=n)!==null&&i!==void 0?i:Ln.history;try{if(!e){try{Ln.localStorage.setItem("test","test"),Ln.localStorage.removeItem("test")}catch{return!1}e=Ln?.localStorage}const r=gYo||wge(t.hash,"__posthog")||wge(t.hash,"state");let s;const a=r?WLt(()=>JSON.parse(atob(decodeURIComponent(r))))||WLt(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action==="ph_authorize"?(s=a,s.source="url",s&&Object.keys(s).length>0&&(a.desiredHash?t.hash=a.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):(s=JSON.parse(e.getItem(NGt)||"{}"),s.source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Lf(t){const e=Vr.ph_load_toolbar||Vr.ph_load_editor;!Us(e)&&nf(e)?e(t,this.instance):RGt.warn("No toolbar load function found")}loadToolbar(t){const e=!!No?.getElementById("__POSTHOG_TOOLBAR__");if(!Ln||e)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,o=sn(sn({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Ln.localStorage.setItem(NGt,JSON.stringify(sn(sn({},o),{},{source:void 0}))),this.Df()===2)this.Lf(o);else if(this.Df()===0){var i,r;this.Of(1),(i=Vr.__PosthogExtensions__)===null||i===void 0||(r=i.loadExternalDependency)===null||r===void 0||r.call(i,this.instance,"toolbar",s=>{if(s)return RGt.error("[Toolbar] Failed to load",s),void this.Of(0);this.Of(2),this.Lf(o)}),Cl(Ln,"turbolinks:load",()=>{this.Of(0),this.loadToolbar(o)})}return!0}Nf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,n=void 0){return this.maybeLoadToolbar(t,e,n)}}},NYo=sn({experiments:class rx{get Rr(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(o=>{rx.qf("retrieved web experiments from the server"),this.jf=new Map,o.forEach(i=>{if(i.feature_flag_key){var r;this.jf&&(rx.qf("setting flag key ",i.feature_flag_key," to web experiment ",i),(r=this.jf)===null||r===void 0||r.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);rA(s)&&i.variants[s]&&this.Bf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const s in i.variants){const a=i.variants[s];rx.Hf(a,this._instance)&&this.Bf(i.name,s,a.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(e){if(this._is_bot())rx.qf(YGt);else if(!this.Rr.disable_web_experiments){if(Us(this.jf))return this.jf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();rx.qf("applying feature flags",e),e.forEach(n=>{var o;if(this.jf&&(!((o=this.jf)===null||o===void 0)&&o.has(n))){var i;const r=this._instance.getFeatureFlag(n),s=(i=this.jf)===null||i===void 0?void 0:i.get(n);r&&s?.variants[r]&&this.Bf(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){const e=rx.getWindowLocation();if(e?.search){const n=ZO(e?.search,"__experiment_id"),o=ZO(e?.search,"__experiment_variant");n&&o&&(rx.qf(`previewing web experiments ${n} && ${o}`),this.getWebExperiments(i=>{this.zf(parseInt(n),o,i)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,o){if(this.Rr.disable_web_experiments&&!o)return e([]);const i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:r=>e(r.statusCode===200&&r.json&&r.json.experiments||[])})}zf(e,n,o){const i=o.filter(r=>r.id===e);i&&i.length>0&&(rx.qf(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.Bf(i[0].name,n,i[0].variants[n].transforms))}static Hf(e,n){return!Us(e.conditions)&&rx.Uf(e,n)&&rx.Wf(e)}static Uf(e,n){var o;if(Us(e.conditions)||Us((o=e.conditions)===null||o===void 0?void 0:o.url))return!0;const i=rx.getWindowLocation();if(i){var r,s,a;const A=tOt(n,i.href);return!(!((r=e.conditions)===null||r===void 0)&&r.url)||fYo[(s=(a=e.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,A)}return!1}static getWindowLocation(){return Ln?.location}static Wf(e){var n;if(Us(e.conditions)||Us((n=e.conditions)===null||n===void 0?void 0:n.utm))return!0;const o=SOt();if(o.utm_source){var i,r,s,a,A,c,l,u;const g=!(!((i=e.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0)&&i.utm_campaign)||((r=e.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0?void 0:r.utm_campaign)==o.utm_campaign,h=!(!((s=e.conditions)===null||s===void 0||(s=s.utm)===null||s===void 0)&&s.utm_source)||((a=e.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==o.utm_source,d=!(!((A=e.conditions)===null||A===void 0||(A=A.utm)===null||A===void 0)&&A.utm_medium)||((c=e.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_medium)==o.utm_medium,p=!(!((l=e.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_term)||((u=e.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0?void 0:u.utm_term)==o.utm_term;return g&&d&&p&&h}return!1}static qf(e,...n){ui.info(`[WebExperiments] ${e}`,n)}Bf(e,n,o){this._is_bot()?rx.qf(YGt):n!=="control"?o.forEach(i=>{if(i.selector){var r;rx.qf(`applying transform of variant ${n} for experiment ${e} `,i);const s=(r=document)===null||r===void 0?void 0:r.querySelectorAll(i.selector);s?.forEach(a=>{const A=a;i.html&&(A.innerHTML=i.html),i.css&&A.setAttribute("style",i.css)})}}):rx.qf("Control variants leave the page unmodified.")}_is_bot(){return tf&&this._instance?lGt(tf,this.Rr.custom_blocked_useragents):void 0}}},Gge),RYo={conversations:class{constructor(t){this._instance=t,this.Vf=void 0,this._conversationsManager=null,this.Gf=!1,this.ne=null,this.Zf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations||(this.Qf=t.ok,!t.ok))return;const e=t.config.conversations;Us(e)||(jy(e)?this.Vf=e:(this.Vf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;(t=this._conversationsManager)===null||t===void 0||t.reset(),this._conversationsManager=null,this.Vf=void 0,this.ne=null,this.Qf=void 0,this.Zf=!1}loadIfEnabled(){if(this._conversationsManager||this.Gf||this._instance.config.disable_conversations||gNe(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=Vr?.__PosthogExtensions__;if(t&&!Bo(this.Vf)&&this.Vf)if(this.ne&&this.ne.token){this.Gf=!0;try{const e=t.initConversations;if(e)return this.Jf(e),void(this.Gf=!1);const n=t.loadExternalDependency;if(!n)return void this.Kf(cNe);n(this._instance,"conversations",o=>{o||!t.initConversations?this.Kf("Could not load conversations script",o):this.Jf(t.initConversations),this.Gf=!1})}catch(e){this.Kf("Error initializing conversations",e),this.Gf=!1}}else r4.error("Conversations enabled but missing token in remote config.")}Jf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Zf=!1,r4.info("Conversations loaded successfully")}catch(e){this.Kf("Error completing conversations initialization",e)}else r4.error("Cannot complete initialization: remote config is null")}Kf(t,e){r4.error(t,e),this._conversationsManager=null,this.Gf=!1,this.Zf=!0}show(){this._conversationsManager?this._conversationsManager.show():r4.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Vf===!0&&!Id(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":gNe(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Qf===!1?"remote_config_failed":Bo(this.Vf)?this.Qf?"disabled_in_project":"remote_config_pending":this.Vf?Us(this.ne)||!this.ne.token?"missing_token":Vr?.__PosthogExtensions__?this.Gf?"initializing":this.Zf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var o=this;return eg(function*(){return o._conversationsManager?o._conversationsManager.sendMessage(t,e,n):(r4.warn(bR),null)})()}getMessages(t,e){var n=this;return eg(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(r4.warn(bR),null)})()}markAsRead(t){var e=this;return eg(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(r4.warn(bR),null)})()}getTickets(t){var e=this;return eg(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(r4.warn(bR),null)})()}requestRestoreLink(t){var e=this;return eg(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(r4.warn(bR),null)})()}restoreFromToken(t){var e=this;return eg(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(r4.warn(bR),null)})()}restoreFromUrlToken(){var t=this;return eg(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(r4.warn(bR),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}Sh(){var t;(t=this._conversationsManager)===null||t===void 0||t.setIdentity()}xh(){var t;(t=this._conversationsManager)===null||t===void 0||t.clearIdentity()}}},TYo={logs:class{constructor(t){var e;this._instance=t,this.name="logs",this.Xf=!1,this.Yf=!1,this.tp=!1,this.$=Cd("[logs]"),this.ep=sn(sn({},this.$),{},{error:(...n)=>{n.some(zGt)||this.$.error(...n)}}),this.al=[],this.np=[],this.hd=0,this.Io=!1,this.sp=[],this.rp=[],this.op=!1,this.ap=!1,this.lp=()=>{var n,o;this.Io||(this.hd=0,(n=this.up)===null||n===void 0||n.onReconnect(),(o=this.hp)===null||o===void 0||o.onReconnect())},this._instance&&(!((e=this._instance.config.logs)===null||e===void 0)&&e.captureConsoleLogs)&&(this.Xf=!0),Ln&&Cl(Ln,"online",this.lp)}cp(t,e,n,o){var i;const r=UGt((i=this._instance)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.logs,n);return[new hOo(this.dp(t,e),r,this.ep,()=>this.vp(),s=>s(),void 0,o),r]}fp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var n;return this.up&&this.pp===e||((n=this.up)===null||n===void 0||n.reset(),this.pp=e,[this.up,this.gp]=this.cp(()=>this.al,o=>{this.al=o})),this.up}mp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var n;return this.hp&&this.yp===e||((n=this.hp)===null||n===void 0||n.reset(),this.yp=e,[this.hp,this.bp]=this.cp(()=>this.np,o=>{this.np=o},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},KGt)),this.hp}setup(t){var e;if(this.Io)return;this.wo=t,!((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0||(e=e.logs)===null||e===void 0)&&e.captureConsoleLogs&&(this.Xf=!0),(this.Xf||this._p()&&this.wp())&&this.kp();let n=!1;const o=t.onRemoteConfig(i=>{var r;n=i.ok&&((r=i.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(i)});this.Io?o.dispose():(this.Po=o,n||this.loadIfEnabled())}dispose(){var t,e,n,o;this.Io||(this.Io=!0,this.Sp(),(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,this.wo=void 0,this.tp=!1,Ln?.removeEventListener("online",this.lp),(e=this.xp)===null||e===void 0||e.call(this),this.xp=void 0,(n=this.up)===null||n===void 0||n.reset(),(o=this.hp)===null||o===void 0||o.reset())}onRemoteConfig(t){var e,n;if(this.Io)return;const o=t.ok?(e=t.config.logs)===null||e===void 0?void 0:e.captureConsoleLogs:void 0;Us(o)?this.Cp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!o}),o?(this.Xf=!0,this.Yf||this.kp(),this.loadIfEnabled()):this.Cp())}reset(){var t,e,n,o;this.Sp(),(t=this.up)===null||t===void 0||t.clearQueue(),this.al=[],(e=this.up)===null||e===void 0||e.reset(),(n=this.hp)===null||n===void 0||n.clearQueue(),this.np=[],(o=this.hp)===null||o===void 0||o.reset(),this.hd=0}captureLog(t){this.Io||this.fp().captureLog(t)}captureConsoleLog(t){this.Io||this.mp().captureLog(t)}captureBufferedConsoleLog(t,e,n){this.Io||this.mp().captureLog(t,{context:e,occurredAtMs:n})}wp(){var t;return!!(!((t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t[MHt])}_p(){var t,e,n;return!(!((t=this._instance)===null||t===void 0||(e=t.nl)===null||e===void 0)&&e.call(t))||!!(!((n=Vr._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}$h(){var t;this.Sp(),(t=this.hp)===null||t===void 0||t.clearQueue(),this.np=[]}Cp(){this.Xf||this.Sp()}kp(){var t;if(this.op||!Vr?.console)return;const e=UGt((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs).maxBufferSize;let n=!0;this.rp.push(()=>{n=!1});for(const o of IYo){let i;try{i=CYo(Vr.console[o])}catch{continue}i&&this.rp.push(oq(Vr.console,o,r=>{const s=(...a)=>{try{n&&this.$p(o,a,e)}catch{}return r.apply(Vr.console,a)};return s.__rrweb_original__=i,s}))}this.op=!0,this.Tp=setTimeout(()=>{this.Sp()},3e4)}$p(t,e,n){var o;if(this.op&&!this.ap&&e.length!==0)if(!((o=this._instance)===null||o===void 0)&&o.is_capturing()){if(n>this.sp.length){this.ap=!0;try{this.sp.push({level:t,args:e,occurredAtMs:Date.now(),context:this.vp()})}finally{this.ap=!1}}}else this.Sp()}Sp(){if(this.sp=[],this.op){this.op=!1,this.Tp&&(clearTimeout(this.Tp),this.Tp=void 0);for(const t of this.rp)t();this.rp=[]}}Ip(){const t=this.sp;return this.Sp(),t}get logger(){return this.Mp||(this.Mp={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Mp}flushLogs(t){t?this.Ep(t):(this.up&&this.up.flush().catch(e=>this.Pp(e)),this.hp&&this.hp.flush().catch(e=>this.Pp(e)))}Pp(t){zGt(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Io||!this.Xf||this.Yf||this.tp)return;const t=Vr?.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.Sp();const e=t.loadExternalDependency;if(!e)return this.$.error(cNe),void this.Sp();this.tp=!0;try{e(this._instance,"logs",n=>{if(this.tp=!1,this.Io||!this.Xf)return;const o=t.logs;if(n||!o?.initializeLogs)this.$.error("Could not load logs script",n),this.Sp();else{var i;const a=this.Ip();var r,s;this.xp=o.initializeLogs((i=this.wo)!==null&&i!==void 0?i:this._instance),this.Yf=!0,a.length>0&&((r=o.replayConsoleBuffer)===null||r===void 0||r.call(o,(s=this.wo)!==null&&s!==void 0?s:this._instance,a))}})}catch(n){throw this.tp=!1,n}}dp(t,e){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:o=>o===c6.LogsQueue?t():void 0,setPersistedProperty(o,i){var r;o===c6.LogsQueue&&e((r=i)!==null&&r!==void 0?r:[])},js:o=>this.js(o),getLibraryId:()=>n_.LIB_NAME,getLibraryVersion:()=>n_.LIB_VERSION}}js(t){return new Promise(e=>{if(BOt(this.hd,3))return void e({kind:"fatal",error:ZNe(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const o=r=>{n||(n=!0,clearTimeout(i),e(r))},i=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),o({kind:"retry-later",error:ZNe(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Rp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{const s=r.statusCode;if(this.Ap(s),s>=200&&300>s)o({kind:"ok"});else if(s===413)o({kind:"too-large"});else if(s!==0&&s!==408&&s!==429&&500>s)o({kind:"fatal",error:new Error(`logs request failed with status ${s}`)});else{var a;s===0?(r.error||this.$.warn("Logs request failed before receiving an HTTP response"),o({kind:"retry-later",error:ZNe(r.error,"logs request failed before receiving an HTTP response")})):o({kind:"retry-later",error:(a=r.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${s}`)})}}})})}Ap(t){(t!==0||this._instance.__loaded)&&(this.hd=bOt(t,this.hd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Ep(t){this.al.length>0&&this.Fp(t,this.al,this.gp,n_.LIB_NAME,e=>{this.al=e}),this.np.length>0&&this.Fp(t,this.np,this.bp,KGt,e=>{this.np=e})}Fp(t,e,n,o,i){if(e.length===0)return;const r=e.map(a=>a.record);i([]);const s=IHt(r,fHt(n,n_.LIB_NAME,n_.LIB_VERSION),o,n_.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Rp(),data:s,compression:"best-available",batchKey:"logs",transport:t})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}vp(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:o,sessionStartTimestamp:i,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n,e.windowId=o,Us(i)||(e.sessionStartTimestamp=i),Us(r)||(e.lastActivityTimestamp=r)}if(!(Vr==null||(t=Vr.location)===null||t===void 0)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Qw(Vr.location.href):Vr.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(e.activeFeatureFlags=n)}return e}}},kYo={metrics:class{constructor(t){this._instance=t,this.$=Cd("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Io)return;const e=!!(!((t=this._instance.config.metrics)===null||t===void 0)&&t.network);e&&!this.Op?this.Op=(n=>{let o=!0;const i=()=>o?(a=>{var A;const c=(A=a.config.metrics)===null||A===void 0?void 0:A.network;return c===!0?{}:c||void 0})(n):void 0,r=EYo(n,i),s=BYo(n,i);return()=>{o=!1,r(),s()}})(this._instance):!e&&this.Op&&(this.Op(),this.Op=void 0)}fp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.metrics;var n;return this.up&&this.pp===e||((n=this.up)===null||n===void 0||n.reset(),this.pp=e,this.up=new pOo(this.dp(),(function(o){var i,r,s,a,A;const c=o?.resourceAttributes;return{serviceName:(i=c?.["service.name"])!==null&&i!==void 0?i:o?.serviceName,serviceVersion:(r=c?.["service.version"])!==null&&r!==void 0?r:o?.serviceVersion,environment:(s=c?.["deployment.environment"])!==null&&s!==void 0?s:o?.environment,resourceAttributes:c,beforeSend:o?.beforeSend,flushIntervalMs:(a=o?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(A=o?.maxSeriesPerFlush)!==null&&A!==void 0?A:1e3}})(e),this.$)),this.up}count(t,e=1,n){this.fp().count(t,e,n)}gauge(t,e,n){this.fp().gauge(t,e,n)}histogram(t,e,n){this.fp().histogram(t,e,n)}flush(t){if(!this.up)return Promise.resolve();if(t){const e=this.up.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.up.flush().catch(e=>this.$.error("PostHog metrics flush failed:",e))}reset(){var t;(t=this.up)===null||t===void 0||t.reset()}dispose(){var t,e;this.Io=!0,(t=this.Op)===null||t===void 0||t.call(this),this.Op=void 0,(e=this.up)===null||e===void 0||e.reset()}dp(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:n=>e.Ys(n),getLibraryId:()=>n_.LIB_NAME,getLibraryVersion:()=>n_.LIB_VERSION}}Ys(t,e){return new Promise(n=>{let o=!1;const i=s=>{o||(o=!0,clearTimeout(r),n(s))},r=setTimeout(()=>i({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(sn(sn({method:"POST",url:this.Dp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(s){const a=s.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var A;i({kind:"retry-later",error:(A=s.error)!==null&&A!==void 0?A:new Error(`metrics request failed with status ${a}`)})}}}))})}Dp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};tq.__defaultExtensionClasses=sn({},sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn({},Gge),bYo),SYo),QYo),vYo),wYo),MYo),PYo),DYo),NYo),RYo),TYo),kYo));var aG=(function(){n_.SDK_DIST_CHANNEL="npm";const t=q$[eq]=new tq;return(function(){function e(){e.done||(e.done=!0,rGt=!1,Tl(q$,function(n){n._dom_loaded()}))}No?.addEventListener?No.readyState==="complete"?e():Cl(No,"DOMContentLoaded",e,{capture:!1}):Ln&&ui.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();class Wb extends Error{response;request;options;constructor(e,n,o){const i=e.status||e.status===0?e.status:"",r=e.statusText??"",s=`${i} ${r}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${n.method} ${n.url}`),this.name="HTTPError",this.response=e,this.request=n,this.options=o}}class jGt extends Error{name="NonError";value;constructor(e){let n="Non-error value was thrown";try{typeof e=="string"?n=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(n=e.message)}catch{}super(n),this.value=e}}class nRe extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const n=e?.cause?e.cause instanceof Error?e.cause:new jGt(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",n?{cause:n}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const $Gt=(()=>{let t=!1,e=!1;const n=typeof globalThis.ReadableStream=="function",o=typeof globalThis.Request=="function";if(n&&o)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),FYo=typeof globalThis.AbortController=="function",qGt=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",LYo=typeof globalThis.ReadableStream=="function",HYo=typeof globalThis.FormData=="function",XGt=["get","post","put","patch","head","delete"],OYo={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},oRe=2147483647,GYo=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,ZGt=Symbol("stop");class eYt{options;constructor(e){this.options=e}}const YYo=t=>new eYt(t),UYo={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},KYo={next:!0},VYo={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},zYo=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[n,o]of t)e+=GYo,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,e+=typeof o=="string"?new TextEncoder().encode(o).length:o.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{const e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},tYt=(t,e,n)=>{let o,i=0;return t.pipeThrough(new TransformStream({transform(r,s){if(s.enqueue(r),o){i+=o.byteLength;let a=e===0?0:i/e;a>=1&&(a=1-Number.EPSILON),n?.({percent:a,totalBytes:Math.max(e,i),transferredBytes:i},o)}o=r},flush(){o&&(i+=o.byteLength,n?.({percent:1,totalBytes:Math.max(e,i),transferredBytes:i},o))}}))},JYo=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});const n=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(tYt(t.body,n,e),{status:t.status,statusText:t.statusText,headers:t.headers})},WYo=(t,e,n)=>{if(!t.body)return t;const o=zYo(n??t.body);return new Request(t,{duplex:"half",body:tYt(t.body,o,e)})},SR=t=>t!==null&&typeof t=="object",Yge=(...t)=>{for(const e of t)if((!SR(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return iRe({},...t)},nYt=(t={},e={})=>{const n=new globalThis.Headers(t),o=e instanceof globalThis.Headers,i=new globalThis.Headers(e);for(const[r,s]of i.entries())o&&s==="undefined"||s===void 0?n.delete(r):n.set(r,s);return n};function Uge(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:iRe(t[n]??[],e[n]??[])}const oYt=(t={},e={})=>({beforeRequest:Uge(t,e,"beforeRequest"),beforeRetry:Uge(t,e,"beforeRetry"),afterResponse:Uge(t,e,"afterResponse"),beforeError:Uge(t,e,"beforeError")}),jYo=(t,e)=>{const n=new URLSearchParams;for(const o of[t,e])if(o!==void 0)if(o instanceof URLSearchParams)for(const[i,r]of o.entries())n.append(i,r);else if(Array.isArray(o))for(const i of o){if(!Array.isArray(i)||i.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");n.append(String(i[0]),String(i[1]))}else if(SR(o))for(const[i,r]of Object.entries(o))r!==void 0&&n.append(i,String(r));else{const i=new URLSearchParams(o);for(const[r,s]of i.entries())n.append(r,s)}return n},iRe=(...t)=>{let e={},n={},o={},i;const r=[];for(const s of t)if(Array.isArray(s))Array.isArray(e)||(e=[]),e=[...e,...s];else if(SR(s)){for(let[a,A]of Object.entries(s)){if(a==="signal"&&A instanceof globalThis.AbortSignal){r.push(A);continue}if(a==="context"){if(A!=null&&(!SR(A)||Array.isArray(A)))throw new TypeError("The `context` option must be an object");e={...e,context:A==null?{}:{...e.context,...A}};continue}if(a==="searchParams"){A==null?i=void 0:i=i===void 0?A:jYo(i,A);continue}SR(A)&&a in e&&(A=iRe(e[a],A)),e={...e,[a]:A}}SR(s.hooks)&&(o=oYt(o,s.hooks),e.hooks=o),SR(s.headers)&&(n=nYt(n,s.headers),e.headers=n)}return i!==void 0&&(e.searchParams=i),r.length>0&&(r.length===1?e.signal=r[0]:qGt?e.signal=AbortSignal.any(r):e.signal=r.at(-1)),e},$Yo=t=>XGt.includes(t)?t.toUpperCase():t,iYt={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},qYo=(t={})=>{if(typeof t=="number")return{...iYt,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.methods&&=t.methods.map(n=>n.toLowerCase()),t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");const e=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));return{...iYt,...e}};class rRe extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function XYo(t,e,n,o){return new Promise((i,r)=>{const s=setTimeout(()=>{n&&n.abort(),r(new rRe(t))},o.timeout);o.fetch(t,e).then(i).catch(r).then(()=>{clearTimeout(s)})})}async function ZYo(t,{signal:e}){return new Promise((n,o)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(r),o(e.reason)}const r=setTimeout(()=>{e?.removeEventListener("abort",i),n()},t)})}const eUo=(t,e)=>{const n={};for(const o in e)Object.hasOwn(e,o)&&!(o in VYo)&&!(o in UYo)&&(!(o in t)||o in KYo)&&(n[o]=e[o]);return n},tUo=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;function nUo(t){return t instanceof Wb||t?.name===Wb.name}function oUo(t){return t instanceof rRe||t?.name===rRe.name}let rYt=class mit{static create(e,n){const o=new mit(e,n),i=async()=>{if(typeof o.#e.timeout=="number"&&o.#e.timeout>oRe)throw new RangeError(`The \`timeout\` option cannot be greater than ${oRe}`);await Promise.resolve();let s=await o.#_();for(const a of o.#e.hooks.afterResponse){const A=o.#g(s.clone());let c;try{c=await a(o.request,o.#u(),A,{retryCount:o.#i})}catch(u){throw o.#A(A),o.#A(s),u}if(c instanceof eYt)throw o.#A(A),o.#A(s),new nRe(c.options);const l=c instanceof globalThis.Response?c:s;A!==l&&o.#A(A),s!==l&&o.#A(s),s=l}if(o.#g(s),!s.ok&&(typeof o.#e.throwHttpErrors=="function"?o.#e.throwHttpErrors(s.status):o.#e.throwHttpErrors)){let a=new Wb(s,o.request,o.#u());for(const A of o.#e.hooks.beforeError)a=await A(a,{retryCount:o.#i});throw a}if(o.#e.onDownloadProgress){if(typeof o.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!LYo)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const a=s.clone();return o.#A(s),JYo(a,o.#e.onDownloadProgress)}return s},r=o.#m(i).finally(()=>{const s=o.#s;o.#d(s?.body??void 0),o.#d(o.request.body??void 0)});for(const[s,a]of Object.entries(OYo))s==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(r[s]=async()=>{o.request.headers.set("accept",o.request.headers.get("accept")||a);const A=await r;if(s==="json"){if(A.status===204)return"";const c=await A.text();return c===""?"":n.parseJson?n.parseJson(c):JSON.parse(c)}return A[s]()});return r}static#o(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)):e}request;#n;#i=0;#t;#e;#s;#r;#c;constructor(e,n={}){if(this.#t=e,this.#e={...n,headers:nYt(this.#t.headers,n.headers),hooks:oYt({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:$Yo(n.method??this.#t.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:qYo(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}FYo&&qGt&&(this.#r=this.#e.signal??this.#t.signal,this.#n=new globalThis.AbortController,this.#e.signal=this.#r?AbortSignal.any([this.#r,this.#n.signal]):this.#n.signal),$Gt&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const o=n.headers&&new globalThis.Headers(n.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(HYo&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!o&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),tUo(this.#e.searchParams)){const r="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(mit.#o(this.#e.searchParams)).toString()),s=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,r);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!$Gt)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#p(this.request,this.#e.body??void 0)}}#a(){const e=this.#e.retry.delay(this.#i);let n=e;this.#e.retry.jitter===!0?n=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(n=this.#e.retry.jitter(e),(!Number.isFinite(n)||n<0)&&(n=e));const o=this.#e.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(o,n)}async#l(e){if(this.#i++,this.#i>this.#e.retry.limit)throw e;const n=e instanceof Error?e:new jGt(e);if(n instanceof nRe)return n.customDelay??this.#a();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){const o=await this.#e.retry.shouldRetry({error:n,retryCount:this.#i});if(o===!1)throw e;if(o===!0)return this.#a()}if(oUo(e)&&!this.#e.retry.retryOnTimeout)throw e;if(nUo(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;const o=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(o&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let i=Number(o)*1e3;Number.isNaN(i)?i=Date.parse(o)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());const r=this.#e.retry.maxRetryAfter??i;return i<r?i:r}if(e.response.status===413)throw e}return this.#a()}#g(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}#d(e){e&&e.cancel().catch(()=>{})}#A(e){this.#d(e.body??void 0)}async#m(e){try{return await e()}catch(n){const o=Math.min(await this.#l(n),oRe);if(this.#i<1)throw n;if(await ZYo(o,this.#r?{signal:this.#r}:{}),n instanceof nRe&&n.customRequest){const i=this.#e.signal?new globalThis.Request(n.customRequest,{signal:this.#e.signal}):new globalThis.Request(n.customRequest);this.#h(i)}for(const i of this.#e.hooks.beforeRetry){const r=await i({request:this.request,options:this.#u(),error:n,retryCount:this.#i});if(r instanceof globalThis.Request){this.#h(r);break}if(r instanceof globalThis.Response)return r;if(r===ZGt)return}return this.#m(e)}}async#_(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#r?AbortSignal.any([this.#r,this.#n.signal]):this.#n.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const n of this.#e.hooks.beforeRequest){const o=await n(this.request,this.#u(),{retryCount:this.#i});if(o instanceof Response)return o;if(o instanceof globalThis.Request){this.#h(o);break}}const e=eUo(this.request,this.#e);return this.#s=this.request,this.request=this.#s.clone(),this.#e.timeout===!1?this.#e.fetch(this.#s,e):XYo(this.#s,e,this.#n,this.#e)}#u(){if(!this.#c){const{hooks:e,...n}=this.#e;this.#c=Object.freeze(n)}return this.#c}#h(e){this.#c=void 0,this.request=this.#p(e)}#p(e,n){return!this.#e.onUploadProgress||!e.body?e:WYo(e,this.#e.onUploadProgress,n??this.#e.body??void 0)}};const sRe=t=>{const e=(n,o)=>rYt.create(n,Yge(t,o));for(const n of XGt)e[n]=(o,i)=>rYt.create(o,Yge(t,i,{method:n}));return e.create=n=>sRe(Yge(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),sRe(Yge(t,n))),e.stop=ZGt,e.retry=YYo,e},iUo=sRe();class rUo extends Wb{constructor(e,n,o,i){super(e,n,o),this.name="RegistryHTTPError",this.message=i}}function iq(t){return typeof window<"u"?window[t]:null}function Tw(){const t=iq("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",e=iq("TSCIRCUIT_REGISTRY_TOKEN");return iUo.create({prefixUrl:t,headers:{Authorization:`Bearer ${e}`},timeout:3e4,hooks:{afterResponse:[async(n,o,i)=>{if(i.ok)return i;let r=null;try{r=await i.clone().json()}catch(u){console.error("Failed to parse registry error response",u)}const s=r?.error?.message??r?.error?.error_message??r?.message,a=r?.error?.error_code??r?.error_code,A=new URL(i.url),l=[`Registry request failed for ${`${A.pathname}${A.search}`} (${i.status})`];throw s&&l.push(`Server message: ${s}`),a&&l.push(`Error code: ${a}`),new rUo(i,n,o,l.join(" | "))}]}})}function Kge(){return!!iq("TSCIRCUIT_REGISTRY_TOKEN")}const rq={get:(t,e)=>Tw().get(t,e),post:(t,e)=>Tw().post(t,e),put:(t,e)=>Tw().put(t,e),delete:(t,e)=>Tw().delete(t,e),patch:(t,e)=>Tw().patch(t,e)},sUo="phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",aUo="https://postpig.tscircuit.com",sYt="runframe:anonymous-id",aRe=()=>typeof window<"u",aYt=t=>t.includes("localhost")||t.includes("127.0.0.1"),AUo=t=>{try{return new URL(t).hostname}catch{return null}},cUo=()=>{if(!aRe())return null;let t=null;return document.referrer&&(t=AUo(document.referrer)),t??window.location.hostname},lUo=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,uUo=()=>{if(!aRe())return null;try{const t=window.localStorage.getItem(sYt);if(t)return t;const e=lUo();return window.localStorage.setItem(sYt,e),e}catch{return null}},gUo=()=>iq("TSCIRCUIT_USE_RUNFRAME_FOR_CLI")===!0,AYt=()=>!aRe()||aYt(window.location.hostname)&&!gUo()?!1:(aG.__loaded||aG.init(sUo,{api_host:aUo,person_profiles:"always"}),!0),dUo=()=>{if(!AYt())return null;const t=cUo(),e=t!=null&&!aYt(t);let n=null;e||(n=uUo());let o,i;return e?(o=`domain:${t}`,i="domain"):(o=void 0,n&&(o=`anonymous:${n}`),i="anonymous_id"),{embedDomain:t,anonymousId:n,distinctId:o,identityType:i}},hUo=(t,{source:e,...n})=>{const o=dUo();if(!o)return;const{embedDomain:i,anonymousId:r,distinctId:s,identityType:a}=o;if(s){const A={};a==="domain"&&i&&(A.embed_domain=i),a==="anonymous_id"&&r&&(A.runframe_anonymous_id=r),aG.identify(s,A)}aG.capture(t,{...n,source:e,embed_domain:i,runframe_anonymous_id:r,identity_type:a})},pUo=t=>{hUo("runframe_activity",t)};AYt();function mUo(t){const e=String.fromCodePoint(...t);return btoa(e)}function _Uo(t,e){const n=JSON.stringify(t),o=PQe(MQe(n));return`https://tscircuit.com/editor?#data:application/gzip;base64,${mUo(o)}`}function Hi(...t){return lHo(DB(t))}const cYt=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),ARe=NLo,Vge=ee.forwardRef(({className:t,...e},n)=>K.jsx(WFt,{ref:n,className:Hi("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",t),...e}));Vge.displayName=WFt.displayName;const h6=ee.forwardRef(({className:t,...e},n)=>K.jsx(jFt,{ref:n,className:Hi("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",t),...e}));h6.displayName=jFt.displayName;const cI=ee.forwardRef(({className:t,...e},n)=>K.jsx($Ft,{ref:n,className:Hi("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",t),...e}));cI.displayName=$Ft.displayName;const lYt="T1RUTwAJAIAAAwAQQ0ZGIFhQSpcAAAcwAABJ3U9TLzJqmmVhAAABAAAAAGBjbWFwFN0WswAABEwAAALEaGVhZC1P1HwAAACcAAAANmhoZWEDrgI1AAAA1AAAACRobXR44xAAAAAAURAAAAFQbWF4cABUUAAAAAD4AAAABm5hbWUZQ94BAAABYAAAAutwb3N0AAMAAAAABxAAAAAgAAEAAAABAADb+Z65Xw889QADA+gAAAAA5e9IsgAAAADl70iy/9P/PwKHAvkAAAADAAIAAAAAAAAAAQAAA6z/LAAAArQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAFQAAFAAAFQAAAADArQB9AAFAAACigK7AAAAjAKKArsAAAHfADEBAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAABYWFhYAEAAIQB6A6z/LAAAAvkAwQAAAAEAAAAAAiwC1wAAAAAAAAAAACIBngABAAAAAAAAAAEAWQABAAAAAAABABEAAAABAAAAAAACAAcAMwABAAAAAAADABsA/AABAAAAAAAEABkASAABAAAAAAAFAAsA2wABAAAAAAAGABgAkwABAAAAAAAHAAEAWQABAAAAAAAIAAEAWQABAAAAAAAJAAEAWQABAAAAAAAKAAEAWQABAAAAAAALAAEAWQABAAAAAAAMAAEAWQABAAAAAAANAAEAWQABAAAAAAAOAAEAWQABAAAAAAAQABEAAAABAAAAAAARAAcAMwADAAEECQAAAAIAgwADAAEECQABACIAEQADAAEECQACAA4AOgADAAEECQADADYBFwADAAEECQAEADIAYQADAAEECQAFABYA5gADAAEECQAGADAAqwADAAEECQAHAAIAgwADAAEECQAIAAIAgwADAAEECQAJAAIAgwADAAEECQAKAAIAgwADAAEECQALAAIAgwADAAEECQAMAAIAgwADAAEECQANAAIAgwADAAEECQAOAAIAgwADAAEECQAQACIAEQADAAEECQARAA4AOlRzY2lyY3VpdEFscGhhYmV0AFQAcwBjAGkAcgBjAHUAaQB0AEEAbABwAGgAYQBiAGUAdFJlZ3VsYXIAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0IFJlZ3VsYXIAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgBUAHMAYwBpAHIAYwB1AGkAdABBAGwAcABoAGEAYgBlAHQAUgBlAGcAdQBsAGEAclZlcnNpb24gMC4xAFYAZQByAHMAaQBvAG4AIAAwAC4AMSA6VHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhcgAgADoAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAcgAAAAABAAMAAQAAAAwABAK4AAAAqgCAAAYAKgAAACEAIgAjACQAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA8AD0APgBBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGEAYgBjAGQAZQBmAGcAaABpAGoAawBsAG0AbgBvAHAAcQByAHMAdAB1AHYAdwB4AHkAev//AAAAAAAhACIAIwAkACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAPAA9AD4AQQBCAEMARABFAEYARwBIAEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAVgBXAFgAWQBaAFsAXABdAF4AXwBhAGIAYwBkAGUAZgBnAGgAaQBqAGsAbABtAG4AbwBwAHEAcgBzAHQAdQB2AHcAeAB5AHr//wAA/+D/4P/g/+D/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/c/9z/3P/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2QABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEABAEAAQEBGVRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgABAQEo+BsA+BwC+B0D+B4Ei/tV+kD5SAUdAAABOQ8dAAAB4BGLHQAASd0SAFcBAQwlNj0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkFZlcnNpb24gMC4xVHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhclRzY2lyY3VpdEFscGhhYmV0UmVndWxhciEiIyQnKCkqKywtLi8wMTIzNDU2Nzg5PD0+QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2FiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6AAAAAYsBjAGNAY4BjwGQAZEBkgGTAZQBlQGWAZcBmAGZAZoBmwGcAZ0BngGfAaABoQGiAaMBpAGlAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AbUBtgG3AbgBuQG6AbsBvAG9Ab4BvwHAAcEBwgHDAcQBxQHGAccByAHJAcoBywHMAc0BzgHPAdAB0QHSAdMB1AHVAdYB1wHYAdkB2gHbAdwB3QBUAgABAAQAeADuAgwFUgWPBmUHOwffCGMIzwkMCUgJhQq1CzwMhg5ADwwQUBHfEt8U3hYZFqIXFxeiGEIZtBsIHCccsh0sHpIfGh9XIC8gtiEFIjwjJSRTJWUmviftKXQp2CqzK0gsfS0ILW8uPy6iLuAvQy+2L/IxEDItM0A0XjWWNlQ39zjFOTk59zp9Oro76Dy1Pd8+/EAaQJVCDELOQ49EGEVZReRGgUdR+UgO+Uj37vlBFYv8VgWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+FYFjpsFlZkFmpQFnI8FnIcFmoIFlX0FL/z3Fe+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBSeLBXqOBX2UBYGZBYebBY+bBZWZBZmUBQ75SPdm+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQX3p3sVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj3XvcoFYAiBYZ7BYB/BXyDBXmJBXqQBX6VBYOaBYmbBZPgBSR/BXqMBXuSBX+YBYaaBYycBZOaBZiVBZyRBfcPmgWe91QFKH8FeYwFfJIFf5gFhZoFjZwFkpkFmZYFm5EF9wyZBZ33RgWQmgWWmAWakwWdjQWchgWYgQWUfAWMewV7+zIF9zifBZr3JgWQmgWWmAWbkwWcjQWchgWZgQWTfAWNewV++xMF8JcFnIoFm4QFl34FkHwFinoFg30FfoAFeoUF+w19BXj7VQXslwWdigWahAWXfwWRewWKegWDfQV+gAV6hgX7CnwFfvscBYZ7BX9/BXyDBXqJBXqQBX2VBYOaBYmbBZf3CQX7MM0V9zifBZ/3VAX7OHcFDvlI9/T5XhWL/awFiHoFgX4FfIEFeogFeo4FfJUFgpgFh5wFi/msBY+bBZSZBZqUBZyOBZyIBZqCBZV9BfcB+2YVNd0FgpkFiJsFjpsFlZkFmpQFnI4FnIcFmoIF4DkFlX0FjnoFh3sFgX4FfYIFeYgFeo4FQ9sV+z+bBXuQBX2VBYOaBYmbBZCbBZeYBZqTBZ2MBfc+ewWchgWZgAWTfQWMegWGfAWAfgV8gwX7LqUVKjgFe4MFeogFeo8FfZUFgpkFiJwFkJsFlZgF7d4FmpMFnI0FnIcFmYEFlH0FjnsFh3sFLD4VZvsHBYN8BX2BBXqGBXqMBXuTBYCYBYabBY2bBa/3CAWTmQWZlgWckAWciQWbgwWWfwWQewVkIRWkSQWNegWHewWAfgV8gwV6iQV6jwV9lQWCmQVyzQWJmwWPmwWWmQWakwWcjQWchwWZgQWdTxXUWgWXfwWRewWKewWEfAV+fwV7hgV5iwV7kgVCvQV/lwWFmgWLnAWTmgWYlgWbkQWdigXTWhX3fFkFm4QFl38FkXwFi3oFhHwFfoAFe4UFeYwF+3y8BXuSBX+XBYWaBYycBZKaBZeWBZyRBfedUhXVWgWWfwWSewWKewWEfAV+fwV6hgV6iwV7kgVCvAV/mAWFmgWLnAWTmgWXlgWckQWcigX2PBWjOAWMewWGewV/fgV8hAV5igV6kAV+lgWDmQVz3gWKmwWQmwWXmAWakgWdjAWbhgWZgAWp+xAVW/sHBYF9BX2BBXqIBXmOBX2UBYGYBYebBY6cBbz3BwWUmQWalQWcjgWciAWaggWVfQWPewU/+y8V+w5aBXqHBXmOBX2UBYGZBYebBY6bBZWZBZmUBfcOvQWcjgWciAWaggWVfgWPewWIewWBfQX7M00V+zObBXuQBX2WBYOZBYqcBZCaBZaYBZuTBZyMBfczewWchgWYgAWTfAWNewWFewWAfwV7gwX7VqAVNb0Ff5YFg5oFi5sFkZsFl5cFm5IFnIsFnIYF4FkFmIAFknwFjHoFhXwFf38Fe4QFeYoF+wzZFWbuBYmbBY+bBZaYBZqUBZyNBZyHBZmBBZR9BbAnBY17BYd7BYB+BXyDBXmIBXqQBX2VBQ75SPfu+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj4Ko0VsmUFlX0FjnsFh3sFgX0FfYIFeYgFeo8FfZQFYrMFio0FiYwFY7sFiowFiowFYsMFiowFiowFY8oFio4FiY0FbcoFio4FiY4Fd8oFi44Fio0FgcMFi5IFi5IFlcMFjI0Fi44Fn8oFjY4FjI4FqcoFjY0FjI4Fs8oFjIwFjIwFtMMFjIwFjIwFs7sFjYwFjI0FtLMFmZQFnI8FnYgFmYIFlX0Fj3sFiHsFgX0FZGUFZV4FZFUFZE8Fb1AFeFEFg10Fk10FnlEFp1AFsk8FslUFDvlI95tWFYqJBWJjBX2CBXqHBXmOBX2UBYGZBYebBY6bBZWZBbKxBbG4BbLBBbLHBafGBZ7FBZO5BYO5BXjFBW/GBWTHBWTBBWW4BWSxBYGZBYibBY+bBZWZBZqUBZyOBZyHBZmCBbRjBYyJBY2KBbRbBYuKBY2KBbNTBYyKBYyKBbRMBYuIBY2JBapMBYuIBY2IBZ9MBYuIBYyJBZVTBYuEBYuEBYFTBYqJBYuIBXdMBYmIBYuIBWxMBYmJBYuIBWJMBYqKBYqKBWNTBYmKBYuKBWJbBQ75SPeU+FUV+zRWBXqIBXqPBX2VBYKZBYicBY+bBZaYBZqTBfc5wgUh9yQFhJoFi5sFkZsFmJYFm5IFnIsFm4UFmIAF8fsfBfH3HwWYlgWbkQWciwWchAWXgAWRewWLewWEfAUh+yQF9zlUBZqDBZZ+BY97BYh6BYJ9BX2BBXqHBXqOBfs0wAWL+yoFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFDvlI95T39hWL90sFjpwFlZgFmpUFnI4FnIgFmoEFlX4FjnoFi/tLBfdpiwWciAWaggWVfQWOewWIegWBfgV8ggV6hwX7aYsFi/tLBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3SwX7aYsFeo8FfJQFgZgFiJwFjpsFlZkFmpQFnI4FDvlI96puFcJVBZV9BY56BYd7BYF+BXyCBXqIBXqOBX2VBTXfBYeRBYaRBYuMBYqMBYqSBYmSBYyMBYqMBY2SBYyTBYyLBYuMBZCRBY+RBfc/9zwFmpUFnI4FnIgFmoMFlX0Fj3sFiHsFgX0FDvlI90L35RX3kosFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogF+5KLBXqOBXyUBYGZBYibBY6bBZWZBZqUBQ75SPf/7RX7D4sFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9w+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBQ75SKOAFfhx+WMFl5cFm5EFnYwFm4UFmIAFknwFjHoFhXwF/HH9YwV/fwV7hQV5igV7kQV+lgWEmgWKnAUO+Uj4CfkPFUOeBUN4BUZQBWMvBYH7JQWj+wwFxi0F2F0FyYsF2LkFxukFo/cMBYH3JQVj5wVq9x4VjYoFkYgFkYgFjIoFjYoF4EEFi4sFjIoFj4UFkIUFi4oFjIoFuSEFjIQFjYUFlvsyBYqGBYuGBXH7GQWIhQWJhAVH+wIFiYoFiokFhocFh4YFiYoFiooFKVEFh4kFiIkFhooFh4oFh4sFh4oFM4sFh4wFh4sFh4wFhowFiI0Fh40FKcUFiowFiYwFh5AFho8Fio0FiowFRvcCBYmSBYiRBXH3GQWLkAWKkAWW9zIFjZEFjJIFufUFjIwFi4wFkJEFj5EFjIwFjIsF39UFjYwFjIwFkY4FkY4FjYwFjYsF6aMFjowFjowFkYoFkYwFjooFjooF6XMFDvlI9/v5ZRWQjgWNjAWNjAWSiwWSjQWMigWNiwWSigWSiQWMigWNiwWRhwWQhwWMigWNigWOhQWPhQWMigWLiQWMhQWNhAWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/i2BTRFBXuDBXqJBXqPBX2WBYOZBYmbBY+bBZaYBfc19xUFDvlI90rmFffoiwWdiAWZggWVfQWOewWIewWBfQV9ggV5iAX8TosFg4wFg4wFiowFiosFhY8FhI8Fi4sFiowFhpEFh5EFi4wFiowFipIFiZIFi4wFi4wFjJIFjJIFjIwFi4wFj5EFj5EF9zn3PgX3L/dKBcTlBZezBYueBYOqBXeiBV6dBUaQBWaGBVBzBWttBX9mBYN9BX6ABXqGBXmNBXyTBYCYBYaaBYycBZu6BYuMBYyNBY+QBY6RBYyMBYyNBbi2BYuLBYuLBZOQBZKQBYuLBYuLBdWoBZCNBZGMBbqSBZCKBZCMBd2FBZKJBZKKBclxBYyKBY2LBZCHBZGHBYyKBY2JBaxlBYyKBYuKBY+FBY6EBYuKBYyKBZdeBYuFBYyGBYptBYqGBYuGBX1ZBYiFBYmGBUwpBYmJBYqJBfsy+04FiooFiooFDvlI9wqUFYeMBVObBXySBX+YBYabBY2bBZOaBZmVBZuQBZ2KBcB8BdeABeiJBb2WBdGxBbW2BZy5BYOvBWWzBUStBTSiBT2UBYiMBYiLBYWOBYaMBYmNBYiNBYePBYeOBYmOBYmNBYmQBYmQBYuOBYqOBYuQBYuRBYyNBYuOBY2QBY2QBY2NBY2OBY+PBY+PBY6MBY2NBZCNBZGNBY6LBY6MBduVBeKdBdGpBauoBZGqBXWtBV2uBUagBTyPBUp2BVZxBWhxBXyEBXmKBXuQBX2WBYOZBYqcBZCaBZeYBbCnBY+MBY6OBceoBY6MBY6NBdikBZOMBZSMBemGBZCKBZGKBd1yBZKIBZOHBcVeBZCGBZCGBa9UBY2EBY6FBYuKBYyKBYqEBYuDBYBQBYmHBYqHBYmIBYmHBYiIBYiHBVxfBYWGBYSHBUduBdFqBZGGBZKHBcBUBYyIBY6JBY2GBY6HBYuIBY2HBZZQBYuJBYyIBYqFBYuGBYqIBYuJBXNKBYuLBYuLBYeEBYaEBYuLBYuLBVZUBYWHBYaHBTlfBYWJBYWIBU19BYWLBYWKBSeNBYiMBYiLBTmWBQ75SPgF98IVi+oFj5sFlJgFmpUFnI4FnIgFmoEFlX4FjnsFiywF6YsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogFLYsFi/s9BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3PQX71IsFhIwFhYwFiYwFiYsFhY8FhY0Fio0FiYwFh5AFh5AFi40FiY0FipEFiZEFi40Fi40FjJEFjJEFjI0Fi40Fj5EFjpAF+Ab4PgWYlgWcjwWcigWbgwWWfgWQfAWKegWCfQX7yfv5BQ75SKn5QRWOmwWVmQWalAWcjwX4WIsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogF/CuLBYv7dwX3HakFk4sFk4wF9x57BZOIBZOJBcJuBZGGBZGHBbFiBYyJBYyKBY6FBY+FBYuKBYyJBaj7BAWLigWLigWLhAWMhAWKigWLiQV9UQWLiwWLigWHhAWIhAWLiwWKigVnXgWFhQWFhgVFYQWFiQWFiAU5dQWGigWGigU+hwWFjAWGiwVKlwWGjQWGjAVWogWGjgWFjwVUugWAmAWHmwWOmwWUmQWZlQWcjwWciQWaggW9YQW0eQXCgQXNjgXSngXFrgWlqwWUswVz5wVxpwVjoAX7DZkF+01iBYaLBYaKBYeMBYiKBYaNBYaMBYiNBYeMBYePBYeNBYmOBYiNBYmQBYiPBYuOBYmPBYuPBYqQBQ75SPch96QVi4sFi4sFbW4FioMFnlkFm24FtWEFtHIFzoEF2o8FxaMFsqoFnrMFjaoFf7MFeKwFcqQFZ5sFUJcFU44FU4MFU28F+yxcFYqPBYyRBYy5BYuLBYuLBY7cBY2RBYyRBafaBYyNBYuNBbTfBZCSBZCRBcC7BY6NBY2NBdC4BZGOBZCOBdykBYyLBYuLBeKlBZ2NBZuGBZmBBZN8BY17BYZ7BYB+BXyDBTRyBUFzBU9kBV5jBWdABXJEBYp7BZGOBZCPBdGtBZKNBZKOBc6UBZCLBY+LBcuJBY+KBY+LBc58BZCKBZCJBbt2BZKGBZKHBa5oBY6GBY+GBaNhBYyHBY2HBZpZBYyEBYyFBYlbBYuLBYuLBYmDBYmDBYuLBYuLBW9UBYuKBYqKBYaGBYeFBYqKBYqLBVhiBYaIBYaIBUNtBYOJBYOJBS+GBYeMBYaLBTmXBYqLBYqLBYSOBYOOBYuLBYqLBVasBYiPBYaNBVq8BYeQBYeQBXaxBYqOBYqOBXXHBYqSBYmTBQ75SPfP90gVg/saBYd7BYF+BXyCBXmJBXqPBX2VBYKZBYmbBZL3HAWMjQWLjQWc9wcFi4wFjI0Fms0FjI0Fi4wFnsYFjIwFi40FoL4FjIwFi40ForcFjIwFi40Fo7EFjIwFjI0FoqoFjI0FjIwFoqYFjYwF+96LBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfhfiwWQigWQigWOigWPigWPiAWQiQWOiQWNiQWOhwWPhwWMiAWNiAWMhgWNhgWLiAWMiAWJhgWLhgWKiAWKiAWIhwWJhgWIiQWJiAWHiAWHiAVqeQV9gQVkaAV3dAV2bgV1aAV2YgV4WwV5UwV8TAUO+Uj3pvf2FUR0BUpaBXBZBYleBaZdBcVnBdlzBciJBeCmBb6wBaLEBYLEBWK1BTi2BVKfBdH3sxU4kQVLgAVXcwVrXQWVaQW4ZQW/bAXDeAWwlgXetQWdpgWMwwV1rwVr9wEVi4sFk4gFk4kFi4sFjIsF0GgFjokFj4kFjocFj4gFjYgFjYgFrVIFjIkFjYgFjIYFjYYFiogFjIgFiTwFi4gFi4kFiYUFioYFiYkFiogFbVwFiYkFiYgFh4gFh4cFiIoFiYkFUm4F0mYFkIcFkYcFw1IFjYcFj4gFjIcFjYgFjIYFjIcFmDoFi4kFi4kFioUFi4UFiokFiokFbDwFiYcFiogFh4cFiYgFiIgFiIkFR1sFhYgFhYcFJ2sFg4oFg4oFP40FhY0FhIsFMqcFho4FhY0FQ7gFio0FiYwFho8Fh5AFio0FiYwFZc0Fio4Fio4FipAFiZAFjI4Fio4Fjs0Fi4wFi4sFjZMFjZIFi4wFi4sFr80Fi4wFjIwFkJAFkJEFi4wFjIsF2sYFkY4Fko8FmI8FaZ8FiI4Fh40FUrwFiY0FiI4FiY8FiI8Fio4FiY4FeMsFi40Fi4wFipIFi5IFi4wFi4wFjpIFjZIFjIsFjI0Fu9IFjo4FjY4Fj44Fj44Fjo0Fjo0F0KsFkYwFkY0F15gFkIsFkYwF7YQFDvlI+Fr4mBWVnQV8xwVwqwVfoAVIkwVHgwVTdAVnagV+XwWYYAWvaQXDdAXMhAXMmgW8qgVf/BoVi4oFZ0IFgX4FfIIFeYgFeo8FfZUFgpkFiJsFj5sFr9QFtuoFwPcXBYuLBYuMBZKcBT55BYOKBYKLBTuUBYWNBYWMBUWoBYSPBYSQBVm6BYqNBYmMBYiQBYeQBYuOBYqNBXfNBYqOBYqOBYyQBYqQBYyOBYyPBZ/NBYyNBYuNBY+QBY6QBY2NBYyNBb26BZKPBZKQBdGnBZGMBZGNBduVBZGKBZGMBduBBZKJBZKJBcdvBYyKBYyLBZGGBZGHBYuKBYyKBbNcBYyKBYyKBY6FBY6FBYuJBYyKBZ83BYuFBYyEBYqJBYuJBYmFBYmGBYqHBUH7SAVW+xgFi4oFiooFXysFDvlI9y/3yxX4OvtDBZqBBZR9BY57BYd7BYF9BXyCBXqJBXqOBfyY92oFhI8FhY8FiowFiowFh5EFh5EFi4wFiosFipMFiZIFi4wFi4wFjZIFjJIFjIwFi4wFj5EFj5EFjIwFjIsFkY8Fko8F+Jj3agWcjwWciAWaggWVfgWPewWIegWCfQV8ggUO+Ui2+GkV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAWc+4gV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj44/fpFYyKBY+FBY+FBYuKBYyKBYyEBY2EBYuKBYuKBYmEBYqDBYqLBYuKBYeFBYeFBYqKBYqKBYWHBYSHBfyY+2oFeogFeo0FfJQFgZkFh5sFjpsFlJkFmpUF+Dv3QwX8O/dDBXyUBYKZBYicBY+bBZWYBZqUBZyOBZyHBfiY+2oFkocFkYcFDvlI+Ev3kxWGigX7q4sFi4sFLPtyBYF9BX2CBXqIBXmOBX2UBYGYBYecBY6bBfek+REFkJIFkJIFi4sFi4sFko8FkpAFi4sFjIsFk40Fk40FjIsFi4sFk4kFlIoFi4sFi4sFkoYFkocFjIsFi4sFkIQFj4QF97r9EQWPewWIegWBfgV9gQV6iAV5jgV9lAWBmAX7IvfIFfsB94AFJvuABQ75SPe++GUV2bYFlMsFTL8F+weeBSmGBYv7VgX32vxEFYSJBYmLBYmLBfv7hwWKiwWLiwWDjAWCjQWLiwWLiwWEjwWEkAWKiwWLiwWGkgWHkQWLjAWKiwWKkwWJkgWLjAWLiwWL+QoFjJIFjZIFi4wFi4wFkJEFjpEFjIwFjIwFkY8FkY8FjYsFjIwFkowFk40F9yWTBZCKBZCLBfcZdQWOigWPigWQiQWQiQWNiQWOiQXlQQWNiAWPiQWNhwWOhwWMhwWNiAWLhgWMhwWLhwWLhwV9+wAFiokFi4gFiIYFiYYFiYkFiogFh4cFh4cFiIoFiYkFSGYF9wJmBY6JBY+KBY+IBY+JBY2IBY6IBdE3BY6GBY6FBYyJBYuKBYyEBYyEBYX7AAWLiQWLiQWJhQWJhQWKiQWKiQVsWwWIiQWKiAWHiAWHhwWIigWIiQU+ZAWJigWJigVu3BXEqAWeqAWP3QVYyQX7JLsF+1CWBYv7nAUO+Uj4ZPclFaDbBZOZBZiXBZuQBZ2KBZuEBZd/BZF7BYp7BXIwBYqIBYqHBYiHBYmHBYiIBYmIBUNLBYiJBYmJBYaJBYaIBYiLBYiJBSl1BYuLBYuLBYOLBYKLBYuLBYuLBfsEnAWJiwWKjAWEjQWEjgWKjAWKiwVRsQWFkQWFkQVU3QWLiwWLiwWIkwWIkgWLiwWLiwVm918Fi5MFi5MFuvdeBYyMBYuNBY+RBY2RBY2MBYyNBc7XBYyMBYuLBZGQBZKQBYuLBYuLBdGsBZKNBZKOBdqVBYyLBYyLBZOKBZKLBYyKBY2LBfVqBYyLBYyLBZKHBZGHBYyLBYyKBcNZBYyLBYuKBZCFBY+FBYyKBYuLBapEBY57BYh7BYF9BXyCBXqIBXqOBXyVBYGYBXDJBWKwBTSlBU6EBVVxBVRNBWD7TAWt+04FuUgFtG8F6H0F2JwFDvlI93uVFYaKBfs1iAWLiwWKiwWDjAWDjQWKiwWLiwWEjwWEjwWLjAWKiwWHkgWGkQWLjAWLiwWJkwWJkgWMjAWKiwWT+QQFjJAFi5EFjY0Fi48Fj48FjY8FjY4FjY0FkI4Fj44Fjo0FjowFkIwFkY0F7pgFj4sFjowF14kFkYoFkIsF9xBrBYuLBYuLBZOHBZKIBYyLBYuKBeZIBYyKBYuLBZCFBZGFBYuLBYuKBb8wBY2FBY6GBaAsBYuHBYyHBY1EBYqHBYuIBYJOBYmHBYqHBXhXBYeFBYmGBUw8BYWGBYWGBTdZBYWJBYWIBfsdaAV53hX3EasF0rUFwM4Fm7UFlMAFicsFeOAFXtoFPsQF+wGnBUiMBVGDBYX8tAUO+Uj3EeUV+CGLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfxOiwV6jgV8lAWCmQWHmwWL99MFi/fSBY+bBZSZBZqUBZyPBfhOiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX8IYsFi/t+BfeciwWdiAWZggWVfQWOewWIegWBfgV9ggV5hwX7nIsFDvlI9xf32hWL+6oFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBYyKBfgviwWciAWZggWVfQWPewWHewWBfQV9ggV6iAX8FYsFi/t4BffQiwWdiAWZggWVfQWOewWIewWBfQV9ggV5hwUO+Uj4fve0Ffs1iwV6jwV9lAWBmQWImwWOmwWVmQWZlAWdjgX3bIsFj4oFkIsFj4kFj4oFj4kFj4kFjogFj4kFjYgFjocFjYgFjYcFjIcFjYcFi4cFjIcFiocFi4cFXvtaBYqJBYuIBYiGBYiGBYmJBYqJBUtGBYmKBYqJBYWIBYaHBYmKBYmKBTpwBYqLBYuKBYOKBYOKBYqLBYqLBTWSBYSNBYSNBTmuBYWOBYaOBUfCBYaQBYaQBV/QBYuMBYqMBYmRBYiSBYuMBYuMBXf3UgWLkQWLkgWx90IFjIwFi40FjpEFjpEFjIwFjI0FzdsFjIwFi4wFkZAFkY8FjIwFjIsF37QFi4sFi4sFk40Fk44Fi4sFi4sF9xeVBZKKBZGLBfcQcQWbhQWXfwWRfAWLegWEfAV+gAV7hQV5iwX7CKMF+weCBUhrBVZJBWj7MwWe+0IFrlUFxFwF0W4Fz4UFx6AFvL8FDvlI+H74OhWL95sFj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3tgX8DosFi/u2BYd7BYJ9BXyCBXqIBXqOBXyUBYGZBYibBYv34AWL98UFjpsFlZkFmpQFnI8FnIcFmoIFlH0Fj3sFi/ubBQ75SPfu+UEVi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5EQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Ui/9z4Vio4Fia8FjpsFlJkFmZUFnY4FnIkFmoIFlX4Fj3sFjGsFkXIFlXYFmXkFnX0FunoFzoQFu5EFwp8FoJkFnJ0Fl6EFk70FivhxBY6bBZWZBZqUBZyPBZyHBZqCBZR+BY96BYz8dAWKiAWLiAWCTgWJhQWJhAV5awWHhgWIhwVycQWHiAWIiAVtdwWGiQWGiAVKcwWGigWFigVRhAWGiwWGiwU8kwWFjAWFjAVRoQWFjwWFjQVvoQWHjwWHjgV2pQWJkAWIjwV+qAWKkAWJjwWEqwUO+Uj3Uff3FfsBOQWL+3UFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBZmCBZV9BY57BYv7xAX4Hve7BZuSBZyNBZyGBZiABZR8BYx7BYZ7BX9/Bfui+14F9+b70AWVfQWPewWHewWCfQV8ggV6iAV6jgV8lAUO+Uj3DOUV+CuLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfxYiwV6jgV9lAWBmQWHmwWL+REFj5sFlZkFmZQFnI8FnYcFmYIFlX0FjnsFDvlI+KH5WxWOjwWNjQWNjQWRjQWPjgWOjAWOjAWRjAWRjAWOigWOiwWQiQWRigWNigWOigWQhwWPiAWNiQWNiQWOhgWOhgWMiQWMiAWLhgWNhQWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h1BftD+6wFiYkFiokFhocFh4cFiYkFiYoFhYkFhYgFiYsFiIoFhYwFhYoFiIwFiYsFhY4FhY0FiYwFiY0Fh48Fho8Fio0FiY0F+0P3rAWL/HUFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY2RBYuQBYyOBYyNBY6QBY6QBY2NBY2NBY+OBZCPBY6MBY2MBZGMBZCNBY6LBY6MBZGKBZGKBY6KBY6KBY+IBZGJBY2JBY2JBY6HBY+HBfdw+/UF93D39QUO+Uj4e/dPFYT4hgWOmwWVmQWZlAWcjwWdiAWZggWVfQWPewWU/REFioYFi4cFiocFiocFiYgFiYcFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4oFhosFh4oFhosFh4sFh40Fh4wFh40Fh4wFiI4Fh44FiI4FiI4F/BT4oQWL/IkFh3sFgn0FfIIFeogFeo4FfJQFgZkFiJsFi/kRBYyPBYuPBYyPBYyPBY6PBYyOBY6OBY6PBY6NBY6OBZCNBY+NBY+MBY6NBZCLBZCMBY+KBY+LBY+JBZCKBY+JBY6KBY+IBY+IBY2IBY6IBQ75SPgblBWFiAWJiwWJiwUzgAWKiwWKigWEjAWDjAWKiwWKiwUypQWJjAWIjAWGjgWGjgWJjQWJjAU62gWJjgWIjgWJjwWIjwWLjwWJjgVP96AFi40Fi4wFi5IFi5IFjIwFi40FxPddBY2PBYyPBY6OBY2PBY6NBY6PBdHEBYyMBYyMBZKOBZGOBY2LBYyMBfcOqQWPiwWPjAWQigWPjAWPiQWPiwX3B2cFjIoFjYsFkYcFkYgFjIoFjYkFzkoFjYgFjYkFjocFjYYFjIgFjIgFxfuJBYuDBYuDBW/7LgWIhAWJhQVYMgWKiQWLigWGhgWGhgWKigWKigUwTgWJigWKigUg0BXOkwXUvAW11gWl9x8FVvd1BVm8BTCoBShzBVdgBVj7RgXD+4sFy00FDvlI93j3xxWJigX7AooFi/uVBYd7BYF9BX2CBXqIBXmOBX2UBYGZBYibBYv5BQWMkQWMkgWMjAWLjQWPkQWOkAWNjAWMjQWQjwWRjwWNiwWMjAWSjQWRjAX3HZcFjosFj4sF9w6EBY+KBZCLBdp2BY+KBY+KBa96BZCIBZCIBcRbBYuKBYuLBZCFBZCEBYuLBYyLBaRXBY2EBY2EBZA/BYuJBYuJBYqFBYqFBYqJBYuJBXRcBYqJBYqJBYeHBYeFBYmKBYqKBWhxBYWIBYWIBVN2BYeKBYeJBTp8BYiLBYmLBfsCggWF4BX1kwXWmQW5nAWgmwWZpwWGxAV6sAVesQVxlwVEnQX7BpIFL4MFi/uJBQ75SPiTtRXQOQWTfAWNewWFewWAfwV7gwV6igV6kAV+lQVRzwVUYAWIigWJiQWGiQWGiAWHiwWIigU1fgWJjAWJigWEjAWFiwWJjAWIiwU0qQWJjAWIjAWGjgWGjgWJjgWJjAU75AWKjgWJjQWJkAWIkAWLjgWKjQVQ98MFi4sFi4sFi5MFi5MFi4sFi4wFw/d2BY2OBYyPBY2PBY6PBY2OBY2OBdDLBY2MBYyNBZGOBZGOBY2MBY2MBfcLrAWRjAWRjAWNigWOjAWRiQWRigX3BGMFjYoFjooFj4cFkYgFjIkFjYoFzUEFjIkFjYkFjYYFjoYFjIgFjIkFw/uoBYuEBYuEBW/7QgWJhQWJhQX7K0AVMfUFg5oFipsFkJsFlpcFm5MFnIwFnIYFmIEF0zcFmqkFpfc1BVb3lgVZxAU0qgUucQVXWgVY+2IFwvuvBctDBcx2BcmUBQ75SPfz+EoV3JcFrpgFoJsFlqIFjLMFfbkFgZYFd5gFcZUFQZsF+xSQBfsofgWL+10F90g8FftIhQWL+7cFh3oFgn4FfIEFeogFeo4FfJUFgZgFiJwFi/j8BYyRBYyRBYyNBYuNBY+QBY6RBY2MBYyNBZGOBZCPBY2MBY2MBZGMBZKNBfdUmwWOiwWOjAX3G4UFj4oFj4sF3HoFj4kFj4sFrX0Fj4kFj4kFp3kFj4cFkIgFoHQFi4oFjIsFjoQFj4UFi4oFjIoFnU0FjIUFjIUFiVQFi4sFiYMFiYMFi4sFeWQFiooFi4oFhoUFhoUFiosFi4oFaXAFhIgFhYcFXXoFhooFhokFNX8F94H7rQWTfQWNegWGewV/fwV8gwV5igV6kAV+lgX7nPfLBYOaBQ75SOXBFYaOBYqNBYiNBYmQBYeQBVr3AQWHnAWOmwWVmQWZlAWcjgWdiAWZggWVfgW3KgXNaQX3IIcF7bgFq/AFdsUFS68F+4ezBYiNBYiLBYaNBYaNBYmOBYiMBUu+BYiPBYiOBYmOBYiOBYqQBYmOBXrHBYuPBYqOBYuQBYuPBYyPBYyPBbT3DAWOkAWNkAWNjQWMjQWQjwWPjwXvzAWRjgWQjgWOiwWNjAWRiwWRjAX3R4IFjYoFjIwFkogFkooFjIoFjYoFkIcFkYcFjIoFjIoF1zAFknwFjXoFhXwFgH4Fe4QFeYoFe5AFfpYFTNYF+yOTBUBaBWssBZVoBbZoBfeDYwWTiQWTiAXfWgWQhwWQhwWNiQWMigWOhQWOhgWrNgWLhgWNhwWLhwWLiAWKhgWKhgVi+xgFi4oFiooFh4UFiIQFiosFiooFhYYFhYcFiosFiooF+xJRBYmLBYqKBYSKBYSJBYmLBYmLBfs2jwWJjAWJiwWFjQWEjAWJjAWJjAUzuQUO+Uj3yflsFfeiiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX7dYsFi/znBYh7BYF9BX2CBXmIBXqOBXyUBYKZBYebBYv45wX7hYsFeo4FfJQFgZkFiJsFjpsFlZkFmpQFnI8FDvlI+HT3hxWQ+E4Fj5sFlZkFmZQFnY4FnIcFmYIFlX0FjnsFhvxQBYqIBYyJBYFHBYqHBYqGBXdYBYmIBYmHBX53BYiHBYiIBW1sBYWHBYaHBVhxBYSJBYSJBU2BBYWLBYSLBTOUBYaNBYWMBUWlBYWPBYWOBVyvBYeQBYWQBWjCBYiRBYiRBXnSBYqPBYqOBYTsBYuNBYuMBYr39wWOmwWVmQWalAWcjwWchwWaggWVfgWOegWM+/UFki8Fm00Fp2EFr28FxXYF14IFu5MFsJ4FoqIFk5cFnLYFDvlI99H3NRX3a/ivBZSZBZqVBZyPBZyIBZqCBZV+BY97BYh6BfuS/REFi4sFi4oFhoUFh4QFi4sFiooFhIcFhYYFiosFi4sFg4kFg4oFiosFi4sFg4wFgowFi4wFiosFhI8FhI8Fi4sFi4wFhpEFhpEFi4wFi4sF+7j5EgWHmwWOmwWVmQWZlAWcjwWciAWaggWVfQUO+Uj4dvdYFdf4gwWQmwWXlwWbkgWcjAWchgWYgAWTfAWMegUq/REFiYcFioYFiYgFiocFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4kFh4sFhooFh4sFh4sFho0Fh4sFh40Fh40FiI4Fh40FiI4FiI4FiY8FiI4F+0b3/wX7Ofv2BYiHBYiGBYmJBYmJBYaIBYeHBYiKBYiKBYaKBYWJBYiLBYiLBYWMBYaLBYiNBYiLBYaOBYaOBYmNBYiNBYiPBYiPBYqOBYmOBYqQBYmQBTv5CQWNnAWTmQWYlgWckAWcigWbhAWWfgWRewXH/G8F9x/3vgWPkAWPkQWMjAWMjAWRjwWRjwWNiwWMjAWSjAWSjQWNiwWMiwWSiQWTigWMiwWMigWRhwWSiAWMigWMigWPhQWPhQUO+Uj3/Pf/FfeZ+7QFlH0FjXsFhnsFgH4FfIMFeYkFeo8FfpYF+5D3qQX7kPupBX6ABXqHBXmNBXyTBYCYBYabBY2bBZSZBfeZ97QF+5/3uwWCmQWJnAWQmwWWlwWalAWdjAWchwWYgQX3lvuxBfeW97EFmZUFm48FnYoFmoIFln8FkHsFiXoFgn0FDvlI9+j4EhWV++EFiHsFgn0FfYEFeogFeY0FfJQFgZkFh5sFgffjBfud96cFgpkFiJsFj5sFlpkFmpMFnI4FnIcFmYEF94n7kQX3k/eQBZqVBZyPBZyIBZqCBZV+BY96BYh7BYJ9BQ75SPci5RX4KosFnYgFmYIFlX0FjnsFiHsFgX0FfYIFeYgF/IKLBYWMBYaLBYiMBYeMBYeOBYaNBYmNBYiNBYiPBYePBYqOBYmOBYqQBYmPBYuPBYuOBYyQBYuQBYyOBYyOBY6PBY2QBfhP+M4F/CqLBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfiCiwWRigWQigWOigWPigWPiQWQiAWNiQWOiQWOhwWPhwWMiAWNiAWMhwWNhgWLiAWLhwWKhgWLhgWKiAWKiAWIhwWJhgUO+Uj3h3QV9zaLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqHBftjiwV5jwV9lAWBmQWImwWL+Z8FjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfs2iwUO+Ujw+VgV+HH9YwWRfAWKegWEfAV+gAV7hQV5jAV7kQV/lwX8cfljBYWaBYycBZKaBZiWBZuRBZ2KBZuFBQ75SPhWShWHewWBfQV9ggV6hwX7Y4sFeY8FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9zaLBYv5SwX7NosFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BQ75SPeo+WQVko8FjIsFjIwFkowFk40FjIoFjIwFk4kFkooFjIoFjIsFkocFkYcF9577ggWVfgWPewWIegWBfQV9ggV6hwV6jgV8lAX7f/dmBft/+2YFfIIFeogFeo8FfZQFgZkFiJwFj5sFlZgF9573ggUO+UiL+wEV+O6LBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfzuiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj4POoVxcIFi/eQBVLBBVCnBS+LBVBvBUxQBWsvBYtQBaswBcpPBcdvBeaLBfcIZhWHiAWFhwVAZwWKigWJigWEigWFiQWJjAWJigX7BYsFiYwFiYoFhI0FhYwFiYwFiYwFQK8FhY8FhY8FP9MFiowFiowFiJEFh5EFiowFiowFZvYFipIFipIFi9IFjJIFjJEFsPcABYyNBYyMBY+RBY6RBYyMBYyMBdfTBZGPBZGPBdeuBYyMBY2MBZKMBZKNBYyKBY2MBfcFiwWMigWNjAWSiQWSigWMigWNigXWaAWQhwWQiAWLjwWPnAWUmAWalQWcjgWciAWagQWVfgWOegWL/IoFiHsFgX4FfIEFeogFeo4FfJUFgpgFh5sFDvlI9xOvFYaOBYuKBYd6BYF+BX2CBXqHBXmPBX2UBYGYBYicBYv5OAWOmwWVmQWZlAWdjgWciAWZggWVfQWPewWL+3YFkI4FkY8F1asFjIsFjIsFko0Fk40FjIoFjIwF9wSLBYyLBYuLBZOJBZOJBYyLBYuLBddrBZCHBZKIBdZKBYyKBY2KBY6FBY+GBYyJBYyKBbApBYyEBYyEBYtLBYqEBYqDBWYrBYqKBYqJBYeGBYiFBYmKBYqJBUBLBYWIBYWHBUBqBYqLBYqLBYSJBYOJBYqLBYqLBfsEiwWKjAWKigWDjQWEjQWKiwWKiwVBrAWA9w0VwlwFxnEF54sFx6UFycAFqdoFi70FbdsFTcAFT6QFL4sFUHIFVFwFDvlI+DLqFczNBZqVBZyPBZyIBZqDBZV9BY97BYl7BYF9BUVDBYWHBYWHBUZmBYiLBYmJBYWKBYWJBYiMBYmKBSGLBYmMBYiKBYWNBYWMBYmNBYmLBUSwBYWPBYWPBUXTBYqMBYqMBYeRBYeRBYuMBYqMBWn2BYqRBYqSBYvSBYyRBYySBa33AAWMjAWLjAWPkQWPkQWMjAWMjAXR0wWRjwWRjwXSrwWNiwWNjQWRjAWSjQWNigWNjAX1iwWNigWNjAWSiQWRigWNiQWNiwXRZwWRhwWRhwXRQwWVfQWNewWHewWBfQV8gwV6iAV6jwV8lQVKzQVWpgU3iwVVcAVRUAVtLgWLUAWoLwXGUAXCbwXdiwUO+Uj4PfUVwroFi/dxBVS6BVCkBS+LBU9yBU1WBW07BYtZBak8BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKiwWEiQWDiQWKjAWKigX7BIsFiosFiosFhI0Fg40FiosFiosFQKwFhY8Fho4FP8sFio0FiYwFiJEFh5AFio0FiowFZusFipMFipIFi8sFjJIFjJIFsO0FjIwFjI0Fj5AFjpEFjYwFjIwF18wFkY4FkI8F16sFi4sFjIsFk40Fk40Fi4sFjIsF9wSLBYyKBYyMBZOJBZKJBYyLBYyLBdVrBZGHBZCIBYv3dgWPmwWVmQWZlAWcjgWdiAWZggWVfQWOewWL/TgFiHoFgX4FfYIFeYcFeo8FfZQFgZgFh5wFDvlI9x74IBV8YQX4GIsFg5QFZs0FbaYFS6cFJosFSm8F93r7/BXXzgWZlAWdjgWchwWZggWVfQWNegWIewWAfgU6QwWGiAWFhwU8ZgWJiwWKigWEigWEiQWJiwWKiwX7DYsFiosFiosFg40FhIwFiowFiosFOrAFhY8FhY4FO9MFiYwFiowFh5EFh5AFi40Fio0FY/YFipIFipIFi9IFjJIFjJIFs/cABYyNBYuNBY+QBY+QBYyNBY2MBdvTBZKOBZCPBdyvBYyLBYyMBZOMBZKNBYyLBYyLBfcNiwWMiwWMiwWTiQWSigWMigWMiwXbZwWQhwWRiAW1ZwWPhQWQhQWyRAWQewWJegWDfQV/ggWUhQWVfgWOegWIewWBfQV9ggV5iAX8SYsFi3UFrDAFz08FzG4F8IsFDvlI97n4VhWL/CQFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/gkBfsGiwV6jgV8lQWCmAWHmwWPnAWUmAWalQWcjgX3BosFi8AFi40Fi40FjZEFjJEFjY0Fi4wFwOoFkZEFkJEFi4sFi4wFk44Fko8F9asFkowFkowF9YsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFKIsFOXIFZEUFi2EF9zuLBZyIBZqBBZV+BY56BYh7BYF+BXyBBXqIBQ75SPg99yMVwroFi/dxBVS7BVCkBS+LBU9yBU1WBW06BYtaBak7BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKigWEigWDiQWKiwWKiwX7BIsFiosFiosFg40FhIwFiowFiosFQKwFhY8FhY4FQMwFiowFiYwFiJEFh5AFio0FiowFZuwFipIFipIFi8wFjJIFjJIFsOwFjI0FjI0Fj5AFjpAFjY0FjIwF1swFko4FkI8F16sFi4sFjIwFk4wFk40Fi4sFjIsF9wSLBYyLBYyLBZOJBZKKBYyKBYyLBdVrBZGHBZCIBYuLBY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYv8mAWKhAWKhAVmKgWKigWKiQWHhgWIhQWJigWKiQVlawWFhwWFhwVBbAWKigWKiwWEiQWDigWKiwWKiwX7BIsFiosFi4sFg4wFg40FiosFi4sFP6sFho8FhI8FQMsFio0FiYwFiJAFh5AFio0Fio0FZuwFiZwFj5sFlZgFm5QFnI0FnIcFmYEFlH0FrDQFyVYFx3EF54sFxqUFpKAFqdoFDvlI+L34CRWNhAWL+9AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/fIBW7TBVqfBSyLBU1yBS49BYv7vQWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+SwFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/uSBbKsBZGOBZGPBdeqBYyLBYuMBZOMBZONBYyLBYuLBfcGiwWMiwWLiwWTiQWTigWMigWLiwXXbAWLiwWLiwWShgWShwWLigWMiwWPhAWQhQWLigWLiwWxLAUO+Uj3mfmIFduLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBTuLBXqOBXyUBYGZBYibBY6bBZWZBZqUBfH7mRWL/E4FiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/hOBY6cBZWYBZqVBZyOBZyIBZqBBZV+BQ75SPgV+YgVyYsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFTYsFeo4FfJQFgpkFh5sFj5sFlJkFmpQF+wn+MhWGigWIjQWHiwUpqQV8kwWAmAWGmwWNmwWUmQWZlgWbjwWdiQXhcQXpoQWhyQWL+I4Fj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/yVBYqEBYqFBWswBYiGBYmHBYmIBYmIBYeIBYeIBYiJBYiJBYaKBYaJBfsXbQWIiwWHigUO+Uj3f/eMFfsRLwWLIQWIewWBfQV8ggV6iAV6jgV8lAWCmQWHmwWL+SwFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/xXBff495sFm5IFnIwFnIYFmIEFk3wFjHoFhnwFgH4F+2v7MgX3mPtwBZV+BZB7BYh7BYJ9BX2BBXqHBXqNBXyTBQ75SPfu+WMVi/0xBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5MQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj43/iYFZCGBYuKBYyJBYyFBY2EBYuKBYyJBYv8WwWHewWBfQV9ggV6iAV5jgV9lAWBmQWImwWL+EgFfJYFXIsFdHgFVDEFi/vmBYh7BYF9BX2CBXmIBXqOBX2UBYGZBYebBYv36gVo4wV1nAVdiwVzeAVVMQWL++YFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h9BY6cBZWYBZmVBZ2OBZyIBZmBBZV+BY2ABa2mBZGOBZGPBY2LBYyMBZKLBZKNBduLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyJBY2KBY+GBY+GBYuJBY2JBZN1BZynBZCQBZCRBbWtBZGPBZGPBY2LBYyMBZKLBZKNBdyLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyKBYyKBQ75SPi++B0VjIUFi/vyBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv36wVt3QVaoQUtiwVPcAUsMwWL++AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/h9BY6cBZWYBZqVBZyOBZyIBZqBBZV+BY56BYtlBbCtBZKPBZCPBdiuBYyLBYyMBZKMBZONBYyLBYyLBfcGiwWMiwWNiwWSiQWSigWMigWNiwXWaAWMiwWLiwWShgWRhgWMiwWLiwWPhAWPhAWLiwWLiwWyIQUO+Uj37Ph4FTWLBVRwBU9PBWwvBYtQBaowBcdPBcNvBeCLBcKnBcfHBarmBYvGBWznBU/HBWH3AxWNjAWRiQWSigWNiQWNiwXTaAWRhgWRhwXTQwWLigWMiwWPhAWPhQWLigWMigWv+wAFjIUFjIQFi0QFioQFioUFZyAFiooFi4oFh4QFh4UFiosFi4oFQ0MFhYcFhYcFQ2YFiYsFiYkFhYoFhIkFiYwFiYoF+wCLBYmMBYmKBYSNBYWMBYmNBYmLBUOwBYWPBYWPBUPTBYuMBYqLBYeRBYeSBYuMBYqMBWf2BYqRBYqSBYvSBYySBYyRBa/3AAWMjAWLjAWPkQWPkgWMiwWLjAXT0wWSjwWQkAXTrgWNiwWNjQWSjAWRjQWNigWNjAX3AIsFDvlI9xTXFYWPBYv7dQWHewWCfQV8ggV6iAV6jgV8lAWBmQWImwWL+TMFjpwFlZgFmpUFnI4FnIgFmoEFlH4Fj3oFi4sFkY8FkI4F1asFjIsFjIwFk4wFko0FjIsFjIsF9wSLBYyLBYuLBZOJBZOKBYyKBYuLBdZsBZGHBZGHBdZLBY2KBYyJBY+GBY+GBYuJBY2JBa8rBY2EBYyDBYtLBYqEBYmEBWYsBYqJBYuJBYeGBYeFBYqKBYmKBUBLBYWHBYaIBUBqBYqLBYqKBYOKBYSJBYqLBYqLBfsEiwWKiwWKiwWDjQWEjAWKjAWKiwVBrAWA9w0VwlwFxnEF54sFx6UFyb8FqdoFi7wFbdsFTb8FT6QFL4sFUHIFVFwFDvlI+D33JRXCugWL924FVLoFUKQFL4sFT3IFTVcFbTsFi1oFqTwFyVcFx3EF54sF9wZiFYaIBYWHBUFqBYqLBYqLBYSJBYOJBYqMBYqKBfsEiwWKjAWKigWEjQWDjQWKiwWKiwVArAWGjgWFjwVAywWJjAWKjQWHkAWHkAWLjQWKjQVm6gWJkgWKkwWLywWMkgWNkgWw6wWMjQWLjQWPkAWPkQWMjAWNjAXWywWRjwWRjwXWqgWLiwWMjAWTjAWTjQWLiwWMiwX3BIsFjIsFjIsFkokFk4oFjIoFjIsF1WwFkIcFkYgFi4sFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/00BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBQ75SPfp+MsVk40F9yaLBZyIBZmBBZV+BY96BYd7BYF+BX2BBXqIBfsdiwU4bgU5TwViNAWL+6MFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/h9BY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYtWBdTABZGNBZGPBeutBQ75SO6nFYSQBYuLBYuMBYeSBYeSBXLSBYmcBY+bBZaYBZuTBZyNBZyGBZmBBZN9BZ9TBbt0BfWLBeSsBbuhBYuoBVHCBfsBygX7BIsFiYsFiosFhI0FhIwFiowFiYwFQK8FhY8Fho8FiowFiYwFiJEFh5EFi4wFio0FipEFipIFi9IFjJMFjZMFi4sFi4wFkJEFj5IF1tMFjIsFjIwFkY8Fko8FjIsFi4wF764Fk4wFk40F9xGLBYyKBY2MBZKJBZKKBYyKBY2KBdZoBZmBBZN8BY17BYd7BYB+BXyDBXmJBXqPBUqqBSGLBTluBVRWBYtuBbN4BfcGiwWOigWPiwWQiQWQigWOigWPiQX3EEQFj4cFkIgF1kQFj4QFkIQFi4sFi4sFjYMFjIMFi0MFioUFioQFiooFi4kFh4UFiIYFiYoFiokFhYgFhoYFQGgFiYsFiYkFJ2cFg4oFg4kF+xGLBYmMBYmKBYWNBYSMBYmMBYqMBUCvBQ75SPdd+DEV+wyLBXqOBXyUBYGZBYibBY6bBZWZBZqUBZyOBfcMiwWL9zcFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/s3BfdDiwWciAWaggWVfQWOewWIewWBfQV8ggV6iAX7Q4sFi/uCBbNMBeF0BfOLBZyHBZqCBZV9BY57BYh7BYF9BXyCBXqIBfsCiwWFjAWFjAX7AqgFg48FhI4Fi4sFiowFhpEFhZAFVOIFio4FiY4FipAFiZAFjI4Fio4FDvlI+GX3SRWL9+AFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/x9BYh6BYF+BXyBBXqIBXqOBXyVBYGYBYicBYuyBWZpBYWHBYWHBT9oBYmKBYqKBYSKBYSJBYmMBYqKBfsGiwWJjAWKigWEjQWEjAWJjAWKjAU/rgWEkAWEkAWLiwWLiwWHkgWHkgVk9AWKkgWKkQWL9/IFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/vrBak6Bb10BeeLBcinBQ75SPfB9xcV92j4JgWWmAWakwWcjQWchwWZgQWUfQWNegWHewX7kfxyBYiHBYiGBYiJBYqJBYaIBYaIBYiKBYiKBYaKBYWKBYiLBYiLBYWMBYaMBYiMBYiMBYaOBYaOBYqNBYiNBYiQBYiPBfuQ+HIFhpsFjZwFlJkFmZUFnI8FnIkFmoMFln4FDvlI+Fj3TRX29+kFk5oFmZUFm5AFnYoFmoMFl34FkHsFiXsF+yr8cgWIhwWKhwWIiAWKhwWHiQWIhwWHiQWIiQWGiQWHiQWHiwWHigWHiwWGiwWHjAWHiwWHjQWGjQWIjQWHjQWIjwWIjQWJjwWIjgWKjwWIjwUg9+kFIPvpBYiHBYqHBYiIBYmHBYiJBYiHBYeJBYiJBYaJBYeJBYeLBYeKBYeLBYaLBYeMBYeLBYeNBYaNBYiNBYeNBYiPBYiNBYmPBYiOBYqPBYiPBfsq+HIFiZsFkJsFl5gFmpMFnYwFm4YFmYEFk3wF9wD76QX29+kFjY8FjI8Fjo4FjY8Fj44Fjo4Fjo0Fj40Fj40Fj40Fj4sFj4wFkIsFkIsFj4oFj4sFj4kFkIkFjokFjokFjogFj4gFjYcFjogFjIcFjYcFDvlI+AL3pxX3evtlBZV+BY97BYh7BYF9BX2BBXqIBXmOBX2UBft992YF+337ZgV9ggV5iAV6jgV9lQWBmQWImwWPmwWVmAX3evdlBft692UFgZgFh5sFjpwFlZgFmZUFnI4FnYgFmYMF9337ZwX3ffdnBZmTBZ2OBZyIBZmBBZV+BY56BYd7BYF+BQ75SOj7TxWDigWLiwWLiwVjiwV6jgV8lAWBmQWImwWOmwWVmQWalAWcjgWqiwXLpQXOwQXJ7gX7dfg4BYebBY2bBZSaBZiVBZyPBZ2JBZqDBZZ+BfdX/AEF91n4AQWWmAWakwWdjQWbhwWZgQWUfAWNewWGewX7gfxMBYuKBYqJBT37EQWGhQWGhgU9TAWEiAWGhwU8bAWLiwWLiwUO+Uj3UtkV98+LBZ2IBZmCBZV9BY57BYh7BYF9BX2CBXmIBfwsiwWEjAWFiwWJjQWIiwWGjgWGjgWJjQWJjAWHkAWHkAWKjQWKjQWKkQWJkAWLjgWLjQWMkQWLkQWNjQWLjQWPkAWOkQX38vguBfvPiwV5jgV9lAWBmQWImwWOmwWVmQWZlAWdjgX4LIsFkooFkYsFjYoFjooFkIgFkYgFjIkFjYoFj4YFj4YFjIkFjIkFjIUFjYYFi4gFi4kFioUFi4UFiYkFi4kFh4YFiIYFDgAAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAA==";function hn(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}const fUo=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function IUo(t){const e=t.match(fUo);if(e===null||e.length<7)throw new Error(`'${t}' is not a matrix`);return{a:parseFloat(e[1]),b:parseFloat(e[2]),c:parseFloat(e[3]),d:parseFloat(e[4]),e:parseFloat(e[5]),f:parseFloat(e[6])}}function CUo(t){const{a:e,b:n,c:o,d:i,e:r,f:s}=t,a=e*i-n*o;return{a:i/a,b:n/-a,c:o/-a,d:e/a,e:(i*r-o*s)/-a,f:(n*r-e*s)/a}}function sq(t){return typeof t>"u"}function of(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function aq(...t){t=Array.isArray(t[0])?t[0]:t;const e=(n,o)=>({a:n.a*o.a+n.c*o.b,c:n.a*o.c+n.c*o.d,e:n.a*o.e+n.c*o.f+n.e,b:n.b*o.a+n.d*o.b,d:n.b*o.c+n.d*o.d,f:n.b*o.e+n.d*o.f+n.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{const[n,o,...i]=t,r=e(n,o);return aq(r,...i)}}}function _0(...t){return aq(...t)}const{cos:yUo,sin:xUo}=Math;function jb(t,e,n){const o=yUo(t),i=xUo(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return sq(e)||sq(n)?r:aq([of(e,n),r,of(-e,-n)])}function Tx(t,e=void 0,n=void 0,o=void 0){sq(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return sq(n)||sq(o)?i:aq([of(n,o),i,of(-n,-o)])}function EUo(t){return $b(t)}function $b(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function BUo(t,e=1e10){return{a:Math.round(t.a*e)/e,b:Math.round(t.b*e)/e,c:Math.round(t.c*e)/e,d:Math.round(t.d*e)/e,e:Math.round(t.e*e)/e,f:Math.round(t.f*e)/e}}function bUo(t,e){const n=t[0].x!=null?t[0].x:t[0][0],o=t[0].y!=null?t[0].y:t[0][1],i=e[0].x!=null?e[0].x:e[0][0],r=e[0].y!=null?e[0].y:e[0][1],s=t[1].x!=null?t[1].x:t[1][0],a=t[1].y!=null?t[1].y:t[1][1],A=e[1].x!=null?e[1].x:e[1][0],c=e[1].y!=null?e[1].y:e[1][1],l=t[2].x!=null?t[2].x:t[2][0],u=t[2].y!=null?t[2].y:t[2][1],g=e[2].x!=null?e[2].x:e[2][0],h=e[2].y!=null?e[2].y:e[2][1],d={a:n-l,b:o-u,c:s-l,d:a-u,e:l,f:u},p={a:i-g,b:r-h,c:A-g,d:c-h,e:g,f:h},m=CUo(d),_=aq([p,m]);return BUo(_)}function SUo(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function zge(t,e,n,o){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,zge.prototype),i.expected=e,i.found=n,i.location=o,i.name="SyntaxError",i}SUo(zge,Error);function cRe(t,e,n){return n=n||" ",t.length>e?t:(e-=t.length,n+=n.repeat(e),t+n.slice(0,e))}zge.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n=null,o;for(o=0;o<t.length;o++)if(t[o].source===this.location.source){n=t[o].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,r=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,s=this.location.source+":"+r.line+":"+r.column;if(n){var a=this.location.end,A=cRe("",r.line.toString().length," "),c=n[i.line-1],l=i.line===a.line?a.column:c.length+1,u=l-i.column||1;e+=`
|
|
1070
1070
|
--> `+s+`
|
|
1071
1071
|
`+A+` |
|
|
@@ -5668,7 +5668,7 @@ test("${c} should solve problem correctly", () => {
|
|
|
5668
5668
|
// Add more specific assertions based on expected output
|
|
5669
5669
|
// expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
|
|
5670
5670
|
})
|
|
5671
|
-
`,u=new Blob([l],{type:"text/plain"}),g=URL.createObjectURL(u),h=document.createElement("a");h.href=g,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(g)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return K.jsxs("div",{className:`relative ${e}`,ref:i,children:[K.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.getSolverName()}`,children:t.getSolverName()}),n&&K.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},Ohn=t=>t.activeSubSolver?[t,...Ohn(t.activeSubSolver)]:[t],DOi=({solver:t})=>{const e=Ohn(t);return K.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>K.jsxs("div",{className:"flex items-center",children:[o>0&&K.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),K.jsx(MOi,{solver:n})]},n.getSolverName()))})},NOi=({solver:t,triggerRender:e,animationSpeed:n=25,renderer:o,onRendererChange:i,onAnimationSpeedChange:r,onDownloadVisualization:s,onSolverStarted:a,onSolverCompleted:A})=>{const[c,l]=ee.useReducer(B=>!B,!1),u=ee.useRef(void 0),g=ee.useRef(null),h="solver-debugger-last-iteration",[d,p]=ee.useState(null),m=ee.useRef(null),_=ee.useMemo(()=>[{label:"Slow",value:250,description:"250ms"},{label:"Normal",value:100,description:"100ms"},{label:"Fast",value:10,description:"10ms"},{label:"Fast (2x)",value:5,description:"5ms"},{label:"Fast (10x)",value:1,description:"1ms"},{label:"Fast 20x",value:.5,description:"2 steps / 1ms"},{label:"Fast 100x",value:.1,description:"10 steps / 1ms"}],[]),f=()=>{const B=Math.max(1,n),S=n<1?Math.round(1/n):1;u.current=setInterval(()=>{if(t.solved||t.failed){u.current&&(clearInterval(u.current),u.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<S&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{u.current&&(clearInterval(u.current),u.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;g.current===null&&typeof window<"u"&&(g.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",g.current??`${t.iterations}`);if(B===null)return;g.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const S=Number(B);if(!Number.isFinite(S)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<S&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return ee.useEffect(()=>()=>{I()},[]),ee.useEffect(()=>{(t.solved||t.failed)&&c&&(I(),l())},[t.solved,t.failed,c]),ee.useEffect(()=>{c&&(I(),f())},[n,c]),ee.useEffect(()=>{if(typeof document>"u")return;const B=S=>{m.current&&!m.current.contains(S.target)&&p(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),K.jsxs("div",{className:"space-y-2 p-2 border-b",children:[K.jsx("div",{className:"flex items-center",children:K.jsxs("div",{className:"flex items-center gap-2",ref:m,children:[K.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[K.jsxs("div",{className:"relative",children:[K.jsx("button",{type:"button",onClick:()=>p(d==="renderer"?null:"renderer"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="renderer"?"open":"closed",children:"Renderer"}),d==="renderer"&&K.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[10rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:["vector","canvas"].map(B=>K.jsxs("button",{type:"button",onClick:()=>{i(B),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B==="vector"?"Vector":"Canvas",o===B&&K.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),K.jsxs("div",{className:"relative",children:[K.jsx("button",{type:"button",onClick:()=>p(d==="debug"?null:"debug"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="debug"?"open":"closed",children:"Debug"}),d==="debug"&&K.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:K.jsx("button",{type:"button",onClick:()=>{s(),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),K.jsxs("div",{className:"relative",children:[K.jsx("button",{type:"button",onClick:()=>p(d==="animation"?null:"animation"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="animation"?"open":"closed",children:"Animation"}),d==="animation"&&K.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:_.map(B=>K.jsxs("button",{type:"button",onClick:()=>{r(B.value),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B.label,K.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&K.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),K.jsx(DOi,{solver:t})]})}),K.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[K.jsx("button",{onClick:C,disabled:t.solved||t.failed||c,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),K.jsx("button",{onClick:y,disabled:t.solved||t.failed||c,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),K.jsx("button",{onClick:x,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${c?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:c?"Stop":"Animate"}),K.jsx("button",{onClick:E,disabled:t.solved||t.failed||c,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),K.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&K.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&K.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&K.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&K.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},ROi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),TOi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},kOi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=TOi(t,e),r=t[o],s=t.firstIterationOfStage?.[o]??(e===t.currentPipelineStageIndex?t.iterations:null),a=t.iterations;let A=0;if(i==="Completed"){const g=t.pipelineDef[e+1],h=g?t.firstIterationOfStage?.[g.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnStage?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const u=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:u&&Object.keys(u).length>0?u:null,solverInstance:r??null}},FOi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return K.jsx("span",{className:`font-medium ${e[t]}`,children:t})},LOi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return K.jsxs("div",{className:"flex items-center gap-2",children:[K.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:K.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),K.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},Ghn=t=>{if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},HOi=t=>Object.entries(t).map(([e,n])=>`${e}: ${Ghn(n)}`).join(", "),OOi=({stats:t})=>{if(!t||Object.keys(t).length===0)return K.jsx("span",{children:"-"});const e=Object.entries(t),n=HOi(t);return K.jsxs("details",{className:"cursor-pointer",children:[K.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),K.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>K.jsxs("div",{children:[o,": ",Ghn(i)]},o))})]})},B$e=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(B$e);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=B$e(o));return e},GOi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=B$e(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},YOi=({expanded:t})=>K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:`w-4 h-4 transition-transform duration-200 ${t?"rotate-90":""}`,children:K.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})}),Yhn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},Uhn=({solver:t,onStepUntilPhase:e,onDownloadInput:n,isNested:o=!1,indentLevel:i=0,triggerRender:r})=>{const[s,a]=ee.useState(new Set),A=t.pipelineDef.map((m,_)=>kOi(t,_)),c=m=>{a(_=>{const f=new Set(_);return f.has(m)?f.delete(m):f.add(m),f})},l=m=>{e?.(m)},u=m=>{m.solverInstance&&(n?n(m.solverInstance,m.name):GOi(m.solverInstance,m.name))},g=m=>`${(m/1e3).toFixed(2)}s`,h=()=>{if(!t.solved&&!t.failed){const m=t.activeSubSolver;for(;!t.solved&&!t.failed&&(t.step(),!(t.activeSubSolver&&t.activeSubSolver!==m)););r?.()}},d=()=>{if(!t.solved&&!t.failed){const m=Yhn(t);for(;!t.solved&&!t.failed&&(t.step(),Yhn(t)===m););r?.()}},p=i*24;return K.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&K.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[K.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),K.jsxs("div",{className:"flex gap-2",children:[K.jsx("button",{onClick:d,disabled:t.solved||t.failed,className:"bg-indigo-500 hover:bg-indigo-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Solver"}),K.jsx("button",{onClick:h,disabled:t.solved||t.failed,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Stage"})]})]}),K.jsx("div",{className:"overflow-x-auto",children:K.jsxs("table",{className:"w-full text-sm",children:[!o&&K.jsx("thead",{children:K.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),K.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",K.jsx("sub",{children:"0"})]}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),K.jsx("tbody",{children:A.map(m=>{const _=ROi(m.solverInstance),f=s.has(m.name);return K.jsxs(Fs.Fragment,{children:[K.jsxs("tr",{className:`border-b border-gray-100 ${m.status==="In Progress"?"bg-yellow-50":""}`,children:[K.jsx("td",{className:"px-4 py-2",children:K.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:p},children:[_?K.jsx("button",{onClick:()=>c(m.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:K.jsx(YOi,{expanded:f})}):K.jsx("span",{className:"w-4"}),K.jsx("span",{className:"text-gray-400 w-6",children:String(m.index+1).padStart(2,"0")}),K.jsx("button",{onClick:()=>l(m.name),disabled:m.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${m.name} completes`,children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),K.jsx("span",{className:"font-medium text-gray-900",children:m.name})]})}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(FOi,{status:m.status})}),K.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:m.firstIteration!==null?m.firstIteration:""}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:m.iterations}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(LOi,{progress:m.progress})}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:g(m.timeSpent)}),K.jsx("td",{className:"px-4 py-2 text-gray-500",children:K.jsx(OOi,{stats:m.stats})}),K.jsx("td",{className:"px-4 py-2",children:m.solverInstance?K.jsxs("button",{onClick:()=>u(m),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${m.name}`,children:[K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),K.jsx("span",{children:"Input"})]}):null})]}),_&&f&&K.jsx("tr",{children:K.jsx("td",{colSpan:8,className:"p-0",children:K.jsx(Uhn,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function UOi({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(m,_)=>{typeof m=="number"&&(m<s&&(s=m),m>A&&(A=m)),typeof _=="number"&&(_<a&&(a=_),_>c&&(c=_))};for(const m of e)l(m.x,m.y);for(const m of n){const _=m.points??[];for(const f of _)l(f.x,f.y)}for(const m of o){const _=m.x??0,f=m.y??0,I=m.width??0,C=m.height??0;l(_,f),l(_+I,f+C)}for(const m of i){const _=m.x??0,f=m.y??0,I=m.radius??1;l(_-I,f-I),l(_+I,f+I)}for(const m of r)l(m.x,m.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const u=10,g=s-u,h=a-u,d=Math.max(1,A-s+2*u),p=Math.max(1,c-a+2*u);return K.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${g} ${h} ${d} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,_)=>K.jsx("rect",{x:m.x??0,y:m.y??0,width:m.width??0,height:m.height??0,fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`rect-${_}`)),n.map((m,_)=>K.jsx("polyline",{fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1,points:(m.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${_}`)),i.map((m,_)=>K.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.fillColor??"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`circle-${_}`)),e.map((m,_)=>K.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${_}`)),r.map((m,_)=>K.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${_}`))]})}var KOi=class extends Fs.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},VOi=({solver:t,createSolver:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=ee.useReducer(f=>f+1,0),[a]=ee.useState(()=>{if(e)return e();if(!t)throw new Error("GenericSolverDebugger requires solver or createSolver");return t}),[A,c]=ee.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[l,u]=ee.useState(n),g=ee.useMemo(()=>{try{return a.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(f){return console.error("Visualization error:",f),{points:[],lines:[],rects:[],circles:[]}}},[a,r]),h=ee.useMemo(()=>(g.rects?.length||0)===0&&(g.lines?.length||0)===0&&(g.points?.length||0)===0&&(g.circles?.length||0)===0,[g]);ee.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const f=document.createElement("script");f.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(f)}},[]),ee.useEffect(()=>{u(n)},[n]);const d=a.pipelineDef!==void 0,p=f=>{const I=a;if(!a.solved&&!a.failed){for(;!a.solved&&!a.failed&&I.currentPipelineStageIndex<=I.pipelineDef.findIndex(C=>C.solverName===f);)a.step();s()}},m=()=>{const f=JSON.stringify(g,null,2),I=new Blob([f],{type:"application/json"}),C=URL.createObjectURL(I),y=document.createElement("a");y.download="visualization.json",y.href=C,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(C)},_=f=>{c(f),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",f)};return K.jsxs("div",{children:[K.jsx(NOi,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:u,onDownloadVisualization:m,onSolverStarted:o,onSolverCompleted:i}),h?K.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):K.jsx(KOi,{fallback:K.jsx(UOi,{graphics:g}),children:A==="canvas"?K.jsx(POi,{graphics:g}):K.jsx(QOi,{graphics:g})}),d&&K.jsx(Uhn,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const zOi=()=>{ee.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},JOi=1e3,NE=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},JOi)},b$e=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},WOi=t=>{const e=t.solverConstructorArgs??[t.solverParams];if(t.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||e.length!==1)return e;const[{input:n,options:o}]=e;return[n,o]},e8="https://github.com/tscircuit/tscircuit-autorouter/issues/new",Khn="https://github.com/tscircuit/copper-pour-solver/issues/new",Vhn="https://github.com/tscircuit/calculate-packing/issues/new",jOi="https://github.com/tscircuit/matchpack/issues/new",zhn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",$Oi={PackSolver2:Vhn,LayoutPipelineSolver:jOi,AutoroutingPipelineSolver:e8,AssignableAutoroutingPipeline2:e8,AssignableAutoroutingPipeline3:e8,AutoroutingPipeline1_OriginalUnravel:e8,AutoroutingPipelineSolver3_HgPortPointPathing:e8,AutoroutingPipelineSolver4:e8,AutoroutingPipelineSolver5:e8,AutoroutingPipelineSolver7_MultiGraph:e8,AutoroutingPipelineSolver8:e8,CopperPourPipelineSolver:Khn,SchematicTracePipelineSolver:zhn},qOi=t=>t.toLowerCase().includes("pack")?tln:t.toLowerCase().includes("rout")?oln:z8i,Jhn=t=>{const e=$Oi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?e8:n.includes("schematic")&&n.includes("trace")?zhn:n.includes("copperpour")?Khn:n.includes("pack")?Vhn:null},XOi=t=>`${b$e(`${t.componentName}-${t.solverName}`)}-solver-input.json`,Whn=t=>{NE(JSON.stringify(t.solverParams,null,2),{fileName:XOi(t),mimeType:"application/json"})},ZOi=({solverEvent:t})=>{const e=Jhn(t.solverName);return K.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[K.jsxs(fA,{type:"button",variant:"outline",size:"sm",onClick:()=>Whn(t),children:[K.jsx(uZ,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?K.jsx(fA,{asChild:!0,variant:"outline",size:"sm",children:K.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[K.jsx(yme,{className:"rf-w-4 rf-h-4"}),"Report"]})}):K.jsxs(fA,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[K.jsx(yme,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},eGi=({solverEvent:t})=>{const e=Jhn(t.solverName);return e?K.jsx(fA,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:K.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:K.jsx(yme,{className:"rf-w-4 rf-h-4"})})}):K.jsx(fA,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:K.jsx(yme,{className:"rf-w-4 rf-h-4"})})},tGi=({solverEvents:t=[]})=>{const[e,n]=ee.useState(null);zOi();const o=ee.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=ee.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=ee.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=gMe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(gMe).join(", ")}`,classFound:!1};try{return{instance:new a(...WOi(r)),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?K.jsx("div",{className:"rf-p-4",children:K.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:K.jsxs("div",{className:"rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),K.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):K.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[K.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[K.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return K.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=qOi(A.solverName);return K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[K.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),K.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[K.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),K.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),K.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?K.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[K.jsx(ZOi,{solverEvent:r}),K.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:K.jsx(yE,{fallback:K.jsx("div",{className:"rf-p-4",children:K.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),K.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:K.jsx(VOi,{solver:s.instance})})})]}):K.jsxs("div",{className:"rf-p-4",children:[K.jsxs("div",{className:"rf-mb-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),K.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&K.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:K.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),K.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[K.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[K.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[K.jsx(eGi,{solverEvent:r}),K.jsx(fA,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8","aria-label":"Download solver input JSON",title:"Download solver input JSON",onClick:()=>Whn(r),children:K.jsx(uZ,{className:"rf-w-4 rf-h-4"})})]})]}),K.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:K.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):K.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},nGi=["subcircuit_id","componentDisplayName","phaseName","routingPhaseIndex","phaseOrdinal","phaseCount","phaseStageIndex","phaseStageCount","connectionCount","obstacleCount","previousTraceCount","isReroutePhase","autorouterName","autorouterVersion","solverName","effort","cacheStatus"],oGi=["phaseOrdinal","routingPhaseIndex","phaseName","phaseStageIndex"];function iGi(t,e){let n=-1,o=-1;for(let i=t.length-1;i>=0;i--){const r=t[i];if(r.status!=="running"||r.subcircuit_id!==e.subcircuit_id||r.componentDisplayName!==e.componentDisplayName)continue;let s=0,a=!1;for(const A of oGi)if(!(r[A]===void 0||e[A]===void 0)){if(r[A]!==e[A]){a=!0;break}s++}!a&&s>o&&(n=i,o=s)}return n}function rGi(t,e){const n=Object.fromEntries(nGi.filter(s=>e[s]!==void 0).map(s=>[s,e[s]])),o=e.simpleRouteJson?structuredClone(e.simpleRouteJson):void 0,i=e.type==="autorouting:start"?-1:iGi(t,e),r={...i===-1?{id:`autorouting_phase_${t.length+1}`}:t[i],...n,status:e.type==="autorouting:start"?"running":e.type==="autorouting:end"?"complete":"error",...e.type==="autorouting:start"?{startSimpleRouteJson:o}:e.type==="autorouting:end"?{endSimpleRouteJson:o}:{errorSimpleRouteJson:o,error:e.error?{...e.error}:void 0}};return i===-1?[...t,r]:t.map((s,a)=>a===i?r:s)}const sGi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),aGi=new Set(["tscircuit","default","auto","auto_local"]);function AGi(t){if(t==="FanoutSolver")return"Fanout";if(t==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const e=t.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(e)return`Pipeline${e[1]}`;const n=t.match(/^AssignableAutoroutingPipeline(\d+)$/);return n?`Assignable${n[1]}`:t}function cGi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&sGi.get(n);if(o)return o;if(n&&!aGi.has(n))return e;const i=t.solverName?.trim();if(i)return AGi(i);const r=t.autorouterVersion?.trim();if(r){const s=r.match(/^beta[_-]pipeline(\d+)$/);return s?`Pipeline${s[1]}`:r==="latest"?"default":r}return e?"default":"Unknown"}const S$e="#fbbf24";function lGi(t){const e=t.endSimpleRouteJson?.traces??[],n=new Set(e.flatMap(i=>[i.pcb_trace_id,i.__replaces_pcb_trace_id].filter(r=>r!==void 0)));return[...(t.startSimpleRouteJson?.traces??[]).filter(i=>!n.has(i.pcb_trace_id)),...e]}function jhn(t){const e=new Map((t.startSimpleRouteJson?.traces??[]).map(n=>[n.pcb_trace_id,n]));return(t.endSimpleRouteJson?.traces??[]).filter(n=>{const o=e.get(n.pcb_trace_id);return!o||!!n.__replaces_pcb_trace_id&&n.__replaces_pcb_trace_id!==o.__replaces_pcb_trace_id||JSON.stringify(o.route)!==JSON.stringify(n.route)}).map(n=>n.pcb_trace_id)}function uGi(t,e){return{outer_diameter:t.via_diameter??e.minViaPadDiameter??e.min_via_pad_diameter??e.minViaDiameter??.6,hole_diameter:t.via_hole_diameter??e.minViaHoleDiameter??e.min_via_hole_diameter??.3}}function $hn(t,e){const n=[];for(const a of t.route)a.route_type==="wire"?n.push({...a,layer:a.layer}):a.route_type==="via"?n.push({route_type:"via",x:a.x,y:a.y,from_layer:a.from_layer,to_layer:a.to_layer,...uGi(a,e)}):a.route_type==="through_obstacle"&&n.push({route_type:"through_pad",start:{...a.start},end:{...a.end},width:a.width,start_layer:a.from_layer,end_layer:a.to_layer,pcb_smtpad_id:a.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:a.circuitJsonMetadata?.pcb_plated_hole_id});const o=a=>{let A=-1,c=Number.POSITIVE_INFINITY;return n.forEach((l,u)=>{if(l.route_type!=="wire")return;const g=Math.hypot(l.x-a.x,l.y-a.y);g<c&&(c=g,A=u)}),A},i=t.route.filter(a=>a.route_type==="jumper").map(a=>[o(a.start),o(a.end)].sort((A,c)=>A-c)).filter(([a,A])=>a>=0&&A>a).sort(([a],[A])=>a-A),r=[];let s=0;for(const[a,A]of i)a>=s&&r.push(n.slice(s,a+1)),s=Math.max(s,A);return s<n.length&&r.push(n.slice(s)),r}function gGi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(jhn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of $hn(r,o)){let a;for(const A of s){if(A.route_type==="through_pad"){a={...A.end,layer:A.end_layer,width:A.width};continue}const c=A.route_type==="wire"?A.layer:A.from_layer;a&&a.layer===c&&(a.x!==A.x||a.y!==A.y)&&e.push({points:[{x:a.x,y:a.y},{x:A.x,y:A.y}],strokeWidth:A.route_type==="wire"?A.width:a.width,strokeColor:S$e,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:S$e,fill:"transparent"}),a={x:A.x,y:A.y,layer:A.route_type==="wire"?A.layer:A.to_layer,width:A.route_type==="wire"?A.width:a?.width??o.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:e,circles:n}}function dGi(t){const e=JSON.stringify(t);let n=2166136261;for(let o=0;o<e.length;o++)n=Math.imul(n^e.charCodeAt(o),16777619);return(n>>>0).toString(36)}const hGi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function pGi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!hGi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:lGi(e),s=new Set(t.filter(c=>c.type==="source_trace").map(c=>c.source_trace_id)),a=["top",...Array.from({length:Math.max(0,o.layerCount-2)},(c,l)=>`inner${l+1}`),...o.layerCount>1?["bottom"]:[]],A=[];for(const c of r){const u=o.connections.find(h=>h.name===c.connection_name||h.source_trace_id===c.connection_name)?.source_trace_id??c.connection_name??"",g=$hn(c,o);for(const[h,d]of g.entries()){const p={type:"pcb_trace",pcb_trace_id:`${e.id}_${n}_${c.pcb_trace_id}_${h}_${dGi(d)}`,subcircuit_id:e.subcircuit_id??void 0,source_trace_id:s.has(u)?u:void 0,route:d};A.push(p);for(const[m,_]of d.entries()){if(_.route_type!=="via")continue;const f=a.indexOf(_.from_layer),I=a.indexOf(_.to_layer),C={type:"pcb_via",pcb_via_id:`${p.pcb_trace_id}_via_${m}`,pcb_trace_id:p.pcb_trace_id,subcircuit_id:e.subcircuit_id??void 0,x:_.x,y:_.y,outer_diameter:_.outer_diameter,hole_diameter:_.hole_diameter,layers:f>=0&&I>=0?a.slice(Math.min(f,I),Math.max(f,I)+1):[_.from_layer,_.to_layer]};A.push(C)}}}return[...i,...A]}const Q$e=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,qhn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",Xhn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,mGi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},_Gi=({circuitJson:t,phases:e=[],isRunning:n=!1})=>{const[o,i]=ee.useState(null),[r,s]=ee.useState("output"),[a,A]=ee.useState(!0),[c,l]=ee.useState(!1),u=ee.useRef(null),[g,h]=ee.useState(480),d=o?e.findIndex(R=>R.id===o.id&&Xhn(R)===Xhn(o)):-1,p=d<0?e.length-1:d,m=e[p],_=d<0,f=!!m?.endSimpleRouteJson,I=m?.startSimpleRouteJson??m?.errorSimpleRouteJson,C=!!I,y=r==="output"&&!f?"input":r==="input"&&!C?"output":r,x=y==="input"?I:m?.endSimpleRouteJson,E=ee.useMemo(()=>!m||!x?null:pGi(t??[],m,y),[t,m,x,y]),B=ee.useMemo(()=>m&&y==="output"&&a?gGi(m):{lines:[],circles:[]},[m,y,a]);if(ee.useLayoutEffect(()=>{const R=u.current;if(!R)return;const F=()=>h(Math.max(360,R.clientHeight));F();const O=new ResizeObserver(F);return O.observe(R),()=>O.disconnect()},[!!m]),!m)return K.jsxs("div",{className:"rf-flex rf-min-h-[400px] rf-flex-col rf-items-center rf-justify-center rf-gap-3 rf-p-8 rf-text-center",children:[K.jsx(oln,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),K.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),K.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const S=Q$e(m,p),Q=m.status==="running"&&n,w=!f,M=I?.connections.length,k=E?.filter(R=>R.type==="pcb_trace").length??0;return K.jsxs("div",{className:"rf-flex rf-h-full rf-min-h-[620px] rf-flex-col rf-bg-white md:rf-flex-row","data-testid":"autorouting-explorer",children:[K.jsxs("aside",{className:"rf-flex rf-shrink-0 rf-flex-col rf-border-b rf-border-gray-200 md:rf-w-52 md:rf-border-b-0 md:rf-border-r","aria-label":"Routing phases",children:[K.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between rf-px-3 rf-py-2 rf-text-xs rf-text-gray-500",children:[K.jsx("span",{children:"Routing phases"}),K.jsx("span",{children:e.length})]}),K.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const O=jhn(R).length,U=R.endSimpleRouteJson?`${O} ${O===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return K.jsxs("button",{type:"button","aria-pressed":F===p,title:`${qhn(R)} · ${U}`,onClick:()=>i(R),className:Hi("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===p?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[K.jsx("span",{className:Hi("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===p?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),K.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[K.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[K.jsx("span",{className:"rf-min-w-0 rf-flex-1 rf-truncate rf-text-xs rf-font-medium rf-leading-5 rf-text-gray-800",title:Q$e(R,F),children:Q$e(R,F)}),R.status==="complete"?K.jsx(IS,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?K.jsx(XJe,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?K.jsx(xE,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),K.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[cGi(R)," · ",U]})]})]},R.id)})})]}),K.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[K.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-gap-3 rf-border-b rf-border-gray-200 rf-px-4 rf-py-3",children:[K.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[S,K.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[p+1," of ",e.length]})]}),n&&K.jsx("button",{type:"button",onClick:()=>i(null),disabled:_,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:_?"Following latest":"Follow latest"}),K.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>K.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:Hi("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),K.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-px-4 rf-py-2 rf-text-xs rf-text-gray-600",children:[K.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[K.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),K.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:S$e}}),"Highlight changes (all layers)"]}),K.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),w&&K.jsx("div",{className:Hi("rf-border-y rf-px-4 rf-py-2 rf-text-xs",m.status==="error"?"rf-border-red-100 rf-bg-red-50 rf-text-red-700":"rf-border-blue-100 rf-bg-blue-50 rf-text-blue-700"),role:"status",children:m.status==="error"?`Routing failed: ${m.error?.message||"No output was captured."}`:Q?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),K.jsx("div",{ref:u,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?K.jsx(f$e,{circuitJson:E,height:g,allowEditing:!1,clickToInteractEnabled:!1,initialState:mGi,debugGraphics:B}):K.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),K.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-border-t rf-border-gray-200 rf-px-4 rf-py-3 rf-text-xs rf-text-gray-500",children:[K.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${qhn(m)}`]}),K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[K.jsxs("button",{type:"button",disabled:!x,onClick:()=>NE(JSON.stringify(x,null,2),{fileName:`${m.id}-${y}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[K.jsx(uZ,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),K.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[K.jsx(xT,{className:Hi("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&K.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${S} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},Zhn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{ee.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{aG.captureException(o)}catch{}}},[t,e]),ee.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{aG.captureException(i,{error_type:o.type})}catch{}}},[n])},epn=t=>{ee.useEffect(()=>{try{pUo(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},tpn="0.0.2824",fGi={version:tpn},ufe=AFt()(cFt(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{t({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),IGi=t=>{const[e,n]=ee.useState([]),[o,i]=ee.useState(null),[r,s]=ee.useState(""),[a,A]=TO("eval-version-selection",null),c=ufe(h=>h.setLastRunEvalVersion),l=ufe(h=>h.lastRunEvalVersion);return ee.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(h=>h.json()).then(h=>{if(Array.isArray(h?.versions)){let d=[...h.versions];h.tags?.latest&&(i(h.tags.latest),d=d.filter(p=>p!==h.tags.latest)),n(d)}}).catch(()=>{})},[t]),ee.useEffect(()=>{t&&(a?(window.TSCIRCUIT_LATEST_EVAL_VERSION=a,c(a)):o&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=o,c(o)))},[t,a,o]),{versions:ee.useMemo(()=>e.filter(h=>h.includes(r)).slice(0,50),[e,r]),latestVersion:o,lastRunEvalVersion:l,search:r,setSearch:s,selectVersion:h=>{A(h),s("")}}},CGi=({snippetNames:t,onSelect:e,onCancel:n,isOpen:o})=>{const[i,r]=ee.useState(""),[s,a]=ee.useState("");if(!o)return null;const A=t.filter(u=>u.toLowerCase().includes(s.toLowerCase())),c=s&&!t.includes(s),l=u=>{u.key==="Enter"&&(A.length===1?r(A[0]):c&&r(s))};return K.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:K.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[K.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),K.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:u=>a(u.target.value),onKeyDown:l}),K.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[A.map(u=>K.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${i===u?"bg-blue-50":""}`,onClick:()=>r(u),children:u},u)),c&&K.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${i===s?"bg-blue-50":""}`,onClick:()=>r(s),children:['Create new "',s,'"']})]}),K.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:n,children:"Cancel"}),K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>i&&e(i),disabled:!i,children:i===s?`Create "${i}"`:`Save to ${i}`})]})]})})},yGi=t=>{const e=ee.useRef(null),n=md(o=>o.recentEvents);ee.useEffect(()=>{if(n.length===0)return;const o=n[0];o.event_id!==e.current&&(t(o),e.current=o.event_id)},[n,t])};var xGi=Object.defineProperty,QS=(t,e)=>xGi(t,"name",{value:e,configurable:!0}),EGi="AlertDialog",[BGi,lmr]=Dx(EGi,[v0n]),vS=v0n(),bGi=QS(t=>{const{__scopeAlertDialog:e,...n}=t,o=vS(e);return K.jsx(n_e,{...o,...n,modal:!0})},"AlertDialog");ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(zvi,{...r,...i,ref:n})},"AlertDialogTrigger"));var SGi=QS(t=>{const{__scopeAlertDialog:e,...n}=t,o=vS(e);return K.jsx(o_e,{...o,...n})},"AlertDialogPortal"),QGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(bZ,{...r,...i,ref:n})},"AlertDialogOverlay")),vGi="AlertDialogContent",[wGi,PGi]=BGi(vGi),MGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,children:i,...r}=e,s=vS(o),a=ee.useRef(null),A=$A(n,a),c=ee.useRef(null);return K.jsx(wGi,{scope:o,cancelRef:c,children:K.jsx(QZ,{role:"alertdialog",...s,...r,ref:A,onOpenAutoFocus:ar(r.onOpenAutoFocus,l=>{l.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:i})})},"AlertDialogContent")),DGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(i_e,{...r,...i,ref:n})},"AlertDialogTitle")),NGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(r_e,{...r,...i,ref:n})},"AlertDialogDescription")),RGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(LWe,{...r,...i,ref:n})},"AlertDialogAction")),TGi="AlertDialogCancel",kGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,{cancelRef:r}=PGi(TGi,o),s=vS(o),a=$A(n,r);return K.jsx(LWe,{...s,...i,ref:a})},"AlertDialogCancel")),FGi=bGi,LGi=SGi,npn=QGi,opn=MGi,ipn=RGi,rpn=kGi,spn=DGi,apn=NGi;const Apn=FGi,HGi=LGi,cpn=ee.forwardRef(({className:t,...e},n)=>K.jsx(npn,{className:Hi("rf-fixed rf-inset-0 rf-z-50 rf-bg-black/80 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0",t),...e,ref:n}));cpn.displayName=npn.displayName;const v$e=ee.forwardRef(({className:t,...e},n)=>K.jsxs(HGi,{children:[K.jsx(cpn,{}),K.jsx(opn,{ref:n,className:Hi("rf-fixed rf-left-[50%] rf-top-[50%] rf-z-50 rf-grid rf-w-full rf-max-w-lg rf-translate-x-[-50%] rf-translate-y-[-50%] rf-gap-4 rf-border rf-border-zinc-200 rf-bg-white rf-p-6 rf-shadow-lg rf-duration-200 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[state=closed]:rf-slide-out-to-left-1/2 data-[state=closed]:rf-slide-out-to-top-[48%] data-[state=open]:rf-slide-in-from-left-1/2 data-[state=open]:rf-slide-in-from-top-[48%] sm:rf-rounded-lg dark:rf-border-zinc-800 dark:rf-bg-zinc-950",t),...e})]}));v$e.displayName=opn.displayName;const w$e=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col rf-space-y-2 rf-text-center sm:rf-text-left",t),...e});w$e.displayName="AlertDialogHeader";const P$e=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col-reverse sm:rf-flex-row sm:rf-justify-end sm:rf-space-x-2",t),...e});P$e.displayName="AlertDialogFooter";const M$e=ee.forwardRef(({className:t,...e},n)=>K.jsx(spn,{ref:n,className:Hi("rf-text-lg rf-font-semibold",t),...e}));M$e.displayName=spn.displayName;const D$e=ee.forwardRef(({className:t,...e},n)=>K.jsx(apn,{ref:n,className:Hi("rf-text-sm rf-text-zinc-500 dark:rf-text-zinc-400",t),...e}));D$e.displayName=apn.displayName;const OGi=ee.forwardRef(({className:t,...e},n)=>K.jsx(ipn,{ref:n,className:Hi(rU(),t),...e}));OGi.displayName=ipn.displayName;const N$e=ee.forwardRef(({className:t,...e},n)=>K.jsx(rpn,{ref:n,className:Hi(rU({variant:"outline"}),"rf-mt-2 sm:rf-mt-0",t),...e}));N$e.displayName=rpn.displayName;var GGi=Object.defineProperty,wS=(t,e)=>GGi(t,"name",{value:e,configurable:!0}),R$e="Checkbox",[YGi,umr]=Dx(R$e),[UGi,T$e]=YGi(R$e);function lpn(t){const{__scopeCheckbox:e,checked:n,children:o,defaultChecked:i,disabled:r,form:s,name:a,onCheckedChange:A,required:c,value:l="on",internal_do_not_use_render:u}=t,[g,h]=MB({prop:n,defaultProp:i??!1,onChange:A,caller:R$e}),[d,p]=ee.useState(null),[m,_]=ee.useState(null),f=ee.useRef(!1),[I,C]=ee.useReducer(E=>E+1,0),y=d?!!s||!!d.closest("form"):!0,x={checked:g,disabled:r,setChecked:h,control:d,setControl:p,name:a,form:s,value:l,hasConsumerStoppedPropagationRef:f,userInteractionCount:I,onUserInteraction:C,required:c,defaultChecked:PS(i)?!1:i,isFormControl:y,bubbleInput:m,setBubbleInput:_};return K.jsx(UGi,{scope:e,...x,children:gpn(u)?u(x):o})}wS(lpn,"CheckboxProvider");var KGi="CheckboxTrigger",VGi=ee.forwardRef(wS(function({__scopeCheckbox:e,onKeyDown:n,onClick:o,...i},r){const{control:s,value:a,disabled:A,checked:c,required:l,setControl:u,setChecked:g,hasConsumerStoppedPropagationRef:h,onUserInteraction:d,isFormControl:p,bubbleInput:m}=T$e(KGi,e),_=$A(r,u),f=ee.useRef(c);return ee.useEffect(()=>{const I=s?.form;if(I){const C=wS(()=>g(f.current),"reset");return I.addEventListener("reset",C),()=>I.removeEventListener("reset",C)}},[s,g]),K.jsx(Na.button,{type:"button",role:"checkbox","aria-checked":PS(c)?"mixed":c,"aria-required":l,"data-state":k$e(c),"data-disabled":A?"":void 0,disabled:A,value:a,...i,ref:_,onKeyDown:ar(n,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:ar(o,I=>{d(),g(C=>PS(C)?!0:!C),m&&p&&(h.current=I.isPropagationStopped(),h.current||I.stopPropagation())})})},"CheckboxTrigger")),upn=ee.forwardRef(wS(function(e,n){const{__scopeCheckbox:o,name:i,checked:r,defaultChecked:s,required:a,disabled:A,value:c,onCheckedChange:l,form:u,...g}=e;return K.jsx(lpn,{__scopeCheckbox:o,checked:r,defaultChecked:s,disabled:A,required:a,onCheckedChange:l,name:i,form:u,value:c,internal_do_not_use_render:({isFormControl:h})=>K.jsxs(K.Fragment,{children:[K.jsx(VGi,{...g,ref:n,__scopeCheckbox:o}),h&&K.jsx(jGi,{__scopeCheckbox:o})]})})},"Checkbox")),zGi="CheckboxIndicator",JGi=ee.forwardRef(wS(function(e,n){const{__scopeCheckbox:o,forceMount:i,...r}=e,s=T$e(zGi,o);return K.jsx(cE,{present:i||PS(s.checked)||s.checked===!0,children:K.jsx(Na.span,{"data-state":k$e(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),WGi="CheckboxBubbleInput",jGi=ee.forwardRef(wS(function({__scopeCheckbox:e,onClick:n,...o},i){const{control:r,hasConsumerStoppedPropagationRef:s,userInteractionCount:a,checked:A,defaultChecked:c,required:l,disabled:u,name:g,value:h,form:d,bubbleInput:p,setBubbleInput:m}=T$e(WGi,e),_=$A(i,m),f=yWe(r),I=ee.useRef(!1),C=ee.useRef(A),y=ee.useRef(a);ee.useEffect(()=>{const E=p;if(!E)return;const B=window.HTMLInputElement.prototype,Q=Object.getOwnPropertyDescriptor(B,"checked").set,w=a!==y.current;y.current=a;const M=C.current!==A;C.current=A;const k=!(w&&s.current);if(M&&Q){I.current=!w;const R=new Event("click",{bubbles:k});E.indeterminate=PS(A),Q.call(E,PS(A)?!1:A),E.dispatchEvent(R),I.current=!1}},[p,A,s,a]);const x=ee.useRef(PS(A)?!1:A);return K.jsx(Na.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:g,value:h,form:d,...o,tabIndex:-1,ref:_,onClick:ar(n,E=>{I.current&&E.stopPropagation()}),style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function gpn(t){return typeof t=="function"}wS(gpn,"isFunction");function PS(t){return t==="indeterminate"}wS(PS,"isIndeterminate");function k$e(t){return PS(t)?"indeterminate":t?"checked":"unchecked"}wS(k$e,"getState");const mee=ee.forwardRef(({className:t,...e},n)=>K.jsx(upn,{ref:n,className:Hi("rf-peer rf-h-4 rf-w-4 rf-shrink-0 rf-rounded-sm rf-border rf-border-zinc-200 rf-border-zinc-900 rf-shadow focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 data-[state=checked]:rf-bg-zinc-900 data-[state=checked]:rf-text-zinc-50 dark:rf-border-zinc-800 dark:rf-border-zinc-50 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=checked]:rf-bg-zinc-50 dark:data-[state=checked]:rf-text-zinc-900",t),...e,children:K.jsx(JGi,{className:Hi("rf-flex rf-items-center rf-justify-center rf-text-current"),children:K.jsx(IS,{className:"rf-h-4 rf-w-4"})})}));mee.displayName=upn.displayName;const HT=n_e,$Gi=o_e,dpn=ee.forwardRef(({className:t,...e},n)=>K.jsx(bZ,{className:Hi("rf-fixed rf-inset-0 rf-z-50 rf-bg-black/80 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0",t),...e,ref:n}));dpn.displayName=bZ.displayName;const YP=ee.forwardRef(({className:t,children:e,showOverlay:n=!0,...o},i)=>K.jsxs($Gi,{children:[K.jsx(dpn,{className:Hi(n?"":"rf-hidden")}),K.jsx(QZ,{ref:i,className:Hi("rf-fixed rf-left-[50%] rf-top-[50%] rf-z-50 rf-grid rf-w-full rf-max-w-lg rf-translate-x-[-50%] rf-translate-y-[-50%] rf-gap-4 rf-border rf-border-zinc-200 rf-bg-white rf-p-6 rf-shadow-lg rf-duration-200 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[state=closed]:rf-slide-out-to-left-1/2 data-[state=closed]:rf-slide-out-to-top-[48%] data-[state=open]:rf-slide-in-from-left-1/2 data-[state=open]:rf-slide-in-from-top-[48%] sm:rf-rounded-lg dark:rf-border-zinc-800 dark:rf-bg-zinc-950",t),...o,children:e})]}));YP.displayName=QZ.displayName;const UP=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col rf-space-y-2 rf-text-center sm:rf-text-left",t),...e});UP.displayName="DialogHeader";const UU=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col-reverse sm:rf-flex-row sm:rf-justify-end sm:rf-space-x-2",t),...e});UU.displayName="DialogFooter";const KP=ee.forwardRef(({className:t,...e},n)=>K.jsx(i_e,{ref:n,className:Hi("rf-text-lg rf-font-semibold",t),...e}));KP.displayName=i_e.displayName;const OT=ee.forwardRef(({className:t,...e},n)=>K.jsx(r_e,{ref:n,className:Hi("rf-text-sm rf-text-zinc-500 dark:rf-text-zinc-400",t),...e}));OT.displayName=r_e.displayName;const gfe={"tscircuit.com":{label:"tscircuit.com",placeholder:"Search tscircuit packages...",emptyMessage:"No packages found"},jlcpcb:{label:"JLCPCB Parts",placeholder:"Search JLCPCB parts (e.g. C14663)...",emptyMessage:"No parts found"},kicad:{label:"KiCad Footprints",placeholder:"Search KiCad footprints...",emptyMessage:"No footprints found"}},qGi="https://cdn.jsdelivr.net/npm/easyeda@latest/dist/browser/index.js";let F$e=null;const L$e=async()=>(F$e||(F$e=import(qGi)),F$e),XGi=t=>(e,n)=>{const o=new Headers(n?.headers),i={};return o.forEach((r,s)=>{i[s]=r}),fetch(`${t?.apiBase??QC}/proxy`,{...n,headers:{...i,"X-Target-Url":e.toString(),"X-Sender-Origin":i.origin??"","X-Sender-Host":i.host??"https://easyeda.com","X-Sender-Referer":i.referer??"","X-Sender-User-Agent":i["user-agent"]??"","X-Sender-Cookie":i.cookie??"",authority:i.authority??"","content-type":i["content-type"]??"",...t?.headers}})},ZGi=async(t,e=10)=>{const n=encodeURIComponent(t),o=await fetch(`https://jlcsearch.tscircuit.com/api/search?limit=${e}&q=${n}`);if(!o.ok)throw new Error(`JLCPCB API error: ${o.status}`);return(await o.json()).components??[]},eYi=t=>({lcscId:t.lcsc,manufacturer:t.mfr,description:t.description,partNumber:`C${t.lcsc}`,package:t.package,price:t.price,stock:t.stock,isBasic:t.is_basic}),hpn=async(t,e)=>{const{fetchEasyEDAComponent:n}=await L$e();return n(t,{fetch:XGi(e),includeModelMetadata:e?.includeModelMetadata})},tYi=async(t,e)=>{const{convertRawEasyToTsx:n}=await L$e(),o=await hpn(t,e);return n({rawEasy:o})},nYi=async(t,e)=>{const{EasyEdaJsonSchema:n,convertEasyEdaJsonToCircuitJson:o}=await L$e(),i=await hpn(t,{...e,includeModelMetadata:!1}),r=n.parse(i);return o(r,{shouldRecenter:!0,showDesignator:!0,useModelCdn:!1})};function VP(t){return Array.isArray?Array.isArray(t):mpn(t)==="[object Array]"}function oYi(t){if(typeof t=="string")return t;if(typeof t=="bigint")return t.toString();const e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function H$e(t){return t==null?"":oYi(t)}function RC(t){return typeof t=="string"}function dfe(t){return typeof t=="number"}function iYi(t){return t===!0||t===!1||rYi(t)&&mpn(t)=="[object Boolean]"}function ppn(t){return typeof t=="object"}function rYi(t){return ppn(t)&&t!==null}function RE(t){return t!=null}function hfe(t){return!t.trim().length}function mpn(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const sYi="Incorrect 'index' type",O$e="Invalid doc index: must be a non-negative integer within the bounds of the docs array",aYi=t=>`Invalid value for key ${t}`,AYi=t=>`Pattern length exceeds max of ${t}.`,cYi=t=>`Missing ${t} property in key`,lYi=t=>`Property 'weight' in key '${t}' must be a positive integer`,uYi="Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.",_pn=Object.prototype.hasOwnProperty;var gYi=class{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(n=>{const o=fpn(n);this._keys.push(o),this._keyMap[o.id]=o,e+=o.weight}),this._keys.forEach(n=>{n.weight/=e})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function fpn(t){let e=null,n=null,o=null,i=1,r=null;if(RC(t)||VP(t))o=t,e=Ipn(t),n=pfe(t);else{if(!_pn.call(t,"name"))throw new Error(cYi("name"));const s=t.name;if(o=s,_pn.call(t,"weight")&&t.weight!==void 0&&(i=t.weight,i<=0))throw new Error(lYi(pfe(s)));e=Ipn(s),n=pfe(s),r=t.getFn??null}return{path:e,id:n,weight:i,src:o,getFn:r}}function Ipn(t){return VP(t)?t:t.split(".")}function pfe(t){return VP(t)?t.join("."):t}function dYi(t,e){const n=[];let o=!1;const i=(r,s,a,A)=>{if(RE(r))if(!s[a])n.push(A!==void 0?{v:r,i:A}:r);else{const c=r[s[a]];if(!RE(c))return;if(a===s.length-1&&(RC(c)||dfe(c)||iYi(c)||typeof c=="bigint"))n.push(A!==void 0?{v:H$e(c),i:A}:H$e(c));else if(VP(c)){o=!0;for(let l=0,u=c.length;l<u;l+=1)i(c[l],s,a+1,l)}else s.length&&i(c,s,a+1,A)}};return i(t,RC(e)?e.split("."):e,0),o?n:n[0]}const wa=Object.freeze({...{isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:dYi,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}});function hYi(t){return t>=9&&t<=13||t===32||t===160}function pYi(t=1,e=3){const n=new Map,o=Math.pow(10,e);return{get(i){let r=0,s=!1;for(let A=0;A<i.length;A++)hYi(i.charCodeAt(A))?s=!1:s||(r++,s=!0);if(r===0&&(r=1),n.has(r))return n.get(r);const a=Math.round(o/Math.pow(r,.5*t))/o;return n.set(r,a),a},clear(){n.clear()}}}var G$e=class{constructor({getFn:t=wa.getFn,fieldNormWeight:e=wa.fieldNormWeight}={}){this.norm=pYi(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((e,n)=>{this._keysMap[e.id]=n})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const t=this.docs.length;this.records=new Array(t);let e=0;if(RC(this.docs[0]))for(let n=0;n<t;n++){const o=this._createStringRecord(this.docs[n],n);o&&(this.records[e++]=o)}else for(let n=0;n<t;n++)this.records[e++]=this._createObjectRecord(this.docs[n],n);this.records.length=e,this.norm.clear()}add(t,e){if(!Number.isInteger(e)||e<0)throw new Error(O$e);if(RC(t)){const o=this._createStringRecord(t,e);return o&&this.records.push(o),o}const n=this._createObjectRecord(t,e);return this.records.push(n),n}removeAt(t){if(!Number.isInteger(t)||t<0)throw new Error(O$e);for(let e=0,n=this.records.length;e<n;e+=1)if(this.records[e].i===t){this.records.splice(e,1);break}for(let e=0,n=this.records.length;e<n;e+=1)this.records[e].i>t&&(this.records[e].i-=1)}removeAll(t){const e=new Set;for(const o of t)Number.isInteger(o)&&o>=0&&e.add(o);if(e.size===0)return;this.records=this.records.filter(o=>!e.has(o.i));const n=Array.from(e).sort((o,i)=>o-i);for(const o of this.records){let i=0,r=n.length;for(;i<r;){const s=i+r>>>1;n[s]<o.i?i=s+1:r=s}o.i-=i}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(t,e){return!RE(t)||hfe(t)?null:{v:t,i:e,n:this.norm.get(t)}}_createObjectRecord(t,e){const n={i:e,$:{}};for(let o=0,i=this.keys.length;o<i;o++){const r=this.keys[o],s=r.getFn?r.getFn(t):this.getFn(t,r.path);if(RE(s)){if(VP(s)){const a=[];for(let A=0,c=s.length;A<c;A+=1){const l=s[A];if(RE(l)){if(RC(l)){if(!hfe(l)){const u={v:l,i:A,n:this.norm.get(l)};a.push(u)}}else if(RE(l.v)){const u=RC(l.v)?l.v:H$e(l.v);if(!hfe(u)){const g={v:u,i:l.i,n:this.norm.get(u)};a.push(g)}}}}n.$[o]=a}else if(RC(s)&&!hfe(s)){const a={v:s,n:this.norm.get(s)};n.$[o]=a}}}return n}toJSON(){return{keys:this.keys.map(({getFn:t,...e})=>e),records:this.records}}};function Cpn(t,e,{getFn:n=wa.getFn,fieldNormWeight:o=wa.fieldNormWeight}={}){const i=new G$e({getFn:n,fieldNormWeight:o});return i.setKeys(t.map(fpn)),i.setSources(e),i.create(),i}function mYi(t,{getFn:e=wa.getFn,fieldNormWeight:n=wa.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new G$e({getFn:e,fieldNormWeight:n});return r.setKeys(o),r.setIndexRecords(i),r}function _Yi(t=[],e=wa.minMatchCharLength){const n=[];let o=-1,i=-1,r=0;for(let s=t.length;r<s;r+=1){const a=t[r];a&&o===-1?o=r:!a&&o!==-1&&(i=r-1,i-o+1>=e&&n.push([o,i]),o=-1)}return t[r-1]&&r-o>=e&&n.push([o,r-1]),n}function fYi(t,e,n,{location:o=wa.location,distance:i=wa.distance,threshold:r=wa.threshold,findAllMatches:s=wa.findAllMatches,minMatchCharLength:a=wa.minMatchCharLength,includeMatches:A=wa.includeMatches,ignoreLocation:c=wa.ignoreLocation}={}){if(e.length>32)throw new Error(AYi(32));const l=e.length,u=t.length,g=Math.max(0,Math.min(o,u));let h=r,d=g;const p=(S,Q)=>{const w=S/l;if(c)return w;const M=Math.abs(g-Q);return i?w+M/i:M?1:w},m=a>1||A,_=m?Array(u):[];let f;for(;(f=t.indexOf(e,d))>-1;){const S=p(0,f);if(h=Math.min(S,h),d=f+l,m){let Q=0;for(;Q<l;)_[f+Q]=1,Q+=1}}d=-1;let I=[],C=1,y=0,x=l+u;const E=1<<l-1;for(let S=0;S<l;S+=1){let Q=0,w=x;for(;Q<w;)p(S,g+w)<=h?Q=w:x=w,w=Math.floor((x-Q)/2+Q);x=w;let M=Math.max(1,g-w+1);const k=s?u:Math.min(g+w,u)+l,R=Array(k+2);R[k+1]=(1<<S)-1;for(let F=k;F>=M;F-=1){const O=F-1,U=n[t[O]];if(R[F]=(R[F+1]<<1|1)&U,S&&(R[F]|=(I[F+1]|I[F])<<1|1|I[F+1]),R[F]&E&&(C=p(S,O),C<=h)){if(h=C,d=O,y=S,d<=g)break;M=Math.max(1,2*g-d)}}if(p(S+1,g)>h)break;I=R}if(m&&d>=0){const S=Math.min(u-1,d+l-1+y);for(let Q=d;Q<=S;Q+=1)n[t[Q]]&&(_[Q]=1)}const B={isMatch:d>=0,score:Math.max(.001,C)};if(m){const S=_Yi(_,a);S.length?A&&(B.indices=S):B.isMatch=!1}return B}function IYi(t){const e={};for(let n=0,o=t.length;n<o;n+=1){const i=t.charAt(n);e[i]=(e[i]||0)|1<<o-n-1}return e}function Y$e(t){if(t.length<=1)return t;t.sort((n,o)=>n[0]-o[0]||n[1]-o[1]);const e=[t[0]];for(let n=1,o=t.length;n<o;n+=1){const i=e[e.length-1],r=t[n];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):e.push(r)}return e}const ypn={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},CYi=new RegExp("["+Object.keys(ypn).join("")+"]","g"),_ee=typeof String.prototype.normalize=="function"?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(CYi,e=>ypn[e]):t=>t;var U$e=class{constructor(t,{location:e=wa.location,threshold:n=wa.threshold,distance:o=wa.distance,includeMatches:i=wa.includeMatches,findAllMatches:r=wa.findAllMatches,minMatchCharLength:s=wa.minMatchCharLength,isCaseSensitive:a=wa.isCaseSensitive,ignoreDiacritics:A=wa.ignoreDiacritics,ignoreLocation:c=wa.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:o,includeMatches:i,findAllMatches:r,minMatchCharLength:s,isCaseSensitive:a,ignoreDiacritics:A,ignoreLocation:c},t=a?t:t.toLowerCase(),t=A?_ee(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const l=(g,h)=>{this.chunks.push({pattern:g,alphabet:IYi(g),startIndex:h})},u=this.pattern.length;if(u>32){let g=0;const h=u%32,d=u-h;for(;g<d;)l(this.pattern.substr(g,32),g),g+=32;if(h){const p=u-32;l(this.pattern.substr(p),p)}}else l(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:n,includeMatches:o}=this.options;if(t=e?t:t.toLowerCase(),t=n?_ee(t):t,this.pattern===t){if(t.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const d={isMatch:!0,score:0};return o&&(d.indices=[[0,t.length-1]]),d}const{location:i,distance:r,threshold:s,findAllMatches:a,minMatchCharLength:A,ignoreLocation:c}=this.options,l=[];let u=0,g=!1;this.chunks.forEach(({pattern:d,alphabet:p,startIndex:m})=>{const{isMatch:_,score:f,indices:I}=fYi(t,d,p,{location:i+m,distance:r,threshold:s,findAllMatches:a,minMatchCharLength:A,includeMatches:o,ignoreLocation:c});_&&(g=!0),u+=f,_&&I&&l.push(...I)});const h={isMatch:g,score:g?u/this.chunks.length:1};return g&&o&&(h.indices=Y$e(l)),h}};const yYi=new Set(["fuzzy","include"]);function xYi(t){return t.startsWith("inverse")}const K$e=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:t=>({type:"exact",search(e){const n=e===t;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:t=>({type:"include",search(e){let n=0,o;const i=[],r=t.length;for(;(o=e.indexOf(t,n))>-1;)n=o+r,i.push([o,n-1]);const s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:t=>({type:"prefix-exact",search(e){const n=e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:t=>({type:"inverse-prefix-exact",search(e){const n=!e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:t=>({type:"inverse-suffix-exact",search(e){const n=!e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:t=>({type:"suffix-exact",search(e){const n=e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[e.length-t.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:t=>({type:"inverse-exact",search(e){const n=e.indexOf(t)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(t,e={})=>{const n=new U$e(t,{location:e.location??wa.location,threshold:e.threshold??wa.threshold,distance:e.distance??wa.distance,includeMatches:e.includeMatches??wa.includeMatches,findAllMatches:e.findAllMatches??wa.findAllMatches,minMatchCharLength:e.minMatchCharLength??wa.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??wa.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??wa.ignoreDiacritics,ignoreLocation:e.ignoreLocation??wa.ignoreLocation});return{type:"fuzzy",search(o){return n.searchIn(o)}}}}],xpn=K$e.length,EYi="\0",BYi="|";function bYi(t){const e=[],n=t.length;let o=0;for(;o<n;){for(;o<n&&t[o]===" ";)o++;if(o>=n)break;let i=o;for(;i<n&&t[i]!==" "&&t[i]!=='"';)i++;if(i<n&&t[i]==='"'){for(i++;i<n;){if(t[i]==='"'){const r=i+1;if(r>=n||t[r]===" "){i++;break}if(t[r]==="$"&&(r+1>=n||t[r+1]===" ")){i+=2;break}}i++}e.push(t.substring(o,i)),o=i}else{for(;i<n&&t[i]!==" ";)i++;e.push(t.substring(o,i)),o=i}}return e}function Epn(t,e){const n=t.match(e);return n?n[1]:null}function SYi(t,e={}){return t.replace(/\\\|/g,EYi).split(BYi).map(n=>{const o=bYi(n.replace(/\u0000/g,"|").trim()).filter(r=>r&&!!r.trim()),i=[];for(let r=0,s=o.length;r<s;r+=1){const a=o[r];let A=!1,c=-1;for(;!A&&++c<xpn;){const l=K$e[c],u=Epn(a,l.multiRegex);u&&(i.push(l.create(u,e)),A=!0)}if(!A)for(c=-1;++c<xpn;){const l=K$e[c],u=Epn(a,l.singleRegex);if(u){i.push(l.create(u,e));break}}}return i})}var QYi=class{constructor(t,{isCaseSensitive:e=wa.isCaseSensitive,ignoreDiacritics:n=wa.ignoreDiacritics,includeMatches:o=wa.includeMatches,minMatchCharLength:i=wa.minMatchCharLength,ignoreLocation:r=wa.ignoreLocation,findAllMatches:s=wa.findAllMatches,location:a=wa.location,threshold:A=wa.threshold,distance:c=wa.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:n,includeMatches:o,minMatchCharLength:i,findAllMatches:s,ignoreLocation:r,location:a,threshold:A,distance:c},t=e?t:t.toLowerCase(),t=n?_ee(t):t,this.pattern=t,this.query=SYi(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:o,ignoreDiacritics:i}=this.options;t=o?t:t.toLowerCase(),t=i?_ee(t):t;let r=0;const s=[];let a=0,A=!1;for(let c=0,l=e.length;c<l;c+=1){const u=e[c];s.length=0,r=0,A=!1;for(let g=0,h=u.length;g<h;g+=1){const d=u[g],{isMatch:p,indices:m,score:_}=d.search(t);if(p)r+=1,a+=_,xYi(d.type)&&(A=!0),n&&(yYi.has(d.type)?s.push(...m):s.push(m));else{a=0,r=0,s.length=0,A=!1;break}}if(r){const g={isMatch:!0,score:a/r};return A&&(g.hasInverse=!0),n&&(g.indices=Y$e(s)),g}}return{isMatch:!1,score:1}}};const V$e=[];function z$e(...t){V$e.push(...t)}function mfe(t,e){for(let n=0,o=V$e.length;n<o;n+=1){const i=V$e[n];if(i.condition(t,e))return new i(t,e)}return new U$e(t,e)}const _fe={AND:"$and",OR:"$or"},J$e={PATH:"$path",PATTERN:"$val"},W$e=t=>!!(t[_fe.AND]||t[_fe.OR]),vYi=t=>!!t[J$e.PATH],wYi=t=>!VP(t)&&ppn(t)&&!W$e(t),Bpn=t=>({[_fe.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function bpn(t,e,{auto:n=!0}={}){const o=i=>{if(RC(i)){const A={keyId:null,pattern:i};return n&&(A.searcher=mfe(i,e)),A}const r=Object.keys(i),s=vYi(i);if(!s&&r.length>1&&!W$e(i))return o(Bpn(i));if(wYi(i)){const A=s?i[J$e.PATH]:r[0],c=s?i[J$e.PATTERN]:i[A];if(!RC(c))throw new Error(aYi(A));const l={keyId:pfe(A),pattern:c};return n&&(l.searcher=mfe(c,e)),l}const a={children:[],operator:r[0]};return r.forEach(A=>{const c=i[A];VP(c)&&c.forEach(l=>{a.children.push(o(l))})}),a};return W$e(t)||(t=Bpn(t)),o(t)}function j$e(t,{ignoreFieldNorm:e=wa.ignoreFieldNorm}){let n=1;return t.forEach(({key:o,norm:i,score:r})=>{const s=o?o.weight:null;n*=Math.pow(r===0&&s?Number.EPSILON:r,(s||1)*(e?1:i))}),n}function PYi(t,{ignoreFieldNorm:e=wa.ignoreFieldNorm}){t.forEach(n=>{n.score=j$e(n.matches,{ignoreFieldNorm:e})})}var MYi=class{constructor(t,e){this.limit=t,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):this.comparator(t,this.heap[0])<0&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(t){const e=this.heap;for(;t>0;){const n=t-1>>1;if(this.comparator(e[t],e[n])<=0)break;const o=e[t];e[t]=e[n],e[n]=o,t=n}}_sinkDown(t){const e=this.heap,n=e.length;let o=t;do{t=o;const i=2*t+1,r=2*t+2;if(i<n&&this.comparator(e[i],e[o])>0&&(o=i),r<n&&this.comparator(e[r],e[o])>0&&(o=r),o!==t){const s=e[t];e[t]=e[o],e[o]=s}}while(o!==t)}};function DYi(t){const e=[];return t.matches.forEach(n=>{if(!RE(n.indices)||!n.indices.length)return;const o={indices:n.indices,value:n.value};n.key&&(o.key=n.key.id),n.idx>-1&&(o.refIndex=n.idx),e.push(o)}),e}function NYi(t,e,{includeMatches:n=wa.includeMatches,includeScore:o=wa.includeScore}={}){return t.map(i=>{const{idx:r}=i,s={item:e[r],refIndex:r};return n&&(s.matches=DYi(i)),o&&(s.score=i.score),s})}const RYi=/[\p{L}\p{M}\p{N}_]+/gu,Spn=new WeakSet;function TYi(t){Spn.has(t)||(Spn.add(t),console.warn(`[Fuse] tokenize regex ${t} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function kYi(t){if(typeof t=="function"){let e=!1;return n=>{const o=t(n);if(!e&&(e=!0,!Array.isArray(o)||o.some(i=>typeof i!="string")))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(o)?"array containing non-strings":typeof o}.`);return o}}return t instanceof RegExp?(t.global||TYi(t),e=>e.match(t)||[]):e=>e.match(RYi)||[]}function $$e({isCaseSensitive:t=!1,ignoreDiacritics:e=!1,tokenize:n}={}){const o=kYi(n);return{tokenize(i){return t||(i=i.toLowerCase()),e&&(i=_ee(i)),o(i)}}}var FYi=class{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=$$e({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});const n=this.analyzer.tokenize(t),{df:o,fieldCount:i}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const r of n){this.termSearchers.push(new U$e(r,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const s=o.get(r)||0,a=Math.log(1+(i-s+.5)/(s+.5));this.idfWeights.push(a)}this.combineAll=e.tokenMatch==="all",this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let n=0,o=0,i=0,r=0;const s=this.combineAll&&!this.useMask?new Set:null;for(let c=0;c<this.termSearchers.length;c++){const l=this.termSearchers[c].searchIn(t),u=this.idfWeights[c];o+=u,l.isMatch&&(i++,n+=u*(1-l.score),l.indices&&e.push(...l.indices),this.combineAll&&(this.useMask?r|=1<<c:s.add(c)))}if(i===0)return{isMatch:!1,score:1};const a=o>0?1-n/o:0,A={isMatch:!0,score:Math.max(.001,a)};return this.options.includeMatches&&e.length&&(A.indices=Y$e(e)),this.combineAll&&(this.useMask?A.matchedMask=r:A.matchedTerms=s,A.termCount=this.numTerms),A}};function q$e(t,e,n,o){const i=o.tokenize(e);if(!i.length)return;t.fieldCount++,t.docFieldCount.set(n,(t.docFieldCount.get(n)||0)+1);const r=new Set(i);let s=t.docTermFieldHits.get(n);s||(s=new Map,t.docTermFieldHits.set(n,s));for(const a of r)s.set(a,(s.get(a)||0)+1),t.df.set(a,(t.df.get(a)||0)+1)}function Qpn(t,e,n,o){const{i,v:r,$:s}=e;if(r!==void 0){q$e(t,r,i,o);return}if(s)for(let a=0;a<n;a++){const A=s[a];if(A)if(Array.isArray(A))for(const c of A)q$e(t,c.v,i,o);else q$e(t,A.v,i,o)}}function LYi(t,e,n){const o={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const i of t)Qpn(o,i,e,n);return o}function HYi(t,e,n,o){Qpn(t,e,n,o)}function OYi(t,e){const n=t.docFieldCount.get(e);if(n===void 0)return;t.fieldCount-=n,t.docFieldCount.delete(e);const o=t.docTermFieldHits.get(e);if(o){for(const[i,r]of o){const s=(t.df.get(i)||0)-r;s<=0?t.df.delete(i):t.df.set(i,s)}t.docTermFieldHits.delete(e)}}function vpn(t,e){if(e.length===0)return;const n=Array.from(new Set(e)).sort((a,A)=>a-A);for(const a of n)OYi(t,a);const o=a=>{let A=0,c=n.length;for(;A<c;){const l=A+c>>>1;n[l]<a?A=l+1:c=l}return a-A},i=n[0],r=new Map;for(const[a,A]of t.docFieldCount)r.set(a>i?o(a):a,A);t.docFieldCount=r;const s=new Map;for(const[a,A]of t.docTermFieldHits)s.set(a>i?o(a):a,A);t.docTermFieldHits=s}var zP=class{constructor(t,e,n){this.options={...wa,...e},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new gYi(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=mfe(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof G$e))throw new Error(sYi);if(this._myIndex=e||Cpn(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const n=$$e({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=LYi(this._myIndex.records,this._myIndex.keys.length,n)}this._invalidateSearcherCache()}add(t){if(!RE(t))return;this._docs.push(t);const e=this._myIndex.add(t,this._docs.length-1);if(this._invertedIndex&&e){const n=$$e({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});HYi(this._invertedIndex,e,this._myIndex.keys.length,n)}this._invalidateSearcherCache()}remove(t=()=>!1){const e=[],n=[];for(let o=0,i=this._docs.length;o<i;o+=1)t(this._docs[o],o)&&(e.push(this._docs[o]),n.push(o));if(n.length){this._invertedIndex&&vpn(this._invertedIndex,n);const o=new Set(n);this._docs=this._docs.filter((i,r)=>!o.has(r)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return e}removeAt(t){if(!Number.isInteger(t)||t<0||t>=this._docs.length)throw new Error(O$e);this._invertedIndex&&vpn(this._invertedIndex,[t]);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(t=>this._keyStore.get(t.id)||t)}search(t,e){const{limit:n=-1}=e||{},{includeMatches:o,includeScore:i,shouldSort:r,sortFn:s,ignoreFieldNorm:a}=this.options;if(RC(t)&&!t.trim()){let g=this._docs.map((h,d)=>({item:h,refIndex:d}));return dfe(n)&&n>-1&&(g=g.slice(0,n)),g}const A=r&&dfe(n)&&n>0&&RC(t),c=s,l=(g,h)=>c(g,h)||g.idx-h.idx;let u;if(A){const g=new MYi(n,l);RC(this._docs[0])?this._searchStringList(t,{heap:g,ignoreFieldNorm:a}):this._searchObjectList(t,{heap:g,ignoreFieldNorm:a}),u=g.extractSorted()}else u=RC(t)?RC(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),PYi(u,{ignoreFieldNorm:a}),r&&u.sort(RC(t)?l:c),dfe(n)&&n>-1&&(u=u.slice(0,n));return NYi(u,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(t,{heap:e,ignoreFieldNorm:n}={}){const o=this._getSearcher(t),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:r}=this._myIndex,s=e?null:[];return r.forEach(({v:a,i:A,n:c})=>{if(!RE(a))return;const l=o.searchIn(a);if(l.isMatch){const u={score:l.score,value:a,norm:c,indices:l.indices};i&&(u.matchedMask=l.matchedMask,u.matchedTerms=l.matchedTerms,u.termCount=l.termCount);const g=[u];if(!i||this._coversAllTokens(g)){const h={item:a,idx:A,matches:g};e?(h.score=j$e(h.matches,{ignoreFieldNorm:n}),e.insert(h)):s.push(h)}}}),s}_searchLogical(t){const e=bpn(t,this.options),n=this._normalizedKeys(),o=(a,A,c)=>{if(!("children"in a)){const{keyId:h,searcher:d}=a;let p;return h===null?(p=[],n.forEach((m,_)=>{p.push(...this._findMatches({key:m,value:A[_],searcher:d}))})):p=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(A,h),searcher:d}),p&&p.length?[{idx:c,item:A,matches:p}]:[]}const{children:l,operator:u}=a,g=[];for(let h=0,d=l.length;h<d;h+=1){const p=l[h],m=o(p,A,c);if(m.length)g.push(...m);else if(u===_fe.AND)return[]}return g},i=this._myIndex.records,r=new Map,s=[];return i.forEach(({$:a,i:A})=>{if(RE(a)){const c=o(e,a,A);c.length&&(r.has(A)||(r.set(A,{idx:A,item:a,matches:[]}),s.push(r.get(A))),c.forEach(({matches:l})=>{r.get(A).matches.push(...l)}))}}),s}_searchObjectList(t,{heap:e,ignoreFieldNorm:n}={}){const o=this._getSearcher(t),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:r}=this._myIndex,s=this._normalizedKeys(),a=e?null:[];return r.forEach(({$:A,i:c})=>{if(!RE(A))return;const l=[];let u=!1,g=!1;if(s.forEach((h,d)=>{const p=this._findMatches({key:h,value:A[d],searcher:o});p.length?(l.push(...p),p[0].hasInverse&&(g=!0)):u=!0}),!(g&&u)&&l.length&&(!i||this._coversAllTokens(l))){const h={idx:c,item:A,matches:l};e?(h.score=j$e(h.matches,{ignoreFieldNorm:n}),e.insert(h)):a.push(h)}}),a}_findMatches({key:t,value:e,searcher:n}){if(!RE(e))return[];const o=[];if(VP(e))e.forEach(({v:i,i:r,n:s})=>{if(!RE(i))return;const a=n.searchIn(i);if(a.isMatch){const A={score:a.score,key:t,value:i,idx:r,norm:s,indices:a.indices,hasInverse:a.hasInverse};a.termCount!==void 0&&(A.matchedMask=a.matchedMask,A.matchedTerms=a.matchedTerms,A.termCount=a.termCount),o.push(A)}});else{const{v:i,n:r}=e,s=n.searchIn(i);if(s.isMatch){const a={score:s.score,key:t,value:i,norm:r,indices:s.indices,hasInverse:s.hasInverse};s.termCount!==void 0&&(a.matchedMask=s.matchedMask,a.matchedTerms=s.matchedTerms,a.termCount=s.termCount),o.push(a)}}return o}_coversAllTokens(t){const e=t.length?t[0].termCount:void 0;if(e===void 0)return!0;if(e<=31){let o=0;for(let i=0;i<t.length;i++)o|=t[i].matchedMask||0;return o===2**e-1}const n=new Set;for(let o=0;o<t.length;o++){const i=t[o].matchedTerms;if(i)for(const r of i)n.add(r)}return n.size===e}};zP.version="7.5.0",zP.createIndex=Cpn,zP.parseIndex=mYi,zP.config=wa,zP.match=function(t,e,n){if(n&&n.useTokenSearch)throw new Error(uYi);return mfe(t,{...wa,...n}).searchIn(e)},zP.parseQuery=bpn,z$e(QYi),z$e(FYi),zP.use=function(...t){t.forEach(e=>z$e(e))};var GYi=zP;const YYi="https://kicad-mod-cache.tscircuit.com";let X$e=null,fee=null,Z$e=null;const UYi=async()=>X$e||fee||(fee=fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then(t=>t.json()).then(t=>(X$e=t,fee=null,t)),fee),KYi=async(t,e=20)=>{const n=await UYi();return Z$e||(Z$e=new GYi(n)),Z$e.search(t).slice(0,e).map(o=>o.item)},VYi=t=>{const e=t.replace(".pretty/","/").replace(".kicad_mod",""),n=`kicad:${e}`;return{path:t,qualifiedName:n,description:e}},zYi=t=>t.replace(/^\/+/,"").split("/").map(e=>encodeURIComponent(e)).join("/"),JYi=async t=>{const e=await fetch(`${YYi}/${zYi(t)}`);if(!e.ok)throw new Error(`KiCad footprint fetch failed: ${e.status}`);const n=await e.text(),{KicadFootprintToCircuitJsonConverter:o}=await vE("kicad-to-circuit-json"),i=new o;return i.addFile(t.split("/").pop()??"selected-footprint.kicad_mod",n),i.runUntilFinished(),i.getOutput()},wpn=t=>t?.source==="jlcpcb"||t?.source==="kicad",WYi=async(t,e)=>{if(t.source==="jlcpcb")return nYi(t.component.partNumber,e?.jlcpcb);if(t.source==="kicad")return JYi(t.footprint.path);throw new Error("Footprint preview is not available for this source")},jYi=({query:t,placeholder:e,isSearching:n,onQueryChange:o,onSubmit:i})=>{const r=ee.useCallback(s=>{s.key==="Enter"&&(s.preventDefault(),i())},[i]);return K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-mt-4",children:[K.jsxs("div",{className:"rf-relative rf-flex-grow",children:[K.jsx(ZJe,{className:"rf-absolute rf-left-2 rf-top-2.5 rf-h-4 rf-w-4 rf-text-muted-foreground"}),K.jsx(gje,{placeholder:e,className:"rf-pl-8",spellCheck:!1,autoComplete:"off",value:t,onChange:s=>o(s.target.value),onKeyDown:r})]}),K.jsx(fA,{onClick:i,disabled:n||t.trim().length<1,className:"sm:rf-px-4 rf-px-3",children:n?K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):K.jsxs(K.Fragment,{children:[K.jsx(ZJe,{className:"rf-h-4 rf-w-4 sm:rf-hidden"}),K.jsx("span",{className:"rf-hidden sm:rf-inline",children:"Search"})]})})]})},$Yi=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}),qYi=t=>$Yi.format(t),Ppn=t=>{switch(t.source){case"tscircuit.com":{const e=t.package;return`tscircuit-${e.package_id??`${e.org_owner_tscircuit_handle??"unknown"}-${e.unscoped_name??e.name??"package"}`}`}case"jlcpcb":return`jlc-${t.component.lcscId}`;case"kicad":return`kicad-${t.footprint.path}`;default:return"unknown"}},XYi=t=>{switch(t.source){case"tscircuit.com":return t.package.unscoped_name;case"jlcpcb":return t.component.isDirectLookup?t.component.partNumber:t.component.manufacturer;case"kicad":return t.footprint.qualifiedName}},ZYi=t=>{switch(t.source){case"tscircuit.com":return t.package.description||(t.package.org_owner_tscircuit_handle?`Component by ${t.package.org_owner_tscircuit_handle}`:void 0);case"jlcpcb":return t.component.description;case"kicad":return t.footprint.description}},eUi=t=>{switch(t.source){case"tscircuit.com":return t.package.name;case"jlcpcb":return t.component.isDirectLookup?void 0:t.component.partNumber;case"kicad":return}},tUi=({results:t,selected:e,onSelect:n,onShowDetails:o})=>{const i=e?Ppn(e):null;return K.jsx("div",{className:"rf-divide-y rf-w-full rf-overflow-hidden",children:t.map(r=>{const s=Ppn(r),a=i===s,A=XYi(r),c=ZYi(r),l=eUi(r),u=r.source==="jlcpcb"?r.component.stock:null,g=r.source==="jlcpcb"?r.component.price:null,h=r.source==="jlcpcb"?r.component.isBasic:null,d=r.source==="jlcpcb"?r.component.isDirectLookup:!1;return K.jsxs("div",{className:`rf-p-3 rf-flex rf-flex-col sm:rf-grid sm:rf-grid-cols-[minmax(0,1fr)_auto] rf-items-start sm:rf-items-center rf-cursor-pointer hover:rf-bg-zinc-100 rf-gap-2 rf-overflow-hidden ${a?"rf-bg-zinc-100":""}`,onClick:()=>n(r),children:[K.jsxs("div",{className:"rf-min-w-0 rf-overflow-hidden rf-w-full",children:[K.jsxs("div",{className:"rf-flex rf-items-start rf-gap-2 rf-min-w-0",children:[K.jsxs("div",{className:"rf-font-medium rf-text-sm rf-truncate rf-flex-1 rf-min-w-0 rf-flex rf-items-center rf-gap-1.5",children:[A,r.source==="jlcpcb"&&h!=null&&K.jsx("span",{className:`rf-text-xs rf-px-1.5 rf-py-0.5 rf-rounded rf-font-medium rf-flex-shrink-0 ${h?"rf-bg-green-100 rf-text-green-700":"rf-bg-orange-100 rf-text-orange-700"}`,children:h?"Basic":"Extended"}),d&&K.jsx("span",{className:"rf-text-xs rf-px-1.5 rf-py-0.5 rf-rounded rf-font-medium rf-flex-shrink-0 rf-bg-blue-100 rf-text-blue-700",children:"Direct lookup"}),r.source==="tscircuit.com"&&r.package.is_private&&K.jsx(Abi,{className:"rf-ml-1 rf-h-3 rf-w-3 rf-text-zinc-400 rf-flex-shrink-0"})]}),r.source==="jlcpcb"&&u!=null?K.jsxs("div",{className:"rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0 sm:rf-hidden",children:[u.toLocaleString()," in stock"]}):null]}),K.jsxs("div",{className:"rf-text-xs rf-text-zinc-500 rf-truncate rf-w-full",children:[l?K.jsx("span",{className:"rf-mr-2",children:l}):null,c]})]}),K.jsxs("div",{children:[r.source==="tscircuit.com"&&o?K.jsx("div",{className:"rf-flex-shrink-0 rf-w-full sm:rf-w-auto",children:K.jsx(fA,{variant:"outline",size:"sm",className:"rf-text-xs rf-w-full sm:rf-w-auto",onClick:p=>{p.stopPropagation(),o(r)},children:"See Details"})}):r.source==="jlcpcb"&&u!=null?K.jsxs("div",{className:"rf-hidden sm:rf-block rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0",children:[u.toLocaleString()," in stock"]}):null,g!=null&&K.jsx("div",{className:"rf-hidden sm:rf-block rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0 rf-text-right",children:qYi(g)})]})]},s)})})},nUi=({circuitJson:t,error:e,isLoading:n,height:o})=>K.jsx("section",{className:"rf-flex rf-min-w-0 rf-items-center rf-justify-center",style:{height:o},children:n?K.jsxs("div",{className:"rf-flex rf-w-full rf-items-center rf-justify-center rf-gap-2 rf-bg-zinc-950 rf-text-sm rf-text-zinc-300",style:{height:o},children:[K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}),"Loading preview..."]}):e?K.jsx("div",{className:"rf-flex rf-w-full rf-items-center rf-justify-center rf-bg-zinc-950 rf-p-4",style:{height:o},children:K.jsxs("div",{className:"rf-flex rf-max-w-[320px] rf-items-start rf-gap-2 rf-text-sm rf-text-zinc-300",children:[K.jsx(XJe,{className:"rf-mt-0.5 rf-h-4 rf-w-4 rf-flex-shrink-0"}),K.jsx("span",{children:e})]})}):t?K.jsx("div",{className:"rf-w-full rf-min-w-0 rf-overflow-hidden",children:K.jsx(f$e,{circuitJson:t,height:o,allowEditing:!1,clickToInteractEnabled:!1,focusOnHover:!1,disablePcbGroups:!0})}):K.jsx("div",{className:"rf-flex rf-w-full rf-items-center rf-justify-center rf-bg-zinc-950 rf-text-sm rf-text-zinc-300",style:{height:o},children:"No preview"})}),Mpn={importComponentDialog:101,importComponentDetailsDialog:102},oUi=({packageResult:t,isOpen:e,onOpenChange:n,isLoading:o,details:i,previewTab:r,onPreviewTabChange:s,isSubmitting:a,onImport:A})=>{const c=t?.package??null,l=c?.latest_pcb_preview_image_url,u=c?.latest_sch_preview_image_url,g=c?.latest_cad_preview_image_url,h=c?.unscoped_name?.split("/").pop()??c?.unscoped_name,d=c?.org_owner_tscircuit_handle??void 0,p=d?`https://tscircuit.com/${d}`:void 0,m=d&&h?`https://tscircuit.com/${d}/${h}`:void 0;return K.jsx(HT,{open:e,onOpenChange:n,children:K.jsxs(YP,{showOverlay:!1,style:{width:"calc(100vw - 2rem)",zIndex:Mpn.importComponentDetailsDialog},className:"rf-max-w-5xl no-scrollbar !rf-overflow-y-auto rf-max-h-[90vh] rf-overflow-hidden rf-flex rf-flex-col rf-rounded-sm",children:[K.jsx(UP,{className:"rf-pb-4 rf-border-b",children:K.jsx("div",{className:"rf-flex rf-items-start rf-justify-between rf-gap-4",children:K.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[K.jsx(KP,{className:"rf-text-xl rf-font-semibold rf-truncate",children:h}),K.jsx(OT,{children:c?.description})]})})}),K.jsxs("div",{className:"rf-flex-1 rf-overflow-y-auto rf-py-4 rf-space-y-6",children:[d?K.jsxs("div",{children:[K.jsx("span",{className:"rf-text-xs rf-font-medium rf-text-gray-500 rf-uppercase rf-tracking-wide",children:"Created by"}),K.jsx("div",{className:"rf-mt-1 rf-text-sm rf-font-medium",children:p?K.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"rf-text-black hover:rf-underline",children:d}):d})]}):null,(g||l||u)&&K.jsx(K.Fragment,{children:K.jsxs("div",{children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Preview"}),K.jsxs(ARe,{value:r,onValueChange:_=>s(_),children:[K.jsxs(Vge,{className:"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",children:[l&&K.jsx(h6,{value:"pcb",children:"PCB"}),u&&K.jsx(h6,{value:"schematic",children:"Schematic"}),g&&K.jsx(h6,{value:"3d",children:"3D"})]}),K.jsxs("div",{className:"rf-mt-4",children:[K.jsx(cI,{value:"pcb",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:l?K.jsx("img",{src:l,alt:`${h??"package"} PCB preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null}),K.jsx(cI,{value:"schematic",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:u?K.jsx("img",{src:u,alt:`${h??"package"} schematic preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null}),K.jsx(cI,{value:"3d",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:g?K.jsx("img",{src:g,alt:`${h??"package"} 3D preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null})]})]})]})}),i?.ai_description?K.jsxs("section",{children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-3",children:"AI Description"}),K.jsx("div",{className:"rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-700 rf-leading-relaxed",children:i.ai_description})})]}):null,i?.ai_usage_instructions?K.jsxs("section",{children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-3",children:"Usage Instructions"}),K.jsx("div",{className:"rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-700 rf-leading-relaxed rf-whitespace-pre-wrap",children:i.ai_usage_instructions})})]}):null,o?K.jsxs("div",{className:"rf-flex rf-justify-center rf-items-center rf-gap-2 rf-text-gray-500",children:[K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}),K.jsx("span",{className:"rf-text-sm",children:"Loading package details..."})]}):null]}),K.jsxs(UU,{className:"rf-pt-4 rf-border-t rf-flex rf-flex-col sm:rf-flex-row rf-justify-between rf-gap-2",children:[K.jsx("div",{className:"rf-flex-1",children:m?K.jsxs(fA,{variant:"outline",size:"sm",className:"rf-gap-2 rf-w-full sm:rf-w-auto",onClick:()=>window.open(m,"_blank"),children:[K.jsx(tbi,{className:"rf-h-4 rf-w-4"}),"View on tscircuit.com"]}):null}),K.jsxs("div",{className:"rf-flex rf-flex-col sm:rf-flex-row rf-gap-2",children:[K.jsx(fA,{variant:"outline",onClick:()=>n(!1),className:"rf-order-2 sm:rf-order-1",children:"Close"}),K.jsx(fA,{onClick:A,disabled:a,className:"rf-bg-blue-600 hover:rf-bg-blue-700",children:a?K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):"Import Component"})]})]})]})})},iUi=()=>{const[t,e]=ee.useState(null),[n,o]=ee.useState(!1),i=ee.useCallback(async(s,a)=>{o(!0);try{const A=await fetch(`https://api.tscircuit.com/packages/get?name=${encodeURIComponent(`${s}/${a}`)}`);if(!A.ok)throw new Error(`Failed to load package details: ${A.status}`);const c=await A.json();e(c.package??null)}catch(A){console.error("Failed to fetch package details",A),e(null)}finally{o(!1)}},[]),r=ee.useCallback(()=>{e(null),o(!1)},[]);return{details:t,isLoading:n,fetchDetails:i,reset:r}},rUi=(t,e)=>{const[n,o]=ee.useState({circuitJson:null,error:null,isLoading:!1});return ee.useEffect(()=>{if(!t||!wpn(t)){o({circuitJson:null,error:null,isLoading:!1});return}let i=!1;return o({circuitJson:null,error:null,isLoading:!0}),WYi(t,e).then(r=>{i||o({circuitJson:r,error:null,isLoading:!1})}).catch(r=>{i||o({circuitJson:null,error:r instanceof Error?r.message:"Failed to load footprint preview",isLoading:!1})}),()=>{i=!0}},[t,e]),n},sUi=async(t,e)=>{const n={"Content-Type":"application/json"};e&&(n.Authorization=`Bearer ${e}`);const o=await fetch("https://registry-api.tscircuit.com/packages/search",{method:"POST",headers:n,body:JSON.stringify({query:t})});if(!o.ok)throw new Error(`tscircuit registry error: ${o.status}`);return(await o.json()).packages??[]},aUi=({sessionToken:t})=>{const[e,n]=ee.useState([]),[o,i]=ee.useState(!1),[r,s]=ee.useState(null),[a,A]=ee.useState(!1),c=ee.useCallback(async u=>{const g=u.trim();if(!g)return[];i(!0),s(null);try{const d=(await sUi(g,t)).map(p=>({source:"tscircuit.com",package:p}));return n(d),d}catch(h){return console.error("Error searching tscircuit packages",h),n([]),s(h instanceof Error?h.message:"Failed to search tscircuit packages"),[]}finally{i(!1),A(!0)}},[t]),l=ee.useCallback(()=>{n([]),i(!1),s(null),A(!1)},[]);return{results:e,isSearching:o,error:r,hasSearched:a,search:c,reset:l}},AUi=t=>{const e=/^C(\d+)$/i.exec(t.trim());if(!e)return null;const n=Number(e[1]);if(!Number.isSafeInteger(n))return null;const o=`C${e[1]}`;return{source:"jlcpcb",component:{lcscId:n,manufacturer:o,partNumber:o,description:"Import directly from EasyEDA; stock and availability are unknown",package:"",isDirectLookup:!0}}},Dpn=(t,e)=>{const n=AUi(t);return n?e.some(i=>i.component.partNumber.toUpperCase()===n.component.partNumber)?e:[n,...e]:e},cUi=t=>{const e=t.trim();return/^C\d+/i.test(e)?e.replace(/^C/i,""):e},lUi=()=>{const[t,e]=ee.useState([]),[n,o]=ee.useState(!1),[i,r]=ee.useState(null),[s,a]=ee.useState(!1),A=ee.useCallback(async l=>{const u=cUi(l);if(!u)return[];o(!0),r(null);try{const g=await ZGi(u,10),h=Dpn(l,g.map(d=>({source:"jlcpcb",component:eYi(d)})));return e(h),h}catch(g){console.error("Error searching JLCPCB components",g);const h=Dpn(l,[]);return e(h),r(h.length>0?null:g instanceof Error?g.message:"Failed to search JLCPCB components"),h}finally{o(!1),a(!0)}},[]),c=ee.useCallback(()=>{e([]),o(!1),r(null),a(!1)},[]);return{results:t,isSearching:n,error:i,hasSearched:s,search:A,reset:c}},uUi=()=>{const[t,e]=ee.useState([]),[n,o]=ee.useState(!1),[i,r]=ee.useState(null),[s,a]=ee.useState(!1),A=ee.useCallback(async l=>{const u=l.trim();if(!u)return[];o(!0),r(null);try{const h=(await KYi(u,20)).map(d=>({source:"kicad",footprint:VYi(d)}));return e(h),h}catch(g){return console.error("Error searching KiCad footprints",g),e([]),r(g instanceof Error?g.message:"Failed to search KiCad footprints"),[]}finally{o(!1),a(!0)}},[]),c=ee.useCallback(()=>{e([]),o(!1),r(null),a(!1)},[]);return{results:t,isSearching:n,error:i,hasSearched:s,search:A,reset:c}},gUi=({onTscircuitPackageSelected:t,onJlcpcbComponentTsxLoaded:e,onKicadStringSelected:n})=>{const o=[];return t&&o.push("tscircuit.com"),e&&o.push("jlcpcb"),n&&o.push("kicad"),o},dUi=({isOpen:t,onClose:e,jlcpcbProxyRequestHeaders:n,onKicadStringSelected:o,onTscircuitPackageSelected:i,onJlcpcbComponentTsxLoaded:r,jlcpcbProxyApiBase:s,tscircuitSessionToken:a})=>{dee();const A=ee.useMemo(()=>gUi({onKicadStringSelected:o,onTscircuitPackageSelected:i,onJlcpcbComponentTsxLoaded:r}),[o,i,r]),c=A.length>0,l=A.length===1,[u,g]=ee.useState(A[0]??"tscircuit.com"),[h,d]=ee.useState(""),[p,m]=ee.useState(null),{results:_,isSearching:f,error:I,hasSearched:C,search:y,reset:x}=aUi({sessionToken:a}),{results:E,isSearching:B,error:S,hasSearched:Q,search:w,reset:M}=lUi(),{results:k,isSearching:R,error:F,hasSearched:O,search:U,reset:Y}=uUi(),{details:W,isLoading:te,fetchDetails:j,reset:J}=iUi(),[ie,oe]=ee.useState(null),[ne,ge]=ee.useState(!1),[ue,_e]=ee.useState("pcb"),[le,fe]=ee.useState(null),[he,ye]=ee.useState(!1),Qe=ee.useMemo(()=>({jlcpcb:{headers:n,apiBase:s}}),[s,n]),{circuitJson:we,error:pe,isLoading:ve}=rUi(p,Qe),Me=wpn(p);ee.useEffect(()=>{fe(null)},[p]);const Pe=ee.useCallback(()=>{x(),M(),Y(),m(null)},[M,Y,x]);ee.useEffect(()=>{t||(Pe(),d(""),ge(!1),oe(null),fe(null))},[t,Pe]),ee.useEffect(()=>{d(""),m(null),u==="tscircuit.com"?x():u==="jlcpcb"?M():u==="kicad"&&Y()},[u,M,Y,x]);const He=ot=>{m(ot),oe(ot),_e("pcb"),ge(!0),J();const gt=ot.package.org_owner_tscircuit_handle,Bt=ot.package.unscoped_name;if(gt&&Bt){const Ct=Bt.split("/").pop()??Bt;j(gt,Ct)}},Re=async()=>{h.trim()&&(m(null),u==="tscircuit.com"?await y(h):u==="jlcpcb"?await w(h):u==="kicad"&&await U(h))},Ee=async ot=>{try{if(fe(null),ye(!0),ot.source==="kicad"){if(!o)throw new Error("KiCad handler not provided");await o({result:ot,footprint:ot.footprint.qualifiedName})}else if(ot.source==="jlcpcb"){if(!r)throw new Error("JLCPCB handler not provided");const gt=await tYi(ot.component.partNumber,{headers:n,apiBase:s});await r({result:ot,tsx:gt})}else if(ot.source==="tscircuit.com"){if(!i)throw new Error("tscircuit package handler not provided");const gt=ot.package.org_owner_tscircuit_handle,Bt=ot.package.unscoped_name;if(!gt||!Bt)throw new Error("Missing package metadata");const Ct=Bt.split("/").pop()??Bt,Dt=`@tsci/${gt}.${Ct}`;await i({result:ot,fullPackageName:Dt})}return!0}catch(gt){return console.error("Failed to import component",gt),fe(gt instanceof Error?gt.message:"Failed to import component"),!1}finally{ye(!1)}};let Te=[],Ce=!1,Fe=null,Ye=!1;u==="tscircuit.com"?(Te=_,Ce=f,Fe=I,Ye=C):u==="jlcpcb"?(Te=E,Ce=B,Fe=S,Ye=Q):u==="kicad"&&(Te=k,Ce=R,Fe=F,Ye=O);const tt=async()=>{if(!p)return;await Ee(p)&&(e(),Pe(),d(""))},At=ot=>{ot||e()},at=ot=>{ge(ot),ot||oe(null)};return K.jsxs(HT,{open:t,onOpenChange:At,children:[K.jsxs(YP,{style:{width:"calc(100vw - 2rem)",maxWidth:Me?"min(1120px, calc(100vw - 2rem))":"min(672px, calc(100vw - 2rem))",zIndex:Mpn.importComponentDialog},className:"rf-rounded-sm rf-max-h-[90vh] rf-overflow-y-auto rf-overflow-x-hidden rf-flex rf-flex-col",children:[K.jsxs(UP,{children:[K.jsxs(KP,{className:"rf-text-lg sm:rf-text-xl",children:["Import ",l?gfe[u].label:""," ","Component"]}),K.jsx(OT,{className:"rf-text-sm",children:c?"Search for components from available sources.":"Import options are disabled because no handlers were provided."})]}),c?K.jsxs(ARe,{value:u,onValueChange:ot=>g(ot),className:"rf-min-w-0 rf-w-full",children:[!l&&K.jsx(Vge,{className:"rf-flex rf-w-full rf-gap-2",children:A.map(ot=>K.jsx(h6,{value:ot,className:"rf-flex-1 rf-text-xs sm:rf-text-sm",children:gfe[ot].label},ot))}),K.jsxs("div",{className:"rf-min-w-0",style:Me?{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(360px, 0.95fr)",gap:"1.5rem",alignItems:"start"}:void 0,children:[K.jsxs("div",{className:"rf-min-w-0",children:[K.jsx(jYi,{query:h,placeholder:gfe[u].placeholder,isSearching:Ce,onQueryChange:d,onSubmit:Re}),K.jsx("div",{className:"no-scrollbar rf-mt-4 rf-flex-1 rf-min-h-[200px] !rf-max-h-[40vh] !rf-overflow-y-auto rf-overflow-x-hidden rf-border rf-rounded-md rf-min-w-0",children:Ce?K.jsxs("div",{className:"rf-p-8 rf-text-center rf-text-zinc-500",children:[K.jsx(xE,{className:"rf-h-8 rf-w-8 rf-animate-spin rf-mx-auto rf-mb-2"}),K.jsx("p",{children:"Searching..."})]}):Te.length>0?K.jsx(tUi,{results:Te,selected:p,onSelect:m,onShowDetails:u==="tscircuit.com"?He:void 0}):K.jsx("div",{className:"rf-p-8 rf-text-center rf-text-zinc-500",children:Fe?`Error: ${Fe}`:Ye?gfe[u].emptyMessage:"Enter a search term to find components"})})]}),Me?K.jsx("div",{className:"rf-mt-4",children:K.jsx(nUi,{circuitJson:we,error:pe,isLoading:ve,height:325})}):null]})]}):null,le?K.jsx("div",{className:"rf-text-sm rf-text-red-600 rf-mt-2",children:le}):null,K.jsxs(UU,{className:"rf-flex rf-flex-col sm:rf-flex-row rf-gap-2",children:[K.jsx(fA,{variant:"outline",onClick:e,className:"rf-order-2 sm:rf-order-1",children:"Cancel"}),K.jsx(fA,{onClick:tt,disabled:!p||he,className:"rf-order-1 sm:rf-order-2",children:he?K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):"Import"})]})]}),K.jsx(oUi,{packageResult:ie,isOpen:ne,onOpenChange:at,isLoading:te,details:W,previewTab:ue,onPreviewTabChange:ot=>_e(ot),isSubmitting:he,onImport:()=>{ie&&Ee(ie).then(ot=>{ot&&(ge(!1),e(),Pe(),d(""))})}})]})},hUi=t=>{const e=t.match(/export const (\w+) =/);if(!e)throw new Error("Could not determine component name from TSX contents");return e[1]},Npn=t=>{const e=md(s=>s.pushEvent),n=md(s=>s.upsertFile),o=async({result:s,fullPackageName:a})=>{const c=s.package.unscoped_name??s.package.name;await ua.promise(e({event_type:"INSTALL_PACKAGE",full_package_name:a}),{loading:`Requesting install for "${c}"`,success:`Install requested for "${c}"`,error:l=>`Failed to request install: ${l instanceof Error?l.message:String(l)}`})},i=async({footprint:s})=>{await ua.promise(navigator.clipboard.writeText(s),{loading:`Copying "${s}"`,success:`Copied "${s}" to clipboard`,error:a=>`Failed to copy footprint: ${a instanceof Error?a.message:String(a)}`})},r=async({result:s,tsx:a})=>{const c=`imports/${hUi(a)}.tsx`;await ua.promise(n(c,a),{loading:`Importing ${s.component.partNumber}`,success:`Imported to "${c}"`,error:l=>`Failed to import component: ${l instanceof Error?l.message:String(l)}`})};return K.jsx(dUi,{...t,onTscircuitPackageSelected:o,onKicadStringSelected:i,onJlcpcbComponentTsxLoaded:r})};Npn.displayName="ImportComponentDialogForCli";const pUi=async({circuitJson:t,projectName:e})=>{const{convertCircuitJsonToAltiumZip:n}=await Promise.resolve().then(()=>Ygr),o=await n(t,e);return new Blob([new Uint8Array(o)],{type:"application/zip"})},mUi=async({circuitJson:t,projectName:e})=>{await ua.promise((async()=>{const n=await pUi({circuitJson:t,projectName:e});NE(n,{fileName:`${e}_altium_project.zip`})})(),{loading:"Generating Altium project...",success:"Altium project ZIP ready",error:n=>`Failed to generate Altium project: ${n instanceof Error?n.message:String(n)}`})};var eqe={exports:{}},Rpn;function _Ui(){return Rpn||(Rpn=1,(function(t,e){var n={env:{},version:""};(function(o){t.exports=o()})(function(){return(function o(i,r,s){function a(l,u){if(!r[l]){if(!i[l]){var g=typeof Y8=="function"&&Y8;if(!u&&g)return g(l,!0);if(A)return A(l,!0);var h=new Error("Cannot find module '"+l+"'");throw h.code="MODULE_NOT_FOUND",h}var d=r[l]={exports:{}};i[l][0].call(d.exports,function(p){var m=i[l][1][p];return a(m||p)},d,d.exports,o,i,r,s)}return r[l].exports}for(var A=typeof Y8=="function"&&Y8,c=0;c<s.length;c++)a(s[c]);return a})({1:[function(o,i,r){var s=o("./utils"),a=o("./support"),A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(c){for(var l,u,g,h,d,p,m,_=[],f=0,I=c.length,C=I,y=s.getTypeOf(c)!=="string";f<c.length;)C=I-f,g=y?(l=c[f++],u=f<I?c[f++]:0,f<I?c[f++]:0):(l=c.charCodeAt(f++),u=f<I?c.charCodeAt(f++):0,f<I?c.charCodeAt(f++):0),h=l>>2,d=(3&l)<<4|u>>4,p=1<C?(15&u)<<2|g>>6:64,m=2<C?63&g:64,_.push(A.charAt(h)+A.charAt(d)+A.charAt(p)+A.charAt(m));return _.join("")},r.decode=function(c){var l,u,g,h,d,p,m=0,_=0,f="data:";if(c.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");var I,C=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===A.charAt(64)&&C--,c.charAt(c.length-2)===A.charAt(64)&&C--,C%1!=0)throw new Error("Invalid base64 input, bad content length.");for(I=a.uint8array?new Uint8Array(0|C):new Array(0|C);m<c.length;)l=A.indexOf(c.charAt(m++))<<2|(h=A.indexOf(c.charAt(m++)))>>4,u=(15&h)<<4|(d=A.indexOf(c.charAt(m++)))>>2,g=(3&d)<<6|(p=A.indexOf(c.charAt(m++))),I[_++]=l,d!==64&&(I[_++]=u),p!==64&&(I[_++]=g);return I}},{"./support":30,"./utils":32}],2:[function(o,i,r){var s=o("./external"),a=o("./stream/DataWorker"),A=o("./stream/Crc32Probe"),c=o("./stream/DataLengthProbe");function l(u,g,h,d,p){this.compressedSize=u,this.uncompressedSize=g,this.crc32=h,this.compression=d,this.compressedContent=p}l.prototype={getContentWorker:function(){var u=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),g=this;return u.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(u,g,h){return u.pipe(new A).pipe(new c("uncompressedSize")).pipe(g.compressWorker(h)).pipe(new c("compressedSize")).withStreamInfo("compression",g)},i.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(o,i,r){var s=o("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},r.DEFLATE=o("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(o,i,r){var s=o("./utils"),a=(function(){for(var A,c=[],l=0;l<256;l++){A=l;for(var u=0;u<8;u++)A=1&A?3988292384^A>>>1:A>>>1;c[l]=A}return c})();i.exports=function(A,c){return A!==void 0&&A.length?s.getTypeOf(A)!=="string"?(function(l,u,g,h){var d=a,p=h+g;l^=-1;for(var m=h;m<p;m++)l=l>>>8^d[255&(l^u[m])];return-1^l})(0|c,A,A.length,0):(function(l,u,g,h){var d=a,p=h+g;l^=-1;for(var m=h;m<p;m++)l=l>>>8^d[255&(l^u.charCodeAt(m))];return-1^l})(0|c,A,A.length,0):0}},{"./utils":32}],5:[function(o,i,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(o,i,r){var s=null;s=typeof Promise<"u"?Promise:o("lie"),i.exports={Promise:s}},{lie:37}],7:[function(o,i,r){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=o("pako"),A=o("./utils"),c=o("./stream/GenericWorker"),l=s?"uint8array":"array";function u(g,h){c.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=h,this.meta={}}r.magic="\b\0",A.inherits(u,c),u.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(A.transformTo(l,g.data),!1)},u.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(h){g.push({data:h,meta:g.meta})}},r.compressWorker=function(g){return new u("Deflate",g)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(o,i,r){function s(d,p){var m,_="";for(m=0;m<p;m++)_+=String.fromCharCode(255&d),d>>>=8;return _}function a(d,p,m,_,f,I){var C,y,x=d.file,E=d.compression,B=I!==l.utf8encode,S=A.transformTo("string",I(x.name)),Q=A.transformTo("string",l.utf8encode(x.name)),w=x.comment,M=A.transformTo("string",I(w)),k=A.transformTo("string",l.utf8encode(w)),R=Q.length!==x.name.length,F=k.length!==w.length,O="",U="",Y="",W=x.dir,te=x.date,j={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||(j.crc32=d.crc32,j.compressedSize=d.compressedSize,j.uncompressedSize=d.uncompressedSize);var J=0;p&&(J|=8),B||!R&&!F||(J|=2048);var ie=0,oe=0;W&&(ie|=16),f==="UNIX"?(oe=798,ie|=(function(ge,ue){var _e=ge;return ge||(_e=ue?16893:33204),(65535&_e)<<16})(x.unixPermissions,W)):(oe=20,ie|=(function(ge){return 63&(ge||0)})(x.dosPermissions)),C=te.getUTCHours(),C<<=6,C|=te.getUTCMinutes(),C<<=5,C|=te.getUTCSeconds()/2,y=te.getUTCFullYear()-1980,y<<=4,y|=te.getUTCMonth()+1,y<<=5,y|=te.getUTCDate(),R&&(U=s(1,1)+s(u(S),4)+Q,O+="up"+s(U.length,2)+U),F&&(Y=s(1,1)+s(u(M),4)+k,O+="uc"+s(Y.length,2)+Y);var ne="";return ne+=`
|
|
5671
|
+
`,u=new Blob([l],{type:"text/plain"}),g=URL.createObjectURL(u),h=document.createElement("a");h.href=g,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(g)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return K.jsxs("div",{className:`relative ${e}`,ref:i,children:[K.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.getSolverName()}`,children:t.getSolverName()}),n&&K.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},Ohn=t=>t.activeSubSolver?[t,...Ohn(t.activeSubSolver)]:[t],DOi=({solver:t})=>{const e=Ohn(t);return K.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>K.jsxs("div",{className:"flex items-center",children:[o>0&&K.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),K.jsx(MOi,{solver:n})]},n.getSolverName()))})},NOi=({solver:t,triggerRender:e,animationSpeed:n=25,renderer:o,onRendererChange:i,onAnimationSpeedChange:r,onDownloadVisualization:s,onSolverStarted:a,onSolverCompleted:A})=>{const[c,l]=ee.useReducer(B=>!B,!1),u=ee.useRef(void 0),g=ee.useRef(null),h="solver-debugger-last-iteration",[d,p]=ee.useState(null),m=ee.useRef(null),_=ee.useMemo(()=>[{label:"Slow",value:250,description:"250ms"},{label:"Normal",value:100,description:"100ms"},{label:"Fast",value:10,description:"10ms"},{label:"Fast (2x)",value:5,description:"5ms"},{label:"Fast (10x)",value:1,description:"1ms"},{label:"Fast 20x",value:.5,description:"2 steps / 1ms"},{label:"Fast 100x",value:.1,description:"10 steps / 1ms"}],[]),f=()=>{const B=Math.max(1,n),S=n<1?Math.round(1/n):1;u.current=setInterval(()=>{if(t.solved||t.failed){u.current&&(clearInterval(u.current),u.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<S&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{u.current&&(clearInterval(u.current),u.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;g.current===null&&typeof window<"u"&&(g.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",g.current??`${t.iterations}`);if(B===null)return;g.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const S=Number(B);if(!Number.isFinite(S)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<S&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return ee.useEffect(()=>()=>{I()},[]),ee.useEffect(()=>{(t.solved||t.failed)&&c&&(I(),l())},[t.solved,t.failed,c]),ee.useEffect(()=>{c&&(I(),f())},[n,c]),ee.useEffect(()=>{if(typeof document>"u")return;const B=S=>{m.current&&!m.current.contains(S.target)&&p(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),K.jsxs("div",{className:"space-y-2 p-2 border-b",children:[K.jsx("div",{className:"flex items-center",children:K.jsxs("div",{className:"flex items-center gap-2",ref:m,children:[K.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[K.jsxs("div",{className:"relative",children:[K.jsx("button",{type:"button",onClick:()=>p(d==="renderer"?null:"renderer"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="renderer"?"open":"closed",children:"Renderer"}),d==="renderer"&&K.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[10rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:["vector","canvas"].map(B=>K.jsxs("button",{type:"button",onClick:()=>{i(B),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B==="vector"?"Vector":"Canvas",o===B&&K.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),K.jsxs("div",{className:"relative",children:[K.jsx("button",{type:"button",onClick:()=>p(d==="debug"?null:"debug"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="debug"?"open":"closed",children:"Debug"}),d==="debug"&&K.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:K.jsx("button",{type:"button",onClick:()=>{s(),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),K.jsxs("div",{className:"relative",children:[K.jsx("button",{type:"button",onClick:()=>p(d==="animation"?null:"animation"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="animation"?"open":"closed",children:"Animation"}),d==="animation"&&K.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:_.map(B=>K.jsxs("button",{type:"button",onClick:()=>{r(B.value),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B.label,K.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&K.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),K.jsx(DOi,{solver:t})]})}),K.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[K.jsx("button",{onClick:C,disabled:t.solved||t.failed||c,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),K.jsx("button",{onClick:y,disabled:t.solved||t.failed||c,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),K.jsx("button",{onClick:x,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${c?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:c?"Stop":"Animate"}),K.jsx("button",{onClick:E,disabled:t.solved||t.failed||c,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),K.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&K.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&K.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&K.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&K.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},ROi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),TOi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},kOi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=TOi(t,e),r=t[o],s=t.firstIterationOfStage?.[o]??(e===t.currentPipelineStageIndex?t.iterations:null),a=t.iterations;let A=0;if(i==="Completed"){const g=t.pipelineDef[e+1],h=g?t.firstIterationOfStage?.[g.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnStage?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const u=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:u&&Object.keys(u).length>0?u:null,solverInstance:r??null}},FOi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return K.jsx("span",{className:`font-medium ${e[t]}`,children:t})},LOi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return K.jsxs("div",{className:"flex items-center gap-2",children:[K.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:K.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),K.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},Ghn=t=>{if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},HOi=t=>Object.entries(t).map(([e,n])=>`${e}: ${Ghn(n)}`).join(", "),OOi=({stats:t})=>{if(!t||Object.keys(t).length===0)return K.jsx("span",{children:"-"});const e=Object.entries(t),n=HOi(t);return K.jsxs("details",{className:"cursor-pointer",children:[K.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),K.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>K.jsxs("div",{children:[o,": ",Ghn(i)]},o))})]})},B$e=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(B$e);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=B$e(o));return e},GOi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=B$e(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},YOi=({expanded:t})=>K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:`w-4 h-4 transition-transform duration-200 ${t?"rotate-90":""}`,children:K.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})}),Yhn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},Uhn=({solver:t,onStepUntilPhase:e,onDownloadInput:n,isNested:o=!1,indentLevel:i=0,triggerRender:r})=>{const[s,a]=ee.useState(new Set),A=t.pipelineDef.map((m,_)=>kOi(t,_)),c=m=>{a(_=>{const f=new Set(_);return f.has(m)?f.delete(m):f.add(m),f})},l=m=>{e?.(m)},u=m=>{m.solverInstance&&(n?n(m.solverInstance,m.name):GOi(m.solverInstance,m.name))},g=m=>`${(m/1e3).toFixed(2)}s`,h=()=>{if(!t.solved&&!t.failed){const m=t.activeSubSolver;for(;!t.solved&&!t.failed&&(t.step(),!(t.activeSubSolver&&t.activeSubSolver!==m)););r?.()}},d=()=>{if(!t.solved&&!t.failed){const m=Yhn(t);for(;!t.solved&&!t.failed&&(t.step(),Yhn(t)===m););r?.()}},p=i*24;return K.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&K.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[K.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),K.jsxs("div",{className:"flex gap-2",children:[K.jsx("button",{onClick:d,disabled:t.solved||t.failed,className:"bg-indigo-500 hover:bg-indigo-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Solver"}),K.jsx("button",{onClick:h,disabled:t.solved||t.failed,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Stage"})]})]}),K.jsx("div",{className:"overflow-x-auto",children:K.jsxs("table",{className:"w-full text-sm",children:[!o&&K.jsx("thead",{children:K.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),K.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",K.jsx("sub",{children:"0"})]}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),K.jsx("tbody",{children:A.map(m=>{const _=ROi(m.solverInstance),f=s.has(m.name);return K.jsxs(Fs.Fragment,{children:[K.jsxs("tr",{className:`border-b border-gray-100 ${m.status==="In Progress"?"bg-yellow-50":""}`,children:[K.jsx("td",{className:"px-4 py-2",children:K.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:p},children:[_?K.jsx("button",{onClick:()=>c(m.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:K.jsx(YOi,{expanded:f})}):K.jsx("span",{className:"w-4"}),K.jsx("span",{className:"text-gray-400 w-6",children:String(m.index+1).padStart(2,"0")}),K.jsx("button",{onClick:()=>l(m.name),disabled:m.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${m.name} completes`,children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),K.jsx("span",{className:"font-medium text-gray-900",children:m.name})]})}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(FOi,{status:m.status})}),K.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:m.firstIteration!==null?m.firstIteration:""}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:m.iterations}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(LOi,{progress:m.progress})}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:g(m.timeSpent)}),K.jsx("td",{className:"px-4 py-2 text-gray-500",children:K.jsx(OOi,{stats:m.stats})}),K.jsx("td",{className:"px-4 py-2",children:m.solverInstance?K.jsxs("button",{onClick:()=>u(m),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${m.name}`,children:[K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),K.jsx("span",{children:"Input"})]}):null})]}),_&&f&&K.jsx("tr",{children:K.jsx("td",{colSpan:8,className:"p-0",children:K.jsx(Uhn,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function UOi({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(m,_)=>{typeof m=="number"&&(m<s&&(s=m),m>A&&(A=m)),typeof _=="number"&&(_<a&&(a=_),_>c&&(c=_))};for(const m of e)l(m.x,m.y);for(const m of n){const _=m.points??[];for(const f of _)l(f.x,f.y)}for(const m of o){const _=m.x??0,f=m.y??0,I=m.width??0,C=m.height??0;l(_,f),l(_+I,f+C)}for(const m of i){const _=m.x??0,f=m.y??0,I=m.radius??1;l(_-I,f-I),l(_+I,f+I)}for(const m of r)l(m.x,m.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const u=10,g=s-u,h=a-u,d=Math.max(1,A-s+2*u),p=Math.max(1,c-a+2*u);return K.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${g} ${h} ${d} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,_)=>K.jsx("rect",{x:m.x??0,y:m.y??0,width:m.width??0,height:m.height??0,fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`rect-${_}`)),n.map((m,_)=>K.jsx("polyline",{fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1,points:(m.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${_}`)),i.map((m,_)=>K.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.fillColor??"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`circle-${_}`)),e.map((m,_)=>K.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${_}`)),r.map((m,_)=>K.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${_}`))]})}var KOi=class extends Fs.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},VOi=({solver:t,createSolver:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=ee.useReducer(f=>f+1,0),[a]=ee.useState(()=>{if(e)return e();if(!t)throw new Error("GenericSolverDebugger requires solver or createSolver");return t}),[A,c]=ee.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[l,u]=ee.useState(n),g=ee.useMemo(()=>{try{return a.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(f){return console.error("Visualization error:",f),{points:[],lines:[],rects:[],circles:[]}}},[a,r]),h=ee.useMemo(()=>(g.rects?.length||0)===0&&(g.lines?.length||0)===0&&(g.points?.length||0)===0&&(g.circles?.length||0)===0,[g]);ee.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const f=document.createElement("script");f.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(f)}},[]),ee.useEffect(()=>{u(n)},[n]);const d=a.pipelineDef!==void 0,p=f=>{const I=a;if(!a.solved&&!a.failed){for(;!a.solved&&!a.failed&&I.currentPipelineStageIndex<=I.pipelineDef.findIndex(C=>C.solverName===f);)a.step();s()}},m=()=>{const f=JSON.stringify(g,null,2),I=new Blob([f],{type:"application/json"}),C=URL.createObjectURL(I),y=document.createElement("a");y.download="visualization.json",y.href=C,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(C)},_=f=>{c(f),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",f)};return K.jsxs("div",{children:[K.jsx(NOi,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:u,onDownloadVisualization:m,onSolverStarted:o,onSolverCompleted:i}),h?K.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):K.jsx(KOi,{fallback:K.jsx(UOi,{graphics:g}),children:A==="canvas"?K.jsx(POi,{graphics:g}):K.jsx(QOi,{graphics:g})}),d&&K.jsx(Uhn,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const zOi=()=>{ee.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},JOi=1e3,NE=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},JOi)},b$e=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},WOi=t=>{const e=t.solverConstructorArgs??[t.solverParams];if(t.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||e.length!==1)return e;const[{input:n,options:o}]=e;return[n,o]},e8="https://github.com/tscircuit/tscircuit-autorouter/issues/new",Khn="https://github.com/tscircuit/copper-pour-solver/issues/new",Vhn="https://github.com/tscircuit/calculate-packing/issues/new",jOi="https://github.com/tscircuit/matchpack/issues/new",zhn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",$Oi={PackSolver2:Vhn,LayoutPipelineSolver:jOi,AutoroutingPipelineSolver:e8,AssignableAutoroutingPipeline2:e8,AssignableAutoroutingPipeline3:e8,AutoroutingPipeline1_OriginalUnravel:e8,AutoroutingPipelineSolver3_HgPortPointPathing:e8,AutoroutingPipelineSolver4:e8,AutoroutingPipelineSolver5:e8,AutoroutingPipelineSolver7_MultiGraph:e8,AutoroutingPipelineSolver8:e8,CopperPourPipelineSolver:Khn,SchematicTracePipelineSolver:zhn},qOi=t=>t.toLowerCase().includes("pack")?tln:t.toLowerCase().includes("rout")?oln:z8i,Jhn=t=>{const e=$Oi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?e8:n.includes("schematic")&&n.includes("trace")?zhn:n.includes("copperpour")?Khn:n.includes("pack")?Vhn:null},XOi=t=>`${b$e(`${t.componentName}-${t.solverName}`)}-solver-input.json`,Whn=t=>{NE(JSON.stringify(t.solverParams,null,2),{fileName:XOi(t),mimeType:"application/json"})},ZOi=({solverEvent:t})=>{const e=Jhn(t.solverName);return K.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[K.jsxs(fA,{type:"button",variant:"outline",size:"sm",onClick:()=>Whn(t),children:[K.jsx(uZ,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?K.jsx(fA,{asChild:!0,variant:"outline",size:"sm",children:K.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[K.jsx(yme,{className:"rf-w-4 rf-h-4"}),"Report"]})}):K.jsxs(fA,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[K.jsx(yme,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},eGi=({solverEvent:t})=>{const e=Jhn(t.solverName);return e?K.jsx(fA,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:K.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:K.jsx(yme,{className:"rf-w-4 rf-h-4"})})}):K.jsx(fA,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:K.jsx(yme,{className:"rf-w-4 rf-h-4"})})},tGi=({solverEvents:t=[]})=>{const[e,n]=ee.useState(null);zOi();const o=ee.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=ee.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=ee.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=gMe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(gMe).join(", ")}`,classFound:!1};try{return{instance:new a(...WOi(r)),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?K.jsx("div",{className:"rf-p-4",children:K.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:K.jsxs("div",{className:"rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),K.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):K.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[K.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[K.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return K.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=qOi(A.solverName);return K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[K.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),K.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[K.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),K.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),K.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?K.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[K.jsx(ZOi,{solverEvent:r}),K.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:K.jsx(yE,{fallback:K.jsx("div",{className:"rf-p-4",children:K.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),K.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:K.jsx(VOi,{solver:s.instance})})})]}):K.jsxs("div",{className:"rf-p-4",children:[K.jsxs("div",{className:"rf-mb-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),K.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&K.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:K.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),K.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[K.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[K.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[K.jsx(eGi,{solverEvent:r}),K.jsx(fA,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8","aria-label":"Download solver input JSON",title:"Download solver input JSON",onClick:()=>Whn(r),children:K.jsx(uZ,{className:"rf-w-4 rf-h-4"})})]})]}),K.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:K.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):K.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},nGi=["subcircuit_id","componentDisplayName","phaseName","routingPhaseIndex","phaseOrdinal","phaseCount","phaseStageIndex","phaseStageCount","connectionCount","obstacleCount","previousTraceCount","isReroutePhase","autorouterName","autorouterVersion","solverName","effort","cacheStatus"],oGi=["phaseOrdinal","routingPhaseIndex","phaseName","phaseStageIndex"];function iGi(t,e){let n=-1,o=-1;for(let i=t.length-1;i>=0;i--){const r=t[i];if(r.status!=="running"||r.subcircuit_id!==e.subcircuit_id||r.componentDisplayName!==e.componentDisplayName)continue;let s=0,a=!1;for(const A of oGi)if(!(r[A]===void 0||e[A]===void 0)){if(r[A]!==e[A]){a=!0;break}s++}!a&&s>o&&(n=i,o=s)}return n}function rGi(t,e){const n=Object.fromEntries(nGi.filter(s=>e[s]!==void 0).map(s=>[s,e[s]])),o=e.simpleRouteJson?structuredClone(e.simpleRouteJson):void 0,i=e.type==="autorouting:start"?-1:iGi(t,e),r={...i===-1?{id:`autorouting_phase_${t.length+1}`}:t[i],...n,status:e.type==="autorouting:start"?"running":e.type==="autorouting:end"?"complete":"error",...e.type==="autorouting:start"?{startSimpleRouteJson:o}:e.type==="autorouting:end"?{endSimpleRouteJson:o}:{errorSimpleRouteJson:o,error:e.error?{...e.error}:void 0}};return i===-1?[...t,r]:t.map((s,a)=>a===i?r:s)}const sGi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),aGi=new Set(["tscircuit","default","auto","auto_local"]);function AGi(t){if(t==="FanoutSolver")return"Fanout";if(t==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const e=t.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(e)return`Pipeline${e[1]}`;const n=t.match(/^AssignableAutoroutingPipeline(\d+)$/);return n?`Assignable${n[1]}`:t}function cGi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&sGi.get(n);if(o)return o;if(n&&!aGi.has(n))return e;const i=t.solverName?.trim();if(i)return AGi(i);const r=t.autorouterVersion?.trim();if(r){const s=r.match(/^beta[_-]pipeline(\d+)$/);return s?`Pipeline${s[1]}`:r==="latest"?"default":r}return e?"default":"Unknown"}const S$e="#fbbf24";function lGi(t){const e=t.endSimpleRouteJson?.traces??[],n=new Set(e.flatMap(i=>[i.pcb_trace_id,i.__replaces_pcb_trace_id].filter(r=>r!==void 0)));return[...(t.startSimpleRouteJson?.traces??[]).filter(i=>!n.has(i.pcb_trace_id)),...e]}function jhn(t){const e=new Map((t.startSimpleRouteJson?.traces??[]).map(n=>[n.pcb_trace_id,n]));return(t.endSimpleRouteJson?.traces??[]).filter(n=>{const o=e.get(n.pcb_trace_id);return!o||!!n.__replaces_pcb_trace_id&&n.__replaces_pcb_trace_id!==o.__replaces_pcb_trace_id||JSON.stringify(o.route)!==JSON.stringify(n.route)}).map(n=>n.pcb_trace_id)}function uGi(t,e){return{outer_diameter:t.via_diameter??e.minViaPadDiameter??e.min_via_pad_diameter??e.minViaDiameter??.6,hole_diameter:t.via_hole_diameter??e.minViaHoleDiameter??e.min_via_hole_diameter??.3}}function $hn(t,e){const n=[];for(const a of t.route)a.route_type==="wire"?n.push({...a,layer:a.layer}):a.route_type==="via"?n.push({route_type:"via",x:a.x,y:a.y,from_layer:a.from_layer,to_layer:a.to_layer,...uGi(a,e)}):a.route_type==="through_obstacle"&&n.push({route_type:"through_pad",start:{...a.start},end:{...a.end},width:a.width,start_layer:a.from_layer,end_layer:a.to_layer,pcb_smtpad_id:a.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:a.circuitJsonMetadata?.pcb_plated_hole_id});const o=a=>{let A=-1,c=Number.POSITIVE_INFINITY;return n.forEach((l,u)=>{if(l.route_type!=="wire")return;const g=Math.hypot(l.x-a.x,l.y-a.y);g<c&&(c=g,A=u)}),A},i=t.route.filter(a=>a.route_type==="jumper").map(a=>[o(a.start),o(a.end)].sort((A,c)=>A-c)).filter(([a,A])=>a>=0&&A>a).sort(([a],[A])=>a-A),r=[];let s=0;for(const[a,A]of i)a>=s&&r.push(n.slice(s,a+1)),s=Math.max(s,A);return s<n.length&&r.push(n.slice(s)),r}function gGi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(jhn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of $hn(r,o)){let a;for(const A of s){if(A.route_type==="through_pad"){a={...A.end,layer:A.end_layer,width:A.width};continue}const c=A.route_type==="wire"?A.layer:A.from_layer;a&&a.layer===c&&(a.x!==A.x||a.y!==A.y)&&e.push({points:[{x:a.x,y:a.y},{x:A.x,y:A.y}],strokeWidth:A.route_type==="wire"?A.width:a.width,strokeColor:S$e,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:S$e,fill:"transparent"}),a={x:A.x,y:A.y,layer:A.route_type==="wire"?A.layer:A.to_layer,width:A.route_type==="wire"?A.width:a?.width??o.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:e,circles:n}}function dGi(t){const e=JSON.stringify(t);let n=2166136261;for(let o=0;o<e.length;o++)n=Math.imul(n^e.charCodeAt(o),16777619);return(n>>>0).toString(36)}const hGi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function pGi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!hGi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:lGi(e),s=new Set(t.filter(c=>c.type==="source_trace").map(c=>c.source_trace_id)),a=["top",...Array.from({length:Math.max(0,o.layerCount-2)},(c,l)=>`inner${l+1}`),...o.layerCount>1?["bottom"]:[]],A=[];for(const c of r){const u=o.connections.find(h=>h.name===c.connection_name||h.source_trace_id===c.connection_name)?.source_trace_id??c.connection_name??"",g=$hn(c,o);for(const[h,d]of g.entries()){const p={type:"pcb_trace",pcb_trace_id:`${e.id}_${n}_${c.pcb_trace_id}_${h}_${dGi(d)}`,subcircuit_id:e.subcircuit_id??void 0,source_trace_id:s.has(u)?u:void 0,route:d};A.push(p);for(const[m,_]of d.entries()){if(_.route_type!=="via")continue;const f=a.indexOf(_.from_layer),I=a.indexOf(_.to_layer),C={type:"pcb_via",pcb_via_id:`${p.pcb_trace_id}_via_${m}`,pcb_trace_id:p.pcb_trace_id,subcircuit_id:e.subcircuit_id??void 0,x:_.x,y:_.y,outer_diameter:_.outer_diameter,hole_diameter:_.hole_diameter,layers:f>=0&&I>=0?a.slice(Math.min(f,I),Math.max(f,I)+1):[_.from_layer,_.to_layer]};A.push(C)}}}return[...i,...A]}const Q$e=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,qhn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",Xhn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,mGi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},_Gi=({circuitJson:t,phases:e=[],isRunning:n=!1})=>{const[o,i]=ee.useState(null),[r,s]=ee.useState("output"),[a,A]=ee.useState(!0),[c,l]=ee.useState(!1),u=ee.useRef(null),[g,h]=ee.useState(480),d=o?e.findIndex(R=>R.id===o.id&&Xhn(R)===Xhn(o)):-1,p=d<0?e.length-1:d,m=e[p],_=d<0,f=!!m?.endSimpleRouteJson,I=m?.startSimpleRouteJson??m?.errorSimpleRouteJson,C=!!I,y=r==="output"&&!f?"input":r==="input"&&!C?"output":r,x=y==="input"?I:m?.endSimpleRouteJson,E=ee.useMemo(()=>!m||!x?null:pGi(t??[],m,y),[t,m,x,y]),B=ee.useMemo(()=>m&&y==="output"&&a?gGi(m):{lines:[],circles:[]},[m,y,a]);if(ee.useLayoutEffect(()=>{const R=u.current;if(!R)return;const F=()=>h(Math.max(360,R.clientHeight));F();const O=new ResizeObserver(F);return O.observe(R),()=>O.disconnect()},[!!m]),!m)return K.jsxs("div",{className:"rf-flex rf-min-h-[400px] rf-flex-col rf-items-center rf-justify-center rf-gap-3 rf-p-8 rf-text-center",children:[K.jsx(oln,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),K.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),K.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const S=Q$e(m,p),Q=m.status==="running"&&n,w=!f,M=I?.connections.length,k=E?.filter(R=>R.type==="pcb_trace").length??0;return K.jsxs("div",{className:"rf-flex rf-h-full rf-min-h-[620px] rf-flex-col rf-bg-white md:rf-flex-row","data-testid":"autorouting-explorer",children:[K.jsxs("aside",{className:"rf-flex rf-shrink-0 rf-flex-col rf-border-b rf-border-gray-200 md:rf-w-52 md:rf-border-b-0 md:rf-border-r","aria-label":"Routing phases",children:[K.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between rf-px-3 rf-py-2 rf-text-xs rf-text-gray-500",children:[K.jsx("span",{children:"Routing phases"}),K.jsx("span",{children:e.length})]}),K.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const O=jhn(R).length,U=R.endSimpleRouteJson?`${O} ${O===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return K.jsxs("button",{type:"button","aria-pressed":F===p,title:`${qhn(R)} · ${U}`,onClick:()=>i(R),className:Hi("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===p?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[K.jsx("span",{className:Hi("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===p?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),K.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[K.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[K.jsx("span",{className:"rf-min-w-0 rf-flex-1 rf-truncate rf-text-xs rf-font-medium rf-leading-5 rf-text-gray-800",title:Q$e(R,F),children:Q$e(R,F)}),R.status==="complete"?K.jsx(IS,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?K.jsx(XJe,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?K.jsx(xE,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),K.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[cGi(R)," · ",U]})]})]},R.id)})})]}),K.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[K.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-gap-3 rf-border-b rf-border-gray-200 rf-px-4 rf-py-3",children:[K.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[S,K.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[p+1," of ",e.length]})]}),n&&K.jsx("button",{type:"button",onClick:()=>i(null),disabled:_,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:_?"Following latest":"Follow latest"}),K.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>K.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:Hi("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),K.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-px-4 rf-py-2 rf-text-xs rf-text-gray-600",children:[K.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[K.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),K.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:S$e}}),"Highlight changes (all layers)"]}),K.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),w&&K.jsx("div",{className:Hi("rf-border-y rf-px-4 rf-py-2 rf-text-xs",m.status==="error"?"rf-border-red-100 rf-bg-red-50 rf-text-red-700":"rf-border-blue-100 rf-bg-blue-50 rf-text-blue-700"),role:"status",children:m.status==="error"?`Routing failed: ${m.error?.message||"No output was captured."}`:Q?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),K.jsx("div",{ref:u,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?K.jsx(f$e,{circuitJson:E,height:g,allowEditing:!1,clickToInteractEnabled:!1,initialState:mGi,debugGraphics:B}):K.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),K.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-border-t rf-border-gray-200 rf-px-4 rf-py-3 rf-text-xs rf-text-gray-500",children:[K.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${qhn(m)}`]}),K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[K.jsxs("button",{type:"button",disabled:!x,onClick:()=>NE(JSON.stringify(x,null,2),{fileName:`${m.id}-${y}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[K.jsx(uZ,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),K.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[K.jsx(xT,{className:Hi("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&K.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${S} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},Zhn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{ee.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{aG.captureException(o)}catch{}}},[t,e]),ee.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{aG.captureException(i,{error_type:o.type})}catch{}}},[n])},epn=t=>{ee.useEffect(()=>{try{pUo(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},tpn="0.0.2826",fGi={version:tpn},ufe=AFt()(cFt(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{t({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),IGi=t=>{const[e,n]=ee.useState([]),[o,i]=ee.useState(null),[r,s]=ee.useState(""),[a,A]=TO("eval-version-selection",null),c=ufe(h=>h.setLastRunEvalVersion),l=ufe(h=>h.lastRunEvalVersion);return ee.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(h=>h.json()).then(h=>{if(Array.isArray(h?.versions)){let d=[...h.versions];h.tags?.latest&&(i(h.tags.latest),d=d.filter(p=>p!==h.tags.latest)),n(d)}}).catch(()=>{})},[t]),ee.useEffect(()=>{t&&(a?(window.TSCIRCUIT_LATEST_EVAL_VERSION=a,c(a)):o&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=o,c(o)))},[t,a,o]),{versions:ee.useMemo(()=>e.filter(h=>h.includes(r)).slice(0,50),[e,r]),latestVersion:o,lastRunEvalVersion:l,search:r,setSearch:s,selectVersion:h=>{A(h),s("")}}},CGi=({snippetNames:t,onSelect:e,onCancel:n,isOpen:o})=>{const[i,r]=ee.useState(""),[s,a]=ee.useState("");if(!o)return null;const A=t.filter(u=>u.toLowerCase().includes(s.toLowerCase())),c=s&&!t.includes(s),l=u=>{u.key==="Enter"&&(A.length===1?r(A[0]):c&&r(s))};return K.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:K.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[K.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),K.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:u=>a(u.target.value),onKeyDown:l}),K.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[A.map(u=>K.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${i===u?"bg-blue-50":""}`,onClick:()=>r(u),children:u},u)),c&&K.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${i===s?"bg-blue-50":""}`,onClick:()=>r(s),children:['Create new "',s,'"']})]}),K.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:n,children:"Cancel"}),K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>i&&e(i),disabled:!i,children:i===s?`Create "${i}"`:`Save to ${i}`})]})]})})},yGi=t=>{const e=ee.useRef(null),n=md(o=>o.recentEvents);ee.useEffect(()=>{if(n.length===0)return;const o=n[0];o.event_id!==e.current&&(t(o),e.current=o.event_id)},[n,t])};var xGi=Object.defineProperty,QS=(t,e)=>xGi(t,"name",{value:e,configurable:!0}),EGi="AlertDialog",[BGi,lmr]=Dx(EGi,[v0n]),vS=v0n(),bGi=QS(t=>{const{__scopeAlertDialog:e,...n}=t,o=vS(e);return K.jsx(n_e,{...o,...n,modal:!0})},"AlertDialog");ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(zvi,{...r,...i,ref:n})},"AlertDialogTrigger"));var SGi=QS(t=>{const{__scopeAlertDialog:e,...n}=t,o=vS(e);return K.jsx(o_e,{...o,...n})},"AlertDialogPortal"),QGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(bZ,{...r,...i,ref:n})},"AlertDialogOverlay")),vGi="AlertDialogContent",[wGi,PGi]=BGi(vGi),MGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,children:i,...r}=e,s=vS(o),a=ee.useRef(null),A=$A(n,a),c=ee.useRef(null);return K.jsx(wGi,{scope:o,cancelRef:c,children:K.jsx(QZ,{role:"alertdialog",...s,...r,ref:A,onOpenAutoFocus:ar(r.onOpenAutoFocus,l=>{l.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:i})})},"AlertDialogContent")),DGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(i_e,{...r,...i,ref:n})},"AlertDialogTitle")),NGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(r_e,{...r,...i,ref:n})},"AlertDialogDescription")),RGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,r=vS(o);return K.jsx(LWe,{...r,...i,ref:n})},"AlertDialogAction")),TGi="AlertDialogCancel",kGi=ee.forwardRef(QS(function(e,n){const{__scopeAlertDialog:o,...i}=e,{cancelRef:r}=PGi(TGi,o),s=vS(o),a=$A(n,r);return K.jsx(LWe,{...s,...i,ref:a})},"AlertDialogCancel")),FGi=bGi,LGi=SGi,npn=QGi,opn=MGi,ipn=RGi,rpn=kGi,spn=DGi,apn=NGi;const Apn=FGi,HGi=LGi,cpn=ee.forwardRef(({className:t,...e},n)=>K.jsx(npn,{className:Hi("rf-fixed rf-inset-0 rf-z-50 rf-bg-black/80 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0",t),...e,ref:n}));cpn.displayName=npn.displayName;const v$e=ee.forwardRef(({className:t,...e},n)=>K.jsxs(HGi,{children:[K.jsx(cpn,{}),K.jsx(opn,{ref:n,className:Hi("rf-fixed rf-left-[50%] rf-top-[50%] rf-z-50 rf-grid rf-w-full rf-max-w-lg rf-translate-x-[-50%] rf-translate-y-[-50%] rf-gap-4 rf-border rf-border-zinc-200 rf-bg-white rf-p-6 rf-shadow-lg rf-duration-200 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[state=closed]:rf-slide-out-to-left-1/2 data-[state=closed]:rf-slide-out-to-top-[48%] data-[state=open]:rf-slide-in-from-left-1/2 data-[state=open]:rf-slide-in-from-top-[48%] sm:rf-rounded-lg dark:rf-border-zinc-800 dark:rf-bg-zinc-950",t),...e})]}));v$e.displayName=opn.displayName;const w$e=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col rf-space-y-2 rf-text-center sm:rf-text-left",t),...e});w$e.displayName="AlertDialogHeader";const P$e=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col-reverse sm:rf-flex-row sm:rf-justify-end sm:rf-space-x-2",t),...e});P$e.displayName="AlertDialogFooter";const M$e=ee.forwardRef(({className:t,...e},n)=>K.jsx(spn,{ref:n,className:Hi("rf-text-lg rf-font-semibold",t),...e}));M$e.displayName=spn.displayName;const D$e=ee.forwardRef(({className:t,...e},n)=>K.jsx(apn,{ref:n,className:Hi("rf-text-sm rf-text-zinc-500 dark:rf-text-zinc-400",t),...e}));D$e.displayName=apn.displayName;const OGi=ee.forwardRef(({className:t,...e},n)=>K.jsx(ipn,{ref:n,className:Hi(rU(),t),...e}));OGi.displayName=ipn.displayName;const N$e=ee.forwardRef(({className:t,...e},n)=>K.jsx(rpn,{ref:n,className:Hi(rU({variant:"outline"}),"rf-mt-2 sm:rf-mt-0",t),...e}));N$e.displayName=rpn.displayName;var GGi=Object.defineProperty,wS=(t,e)=>GGi(t,"name",{value:e,configurable:!0}),R$e="Checkbox",[YGi,umr]=Dx(R$e),[UGi,T$e]=YGi(R$e);function lpn(t){const{__scopeCheckbox:e,checked:n,children:o,defaultChecked:i,disabled:r,form:s,name:a,onCheckedChange:A,required:c,value:l="on",internal_do_not_use_render:u}=t,[g,h]=MB({prop:n,defaultProp:i??!1,onChange:A,caller:R$e}),[d,p]=ee.useState(null),[m,_]=ee.useState(null),f=ee.useRef(!1),[I,C]=ee.useReducer(E=>E+1,0),y=d?!!s||!!d.closest("form"):!0,x={checked:g,disabled:r,setChecked:h,control:d,setControl:p,name:a,form:s,value:l,hasConsumerStoppedPropagationRef:f,userInteractionCount:I,onUserInteraction:C,required:c,defaultChecked:PS(i)?!1:i,isFormControl:y,bubbleInput:m,setBubbleInput:_};return K.jsx(UGi,{scope:e,...x,children:gpn(u)?u(x):o})}wS(lpn,"CheckboxProvider");var KGi="CheckboxTrigger",VGi=ee.forwardRef(wS(function({__scopeCheckbox:e,onKeyDown:n,onClick:o,...i},r){const{control:s,value:a,disabled:A,checked:c,required:l,setControl:u,setChecked:g,hasConsumerStoppedPropagationRef:h,onUserInteraction:d,isFormControl:p,bubbleInput:m}=T$e(KGi,e),_=$A(r,u),f=ee.useRef(c);return ee.useEffect(()=>{const I=s?.form;if(I){const C=wS(()=>g(f.current),"reset");return I.addEventListener("reset",C),()=>I.removeEventListener("reset",C)}},[s,g]),K.jsx(Na.button,{type:"button",role:"checkbox","aria-checked":PS(c)?"mixed":c,"aria-required":l,"data-state":k$e(c),"data-disabled":A?"":void 0,disabled:A,value:a,...i,ref:_,onKeyDown:ar(n,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:ar(o,I=>{d(),g(C=>PS(C)?!0:!C),m&&p&&(h.current=I.isPropagationStopped(),h.current||I.stopPropagation())})})},"CheckboxTrigger")),upn=ee.forwardRef(wS(function(e,n){const{__scopeCheckbox:o,name:i,checked:r,defaultChecked:s,required:a,disabled:A,value:c,onCheckedChange:l,form:u,...g}=e;return K.jsx(lpn,{__scopeCheckbox:o,checked:r,defaultChecked:s,disabled:A,required:a,onCheckedChange:l,name:i,form:u,value:c,internal_do_not_use_render:({isFormControl:h})=>K.jsxs(K.Fragment,{children:[K.jsx(VGi,{...g,ref:n,__scopeCheckbox:o}),h&&K.jsx(jGi,{__scopeCheckbox:o})]})})},"Checkbox")),zGi="CheckboxIndicator",JGi=ee.forwardRef(wS(function(e,n){const{__scopeCheckbox:o,forceMount:i,...r}=e,s=T$e(zGi,o);return K.jsx(cE,{present:i||PS(s.checked)||s.checked===!0,children:K.jsx(Na.span,{"data-state":k$e(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),WGi="CheckboxBubbleInput",jGi=ee.forwardRef(wS(function({__scopeCheckbox:e,onClick:n,...o},i){const{control:r,hasConsumerStoppedPropagationRef:s,userInteractionCount:a,checked:A,defaultChecked:c,required:l,disabled:u,name:g,value:h,form:d,bubbleInput:p,setBubbleInput:m}=T$e(WGi,e),_=$A(i,m),f=yWe(r),I=ee.useRef(!1),C=ee.useRef(A),y=ee.useRef(a);ee.useEffect(()=>{const E=p;if(!E)return;const B=window.HTMLInputElement.prototype,Q=Object.getOwnPropertyDescriptor(B,"checked").set,w=a!==y.current;y.current=a;const M=C.current!==A;C.current=A;const k=!(w&&s.current);if(M&&Q){I.current=!w;const R=new Event("click",{bubbles:k});E.indeterminate=PS(A),Q.call(E,PS(A)?!1:A),E.dispatchEvent(R),I.current=!1}},[p,A,s,a]);const x=ee.useRef(PS(A)?!1:A);return K.jsx(Na.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:g,value:h,form:d,...o,tabIndex:-1,ref:_,onClick:ar(n,E=>{I.current&&E.stopPropagation()}),style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function gpn(t){return typeof t=="function"}wS(gpn,"isFunction");function PS(t){return t==="indeterminate"}wS(PS,"isIndeterminate");function k$e(t){return PS(t)?"indeterminate":t?"checked":"unchecked"}wS(k$e,"getState");const mee=ee.forwardRef(({className:t,...e},n)=>K.jsx(upn,{ref:n,className:Hi("rf-peer rf-h-4 rf-w-4 rf-shrink-0 rf-rounded-sm rf-border rf-border-zinc-200 rf-border-zinc-900 rf-shadow focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 data-[state=checked]:rf-bg-zinc-900 data-[state=checked]:rf-text-zinc-50 dark:rf-border-zinc-800 dark:rf-border-zinc-50 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=checked]:rf-bg-zinc-50 dark:data-[state=checked]:rf-text-zinc-900",t),...e,children:K.jsx(JGi,{className:Hi("rf-flex rf-items-center rf-justify-center rf-text-current"),children:K.jsx(IS,{className:"rf-h-4 rf-w-4"})})}));mee.displayName=upn.displayName;const HT=n_e,$Gi=o_e,dpn=ee.forwardRef(({className:t,...e},n)=>K.jsx(bZ,{className:Hi("rf-fixed rf-inset-0 rf-z-50 rf-bg-black/80 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0",t),...e,ref:n}));dpn.displayName=bZ.displayName;const YP=ee.forwardRef(({className:t,children:e,showOverlay:n=!0,...o},i)=>K.jsxs($Gi,{children:[K.jsx(dpn,{className:Hi(n?"":"rf-hidden")}),K.jsx(QZ,{ref:i,className:Hi("rf-fixed rf-left-[50%] rf-top-[50%] rf-z-50 rf-grid rf-w-full rf-max-w-lg rf-translate-x-[-50%] rf-translate-y-[-50%] rf-gap-4 rf-border rf-border-zinc-200 rf-bg-white rf-p-6 rf-shadow-lg rf-duration-200 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[state=closed]:rf-slide-out-to-left-1/2 data-[state=closed]:rf-slide-out-to-top-[48%] data-[state=open]:rf-slide-in-from-left-1/2 data-[state=open]:rf-slide-in-from-top-[48%] sm:rf-rounded-lg dark:rf-border-zinc-800 dark:rf-bg-zinc-950",t),...o,children:e})]}));YP.displayName=QZ.displayName;const UP=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col rf-space-y-2 rf-text-center sm:rf-text-left",t),...e});UP.displayName="DialogHeader";const UU=({className:t,...e})=>K.jsx("div",{className:Hi("rf-flex rf-flex-col-reverse sm:rf-flex-row sm:rf-justify-end sm:rf-space-x-2",t),...e});UU.displayName="DialogFooter";const KP=ee.forwardRef(({className:t,...e},n)=>K.jsx(i_e,{ref:n,className:Hi("rf-text-lg rf-font-semibold",t),...e}));KP.displayName=i_e.displayName;const OT=ee.forwardRef(({className:t,...e},n)=>K.jsx(r_e,{ref:n,className:Hi("rf-text-sm rf-text-zinc-500 dark:rf-text-zinc-400",t),...e}));OT.displayName=r_e.displayName;const gfe={"tscircuit.com":{label:"tscircuit.com",placeholder:"Search tscircuit packages...",emptyMessage:"No packages found"},jlcpcb:{label:"JLCPCB Parts",placeholder:"Search JLCPCB parts (e.g. C14663)...",emptyMessage:"No parts found"},kicad:{label:"KiCad Footprints",placeholder:"Search KiCad footprints...",emptyMessage:"No footprints found"}},qGi="https://cdn.jsdelivr.net/npm/easyeda@latest/dist/browser/index.js";let F$e=null;const L$e=async()=>(F$e||(F$e=import(qGi)),F$e),XGi=t=>(e,n)=>{const o=new Headers(n?.headers),i={};return o.forEach((r,s)=>{i[s]=r}),fetch(`${t?.apiBase??QC}/proxy`,{...n,headers:{...i,"X-Target-Url":e.toString(),"X-Sender-Origin":i.origin??"","X-Sender-Host":i.host??"https://easyeda.com","X-Sender-Referer":i.referer??"","X-Sender-User-Agent":i["user-agent"]??"","X-Sender-Cookie":i.cookie??"",authority:i.authority??"","content-type":i["content-type"]??"",...t?.headers}})},ZGi=async(t,e=10)=>{const n=encodeURIComponent(t),o=await fetch(`https://jlcsearch.tscircuit.com/api/search?limit=${e}&q=${n}`);if(!o.ok)throw new Error(`JLCPCB API error: ${o.status}`);return(await o.json()).components??[]},eYi=t=>({lcscId:t.lcsc,manufacturer:t.mfr,description:t.description,partNumber:`C${t.lcsc}`,package:t.package,price:t.price,stock:t.stock,isBasic:t.is_basic}),hpn=async(t,e)=>{const{fetchEasyEDAComponent:n}=await L$e();return n(t,{fetch:XGi(e),includeModelMetadata:e?.includeModelMetadata})},tYi=async(t,e)=>{const{convertRawEasyToTsx:n}=await L$e(),o=await hpn(t,e);return n({rawEasy:o})},nYi=async(t,e)=>{const{EasyEdaJsonSchema:n,convertEasyEdaJsonToCircuitJson:o}=await L$e(),i=await hpn(t,{...e,includeModelMetadata:!1}),r=n.parse(i);return o(r,{shouldRecenter:!0,showDesignator:!0,useModelCdn:!1})};function VP(t){return Array.isArray?Array.isArray(t):mpn(t)==="[object Array]"}function oYi(t){if(typeof t=="string")return t;if(typeof t=="bigint")return t.toString();const e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function H$e(t){return t==null?"":oYi(t)}function RC(t){return typeof t=="string"}function dfe(t){return typeof t=="number"}function iYi(t){return t===!0||t===!1||rYi(t)&&mpn(t)=="[object Boolean]"}function ppn(t){return typeof t=="object"}function rYi(t){return ppn(t)&&t!==null}function RE(t){return t!=null}function hfe(t){return!t.trim().length}function mpn(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const sYi="Incorrect 'index' type",O$e="Invalid doc index: must be a non-negative integer within the bounds of the docs array",aYi=t=>`Invalid value for key ${t}`,AYi=t=>`Pattern length exceeds max of ${t}.`,cYi=t=>`Missing ${t} property in key`,lYi=t=>`Property 'weight' in key '${t}' must be a positive integer`,uYi="Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.",_pn=Object.prototype.hasOwnProperty;var gYi=class{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(n=>{const o=fpn(n);this._keys.push(o),this._keyMap[o.id]=o,e+=o.weight}),this._keys.forEach(n=>{n.weight/=e})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function fpn(t){let e=null,n=null,o=null,i=1,r=null;if(RC(t)||VP(t))o=t,e=Ipn(t),n=pfe(t);else{if(!_pn.call(t,"name"))throw new Error(cYi("name"));const s=t.name;if(o=s,_pn.call(t,"weight")&&t.weight!==void 0&&(i=t.weight,i<=0))throw new Error(lYi(pfe(s)));e=Ipn(s),n=pfe(s),r=t.getFn??null}return{path:e,id:n,weight:i,src:o,getFn:r}}function Ipn(t){return VP(t)?t:t.split(".")}function pfe(t){return VP(t)?t.join("."):t}function dYi(t,e){const n=[];let o=!1;const i=(r,s,a,A)=>{if(RE(r))if(!s[a])n.push(A!==void 0?{v:r,i:A}:r);else{const c=r[s[a]];if(!RE(c))return;if(a===s.length-1&&(RC(c)||dfe(c)||iYi(c)||typeof c=="bigint"))n.push(A!==void 0?{v:H$e(c),i:A}:H$e(c));else if(VP(c)){o=!0;for(let l=0,u=c.length;l<u;l+=1)i(c[l],s,a+1,l)}else s.length&&i(c,s,a+1,A)}};return i(t,RC(e)?e.split("."):e,0),o?n:n[0]}const wa=Object.freeze({...{isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:dYi,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}});function hYi(t){return t>=9&&t<=13||t===32||t===160}function pYi(t=1,e=3){const n=new Map,o=Math.pow(10,e);return{get(i){let r=0,s=!1;for(let A=0;A<i.length;A++)hYi(i.charCodeAt(A))?s=!1:s||(r++,s=!0);if(r===0&&(r=1),n.has(r))return n.get(r);const a=Math.round(o/Math.pow(r,.5*t))/o;return n.set(r,a),a},clear(){n.clear()}}}var G$e=class{constructor({getFn:t=wa.getFn,fieldNormWeight:e=wa.fieldNormWeight}={}){this.norm=pYi(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((e,n)=>{this._keysMap[e.id]=n})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const t=this.docs.length;this.records=new Array(t);let e=0;if(RC(this.docs[0]))for(let n=0;n<t;n++){const o=this._createStringRecord(this.docs[n],n);o&&(this.records[e++]=o)}else for(let n=0;n<t;n++)this.records[e++]=this._createObjectRecord(this.docs[n],n);this.records.length=e,this.norm.clear()}add(t,e){if(!Number.isInteger(e)||e<0)throw new Error(O$e);if(RC(t)){const o=this._createStringRecord(t,e);return o&&this.records.push(o),o}const n=this._createObjectRecord(t,e);return this.records.push(n),n}removeAt(t){if(!Number.isInteger(t)||t<0)throw new Error(O$e);for(let e=0,n=this.records.length;e<n;e+=1)if(this.records[e].i===t){this.records.splice(e,1);break}for(let e=0,n=this.records.length;e<n;e+=1)this.records[e].i>t&&(this.records[e].i-=1)}removeAll(t){const e=new Set;for(const o of t)Number.isInteger(o)&&o>=0&&e.add(o);if(e.size===0)return;this.records=this.records.filter(o=>!e.has(o.i));const n=Array.from(e).sort((o,i)=>o-i);for(const o of this.records){let i=0,r=n.length;for(;i<r;){const s=i+r>>>1;n[s]<o.i?i=s+1:r=s}o.i-=i}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(t,e){return!RE(t)||hfe(t)?null:{v:t,i:e,n:this.norm.get(t)}}_createObjectRecord(t,e){const n={i:e,$:{}};for(let o=0,i=this.keys.length;o<i;o++){const r=this.keys[o],s=r.getFn?r.getFn(t):this.getFn(t,r.path);if(RE(s)){if(VP(s)){const a=[];for(let A=0,c=s.length;A<c;A+=1){const l=s[A];if(RE(l)){if(RC(l)){if(!hfe(l)){const u={v:l,i:A,n:this.norm.get(l)};a.push(u)}}else if(RE(l.v)){const u=RC(l.v)?l.v:H$e(l.v);if(!hfe(u)){const g={v:u,i:l.i,n:this.norm.get(u)};a.push(g)}}}}n.$[o]=a}else if(RC(s)&&!hfe(s)){const a={v:s,n:this.norm.get(s)};n.$[o]=a}}}return n}toJSON(){return{keys:this.keys.map(({getFn:t,...e})=>e),records:this.records}}};function Cpn(t,e,{getFn:n=wa.getFn,fieldNormWeight:o=wa.fieldNormWeight}={}){const i=new G$e({getFn:n,fieldNormWeight:o});return i.setKeys(t.map(fpn)),i.setSources(e),i.create(),i}function mYi(t,{getFn:e=wa.getFn,fieldNormWeight:n=wa.fieldNormWeight}={}){const{keys:o,records:i}=t,r=new G$e({getFn:e,fieldNormWeight:n});return r.setKeys(o),r.setIndexRecords(i),r}function _Yi(t=[],e=wa.minMatchCharLength){const n=[];let o=-1,i=-1,r=0;for(let s=t.length;r<s;r+=1){const a=t[r];a&&o===-1?o=r:!a&&o!==-1&&(i=r-1,i-o+1>=e&&n.push([o,i]),o=-1)}return t[r-1]&&r-o>=e&&n.push([o,r-1]),n}function fYi(t,e,n,{location:o=wa.location,distance:i=wa.distance,threshold:r=wa.threshold,findAllMatches:s=wa.findAllMatches,minMatchCharLength:a=wa.minMatchCharLength,includeMatches:A=wa.includeMatches,ignoreLocation:c=wa.ignoreLocation}={}){if(e.length>32)throw new Error(AYi(32));const l=e.length,u=t.length,g=Math.max(0,Math.min(o,u));let h=r,d=g;const p=(S,Q)=>{const w=S/l;if(c)return w;const M=Math.abs(g-Q);return i?w+M/i:M?1:w},m=a>1||A,_=m?Array(u):[];let f;for(;(f=t.indexOf(e,d))>-1;){const S=p(0,f);if(h=Math.min(S,h),d=f+l,m){let Q=0;for(;Q<l;)_[f+Q]=1,Q+=1}}d=-1;let I=[],C=1,y=0,x=l+u;const E=1<<l-1;for(let S=0;S<l;S+=1){let Q=0,w=x;for(;Q<w;)p(S,g+w)<=h?Q=w:x=w,w=Math.floor((x-Q)/2+Q);x=w;let M=Math.max(1,g-w+1);const k=s?u:Math.min(g+w,u)+l,R=Array(k+2);R[k+1]=(1<<S)-1;for(let F=k;F>=M;F-=1){const O=F-1,U=n[t[O]];if(R[F]=(R[F+1]<<1|1)&U,S&&(R[F]|=(I[F+1]|I[F])<<1|1|I[F+1]),R[F]&E&&(C=p(S,O),C<=h)){if(h=C,d=O,y=S,d<=g)break;M=Math.max(1,2*g-d)}}if(p(S+1,g)>h)break;I=R}if(m&&d>=0){const S=Math.min(u-1,d+l-1+y);for(let Q=d;Q<=S;Q+=1)n[t[Q]]&&(_[Q]=1)}const B={isMatch:d>=0,score:Math.max(.001,C)};if(m){const S=_Yi(_,a);S.length?A&&(B.indices=S):B.isMatch=!1}return B}function IYi(t){const e={};for(let n=0,o=t.length;n<o;n+=1){const i=t.charAt(n);e[i]=(e[i]||0)|1<<o-n-1}return e}function Y$e(t){if(t.length<=1)return t;t.sort((n,o)=>n[0]-o[0]||n[1]-o[1]);const e=[t[0]];for(let n=1,o=t.length;n<o;n+=1){const i=e[e.length-1],r=t[n];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):e.push(r)}return e}const ypn={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},CYi=new RegExp("["+Object.keys(ypn).join("")+"]","g"),_ee=typeof String.prototype.normalize=="function"?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(CYi,e=>ypn[e]):t=>t;var U$e=class{constructor(t,{location:e=wa.location,threshold:n=wa.threshold,distance:o=wa.distance,includeMatches:i=wa.includeMatches,findAllMatches:r=wa.findAllMatches,minMatchCharLength:s=wa.minMatchCharLength,isCaseSensitive:a=wa.isCaseSensitive,ignoreDiacritics:A=wa.ignoreDiacritics,ignoreLocation:c=wa.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:o,includeMatches:i,findAllMatches:r,minMatchCharLength:s,isCaseSensitive:a,ignoreDiacritics:A,ignoreLocation:c},t=a?t:t.toLowerCase(),t=A?_ee(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const l=(g,h)=>{this.chunks.push({pattern:g,alphabet:IYi(g),startIndex:h})},u=this.pattern.length;if(u>32){let g=0;const h=u%32,d=u-h;for(;g<d;)l(this.pattern.substr(g,32),g),g+=32;if(h){const p=u-32;l(this.pattern.substr(p),p)}}else l(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:n,includeMatches:o}=this.options;if(t=e?t:t.toLowerCase(),t=n?_ee(t):t,this.pattern===t){if(t.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const d={isMatch:!0,score:0};return o&&(d.indices=[[0,t.length-1]]),d}const{location:i,distance:r,threshold:s,findAllMatches:a,minMatchCharLength:A,ignoreLocation:c}=this.options,l=[];let u=0,g=!1;this.chunks.forEach(({pattern:d,alphabet:p,startIndex:m})=>{const{isMatch:_,score:f,indices:I}=fYi(t,d,p,{location:i+m,distance:r,threshold:s,findAllMatches:a,minMatchCharLength:A,includeMatches:o,ignoreLocation:c});_&&(g=!0),u+=f,_&&I&&l.push(...I)});const h={isMatch:g,score:g?u/this.chunks.length:1};return g&&o&&(h.indices=Y$e(l)),h}};const yYi=new Set(["fuzzy","include"]);function xYi(t){return t.startsWith("inverse")}const K$e=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:t=>({type:"exact",search(e){const n=e===t;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:t=>({type:"include",search(e){let n=0,o;const i=[],r=t.length;for(;(o=e.indexOf(t,n))>-1;)n=o+r,i.push([o,n-1]);const s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:t=>({type:"prefix-exact",search(e){const n=e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:t=>({type:"inverse-prefix-exact",search(e){const n=!e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:t=>({type:"inverse-suffix-exact",search(e){const n=!e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:t=>({type:"suffix-exact",search(e){const n=e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[e.length-t.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:t=>({type:"inverse-exact",search(e){const n=e.indexOf(t)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(t,e={})=>{const n=new U$e(t,{location:e.location??wa.location,threshold:e.threshold??wa.threshold,distance:e.distance??wa.distance,includeMatches:e.includeMatches??wa.includeMatches,findAllMatches:e.findAllMatches??wa.findAllMatches,minMatchCharLength:e.minMatchCharLength??wa.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??wa.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??wa.ignoreDiacritics,ignoreLocation:e.ignoreLocation??wa.ignoreLocation});return{type:"fuzzy",search(o){return n.searchIn(o)}}}}],xpn=K$e.length,EYi="\0",BYi="|";function bYi(t){const e=[],n=t.length;let o=0;for(;o<n;){for(;o<n&&t[o]===" ";)o++;if(o>=n)break;let i=o;for(;i<n&&t[i]!==" "&&t[i]!=='"';)i++;if(i<n&&t[i]==='"'){for(i++;i<n;){if(t[i]==='"'){const r=i+1;if(r>=n||t[r]===" "){i++;break}if(t[r]==="$"&&(r+1>=n||t[r+1]===" ")){i+=2;break}}i++}e.push(t.substring(o,i)),o=i}else{for(;i<n&&t[i]!==" ";)i++;e.push(t.substring(o,i)),o=i}}return e}function Epn(t,e){const n=t.match(e);return n?n[1]:null}function SYi(t,e={}){return t.replace(/\\\|/g,EYi).split(BYi).map(n=>{const o=bYi(n.replace(/\u0000/g,"|").trim()).filter(r=>r&&!!r.trim()),i=[];for(let r=0,s=o.length;r<s;r+=1){const a=o[r];let A=!1,c=-1;for(;!A&&++c<xpn;){const l=K$e[c],u=Epn(a,l.multiRegex);u&&(i.push(l.create(u,e)),A=!0)}if(!A)for(c=-1;++c<xpn;){const l=K$e[c],u=Epn(a,l.singleRegex);if(u){i.push(l.create(u,e));break}}}return i})}var QYi=class{constructor(t,{isCaseSensitive:e=wa.isCaseSensitive,ignoreDiacritics:n=wa.ignoreDiacritics,includeMatches:o=wa.includeMatches,minMatchCharLength:i=wa.minMatchCharLength,ignoreLocation:r=wa.ignoreLocation,findAllMatches:s=wa.findAllMatches,location:a=wa.location,threshold:A=wa.threshold,distance:c=wa.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:n,includeMatches:o,minMatchCharLength:i,findAllMatches:s,ignoreLocation:r,location:a,threshold:A,distance:c},t=e?t:t.toLowerCase(),t=n?_ee(t):t,this.pattern=t,this.query=SYi(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:o,ignoreDiacritics:i}=this.options;t=o?t:t.toLowerCase(),t=i?_ee(t):t;let r=0;const s=[];let a=0,A=!1;for(let c=0,l=e.length;c<l;c+=1){const u=e[c];s.length=0,r=0,A=!1;for(let g=0,h=u.length;g<h;g+=1){const d=u[g],{isMatch:p,indices:m,score:_}=d.search(t);if(p)r+=1,a+=_,xYi(d.type)&&(A=!0),n&&(yYi.has(d.type)?s.push(...m):s.push(m));else{a=0,r=0,s.length=0,A=!1;break}}if(r){const g={isMatch:!0,score:a/r};return A&&(g.hasInverse=!0),n&&(g.indices=Y$e(s)),g}}return{isMatch:!1,score:1}}};const V$e=[];function z$e(...t){V$e.push(...t)}function mfe(t,e){for(let n=0,o=V$e.length;n<o;n+=1){const i=V$e[n];if(i.condition(t,e))return new i(t,e)}return new U$e(t,e)}const _fe={AND:"$and",OR:"$or"},J$e={PATH:"$path",PATTERN:"$val"},W$e=t=>!!(t[_fe.AND]||t[_fe.OR]),vYi=t=>!!t[J$e.PATH],wYi=t=>!VP(t)&&ppn(t)&&!W$e(t),Bpn=t=>({[_fe.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function bpn(t,e,{auto:n=!0}={}){const o=i=>{if(RC(i)){const A={keyId:null,pattern:i};return n&&(A.searcher=mfe(i,e)),A}const r=Object.keys(i),s=vYi(i);if(!s&&r.length>1&&!W$e(i))return o(Bpn(i));if(wYi(i)){const A=s?i[J$e.PATH]:r[0],c=s?i[J$e.PATTERN]:i[A];if(!RC(c))throw new Error(aYi(A));const l={keyId:pfe(A),pattern:c};return n&&(l.searcher=mfe(c,e)),l}const a={children:[],operator:r[0]};return r.forEach(A=>{const c=i[A];VP(c)&&c.forEach(l=>{a.children.push(o(l))})}),a};return W$e(t)||(t=Bpn(t)),o(t)}function j$e(t,{ignoreFieldNorm:e=wa.ignoreFieldNorm}){let n=1;return t.forEach(({key:o,norm:i,score:r})=>{const s=o?o.weight:null;n*=Math.pow(r===0&&s?Number.EPSILON:r,(s||1)*(e?1:i))}),n}function PYi(t,{ignoreFieldNorm:e=wa.ignoreFieldNorm}){t.forEach(n=>{n.score=j$e(n.matches,{ignoreFieldNorm:e})})}var MYi=class{constructor(t,e){this.limit=t,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):this.comparator(t,this.heap[0])<0&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(t){const e=this.heap;for(;t>0;){const n=t-1>>1;if(this.comparator(e[t],e[n])<=0)break;const o=e[t];e[t]=e[n],e[n]=o,t=n}}_sinkDown(t){const e=this.heap,n=e.length;let o=t;do{t=o;const i=2*t+1,r=2*t+2;if(i<n&&this.comparator(e[i],e[o])>0&&(o=i),r<n&&this.comparator(e[r],e[o])>0&&(o=r),o!==t){const s=e[t];e[t]=e[o],e[o]=s}}while(o!==t)}};function DYi(t){const e=[];return t.matches.forEach(n=>{if(!RE(n.indices)||!n.indices.length)return;const o={indices:n.indices,value:n.value};n.key&&(o.key=n.key.id),n.idx>-1&&(o.refIndex=n.idx),e.push(o)}),e}function NYi(t,e,{includeMatches:n=wa.includeMatches,includeScore:o=wa.includeScore}={}){return t.map(i=>{const{idx:r}=i,s={item:e[r],refIndex:r};return n&&(s.matches=DYi(i)),o&&(s.score=i.score),s})}const RYi=/[\p{L}\p{M}\p{N}_]+/gu,Spn=new WeakSet;function TYi(t){Spn.has(t)||(Spn.add(t),console.warn(`[Fuse] tokenize regex ${t} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function kYi(t){if(typeof t=="function"){let e=!1;return n=>{const o=t(n);if(!e&&(e=!0,!Array.isArray(o)||o.some(i=>typeof i!="string")))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(o)?"array containing non-strings":typeof o}.`);return o}}return t instanceof RegExp?(t.global||TYi(t),e=>e.match(t)||[]):e=>e.match(RYi)||[]}function $$e({isCaseSensitive:t=!1,ignoreDiacritics:e=!1,tokenize:n}={}){const o=kYi(n);return{tokenize(i){return t||(i=i.toLowerCase()),e&&(i=_ee(i)),o(i)}}}var FYi=class{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=$$e({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});const n=this.analyzer.tokenize(t),{df:o,fieldCount:i}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const r of n){this.termSearchers.push(new U$e(r,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const s=o.get(r)||0,a=Math.log(1+(i-s+.5)/(s+.5));this.idfWeights.push(a)}this.combineAll=e.tokenMatch==="all",this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let n=0,o=0,i=0,r=0;const s=this.combineAll&&!this.useMask?new Set:null;for(let c=0;c<this.termSearchers.length;c++){const l=this.termSearchers[c].searchIn(t),u=this.idfWeights[c];o+=u,l.isMatch&&(i++,n+=u*(1-l.score),l.indices&&e.push(...l.indices),this.combineAll&&(this.useMask?r|=1<<c:s.add(c)))}if(i===0)return{isMatch:!1,score:1};const a=o>0?1-n/o:0,A={isMatch:!0,score:Math.max(.001,a)};return this.options.includeMatches&&e.length&&(A.indices=Y$e(e)),this.combineAll&&(this.useMask?A.matchedMask=r:A.matchedTerms=s,A.termCount=this.numTerms),A}};function q$e(t,e,n,o){const i=o.tokenize(e);if(!i.length)return;t.fieldCount++,t.docFieldCount.set(n,(t.docFieldCount.get(n)||0)+1);const r=new Set(i);let s=t.docTermFieldHits.get(n);s||(s=new Map,t.docTermFieldHits.set(n,s));for(const a of r)s.set(a,(s.get(a)||0)+1),t.df.set(a,(t.df.get(a)||0)+1)}function Qpn(t,e,n,o){const{i,v:r,$:s}=e;if(r!==void 0){q$e(t,r,i,o);return}if(s)for(let a=0;a<n;a++){const A=s[a];if(A)if(Array.isArray(A))for(const c of A)q$e(t,c.v,i,o);else q$e(t,A.v,i,o)}}function LYi(t,e,n){const o={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const i of t)Qpn(o,i,e,n);return o}function HYi(t,e,n,o){Qpn(t,e,n,o)}function OYi(t,e){const n=t.docFieldCount.get(e);if(n===void 0)return;t.fieldCount-=n,t.docFieldCount.delete(e);const o=t.docTermFieldHits.get(e);if(o){for(const[i,r]of o){const s=(t.df.get(i)||0)-r;s<=0?t.df.delete(i):t.df.set(i,s)}t.docTermFieldHits.delete(e)}}function vpn(t,e){if(e.length===0)return;const n=Array.from(new Set(e)).sort((a,A)=>a-A);for(const a of n)OYi(t,a);const o=a=>{let A=0,c=n.length;for(;A<c;){const l=A+c>>>1;n[l]<a?A=l+1:c=l}return a-A},i=n[0],r=new Map;for(const[a,A]of t.docFieldCount)r.set(a>i?o(a):a,A);t.docFieldCount=r;const s=new Map;for(const[a,A]of t.docTermFieldHits)s.set(a>i?o(a):a,A);t.docTermFieldHits=s}var zP=class{constructor(t,e,n){this.options={...wa,...e},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new gYi(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=mfe(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof G$e))throw new Error(sYi);if(this._myIndex=e||Cpn(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const n=$$e({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=LYi(this._myIndex.records,this._myIndex.keys.length,n)}this._invalidateSearcherCache()}add(t){if(!RE(t))return;this._docs.push(t);const e=this._myIndex.add(t,this._docs.length-1);if(this._invertedIndex&&e){const n=$$e({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});HYi(this._invertedIndex,e,this._myIndex.keys.length,n)}this._invalidateSearcherCache()}remove(t=()=>!1){const e=[],n=[];for(let o=0,i=this._docs.length;o<i;o+=1)t(this._docs[o],o)&&(e.push(this._docs[o]),n.push(o));if(n.length){this._invertedIndex&&vpn(this._invertedIndex,n);const o=new Set(n);this._docs=this._docs.filter((i,r)=>!o.has(r)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return e}removeAt(t){if(!Number.isInteger(t)||t<0||t>=this._docs.length)throw new Error(O$e);this._invertedIndex&&vpn(this._invertedIndex,[t]);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(t=>this._keyStore.get(t.id)||t)}search(t,e){const{limit:n=-1}=e||{},{includeMatches:o,includeScore:i,shouldSort:r,sortFn:s,ignoreFieldNorm:a}=this.options;if(RC(t)&&!t.trim()){let g=this._docs.map((h,d)=>({item:h,refIndex:d}));return dfe(n)&&n>-1&&(g=g.slice(0,n)),g}const A=r&&dfe(n)&&n>0&&RC(t),c=s,l=(g,h)=>c(g,h)||g.idx-h.idx;let u;if(A){const g=new MYi(n,l);RC(this._docs[0])?this._searchStringList(t,{heap:g,ignoreFieldNorm:a}):this._searchObjectList(t,{heap:g,ignoreFieldNorm:a}),u=g.extractSorted()}else u=RC(t)?RC(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),PYi(u,{ignoreFieldNorm:a}),r&&u.sort(RC(t)?l:c),dfe(n)&&n>-1&&(u=u.slice(0,n));return NYi(u,this._docs,{includeMatches:o,includeScore:i})}_searchStringList(t,{heap:e,ignoreFieldNorm:n}={}){const o=this._getSearcher(t),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:r}=this._myIndex,s=e?null:[];return r.forEach(({v:a,i:A,n:c})=>{if(!RE(a))return;const l=o.searchIn(a);if(l.isMatch){const u={score:l.score,value:a,norm:c,indices:l.indices};i&&(u.matchedMask=l.matchedMask,u.matchedTerms=l.matchedTerms,u.termCount=l.termCount);const g=[u];if(!i||this._coversAllTokens(g)){const h={item:a,idx:A,matches:g};e?(h.score=j$e(h.matches,{ignoreFieldNorm:n}),e.insert(h)):s.push(h)}}}),s}_searchLogical(t){const e=bpn(t,this.options),n=this._normalizedKeys(),o=(a,A,c)=>{if(!("children"in a)){const{keyId:h,searcher:d}=a;let p;return h===null?(p=[],n.forEach((m,_)=>{p.push(...this._findMatches({key:m,value:A[_],searcher:d}))})):p=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(A,h),searcher:d}),p&&p.length?[{idx:c,item:A,matches:p}]:[]}const{children:l,operator:u}=a,g=[];for(let h=0,d=l.length;h<d;h+=1){const p=l[h],m=o(p,A,c);if(m.length)g.push(...m);else if(u===_fe.AND)return[]}return g},i=this._myIndex.records,r=new Map,s=[];return i.forEach(({$:a,i:A})=>{if(RE(a)){const c=o(e,a,A);c.length&&(r.has(A)||(r.set(A,{idx:A,item:a,matches:[]}),s.push(r.get(A))),c.forEach(({matches:l})=>{r.get(A).matches.push(...l)}))}}),s}_searchObjectList(t,{heap:e,ignoreFieldNorm:n}={}){const o=this._getSearcher(t),i=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:r}=this._myIndex,s=this._normalizedKeys(),a=e?null:[];return r.forEach(({$:A,i:c})=>{if(!RE(A))return;const l=[];let u=!1,g=!1;if(s.forEach((h,d)=>{const p=this._findMatches({key:h,value:A[d],searcher:o});p.length?(l.push(...p),p[0].hasInverse&&(g=!0)):u=!0}),!(g&&u)&&l.length&&(!i||this._coversAllTokens(l))){const h={idx:c,item:A,matches:l};e?(h.score=j$e(h.matches,{ignoreFieldNorm:n}),e.insert(h)):a.push(h)}}),a}_findMatches({key:t,value:e,searcher:n}){if(!RE(e))return[];const o=[];if(VP(e))e.forEach(({v:i,i:r,n:s})=>{if(!RE(i))return;const a=n.searchIn(i);if(a.isMatch){const A={score:a.score,key:t,value:i,idx:r,norm:s,indices:a.indices,hasInverse:a.hasInverse};a.termCount!==void 0&&(A.matchedMask=a.matchedMask,A.matchedTerms=a.matchedTerms,A.termCount=a.termCount),o.push(A)}});else{const{v:i,n:r}=e,s=n.searchIn(i);if(s.isMatch){const a={score:s.score,key:t,value:i,norm:r,indices:s.indices,hasInverse:s.hasInverse};s.termCount!==void 0&&(a.matchedMask=s.matchedMask,a.matchedTerms=s.matchedTerms,a.termCount=s.termCount),o.push(a)}}return o}_coversAllTokens(t){const e=t.length?t[0].termCount:void 0;if(e===void 0)return!0;if(e<=31){let o=0;for(let i=0;i<t.length;i++)o|=t[i].matchedMask||0;return o===2**e-1}const n=new Set;for(let o=0;o<t.length;o++){const i=t[o].matchedTerms;if(i)for(const r of i)n.add(r)}return n.size===e}};zP.version="7.5.0",zP.createIndex=Cpn,zP.parseIndex=mYi,zP.config=wa,zP.match=function(t,e,n){if(n&&n.useTokenSearch)throw new Error(uYi);return mfe(t,{...wa,...n}).searchIn(e)},zP.parseQuery=bpn,z$e(QYi),z$e(FYi),zP.use=function(...t){t.forEach(e=>z$e(e))};var GYi=zP;const YYi="https://kicad-mod-cache.tscircuit.com";let X$e=null,fee=null,Z$e=null;const UYi=async()=>X$e||fee||(fee=fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then(t=>t.json()).then(t=>(X$e=t,fee=null,t)),fee),KYi=async(t,e=20)=>{const n=await UYi();return Z$e||(Z$e=new GYi(n)),Z$e.search(t).slice(0,e).map(o=>o.item)},VYi=t=>{const e=t.replace(".pretty/","/").replace(".kicad_mod",""),n=`kicad:${e}`;return{path:t,qualifiedName:n,description:e}},zYi=t=>t.replace(/^\/+/,"").split("/").map(e=>encodeURIComponent(e)).join("/"),JYi=async t=>{const e=await fetch(`${YYi}/${zYi(t)}`);if(!e.ok)throw new Error(`KiCad footprint fetch failed: ${e.status}`);const n=await e.text(),{KicadFootprintToCircuitJsonConverter:o}=await vE("kicad-to-circuit-json"),i=new o;return i.addFile(t.split("/").pop()??"selected-footprint.kicad_mod",n),i.runUntilFinished(),i.getOutput()},wpn=t=>t?.source==="jlcpcb"||t?.source==="kicad",WYi=async(t,e)=>{if(t.source==="jlcpcb")return nYi(t.component.partNumber,e?.jlcpcb);if(t.source==="kicad")return JYi(t.footprint.path);throw new Error("Footprint preview is not available for this source")},jYi=({query:t,placeholder:e,isSearching:n,onQueryChange:o,onSubmit:i})=>{const r=ee.useCallback(s=>{s.key==="Enter"&&(s.preventDefault(),i())},[i]);return K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-mt-4",children:[K.jsxs("div",{className:"rf-relative rf-flex-grow",children:[K.jsx(ZJe,{className:"rf-absolute rf-left-2 rf-top-2.5 rf-h-4 rf-w-4 rf-text-muted-foreground"}),K.jsx(gje,{placeholder:e,className:"rf-pl-8",spellCheck:!1,autoComplete:"off",value:t,onChange:s=>o(s.target.value),onKeyDown:r})]}),K.jsx(fA,{onClick:i,disabled:n||t.trim().length<1,className:"sm:rf-px-4 rf-px-3",children:n?K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):K.jsxs(K.Fragment,{children:[K.jsx(ZJe,{className:"rf-h-4 rf-w-4 sm:rf-hidden"}),K.jsx("span",{className:"rf-hidden sm:rf-inline",children:"Search"})]})})]})},$Yi=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}),qYi=t=>$Yi.format(t),Ppn=t=>{switch(t.source){case"tscircuit.com":{const e=t.package;return`tscircuit-${e.package_id??`${e.org_owner_tscircuit_handle??"unknown"}-${e.unscoped_name??e.name??"package"}`}`}case"jlcpcb":return`jlc-${t.component.lcscId}`;case"kicad":return`kicad-${t.footprint.path}`;default:return"unknown"}},XYi=t=>{switch(t.source){case"tscircuit.com":return t.package.unscoped_name;case"jlcpcb":return t.component.isDirectLookup?t.component.partNumber:t.component.manufacturer;case"kicad":return t.footprint.qualifiedName}},ZYi=t=>{switch(t.source){case"tscircuit.com":return t.package.description||(t.package.org_owner_tscircuit_handle?`Component by ${t.package.org_owner_tscircuit_handle}`:void 0);case"jlcpcb":return t.component.description;case"kicad":return t.footprint.description}},eUi=t=>{switch(t.source){case"tscircuit.com":return t.package.name;case"jlcpcb":return t.component.isDirectLookup?void 0:t.component.partNumber;case"kicad":return}},tUi=({results:t,selected:e,onSelect:n,onShowDetails:o})=>{const i=e?Ppn(e):null;return K.jsx("div",{className:"rf-divide-y rf-w-full rf-overflow-hidden",children:t.map(r=>{const s=Ppn(r),a=i===s,A=XYi(r),c=ZYi(r),l=eUi(r),u=r.source==="jlcpcb"?r.component.stock:null,g=r.source==="jlcpcb"?r.component.price:null,h=r.source==="jlcpcb"?r.component.isBasic:null,d=r.source==="jlcpcb"?r.component.isDirectLookup:!1;return K.jsxs("div",{className:`rf-p-3 rf-flex rf-flex-col sm:rf-grid sm:rf-grid-cols-[minmax(0,1fr)_auto] rf-items-start sm:rf-items-center rf-cursor-pointer hover:rf-bg-zinc-100 rf-gap-2 rf-overflow-hidden ${a?"rf-bg-zinc-100":""}`,onClick:()=>n(r),children:[K.jsxs("div",{className:"rf-min-w-0 rf-overflow-hidden rf-w-full",children:[K.jsxs("div",{className:"rf-flex rf-items-start rf-gap-2 rf-min-w-0",children:[K.jsxs("div",{className:"rf-font-medium rf-text-sm rf-truncate rf-flex-1 rf-min-w-0 rf-flex rf-items-center rf-gap-1.5",children:[A,r.source==="jlcpcb"&&h!=null&&K.jsx("span",{className:`rf-text-xs rf-px-1.5 rf-py-0.5 rf-rounded rf-font-medium rf-flex-shrink-0 ${h?"rf-bg-green-100 rf-text-green-700":"rf-bg-orange-100 rf-text-orange-700"}`,children:h?"Basic":"Extended"}),d&&K.jsx("span",{className:"rf-text-xs rf-px-1.5 rf-py-0.5 rf-rounded rf-font-medium rf-flex-shrink-0 rf-bg-blue-100 rf-text-blue-700",children:"Direct lookup"}),r.source==="tscircuit.com"&&r.package.is_private&&K.jsx(Abi,{className:"rf-ml-1 rf-h-3 rf-w-3 rf-text-zinc-400 rf-flex-shrink-0"})]}),r.source==="jlcpcb"&&u!=null?K.jsxs("div",{className:"rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0 sm:rf-hidden",children:[u.toLocaleString()," in stock"]}):null]}),K.jsxs("div",{className:"rf-text-xs rf-text-zinc-500 rf-truncate rf-w-full",children:[l?K.jsx("span",{className:"rf-mr-2",children:l}):null,c]})]}),K.jsxs("div",{children:[r.source==="tscircuit.com"&&o?K.jsx("div",{className:"rf-flex-shrink-0 rf-w-full sm:rf-w-auto",children:K.jsx(fA,{variant:"outline",size:"sm",className:"rf-text-xs rf-w-full sm:rf-w-auto",onClick:p=>{p.stopPropagation(),o(r)},children:"See Details"})}):r.source==="jlcpcb"&&u!=null?K.jsxs("div",{className:"rf-hidden sm:rf-block rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0",children:[u.toLocaleString()," in stock"]}):null,g!=null&&K.jsx("div",{className:"rf-hidden sm:rf-block rf-text-xs rf-text-zinc-500 rf-font-medium rf-whitespace-nowrap rf-flex-shrink-0 rf-text-right",children:qYi(g)})]})]},s)})})},nUi=({circuitJson:t,error:e,isLoading:n,height:o})=>K.jsx("section",{className:"rf-flex rf-min-w-0 rf-items-center rf-justify-center",style:{height:o},children:n?K.jsxs("div",{className:"rf-flex rf-w-full rf-items-center rf-justify-center rf-gap-2 rf-bg-zinc-950 rf-text-sm rf-text-zinc-300",style:{height:o},children:[K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}),"Loading preview..."]}):e?K.jsx("div",{className:"rf-flex rf-w-full rf-items-center rf-justify-center rf-bg-zinc-950 rf-p-4",style:{height:o},children:K.jsxs("div",{className:"rf-flex rf-max-w-[320px] rf-items-start rf-gap-2 rf-text-sm rf-text-zinc-300",children:[K.jsx(XJe,{className:"rf-mt-0.5 rf-h-4 rf-w-4 rf-flex-shrink-0"}),K.jsx("span",{children:e})]})}):t?K.jsx("div",{className:"rf-w-full rf-min-w-0 rf-overflow-hidden",children:K.jsx(f$e,{circuitJson:t,height:o,allowEditing:!1,clickToInteractEnabled:!1,focusOnHover:!1,disablePcbGroups:!0})}):K.jsx("div",{className:"rf-flex rf-w-full rf-items-center rf-justify-center rf-bg-zinc-950 rf-text-sm rf-text-zinc-300",style:{height:o},children:"No preview"})}),Mpn={importComponentDialog:101,importComponentDetailsDialog:102},oUi=({packageResult:t,isOpen:e,onOpenChange:n,isLoading:o,details:i,previewTab:r,onPreviewTabChange:s,isSubmitting:a,onImport:A})=>{const c=t?.package??null,l=c?.latest_pcb_preview_image_url,u=c?.latest_sch_preview_image_url,g=c?.latest_cad_preview_image_url,h=c?.unscoped_name?.split("/").pop()??c?.unscoped_name,d=c?.org_owner_tscircuit_handle??void 0,p=d?`https://tscircuit.com/${d}`:void 0,m=d&&h?`https://tscircuit.com/${d}/${h}`:void 0;return K.jsx(HT,{open:e,onOpenChange:n,children:K.jsxs(YP,{showOverlay:!1,style:{width:"calc(100vw - 2rem)",zIndex:Mpn.importComponentDetailsDialog},className:"rf-max-w-5xl no-scrollbar !rf-overflow-y-auto rf-max-h-[90vh] rf-overflow-hidden rf-flex rf-flex-col rf-rounded-sm",children:[K.jsx(UP,{className:"rf-pb-4 rf-border-b",children:K.jsx("div",{className:"rf-flex rf-items-start rf-justify-between rf-gap-4",children:K.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[K.jsx(KP,{className:"rf-text-xl rf-font-semibold rf-truncate",children:h}),K.jsx(OT,{children:c?.description})]})})}),K.jsxs("div",{className:"rf-flex-1 rf-overflow-y-auto rf-py-4 rf-space-y-6",children:[d?K.jsxs("div",{children:[K.jsx("span",{className:"rf-text-xs rf-font-medium rf-text-gray-500 rf-uppercase rf-tracking-wide",children:"Created by"}),K.jsx("div",{className:"rf-mt-1 rf-text-sm rf-font-medium",children:p?K.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"rf-text-black hover:rf-underline",children:d}):d})]}):null,(g||l||u)&&K.jsx(K.Fragment,{children:K.jsxs("div",{children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Preview"}),K.jsxs(ARe,{value:r,onValueChange:_=>s(_),children:[K.jsxs(Vge,{className:"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",children:[l&&K.jsx(h6,{value:"pcb",children:"PCB"}),u&&K.jsx(h6,{value:"schematic",children:"Schematic"}),g&&K.jsx(h6,{value:"3d",children:"3D"})]}),K.jsxs("div",{className:"rf-mt-4",children:[K.jsx(cI,{value:"pcb",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:l?K.jsx("img",{src:l,alt:`${h??"package"} PCB preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null}),K.jsx(cI,{value:"schematic",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:u?K.jsx("img",{src:u,alt:`${h??"package"} schematic preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null}),K.jsx(cI,{value:"3d",className:"rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",children:g?K.jsx("img",{src:g,alt:`${h??"package"} 3D preview`,className:"rf-w-full rf-h-full rf-object-contain rf-bg-white rf-p-4"}):null})]})]})]})}),i?.ai_description?K.jsxs("section",{children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-3",children:"AI Description"}),K.jsx("div",{className:"rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-700 rf-leading-relaxed",children:i.ai_description})})]}):null,i?.ai_usage_instructions?K.jsxs("section",{children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-mb-3",children:"Usage Instructions"}),K.jsx("div",{className:"rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-700 rf-leading-relaxed rf-whitespace-pre-wrap",children:i.ai_usage_instructions})})]}):null,o?K.jsxs("div",{className:"rf-flex rf-justify-center rf-items-center rf-gap-2 rf-text-gray-500",children:[K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}),K.jsx("span",{className:"rf-text-sm",children:"Loading package details..."})]}):null]}),K.jsxs(UU,{className:"rf-pt-4 rf-border-t rf-flex rf-flex-col sm:rf-flex-row rf-justify-between rf-gap-2",children:[K.jsx("div",{className:"rf-flex-1",children:m?K.jsxs(fA,{variant:"outline",size:"sm",className:"rf-gap-2 rf-w-full sm:rf-w-auto",onClick:()=>window.open(m,"_blank"),children:[K.jsx(tbi,{className:"rf-h-4 rf-w-4"}),"View on tscircuit.com"]}):null}),K.jsxs("div",{className:"rf-flex rf-flex-col sm:rf-flex-row rf-gap-2",children:[K.jsx(fA,{variant:"outline",onClick:()=>n(!1),className:"rf-order-2 sm:rf-order-1",children:"Close"}),K.jsx(fA,{onClick:A,disabled:a,className:"rf-bg-blue-600 hover:rf-bg-blue-700",children:a?K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):"Import Component"})]})]})]})})},iUi=()=>{const[t,e]=ee.useState(null),[n,o]=ee.useState(!1),i=ee.useCallback(async(s,a)=>{o(!0);try{const A=await fetch(`https://api.tscircuit.com/packages/get?name=${encodeURIComponent(`${s}/${a}`)}`);if(!A.ok)throw new Error(`Failed to load package details: ${A.status}`);const c=await A.json();e(c.package??null)}catch(A){console.error("Failed to fetch package details",A),e(null)}finally{o(!1)}},[]),r=ee.useCallback(()=>{e(null),o(!1)},[]);return{details:t,isLoading:n,fetchDetails:i,reset:r}},rUi=(t,e)=>{const[n,o]=ee.useState({circuitJson:null,error:null,isLoading:!1});return ee.useEffect(()=>{if(!t||!wpn(t)){o({circuitJson:null,error:null,isLoading:!1});return}let i=!1;return o({circuitJson:null,error:null,isLoading:!0}),WYi(t,e).then(r=>{i||o({circuitJson:r,error:null,isLoading:!1})}).catch(r=>{i||o({circuitJson:null,error:r instanceof Error?r.message:"Failed to load footprint preview",isLoading:!1})}),()=>{i=!0}},[t,e]),n},sUi=async(t,e)=>{const n={"Content-Type":"application/json"};e&&(n.Authorization=`Bearer ${e}`);const o=await fetch("https://registry-api.tscircuit.com/packages/search",{method:"POST",headers:n,body:JSON.stringify({query:t})});if(!o.ok)throw new Error(`tscircuit registry error: ${o.status}`);return(await o.json()).packages??[]},aUi=({sessionToken:t})=>{const[e,n]=ee.useState([]),[o,i]=ee.useState(!1),[r,s]=ee.useState(null),[a,A]=ee.useState(!1),c=ee.useCallback(async u=>{const g=u.trim();if(!g)return[];i(!0),s(null);try{const d=(await sUi(g,t)).map(p=>({source:"tscircuit.com",package:p}));return n(d),d}catch(h){return console.error("Error searching tscircuit packages",h),n([]),s(h instanceof Error?h.message:"Failed to search tscircuit packages"),[]}finally{i(!1),A(!0)}},[t]),l=ee.useCallback(()=>{n([]),i(!1),s(null),A(!1)},[]);return{results:e,isSearching:o,error:r,hasSearched:a,search:c,reset:l}},AUi=t=>{const e=/^C(\d+)$/i.exec(t.trim());if(!e)return null;const n=Number(e[1]);if(!Number.isSafeInteger(n))return null;const o=`C${e[1]}`;return{source:"jlcpcb",component:{lcscId:n,manufacturer:o,partNumber:o,description:"Import directly from EasyEDA; stock and availability are unknown",package:"",isDirectLookup:!0}}},Dpn=(t,e)=>{const n=AUi(t);return n?e.some(i=>i.component.partNumber.toUpperCase()===n.component.partNumber)?e:[n,...e]:e},cUi=t=>{const e=t.trim();return/^C\d+/i.test(e)?e.replace(/^C/i,""):e},lUi=()=>{const[t,e]=ee.useState([]),[n,o]=ee.useState(!1),[i,r]=ee.useState(null),[s,a]=ee.useState(!1),A=ee.useCallback(async l=>{const u=cUi(l);if(!u)return[];o(!0),r(null);try{const g=await ZGi(u,10),h=Dpn(l,g.map(d=>({source:"jlcpcb",component:eYi(d)})));return e(h),h}catch(g){console.error("Error searching JLCPCB components",g);const h=Dpn(l,[]);return e(h),r(h.length>0?null:g instanceof Error?g.message:"Failed to search JLCPCB components"),h}finally{o(!1),a(!0)}},[]),c=ee.useCallback(()=>{e([]),o(!1),r(null),a(!1)},[]);return{results:t,isSearching:n,error:i,hasSearched:s,search:A,reset:c}},uUi=()=>{const[t,e]=ee.useState([]),[n,o]=ee.useState(!1),[i,r]=ee.useState(null),[s,a]=ee.useState(!1),A=ee.useCallback(async l=>{const u=l.trim();if(!u)return[];o(!0),r(null);try{const h=(await KYi(u,20)).map(d=>({source:"kicad",footprint:VYi(d)}));return e(h),h}catch(g){return console.error("Error searching KiCad footprints",g),e([]),r(g instanceof Error?g.message:"Failed to search KiCad footprints"),[]}finally{o(!1),a(!0)}},[]),c=ee.useCallback(()=>{e([]),o(!1),r(null),a(!1)},[]);return{results:t,isSearching:n,error:i,hasSearched:s,search:A,reset:c}},gUi=({onTscircuitPackageSelected:t,onJlcpcbComponentTsxLoaded:e,onKicadStringSelected:n})=>{const o=[];return t&&o.push("tscircuit.com"),e&&o.push("jlcpcb"),n&&o.push("kicad"),o},dUi=({isOpen:t,onClose:e,jlcpcbProxyRequestHeaders:n,onKicadStringSelected:o,onTscircuitPackageSelected:i,onJlcpcbComponentTsxLoaded:r,jlcpcbProxyApiBase:s,tscircuitSessionToken:a})=>{dee();const A=ee.useMemo(()=>gUi({onKicadStringSelected:o,onTscircuitPackageSelected:i,onJlcpcbComponentTsxLoaded:r}),[o,i,r]),c=A.length>0,l=A.length===1,[u,g]=ee.useState(A[0]??"tscircuit.com"),[h,d]=ee.useState(""),[p,m]=ee.useState(null),{results:_,isSearching:f,error:I,hasSearched:C,search:y,reset:x}=aUi({sessionToken:a}),{results:E,isSearching:B,error:S,hasSearched:Q,search:w,reset:M}=lUi(),{results:k,isSearching:R,error:F,hasSearched:O,search:U,reset:Y}=uUi(),{details:W,isLoading:te,fetchDetails:j,reset:J}=iUi(),[ie,oe]=ee.useState(null),[ne,ge]=ee.useState(!1),[ue,_e]=ee.useState("pcb"),[le,fe]=ee.useState(null),[he,ye]=ee.useState(!1),Qe=ee.useMemo(()=>({jlcpcb:{headers:n,apiBase:s}}),[s,n]),{circuitJson:we,error:pe,isLoading:ve}=rUi(p,Qe),Me=wpn(p);ee.useEffect(()=>{fe(null)},[p]);const Pe=ee.useCallback(()=>{x(),M(),Y(),m(null)},[M,Y,x]);ee.useEffect(()=>{t||(Pe(),d(""),ge(!1),oe(null),fe(null))},[t,Pe]),ee.useEffect(()=>{d(""),m(null),u==="tscircuit.com"?x():u==="jlcpcb"?M():u==="kicad"&&Y()},[u,M,Y,x]);const He=ot=>{m(ot),oe(ot),_e("pcb"),ge(!0),J();const gt=ot.package.org_owner_tscircuit_handle,Bt=ot.package.unscoped_name;if(gt&&Bt){const Ct=Bt.split("/").pop()??Bt;j(gt,Ct)}},Re=async()=>{h.trim()&&(m(null),u==="tscircuit.com"?await y(h):u==="jlcpcb"?await w(h):u==="kicad"&&await U(h))},Ee=async ot=>{try{if(fe(null),ye(!0),ot.source==="kicad"){if(!o)throw new Error("KiCad handler not provided");await o({result:ot,footprint:ot.footprint.qualifiedName})}else if(ot.source==="jlcpcb"){if(!r)throw new Error("JLCPCB handler not provided");const gt=await tYi(ot.component.partNumber,{headers:n,apiBase:s});await r({result:ot,tsx:gt})}else if(ot.source==="tscircuit.com"){if(!i)throw new Error("tscircuit package handler not provided");const gt=ot.package.org_owner_tscircuit_handle,Bt=ot.package.unscoped_name;if(!gt||!Bt)throw new Error("Missing package metadata");const Ct=Bt.split("/").pop()??Bt,Dt=`@tsci/${gt}.${Ct}`;await i({result:ot,fullPackageName:Dt})}return!0}catch(gt){return console.error("Failed to import component",gt),fe(gt instanceof Error?gt.message:"Failed to import component"),!1}finally{ye(!1)}};let Te=[],Ce=!1,Fe=null,Ye=!1;u==="tscircuit.com"?(Te=_,Ce=f,Fe=I,Ye=C):u==="jlcpcb"?(Te=E,Ce=B,Fe=S,Ye=Q):u==="kicad"&&(Te=k,Ce=R,Fe=F,Ye=O);const tt=async()=>{if(!p)return;await Ee(p)&&(e(),Pe(),d(""))},At=ot=>{ot||e()},at=ot=>{ge(ot),ot||oe(null)};return K.jsxs(HT,{open:t,onOpenChange:At,children:[K.jsxs(YP,{style:{width:"calc(100vw - 2rem)",maxWidth:Me?"min(1120px, calc(100vw - 2rem))":"min(672px, calc(100vw - 2rem))",zIndex:Mpn.importComponentDialog},className:"rf-rounded-sm rf-max-h-[90vh] rf-overflow-y-auto rf-overflow-x-hidden rf-flex rf-flex-col",children:[K.jsxs(UP,{children:[K.jsxs(KP,{className:"rf-text-lg sm:rf-text-xl",children:["Import ",l?gfe[u].label:""," ","Component"]}),K.jsx(OT,{className:"rf-text-sm",children:c?"Search for components from available sources.":"Import options are disabled because no handlers were provided."})]}),c?K.jsxs(ARe,{value:u,onValueChange:ot=>g(ot),className:"rf-min-w-0 rf-w-full",children:[!l&&K.jsx(Vge,{className:"rf-flex rf-w-full rf-gap-2",children:A.map(ot=>K.jsx(h6,{value:ot,className:"rf-flex-1 rf-text-xs sm:rf-text-sm",children:gfe[ot].label},ot))}),K.jsxs("div",{className:"rf-min-w-0",style:Me?{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(360px, 0.95fr)",gap:"1.5rem",alignItems:"start"}:void 0,children:[K.jsxs("div",{className:"rf-min-w-0",children:[K.jsx(jYi,{query:h,placeholder:gfe[u].placeholder,isSearching:Ce,onQueryChange:d,onSubmit:Re}),K.jsx("div",{className:"no-scrollbar rf-mt-4 rf-flex-1 rf-min-h-[200px] !rf-max-h-[40vh] !rf-overflow-y-auto rf-overflow-x-hidden rf-border rf-rounded-md rf-min-w-0",children:Ce?K.jsxs("div",{className:"rf-p-8 rf-text-center rf-text-zinc-500",children:[K.jsx(xE,{className:"rf-h-8 rf-w-8 rf-animate-spin rf-mx-auto rf-mb-2"}),K.jsx("p",{children:"Searching..."})]}):Te.length>0?K.jsx(tUi,{results:Te,selected:p,onSelect:m,onShowDetails:u==="tscircuit.com"?He:void 0}):K.jsx("div",{className:"rf-p-8 rf-text-center rf-text-zinc-500",children:Fe?`Error: ${Fe}`:Ye?gfe[u].emptyMessage:"Enter a search term to find components"})})]}),Me?K.jsx("div",{className:"rf-mt-4",children:K.jsx(nUi,{circuitJson:we,error:pe,isLoading:ve,height:325})}):null]})]}):null,le?K.jsx("div",{className:"rf-text-sm rf-text-red-600 rf-mt-2",children:le}):null,K.jsxs(UU,{className:"rf-flex rf-flex-col sm:rf-flex-row rf-gap-2",children:[K.jsx(fA,{variant:"outline",onClick:e,className:"rf-order-2 sm:rf-order-1",children:"Cancel"}),K.jsx(fA,{onClick:tt,disabled:!p||he,className:"rf-order-1 sm:rf-order-2",children:he?K.jsx(xE,{className:"rf-h-4 rf-w-4 rf-animate-spin"}):"Import"})]})]}),K.jsx(oUi,{packageResult:ie,isOpen:ne,onOpenChange:at,isLoading:te,details:W,previewTab:ue,onPreviewTabChange:ot=>_e(ot),isSubmitting:he,onImport:()=>{ie&&Ee(ie).then(ot=>{ot&&(ge(!1),e(),Pe(),d(""))})}})]})},hUi=t=>{const e=t.match(/export const (\w+) =/);if(!e)throw new Error("Could not determine component name from TSX contents");return e[1]},Npn=t=>{const e=md(s=>s.pushEvent),n=md(s=>s.upsertFile),o=async({result:s,fullPackageName:a})=>{const c=s.package.unscoped_name??s.package.name;await ua.promise(e({event_type:"INSTALL_PACKAGE",full_package_name:a}),{loading:`Requesting install for "${c}"`,success:`Install requested for "${c}"`,error:l=>`Failed to request install: ${l instanceof Error?l.message:String(l)}`})},i=async({footprint:s})=>{await ua.promise(navigator.clipboard.writeText(s),{loading:`Copying "${s}"`,success:`Copied "${s}" to clipboard`,error:a=>`Failed to copy footprint: ${a instanceof Error?a.message:String(a)}`})},r=async({result:s,tsx:a})=>{const c=`imports/${hUi(a)}.tsx`;await ua.promise(n(c,a),{loading:`Importing ${s.component.partNumber}`,success:`Imported to "${c}"`,error:l=>`Failed to import component: ${l instanceof Error?l.message:String(l)}`})};return K.jsx(dUi,{...t,onTscircuitPackageSelected:o,onKicadStringSelected:i,onJlcpcbComponentTsxLoaded:r})};Npn.displayName="ImportComponentDialogForCli";const pUi=async({circuitJson:t,projectName:e})=>{const{convertCircuitJsonToAltiumZip:n}=await Promise.resolve().then(()=>Ygr),o=await n(t,e);return new Blob([new Uint8Array(o)],{type:"application/zip"})},mUi=async({circuitJson:t,projectName:e})=>{await ua.promise((async()=>{const n=await pUi({circuitJson:t,projectName:e});NE(n,{fileName:`${e}_altium_project.zip`})})(),{loading:"Generating Altium project...",success:"Altium project ZIP ready",error:n=>`Failed to generate Altium project: ${n instanceof Error?n.message:String(n)}`})};var eqe={exports:{}},Rpn;function _Ui(){return Rpn||(Rpn=1,(function(t,e){var n={env:{},version:""};(function(o){t.exports=o()})(function(){return(function o(i,r,s){function a(l,u){if(!r[l]){if(!i[l]){var g=typeof Y8=="function"&&Y8;if(!u&&g)return g(l,!0);if(A)return A(l,!0);var h=new Error("Cannot find module '"+l+"'");throw h.code="MODULE_NOT_FOUND",h}var d=r[l]={exports:{}};i[l][0].call(d.exports,function(p){var m=i[l][1][p];return a(m||p)},d,d.exports,o,i,r,s)}return r[l].exports}for(var A=typeof Y8=="function"&&Y8,c=0;c<s.length;c++)a(s[c]);return a})({1:[function(o,i,r){var s=o("./utils"),a=o("./support"),A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(c){for(var l,u,g,h,d,p,m,_=[],f=0,I=c.length,C=I,y=s.getTypeOf(c)!=="string";f<c.length;)C=I-f,g=y?(l=c[f++],u=f<I?c[f++]:0,f<I?c[f++]:0):(l=c.charCodeAt(f++),u=f<I?c.charCodeAt(f++):0,f<I?c.charCodeAt(f++):0),h=l>>2,d=(3&l)<<4|u>>4,p=1<C?(15&u)<<2|g>>6:64,m=2<C?63&g:64,_.push(A.charAt(h)+A.charAt(d)+A.charAt(p)+A.charAt(m));return _.join("")},r.decode=function(c){var l,u,g,h,d,p,m=0,_=0,f="data:";if(c.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");var I,C=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===A.charAt(64)&&C--,c.charAt(c.length-2)===A.charAt(64)&&C--,C%1!=0)throw new Error("Invalid base64 input, bad content length.");for(I=a.uint8array?new Uint8Array(0|C):new Array(0|C);m<c.length;)l=A.indexOf(c.charAt(m++))<<2|(h=A.indexOf(c.charAt(m++)))>>4,u=(15&h)<<4|(d=A.indexOf(c.charAt(m++)))>>2,g=(3&d)<<6|(p=A.indexOf(c.charAt(m++))),I[_++]=l,d!==64&&(I[_++]=u),p!==64&&(I[_++]=g);return I}},{"./support":30,"./utils":32}],2:[function(o,i,r){var s=o("./external"),a=o("./stream/DataWorker"),A=o("./stream/Crc32Probe"),c=o("./stream/DataLengthProbe");function l(u,g,h,d,p){this.compressedSize=u,this.uncompressedSize=g,this.crc32=h,this.compression=d,this.compressedContent=p}l.prototype={getContentWorker:function(){var u=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),g=this;return u.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(u,g,h){return u.pipe(new A).pipe(new c("uncompressedSize")).pipe(g.compressWorker(h)).pipe(new c("compressedSize")).withStreamInfo("compression",g)},i.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(o,i,r){var s=o("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},r.DEFLATE=o("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(o,i,r){var s=o("./utils"),a=(function(){for(var A,c=[],l=0;l<256;l++){A=l;for(var u=0;u<8;u++)A=1&A?3988292384^A>>>1:A>>>1;c[l]=A}return c})();i.exports=function(A,c){return A!==void 0&&A.length?s.getTypeOf(A)!=="string"?(function(l,u,g,h){var d=a,p=h+g;l^=-1;for(var m=h;m<p;m++)l=l>>>8^d[255&(l^u[m])];return-1^l})(0|c,A,A.length,0):(function(l,u,g,h){var d=a,p=h+g;l^=-1;for(var m=h;m<p;m++)l=l>>>8^d[255&(l^u.charCodeAt(m))];return-1^l})(0|c,A,A.length,0):0}},{"./utils":32}],5:[function(o,i,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(o,i,r){var s=null;s=typeof Promise<"u"?Promise:o("lie"),i.exports={Promise:s}},{lie:37}],7:[function(o,i,r){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=o("pako"),A=o("./utils"),c=o("./stream/GenericWorker"),l=s?"uint8array":"array";function u(g,h){c.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=h,this.meta={}}r.magic="\b\0",A.inherits(u,c),u.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(A.transformTo(l,g.data),!1)},u.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(h){g.push({data:h,meta:g.meta})}},r.compressWorker=function(g){return new u("Deflate",g)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(o,i,r){function s(d,p){var m,_="";for(m=0;m<p;m++)_+=String.fromCharCode(255&d),d>>>=8;return _}function a(d,p,m,_,f,I){var C,y,x=d.file,E=d.compression,B=I!==l.utf8encode,S=A.transformTo("string",I(x.name)),Q=A.transformTo("string",l.utf8encode(x.name)),w=x.comment,M=A.transformTo("string",I(w)),k=A.transformTo("string",l.utf8encode(w)),R=Q.length!==x.name.length,F=k.length!==w.length,O="",U="",Y="",W=x.dir,te=x.date,j={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||(j.crc32=d.crc32,j.compressedSize=d.compressedSize,j.uncompressedSize=d.uncompressedSize);var J=0;p&&(J|=8),B||!R&&!F||(J|=2048);var ie=0,oe=0;W&&(ie|=16),f==="UNIX"?(oe=798,ie|=(function(ge,ue){var _e=ge;return ge||(_e=ue?16893:33204),(65535&_e)<<16})(x.unixPermissions,W)):(oe=20,ie|=(function(ge){return 63&(ge||0)})(x.dosPermissions)),C=te.getUTCHours(),C<<=6,C|=te.getUTCMinutes(),C<<=5,C|=te.getUTCSeconds()/2,y=te.getUTCFullYear()-1980,y<<=4,y|=te.getUTCMonth()+1,y<<=5,y|=te.getUTCDate(),R&&(U=s(1,1)+s(u(S),4)+Q,O+="up"+s(U.length,2)+U),F&&(Y=s(1,1)+s(u(M),4)+k,O+="uc"+s(Y.length,2)+Y);var ne="";return ne+=`
|
|
5672
5672
|
\0`,ne+=s(J,2),ne+=E.magic,ne+=s(C,2),ne+=s(y,2),ne+=s(j.crc32,4),ne+=s(j.compressedSize,4),ne+=s(j.uncompressedSize,4),ne+=s(S.length,2),ne+=s(O.length,2),{fileRecord:g.LOCAL_FILE_HEADER+ne+S+O,dirRecord:g.CENTRAL_FILE_HEADER+s(oe,2)+ne+s(M.length,2)+"\0\0\0\0"+s(ie,4)+s(_,4)+S+O+M}}var A=o("../utils"),c=o("../stream/GenericWorker"),l=o("../utf8"),u=o("../crc32"),g=o("../signature");function h(d,p,m,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=m,this.encodeFileName=_,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}A.inherits(h,c),h.prototype.push=function(d){var p=d.meta.percent||0,m=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,c.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:m?(p+100*(m-_-1))/m:100}}))},h.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var p=this.streamFiles&&!d.file.dir;if(p){var m=a(d,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(d){this.accumulate=!1;var p=this.streamFiles&&!d.file.dir,m=a(d,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),p)this.push({data:(function(_){return g.DATA_DESCRIPTOR+s(_.crc32,4)+s(_.compressedSize,4)+s(_.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var d=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var m=this.bytesWritten-d,_=(function(f,I,C,y,x){var E=A.transformTo("string",x(y));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(f,2)+s(f,2)+s(I,4)+s(C,4)+s(E.length,2)+E})(this.dirRecords.length,m,d,this.zipComment,this.encodeFileName);this.push({data:_,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(d){this._sources.push(d);var p=this;return d.on("data",function(m){p.processChunk(m)}),d.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),d.on("error",function(m){p.error(m)}),this},h.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(d){var p=this._sources;if(!c.prototype.error.call(this,d))return!1;for(var m=0;m<p.length;m++)try{p[m].error(d)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var d=this._sources,p=0;p<d.length;p++)d[p].lock()},i.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(o,i,r){var s=o("../compressions"),a=o("./ZipFileWorker");r.generateWorker=function(A,c,l){var u=new a(c.streamFiles,l,c.platform,c.encodeFileName),g=0;try{A.forEach(function(h,d){g++;var p=(function(I,C){var y=I||C,x=s[y];if(!x)throw new Error(y+" is not a valid compression method !");return x})(d.options.compression,c.compression),m=d.options.compressionOptions||c.compressionOptions||{},_=d.dir,f=d.date;d._compressWorker(p,m).withStreamInfo("file",{name:h,dir:_,date:f,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(u)}),u.entriesCount=g}catch(h){u.error(h)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(o,i,r){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new s;for(var A in this)typeof this[A]!="function"&&(a[A]=this[A]);return a}}(s.prototype=o("./object")).loadAsync=o("./load"),s.support=o("./support"),s.defaults=o("./defaults"),s.version="3.10.2",s.loadAsync=function(a,A){return new s().loadAsync(a,A)},s.external=o("./external"),i.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(o,i,r){var s=o("./utils"),a=o("./external"),A=o("./utf8"),c=o("./zipEntries"),l=o("./stream/Crc32Probe"),u=o("./nodejsUtils");function g(h){return new a.Promise(function(d,p){var m=h.decompressed.getContentWorker().pipe(new l);m.on("error",function(_){p(_)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}i.exports=function(h,d){var p=this;return d=s.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:A.utf8decode}),u.isNode&&u.isStream(h)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",h,!0,d.optimizedBinaryString,d.base64).then(function(m){var _=new c(d);return _.load(m),_}).then(function(m){var _=[a.Promise.resolve(m)],f=m.files;if(d.checkCRC32)for(var I=0;I<f.length;I++)_.push(g(f[I]));return a.Promise.all(_)}).then(function(m){for(var _=m.shift(),f=_.files,I=0;I<f.length;I++){var C=f[I],y=C.fileNameStr,x=s.resolve(C.fileNameStr);p.file(x,C.decompressed,{binary:!0,optimizedBinaryString:!0,date:C.date,dir:C.dir,comment:C.fileCommentStr.length?C.fileCommentStr:null,unixPermissions:C.unixPermissions,dosPermissions:C.dosPermissions,createFolders:d.createFolders}),C.dir||(p.file(x).unsafeOriginalName=y)}return _.zipComment.length&&(p.comment=_.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(o,i,r){var s=o("../utils"),a=o("../stream/GenericWorker");function A(c,l){a.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(l)}s.inherits(A,a),A.prototype._bindStream=function(c){var l=this;(this._stream=c).pause(),c.on("data",function(u){l.push({data:u,meta:{percent:0}})}).on("error",function(u){l.isPaused?this.generatedError=u:l.error(u)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},A.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},A.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=A},{"../stream/GenericWorker":28,"../utils":32}],13:[function(o,i,r){var s=o("readable-stream").Readable;function a(A,c,l){s.call(this,c),this._helper=A;var u=this;A.on("data",function(g,h){u.push(g)||u._helper.pause(),l&&l(h)}).on("error",function(g){u.emit("error",g)}).on("end",function(){u.push(null)})}o("../utils").inherits(a,s),a.prototype._read=function(){this._helper.resume()},i.exports=a},{"../utils":32,"readable-stream":16}],14:[function(o,i,r){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,a);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,a)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var a=new Buffer(s);return a.fill(0),a},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(o,i,r){function s(x,E,B){var S,Q=A.getTypeOf(E),w=A.extend(B||{},u);w.date=w.date||new Date,w.compression!==null&&(w.compression=w.compression.toUpperCase()),typeof w.unixPermissions=="string"&&(w.unixPermissions=parseInt(w.unixPermissions,8)),w.unixPermissions&&16384&w.unixPermissions&&(w.dir=!0),w.dosPermissions&&16&w.dosPermissions&&(w.dir=!0),w.dir&&(x=f(x)),w.createFolders&&(S=_(x))&&I.call(this,S,!0);var M=Q==="string"&&w.binary===!1&&w.base64===!1;B&&B.binary!==void 0||(w.binary=!M),(E instanceof g&&E.uncompressedSize===0||w.dir||!E||E.length===0)&&(w.base64=!1,w.binary=!0,E="",w.compression="STORE",Q="string");var k=null;k=E instanceof g||E instanceof c?E:p.isNode&&p.isStream(E)?new m(x,E):A.prepareContent(x,E,w.binary,w.optimizedBinaryString,w.base64);var R=new h(x,k,w);this.files[x]=R}var a=o("./utf8"),A=o("./utils"),c=o("./stream/GenericWorker"),l=o("./stream/StreamHelper"),u=o("./defaults"),g=o("./compressedObject"),h=o("./zipObject"),d=o("./generate"),p=o("./nodejsUtils"),m=o("./nodejs/NodejsStreamInputAdapter"),_=function(x){x.slice(-1)==="/"&&(x=x.substring(0,x.length-1));var E=x.lastIndexOf("/");return 0<E?x.substring(0,E):""},f=function(x){return x.slice(-1)!=="/"&&(x+="/"),x},I=function(x,E){return E=E!==void 0?E:u.createFolders,x=f(x),this.files[x]||s.call(this,x,null,{dir:!0,createFolders:E}),this.files[x]};function C(x){return Object.prototype.toString.call(x)==="[object RegExp]"}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(x){var E,B,S;for(E in this.files)S=this.files[E],(B=E.slice(this.root.length,E.length))&&E.slice(0,this.root.length)===this.root&&x(B,S)},filter:function(x){var E=[];return this.forEach(function(B,S){x(B,S)&&E.push(S)}),E},file:function(x,E,B){if(arguments.length!==1)return x=this.root+x,s.call(this,x,E,B),this;if(C(x)){var S=x;return this.filter(function(w,M){return!M.dir&&S.test(w)})}var Q=this.files[this.root+x];return Q&&!Q.dir?Q:null},folder:function(x){if(!x)return this;if(C(x))return this.filter(function(Q,w){return w.dir&&x.test(Q)});var E=this.root+x,B=I.call(this,E),S=this.clone();return S.root=B.name,S},remove:function(x){x=this.root+x;var E=this.files[x];if(E||(x.slice(-1)!=="/"&&(x+="/"),E=this.files[x]),E&&!E.dir)delete this.files[x];else for(var B=this.filter(function(Q,w){return w.name.slice(0,x.length)===x}),S=0;S<B.length;S++)delete this.files[B[S].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(x){var E,B={};try{if((B=A.extend(x||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=B.type.toLowerCase(),B.compression=B.compression.toUpperCase(),B.type==="binarystring"&&(B.type="string"),!B.type)throw new Error("No output type specified.");A.checkSupport(B.type),B.platform!=="darwin"&&B.platform!=="freebsd"&&B.platform!=="linux"&&B.platform!=="sunos"||(B.platform="UNIX"),B.platform==="win32"&&(B.platform="DOS");var S=B.comment||this.comment||"";E=d.generateWorker(this,B,S)}catch(Q){(E=new c("error")).error(Q)}return new l(E,B.type||"string",B.mimeType)},generateAsync:function(x,E){return this.generateInternalStream(x).accumulate(E)},generateNodeStream:function(x,E){return(x=x||{}).type||(x.type="nodebuffer"),this.generateInternalStream(x).toNodejsStream(E)}};i.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(o,i,r){i.exports=o("stream")},{stream:void 0}],17:[function(o,i,r){var s=o("./DataReader");function a(A){s.call(this,A);for(var c=0;c<this.data.length;c++)A[c]=255&A[c]}o("../utils").inherits(a,s),a.prototype.byteAt=function(A){return this.data[this.zero+A]},a.prototype.lastIndexOfSignature=function(A){for(var c=A.charCodeAt(0),l=A.charCodeAt(1),u=A.charCodeAt(2),g=A.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===c&&this.data[h+1]===l&&this.data[h+2]===u&&this.data[h+3]===g)return h-this.zero;return-1},a.prototype.readAndCheckSignature=function(A){var c=A.charCodeAt(0),l=A.charCodeAt(1),u=A.charCodeAt(2),g=A.charCodeAt(3),h=this.readData(4);return c===h[0]&&l===h[1]&&u===h[2]&&g===h[3]},a.prototype.readData=function(A){if(this.checkOffset(A),A===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+A);return this.index+=A,c},i.exports=a},{"../utils":32,"./DataReader":18}],18:[function(o,i,r){var s=o("../utils");function a(A){this.data=A,this.length=A.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(A){this.checkIndex(this.index+A)},checkIndex:function(A){if(this.length<this.zero+A||A<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+A+"). Corrupted zip ?")},setIndex:function(A){this.checkIndex(A),this.index=A},skip:function(A){this.setIndex(this.index+A)},byteAt:function(){},readInt:function(A){var c,l=0;for(this.checkOffset(A),c=this.index+A-1;c>=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=A,l},readString:function(A){return s.transformTo("string",this.readData(A))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var A=this.readInt(4);return new Date(Date.UTC(1980+(A>>25&127),(A>>21&15)-1,A>>16&31,A>>11&31,A>>5&63,(31&A)<<1))}},i.exports=a},{"../utils":32}],19:[function(o,i,r){var s=o("./Uint8ArrayReader");function a(A){s.call(this,A)}o("../utils").inherits(a,s),a.prototype.readData=function(A){this.checkOffset(A);var c=this.data.slice(this.zero+this.index,this.zero+this.index+A);return this.index+=A,c},i.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(o,i,r){var s=o("./DataReader");function a(A){s.call(this,A)}o("../utils").inherits(a,s),a.prototype.byteAt=function(A){return this.data.charCodeAt(this.zero+A)},a.prototype.lastIndexOfSignature=function(A){return this.data.lastIndexOf(A)-this.zero},a.prototype.readAndCheckSignature=function(A){return A===this.readData(4)},a.prototype.readData=function(A){this.checkOffset(A);var c=this.data.slice(this.zero+this.index,this.zero+this.index+A);return this.index+=A,c},i.exports=a},{"../utils":32,"./DataReader":18}],21:[function(o,i,r){var s=o("./ArrayReader");function a(A){s.call(this,A)}o("../utils").inherits(a,s),a.prototype.readData=function(A){if(this.checkOffset(A),A===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+A);return this.index+=A,c},i.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(o,i,r){var s=o("../utils"),a=o("../support"),A=o("./ArrayReader"),c=o("./StringReader"),l=o("./NodeBufferReader"),u=o("./Uint8ArrayReader");i.exports=function(g){var h=s.getTypeOf(g);return s.checkSupport(h),h!=="string"||a.uint8array?h==="nodebuffer"?new l(g):a.uint8array?new u(s.transformTo("uint8array",g)):new A(s.transformTo("array",g)):new c(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(o,i,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(o,i,r){var s=o("./GenericWorker"),a=o("../utils");function A(c){s.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(A,s),A.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},i.exports=A},{"../utils":32,"./GenericWorker":28}],25:[function(o,i,r){var s=o("./GenericWorker"),a=o("../crc32");function A(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}o("../utils").inherits(A,s),A.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},i.exports=A},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(o,i,r){var s=o("../utils"),a=o("./GenericWorker");function A(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(A,a),A.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}a.prototype.processChunk.call(this,c)},i.exports=A},{"../utils":32,"./GenericWorker":28}],27:[function(o,i,r){var s=o("../utils"),a=o("./GenericWorker");function A(c){a.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(u){l.dataIsReady=!0,l.data=u,l.max=u&&u.length||0,l.type=s.getTypeOf(u),l.isPaused||l._tickAndRepeat()},function(u){l.error(u)})}s.inherits(A,a),A.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},A.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},A.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},A.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=A},{"../utils":32,"./GenericWorker":28}],28:[function(o,i,r){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,A){return this._listeners[a].push(A),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,A){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,A)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var A=this;return a.on("data",function(c){A.processChunk(c)}),a.on("end",function(){A.end()}),a.on("error",function(c){A.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,A){return this.extraStreamInfo[a]=A,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},i.exports=s},{}],29:[function(o,i,r){var s=o("../utils"),a=o("./ConvertWorker"),A=o("./GenericWorker"),c=o("../base64"),l=o("../support"),u=o("../external"),g=null;if(l.nodestream)try{g=o("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(p,m){return new u.Promise(function(_,f){var I=[],C=p._internalType,y=p._outputType,x=p._mimeType;p.on("data",function(E,B){I.push(E),m&&m(B)}).on("error",function(E){I=[],f(E)}).on("end",function(){try{var E=(function(B,S,Q){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",S),Q);case"base64":return c.encode(S);default:return s.transformTo(B,S)}})(y,(function(B,S){var Q,w=0,M=null,k=0;for(Q=0;Q<S.length;Q++)k+=S[Q].length;switch(B){case"string":return S.join("");case"array":return Array.prototype.concat.apply([],S);case"uint8array":for(M=new Uint8Array(k),Q=0;Q<S.length;Q++)M.set(S[Q],w),w+=S[Q].length;return M;case"nodebuffer":return Buffer.concat(S);default:throw new Error("concat : unsupported type '"+B+"'")}})(C,I),x);_(E)}catch(B){f(B)}I=[]}).resume()})}function d(p,m,_){var f=m;switch(m){case"blob":case"arraybuffer":f="uint8array";break;case"base64":f="string"}try{this._internalType=f,this._outputType=m,this._mimeType=_,s.checkSupport(f),this._worker=p.pipe(new a(f)),p.lock()}catch(I){this._worker=new A("error"),this._worker.error(I)}}d.prototype={accumulate:function(p){return h(this,p)},on:function(p,m){var _=this;return p==="data"?this._worker.on(p,function(f){m.call(_,f.data,f.meta)}):this._worker.on(p,function(){s.delay(m,arguments,_)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},p)}},i.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(o,i,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var s=new ArrayBuffer(0);try{r.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),r.blob=a.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!o("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(o,i,r){for(var s=o("./utils"),a=o("./support"),A=o("./nodejsUtils"),c=o("./stream/GenericWorker"),l=new Array(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;l[254]=l[254]=1;function g(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}r.utf8encode=function(d){return a.nodebuffer?A.newBufferFrom(d,"utf-8"):(function(p){var m,_,f,I,C,y=p.length,x=0;for(I=0;I<y;I++)(64512&(_=p.charCodeAt(I)))==55296&&I+1<y&&(64512&(f=p.charCodeAt(I+1)))==56320&&(_=65536+(_-55296<<10)+(f-56320),I++),x+=_<128?1:_<2048?2:_<65536?3:4;for(m=a.uint8array?new Uint8Array(x):new Array(x),I=C=0;C<x;I++)(64512&(_=p.charCodeAt(I)))==55296&&I+1<y&&(64512&(f=p.charCodeAt(I+1)))==56320&&(_=65536+(_-55296<<10)+(f-56320),I++),_<128?m[C++]=_:(_<2048?m[C++]=192|_>>>6:(_<65536?m[C++]=224|_>>>12:(m[C++]=240|_>>>18,m[C++]=128|_>>>12&63),m[C++]=128|_>>>6&63),m[C++]=128|63&_);return m})(d)},r.utf8decode=function(d){return a.nodebuffer?s.transformTo("nodebuffer",d).toString("utf-8"):(function(p){var m,_,f,I,C=p.length,y=new Array(2*C);for(m=_=0;m<C;)if((f=p[m++])<128)y[_++]=f;else if(4<(I=l[f]))y[_++]=65533,m+=I-1;else{for(f&=I===2?31:I===3?15:7;1<I&&m<C;)f=f<<6|63&p[m++],I--;1<I?y[_++]=65533:f<65536?y[_++]=f:(f-=65536,y[_++]=55296|f>>10&1023,y[_++]=56320|1023&f)}return y.length!==_&&(y.subarray?y=y.subarray(0,_):y.length=_),s.applyFromCharCode(y)})(d=s.transformTo(a.uint8array?"uint8array":"array",d))},s.inherits(g,c),g.prototype.processChunk=function(d){var p=s.transformTo(a.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var m=p;(p=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var _=(function(I,C){var y;for((C=C||I.length)>I.length&&(C=I.length),y=C-1;0<=y&&(192&I[y])==128;)y--;return y<0||y===0?C:y+l[I[y]]>C?y:C})(p),f=p;_!==p.length&&(a.uint8array?(f=p.subarray(0,_),this.leftOver=p.subarray(_,p.length)):(f=p.slice(0,_),this.leftOver=p.slice(_,p.length))),this.push({data:r.utf8decode(f),meta:d.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=g,s.inherits(h,c),h.prototype.processChunk=function(d){this.push({data:r.utf8encode(d.data),meta:d.meta})},r.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(o,i,r){var s=o("./support"),a=o("./base64"),A=o("./nodejsUtils"),c=o("./external");function l(m){return m}function u(m,_){for(var f=0;f<m.length;++f)_[f]=255&m.charCodeAt(f);return _}o("setimmediate"),r.newBlob=function(m,_){r.checkSupport("blob");try{return new Blob([m],{type:_})}catch{try{var f=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return f.append(m),f.getBlob(_)}catch{throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(m,_,f){var I=[],C=0,y=m.length;if(y<=f)return String.fromCharCode.apply(null,m);for(;C<y;)_==="array"||_==="nodebuffer"?I.push(String.fromCharCode.apply(null,m.slice(C,Math.min(C+f,y)))):I.push(String.fromCharCode.apply(null,m.subarray(C,Math.min(C+f,y)))),C+=f;return I.join("")},stringifyByChar:function(m){for(var _="",f=0;f<m.length;f++)_+=String.fromCharCode(m[f]);return _},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,A.allocBuffer(1)).length===1}catch{return!1}})()}};function h(m){var _=65536,f=r.getTypeOf(m),I=!0;if(f==="uint8array"?I=g.applyCanBeUsed.uint8array:f==="nodebuffer"&&(I=g.applyCanBeUsed.nodebuffer),I)for(;1<_;)try{return g.stringifyByChunk(m,f,_)}catch{_=Math.floor(_/2)}return g.stringifyByChar(m)}function d(m,_){for(var f=0;f<m.length;f++)_[f]=m[f];return _}r.applyFromCharCode=h;var p={};p.string={string:l,array:function(m){return u(m,new Array(m.length))},arraybuffer:function(m){return p.string.uint8array(m).buffer},uint8array:function(m){return u(m,new Uint8Array(m.length))},nodebuffer:function(m){return u(m,A.allocBuffer(m.length))}},p.array={string:h,array:l,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return A.newBufferFrom(m)}},p.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return d(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:l,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return A.newBufferFrom(new Uint8Array(m))}},p.uint8array={string:h,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:l,nodebuffer:function(m){return A.newBufferFrom(m)}},p.nodebuffer={string:h,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return p.nodebuffer.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:l},r.transformTo=function(m,_){if(_=_||"",!m)return _;r.checkSupport(m);var f=r.getTypeOf(_);return p[f][m](_)},r.resolve=function(m){for(var _=m.split("/"),f=[],I=0;I<_.length;I++){var C=_[I];C==="."||C===""&&I!==0&&I!==_.length-1||(C===".."?f.pop():f.push(C))}return f.join("/")},r.getTypeOf=function(m){if(typeof m=="string")return"string";var _=Object.prototype.toString.call(m);return _==="[object Array]"?"array":s.nodebuffer&&A.isBuffer(m)?"nodebuffer":s.uint8array&&_==="[object Uint8Array]"?"uint8array":s.arraybuffer&&_==="[object ArrayBuffer]"?"arraybuffer":void 0},r.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(m){var _,f,I="";for(f=0;f<(m||"").length;f++)I+="\\x"+((_=m.charCodeAt(f))<16?"0":"")+_.toString(16).toUpperCase();return I},r.delay=function(m,_,f){setImmediate(function(){m.apply(f||null,_||[])})},r.inherits=function(m,_){function f(){}f.prototype=_.prototype,m.prototype=new f},r.extend=function(){var m,_,f={};for(m=0;m<arguments.length;m++)for(_ in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],_)&&f[_]===void 0&&(f[_]=arguments[m][_]);return f},r.prepareContent=function(m,_,f,I,C){return c.Promise.resolve(_).then(function(y){return s.blob&&(y instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(y))!==-1)?Blob.prototype.arrayBuffer!==void 0?y.arrayBuffer():typeof FileReader<"u"?new c.Promise(function(x,E){var B=new FileReader;B.onload=function(S){x(S.target.result)},B.onerror=function(S){E(S.target.error)},B.readAsArrayBuffer(y)}):c.Promise.reject(new Error(m+" is a Blob, but we have no way of reading it.")):y}).then(function(y){var x=r.getTypeOf(y);return x?(x==="arraybuffer"?y=r.transformTo("uint8array",y):x==="string"&&(C?y=a.decode(y):f&&I!==!0&&(y=(function(E){return u(E,s.uint8array?new Uint8Array(E.length):new Array(E.length))})(y))),y):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(o,i,r){var s=o("./reader/readerFor"),a=o("./utils"),A=o("./signature"),c=o("./zipEntry"),l=o("./support");function u(g){this.files=[],this.loadOptions=g}u.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(h)+", expected "+a.pretty(g)+")")}},isSignature:function(g,h){var d=this.reader.index;this.reader.setIndex(g);var p=this.reader.readString(4)===h;return this.reader.setIndex(d),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var g=this.reader.readData(this.zipCommentLength),h=l.uint8array?"uint8array":"array",d=a.transformTo(h,g);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var g,h,d,p=this.zip64EndOfCentralSize-44;0<p;)g=this.reader.readInt(2),h=this.reader.readInt(4),d=this.reader.readData(h),this.zip64ExtensibleData[g]={id:g,length:h,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var g,h;for(g=0;g<this.files.length;g++)h=this.files[g],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(A.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(A.CENTRAL_FILE_HEADER);)(g=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(g);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var g=this.reader.lastIndexOfSignature(A.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,A.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(g);var h=g;if(this.checkSignature(A.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(A.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(g),this.checkSignature(A.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,A.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(A.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(A.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var p=h-d;if(0<p)this.isSignature(h,A.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(g){this.reader=s(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(o,i,r){var s=o("./reader/readerFor"),a=o("./utils"),A=o("./compressedObject"),c=o("./crc32"),l=o("./utf8"),u=o("./compressions"),g=o("./support");function h(d,p){this.options=d,this.loadOptions=p}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var p,m;if(d.skip(22),this.fileNameLength=d.readInt(2),m=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=(function(_){for(var f in u)if(Object.prototype.hasOwnProperty.call(u,f)&&u[f].magic===_)return u[f];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new A(this.compressedSize,this.uncompressedSize,this.crc32,p,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var p=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(p),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var p,m,_,f=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<f;)p=d.readInt(2),m=d.readInt(2),_=d.readData(m),this.extraFields[p]={id:p,length:m,value:_};d.setIndex(f)},handleUTF8:function(){var d=g.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var m=a.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var _=this.findExtraFieldUnicodeComment();if(_!==null)this.fileCommentStr=_;else{var f=a.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(f)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var p=s(d.value);return p.readInt(1)!==1||c(this.fileName)!==p.readInt(4)?null:l.utf8decode(p.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var p=s(d.value);return p.readInt(1)!==1||c(this.fileComment)!==p.readInt(4)?null:l.utf8decode(p.readData(d.length-5))}return null}},i.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(o,i,r){function s(p,m,_){this.name=p,this.dir=_.dir,this.date=_.date,this.comment=_.comment,this.unixPermissions=_.unixPermissions,this.dosPermissions=_.dosPermissions,this._data=m,this._dataBinary=_.binary,this.options={compression:_.compression,compressionOptions:_.compressionOptions}}var a=o("./stream/StreamHelper"),A=o("./stream/DataWorker"),c=o("./utf8"),l=o("./compressedObject"),u=o("./stream/GenericWorker");s.prototype={internalStream:function(p){var m=null,_="string";try{if(!p)throw new Error("No output type specified.");var f=(_=p.toLowerCase())==="string"||_==="text";_!=="binarystring"&&_!=="text"||(_="string"),m=this._decompressWorker();var I=!this._dataBinary;I&&!f&&(m=m.pipe(new c.Utf8EncodeWorker)),!I&&f&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(C){(m=new u("error")).error(C)}return new a(m,_,"")},async:function(p,m){return this.internalStream(p).accumulate(m)},nodeStream:function(p,m){return this.internalStream(p||"nodebuffer").toNodejsStream(m)},_compressWorker:function(p,m){if(this._data instanceof l&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var _=this._decompressWorker();return this._dataBinary||(_=_.pipe(new c.Utf8EncodeWorker)),l.createWorkerFrom(_,p,m)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof u?this._data:new A(this._data)}};for(var g=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<g.length;d++)s.prototype[g[d]]=h;i.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(o,i,r){(function(s){var a,A,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var l=0,u=new c(p),g=s.document.createTextNode("");u.observe(g,{characterData:!0}),a=function(){g.data=l=++l%2}}else if(s.setImmediate||s.MessageChannel===void 0)a="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){p(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(p,0)};else{var h=new s.MessageChannel;h.port1.onmessage=p,a=function(){h.port2.postMessage(0)}}var d=[];function p(){var m,_;A=!0;for(var f=d.length;f;){for(_=d,d=[],m=-1;++m<f;)_[m]();f=d.length}A=!1}i.exports=function(m){d.push(m)!==1||A||a()}}).call(this,typeof py<"u"?py:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(o,i,r){var s=o("immediate");function a(){}var A={},c=["REJECTED"],l=["FULFILLED"],u=["PENDING"];function g(f){if(typeof f!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,f!==a&&m(this,f)}function h(f,I,C){this.promise=f,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}function d(f,I,C){s(function(){var y;try{y=I(C)}catch(x){return A.reject(f,x)}y===f?A.reject(f,new TypeError("Cannot resolve promise with itself")):A.resolve(f,y)})}function p(f){var I=f&&f.then;if(f&&(typeof f=="object"||typeof f=="function")&&typeof I=="function")return function(){I.apply(f,arguments)}}function m(f,I){var C=!1;function y(B){C||(C=!0,A.reject(f,B))}function x(B){C||(C=!0,A.resolve(f,B))}var E=_(function(){I(x,y)});E.status==="error"&&y(E.value)}function _(f,I){var C={};try{C.value=f(I),C.status="success"}catch(y){C.status="error",C.value=y}return C}(i.exports=g).prototype.finally=function(f){if(typeof f!="function")return this;var I=this.constructor;return this.then(function(C){return I.resolve(f()).then(function(){return C})},function(C){return I.resolve(f()).then(function(){throw C})})},g.prototype.catch=function(f){return this.then(null,f)},g.prototype.then=function(f,I){if(typeof f!="function"&&this.state===l||typeof I!="function"&&this.state===c)return this;var C=new this.constructor(a);return this.state!==u?d(C,this.state===l?f:I,this.outcome):this.queue.push(new h(C,f,I)),C},h.prototype.callFulfilled=function(f){A.resolve(this.promise,f)},h.prototype.otherCallFulfilled=function(f){d(this.promise,this.onFulfilled,f)},h.prototype.callRejected=function(f){A.reject(this.promise,f)},h.prototype.otherCallRejected=function(f){d(this.promise,this.onRejected,f)},A.resolve=function(f,I){var C=_(p,I);if(C.status==="error")return A.reject(f,C.value);var y=C.value;if(y)m(f,y);else{f.state=l,f.outcome=I;for(var x=-1,E=f.queue.length;++x<E;)f.queue[x].callFulfilled(I)}return f},A.reject=function(f,I){f.state=c,f.outcome=I;for(var C=-1,y=f.queue.length;++C<y;)f.queue[C].callRejected(I);return f},g.resolve=function(f){return f instanceof this?f:A.resolve(new this(a),f)},g.reject=function(f){var I=new this(a);return A.reject(I,f)},g.all=function(f){var I=this;if(Object.prototype.toString.call(f)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=f.length,y=!1;if(!C)return this.resolve([]);for(var x=new Array(C),E=0,B=-1,S=new this(a);++B<C;)Q(f[B],B);return S;function Q(w,M){I.resolve(w).then(function(k){x[M]=k,++E!==C||y||(y=!0,A.resolve(S,x))},function(k){y||(y=!0,A.reject(S,k))})}},g.race=function(f){var I=this;if(Object.prototype.toString.call(f)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=f.length,y=!1;if(!C)return this.resolve([]);for(var x=-1,E=new this(a);++x<C;)B=f[x],I.resolve(B).then(function(S){y||(y=!0,A.resolve(E,S))},function(S){y||(y=!0,A.reject(E,S))});var B;return E}},{immediate:36}],38:[function(o,i,r){var s={};(0,o("./lib/utils/common").assign)(s,o("./lib/deflate"),o("./lib/inflate"),o("./lib/zlib/constants")),i.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(o,i,r){var s=o("./zlib/deflate"),a=o("./utils/common"),A=o("./utils/strings"),c=o("./zlib/messages"),l=o("./zlib/zstream"),u=Object.prototype.toString,g=0,h=-1,d=0,p=8;function m(f){if(!(this instanceof m))return new m(f);this.options=a.assign({level:h,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},f||{});var I=this.options;I.raw&&0<I.windowBits?I.windowBits=-I.windowBits:I.gzip&&0<I.windowBits&&I.windowBits<16&&(I.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var C=s.deflateInit2(this.strm,I.level,I.method,I.windowBits,I.memLevel,I.strategy);if(C!==g)throw new Error(c[C]);if(I.header&&s.deflateSetHeader(this.strm,I.header),I.dictionary){var y;if(y=typeof I.dictionary=="string"?A.string2buf(I.dictionary):u.call(I.dictionary)==="[object ArrayBuffer]"?new Uint8Array(I.dictionary):I.dictionary,(C=s.deflateSetDictionary(this.strm,y))!==g)throw new Error(c[C]);this._dict_set=!0}}function _(f,I){var C=new m(I);if(C.push(f,!0),C.err)throw C.msg||c[C.err];return C.result}m.prototype.push=function(f,I){var C,y,x=this.strm,E=this.options.chunkSize;if(this.ended)return!1;y=I===~~I?I:I===!0?4:0,typeof f=="string"?x.input=A.string2buf(f):u.call(f)==="[object ArrayBuffer]"?x.input=new Uint8Array(f):x.input=f,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new a.Buf8(E),x.next_out=0,x.avail_out=E),(C=s.deflate(x,y))!==1&&C!==g)return this.onEnd(C),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||y!==4&&y!==2)||(this.options.to==="string"?this.onData(A.buf2binstring(a.shrinkBuf(x.output,x.next_out))):this.onData(a.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&C!==1);return y===4?(C=s.deflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===g):y!==2||(this.onEnd(g),!(x.avail_out=0))},m.prototype.onData=function(f){this.chunks.push(f)},m.prototype.onEnd=function(f){f===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},r.Deflate=m,r.deflate=_,r.deflateRaw=function(f,I){return(I=I||{}).raw=!0,_(f,I)},r.gzip=function(f,I){return(I=I||{}).gzip=!0,_(f,I)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(o,i,r){var s=o("./zlib/inflate"),a=o("./utils/common"),A=o("./utils/strings"),c=o("./zlib/constants"),l=o("./zlib/messages"),u=o("./zlib/zstream"),g=o("./zlib/gzheader"),h=Object.prototype.toString;function d(m){if(!(this instanceof d))return new d(m);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},m||{});var _=this.options;_.raw&&0<=_.windowBits&&_.windowBits<16&&(_.windowBits=-_.windowBits,_.windowBits===0&&(_.windowBits=-15)),!(0<=_.windowBits&&_.windowBits<16)||m&&m.windowBits||(_.windowBits+=32),15<_.windowBits&&_.windowBits<48&&(15&_.windowBits)==0&&(_.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var f=s.inflateInit2(this.strm,_.windowBits);if(f!==c.Z_OK)throw new Error(l[f]);this.header=new g,s.inflateGetHeader(this.strm,this.header)}function p(m,_){var f=new d(_);if(f.push(m,!0),f.err)throw f.msg||l[f.err];return f.result}d.prototype.push=function(m,_){var f,I,C,y,x,E,B=this.strm,S=this.options.chunkSize,Q=this.options.dictionary,w=!1;if(this.ended)return!1;I=_===~~_?_:_===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?B.input=A.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?B.input=new Uint8Array(m):B.input=m,B.next_in=0,B.avail_in=B.input.length;do{if(B.avail_out===0&&(B.output=new a.Buf8(S),B.next_out=0,B.avail_out=S),(f=s.inflate(B,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&Q&&(E=typeof Q=="string"?A.string2buf(Q):h.call(Q)==="[object ArrayBuffer]"?new Uint8Array(Q):Q,f=s.inflateSetDictionary(this.strm,E)),f===c.Z_BUF_ERROR&&w===!0&&(f=c.Z_OK,w=!1),f!==c.Z_STREAM_END&&f!==c.Z_OK)return this.onEnd(f),!(this.ended=!0);B.next_out&&(B.avail_out!==0&&f!==c.Z_STREAM_END&&(B.avail_in!==0||I!==c.Z_FINISH&&I!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(C=A.utf8border(B.output,B.next_out),y=B.next_out-C,x=A.buf2string(B.output,C),B.next_out=y,B.avail_out=S-y,y&&a.arraySet(B.output,B.output,C,y,0),this.onData(x)):this.onData(a.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(w=!0)}while((0<B.avail_in||B.avail_out===0)&&f!==c.Z_STREAM_END);return f===c.Z_STREAM_END&&(I=c.Z_FINISH),I===c.Z_FINISH?(f=s.inflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===c.Z_OK):I!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(B.avail_out=0))},d.prototype.onData=function(m){this.chunks.push(m)},d.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},r.Inflate=d,r.inflate=p,r.inflateRaw=function(m,_){return(_=_||{}).raw=!0,p(m,_)},r.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(o,i,r){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";r.assign=function(c){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var u=l.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var g in u)u.hasOwnProperty(g)&&(c[g]=u[g])}}return c},r.shrinkBuf=function(c,l){return c.length===l?c:c.subarray?c.subarray(0,l):(c.length=l,c)};var a={arraySet:function(c,l,u,g,h){if(l.subarray&&c.subarray)c.set(l.subarray(u,u+g),h);else for(var d=0;d<g;d++)c[h+d]=l[u+d]},flattenChunks:function(c){var l,u,g,h,d,p;for(l=g=0,u=c.length;l<u;l++)g+=c[l].length;for(p=new Uint8Array(g),l=h=0,u=c.length;l<u;l++)d=c[l],p.set(d,h),h+=d.length;return p}},A={arraySet:function(c,l,u,g,h){for(var d=0;d<g;d++)c[h+d]=l[u+d]},flattenChunks:function(c){return[].concat.apply([],c)}};r.setTyped=function(c){c?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,a)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,A))},r.setTyped(s)},{}],42:[function(o,i,r){var s=o("./common"),a=!0,A=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{A=!1}for(var c=new s.Buf8(256),l=0;l<256;l++)c[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(g,h){if(h<65537&&(g.subarray&&A||!g.subarray&&a))return String.fromCharCode.apply(null,s.shrinkBuf(g,h));for(var d="",p=0;p<h;p++)d+=String.fromCharCode(g[p]);return d}c[254]=c[254]=1,r.string2buf=function(g){var h,d,p,m,_,f=g.length,I=0;for(m=0;m<f;m++)(64512&(d=g.charCodeAt(m)))==55296&&m+1<f&&(64512&(p=g.charCodeAt(m+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),m++),I+=d<128?1:d<2048?2:d<65536?3:4;for(h=new s.Buf8(I),m=_=0;_<I;m++)(64512&(d=g.charCodeAt(m)))==55296&&m+1<f&&(64512&(p=g.charCodeAt(m+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),m++),d<128?h[_++]=d:(d<2048?h[_++]=192|d>>>6:(d<65536?h[_++]=224|d>>>12:(h[_++]=240|d>>>18,h[_++]=128|d>>>12&63),h[_++]=128|d>>>6&63),h[_++]=128|63&d);return h},r.buf2binstring=function(g){return u(g,g.length)},r.binstring2buf=function(g){for(var h=new s.Buf8(g.length),d=0,p=h.length;d<p;d++)h[d]=g.charCodeAt(d);return h},r.buf2string=function(g,h){var d,p,m,_,f=h||g.length,I=new Array(2*f);for(d=p=0;d<f;)if((m=g[d++])<128)I[p++]=m;else if(4<(_=c[m]))I[p++]=65533,d+=_-1;else{for(m&=_===2?31:_===3?15:7;1<_&&d<f;)m=m<<6|63&g[d++],_--;1<_?I[p++]=65533:m<65536?I[p++]=m:(m-=65536,I[p++]=55296|m>>10&1023,I[p++]=56320|1023&m)}return u(I,p)},r.utf8border=function(g,h){var d;for((h=h||g.length)>g.length&&(h=g.length),d=h-1;0<=d&&(192&g[d])==128;)d--;return d<0||d===0?h:d+c[g[d]]>h?d:h}},{"./common":41}],43:[function(o,i,r){i.exports=function(s,a,A,c){for(var l=65535&s|0,u=s>>>16&65535|0,g=0;A!==0;){for(A-=g=2e3<A?2e3:A;u=u+(l=l+a[c++]|0)|0,--g;);l%=65521,u%=65521}return l|u<<16|0}},{}],44:[function(o,i,r){i.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(o,i,r){var s=(function(){for(var a,A=[],c=0;c<256;c++){a=c;for(var l=0;l<8;l++)a=1&a?3988292384^a>>>1:a>>>1;A[c]=a}return A})();i.exports=function(a,A,c,l){var u=s,g=l+c;a^=-1;for(var h=l;h<g;h++)a=a>>>8^u[255&(a^A[h])];return-1^a}},{}],46:[function(o,i,r){var s,a=o("../utils/common"),A=o("./trees"),c=o("./adler32"),l=o("./crc32"),u=o("./messages"),g=0,h=4,d=0,p=-2,m=-1,_=4,f=2,I=8,C=9,y=286,x=30,E=19,B=2*y+1,S=15,Q=3,w=258,M=w+Q+1,k=42,R=113,F=1,O=2,U=3,Y=4;function W(pe,ve){return pe.msg=u[ve],ve}function te(pe){return(pe<<1)-(4<pe?9:0)}function j(pe){for(var ve=pe.length;0<=--ve;)pe[ve]=0}function J(pe){var ve=pe.state,Me=ve.pending;Me>pe.avail_out&&(Me=pe.avail_out),Me!==0&&(a.arraySet(pe.output,ve.pending_buf,ve.pending_out,Me,pe.next_out),pe.next_out+=Me,ve.pending_out+=Me,pe.total_out+=Me,pe.avail_out-=Me,ve.pending-=Me,ve.pending===0&&(ve.pending_out=0))}function ie(pe,ve){A._tr_flush_block(pe,0<=pe.block_start?pe.block_start:-1,pe.strstart-pe.block_start,ve),pe.block_start=pe.strstart,J(pe.strm)}function oe(pe,ve){pe.pending_buf[pe.pending++]=ve}function ne(pe,ve){pe.pending_buf[pe.pending++]=ve>>>8&255,pe.pending_buf[pe.pending++]=255&ve}function ge(pe,ve){var Me,Pe,He=pe.max_chain_length,Re=pe.strstart,Ee=pe.prev_length,Te=pe.nice_match,Ce=pe.strstart>pe.w_size-M?pe.strstart-(pe.w_size-M):0,Fe=pe.window,Ye=pe.w_mask,tt=pe.prev,At=pe.strstart+w,at=Fe[Re+Ee-1],ot=Fe[Re+Ee];pe.prev_length>=pe.good_match&&(He>>=2),Te>pe.lookahead&&(Te=pe.lookahead);do if(Fe[(Me=ve)+Ee]===ot&&Fe[Me+Ee-1]===at&&Fe[Me]===Fe[Re]&&Fe[++Me]===Fe[Re+1]){Re+=2,Me++;do;while(Fe[++Re]===Fe[++Me]&&Fe[++Re]===Fe[++Me]&&Fe[++Re]===Fe[++Me]&&Fe[++Re]===Fe[++Me]&&Fe[++Re]===Fe[++Me]&&Fe[++Re]===Fe[++Me]&&Fe[++Re]===Fe[++Me]&&Fe[++Re]===Fe[++Me]&&Re<At);if(Pe=w-(At-Re),Re=At-w,Ee<Pe){if(pe.match_start=ve,Te<=(Ee=Pe))break;at=Fe[Re+Ee-1],ot=Fe[Re+Ee]}}while((ve=tt[ve&Ye])>Ce&&--He!=0);return Ee<=pe.lookahead?Ee:pe.lookahead}function ue(pe){var ve,Me,Pe,He,Re,Ee,Te,Ce,Fe,Ye,tt=pe.w_size;do{if(He=pe.window_size-pe.lookahead-pe.strstart,pe.strstart>=tt+(tt-M)){for(a.arraySet(pe.window,pe.window,tt,tt,0),pe.match_start-=tt,pe.strstart-=tt,pe.block_start-=tt,ve=Me=pe.hash_size;Pe=pe.head[--ve],pe.head[ve]=tt<=Pe?Pe-tt:0,--Me;);for(ve=Me=tt;Pe=pe.prev[--ve],pe.prev[ve]=tt<=Pe?Pe-tt:0,--Me;);He+=tt}if(pe.strm.avail_in===0)break;if(Ee=pe.strm,Te=pe.window,Ce=pe.strstart+pe.lookahead,Fe=He,Ye=void 0,Ye=Ee.avail_in,Fe<Ye&&(Ye=Fe),Me=Ye===0?0:(Ee.avail_in-=Ye,a.arraySet(Te,Ee.input,Ee.next_in,Ye,Ce),Ee.state.wrap===1?Ee.adler=c(Ee.adler,Te,Ye,Ce):Ee.state.wrap===2&&(Ee.adler=l(Ee.adler,Te,Ye,Ce)),Ee.next_in+=Ye,Ee.total_in+=Ye,Ye),pe.lookahead+=Me,pe.lookahead+pe.insert>=Q)for(Re=pe.strstart-pe.insert,pe.ins_h=pe.window[Re],pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[Re+1])&pe.hash_mask;pe.insert&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[Re+Q-1])&pe.hash_mask,pe.prev[Re&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=Re,Re++,pe.insert--,!(pe.lookahead+pe.insert<Q)););}while(pe.lookahead<M&&pe.strm.avail_in!==0)}function _e(pe,ve){for(var Me,Pe;;){if(pe.lookahead<M){if(ue(pe),pe.lookahead<M&&ve===g)return F;if(pe.lookahead===0)break}if(Me=0,pe.lookahead>=Q&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+Q-1])&pe.hash_mask,Me=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart),Me!==0&&pe.strstart-Me<=pe.w_size-M&&(pe.match_length=ge(pe,Me)),pe.match_length>=Q)if(Pe=A._tr_tally(pe,pe.strstart-pe.match_start,pe.match_length-Q),pe.lookahead-=pe.match_length,pe.match_length<=pe.max_lazy_match&&pe.lookahead>=Q){for(pe.match_length--;pe.strstart++,pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+Q-1])&pe.hash_mask,Me=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart,--pe.match_length!=0;);pe.strstart++}else pe.strstart+=pe.match_length,pe.match_length=0,pe.ins_h=pe.window[pe.strstart],pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+1])&pe.hash_mask;else Pe=A._tr_tally(pe,0,pe.window[pe.strstart]),pe.lookahead--,pe.strstart++;if(Pe&&(ie(pe,!1),pe.strm.avail_out===0))return F}return pe.insert=pe.strstart<Q-1?pe.strstart:Q-1,ve===h?(ie(pe,!0),pe.strm.avail_out===0?U:Y):pe.last_lit&&(ie(pe,!1),pe.strm.avail_out===0)?F:O}function le(pe,ve){for(var Me,Pe,He;;){if(pe.lookahead<M){if(ue(pe),pe.lookahead<M&&ve===g)return F;if(pe.lookahead===0)break}if(Me=0,pe.lookahead>=Q&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+Q-1])&pe.hash_mask,Me=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart),pe.prev_length=pe.match_length,pe.prev_match=pe.match_start,pe.match_length=Q-1,Me!==0&&pe.prev_length<pe.max_lazy_match&&pe.strstart-Me<=pe.w_size-M&&(pe.match_length=ge(pe,Me),pe.match_length<=5&&(pe.strategy===1||pe.match_length===Q&&4096<pe.strstart-pe.match_start)&&(pe.match_length=Q-1)),pe.prev_length>=Q&&pe.match_length<=pe.prev_length){for(He=pe.strstart+pe.lookahead-Q,Pe=A._tr_tally(pe,pe.strstart-1-pe.prev_match,pe.prev_length-Q),pe.lookahead-=pe.prev_length-1,pe.prev_length-=2;++pe.strstart<=He&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+Q-1])&pe.hash_mask,Me=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart),--pe.prev_length!=0;);if(pe.match_available=0,pe.match_length=Q-1,pe.strstart++,Pe&&(ie(pe,!1),pe.strm.avail_out===0))return F}else if(pe.match_available){if((Pe=A._tr_tally(pe,0,pe.window[pe.strstart-1]))&&ie(pe,!1),pe.strstart++,pe.lookahead--,pe.strm.avail_out===0)return F}else pe.match_available=1,pe.strstart++,pe.lookahead--}return pe.match_available&&(Pe=A._tr_tally(pe,0,pe.window[pe.strstart-1]),pe.match_available=0),pe.insert=pe.strstart<Q-1?pe.strstart:Q-1,ve===h?(ie(pe,!0),pe.strm.avail_out===0?U:Y):pe.last_lit&&(ie(pe,!1),pe.strm.avail_out===0)?F:O}function fe(pe,ve,Me,Pe,He){this.good_length=pe,this.max_lazy=ve,this.nice_length=Me,this.max_chain=Pe,this.func=He}function he(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=I,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*B),this.dyn_dtree=new a.Buf16(2*(2*x+1)),this.bl_tree=new a.Buf16(2*(2*E+1)),j(this.dyn_ltree),j(this.dyn_dtree),j(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(S+1),this.heap=new a.Buf16(2*y+1),j(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*y+1),j(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ye(pe){var ve;return pe&&pe.state?(pe.total_in=pe.total_out=0,pe.data_type=f,(ve=pe.state).pending=0,ve.pending_out=0,ve.wrap<0&&(ve.wrap=-ve.wrap),ve.status=ve.wrap?k:R,pe.adler=ve.wrap===2?0:1,ve.last_flush=g,A._tr_init(ve),d):W(pe,p)}function Qe(pe){var ve=ye(pe);return ve===d&&(function(Me){Me.window_size=2*Me.w_size,j(Me.head),Me.max_lazy_match=s[Me.level].max_lazy,Me.good_match=s[Me.level].good_length,Me.nice_match=s[Me.level].nice_length,Me.max_chain_length=s[Me.level].max_chain,Me.strstart=0,Me.block_start=0,Me.lookahead=0,Me.insert=0,Me.match_length=Me.prev_length=Q-1,Me.match_available=0,Me.ins_h=0})(pe.state),ve}function we(pe,ve,Me,Pe,He,Re){if(!pe)return p;var Ee=1;if(ve===m&&(ve=6),Pe<0?(Ee=0,Pe=-Pe):15<Pe&&(Ee=2,Pe-=16),He<1||C<He||Me!==I||Pe<8||15<Pe||ve<0||9<ve||Re<0||_<Re)return W(pe,p);Pe===8&&(Pe=9);var Te=new he;return(pe.state=Te).strm=pe,Te.wrap=Ee,Te.gzhead=null,Te.w_bits=Pe,Te.w_size=1<<Te.w_bits,Te.w_mask=Te.w_size-1,Te.hash_bits=He+7,Te.hash_size=1<<Te.hash_bits,Te.hash_mask=Te.hash_size-1,Te.hash_shift=~~((Te.hash_bits+Q-1)/Q),Te.window=new a.Buf8(2*Te.w_size),Te.head=new a.Buf16(Te.hash_size),Te.prev=new a.Buf16(Te.w_size),Te.lit_bufsize=1<<He+6,Te.pending_buf_size=4*Te.lit_bufsize,Te.pending_buf=new a.Buf8(Te.pending_buf_size),Te.d_buf=1*Te.lit_bufsize,Te.l_buf=3*Te.lit_bufsize,Te.level=ve,Te.strategy=Re,Te.method=Me,Qe(pe)}s=[new fe(0,0,0,0,function(pe,ve){var Me=65535;for(Me>pe.pending_buf_size-5&&(Me=pe.pending_buf_size-5);;){if(pe.lookahead<=1){if(ue(pe),pe.lookahead===0&&ve===g)return F;if(pe.lookahead===0)break}pe.strstart+=pe.lookahead,pe.lookahead=0;var Pe=pe.block_start+Me;if((pe.strstart===0||pe.strstart>=Pe)&&(pe.lookahead=pe.strstart-Pe,pe.strstart=Pe,ie(pe,!1),pe.strm.avail_out===0)||pe.strstart-pe.block_start>=pe.w_size-M&&(ie(pe,!1),pe.strm.avail_out===0))return F}return pe.insert=0,ve===h?(ie(pe,!0),pe.strm.avail_out===0?U:Y):(pe.strstart>pe.block_start&&(ie(pe,!1),pe.strm.avail_out),F)}),new fe(4,4,8,4,_e),new fe(4,5,16,8,_e),new fe(4,6,32,32,_e),new fe(4,4,16,16,le),new fe(8,16,32,32,le),new fe(8,16,128,128,le),new fe(8,32,128,256,le),new fe(32,128,258,1024,le),new fe(32,258,258,4096,le)],r.deflateInit=function(pe,ve){return we(pe,ve,I,15,8,0)},r.deflateInit2=we,r.deflateReset=Qe,r.deflateResetKeep=ye,r.deflateSetHeader=function(pe,ve){return pe&&pe.state?pe.state.wrap!==2?p:(pe.state.gzhead=ve,d):p},r.deflate=function(pe,ve){var Me,Pe,He,Re;if(!pe||!pe.state||5<ve||ve<0)return pe?W(pe,p):p;if(Pe=pe.state,!pe.output||!pe.input&&pe.avail_in!==0||Pe.status===666&&ve!==h)return W(pe,pe.avail_out===0?-5:p);if(Pe.strm=pe,Me=Pe.last_flush,Pe.last_flush=ve,Pe.status===k)if(Pe.wrap===2)pe.adler=0,oe(Pe,31),oe(Pe,139),oe(Pe,8),Pe.gzhead?(oe(Pe,(Pe.gzhead.text?1:0)+(Pe.gzhead.hcrc?2:0)+(Pe.gzhead.extra?4:0)+(Pe.gzhead.name?8:0)+(Pe.gzhead.comment?16:0)),oe(Pe,255&Pe.gzhead.time),oe(Pe,Pe.gzhead.time>>8&255),oe(Pe,Pe.gzhead.time>>16&255),oe(Pe,Pe.gzhead.time>>24&255),oe(Pe,Pe.level===9?2:2<=Pe.strategy||Pe.level<2?4:0),oe(Pe,255&Pe.gzhead.os),Pe.gzhead.extra&&Pe.gzhead.extra.length&&(oe(Pe,255&Pe.gzhead.extra.length),oe(Pe,Pe.gzhead.extra.length>>8&255)),Pe.gzhead.hcrc&&(pe.adler=l(pe.adler,Pe.pending_buf,Pe.pending,0)),Pe.gzindex=0,Pe.status=69):(oe(Pe,0),oe(Pe,0),oe(Pe,0),oe(Pe,0),oe(Pe,0),oe(Pe,Pe.level===9?2:2<=Pe.strategy||Pe.level<2?4:0),oe(Pe,3),Pe.status=R);else{var Ee=I+(Pe.w_bits-8<<4)<<8;Ee|=(2<=Pe.strategy||Pe.level<2?0:Pe.level<6?1:Pe.level===6?2:3)<<6,Pe.strstart!==0&&(Ee|=32),Ee+=31-Ee%31,Pe.status=R,ne(Pe,Ee),Pe.strstart!==0&&(ne(Pe,pe.adler>>>16),ne(Pe,65535&pe.adler)),pe.adler=1}if(Pe.status===69)if(Pe.gzhead.extra){for(He=Pe.pending;Pe.gzindex<(65535&Pe.gzhead.extra.length)&&(Pe.pending!==Pe.pending_buf_size||(Pe.gzhead.hcrc&&Pe.pending>He&&(pe.adler=l(pe.adler,Pe.pending_buf,Pe.pending-He,He)),J(pe),He=Pe.pending,Pe.pending!==Pe.pending_buf_size));)oe(Pe,255&Pe.gzhead.extra[Pe.gzindex]),Pe.gzindex++;Pe.gzhead.hcrc&&Pe.pending>He&&(pe.adler=l(pe.adler,Pe.pending_buf,Pe.pending-He,He)),Pe.gzindex===Pe.gzhead.extra.length&&(Pe.gzindex=0,Pe.status=73)}else Pe.status=73;if(Pe.status===73)if(Pe.gzhead.name){He=Pe.pending;do{if(Pe.pending===Pe.pending_buf_size&&(Pe.gzhead.hcrc&&Pe.pending>He&&(pe.adler=l(pe.adler,Pe.pending_buf,Pe.pending-He,He)),J(pe),He=Pe.pending,Pe.pending===Pe.pending_buf_size)){Re=1;break}Re=Pe.gzindex<Pe.gzhead.name.length?255&Pe.gzhead.name.charCodeAt(Pe.gzindex++):0,oe(Pe,Re)}while(Re!==0);Pe.gzhead.hcrc&&Pe.pending>He&&(pe.adler=l(pe.adler,Pe.pending_buf,Pe.pending-He,He)),Re===0&&(Pe.gzindex=0,Pe.status=91)}else Pe.status=91;if(Pe.status===91)if(Pe.gzhead.comment){He=Pe.pending;do{if(Pe.pending===Pe.pending_buf_size&&(Pe.gzhead.hcrc&&Pe.pending>He&&(pe.adler=l(pe.adler,Pe.pending_buf,Pe.pending-He,He)),J(pe),He=Pe.pending,Pe.pending===Pe.pending_buf_size)){Re=1;break}Re=Pe.gzindex<Pe.gzhead.comment.length?255&Pe.gzhead.comment.charCodeAt(Pe.gzindex++):0,oe(Pe,Re)}while(Re!==0);Pe.gzhead.hcrc&&Pe.pending>He&&(pe.adler=l(pe.adler,Pe.pending_buf,Pe.pending-He,He)),Re===0&&(Pe.status=103)}else Pe.status=103;if(Pe.status===103&&(Pe.gzhead.hcrc?(Pe.pending+2>Pe.pending_buf_size&&J(pe),Pe.pending+2<=Pe.pending_buf_size&&(oe(Pe,255&pe.adler),oe(Pe,pe.adler>>8&255),pe.adler=0,Pe.status=R)):Pe.status=R),Pe.pending!==0){if(J(pe),pe.avail_out===0)return Pe.last_flush=-1,d}else if(pe.avail_in===0&&te(ve)<=te(Me)&&ve!==h)return W(pe,-5);if(Pe.status===666&&pe.avail_in!==0)return W(pe,-5);if(pe.avail_in!==0||Pe.lookahead!==0||ve!==g&&Pe.status!==666){var Te=Pe.strategy===2?(function(Ce,Fe){for(var Ye;;){if(Ce.lookahead===0&&(ue(Ce),Ce.lookahead===0)){if(Fe===g)return F;break}if(Ce.match_length=0,Ye=A._tr_tally(Ce,0,Ce.window[Ce.strstart]),Ce.lookahead--,Ce.strstart++,Ye&&(ie(Ce,!1),Ce.strm.avail_out===0))return F}return Ce.insert=0,Fe===h?(ie(Ce,!0),Ce.strm.avail_out===0?U:Y):Ce.last_lit&&(ie(Ce,!1),Ce.strm.avail_out===0)?F:O})(Pe,ve):Pe.strategy===3?(function(Ce,Fe){for(var Ye,tt,At,at,ot=Ce.window;;){if(Ce.lookahead<=w){if(ue(Ce),Ce.lookahead<=w&&Fe===g)return F;if(Ce.lookahead===0)break}if(Ce.match_length=0,Ce.lookahead>=Q&&0<Ce.strstart&&(tt=ot[At=Ce.strstart-1])===ot[++At]&&tt===ot[++At]&&tt===ot[++At]){at=Ce.strstart+w;do;while(tt===ot[++At]&&tt===ot[++At]&&tt===ot[++At]&&tt===ot[++At]&&tt===ot[++At]&&tt===ot[++At]&&tt===ot[++At]&&tt===ot[++At]&&At<at);Ce.match_length=w-(at-At),Ce.match_length>Ce.lookahead&&(Ce.match_length=Ce.lookahead)}if(Ce.match_length>=Q?(Ye=A._tr_tally(Ce,1,Ce.match_length-Q),Ce.lookahead-=Ce.match_length,Ce.strstart+=Ce.match_length,Ce.match_length=0):(Ye=A._tr_tally(Ce,0,Ce.window[Ce.strstart]),Ce.lookahead--,Ce.strstart++),Ye&&(ie(Ce,!1),Ce.strm.avail_out===0))return F}return Ce.insert=0,Fe===h?(ie(Ce,!0),Ce.strm.avail_out===0?U:Y):Ce.last_lit&&(ie(Ce,!1),Ce.strm.avail_out===0)?F:O})(Pe,ve):s[Pe.level].func(Pe,ve);if(Te!==U&&Te!==Y||(Pe.status=666),Te===F||Te===U)return pe.avail_out===0&&(Pe.last_flush=-1),d;if(Te===O&&(ve===1?A._tr_align(Pe):ve!==5&&(A._tr_stored_block(Pe,0,0,!1),ve===3&&(j(Pe.head),Pe.lookahead===0&&(Pe.strstart=0,Pe.block_start=0,Pe.insert=0))),J(pe),pe.avail_out===0))return Pe.last_flush=-1,d}return ve!==h?d:Pe.wrap<=0?1:(Pe.wrap===2?(oe(Pe,255&pe.adler),oe(Pe,pe.adler>>8&255),oe(Pe,pe.adler>>16&255),oe(Pe,pe.adler>>24&255),oe(Pe,255&pe.total_in),oe(Pe,pe.total_in>>8&255),oe(Pe,pe.total_in>>16&255),oe(Pe,pe.total_in>>24&255)):(ne(Pe,pe.adler>>>16),ne(Pe,65535&pe.adler)),J(pe),0<Pe.wrap&&(Pe.wrap=-Pe.wrap),Pe.pending!==0?d:1)},r.deflateEnd=function(pe){var ve;return pe&&pe.state?(ve=pe.state.status)!==k&&ve!==69&&ve!==73&&ve!==91&&ve!==103&&ve!==R&&ve!==666?W(pe,p):(pe.state=null,ve===R?W(pe,-3):d):p},r.deflateSetDictionary=function(pe,ve){var Me,Pe,He,Re,Ee,Te,Ce,Fe,Ye=ve.length;if(!pe||!pe.state||(Re=(Me=pe.state).wrap)===2||Re===1&&Me.status!==k||Me.lookahead)return p;for(Re===1&&(pe.adler=c(pe.adler,ve,Ye,0)),Me.wrap=0,Ye>=Me.w_size&&(Re===0&&(j(Me.head),Me.strstart=0,Me.block_start=0,Me.insert=0),Fe=new a.Buf8(Me.w_size),a.arraySet(Fe,ve,Ye-Me.w_size,Me.w_size,0),ve=Fe,Ye=Me.w_size),Ee=pe.avail_in,Te=pe.next_in,Ce=pe.input,pe.avail_in=Ye,pe.next_in=0,pe.input=ve,ue(Me);Me.lookahead>=Q;){for(Pe=Me.strstart,He=Me.lookahead-(Q-1);Me.ins_h=(Me.ins_h<<Me.hash_shift^Me.window[Pe+Q-1])&Me.hash_mask,Me.prev[Pe&Me.w_mask]=Me.head[Me.ins_h],Me.head[Me.ins_h]=Pe,Pe++,--He;);Me.strstart=Pe,Me.lookahead=Q-1,ue(Me)}return Me.strstart+=Me.lookahead,Me.block_start=Me.strstart,Me.insert=Me.lookahead,Me.lookahead=0,Me.match_length=Me.prev_length=Q-1,Me.match_available=0,pe.next_in=Te,pe.input=Ce,pe.avail_in=Ee,Me.wrap=Re,d},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(o,i,r){i.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(o,i,r){i.exports=function(s,a){var A,c,l,u,g,h,d,p,m,_,f,I,C,y,x,E,B,S,Q,w,M,k,R,F,O;A=s.state,c=s.next_in,F=s.input,l=c+(s.avail_in-5),u=s.next_out,O=s.output,g=u-(a-s.avail_out),h=u+(s.avail_out-257),d=A.dmax,p=A.wsize,m=A.whave,_=A.wnext,f=A.window,I=A.hold,C=A.bits,y=A.lencode,x=A.distcode,E=(1<<A.lenbits)-1,B=(1<<A.distbits)-1;e:do{C<15&&(I+=F[c++]<<C,C+=8,I+=F[c++]<<C,C+=8),S=y[I&E];t:for(;;){if(I>>>=Q=S>>>24,C-=Q,(Q=S>>>16&255)===0)O[u++]=65535&S;else{if(!(16&Q)){if((64&Q)==0){S=y[(65535&S)+(I&(1<<Q)-1)];continue t}if(32&Q){A.mode=12;break e}s.msg="invalid literal/length code",A.mode=30;break e}w=65535&S,(Q&=15)&&(C<Q&&(I+=F[c++]<<C,C+=8),w+=I&(1<<Q)-1,I>>>=Q,C-=Q),C<15&&(I+=F[c++]<<C,C+=8,I+=F[c++]<<C,C+=8),S=x[I&B];n:for(;;){if(I>>>=Q=S>>>24,C-=Q,!(16&(Q=S>>>16&255))){if((64&Q)==0){S=x[(65535&S)+(I&(1<<Q)-1)];continue n}s.msg="invalid distance code",A.mode=30;break e}if(M=65535&S,C<(Q&=15)&&(I+=F[c++]<<C,(C+=8)<Q&&(I+=F[c++]<<C,C+=8)),d<(M+=I&(1<<Q)-1)){s.msg="invalid distance too far back",A.mode=30;break e}if(I>>>=Q,C-=Q,(Q=u-g)<M){if(m<(Q=M-Q)&&A.sane){s.msg="invalid distance too far back",A.mode=30;break e}if(R=f,(k=0)===_){if(k+=p-Q,Q<w){for(w-=Q;O[u++]=f[k++],--Q;);k=u-M,R=O}}else if(_<Q){if(k+=p+_-Q,(Q-=_)<w){for(w-=Q;O[u++]=f[k++],--Q;);if(k=0,_<w){for(w-=Q=_;O[u++]=f[k++],--Q;);k=u-M,R=O}}}else if(k+=_-Q,Q<w){for(w-=Q;O[u++]=f[k++],--Q;);k=u-M,R=O}for(;2<w;)O[u++]=R[k++],O[u++]=R[k++],O[u++]=R[k++],w-=3;w&&(O[u++]=R[k++],1<w&&(O[u++]=R[k++]))}else{for(k=u-M;O[u++]=O[k++],O[u++]=O[k++],O[u++]=O[k++],2<(w-=3););w&&(O[u++]=O[k++],1<w&&(O[u++]=O[k++]))}break}}break}}while(c<l&&u<h);c-=w=C>>3,I&=(1<<(C-=w<<3))-1,s.next_in=c,s.next_out=u,s.avail_in=c<l?l-c+5:5-(c-l),s.avail_out=u<h?h-u+257:257-(u-h),A.hold=I,A.bits=C}},{}],49:[function(o,i,r){var s=o("../utils/common"),a=o("./adler32"),A=o("./crc32"),c=o("./inffast"),l=o("./inftrees"),u=1,g=2,h=0,d=-2,p=1,m=852,_=592;function f(k){return(k>>>24&255)+(k>>>8&65280)+((65280&k)<<8)+((255&k)<<24)}function I(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(k){var R;return k&&k.state?(R=k.state,k.total_in=k.total_out=R.total=0,k.msg="",R.wrap&&(k.adler=1&R.wrap),R.mode=p,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new s.Buf32(m),R.distcode=R.distdyn=new s.Buf32(_),R.sane=1,R.back=-1,h):d}function y(k){var R;return k&&k.state?((R=k.state).wsize=0,R.whave=0,R.wnext=0,C(k)):d}function x(k,R){var F,O;return k&&k.state?(O=k.state,R<0?(F=0,R=-R):(F=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?d:(O.window!==null&&O.wbits!==R&&(O.window=null),O.wrap=F,O.wbits=R,y(k))):d}function E(k,R){var F,O;return k?(O=new I,(k.state=O).window=null,(F=x(k,R))!==h&&(k.state=null),F):d}var B,S,Q=!0;function w(k){if(Q){var R;for(B=new s.Buf32(512),S=new s.Buf32(32),R=0;R<144;)k.lens[R++]=8;for(;R<256;)k.lens[R++]=9;for(;R<280;)k.lens[R++]=7;for(;R<288;)k.lens[R++]=8;for(l(u,k.lens,0,288,B,0,k.work,{bits:9}),R=0;R<32;)k.lens[R++]=5;l(g,k.lens,0,32,S,0,k.work,{bits:5}),Q=!1}k.lencode=B,k.lenbits=9,k.distcode=S,k.distbits=5}function M(k,R,F,O){var U,Y=k.state;return Y.window===null&&(Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new s.Buf8(Y.wsize)),O>=Y.wsize?(s.arraySet(Y.window,R,F-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(O<(U=Y.wsize-Y.wnext)&&(U=O),s.arraySet(Y.window,R,F-O,U,Y.wnext),(O-=U)?(s.arraySet(Y.window,R,F-O,O,0),Y.wnext=O,Y.whave=Y.wsize):(Y.wnext+=U,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave<Y.wsize&&(Y.whave+=U))),0}r.inflateReset=y,r.inflateReset2=x,r.inflateResetKeep=C,r.inflateInit=function(k){return E(k,15)},r.inflateInit2=E,r.inflate=function(k,R){var F,O,U,Y,W,te,j,J,ie,oe,ne,ge,ue,_e,le,fe,he,ye,Qe,we,pe,ve,Me,Pe,He=0,Re=new s.Buf8(4),Ee=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!k||!k.state||!k.output||!k.input&&k.avail_in!==0)return d;(F=k.state).mode===12&&(F.mode=13),W=k.next_out,U=k.output,j=k.avail_out,Y=k.next_in,O=k.input,te=k.avail_in,J=F.hold,ie=F.bits,oe=te,ne=j,ve=h;e:for(;;)switch(F.mode){case p:if(F.wrap===0){F.mode=13;break}for(;ie<16;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(2&F.wrap&&J===35615){Re[F.check=0]=255&J,Re[1]=J>>>8&255,F.check=A(F.check,Re,2,0),ie=J=0,F.mode=2;break}if(F.flags=0,F.head&&(F.head.done=!1),!(1&F.wrap)||(((255&J)<<8)+(J>>8))%31){k.msg="incorrect header check",F.mode=30;break}if((15&J)!=8){k.msg="unknown compression method",F.mode=30;break}if(ie-=4,pe=8+(15&(J>>>=4)),F.wbits===0)F.wbits=pe;else if(pe>F.wbits){k.msg="invalid window size",F.mode=30;break}F.dmax=1<<pe,k.adler=F.check=1,F.mode=512&J?10:12,ie=J=0;break;case 2:for(;ie<16;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(F.flags=J,(255&F.flags)!=8){k.msg="unknown compression method",F.mode=30;break}if(57344&F.flags){k.msg="unknown header flags set",F.mode=30;break}F.head&&(F.head.text=J>>8&1),512&F.flags&&(Re[0]=255&J,Re[1]=J>>>8&255,F.check=A(F.check,Re,2,0)),ie=J=0,F.mode=3;case 3:for(;ie<32;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}F.head&&(F.head.time=J),512&F.flags&&(Re[0]=255&J,Re[1]=J>>>8&255,Re[2]=J>>>16&255,Re[3]=J>>>24&255,F.check=A(F.check,Re,4,0)),ie=J=0,F.mode=4;case 4:for(;ie<16;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}F.head&&(F.head.xflags=255&J,F.head.os=J>>8),512&F.flags&&(Re[0]=255&J,Re[1]=J>>>8&255,F.check=A(F.check,Re,2,0)),ie=J=0,F.mode=5;case 5:if(1024&F.flags){for(;ie<16;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}F.length=J,F.head&&(F.head.extra_len=J),512&F.flags&&(Re[0]=255&J,Re[1]=J>>>8&255,F.check=A(F.check,Re,2,0)),ie=J=0}else F.head&&(F.head.extra=null);F.mode=6;case 6:if(1024&F.flags&&(te<(ge=F.length)&&(ge=te),ge&&(F.head&&(pe=F.head.extra_len-F.length,F.head.extra||(F.head.extra=new Array(F.head.extra_len)),s.arraySet(F.head.extra,O,Y,ge,pe)),512&F.flags&&(F.check=A(F.check,O,ge,Y)),te-=ge,Y+=ge,F.length-=ge),F.length))break e;F.length=0,F.mode=7;case 7:if(2048&F.flags){if(te===0)break e;for(ge=0;pe=O[Y+ge++],F.head&&pe&&F.length<65536&&(F.head.name+=String.fromCharCode(pe)),pe&&ge<te;);if(512&F.flags&&(F.check=A(F.check,O,ge,Y)),te-=ge,Y+=ge,pe)break e}else F.head&&(F.head.name=null);F.length=0,F.mode=8;case 8:if(4096&F.flags){if(te===0)break e;for(ge=0;pe=O[Y+ge++],F.head&&pe&&F.length<65536&&(F.head.comment+=String.fromCharCode(pe)),pe&&ge<te;);if(512&F.flags&&(F.check=A(F.check,O,ge,Y)),te-=ge,Y+=ge,pe)break e}else F.head&&(F.head.comment=null);F.mode=9;case 9:if(512&F.flags){for(;ie<16;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(J!==(65535&F.check)){k.msg="header crc mismatch",F.mode=30;break}ie=J=0}F.head&&(F.head.hcrc=F.flags>>9&1,F.head.done=!0),k.adler=F.check=0,F.mode=12;break;case 10:for(;ie<32;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}k.adler=F.check=f(J),ie=J=0,F.mode=11;case 11:if(F.havedict===0)return k.next_out=W,k.avail_out=j,k.next_in=Y,k.avail_in=te,F.hold=J,F.bits=ie,2;k.adler=F.check=1,F.mode=12;case 12:if(R===5||R===6)break e;case 13:if(F.last){J>>>=7&ie,ie-=7&ie,F.mode=27;break}for(;ie<3;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}switch(F.last=1&J,ie-=1,3&(J>>>=1)){case 0:F.mode=14;break;case 1:if(w(F),F.mode=20,R!==6)break;J>>>=2,ie-=2;break e;case 2:F.mode=17;break;case 3:k.msg="invalid block type",F.mode=30}J>>>=2,ie-=2;break;case 14:for(J>>>=7&ie,ie-=7&ie;ie<32;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if((65535&J)!=(J>>>16^65535)){k.msg="invalid stored block lengths",F.mode=30;break}if(F.length=65535&J,ie=J=0,F.mode=15,R===6)break e;case 15:F.mode=16;case 16:if(ge=F.length){if(te<ge&&(ge=te),j<ge&&(ge=j),ge===0)break e;s.arraySet(U,O,Y,ge,W),te-=ge,Y+=ge,j-=ge,W+=ge,F.length-=ge;break}F.mode=12;break;case 17:for(;ie<14;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(F.nlen=257+(31&J),J>>>=5,ie-=5,F.ndist=1+(31&J),J>>>=5,ie-=5,F.ncode=4+(15&J),J>>>=4,ie-=4,286<F.nlen||30<F.ndist){k.msg="too many length or distance symbols",F.mode=30;break}F.have=0,F.mode=18;case 18:for(;F.have<F.ncode;){for(;ie<3;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}F.lens[Ee[F.have++]]=7&J,J>>>=3,ie-=3}for(;F.have<19;)F.lens[Ee[F.have++]]=0;if(F.lencode=F.lendyn,F.lenbits=7,Me={bits:F.lenbits},ve=l(0,F.lens,0,19,F.lencode,0,F.work,Me),F.lenbits=Me.bits,ve){k.msg="invalid code lengths set",F.mode=30;break}F.have=0,F.mode=19;case 19:for(;F.have<F.nlen+F.ndist;){for(;fe=(He=F.lencode[J&(1<<F.lenbits)-1])>>>16&255,he=65535&He,!((le=He>>>24)<=ie);){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(he<16)J>>>=le,ie-=le,F.lens[F.have++]=he;else{if(he===16){for(Pe=le+2;ie<Pe;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(J>>>=le,ie-=le,F.have===0){k.msg="invalid bit length repeat",F.mode=30;break}pe=F.lens[F.have-1],ge=3+(3&J),J>>>=2,ie-=2}else if(he===17){for(Pe=le+3;ie<Pe;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}ie-=le,pe=0,ge=3+(7&(J>>>=le)),J>>>=3,ie-=3}else{for(Pe=le+7;ie<Pe;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}ie-=le,pe=0,ge=11+(127&(J>>>=le)),J>>>=7,ie-=7}if(F.have+ge>F.nlen+F.ndist){k.msg="invalid bit length repeat",F.mode=30;break}for(;ge--;)F.lens[F.have++]=pe}}if(F.mode===30)break;if(F.lens[256]===0){k.msg="invalid code -- missing end-of-block",F.mode=30;break}if(F.lenbits=9,Me={bits:F.lenbits},ve=l(u,F.lens,0,F.nlen,F.lencode,0,F.work,Me),F.lenbits=Me.bits,ve){k.msg="invalid literal/lengths set",F.mode=30;break}if(F.distbits=6,F.distcode=F.distdyn,Me={bits:F.distbits},ve=l(g,F.lens,F.nlen,F.ndist,F.distcode,0,F.work,Me),F.distbits=Me.bits,ve){k.msg="invalid distances set",F.mode=30;break}if(F.mode=20,R===6)break e;case 20:F.mode=21;case 21:if(6<=te&&258<=j){k.next_out=W,k.avail_out=j,k.next_in=Y,k.avail_in=te,F.hold=J,F.bits=ie,c(k,ne),W=k.next_out,U=k.output,j=k.avail_out,Y=k.next_in,O=k.input,te=k.avail_in,J=F.hold,ie=F.bits,F.mode===12&&(F.back=-1);break}for(F.back=0;fe=(He=F.lencode[J&(1<<F.lenbits)-1])>>>16&255,he=65535&He,!((le=He>>>24)<=ie);){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(fe&&(240&fe)==0){for(ye=le,Qe=fe,we=he;fe=(He=F.lencode[we+((J&(1<<ye+Qe)-1)>>ye)])>>>16&255,he=65535&He,!(ye+(le=He>>>24)<=ie);){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}J>>>=ye,ie-=ye,F.back+=ye}if(J>>>=le,ie-=le,F.back+=le,F.length=he,fe===0){F.mode=26;break}if(32&fe){F.back=-1,F.mode=12;break}if(64&fe){k.msg="invalid literal/length code",F.mode=30;break}F.extra=15&fe,F.mode=22;case 22:if(F.extra){for(Pe=F.extra;ie<Pe;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}F.length+=J&(1<<F.extra)-1,J>>>=F.extra,ie-=F.extra,F.back+=F.extra}F.was=F.length,F.mode=23;case 23:for(;fe=(He=F.distcode[J&(1<<F.distbits)-1])>>>16&255,he=65535&He,!((le=He>>>24)<=ie);){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if((240&fe)==0){for(ye=le,Qe=fe,we=he;fe=(He=F.distcode[we+((J&(1<<ye+Qe)-1)>>ye)])>>>16&255,he=65535&He,!(ye+(le=He>>>24)<=ie);){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}J>>>=ye,ie-=ye,F.back+=ye}if(J>>>=le,ie-=le,F.back+=le,64&fe){k.msg="invalid distance code",F.mode=30;break}F.offset=he,F.extra=15&fe,F.mode=24;case 24:if(F.extra){for(Pe=F.extra;ie<Pe;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}F.offset+=J&(1<<F.extra)-1,J>>>=F.extra,ie-=F.extra,F.back+=F.extra}if(F.offset>F.dmax){k.msg="invalid distance too far back",F.mode=30;break}F.mode=25;case 25:if(j===0)break e;if(ge=ne-j,F.offset>ge){if((ge=F.offset-ge)>F.whave&&F.sane){k.msg="invalid distance too far back",F.mode=30;break}ue=ge>F.wnext?(ge-=F.wnext,F.wsize-ge):F.wnext-ge,ge>F.length&&(ge=F.length),_e=F.window}else _e=U,ue=W-F.offset,ge=F.length;for(j<ge&&(ge=j),j-=ge,F.length-=ge;U[W++]=_e[ue++],--ge;);F.length===0&&(F.mode=21);break;case 26:if(j===0)break e;U[W++]=F.length,j--,F.mode=21;break;case 27:if(F.wrap){for(;ie<32;){if(te===0)break e;te--,J|=O[Y++]<<ie,ie+=8}if(ne-=j,k.total_out+=ne,F.total+=ne,ne&&(k.adler=F.check=F.flags?A(F.check,U,ne,W-ne):a(F.check,U,ne,W-ne)),ne=j,(F.flags?J:f(J))!==F.check){k.msg="incorrect data check",F.mode=30;break}ie=J=0}F.mode=28;case 28:if(F.wrap&&F.flags){for(;ie<32;){if(te===0)break e;te--,J+=O[Y++]<<ie,ie+=8}if(J!==(4294967295&F.total)){k.msg="incorrect length check",F.mode=30;break}ie=J=0}F.mode=29;case 29:ve=1;break e;case 30:ve=-3;break e;case 31:return-4;default:return d}return k.next_out=W,k.avail_out=j,k.next_in=Y,k.avail_in=te,F.hold=J,F.bits=ie,(F.wsize||ne!==k.avail_out&&F.mode<30&&(F.mode<27||R!==4))&&M(k,k.output,k.next_out,ne-k.avail_out)?(F.mode=31,-4):(oe-=k.avail_in,ne-=k.avail_out,k.total_in+=oe,k.total_out+=ne,F.total+=ne,F.wrap&&ne&&(k.adler=F.check=F.flags?A(F.check,U,ne,k.next_out-ne):a(F.check,U,ne,k.next_out-ne)),k.data_type=F.bits+(F.last?64:0)+(F.mode===12?128:0)+(F.mode===20||F.mode===15?256:0),(oe==0&&ne===0||R===4)&&ve===h&&(ve=-5),ve)},r.inflateEnd=function(k){if(!k||!k.state)return d;var R=k.state;return R.window&&(R.window=null),k.state=null,h},r.inflateGetHeader=function(k,R){var F;return k&&k.state?(2&(F=k.state).wrap)==0?d:((F.head=R).done=!1,h):d},r.inflateSetDictionary=function(k,R){var F,O=R.length;return k&&k.state?(F=k.state).wrap!==0&&F.mode!==11?d:F.mode===11&&a(1,R,O,0)!==F.check?-3:M(k,R,O,O)?(F.mode=31,-4):(F.havedict=1,h):d},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(o,i,r){var s=o("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],A=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];i.exports=function(u,g,h,d,p,m,_,f){var I,C,y,x,E,B,S,Q,w,M=f.bits,k=0,R=0,F=0,O=0,U=0,Y=0,W=0,te=0,j=0,J=0,ie=null,oe=0,ne=new s.Buf16(16),ge=new s.Buf16(16),ue=null,_e=0;for(k=0;k<=15;k++)ne[k]=0;for(R=0;R<d;R++)ne[g[h+R]]++;for(U=M,O=15;1<=O&&ne[O]===0;O--);if(O<U&&(U=O),O===0)return p[m++]=20971520,p[m++]=20971520,f.bits=1,0;for(F=1;F<O&&ne[F]===0;F++);for(U<F&&(U=F),k=te=1;k<=15;k++)if(te<<=1,(te-=ne[k])<0)return-1;if(0<te&&(u===0||O!==1))return-1;for(ge[1]=0,k=1;k<15;k++)ge[k+1]=ge[k]+ne[k];for(R=0;R<d;R++)g[h+R]!==0&&(_[ge[g[h+R]]++]=R);if(B=u===0?(ie=ue=_,19):u===1?(ie=a,oe-=257,ue=A,_e-=257,256):(ie=c,ue=l,-1),k=F,E=m,W=R=J=0,y=-1,x=(j=1<<(Y=U))-1,u===1&&852<j||u===2&&592<j)return 1;for(;;){for(S=k-W,w=_[R]<B?(Q=0,_[R]):_[R]>B?(Q=ue[_e+_[R]],ie[oe+_[R]]):(Q=96,0),I=1<<k-W,F=C=1<<Y;p[E+(J>>W)+(C-=I)]=S<<24|Q<<16|w|0,C!==0;);for(I=1<<k-1;J&I;)I>>=1;if(I!==0?(J&=I-1,J+=I):J=0,R++,--ne[k]==0){if(k===O)break;k=g[h+_[R]]}if(U<k&&(J&x)!==y){for(W===0&&(W=U),E+=F,te=1<<(Y=k-W);Y+W<O&&!((te-=ne[Y+W])<=0);)Y++,te<<=1;if(j+=1<<Y,u===1&&852<j||u===2&&592<j)return 1;p[y=J&x]=U<<24|Y<<16|E-m|0}}return J!==0&&(p[E+J]=k-W<<24|64<<16|0),f.bits=U,0}},{"../utils/common":41}],51:[function(o,i,r){i.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(o,i,r){var s=o("../utils/common"),a=0,A=1;function c(He){for(var Re=He.length;0<=--Re;)He[Re]=0}var l=0,u=29,g=256,h=g+1+u,d=30,p=19,m=2*h+1,_=15,f=16,I=7,C=256,y=16,x=17,E=18,B=[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],S=[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],Q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],M=new Array(2*(h+2));c(M);var k=new Array(2*d);c(k);var R=new Array(512);c(R);var F=new Array(256);c(F);var O=new Array(u);c(O);var U,Y,W,te=new Array(d);function j(He,Re,Ee,Te,Ce){this.static_tree=He,this.extra_bits=Re,this.extra_base=Ee,this.elems=Te,this.max_length=Ce,this.has_stree=He&&He.length}function J(He,Re){this.dyn_tree=He,this.max_code=0,this.stat_desc=Re}function ie(He){return He<256?R[He]:R[256+(He>>>7)]}function oe(He,Re){He.pending_buf[He.pending++]=255&Re,He.pending_buf[He.pending++]=Re>>>8&255}function ne(He,Re,Ee){He.bi_valid>f-Ee?(He.bi_buf|=Re<<He.bi_valid&65535,oe(He,He.bi_buf),He.bi_buf=Re>>f-He.bi_valid,He.bi_valid+=Ee-f):(He.bi_buf|=Re<<He.bi_valid&65535,He.bi_valid+=Ee)}function ge(He,Re,Ee){ne(He,Ee[2*Re],Ee[2*Re+1])}function ue(He,Re){for(var Ee=0;Ee|=1&He,He>>>=1,Ee<<=1,0<--Re;);return Ee>>>1}function _e(He,Re,Ee){var Te,Ce,Fe=new Array(_+1),Ye=0;for(Te=1;Te<=_;Te++)Fe[Te]=Ye=Ye+Ee[Te-1]<<1;for(Ce=0;Ce<=Re;Ce++){var tt=He[2*Ce+1];tt!==0&&(He[2*Ce]=ue(Fe[tt]++,tt))}}function le(He){var Re;for(Re=0;Re<h;Re++)He.dyn_ltree[2*Re]=0;for(Re=0;Re<d;Re++)He.dyn_dtree[2*Re]=0;for(Re=0;Re<p;Re++)He.bl_tree[2*Re]=0;He.dyn_ltree[2*C]=1,He.opt_len=He.static_len=0,He.last_lit=He.matches=0}function fe(He){8<He.bi_valid?oe(He,He.bi_buf):0<He.bi_valid&&(He.pending_buf[He.pending++]=He.bi_buf),He.bi_buf=0,He.bi_valid=0}function he(He,Re,Ee,Te){var Ce=2*Re,Fe=2*Ee;return He[Ce]<He[Fe]||He[Ce]===He[Fe]&&Te[Re]<=Te[Ee]}function ye(He,Re,Ee){for(var Te=He.heap[Ee],Ce=Ee<<1;Ce<=He.heap_len&&(Ce<He.heap_len&&he(Re,He.heap[Ce+1],He.heap[Ce],He.depth)&&Ce++,!he(Re,Te,He.heap[Ce],He.depth));)He.heap[Ee]=He.heap[Ce],Ee=Ce,Ce<<=1;He.heap[Ee]=Te}function Qe(He,Re,Ee){var Te,Ce,Fe,Ye,tt=0;if(He.last_lit!==0)for(;Te=He.pending_buf[He.d_buf+2*tt]<<8|He.pending_buf[He.d_buf+2*tt+1],Ce=He.pending_buf[He.l_buf+tt],tt++,Te===0?ge(He,Ce,Re):(ge(He,(Fe=F[Ce])+g+1,Re),(Ye=B[Fe])!==0&&ne(He,Ce-=O[Fe],Ye),ge(He,Fe=ie(--Te),Ee),(Ye=S[Fe])!==0&&ne(He,Te-=te[Fe],Ye)),tt<He.last_lit;);ge(He,C,Re)}function we(He,Re){var Ee,Te,Ce,Fe=Re.dyn_tree,Ye=Re.stat_desc.static_tree,tt=Re.stat_desc.has_stree,At=Re.stat_desc.elems,at=-1;for(He.heap_len=0,He.heap_max=m,Ee=0;Ee<At;Ee++)Fe[2*Ee]!==0?(He.heap[++He.heap_len]=at=Ee,He.depth[Ee]=0):Fe[2*Ee+1]=0;for(;He.heap_len<2;)Fe[2*(Ce=He.heap[++He.heap_len]=at<2?++at:0)]=1,He.depth[Ce]=0,He.opt_len--,tt&&(He.static_len-=Ye[2*Ce+1]);for(Re.max_code=at,Ee=He.heap_len>>1;1<=Ee;Ee--)ye(He,Fe,Ee);for(Ce=At;Ee=He.heap[1],He.heap[1]=He.heap[He.heap_len--],ye(He,Fe,1),Te=He.heap[1],He.heap[--He.heap_max]=Ee,He.heap[--He.heap_max]=Te,Fe[2*Ce]=Fe[2*Ee]+Fe[2*Te],He.depth[Ce]=(He.depth[Ee]>=He.depth[Te]?He.depth[Ee]:He.depth[Te])+1,Fe[2*Ee+1]=Fe[2*Te+1]=Ce,He.heap[1]=Ce++,ye(He,Fe,1),2<=He.heap_len;);He.heap[--He.heap_max]=He.heap[1],(function(ot,gt){var Bt,Ct,Dt,Nt,st,Yt,pn=gt.dyn_tree,be=gt.max_code,et=gt.stat_desc.static_tree,It=gt.stat_desc.has_stree,Et=gt.stat_desc.extra_bits,Ze=gt.stat_desc.extra_base,mt=gt.stat_desc.max_length,bt=0;for(Nt=0;Nt<=_;Nt++)ot.bl_count[Nt]=0;for(pn[2*ot.heap[ot.heap_max]+1]=0,Bt=ot.heap_max+1;Bt<m;Bt++)mt<(Nt=pn[2*pn[2*(Ct=ot.heap[Bt])+1]+1]+1)&&(Nt=mt,bt++),pn[2*Ct+1]=Nt,be<Ct||(ot.bl_count[Nt]++,st=0,Ze<=Ct&&(st=Et[Ct-Ze]),Yt=pn[2*Ct],ot.opt_len+=Yt*(Nt+st),It&&(ot.static_len+=Yt*(et[2*Ct+1]+st)));if(bt!==0){do{for(Nt=mt-1;ot.bl_count[Nt]===0;)Nt--;ot.bl_count[Nt]--,ot.bl_count[Nt+1]+=2,ot.bl_count[mt]--,bt-=2}while(0<bt);for(Nt=mt;Nt!==0;Nt--)for(Ct=ot.bl_count[Nt];Ct!==0;)be<(Dt=ot.heap[--Bt])||(pn[2*Dt+1]!==Nt&&(ot.opt_len+=(Nt-pn[2*Dt+1])*pn[2*Dt],pn[2*Dt+1]=Nt),Ct--)}})(He,Re),_e(Fe,at,He.bl_count)}function pe(He,Re,Ee){var Te,Ce,Fe=-1,Ye=Re[1],tt=0,At=7,at=4;for(Ye===0&&(At=138,at=3),Re[2*(Ee+1)+1]=65535,Te=0;Te<=Ee;Te++)Ce=Ye,Ye=Re[2*(Te+1)+1],++tt<At&&Ce===Ye||(tt<at?He.bl_tree[2*Ce]+=tt:Ce!==0?(Ce!==Fe&&He.bl_tree[2*Ce]++,He.bl_tree[2*y]++):tt<=10?He.bl_tree[2*x]++:He.bl_tree[2*E]++,Fe=Ce,at=(tt=0)===Ye?(At=138,3):Ce===Ye?(At=6,3):(At=7,4))}function ve(He,Re,Ee){var Te,Ce,Fe=-1,Ye=Re[1],tt=0,At=7,at=4;for(Ye===0&&(At=138,at=3),Te=0;Te<=Ee;Te++)if(Ce=Ye,Ye=Re[2*(Te+1)+1],!(++tt<At&&Ce===Ye)){if(tt<at)for(;ge(He,Ce,He.bl_tree),--tt!=0;);else Ce!==0?(Ce!==Fe&&(ge(He,Ce,He.bl_tree),tt--),ge(He,y,He.bl_tree),ne(He,tt-3,2)):tt<=10?(ge(He,x,He.bl_tree),ne(He,tt-3,3)):(ge(He,E,He.bl_tree),ne(He,tt-11,7));Fe=Ce,at=(tt=0)===Ye?(At=138,3):Ce===Ye?(At=6,3):(At=7,4)}}c(te);var Me=!1;function Pe(He,Re,Ee,Te){ne(He,(l<<1)+(Te?1:0),3),(function(Ce,Fe,Ye,tt){fe(Ce),oe(Ce,Ye),oe(Ce,~Ye),s.arraySet(Ce.pending_buf,Ce.window,Fe,Ye,Ce.pending),Ce.pending+=Ye})(He,Re,Ee)}r._tr_init=function(He){Me||((function(){var Re,Ee,Te,Ce,Fe,Ye=new Array(_+1);for(Ce=Te=0;Ce<u-1;Ce++)for(O[Ce]=Te,Re=0;Re<1<<B[Ce];Re++)F[Te++]=Ce;for(F[Te-1]=Ce,Ce=Fe=0;Ce<16;Ce++)for(te[Ce]=Fe,Re=0;Re<1<<S[Ce];Re++)R[Fe++]=Ce;for(Fe>>=7;Ce<d;Ce++)for(te[Ce]=Fe<<7,Re=0;Re<1<<S[Ce]-7;Re++)R[256+Fe++]=Ce;for(Ee=0;Ee<=_;Ee++)Ye[Ee]=0;for(Re=0;Re<=143;)M[2*Re+1]=8,Re++,Ye[8]++;for(;Re<=255;)M[2*Re+1]=9,Re++,Ye[9]++;for(;Re<=279;)M[2*Re+1]=7,Re++,Ye[7]++;for(;Re<=287;)M[2*Re+1]=8,Re++,Ye[8]++;for(_e(M,h+1,Ye),Re=0;Re<d;Re++)k[2*Re+1]=5,k[2*Re]=ue(Re,5);U=new j(M,B,g+1,h,_),Y=new j(k,S,0,d,_),W=new j(new Array(0),Q,0,p,I)})(),Me=!0),He.l_desc=new J(He.dyn_ltree,U),He.d_desc=new J(He.dyn_dtree,Y),He.bl_desc=new J(He.bl_tree,W),He.bi_buf=0,He.bi_valid=0,le(He)},r._tr_stored_block=Pe,r._tr_flush_block=function(He,Re,Ee,Te){var Ce,Fe,Ye=0;0<He.level?(He.strm.data_type===2&&(He.strm.data_type=(function(tt){var At,at=4093624447;for(At=0;At<=31;At++,at>>>=1)if(1&at&&tt.dyn_ltree[2*At]!==0)return a;if(tt.dyn_ltree[18]!==0||tt.dyn_ltree[20]!==0||tt.dyn_ltree[26]!==0)return A;for(At=32;At<g;At++)if(tt.dyn_ltree[2*At]!==0)return A;return a})(He)),we(He,He.l_desc),we(He,He.d_desc),Ye=(function(tt){var At;for(pe(tt,tt.dyn_ltree,tt.l_desc.max_code),pe(tt,tt.dyn_dtree,tt.d_desc.max_code),we(tt,tt.bl_desc),At=p-1;3<=At&&tt.bl_tree[2*w[At]+1]===0;At--);return tt.opt_len+=3*(At+1)+5+5+4,At})(He),Ce=He.opt_len+3+7>>>3,(Fe=He.static_len+3+7>>>3)<=Ce&&(Ce=Fe)):Ce=Fe=Ee+5,Ee+4<=Ce&&Re!==-1?Pe(He,Re,Ee,Te):He.strategy===4||Fe===Ce?(ne(He,2+(Te?1:0),3),Qe(He,M,k)):(ne(He,4+(Te?1:0),3),(function(tt,At,at,ot){var gt;for(ne(tt,At-257,5),ne(tt,at-1,5),ne(tt,ot-4,4),gt=0;gt<ot;gt++)ne(tt,tt.bl_tree[2*w[gt]+1],3);ve(tt,tt.dyn_ltree,At-1),ve(tt,tt.dyn_dtree,at-1)})(He,He.l_desc.max_code+1,He.d_desc.max_code+1,Ye+1),Qe(He,He.dyn_ltree,He.dyn_dtree)),le(He),Te&&fe(He)},r._tr_tally=function(He,Re,Ee){return He.pending_buf[He.d_buf+2*He.last_lit]=Re>>>8&255,He.pending_buf[He.d_buf+2*He.last_lit+1]=255&Re,He.pending_buf[He.l_buf+He.last_lit]=255&Ee,He.last_lit++,Re===0?He.dyn_ltree[2*Ee]++:(He.matches++,Re--,He.dyn_ltree[2*(F[Ee]+g+1)]++,He.dyn_dtree[2*ie(Re)]++),He.last_lit===He.lit_bufsize-1},r._tr_align=function(He){ne(He,2,3),ge(He,C,M),(function(Re){Re.bi_valid===16?(oe(Re,Re.bi_buf),Re.bi_buf=0,Re.bi_valid=0):8<=Re.bi_valid&&(Re.pending_buf[Re.pending++]=255&Re.bi_buf,Re.bi_buf>>=8,Re.bi_valid-=8)})(He)}},{"../utils/common":41}],53:[function(o,i,r){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(o,i,r){(function(s){(function(a,A){if(!a.setImmediate){var c,l,u,g,h=1,d={},p=!1,m=a.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(a);_=_&&_.setTimeout?_:a,c={}.toString.call(a.process)==="[object process]"?function(y){n.nextTick(function(){I(y)})}:(function(){if(a.postMessage&&!a.importScripts){var y=!0,x=a.onmessage;return a.onmessage=function(){y=!1},a.postMessage("","*"),a.onmessage=x,y}})()?(g="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",C,!1):a.attachEvent("onmessage",C),function(y){a.postMessage(g+y,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(y){I(y.data)},function(y){u.port2.postMessage(y)}):m&&"onreadystatechange"in m.createElement("script")?(l=m.documentElement,function(y){var x=m.createElement("script");x.onreadystatechange=function(){I(y),x.onreadystatechange=null,l.removeChild(x),x=null},l.appendChild(x)}):function(y){setTimeout(I,0,y)},_.setImmediate=function(y){typeof y!="function"&&(y=new Function(""+y));for(var x=new Array(arguments.length-1),E=0;E<x.length;E++)x[E]=arguments[E+1];var B={callback:y,args:x};return d[h]=B,c(h),h++},_.clearImmediate=f}function f(y){delete d[y]}function I(y){if(p)setTimeout(I,0,y);else{var x=d[y];if(x){p=!0;try{(function(E){var B=E.callback,S=E.args;switch(S.length){case 0:B();break;case 1:B(S[0]);break;case 2:B(S[0],S[1]);break;case 3:B(S[0],S[1],S[2]);break;default:B.apply(A,S)}})(x)}finally{f(y),p=!1}}}}function C(y){y.source===a&&typeof y.data=="string"&&y.data.indexOf(g)===0&&I(+y.data.slice(g.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof py<"u"?py:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(eqe)),eqe.exports}var fUi=_Ui();const ffe=my(fUi),IUi=async({circuitJson:t,projectName:e})=>{await ua.promise((async()=>{const n=new ffe,[o,{convertCircuitJsonToBomRows:i,convertBomRowsToCsv:r},{convertCircuitJsonToPickAndPlaceCsv:s}]=await Promise.all([vE("circuit-json-to-gerber"),vE("circuit-json-to-bom-csv"),vE("circuit-json-to-pnp-csv")]),a=t.filter(h=>!("error_type"in h)&&!("warning_type"in h)),A=o.convertCircuitJsonToGerberFiles(a,{flip_y_axis:!1});for(const[h,d]of Object.entries(A))n.file(`gerber/${h}`,d);const c=await i({circuitJson:t}),l=await r(c);n.file("bom.csv",l);const u=await s(t,{supplier:"jlcpcb"});n.file("pick_and_place.csv",u);const g=await n.generateAsync({type:"blob"});NE(g,{fileName:`${e}_fabrication_files.zip`})})(),{loading:"Generating fabrication files...",success:"Fabrication ZIP ready",error:n=>`Failed to generate fabrication files: ${n instanceof Error?n.message:String(n)}`})},CUi=async t=>{const{createFdmComponentBox:e,renderFdmComponentBoxPng:n}=await vE("circuit-json-to-fdm-component-box"),[o,i]=await Promise.all([e(t),n(t,{},{width:960,height:640})]);return{...o,previewPng:i}},yUi=async t=>{const{createFdmComponentBox:e}=await vE("circuit-json-to-fdm-component-box");return e(t)},Tpn=({generatedBox:t,projectName:e})=>{const n=Uint8Array.from(t.threeMf);NE(new Blob([n.buffer],{type:"model/3mf"}),{fileName:`${b$e(e)}-component-box.3mf`})},xUi=async({circuitJson:t,projectName:e})=>{await ua.promise((async()=>{const n=await yUi(t);Tpn({generatedBox:n,projectName:e})})(),{loading:"Generating component box...",success:"Component box 3MF ready",error:n=>`Failed to generate component box: ${n instanceof Error?n.message:String(n)}`})},EUi=async({circuitJson:t,projectName:e})=>{let n;try{const{convertCircuitJsonToGltf:o}=await vE("circuit-json-to-gltf");console.log("convertCircuitJsonToGltf",o);const i=await o(t,{format:"glb",boardTextureResolution:1024});if(!i||!(i instanceof ArrayBuffer))throw new Error("Invalid GLB data returned from converter");n=new Blob([i],{type:"model/gltf-binary"})}catch(o){console.error("GLB Export Error:",o);return}NE(n,{fileName:`${e}.glb`})},BUi=async({circuitJson:t,libraryName:e})=>{const{CircuitJsonToKicadLibraryConverter:n}=await vE("circuit-json-to-kicad"),o=new n(t,{libraryName:e,footprintLibraryName:e});o.runUntilFinished();const i=o.getOutput(),r=new ffe;r.file(`${e}.kicad_sym`,i.kicadSymString);for(const s of i.footprints){const a=r.folder(`${e}.pretty`);a&&a.file(`${s.footprintName}.kicad_mod`,`${s.kicadModString}
|
|
5673
5673
|
`)}if(i.model3dSourcePaths.length>0){const s=r.folder(`${e}.3dshapes`);if(s)for(const a of i.model3dSourcePaths)try{const A=a.split("/").pop()||a,c=await fetch(a);if(c.ok){const l=await c.arrayBuffer();s.file(A,l)}}catch{}}return r.file("fp-lib-table",i.fpLibTableString),r.file("sym-lib-table",i.symLibTableString),r},bUi=async({circuitJson:t,projectName:e})=>{await ua.promise((async()=>{const o=await(await BUi({circuitJson:t,libraryName:e})).generateAsync({type:"blob"});NE(o,{fileName:`${e}_kicad_library.zip`})})(),{loading:"Generating KiCad library...",success:"KiCad library ZIP ready",error:n=>`Failed to generate KiCad library: ${n instanceof Error?n.message:String(n)}`})},SUi=async({circuitJson:t,projectName:e})=>{const{CircuitJsonToKicadPcbConverter:n,CircuitJsonToKicadSchConverter:o,CircuitJsonToKicadProConverter:i,resolveAndLoadKicad3dModelFiles:r}=await vE("circuit-json-to-kicad"),s=new o(t);s.runUntilFinished();const a=s.getOutputString(),A=new n(t,{includeBuiltin3dModels:!0,projectName:e});A.runUntilFinished();const c=A.getOutputString(),l=new i(t,{projectName:e,schematicFilename:`${e}.kicad_sch`,pcbFilename:`${e}.kicad_pcb`});l.runUntilFinished();const u=l.getOutputString(),g=new ffe;return g.file(`${e}.kicad_sch`,a),g.file(`${e}.kicad_pcb`,c),g.file(`${e}.kicad_pro`,u),await r({projectName:e,model3dSourcePaths:A.getModel3dSourcePaths(),fetch,onModelFile:({outputPath:h,content:d})=>{g.file(h,d)},onError:({sourcePath:h})=>{console.warn(`Failed to load 3D model from ${h}`)}}),g},QUi=async({circuitJson:t,projectName:e})=>{await ua.promise((async()=>{const o=await(await SUi({circuitJson:t,projectName:e})).generateAsync({type:"blob"});NE(o,{fileName:`${e}_kicad_project.zip`})})(),{loading:"Generating KiCad project...",success:"KiCad project ZIP ready",error:n=>`Failed to generate KiCad project: ${n instanceof Error?n.message:String(n)}`})},kpn=async({circuitJson:t,projectName:e,options:n={}})=>{try{const{convertCircuitJsonToLbrn:o}=await vE("circuit-json-to-lbrn"),r=(await o(t,{includeSilkscreen:n.includeSilkscreen??!1,includeOxidationCleaningLayer:n.includeOxidationCleaningLayer??!0})).toXml(),s=new Blob([r],{type:"application/lbrn"});NE(s,{fileName:`${e}.lbrn2`})}catch(o){const i=o instanceof Error?o.message:"Unknown error";ua.error(`Failed to export to LBRN format: ${i}`)}},vUi=async({circuitJson:t,projectName:e})=>{const{convertCircuitJsonToPinoutSvg:n}=await vE("circuit-to-svg"),o=n(t);NE(o,{fileName:`${e}-pinout.svg`,mimeType:"image/svg+xml"})},wUi=async({circuitJson:t,projectName:e})=>{const{circuitJsonToStep:n}=await vE("circuit-json-to-step"),o=t.find(c=>c.type==="pcb_board"),i=o&&"width"in o?o.width:void 0,r=o&&"height"in o?o.height:void 0,s=o&&"thickness"in o?o.thickness:void 0;if(i===void 0||r===void 0||s===void 0){ua.error("Board dimensions not found. Please add a pcb_board with width, height, and thickness to your circuit.");return}let a;try{a=await n(t,{boardWidth:i,boardHeight:r,boardThickness:s,productName:e,includeComponents:!0,includeExternalMeshes:!0})}catch(c){const l=c instanceof Error?c.message:"Unknown error";ua.error(`Failed to convert circuit to STEP format: ${l}`);return}const A=new Blob([a],{type:"application/step"});try{NE(A,{fileName:`${e}.step`})}catch(c){const l=c instanceof Error?c.message:"Unknown error";ua.error(`Failed to download STEP file: ${l}`)}},PUi=[{extension:"json",name:"Circuit JSON"},{extension:"json",name:"Simple Route JSON"},{extension:"zip",name:"Fabrication Files"},{extension:"zip",name:"KiCad Project"},{extension:"zip",name:"Altium Project"},{extension:"zip",name:"KiCad Library"},{extension:"glb",name:"GLB (Binary GLTF)"},{extension:"svg",name:"Pinout SVG"},{extension:"step",name:"STEP"},{extension:"lbrn2",name:"LightBurn"}],MUi=async({exportName:t,circuitJson:e,simpleRouteJson:n,projectName:o})=>{const i=b$e(o);if(t==="Fabrication Files"){await IUi({circuitJson:e,projectName:i});return}if(t==="KiCad Project"){await QUi({circuitJson:e,projectName:i});return}if(t==="Altium Project"){await mUi({circuitJson:e,projectName:i});return}if(t==="KiCad Library"){await bUi({circuitJson:e,projectName:i});return}if(t==="Circuit JSON"){NE(JSON.stringify(e,null,2),{fileName:`${i}.circuit.json`,mimeType:"application/json"});return}if(t==="Simple Route JSON"){if(!n)throw new Error("No Simple Route JSON available to export");NE(JSON.stringify(n,null,2),{fileName:`${i}.simple-route.json`,mimeType:"application/json"});return}if(t==="GLB (Binary GLTF)"){await EUi({circuitJson:e,projectName:i});return}if(t==="Pinout SVG"){vUi({circuitJson:e,projectName:i});return}if(t==="STEP"){await wUi({circuitJson:e,projectName:i});return}if(t==="Component Box (3MF)"){await xUi({circuitJson:e,projectName:i});return}if(t==="LightBurn"){await kpn({circuitJson:e,projectName:i});return}throw new Error(`Unsupported export type: "${t}"`)},DUi=({packageName:t,onSelectReview:e})=>{const n=md(u=>u.fsMap),o=md(u=>u.circuitJson),[i,r]=ee.useState([]),[s,a]=ee.useState(!1),[A,c]=ee.useState(!1);ee.useEffect(()=>{!t||!Kge()||(a(!0),rq.get("ai_reviews/list",{searchParams:{package_name:t}}).json().then(u=>r(u.ai_reviews)).catch(u=>{console.error("Failed to load AI reviews",u),ua.error("Failed to load AI reviews")}).finally(()=>a(!1)))},[t]);const l=async()=>{if(!o){ua.error("Need Circuit JSON to Request AI Review");return}if(!Kge()){ua.error("Missing registry token");return}c(!0);try{const{ai_review:u}=await rq.post("ai_reviews/create",{json:{package_name:t??"unknown",fs_map:Object.fromEntries(n),circuit_json:o}}).json();r(g=>[u,...g]),e(u),ua.success("AI review requested")}catch(u){console.error("Failed to create AI review",u),ua.error("Failed to request AI review")}finally{c(!1)}};return K.jsxs(K.Fragment,{children:[K.jsxs(UP,{children:[K.jsx(KP,{children:"AI Review"}),K.jsx(OT,{children:"Select an AI review or request a new one."})]}),K.jsx("div",{className:"rf-flex rf-gap-4 rf-mt-4",children:K.jsx("div",{className:"rf-w-48 rf-h-64 rf-overflow-y-auto rf-border rf-rounded rf-p-2 rf-flex-shrink-0",children:s?K.jsx("div",{className:"rf-text-sm",children:"Loading..."}):i.length>0?i.map(u=>K.jsx("div",{className:"rf-text-sm rf-p-2 rf-cursor-pointer rf-rounded hover:rf-bg-zinc-100",onClick:()=>e(u),children:new Date(u.created_at||"").toLocaleString()},u.ai_review_id)):K.jsx("div",{className:"rf-text-sm rf-text-muted-foreground",children:"No AI reviews found."})})}),K.jsx(UU,{className:"rf-mt-4",children:K.jsx(fA,{onClick:l,disabled:A,children:A?"Requesting...":"Review my Board"})})]})};function tqe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var GT=tqe();function Fpn(t){GT=t}var Iee={exec:()=>null};function L0(t,e=""){let n=typeof t=="string"?t:t.source;const o={replace:(i,r)=>{let s=typeof r=="string"?r:r.source;return s=s.replace(u2.caret,"$1"),n=n.replace(i,s),o},getRegex:()=>new RegExp(n,e)};return o}var u2={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},NUi=/^(?:[ \t]*(?:\n|$))+/,RUi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,TUi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Cee=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,kUi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,nqe=/(?:[*+-]|\d{1,9}[.)])/,Lpn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Hpn=L0(Lpn).replace(/bull/g,nqe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),FUi=L0(Lpn).replace(/bull/g,nqe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),oqe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,LUi=/^[^\n]+/,iqe=/(?!\s*\])(?:\\.|[^\[\]\\])+/,HUi=L0(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",iqe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),OUi=L0(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,nqe).getRegex(),Ife="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",rqe=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,GUi=L0("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",rqe).replace("tag",Ife).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Opn=L0(oqe).replace("hr",Cee).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ife).getRegex(),YUi=L0(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Opn).getRegex(),sqe={blockquote:YUi,code:RUi,def:HUi,fences:TUi,heading:kUi,hr:Cee,html:GUi,lheading:Hpn,list:OUi,newline:NUi,paragraph:Opn,table:Iee,text:LUi},Gpn=L0("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Cee).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ife).getRegex(),UUi={...sqe,lheading:FUi,table:Gpn,paragraph:L0(oqe).replace("hr",Cee).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Gpn).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ife).getRegex()},KUi={...sqe,html:L0(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",rqe).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Iee,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:L0(oqe).replace("hr",Cee).replace("heading",` *#{1,6} *[^
|
|
5674
5674
|
]`).replace("lheading",Hpn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},VUi=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zUi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ypn=/^( {2,}|\\)\n(?!\s*$)/,JUi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Cfe=/[\p{P}\p{S}]/u,aqe=/[\s\p{P}\p{S}]/u,Upn=/[^\s\p{P}\p{S}]/u,WUi=L0(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,aqe).getRegex(),Kpn=/(?!~)[\p{P}\p{S}]/u,jUi=/(?!~)[\s\p{P}\p{S}]/u,$Ui=/(?:[^\s\p{P}\p{S}]|~)/u,qUi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Vpn=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,XUi=L0(Vpn,"u").replace(/punct/g,Cfe).getRegex(),ZUi=L0(Vpn,"u").replace(/punct/g,Kpn).getRegex(),zpn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",eKi=L0(zpn,"gu").replace(/notPunctSpace/g,Upn).replace(/punctSpace/g,aqe).replace(/punct/g,Cfe).getRegex(),tKi=L0(zpn,"gu").replace(/notPunctSpace/g,$Ui).replace(/punctSpace/g,jUi).replace(/punct/g,Kpn).getRegex(),nKi=L0("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Upn).replace(/punctSpace/g,aqe).replace(/punct/g,Cfe).getRegex(),oKi=L0(/\\(punct)/,"gu").replace(/punct/g,Cfe).getRegex(),iKi=L0(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),rKi=L0(rqe).replace("(?:-->|$)","-->").getRegex(),sKi=L0("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",rKi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),yfe=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,aKi=L0(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",yfe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Jpn=L0(/^!?\[(label)\]\[(ref)\]/).replace("label",yfe).replace("ref",iqe).getRegex(),Wpn=L0(/^!?\[(ref)\](?:\[\])?/).replace("ref",iqe).getRegex(),AKi=L0("reflink|nolink(?!\\()","g").replace("reflink",Jpn).replace("nolink",Wpn).getRegex(),Aqe={_backpedal:Iee,anyPunctuation:oKi,autolink:iKi,blockSkip:qUi,br:Ypn,code:zUi,del:Iee,emStrongLDelim:XUi,emStrongRDelimAst:eKi,emStrongRDelimUnd:nKi,escape:VUi,link:aKi,nolink:Wpn,punctuation:WUi,reflink:Jpn,reflinkSearch:AKi,tag:sKi,text:JUi,url:Iee},cKi={...Aqe,link:L0(/^!?\[(label)\]\((.*?)\)/).replace("label",yfe).getRegex(),reflink:L0(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",yfe).getRegex()},cqe={...Aqe,emStrongRDelimAst:tKi,emStrongLDelim:ZUi,url:L0(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},lKi={...cqe,br:L0(Ypn).replace("{2,}","*").getRegex(),text:L0(cqe.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},xfe={normal:sqe,gfm:UUi,pedantic:KUi},yee={normal:Aqe,gfm:cqe,breaks:lKi,pedantic:cKi},uKi={"&":"&","<":"<",">":">",'"':""","'":"'"},jpn=t=>uKi[t];function t8(t,e){if(e){if(u2.escapeTest.test(t))return t.replace(u2.escapeReplace,jpn)}else if(u2.escapeTestNoEncode.test(t))return t.replace(u2.escapeReplaceNoEncode,jpn);return t}function $pn(t){try{t=encodeURI(t).replace(u2.percentDecode,"%")}catch{return null}return t}function qpn(t,e){const n=t.replace(u2.findPipe,(r,s,a)=>{let A=!1,c=s;for(;--c>=0&&a[c]==="\\";)A=!A;return A?"|":" |"}),o=n.split(u2.splitPipe);let i=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),e)if(o.length>e)o.splice(e);else for(;o.length<e;)o.push("");for(;i<o.length;i++)o[i]=o[i].trim().replace(u2.slashPipe,"|");return o}function xee(t,e,n){const o=t.length;if(o===0)return"";let i=0;for(;i<o&&t.charAt(o-i-1)===e;)i++;return t.slice(0,o-i)}function gKi(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let o=0;o<t.length;o++)if(t[o]==="\\")o++;else if(t[o]===e[0])n++;else if(t[o]===e[1]&&(n--,n<0))return o;return n>0?-2:-1}function Xpn(t,e,n,o,i){const r=e.href,s=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");o.state.inLink=!0;const A={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:r,title:s,text:a,tokens:o.inlineTokens(a)};return o.state.inLink=!1,A}function dKi(t,e,n){const o=t.match(n.other.indentCodeCompensation);if(o===null)return e;const i=o[1];return e.split(`
|