rivet-design 0.13.0 → 0.13.2
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/agent-variants/SessionStore.d.ts +2 -1
- package/dist/agent-variants/SessionStore.d.ts.map +1 -1
- package/dist/agent-variants/SessionStore.js +10 -5
- package/dist/agent-variants/SessionStore.js.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.d.ts +5 -4
- package/dist/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.js +8 -8
- package/dist/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/agent-variants/contracts.d.ts +1 -1
- package/dist/agent-variants/contracts.js +2 -2
- package/dist/agent-variants/contracts.js.map +1 -1
- package/dist/cli/commands/mcpServe.d.ts.map +1 -1
- package/dist/cli/commands/mcpServe.js +50 -5
- package/dist/cli/commands/mcpServe.js.map +1 -1
- package/dist/cli/commands/variants.d.ts.map +1 -1
- package/dist/cli/commands/variants.js +78 -17
- package/dist/cli/commands/variants.js.map +1 -1
- package/dist/mcp/changeBatchClassification.d.ts +3 -1
- package/dist/mcp/changeBatchClassification.d.ts.map +1 -1
- package/dist/mcp/changeBatchClassification.js +5 -0
- package/dist/mcp/changeBatchClassification.js.map +1 -1
- package/dist/routes/agentVariants.d.ts.map +1 -1
- package/dist/routes/agentVariants.js +46 -1
- package/dist/routes/agentVariants.js.map +1 -1
- package/dist/routes/static.d.ts.map +1 -1
- package/dist/routes/static.js +77 -8
- package/dist/routes/static.js.map +1 -1
- package/dist/services/VariantGenerationService.d.ts +0 -7
- package/dist/services/VariantGenerationService.d.ts.map +1 -1
- package/dist/services/VariantGenerationService.js +6 -64
- package/dist/services/VariantGenerationService.js.map +1 -1
- package/dist/services/VariantRunService.d.ts.map +1 -1
- package/dist/services/VariantRunService.js +2 -1
- package/dist/services/VariantRunService.js.map +1 -1
- package/dist/types/change-request-types.d.ts +10 -4
- package/dist/types/change-request-types.d.ts.map +1 -1
- package/dist/utils/skills/claude-skill.d.ts +2 -2
- package/dist/utils/skills/claude-skill.d.ts.map +1 -1
- package/dist/utils/skills/claude-skill.js +1 -1
- package/dist/utils/skills/cli-guidance.d.ts +2 -2
- package/dist/utils/skills/cli-guidance.d.ts.map +1 -1
- package/dist/utils/skills/cli-guidance.js +7 -5
- package/dist/utils/skills/cli-guidance.js.map +1 -1
- package/dist/utils/skills/cursor-rules.d.ts +2 -2
- package/dist/utils/skills/cursor-rules.d.ts.map +1 -1
- package/dist/utils/skills/cursor-rules.js +1 -1
- package/package.json +1 -1
- package/src/ui/dist/assets/{main-BWOvFoal.js → main-BBHg643G.js} +3 -3
- package/src/ui/dist/index.html +1 -1
|
@@ -14,7 +14,7 @@ var $M=Object.defineProperty;var dS=t=>{throw TypeError(t)};var HM=(t,e,n)=>e in
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var pS;function BM(){if(pS)return Dc;pS=1;var t=U_(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(u,c,f){var h,p={},v=null,y=null;f!==void 0&&(v=""+f),c.key!==void 0&&(v=""+c.key),c.ref!==void 0&&(y=c.ref);for(h in c)r.call(c,h)&&!i.hasOwnProperty(h)&&(p[h]=c[h]);if(u&&u.defaultProps)for(h in c=u.defaultProps,c)p[h]===void 0&&(p[h]=c[h]);return{$$typeof:e,type:u,key:v,ref:y,props:p,_owner:s.current}}return Dc.Fragment=n,Dc.jsx=a,Dc.jsxs=a,Dc}var mS;function WM(){return mS||(mS=1,sv.exports=BM()),sv.exports}var S=WM(),g=U_();const ve=$m(g),B_=zM({__proto__:null,default:ve},[g]);var uf=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ga,To,mu,GC,GM=(GC=class extends uf{constructor(){super();Ue(this,Ga);Ue(this,To);Ue(this,mu);Ae(this,mu,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){W(this,To)||this.setEventListener(W(this,mu))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,To))==null||e.call(this),Ae(this,To,void 0))}setEventListener(e){var n;Ae(this,mu,e),(n=W(this,To))==null||n.call(this),Ae(this,To,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){W(this,Ga)!==e&&(Ae(this,Ga,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof W(this,Ga)=="boolean"?W(this,Ga):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ga=new WeakMap,To=new WeakMap,mu=new WeakMap,GC),W_=new GM,KM={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Ao,z_,KC,ZM=(KC=class{constructor(){Ue(this,Ao,KM);Ue(this,z_,!1)}setTimeoutProvider(t){Ae(this,Ao,t)}setTimeout(t,e){return W(this,Ao).setTimeout(t,e)}clearTimeout(t){W(this,Ao).clearTimeout(t)}setInterval(t,e){return W(this,Ao).setInterval(t,e)}clearInterval(t){W(this,Ao).clearInterval(t)}},Ao=new WeakMap,z_=new WeakMap,KC),Ha=new ZM;function qM(t){setTimeout(t,0)}var YM=typeof window>"u"||"Deno"in globalThis;function _r(){}function XM(t,e){return typeof t=="function"?t(e):t}function P1(t){return typeof t=="number"&&t>=0&&t!==1/0}function n8(t,e){return Math.max(t+(e||0)-Date.now(),0)}function zo(t,e){return typeof t=="function"?t(e):t}function Nr(t,e){return typeof t=="function"?t(e):t}function gS(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:u}=t;if(a){if(r){if(e.queryHash!==G_(a,e.options))return!1}else if(!Cd(e.queryKey,a))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||s&&s!==e.state.fetchStatus||i&&!i(e))}function vS(t,e){const{exact:n,status:r,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(kd(e.options.mutationKey)!==kd(i))return!1}else if(!Cd(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function G_(t,e){return((e==null?void 0:e.queryKeyHashFn)||kd)(t)}function kd(t){return JSON.stringify(t,(e,n)=>A1(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Cd(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Cd(t[n],e[n])):!1}var QM=Object.prototype.hasOwnProperty;function r8(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=yS(t)&&yS(e);if(!r&&!(A1(t)&&A1(e)))return e;const i=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),u=a.length,c=r?new Array(u):{};let f=0;for(let h=0;h<u;h++){const p=r?h:a[h],v=t[p],y=e[p];if(v===y){c[p]=v,(r?h<i:QM.call(t,p))&&f++;continue}if(v===null||y===null||typeof v!="object"||typeof y!="object"){c[p]=y;continue}const x=r8(v,y,n+1);c[p]=x,x===v&&f++}return i===u&&f===i?t:c}function T1(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function yS(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function A1(t){if(!_S(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!_S(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function _S(t){return Object.prototype.toString.call(t)==="[object Object]"}function JM(t){return new Promise(e=>{Ha.setTimeout(e,t)})}function R1(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?r8(t,e):e}function eL(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function tL(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var K_=Symbol();function s8(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===K_?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function i8(t,e){return typeof t=="function"?t(...e):!!t}function nL(t,e,n){let r=!1,s;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(s??(s=e()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),t}var Pd=(()=>{let t=()=>YM;return{isServer(){return t()},setIsServer(e){t=e}}})();function I1(){let t,e;const n=new Promise((s,i)=>{t=s,e=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}var rL=qM;function sL(){let t=[],e=0,n=u=>{u()},r=u=>{u()},s=rL;const i=u=>{e?t.push(u):s(()=>{n(u)})},a=()=>{const u=t;t=[],u.length&&s(()=>{r(()=>{u.forEach(c=>{n(c)})})})};return{batch:u=>{let c;e++;try{c=u()}finally{e--,e||a()}return c},batchCalls:u=>(...c)=>{i(()=>{u(...c)})},schedule:i,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{s=u}}}var Fn=sL(),gu,Ro,vu,ZC,iL=(ZC=class extends uf{constructor(){super();Ue(this,gu,!0);Ue(this,Ro);Ue(this,vu);Ae(this,vu,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){W(this,Ro)||this.setEventListener(W(this,vu))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,Ro))==null||e.call(this),Ae(this,Ro,void 0))}setEventListener(e){var n;Ae(this,vu,e),(n=W(this,Ro))==null||n.call(this),Ae(this,Ro,e(this.setOnline.bind(this)))}setOnline(e){W(this,gu)!==e&&(Ae(this,gu,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return W(this,gu)}},gu=new WeakMap,Ro=new WeakMap,vu=new WeakMap,ZC),Fp=new iL;function oL(t){return Math.min(1e3*2**t,3e4)}function o8(t){return(t??"online")==="online"?Fp.isOnline():!0}var M1=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function a8(t){let e=!1,n=0,r;const s=I1(),i=()=>s.status!=="pending",a=_=>{var b;if(!i()){const E=new M1(_);v(E),(b=t.onCancel)==null||b.call(t,E)}},u=()=>{e=!0},c=()=>{e=!1},f=()=>W_.isFocused()&&(t.networkMode==="always"||Fp.isOnline())&&t.canRun(),h=()=>o8(t.networkMode)&&t.canRun(),p=_=>{i()||(r==null||r(),s.resolve(_))},v=_=>{i()||(r==null||r(),s.reject(_))},y=()=>new Promise(_=>{var b;r=E=>{(i()||f())&&_(E)},(b=t.onPause)==null||b.call(t)}).then(()=>{var _;r=void 0,i()||(_=t.onContinue)==null||_.call(t)}),x=()=>{if(i())return;let _;const b=n===0?t.initialPromise:void 0;try{_=b??t.fn()}catch(E){_=Promise.reject(E)}Promise.resolve(_).then(p).catch(E=>{var O;if(i())return;const C=t.retry??(Pd.isServer()?0:3),P=t.retryDelay??oL,T=typeof P=="function"?P(n,E):P,A=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,E);if(e||!A){v(E);return}n++,(O=t.onFail)==null||O.call(t,n,E),JM(T).then(()=>f()?void 0:y()).then(()=>{e?v(E):x()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(r==null||r(),s),cancelRetry:u,continueRetry:c,canStart:h,start:()=>(h()?x():y().then(x),s)}}var Ka,qC,l8=(qC=class{constructor(){Ue(this,Ka)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),P1(this.gcTime)&&Ae(this,Ka,Ha.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Pd.isServer()?1/0:300*1e3))}clearGcTimeout(){W(this,Ka)!==void 0&&(Ha.clearTimeout(W(this,Ka)),Ae(this,Ka,void 0))}},Ka=new WeakMap,qC);function aL(t){return{onFetch:(e,n)=>{var h,p,v,y,x;const r=e.options,s=(v=(p=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:v.direction,i=((y=e.state.data)==null?void 0:y.pages)||[],a=((x=e.state.data)==null?void 0:x.pageParams)||[];let u={pages:[],pageParams:[]},c=0;const f=async()=>{let _=!1;const b=P=>{nL(P,()=>e.signal,()=>_=!0)},E=s8(e.options,e.fetchOptions),C=async(P,T,A)=>{if(_)return Promise.reject(e.signal.reason);if(T==null&&P.pages.length)return Promise.resolve(P);const M=(()=>{const j={client:e.client,queryKey:e.queryKey,pageParam:T,direction:A?"backward":"forward",meta:e.options.meta};return b(j),j})(),R=await E(M),{maxPages:L}=e.options,N=A?tL:eL;return{pages:N(P.pages,R,L),pageParams:N(P.pageParams,T,L)}};if(s&&i.length){const P=s==="backward",T=P?lL:xS,A={pages:i,pageParams:a},O=T(r,A);u=await C(A,O,P)}else{const P=t??i.length;do{const T=c===0?a[0]??r.initialPageParam:xS(r,u);if(c>0&&T==null)break;u=await C(u,T),c++}while(c<P)}return u};e.options.persister?e.fetchFn=()=>{var _,b;return(b=(_=e.options).persister)==null?void 0:b.call(_,f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=f}}}function xS(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function lL(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var yu,Za,_u,is,qa,Pn,rf,Ya,Or,u8,Mi,YC,uL=(YC=class extends l8{constructor(e){super();Ue(this,Or);Ue(this,yu);Ue(this,Za);Ue(this,_u);Ue(this,is);Ue(this,qa);Ue(this,Pn);Ue(this,rf);Ue(this,Ya);Ae(this,Ya,!1),Ae(this,rf,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ae(this,qa,e.client),Ae(this,is,W(this,qa).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ae(this,Za,bS(this.options)),this.state=e.state??W(this,Za),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return W(this,yu)}get promise(){var e;return(e=W(this,Pn))==null?void 0:e.promise}setOptions(e){if(this.options={...W(this,rf),...e},e!=null&&e._type&&Ae(this,yu,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=bS(this.options);n.data!==void 0&&(this.setState(wS(n.data,n.dataUpdatedAt)),Ae(this,Za,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&W(this,is).remove(this)}setData(e,n){const r=R1(this.state.data,e,this.options);return ot(this,Or,Mi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){ot(this,Or,Mi).call(this,{type:"setState",state:e})}cancel(e){var r,s;const n=(r=W(this,Pn))==null?void 0:r.promise;return(s=W(this,Pn))==null||s.cancel(e),n?n.then(_r).catch(_r):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return W(this,Za)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Nr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===K_||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>zo(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!n8(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=W(this,Pn))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=W(this,Pn))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),W(this,is).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(W(this,Pn)&&(W(this,Ya)||ot(this,Or,u8).call(this)?W(this,Pn).cancel({revert:!0}):W(this,Pn).cancelRetry()),this.scheduleGc()),W(this,is).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ot(this,Or,Mi).call(this,{type:"invalidate"})}async fetch(e,n){var f,h,p,v,y,x,_,b,E,C,P;if(this.state.fetchStatus!=="idle"&&((f=W(this,Pn))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(W(this,Pn))return W(this,Pn).continueRetry(),W(this,Pn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const T=this.observers.find(A=>A.options.queryFn);T&&this.setOptions(T.options)}const r=new AbortController,s=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(Ae(this,Ya,!0),r.signal)})},i=()=>{const T=s8(this.options,n),O=(()=>{const M={client:W(this,qa),queryKey:this.queryKey,meta:this.meta};return s(M),M})();return Ae(this,Ya,!1),this.options.persister?this.options.persister(T,O,this):T(O)},u=(()=>{const T={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:W(this,qa),state:this.state,fetchFn:i};return s(T),T})(),c=W(this,yu)==="infinite"?aL(this.options.pages):this.options.behavior;c==null||c.onFetch(u,this),Ae(this,_u,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&ot(this,Or,Mi).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),Ae(this,Pn,a8({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:T=>{T instanceof M1&&T.revert&&this.setState({...W(this,_u),fetchStatus:"idle"}),r.abort()},onFail:(T,A)=>{ot(this,Or,Mi).call(this,{type:"failed",failureCount:T,error:A})},onPause:()=>{ot(this,Or,Mi).call(this,{type:"pause"})},onContinue:()=>{ot(this,Or,Mi).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const T=await W(this,Pn).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(y=(v=W(this,is).config).onSuccess)==null||y.call(v,T,this),(_=(x=W(this,is).config).onSettled)==null||_.call(x,T,this.state.error,this),T}catch(T){if(T instanceof M1){if(T.silent)return W(this,Pn).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw ot(this,Or,Mi).call(this,{type:"error",error:T}),(E=(b=W(this,is).config).onError)==null||E.call(b,T,this),(P=(C=W(this,is).config).onSettled)==null||P.call(C,this.state.data,T,this),T}finally{this.scheduleGc()}}},yu=new WeakMap,Za=new WeakMap,_u=new WeakMap,is=new WeakMap,qa=new WeakMap,Pn=new WeakMap,rf=new WeakMap,Ya=new WeakMap,Or=new WeakSet,u8=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Mi=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...c8(r.data,this.options),fetchMeta:e.meta??null};case"success":const s={...r,...wS(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ae(this,_u,e.manual?s:void 0),s;case"error":const i=e.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Fn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),W(this,is).notify({query:this,type:"updated",action:e})})},YC);function c8(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:o8(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function wS(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bS(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var gr,ut,sf,rr,Xa,xu,$i,Io,of,wu,bu,Qa,Ja,Mo,Su,pt,ed,L1,O1,N1,D1,j1,F1,V1,d8,XC,cL=(XC=class extends uf{constructor(e,n){super();Ue(this,pt);Ue(this,gr);Ue(this,ut);Ue(this,sf);Ue(this,rr);Ue(this,Xa);Ue(this,xu);Ue(this,$i);Ue(this,Io);Ue(this,of);Ue(this,wu);Ue(this,bu);Ue(this,Qa);Ue(this,Ja);Ue(this,Mo);Ue(this,Su,new Set);this.options=n,Ae(this,gr,e),Ae(this,Io,null),Ae(this,$i,I1()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(W(this,ut).addObserver(this),SS(W(this,ut),this.options)?ot(this,pt,ed).call(this):this.updateResult(),ot(this,pt,D1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $1(W(this,ut),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $1(W(this,ut),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ot(this,pt,j1).call(this),ot(this,pt,F1).call(this),W(this,ut).removeObserver(this)}setOptions(e){const n=this.options,r=W(this,ut);if(this.options=W(this,gr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Nr(this.options.enabled,W(this,ut))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ot(this,pt,V1).call(this),W(this,ut).setOptions(this.options),n._defaulted&&!T1(this.options,n)&&W(this,gr).getQueryCache().notify({type:"observerOptionsUpdated",query:W(this,ut),observer:this});const s=this.hasListeners();s&&ES(W(this,ut),r,this.options,n)&&ot(this,pt,ed).call(this),this.updateResult(),s&&(W(this,ut)!==r||Nr(this.options.enabled,W(this,ut))!==Nr(n.enabled,W(this,ut))||zo(this.options.staleTime,W(this,ut))!==zo(n.staleTime,W(this,ut)))&&ot(this,pt,L1).call(this);const i=ot(this,pt,O1).call(this);s&&(W(this,ut)!==r||Nr(this.options.enabled,W(this,ut))!==Nr(n.enabled,W(this,ut))||i!==W(this,Mo))&&ot(this,pt,N1).call(this,i)}getOptimisticResult(e){const n=W(this,gr).getQueryCache().build(W(this,gr),e),r=this.createResult(n,e);return fL(this,r)&&(Ae(this,rr,r),Ae(this,xu,this.options),Ae(this,Xa,W(this,ut).state)),r}getCurrentResult(){return W(this,rr)}trackResult(e,n){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&W(this,$i).status==="pending"&&W(this,$i).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(e){W(this,Su).add(e)}getCurrentQuery(){return W(this,ut)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=W(this,gr).defaultQueryOptions(e),r=W(this,gr).getQueryCache().build(W(this,gr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return ot(this,pt,ed).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),W(this,rr)))}createResult(e,n){var L;const r=W(this,ut),s=this.options,i=W(this,rr),a=W(this,Xa),u=W(this,xu),f=e!==r?e.state:W(this,sf),{state:h}=e;let p={...h},v=!1,y;if(n._optimisticResults){const N=this.hasListeners(),j=!N&&SS(e,n),V=N&&ES(e,r,n,s);(j||V)&&(p={...p,...c8(h.data,e.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:_,status:b}=p;y=p.data;let E=!1;if(n.placeholderData!==void 0&&y===void 0&&b==="pending"){let N;i!=null&&i.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(N=i.data,E=!0):N=typeof n.placeholderData=="function"?n.placeholderData((L=W(this,bu))==null?void 0:L.state.data,W(this,bu)):n.placeholderData,N!==void 0&&(b="success",y=R1(i==null?void 0:i.data,N,n),v=!0)}if(n.select&&y!==void 0&&!E)if(i&&y===(a==null?void 0:a.data)&&n.select===W(this,of))y=W(this,wu);else try{Ae(this,of,n.select),y=n.select(y),y=R1(i==null?void 0:i.data,y,n),Ae(this,wu,y),Ae(this,Io,null)}catch(N){Ae(this,Io,N)}W(this,Io)&&(x=W(this,Io),y=W(this,wu),_=Date.now(),b="error");const C=p.fetchStatus==="fetching",P=b==="pending",T=b==="error",A=P&&C,O=y!==void 0,R={status:b,fetchStatus:p.fetchStatus,isPending:P,isSuccess:b==="success",isError:T,isInitialLoading:A,isLoading:A,data:y,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:C,isRefetching:C&&!P,isLoadingError:T&&!O,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:T&&O,isStale:Z_(e,n),refetch:this.refetch,promise:W(this,$i),isEnabled:Nr(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const N=R.data!==void 0,j=R.status==="error"&&!N,V=K=>{j?K.reject(R.error):N&&K.resolve(R.data)},G=()=>{const K=Ae(this,$i,R.promise=I1());V(K)},Y=W(this,$i);switch(Y.status){case"pending":e.queryHash===r.queryHash&&V(Y);break;case"fulfilled":(j||R.data!==Y.value)&&G();break;case"rejected":(!j||R.error!==Y.reason)&&G();break}}return R}updateResult(){const e=W(this,rr),n=this.createResult(W(this,ut),this.options);if(Ae(this,Xa,W(this,ut).state),Ae(this,xu,this.options),W(this,Xa).data!==void 0&&Ae(this,bu,W(this,ut)),T1(n,e))return;Ae(this,rr,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!W(this,Su).size)return!0;const a=new Set(i??W(this,Su));return this.options.throwOnError&&a.add("error"),Object.keys(W(this,rr)).some(u=>{const c=u;return W(this,rr)[c]!==e[c]&&a.has(c)})};ot(this,pt,d8).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ot(this,pt,D1).call(this)}},gr=new WeakMap,ut=new WeakMap,sf=new WeakMap,rr=new WeakMap,Xa=new WeakMap,xu=new WeakMap,$i=new WeakMap,Io=new WeakMap,of=new WeakMap,wu=new WeakMap,bu=new WeakMap,Qa=new WeakMap,Ja=new WeakMap,Mo=new WeakMap,Su=new WeakMap,pt=new WeakSet,ed=function(e){ot(this,pt,V1).call(this);let n=W(this,ut).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(_r)),n},L1=function(){ot(this,pt,j1).call(this);const e=zo(this.options.staleTime,W(this,ut));if(Pd.isServer()||W(this,rr).isStale||!P1(e))return;const r=n8(W(this,rr).dataUpdatedAt,e)+1;Ae(this,Qa,Ha.setTimeout(()=>{W(this,rr).isStale||this.updateResult()},r))},O1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(W(this,ut)):this.options.refetchInterval)??!1},N1=function(e){ot(this,pt,F1).call(this),Ae(this,Mo,e),!(Pd.isServer()||Nr(this.options.enabled,W(this,ut))===!1||!P1(W(this,Mo))||W(this,Mo)===0)&&Ae(this,Ja,Ha.setInterval(()=>{(this.options.refetchIntervalInBackground||W_.isFocused())&&ot(this,pt,ed).call(this)},W(this,Mo)))},D1=function(){ot(this,pt,L1).call(this),ot(this,pt,N1).call(this,ot(this,pt,O1).call(this))},j1=function(){W(this,Qa)!==void 0&&(Ha.clearTimeout(W(this,Qa)),Ae(this,Qa,void 0))},F1=function(){W(this,Ja)!==void 0&&(Ha.clearInterval(W(this,Ja)),Ae(this,Ja,void 0))},V1=function(){const e=W(this,gr).getQueryCache().build(W(this,gr),this.options);if(e===W(this,ut))return;const n=W(this,ut);Ae(this,ut,e),Ae(this,sf,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},d8=function(e){Fn.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(W(this,rr))}),W(this,gr).getQueryCache().notify({query:W(this,ut),type:"observerResultsUpdated"})})},XC);function dL(t,e){return Nr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Nr(e.retryOnMount,t)===!1)}function SS(t,e){return dL(t,e)||t.state.data!==void 0&&$1(t,e,e.refetchOnMount)}function $1(t,e,n){if(Nr(e.enabled,t)!==!1&&zo(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Z_(t,e)}return!1}function ES(t,e,n,r){return(t!==e||Nr(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Z_(t,n)}function Z_(t,e){return Nr(e.enabled,t)!==!1&&t.isStaleByTime(zo(e.staleTime,t))}function fL(t,e){return!T1(t.getCurrentResult(),e)}var af,Xs,Zn,el,Qs,ko,QC,hL=(QC=class extends l8{constructor(e){super();Ue(this,Qs);Ue(this,af);Ue(this,Xs);Ue(this,Zn);Ue(this,el);Ae(this,af,e.client),this.mutationId=e.mutationId,Ae(this,Zn,e.mutationCache),Ae(this,Xs,[]),this.state=e.state||pL(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){W(this,Xs).includes(e)||(W(this,Xs).push(e),this.clearGcTimeout(),W(this,Zn).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ae(this,Xs,W(this,Xs).filter(n=>n!==e)),this.scheduleGc(),W(this,Zn).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){W(this,Xs).length||(this.state.status==="pending"?this.scheduleGc():W(this,Zn).remove(this))}continue(){var e;return((e=W(this,el))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,u,c,f,h,p,v,y,x,_,b,E,C,P,T,A,O,M;const n=()=>{ot(this,Qs,ko).call(this,{type:"continue"})},r={client:W(this,af),meta:this.options.meta,mutationKey:this.options.mutationKey};Ae(this,el,a8({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,L)=>{ot(this,Qs,ko).call(this,{type:"failed",failureCount:R,error:L})},onPause:()=>{ot(this,Qs,ko).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>W(this,Zn).canRun(this)}));const s=this.state.status==="pending",i=!W(this,el).canStart();try{if(s)n();else{ot(this,Qs,ko).call(this,{type:"pending",variables:e,isPaused:i}),W(this,Zn).config.onMutate&&await W(this,Zn).config.onMutate(e,this,r);const L=await((u=(a=this.options).onMutate)==null?void 0:u.call(a,e,r));L!==this.state.context&&ot(this,Qs,ko).call(this,{type:"pending",context:L,variables:e,isPaused:i})}const R=await W(this,el).start();return await((f=(c=W(this,Zn).config).onSuccess)==null?void 0:f.call(c,R,e,this.state.context,this,r)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,R,e,this.state.context,r)),await((y=(v=W(this,Zn).config).onSettled)==null?void 0:y.call(v,R,null,this.state.variables,this.state.context,this,r)),await((_=(x=this.options).onSettled)==null?void 0:_.call(x,R,null,e,this.state.context,r)),ot(this,Qs,ko).call(this,{type:"success",data:R}),R}catch(R){try{await((E=(b=W(this,Zn).config).onError)==null?void 0:E.call(b,R,e,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((P=(C=this.options).onError)==null?void 0:P.call(C,R,e,this.state.context,r))}catch(L){Promise.reject(L)}try{await((A=(T=W(this,Zn).config).onSettled)==null?void 0:A.call(T,void 0,R,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((M=(O=this.options).onSettled)==null?void 0:M.call(O,void 0,R,e,this.state.context,r))}catch(L){Promise.reject(L)}throw ot(this,Qs,ko).call(this,{type:"error",error:R}),R}finally{W(this,Zn).runNext(this)}}},af=new WeakMap,Xs=new WeakMap,Zn=new WeakMap,el=new WeakMap,Qs=new WeakSet,ko=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fn.batch(()=>{W(this,Xs).forEach(r=>{r.onMutationUpdate(e)}),W(this,Zn).notify({mutation:this,type:"updated",action:e})})},QC);function pL(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hi,Ps,lf,JC,mL=(JC=class extends uf{constructor(e={}){super();Ue(this,Hi);Ue(this,Ps);Ue(this,lf);this.config=e,Ae(this,Hi,new Set),Ae(this,Ps,new Map),Ae(this,lf,0)}build(e,n,r){const s=new hL({client:e,mutationCache:this,mutationId:++Ch(this,lf)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){W(this,Hi).add(e);const n=Ph(e);if(typeof n=="string"){const r=W(this,Ps).get(n);r?r.push(e):W(this,Ps).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(W(this,Hi).delete(e)){const n=Ph(e);if(typeof n=="string"){const r=W(this,Ps).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&W(this,Ps).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Ph(e);if(typeof n=="string"){const r=W(this,Ps).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=Ph(e);if(typeof n=="string"){const s=(r=W(this,Ps).get(n))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fn.batch(()=>{W(this,Hi).forEach(e=>{this.notify({type:"removed",mutation:e})}),W(this,Hi).clear(),W(this,Ps).clear()})}getAll(){return Array.from(W(this,Hi))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>vS(n,r))}findAll(e={}){return this.getAll().filter(n=>vS(e,n))}notify(e){Fn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Fn.batch(()=>Promise.all(e.map(n=>n.continue().catch(_r))))}},Hi=new WeakMap,Ps=new WeakMap,lf=new WeakMap,JC);function Ph(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Js,e8,gL=(e8=class extends uf{constructor(e={}){super();Ue(this,Js);this.config=e,Ae(this,Js,new Map)}build(e,n,r){const s=n.queryKey,i=n.queryHash??G_(s,n);let a=this.get(i);return a||(a=new uL({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(a)),a}add(e){W(this,Js).has(e.queryHash)||(W(this,Js).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=W(this,Js).get(e.queryHash);n&&(e.destroy(),n===e&&W(this,Js).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return W(this,Js).get(e)}getAll(){return[...W(this,Js).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>gS(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>gS(e,r)):n}notify(e){Fn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Js=new WeakMap,e8),Qt,Lo,Oo,Eu,ku,No,Cu,Pu,t8,vL=(t8=class{constructor(t={}){Ue(this,Qt);Ue(this,Lo);Ue(this,Oo);Ue(this,Eu);Ue(this,ku);Ue(this,No);Ue(this,Cu);Ue(this,Pu);Ae(this,Qt,t.queryCache||new gL),Ae(this,Lo,t.mutationCache||new mL),Ae(this,Oo,t.defaultOptions||{}),Ae(this,Eu,new Map),Ae(this,ku,new Map),Ae(this,No,0)}mount(){Ch(this,No)._++,W(this,No)===1&&(Ae(this,Cu,W_.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,Qt).onFocus())})),Ae(this,Pu,Fp.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,Qt).onOnline())})))}unmount(){var t,e;Ch(this,No)._--,W(this,No)===0&&((t=W(this,Cu))==null||t.call(this),Ae(this,Cu,void 0),(e=W(this,Pu))==null||e.call(this),Ae(this,Pu,void 0))}isFetching(t){return W(this,Qt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return W(this,Lo).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=W(this,Qt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=W(this,Qt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(zo(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return W(this,Qt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=W(this,Qt).get(r.queryHash),i=s==null?void 0:s.state.data,a=XM(e,i);if(a!==void 0)return W(this,Qt).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return Fn.batch(()=>W(this,Qt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=W(this,Qt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=W(this,Qt);Fn.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=W(this,Qt);return Fn.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Fn.batch(()=>W(this,Qt).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(_r).catch(_r)}invalidateQueries(t,e={}){return Fn.batch(()=>(W(this,Qt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Fn.batch(()=>W(this,Qt).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(_r)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(_r)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=W(this,Qt).build(this,e);return n.isStaleByTime(zo(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(_r).catch(_r)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(_r).catch(_r)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Fp.isOnline()?W(this,Lo).resumePausedMutations():Promise.resolve()}getQueryCache(){return W(this,Qt)}getMutationCache(){return W(this,Lo)}getDefaultOptions(){return W(this,Oo)}setDefaultOptions(t){Ae(this,Oo,t)}setQueryDefaults(t,e){W(this,Eu).set(kd(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...W(this,Eu).values()],n={};return e.forEach(r=>{Cd(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){W(this,ku).set(kd(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...W(this,ku).values()],n={};return e.forEach(r=>{Cd(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...W(this,Oo).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=G_(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===K_&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...W(this,Oo).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){W(this,Qt).clear(),W(this,Lo).clear()}},Qt=new WeakMap,Lo=new WeakMap,Oo=new WeakMap,Eu=new WeakMap,ku=new WeakMap,No=new WeakMap,Cu=new WeakMap,Pu=new WeakMap,t8),f8=g.createContext(void 0),h8=t=>{const e=g.useContext(f8);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},yL=({client:t,children:e})=>(g.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),S.jsx(f8.Provider,{value:t,children:e})),p8=g.createContext(!1),_L=()=>g.useContext(p8);p8.Provider;function xL(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var wL=g.createContext(xL()),bL=()=>g.useContext(wL),SL=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?i8(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},EL=t=>{g.useEffect(()=>{t.clearReset()},[t])},kL=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||i8(n,[t.error,r])),CL=t=>{if(t.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},PL=(t,e)=>t.isLoading&&t.isFetching&&!e,TL=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,kS=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function AL(t,e,n){var y,x,_,b;const r=_L(),s=bL(),i=h8(),a=i.defaultQueryOptions(t);(x=(y=i.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,a);const u=i.getQueryCache().get(a.queryHash),c=t.subscribed!==!1;a._optimisticResults=r?"isRestoring":c?"optimistic":void 0,CL(a),SL(a,s,u),EL(s);const f=!i.getQueryCache().get(a.queryHash),[h]=g.useState(()=>new e(i,a)),p=h.getOptimisticResult(a),v=!r&&c;if(g.useSyncExternalStore(g.useCallback(E=>{const C=v?h.subscribe(Fn.batchCalls(E)):_r;return h.updateResult(),C},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),g.useEffect(()=>{h.setOptions(a)},[a,h]),TL(a,p))throw kS(a,h,s);if(kL({result:p,errorResetBoundary:s,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw p.error;if((b=(_=i.getDefaultOptions().queries)==null?void 0:_._experimental_afterQuery)==null||b.call(_,a,p),a.experimental_prefetchInRender&&!Pd.isServer()&&PL(p,r)){const E=f?kS(a,h,s):u==null?void 0:u.promise;E==null||E.catch(_r).finally(()=>{h.updateResult()})}return a.notifyOnChangeProps?p:h.trackResult(p)}function H1(t,e){return AL(t,cL)}var te=typeof window<"u"?window:void 0,_n=typeof globalThis<"u"?globalThis:te;typeof self>"u"&&(_n.self=_n),typeof File>"u"&&(_n.File=function(){});var sr=_n==null?void 0:_n.navigator,Ee=_n==null?void 0:_n.document,on=_n==null?void 0:_n.location,z1=_n==null?void 0:_n.fetch,U1=_n!=null&&_n.XMLHttpRequest&&"withCredentials"in new _n.XMLHttpRequest?_n.XMLHttpRequest:void 0,CS=_n==null?void 0:_n.AbortController,RL=_n==null?void 0:_n.CompressionStream,vr=sr==null?void 0:sr.userAgent,$e=te??{};function m8(){return!(!te||te.navigator.onLine===!1)}var PS="1.399.1",Vt={DEBUG:!1,LIB_VERSION:PS,LIB_NAME:"web",JS_SDK_VERSION:PS};function TS(t,e,n,r,s,i,a){try{var u=t[i](a),c=u.value}catch(f){return void n(f)}u.done?e(c):Promise.resolve(c).then(r,s)}function en(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var i=t.apply(e,n);function a(c){TS(i,r,s,a,u,"next",c)}function u(c){TS(i,r,s,a,u,"throw",c)}a(void 0)}))}}function pe(){return pe=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pe.apply(null,arguments)}function g8(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var AS=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function RS(t){return typeof t=="string"||t}function IS(t){return typeof t=="string"?t:void 0}var jc,Di=(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.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.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),MS=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),IL=["$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"],ML=["token"],v8="NativeGzipValidationError",B1=t=>t.length>=2&&t[0]===31&&t[1]===139,LS=(t,e)=>t===MS.GZipJS||e===MS.GZipJS||e==="gzip",OS=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",Th=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=v8,e},LL=(function(){var t=en((function*(e,n){18>e.size&&Th("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());B1(r)&&r[2]===8||Th("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(a=>{for(var u=(()=>{if(jc)return jc;jc=[];for(var h=0;256>h;h++){for(var p=h,v=0;8>v;v++)p=1&p?3988292384^p>>>1:p>>>1;jc[h]=p>>>0}return jc})(),c=4294967295,f=0;a.length>f;f++)c=u[255&(c^a[f])]^c>>>8;return(4294967295^c)>>>0})(n)&&Th("invalid-crc");var i=n.length>>>0;s.getUint32(4,!0)!==i&&Th("invalid-size")}));return function(e,n){return t.apply(this,arguments)}})();function W1(){return W1=en((function*(t,e,n){e===void 0&&(e=!0);try{var r=new TextEncoder().encode(t),s=new CompressionStream("gzip"),i=s.writable.getWriter(),a=i.write(r).then((()=>i.close())).catch((function(){var f=en((function*(h){try{yield i.abort(h)}catch{}throw h}));return function(h){return f.apply(this,arguments)}})()),u=new Response(s.readable).blob(),[c]=yield Promise.all([u,a]);return yield LL(c,r),c}catch(f){if(n!=null&&n.rethrow)throw f;return e&&console.error("Failed to gzip compress data",f),null}})),W1.apply(this,arguments)}var OL=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],NS=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return OL.concat(e).some((r=>{var s=r.toLowerCase();return n.indexOf(s)!==-1}))};function Be(t,e){return t.indexOf(e)!==-1}var Hm=function(t){return t.trim()},G1=function(t){return t.replace(/^\$/,"")},y8=Object.prototype,_8=y8.hasOwnProperty,zm=y8.toString,tt=Array.isArray||function(t){return zm.call(t)==="[object Array]"},Ts=t=>typeof t=="function",Ot=t=>t===Object(t)&&!tt(t),Do=t=>{if(Ot(t)){for(var e in t)if(_8.call(t,e))return!1;return!0}return!1},be=t=>t===void 0,_t=t=>zm.call(t)=="[object String]",K1=t=>_t(t)&&t.trim().length===0,ar=t=>t===null,Ye=t=>be(t)||ar(t),$n=t=>zm.call(t)=="[object Number]"&&t==t,Li=t=>$n(t)&&t>0,ai=t=>zm.call(t)==="[object Boolean]",NL=t=>t instanceof FormData,DL=t=>Be(IL,t),jL=t=>Be(ML,t);function x8(t){return t===null||typeof t!="object"}function Vp(t,e){return{}.toString.call(t)==="[object "+e+"]"}function q_(t){return typeof Event<"u"&&(function(e,n){try{return e instanceof n}catch{return!1}})(t,Event)}var FL=[!0,"true",1,"1","yes"],ov=t=>Be(FL,t),VL=[!1,"false",0,"0","no"];function si(t,e,n,r,s){return e>n&&(r.warn("min cannot be greater than max."),e=n),$n(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),si(s||n,e,n,r))}class $L{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=si(e.bucketSize,0,100,e.Ae),this.De=si(e.refillRate,0,this.Fe,e.Ae),this.$e=si(e.refillInterval,0,864e5,e.Ae)}Ne(e,n){var r=Math.floor((n-e.lastAccess)/this.$e);r>0&&(e.tokens=Math.min(e.tokens+r*this.De,this.Fe),e.lastAccess=e.lastAccess+r*this.$e)}consumeRateLimit(e){var n,r=Date.now(),s=String(e),i=this.Ee[s];return i?this.Ne(i,r):this.Ee[s]=i={tokens:this.Fe,lastAccess:r},i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.Pe)==null||n.call(this,e)),i.tokens===0)}stop(){this.Ee={}}}var zr="Mobile",$p="iOS",Wi="Android",Tu="Tablet",w8=Wi+" "+Tu,b8="iPad",S8="Apple",E8=S8+" Watch",ud="Safari",Au="BlackBerry",k8="Samsung",C8=k8+"Browser",P8=k8+" Internet",tl="Chrome",HL=tl+" OS",T8=tl+" "+$p,Y_="Internet Explorer",A8=Y_+" "+zr,X_="Opera",zL=X_+" Mini",Q_="Edge",R8="Microsoft "+Q_,ou="Firefox",I8=ou+" "+$p,Td="Nintendo",Ad="PlayStation",au="Xbox",M8=Wi+" "+zr,L8=zr+" "+ud,td="Windows",Z1=td+" Phone",DS="Nokia",q1="Ouya",O8="Generic",UL=O8+" "+zr.toLowerCase(),N8=O8+" "+Tu.toLowerCase(),Y1="Konqueror",D8="Oculus Browser",Hp="Vivaldi",j8="Yandex",zp="Whale",X1="DuckDuckGo",F8="Pale Moon",Up="Waterfox",cd="Brave",V8="Google Search App",Ft="(\\d+(\\.\\d+)?)",av=new RegExp("Version/"+Ft),BL=new RegExp(au,"i"),WL=new RegExp(Ad+" \\w+","i"),GL=new RegExp(Td+" \\w+","i"),J_=new RegExp(Au+"|PlayBook|BB10","i"),KL={"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"},$8=function(t,e,n,r){e=e||"";var s=(function(i){return i!=null&&i.brave?cd:null})(n);return s||(r!=null&&r.detectGoogleSearchApp&&Be(t,"GSA/")?V8:Be(t," OPR/")&&Be(t,"Mini")?zL:Be(t," OPR/")?X_:J_.test(t)?Au:Be(t,"IE"+zr)||Be(t,"WPDesktop")?A8:Be(t,"OculusBrowser")?D8:Be(t,C8)?P8:Be(t,Q_)||Be(t,"Edg/")?R8:Be(t,Hp+"/")?Hp:Be(t,"YaBrowser/")?j8:Be(t,zp+"/")?zp:Be(t,X1+"/")||Be(t,"Ddg/")?X1:Be(t,"FBIOS")?"Facebook "+zr:Be(t,"UCWEB")||Be(t,"UCBrowser")?"UC Browser":Be(t,"CriOS")?T8:Be(t,"CrMo")||Be(t,tl)?tl:Be(t,Wi)&&Be(t,ud)?M8:Be(t,"FxiOS")?I8:Be(t.toLowerCase(),Y1.toLowerCase())?Y1:Be(t,cd+"/")?cd:((i,a)=>a&&Be(a,S8)||(function(u){return Be(u,ud)&&!Be(u,tl)&&!Be(u,Wi)})(i))(t,e)?Be(t,zr)?L8:ud:Be(t,"PaleMoon/")?F8:Be(t,Up+"/")?Up:Be(t,ou)?ou:Be(t,"MSIE")||Be(t,"Trident/")?Y_:Be(t,"Gecko")?ou:"")},ZL={[A8]:[new RegExp("rv:"+Ft)],[R8]:[new RegExp(Q_+"?\\/"+Ft)],[tl]:[new RegExp("("+tl+"|CrMo)\\/"+Ft)],[T8]:[new RegExp("CriOS\\/"+Ft)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ft)],[ud]:[av],[L8]:[av],[X_]:[new RegExp("(Opera|OPR)\\/"+Ft)],[ou]:[new RegExp(ou+"\\/"+Ft)],[I8]:[new RegExp("FxiOS\\/"+Ft)],[Y1]:[new RegExp("Konqueror[:/]?"+Ft,"i")],[Au]:[new RegExp(Au+" "+Ft),av],[M8]:[new RegExp("android\\s"+Ft,"i")],[P8]:[new RegExp(C8+"\\/"+Ft)],[D8]:[new RegExp("OculusBrowser\\/"+Ft)],[Hp]:[new RegExp(Hp+"\\/"+Ft)],[j8]:[new RegExp("YaBrowser\\/"+Ft)],[zp]:[new RegExp(zp+"\\/"+Ft)],[cd]:[new RegExp(cd+"\\/"+Ft)],[X1]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ft)],[F8]:[new RegExp("PaleMoon\\/"+Ft)],[Up]:[new RegExp(Up+"\\/"+Ft)],[V8]:[new RegExp("GSA\\/"+Ft)],[Y_]:[new RegExp("(rv:|MSIE )"+Ft)],Mozilla:[new RegExp("rv:"+Ft)]},qL=function(t,e,n,r){var s=$8(t,e,n,r),i=ZL[s];if(be(i))return null;for(var a=0;i.length>a;a++){var u=t.match(i[a]);if(u)return parseFloat(u[u.length-2])}return null},jS=[[new RegExp(au+"; "+au+" (.*?)[);]","i"),t=>[au,t&&t[1]||""]],[new RegExp(Td,"i"),[Td,""]],[new RegExp(Ad,"i"),[Ad,""]],[J_,[Au,""]],[new RegExp(td,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Z1,""];if(new RegExp(zr).test(e)&&!/IEMobile\b/.test(e))return[td+" "+zr,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=KL[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[td,r]}return[td,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[$p,[t[3],t[4],t[5]||"0"].join(".")]:[$p,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=be(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Wi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Wi+")","i"),t=>t&&t[2]?[Wi,[t[2],t[3],t[4]||"0"].join(".")]:[Wi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var 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/,[HL,""]],[/Linux|debian/i,["Linux",""]]],FS=function(t){return GL.test(t)?Td:WL.test(t)?Ad:BL.test(t)?au:new RegExp(q1,"i").test(t)?q1:new RegExp("("+Z1+"|WPDesktop)","i").test(t)?Z1:/iPad/.test(t)?b8:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?E8:J_.test(t)?Au:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(DS,"i").test(t)?DS:/(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(zr).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)?Wi:w8:new RegExp("(pda|"+zr+")","i").test(t)?UL:new RegExp(Tu,"i").test(t)&&!new RegExp(Tu+" pc","i").test(t)?N8:""},YL=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function VS(t,e){return typeof(n=t)=="string"&&YL.test(n)?t:e();var n}function Wo(t){return t&&t.split("#")[0]}function ap(t,e){var n=setTimeout(t,e);return n!=null&&n.unref&&(n==null||n.unref()),n}var XL=t=>t instanceof Error,H8={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}},QL=H8.info;function z8(t){if(ai(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(tt(t))return{arrayValue:{values:t.map((e=>z8(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function Bp(t){var e=[];for(var n in t){var r=t[n];ar(r)||be(r)||e.push({key:n,value:z8(r)})}return e}function JL(t,e){var n=t.level||"info",{text:r,number:s}=H8[n]||QL,i=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Ye(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Ye(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);var u=pe({},a,t.attributes||{}),c={timeUnixNano:i,observedTimeUnixNano:i,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:Bp(u)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),be(t.trace_flags)||(c.flags=t.trace_flags),c}function U8(t,e,n){return pe({},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})}function B8(t,e,n,r){return{resourceLogs:[{resource:{attributes:Bp(e)},scopeLogs:[{scope:{name:n,version:r},logRecords:t}]}]}}let eO=class{constructor(t,e,n,r,s,i,a){var u;i===void 0&&(i=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=n,this.qe=r,this.Be=s,this.je=i,this.He=a,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max((u=e.maxQueueSize)!==null&&u!==void 0?u:e.maxBufferSize,e.maxBufferSize),this.Ke=e.flushIntervalMs,this.Ye=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ye=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.it(t);if(e!==null)if(e.body){if(this.nt()){var n={record:JL(e,this.qe())};this.Be((()=>this.st(n)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=tt(e)?e:[e],r=t;for(var s of n)try{var i=s(r);if(!i)return this.Ae.info("Log was rejected in beforeSend function"),null;r=i}catch(a){return this.Ae.error("Error in beforeSend function for log:",a),null}return r}nt(){if(this.et===void 0)return!0;var t=Date.now(),e=t-this.We;return this.Xe>e&&e>=0||(this.We=t,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var t=this;return en((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return en((function*(){var e;t.tt();var n=(e=t._instance.getPersistedProperty(Di.LogsQueue))!==null&&e!==void 0?e:[];if(n.length!==0)for(var r=n.length,s=0;n.length>0&&r>s;){var i,a;t.ze=0;var u=Math.min(n.length,t.Ye),c=n.slice(0,u),f=B8(c.map((p=>p.record)),t.ut(),(i=t.He)!==null&&i!==void 0?i:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.ht(f);if(h.kind==="too-large"&&c.length>1)t.Ye=Math.max(1,Math.floor(c.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+c.length+", reducing batch size to "+t.Ye);else if(h.kind==="retry-later"||(h.kind==="too-large"?t.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&t.Se.maxBatchRecordsPerPost>t.Ye&&(t.Ye=Math.min(t.Se.maxBatchRecordsPerPost,t.Ye+1)),yield t.dt(c.length),n=(a=t._instance.getPersistedProperty(Di.LogsQueue))!==null&&a!==void 0?a:[],s+=c.length,h.kind==="fatal"))throw h.error}}))()}dt(t){var e=this;return en((function*(){var n,r=Math.max(0,t-e.ze),s=(n=e._instance.getPersistedProperty(Di.LogsQueue))!==null&&n!==void 0?n:[];e._instance.setPersistedProperty(Di.LogsQueue,s.slice(r)),yield e.je()}))()}ut(){return U8(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var n=(e=this._instance.getPersistedProperty(Di.LogsQueue))!==null&&e!==void 0?e:[];this.Je>n.length||(n.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),n.push(t),this._instance.setPersistedProperty(Di.LogsQueue,n),this.Qe>n.length?this.ct():this.rt()}}ct(t){t===void 0&&(t=this.Ke),this.vt||(this.vt=ap((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.Ve-1),6);return this.Ke*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(Di.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return en((function*(){e.tt();var n=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([n,new Promise((r=>ap(r,t)))]):yield n}))()}flushWithTimeout(t){var e=this;return en((function*(){var n=!1,r=e.flush(),s=new Promise((i=>ap((()=>{n=!0,i()}),t)));try{yield Promise.race([r,s])}finally{n&&r.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(t=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var lv=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function $S(t){return String(t)+"000000"}function HS(t,e,n,r){var s="";return r&&(s=Object.keys(r).sort().map((i=>JSON.stringify(i)+":"+JSON.stringify(r[i]))).join(",")),t+"\0"+e+"\0"+(n??"")+"\0"+s}let tO=class{constructor(t,e,n){this._instance=t,this.Se=e,this.Ae=n,this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}count(t,e,n){e===void 0&&(e=1),this.kt({name:t,type:"count",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(t,e,n){this.kt({name:t,type:"gauge",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(t,e,n){this.kt({name:t,type:"histogram",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var t=this,e=this.Ue,n=(function(){var s=en((function*(){e&&(yield e.catch((()=>{}))),yield t.St()}));return function(){return s.apply(this,arguments)}})(),r=n().finally((()=>{this.Ue===r&&(this.Ue=null)}));return this.Ue=r,r}drainWindow(){if(this.bt.size===0)return null;var t=this.bt;return this.bt=new Map,this._t=!1,this.wt=new Map,this.xt=new Set,this.Ct(t)}reset(){this.tt(),this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}kt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.it(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ae.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var n=this.wt.get(e.name);n===void 0?this.wt.set(e.name,e.type):n===e.type||this.xt.has(e.name)||(this.xt.add(e.name),this.Ae.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name."));var r=HS(e.type,e.name,e.unit,e.attributes),s=this.bt.get(r);if(!s){if(this.bt.size>=this.Se.maxSeriesPerFlush)return void(this._t||(this._t=!0,this.Ae.warn("Metric series cap reached ("+this.Se.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")));s={name:e.name,type:e.type,unit:e.unit,attributes:e.attributes?pe({},e.attributes):void 0,windowStartMs:Date.now()},this.bt.set(r,s)}this.It(s,e.value),this.ct()}else this.Ae.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ae.warn("Dropping metric with empty name")}}It(t,e){var n;switch(t.type){case"count":t.total=((n=t.total)!==null&&n!==void 0?n:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(lv.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[(function(s,i){for(var a=0;i.length>a;a++)if(i[a]>=s)return a;return i.length})(e,lv)]+=1}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=tt(e)?e:[e],r=t;for(var s of n)try{var i=s(r);if(!i)return this.Ae.info("Metric was rejected in beforeSend function"),null;r=i}catch(a){return this.Ae.error("Error in beforeSend function for metric:",a),null}return r}ct(){this.vt||(this.vt=ap((()=>{this.vt=void 0,this.flush().catch((()=>{}))}),this.Se.flushIntervalMs))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}St(){var t=this;return en((function*(){if(t.bt.size!==0){var e=t.bt;t.bt=new Map,t._t=!1,t.wt=new Map,t.xt=new Set;var n=yield t._instance.Tt(t.Ct(e));switch(n.kind){case"ok":return;case"retry-later":return t.Mt(e),void t.ct();case"too-large":return void t.Ae.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ae.error("Failed to send metrics batch:",n.error)}}}))()}Ct(t){return(function(s,i,a,u){return{resourceMetrics:[{resource:{attributes:Bp(i)},scopeMetrics:[{scope:{name:a,version:u},metrics:s}]}]}})(this.Et(t),(e=this.Se,n=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),pe({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":n,"telemetry.sdk.version":r})),this._instance.getLibraryId(),this._instance.getLibraryVersion());var e,n,r}Et(t){var e=$S(Date.now()),n=new Map;for(var r of t.values()){var s,i=HS(r.type,r.name,r.unit,void 0),a=n.get(i);a||(a=pe({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},n.set(i,a));var u=Bp((s=r.attributes)!==null&&s!==void 0?s:{}),c=$S(r.windowStartMs);if(r.type==="count"){var f,h={attributes:u,startTimeUnixNano:c,timeUnixNano:e,asDouble:(f=r.total)!==null&&f!==void 0?f:0};a.sum.dataPoints.push(h)}else if(r.type==="gauge"){var p,v={attributes:u,timeUnixNano:e,asDouble:(p=r.last)!==null&&p!==void 0?p:0};a.gauge.dataPoints.push(v)}else r.hist&&a.histogram.dataPoints.push({attributes:u,startTimeUnixNano:c,timeUnixNano:e,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:lv})}return Array.from(n.values())}Mt(t){var e,n;for(var[r,s]of t){var i=this.bt.get(r);if(i)switch(i.windowStartMs=Math.min(i.windowStartMs,s.windowStartMs),i.type){case"count":i.total=((e=i.total)!==null&&e!==void 0?e:0)+((n=s.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(s.hist)if(i.hist){i.hist.count+=s.hist.count,i.hist.sum+=s.hist.sum,i.hist.min=Math.min(i.hist.min,s.hist.min),i.hist.max=Math.max(i.hist.max,s.hist.max);for(var a=0;i.hist.bucketCounts.length>a;a++)i.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else i.hist=s.hist}else this.bt.set(r,s)}}};var Ah,zS,uv;function nO(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return uv&&n.length===zS||(zS=n.length,uv=n.reduce(((r,s)=>{Ah||(Ah={});var i=Ah[s];if(i)r[i[0]]=i[1];else for(var a=t(s),u=a.length-1;u>=0;u--){var c=a[u],f=c==null?void 0:c.filename,h=e[s];if(f&&h){r[f]=h,Ah[s]=[f,h];break}}return r}),{})),uv}}class rO{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,n,0).apply(e),i=this.buildParsingContext(n),a=this.parseStacktrace(s,i);return{$exception_list:this.convertToExceptionList(a,r),$exception_level:"error"}}modifyFrames(e){var n=this;return en((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&tt(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),pe({},e,{cause:r,stack:s})}applyChunkIds(e,n){return e.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return en((function*(){var r=e;for(var s of n.modifiers)r=yield s(r);return r}))()}convertToExceptionList(e,n){var r,s,i,a={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(s=n.handled)===null||s===void 0||s,synthetic:(i=e.synthetic)!==null&&i!==void 0&&i}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var u=[a];return e.cause!=null&&u.push(...this.convertToExceptionList(e.cause,pe({},n,{handled:!0}))),u}buildParsingContext(e){var n;return{chunkIdMap:nO(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var s=(i,a)=>{if(4>=a){var u=this.buildCoercingContext(e,n,a);return this.applyCoercers(i,u)}};return pe({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:i=>s(i,r),next:i=>s(i,r+1)})}}var Ru="?";function Q1(t,e,n,r,s){var i={platform:t,filename:e,function:n==="<anonymous>"?Ru:n,in_app:!0};return be(r)||(i.lineno=r),be(s)||(i.colno=s),i}var W8=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Ru,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},sO=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,iO=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oO=/\((\S*)(?::(\d+))(?::(\d+))\)/,aO=(t,e)=>{var n=sO.exec(t);if(n){var[,r,s,i]=n;return Q1(e,r,Ru,+s,+i)}var a=iO.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var u=oO.exec(a[2]);u&&(a[2]=u[1],a[3]=u[2],a[4]=u[3])}var[c,f]=W8(a[1]||Ru,a[2]);return Q1(e,f,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},lO=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,uO=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,cO=(t,e)=>{var n=lO.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=uO.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var s=n[3],i=n[1]||Ru;return[i,s]=W8(i,s),Q1(e,s,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},US=/\(error: (.*)\)/;class dO{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=_t(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?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){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return Vp(e,"DOMException")}isDOMError(e){return Vp(e,"DOMError")}}class fO{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class hO{constructor(){}match(e){return Vp(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var pO=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class mO{match(e){return typeof e=="string"}coerce(e,n){var r,[s,i]=this.getInfos(e);return{type:s??"Error",value:i??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,s=e.match(pO);return s&&(n=s[1],r=s[2]),[n,r]}}var gO=["fatal","error","warning","log","info","debug"];function G8(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var s=n.slice(0,r).join(", ");if(e>=s.length)return r===n.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class vO{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,s=this.getErrorPropertyFromObject(e);return s?n.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return q_(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+G8(e)}isSeverityLevel(e){return _t(e)&&!K1(e)&&gO.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(XL(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class yO{match(e){return q_(e)}coerce(e,n){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+G8(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class _O{match(e){return x8(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class xO{match(e){return Vp(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!q_(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,s=this.getUnhandledRejectionReason(e);return x8(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(s)}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}}var Wp="$message",Gp="$timestamp",wO=new Set([Wp,Gp]),cv={enabled:!0,max_bytes:32768};function Kp(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:cv.enabled,max_bytes:SO(t.max_bytes,cv.max_bytes)}:pe({},cv)}class bO{constructor(e){this.Pt=[],this.Rt=0,this.Se=Kp(e)}setConfig(e){this.Se=Kp(e),this.Ot()}add(e){var n=(function(s){var i,a,u;try{u=[],i=(a=JSON.stringify(s,(function(v,y){if(typeof y=="bigint")return y.toString();if(typeof y!="function"&&typeof y!="symbol"){if(y instanceof Error)return{name:y.name,message:y.message,stack:y.stack};if(y&&typeof y=="object"){for(;u.length>0&&u[u.length-1]!==this;)u.pop();if(u.includes(y))return"[Circular]";u.push(y)}return y}})))!==null&&a!==void 0?a:"null"}catch{return}try{var c=JSON.parse(i);if(!Ot(c))return;var f=c,h=f[Wp],p=f[Gp];return!_t(h)||h.trim().length===0||!_t(p)&&!$n(p)?void 0:{step:f,json:i}}catch{return}})(e);if(n){var r=(function(s){if(typeof TextEncoder<"u")return new TextEncoder().encode(s).length;for(var i=encodeURIComponent(s),a=0,u=0;i.length>u;u++)i[u]==="%"?(a+=1,u+=2):a+=1;return a})(n.json);r>this.Se.max_bytes||(this.Pt.push({step:n.step,bytes:r}),this.Rt+=r,this.Ot())}}getAttachable(){return this.Pt.map((e=>e.step))}clear(){this.Pt=[],this.Rt=0}size(){return this.Pt.length}Ot(){for(;this.Rt>this.Se.max_bytes&&this.Pt.length>0;){var e=this.Pt.shift();e&&(this.Rt-=e.bytes)}}}function SO(t,e){if(!$n(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var K8=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={k(s){if(te&&(Vt.DEBUG||$e.POSTHOG_DEBUG||n)&&!be(te.console)&&te.console){for(var i=("__rrweb_original__"in te.console[s])?te.console[s].__rrweb_original__:te.console[s],a=arguments.length,u=new Array(a>1?a-1:0),c=1;a>c;c++)u[c-1]=arguments[c];i(t,...u)}},debug(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("debug",...i)},info(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("log",...i)},warn(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("warn",...i)},error(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("error",...i)},critical(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];console.error(t,...i)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,i)=>K8(t+" "+s,i)};return r},_e=K8("[PostHog.js]"),Dt=_e.createLogger,EO=Dt("[ExternalScriptsLoader]"),dv=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return EO.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Ee==null?void 0:Ee.querySelectorAll("script");if(r){for(var s,i=function(){if(r[a].src===e){var c=r[a];return c.__posthog_loading_callback_fired?{v:n()}:(c.addEventListener("load",(f=>{c.__posthog_loading_callback_fired=!0,n(void 0,f)})),c.onerror=f=>n(f),{v:void 0})}},a=0;r.length>a;a++)if(s=i())return s.v}var u=()=>{if(!Ee)return n("document not found");var c=Ee.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=e,c.onload=p=>{c.__posthog_loading_callback_fired=!0,n(void 0,p)},c.onerror=p=>n(p),t.config.prepare_external_dependency_script&&(c=t.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")Ee.head.appendChild(c);else{var f,h=Ee.querySelectorAll("body > script");h.length>0?(f=h[0].parentNode)==null||f.insertBefore(c,h[0]):Ee.body.appendChild(c)}};Ee!=null&&Ee.body?u():Ee==null||Ee.addEventListener("DOMContentLoaded",u)};$e.__PosthogExtensions__=$e.__PosthogExtensions__||{},$e.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var i=3e5;s=s+"&t="+Math.floor(Date.now()/i)*i}r=t.requestRouter.endpointFor("assets",s)}dv(t,r,n)}else{var a=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");dv(t,a,n)}},$e.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);dv(t,r,n)};var Z8="$people_distinct_id",Zp="$device_id",fv="$device_model",nd="__alias",rd="__timers",J1="$autocapture_disabled_server_side",ey="$heatmaps_enabled_server_side",ty="$exception_capture_enabled_server_side",ny="$error_tracking_suppression_rules",ry="$error_tracking_capture_extension_exceptions",sy="$web_vitals_enabled_server_side",e2="$dead_clicks_enabled_server_side",t2="$product_tours_enabled_server_side",iy="$web_vitals_allowed_metrics",za="$session_recording_remote_config",q8="$replay_sample_rate",Y8="$replay_override_sampling",X8="$replay_override_linked_flag",Q8="$replay_override_url_trigger",J8="$replay_override_event_trigger",Jl="$sesid",n2="$session_is_sampled",Va="$enabled_feature_flags",lp="$active_feature_flags",sd="$early_access_features",oy="$feature_flag_details",up="$feature_flag_payloads",ay="$feature_flag_request_id",Oi="$override_feature_flags",ql="$override_feature_flag_payloads",Oa="$stored_person_properties",Na="$stored_group_properties",ly="$surveys",qp="$surveys_loaded_at",uy="$surveys_activated",id="ph_product_tours",dd="$flag_call_reported",cy="$flag_call_reported_session_id",dy="$feature_flag_errors",Rd="$feature_flag_evaluated_at",Es="$user_state",fy="$client_session_props",hy="$capture_rate_limit",py="$initial_campaign_params",my="$initial_referrer_info",Yp="$initial_person_info",Xp="$epp",e6="__POSTHOG_TOOLBAR__",Rh="$posthog_cookieless",t6="$sdk_debug_extensions_init_method",n6="$sdk_debug_extensions_init_time_ms",r6="$sdk_debug_recording_script_not_loaded",r2="PostHog loadExternalDependency extension not found.",Da="on_reject",zi="always",Vl="anonymous",$l="identified",gy="identified_only",Qp="visibilitychange",Jp="beforeunload",Yl="$pageview",hv="$pageleave",pv="$identify",BS="$groupidentify";function Ih(t,e){tt(t)&&t.forEach(e)}function bt(t,e){if(!Ye(t))if(tt(t))t.forEach(e);else if(NL(t))t.forEach(((r,s)=>e(r,s)));else for(var n in t)_8.call(t,n)&&e(t[n],n)}var At=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var s of n)for(var i in s)s[i]!==void 0&&(t[i]=s[i]);return t};function cp(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var WS=function(t){try{return t()}catch{return}},kO=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(s){_e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_e.critical(s)}}},s2=function(t){var e={};return bt(t,(function(n,r){(_t(n)&&n.length>0||$n(n))&&(e[r]=n)})),e},CO=["herokuapp.com","vercel.app","netlify.app"];function PO(t){var e=t==null?void 0:t.hostname;if(!_t(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of CO)if(n===r)return!1;return!0}function $t(t,e,n,r){var{capture:s=!1,passive:i=!0}=r??{};t==null||t.addEventListener(e,n,{capture:s,passive:i})}function s6(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return $n(t)&&isFinite(t)&&Math.floor(t)===t});class em{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>n||0>r||0>s||e>0xffffffffffff||n>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new em(i)}toString(){for(var e="",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 em(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class TO{constructor(){this.S=0,this.C=0,this.I=new AO}generate(){var e=this.generateOrAbort();if(be(e)){this.S=0;var n=this.generateOrAbort();if(be(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return em.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var GS,i6=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};te&&!be(te.crypto)&&crypto.getRandomValues&&(i6=t=>crypto.getRandomValues(t));class AO{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(i6(this.R),this.O=0),this.R[this.O++]}}var Fi=()=>RO().toString(),RO=()=>(GS||(GS=new TO)).generate(),Fc="",IO=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ti={N:()=>!!Ee,D(t){_e.error("cookieStore error: "+t)},A(t){if(Ee){try{for(var e=t+"=",n=Ee.cookie.split(";").filter((i=>i.length)),r=0;n.length>r;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},F(t){var e;try{e=JSON.parse(ti.A(t))||{}}catch{}return e},q(t,e,n,r,s){if(!Ee)return!1;try{var i="",a="",u=(function(h,p){if(p){var v=(function(x,_){if(_===void 0&&(_=Ee),Fc)return Fc;if(!_||["localhost","127.0.0.1"].includes(x))return"";for(var b=x.split("."),E=Math.min(b.length,8),C="dmn_chk_"+Fi();!Fc&&E--;){var P=b.slice(E).join("."),T=C+"=1;domain=."+P+";path=/";_.cookie=T+";max-age=3",_.cookie.includes(C)&&(_.cookie=T+";max-age=0",Fc=P)}return Fc})(h);if(!v){var y=(x=>{var _=x.match(IO);return _?_[0]:""})(h);y!==v&&_e.info("Warning: cookie subdomain discovery mismatch",y,v),v=y}return v?"; domain=."+v:""}return""})(Ee.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+864e5*n),i="; expires="+c.toUTCString()}s&&(a="; secure");var f=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+u+a;return f.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+f.length),Ee.cookie=f,!0}catch{return!1}},P(t,e){if(Ee!=null&&Ee.cookie)try{ti.q(t,"",-1,e)}catch{return}}},mv=null,wt={N(){if(!ar(mv))return mv;var t=!0;if(be(te))t=!1;else try{var e="__mplssupport__";wt.q(e,"xyz"),wt.A(e)!=='"xyz"'&&(t=!1),wt.P(e)}catch{t=!1}return t||_e.error("localStorage unsupported; falling back to cookie store"),mv=t,t},D(t){_e.error("localStorage error: "+t)},A(t){try{return te==null?void 0:te.localStorage.getItem(t)}catch(e){wt.D(e)}return null},F(t){try{return JSON.parse(wt.A(t))||{}}catch{}return null},q(t,e){try{return te==null||te.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){wt.D(n)}return!1},P(t){try{te==null||te.localStorage.removeItem(t)}catch(e){wt.D(e)}}},MO=[Zp,"distinct_id",Jl,n2,Xp,Yp,Es],Mh={},LO={N:()=>!0,D(t){_e.error("memoryStorage error: "+t)},A:t=>Mh[t]||null,F:t=>Mh[t]||null,q:(t,e)=>(Mh[t]=e,!0),P(t){delete Mh[t]}},ba=null,jn={N(){if(!ar(ba))return ba;if(ba=!0,be(te))ba=!1;else try{var t="__support__";jn.q(t,"xyz"),jn.A(t)!=='"xyz"'&&(ba=!1),jn.P(t)}catch{ba=!1}return ba},D(t){_e.error("sessionStorage error: ",t)},A(t){try{return te==null?void 0:te.sessionStorage.getItem(t)}catch(e){jn.D(e)}return null},F(t){try{return JSON.parse(jn.A(t))||null}catch{}return null},q(t,e){try{return te==null||te.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){jn.D(n)}return!1},P(t){try{te==null||te.sessionStorage.removeItem(t)}catch(e){jn.D(e)}}};class OO{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.Ft()?0:this.At}isOptedOut(){return this.Se.cookieless_mode===zi||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===Da}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Dt.q(this.$t,e?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Dt.P(this.$t,this.Se.cross_subdomain_cookie)}get $t(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get At(){var e=this.Dt.A(this.$t);return ov(e)?1:Be(VL,e)?0:-1}get Dt(){var e=this.Se.opt_out_capturing_persistence_type,n=e==="localStorage"?wt:ti;if(!this.Nt||this.Nt!==n){this.Nt=n;var r=e==="localStorage"?ti:wt;r.A(this.$t)&&(this.Nt.A(this.$t)||this.optInOut(ov(r.A(this.$t))),r.P(this.$t,this.Se.cross_subdomain_cookie))}return this.Nt}Ft(){return!!this.Se.respect_dnt&&[sr==null?void 0:sr.doNotTrack,sr==null?void 0:sr.msDoNotTrack,$e.doNotTrack].some((e=>ov(e)))}}function o6(t,e){var n,r=t==null||(n=t.config)==null?void 0:n.get_current_url;if(!Ts(r))return e;try{var s=r(e);return _t(s)&&s?s:e}catch(i){return _e.error("Error in get_current_url, falling back to window.location.href",i),e}}var NO=1,DO=3,jO=11;function KS(t){return t instanceof Element&&(t.id===e6||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Go(t){return!!t&&t.nodeType===NO}function Vr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function a6(t){return!!t&&t.nodeType===DO}function l6(t){return!!t&&t.nodeType===jO&&Go(t.host)}function i2(t){return t?Hm(t).split(/\s+/):[]}function ZS(t,e){var n=(function(r){var s,i=te==null||(s=te.location)==null?void 0:s.href;return be(i)?void 0:o6(r,i)})(e);return!!(n&&t&&t.some((r=>n.match(r))))}function tm(t){var 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 i2(e)}function u6(t){return Ye(t)?null:Hm(t).split(/(\s+)/).filter((e=>fd(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Id(t){var e="";return yy(t)&&!h6(t)&&t.childNodes&&t.childNodes.length&&bt(t.childNodes,(function(n){var r;a6(n)&&n.textContent&&(e+=(r=u6(n.textContent))!==null&&r!==void 0?r:"")})),Hm(e)}function gv(t){return be(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var o2=["a","button","form","input","select","textarea","label"];function vy(t,e){if(be(e))return!0;var n,r=function(i){if(e.some((a=>(function(u,c){var f=u.matches||u.matchesSelector||u.msMatchesSelector||u.mozMatchesSelector||u.webkitMatchesSelector||u.oMatchesSelector;try{return!!f&&f.call(u,c)}catch{return!1}})(i,a))))return{v:!0}};for(var s of t)if(n=r(s))return n.v;return!1}function c6(t){var e=t.parentNode;return!(!e||!Go(e))&&e}var FO=[".ph-no-autocapture","[data-ph-no-autocapture]"],d6=["next","previous","prev",">","<"],VO=[...d6,"+","-","−","–"],qS=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,YS=[".ph-no-rageclick",".ph-no-capture"],$O=["","text","search","email","password","url","tel","number"];function XS(t,e){if(!te||a2(t))return!1;var n,r,s,i,a;if(ai(e)?(n=!!e&&YS,r=void 0,s=!1):(n=(i=e==null?void 0:e.css_selector_ignorelist)!==null&&i!==void 0?i:YS,r=e==null?void 0:e.content_ignorelist,s=(a=e==null?void 0:e.ignore_text_selection)!==null&&a!==void 0&&a),n===!1||s&&(function(c){return!(!c||!Go(c))&&(!!Vr(c,"textarea")||(Vr(c,"input")?Be($O,(c.getAttribute("type")||"").toLowerCase()):(function(f){if(f.isContentEditable)return!0;var h=f.getAttribute==null?void 0:f.getAttribute("contenteditable");return h==="true"||h===""})(c)))})(t))return!1;var{targetElementList:u}=f6(t,!1);return!(function(c,f){if(c===!1||be(c))return!1;var h;if(c===!0)h=d6;else{if(!tt(c))return!1;if(c.length>10)return _e.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;h=c.map((p=>p.toLowerCase()))}return f.some((p=>{var{safeText:v,ariaLabel:y}=p;return h.some((x=>qS(v,x)||qS(y,x)))}))})(r,u.map((c=>{var f;return{safeText:Id(c).toLowerCase(),ariaLabel:((f=c.getAttribute("aria-label"))==null?void 0:f.toLowerCase().trim())||""}})))&&!vy(u,n)}var a2=t=>!t||Vr(t,"html")||!Go(t),f6=(t,e)=>{if(!te||a2(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],s=t;s.parentNode&&!Vr(s,"body");)if(l6(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var i=c6(s);if(!i)break;if(e||o2.indexOf(i.tagName.toLowerCase())>-1)n=!0;else try{var a=te.getComputedStyle(i);a&&a.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(i),s=i}return{parentIsUsefulElement:n,targetElementList:r}};function yy(t){for(var e=t;e.parentNode&&!Vr(e,"body");e=e.parentNode){var n=tm(e);if(Be(n,"ph-sensitive")||Be(n,"ph-no-capture"))return!1}if(Be(tm(t),"ph-include"))return!0;var r=t.type||"";if(_t(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!_t(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function h6(t){return!!(Vr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Vr(t,"select")||Vr(t,"textarea")||t.getAttribute("contenteditable")==="true")}var p6="(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})",HO=new RegExp("^(?:"+p6+")$"),zO=new RegExp(p6),m6="\\d{3}-?\\d{2}-?\\d{4}",UO=new RegExp("^("+m6+")$"),BO=new RegExp("("+m6+")");function fd(t,e){return e===void 0&&(e=!0),!(Ye(t)||_t(t)&&(t=Hm(t),(e?HO:zO).test((t||"").replace(/[- ]/g,""))||(e?UO:BO).test(t)))}function QS(t){var e=Id(t);return fd(e=(e+" "+g6(t)).trim())?e:""}function g6(t){var e="";return t&&t.childNodes&&t.childNodes.length&&bt(t.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Id(n);e=(e+" "+s).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+g6(n)).trim())}catch(i){_e.error("[AutoCapture]",i)}})),e}function JS(t){return t.replace(/"|\\"/g,'\\"')}function WO(t){var e=t.attr__class;return e?tt(e)?e:i2(e):void 0}var Lh=Dt("[Dead Clicks]"),GO=()=>!0,KO=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(e2)),r=t.instance.config.capture_dead_clicks;return ai(r)?r:!!Ot(r)||n};class eE{get lazyLoadedDeadClicksAutocapture(){return this.qt}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[e2]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Bt((()=>{this.jt()})):this.stop()}Bt(e){var n,r;(n=$e.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?e():(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Lh.error("failed to load script",s):e()}))}jt(){var e;if(Ee){if(!this.qt&&(e=$e.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=Ot(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.qt=$e.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.qt.start(Ee),Lh.info("starting...")}}else Lh.error("`document` not found. Cannot start.")}stop(){this.qt&&(this.qt.stop(),this.qt=void 0,Lh.info("stopping..."))}}var vv=Dt("[SegmentIntegration]"),v6="posthog-js";function y6(t,e){var{organization:n,projectId:r,prefix:s,severityAllowList:i=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return u=>{var c,f,h,p,v;if(i!=="*"&&!i.includes(u.level)||!t.__loaded)return u;u.tags||(u.tags={});var y=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());u.tags["PostHog Person URL"]=y,t.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var x,_=((c=u.exception)==null?void 0:c.values)||[],b=_.map((C=>pe({},C,{stacktrace:C.stacktrace?pe({},C.stacktrace,{type:"raw",frames:(C.stacktrace.frames||[]).map((P=>pe({},P,{platform:"web:javascript"})))}):void 0}))),E={$exception_message:((f=_[0])==null?void 0:f.value)||u.message,$exception_type:(h=_[0])==null?void 0:h.type,$exception_level:u.level,$exception_list:b,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((p=_[0])==null?void 0:p.value)||u.message,$sentry_exception_type:(v=_[0])==null?void 0:v.type,$sentry_tags:u.tags};return n&&r&&(E.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+u.event_id),a&&((x=t.exceptions)==null||x.sendExceptionEvent(E)),u}}class ZO{constructor(e,n,r,s,i,a){this.name=v6,this.setupOnce=function(u){u(y6(e,{organization:n,projectId:r,prefix:s,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}}class tE{constructor(e){this.Ht=(n,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:s}),this.Ut=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.zt()}zt(){var e;this.Vt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Ht)}destroy(){var e;(e=this.Vt)==null||e.call(this),this.Vt=void 0}doPageView(e,n){var r,s=this.Wt(e,n);return this.Ut={pathname:(r=te==null?void 0:te.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var n;return this.Wt(e,(n=this.Ut)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ut)==null?void 0:e.pageViewId}}Wt(e,n){var r=this.Ut;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:u,maxScrollY:c,maxContentHeight:f,lastContentY:h,maxContentY:p}=i;if(!(be(a)||be(u)||be(c)||be(f)||be(h)||be(p))){a=Math.ceil(a),u=Math.ceil(u),c=Math.ceil(c),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p);var v=a>1?si(u/a,0,1,_e):1,y=a>1?si(c/a,0,1,_e):1,x=f>1?si(h/f,0,1,_e):1,_=f>1?si(p/f,0,1,_e):1;s=At(s,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:x,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var Oh=["flags","surveys"],qO={[Z8]:{exposure:"hidden"},[nd]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[rd]:{exposure:"hidden"},[J1]:{exposure:"event"},[ey]:{exposure:"hidden"},[ty]:{exposure:"event"},[ny]:{exposure:"hidden"},[ry]:{exposure:"event"},[sy]:{exposure:"event"},[e2]:{exposure:"event"},[t2]:{exposure:"hidden"},[iy]:{exposure:"event"},[za]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Jl]:{exposure:"hidden"},[n2]:{exposure:"event"},[q8]:{exposure:"event",shouldSkipFromEventProperties:t=>ar(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Va]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Ot(t))return{};for(var e={},n=Object.keys(t),r=0;n.length>r;r++)e["$feature/"+n[r]]=t[n[r]];return e}},[lp]:{exposure:"event",storageGroup:"flags"},[sd]:{exposure:"hidden"},[oy]:{exposure:"hidden",storageGroup:"flags"},[up]:{exposure:"event",storageGroup:"flags"},[ay]:{exposure:"event",storageGroup:"flags",volatile:!0},[Oi]:{exposure:"event"},[ql]:{exposure:"hidden"},[Oa]:{exposure:"hidden"},[Na]:{exposure:"hidden"},[ly]:{exposure:"hidden",storageGroup:"surveys"},[qp]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[uy]:{exposure:"event"},[id]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[dd]:{exposure:"hidden"},[cy]:{exposure:"hidden"},[dy]:{exposure:"hidden"},[Rd]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Es]:{exposure:"hidden"},[fy]:{exposure:"hidden"},[hy]:{exposure:"hidden"},[py]:{exposure:"hidden"},[my]:{exposure:"hidden"},[Yp]:{exposure:"hidden"},[Xp]:{exposure:"hidden"},[Y8]:{exposure:"event"},[X8]:{exposure:"event"},[Q8]:{exposure:"event"},[J8]:{exposure:"event"},[t6]:{exposure:"event"},[n6]:{exposure:"event"},[r6]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},YO=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Sa=t=>{var e=qO[t];if(e)return e;for(var[n,r]of YO)if(t.indexOf(n)===0)return r},Md=t=>{var e=Ee==null?void 0:Ee.createElement("a");return be(e)?null:(e.href=t,e)},Iu=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var i=r[s].split("=");if(i[0]===e){n=i;break}}if(!tt(n)||2>n.length)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{_e.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ld=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],i=(r[0]||"").split("?"),a=i[1],u=i[0],c=(a||"").split("&"),f=[],h=0;c.length>h;h++){var p=c[h].split("=");tt(p)&&(e.includes(p[0])?f.push(p[0]+"="+n):f.push(c[h]))}var v=u;return a!=null&&(v+="?"+f.join("&")),s!=null&&(v+="#"+s),v},nm=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},_6=(t,e)=>t>=e&&m8(),x6=(t,e,n,r)=>{if(t===0){if(m8()){var s=e+1;return s===n&&r(),s}return e}return 0},Nh="https?://(.*)",Mu=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],XO=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Mu],Od="<masked>",QO=["li_fat_id"];function w6(t,e,n){if(!Ee)return{};var r,s=e?[...Mu,...n||[]]:[],i=b6(Ld(Ee.URL,s,Od),t),a=(r={},bt(QO,(function(u){var c=ti.A(u);r[u]=c||null})),r);return At(a,i)}function b6(t,e){var n=XO.concat(e||[]),r={};return bt(n,(function(s){var i=Iu(t,s);r[s]=i||null})),r}function S6(t){var e=(function(i){return i?i.search(Nh+"google.([^/?]*)")===0?"google":i.search(Nh+"bing.com")===0?"bing":i.search(Nh+"yahoo.com")===0?"yahoo":i.search(Nh+"duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",r={};if(!ar(e)){r.$search_engine=e;var s=Ee?Iu(Ee.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function nE(){return navigator.language||navigator.userLanguage}var rm="$direct";function E6(){return(Ee==null?void 0:Ee.referrer)||rm}function k6(t,e,n){n===void 0&&(n=!1);var r=t?[...Mu,...e||[]]:[],s=n?Wo(on==null?void 0:on.href):on==null?void 0:on.href,i=s==null?void 0:s.substring(0,1e3);return{r:E6().substring(0,1e3),u:i?Ld(i,r,Od):void 0}}function C6(t,e){var n;e===void 0&&(e=!1);var{r,u:s}=t,i=e?Wo(s):s,a={$referrer:r,$referring_domain:r==null?void 0:r==rm?rm:(n=Md(r))==null?void 0:n.host};if(i){a.$current_url=i;var u=Md(i);a.$host=u==null?void 0:u.host,a.$pathname=u==null?void 0:u.pathname;var c=b6(i);At(a,c)}if(r){var f=S6(r);At(a,f)}return a}function P6(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function JO(){try{return new Date().getTimezoneOffset()}catch{return}}var eN={flags:Rd,surveys:qp},tN=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Hl="main";class yv{constructor(e,n,r){if(r===void 0&&(r=!0),this.Gt={},this.Zt=!1,this.Qt=!1,this.Se=e,this.Jt=r,this.props={},this.Kt=!1,this.Yt=(i=>{var a="";return i.token&&(a=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+a+"_posthog"})(e),this.Dt=this.Xt(e),this.Qt=this.er(e),this.load(),e.debug&&_e.info("Persistence loaded",e.persistence,pe({},this.props)),this.update_config(e,e,n),this.save(),te){var s=()=>this.flush();$t(te,"beforeunload",s,{capture:!1}),$t(te,"pagehide",s,{capture:!1})}}tr(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return $n(n)&&n>0?n:0}isDisabled(){return!!this.rr}Xt(e){tN.indexOf(e.persistence.toLowerCase())===-1&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n,r=(function(a,u){a===void 0&&(a=[]),u===void 0&&(u=!1);var c=[...MO,...a];return pe({},wt,{F(f){try{var h={};try{h=ti.F(f)||{}}catch{}var p,v=JSON.parse(wt.A(f)||"{}");if(u){var y={};for(var x in h){var _=h[x];ar(_)||_===""||(y[x]=_)}p=At(v,y)}else p=At(h,v);return wt.q(f,p),p}catch{}return null},q(f,h,p,v,y,x){var _=wt.q(f,h,void 0,void 0,x);try{var b={};c.forEach((E=>{h[E]&&(b[E]=h[E])})),Object.keys(b).length&&ti.q(f,b,p,v,y,x)}catch(E){wt.D(E)}return _},P(f,h){try{te==null||te.localStorage.removeItem(f),ti.P(f,h)}catch(p){wt.D(p)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,i=e.persistence.toLowerCase();return i==="localstorage"&&wt.N()?(n=wt,s=!0):i==="localstorage+cookie"&&r.N()?(n=r,s=!0):i==="sessionstorage"&&jn.N()?n=jn:i==="memory"?n=LO:i==="cookie"?n=ti:r.N()?(n=r,s=!0):n=ti,this.Zt=s,n}ir(e){return this.Yt+"__"+e}er(e){return this.Zt&&!!e.split_storage}nr(e){var n=e??this.Se.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[Rd];return!r||typeof r!="number"||Date.now()-r>n}properties(){var e={};return bt(this.props,((n,r)=>{var s=Sa(r);if((s==null?void 0:s.exposure)==="derived"){if(s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(n,r===Va?()=>this.nr():()=>!1))return;s.transformToEventProperties&&At(e,s.transformToEventProperties(n))}else if(!s||s.exposure==="event"){if(s!=null&&s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(n,(()=>!1)))return;e[r]=n}})),e}load(){if(!this.rr){var e=this.Dt.F(this.Yt);e&&(this.props=At({},e)),this.Qt&&this.sr()}}sr(){for(var e of Oh){var n=wt.F(this.ir(e));if(n&&!Do(n)){var r=this.ar(e);r.persisted=!0,this.lr(e)||(r.fingerprint=this.ur(n,e)),this.hr(e,n)||At(this.props,n)}}}lr(e){return Object.keys(this.props).some((n=>{var r;return((r=Sa(n))==null?void 0:r.storageGroup)===e}))}hr(e,n){var r=eN[e];if(!r)return!1;var s=n[r],i=this.props[r];return $n(s)&&$n(i)&&i>s}refreshKey(e){var n;if(!this.rr){var r=this.Qt?(n=Sa(e))==null?void 0:n.storageGroup:void 0,s=r?wt.F(this.ir(r)):this.Dt.F(this.Yt);if(s&&e in s)this.dr(e,s[e]);else{if(r){var i=this.Dt.F(this.Yt);if(i&&e in i)return void this.dr(e,i[e])}this.cr(e)}}}save(){if(!this.rr){var e=this.tr();e>0?be(this.vr)&&(this.vr=setTimeout((()=>{this.vr=void 0,this.pr()}),e)):this.pr()}}flush(){be(this.vr)||(clearTimeout(this.vr),this.vr=void 0,this.pr())}pr(){this.rr||(this.Qt?this.gr():this.mr(this.Dt,this.Yt,this.props,Hl))}gr(){var{main:e,groups:n}=this.yr();for(var r of(this.mr(this.Dt,this.Yt,e,Hl),Oh)){var s,i=n[r];(!Do(i)||(s=this.Gt[r])!=null&&s.persisted)&&this.mr(wt,this.ir(r),i,r)}}yr(){var e={},n={};for(var r of Oh)n[r]={};return bt(this.props,((s,i)=>{var a,u=(a=Sa(i))==null?void 0:a.storageGroup;u?n[u][i]=s:e[i]=s})),{main:e,groups:n}}ur(e,n){if(n===Hl)return JSON.stringify(e)+"|"+this.br+"|"+this._r+"|"+this.wr;var r={};return bt(e,((s,i)=>{var a;r[i]=(a=Sa(i))!=null&&a.volatile?"__volatile__":s})),JSON.stringify(r)}mr(e,n,r,s){var i=this.ar(s);if(s===Hl||i.dirty||be(i.fingerprint)){var a;try{if((a=this.ur(r,s))===i.fingerprint)return void(i.dirty=!1)}catch{a=void 0}e.q(n,r,this.br,this._r,this.wr,this.Se.debug)?(i.dirty=!1,s!==Hl&&(i.persisted=!0),be(a)||(i.fingerprint=a)):this.Se.debug&&_e.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(e){var{keepGroupEntries:n=!1}=e===void 0?{}:e;if(be(this.vr)||(clearTimeout(this.vr),this.vr=void 0),this.Dt.P(this.Yt,!1),this.Dt.P(this.Yt,!0),!n&&this.Jt)for(var r of Oh)wt.P(this.ir(r));n?delete this.Gt[Hl]:this.Gt={}}clear(){this.remove(),this.props={}}register_once(e,n,r){if(Ot(e)){be(n)&&(n="None"),this.br=be(r)?this.kr:r;var s=!1;if(bt(e,((i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.dr(a,i),s=!0)})),s)return this.save(),!0}return!1}register(e,n){if(Ot(e)){this.br=be(n)?this.kr:n;var r=!1;if(bt(e,((s,i)=>{e.hasOwnProperty(i)&&this.props[i]!==s&&(this.dr(i,s),r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.cr(e),this.save())}update_campaign_params(){if(!this.Kt){var e=w6(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);Do(s2(e))||this.register(e),this.Kt=!0}}update_search_keyword(){var e;this.register((e=Ee==null?void 0:Ee.referrer)?S6(e):{})}update_referrer_info(){var e;this.register_once({$referrer:E6(),$referring_domain:Ee!=null&&Ee.referrer&&((e=Md(Ee.referrer))==null?void 0:e.host)||rm},void 0)}set_initial_person_info(){this.props[py]||this.props[my]||this.register_once({[Yp]:k6(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};bt([my,py],(s=>{var i=this.props[s];i&&bt(i,(function(a,u){e["$initial_"+G1(u)]=a}))}));var n=this.props[Yp];if(n){var r=(function(s,i){i===void 0&&(i=!1);var a=C6(s,i),u={};return bt(a,(function(c,f){u["$initial_"+G1(f)]=c})),u})(n,this.Se.disable_capture_url_hashes);At(e,r)}return e}safe_merge(e){return bt(this.props,(function(n,r){r in e||(e[r]=n)})),e}update_config(e,n,r){this.kr=this.br=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==n.persistence||!((c,f)=>{if(c.length!==f.length)return!1;var h=[...c].sort(),p=[...f].sort();return h.every(((v,y)=>v===p[y]))})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),i=s?this.Xt(e):this.Dt,a=this.er(e);if(s||a!==this.Qt){var u=this.props;this.clear(),this.Dt=i,this.Qt=a,this.props=u,this.save()}}set_disabled(e){this.rr=e,this.rr?this.remove():this.save()}set_cross_subdomain(e){e!==this._r&&(this._r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.wr&&(this.wr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){var r=this.props[rd]||{};r[e]=n,this.dr(rd,r),this.save()}remove_event_timer(e){var n=this.props[rd]||{},r=n[e];return be(r)||(delete n[e],this.dr(rd,n),this.save()),r}get_property(e){return this.props[e]}set_property(e,n){this.dr(e,n),this.save()}dr(e,n){var r;this.props[e]=n,(r=Sa(e))!=null&&r.volatile||this.Sr(e)}cr(e){delete this.props[e],this.Sr(e)}Sr(e){var n,r=(n=Sa(e))==null?void 0:n.storageGroup;r&&(this.ar(r).dirty=!0)}ar(e){return this.Gt[e]||(this.Gt[e]={})}}var Vc={Activation:"events",Cancellation:"cancelEvents"},_v={Popover:"popover",API:"api",Widget:"widget"},nN={Always:"always"},Ui={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},xv={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},_y={Popover:"popover",Inline:"inline"},rN={SHOWN:"product tour shown"},rE={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},sE=Dt("[RateLimiter]");class sN{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((s=>{sE.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void sE.warn('could not rate limit - continuing. Error: "'+(s==null?void 0:s.message)+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,u=new Date().getTime(),c=(n=(r=this.instance.persistence)==null?void 0:r.get_property(hy))!==null&&n!==void 0?n:{tokens:i,last:u};c.tokens+=(u-c.last)/1e3*a,c.last=u,c.tokens>i&&(c.tokens=i);var f=1>c.tokens;return f||e||(c.tokens=Math.max(0,c.tokens-1)),!f||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=f,(s=this.instance.persistence)==null||s.set_property(hy,c),{isRateLimited:f,remainingTokens:c.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var $c=Dt("[RemoteConfig]");class T6{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$e._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Cr(e){var n,r;(n=$e.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ir(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return $c.info("Using preloaded remote config",this.remoteConfig),this.Tr(this.remoteConfig),void this.Mr();if(this._instance.Er())return void $c.warn("Remote config is disabled. Falling back to local config.");this.Cr((e=>{if(!e)return $c.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ir((n=>{this.Tr(n),this.Mr()}));this.Tr(e),this.Mr()}))}catch(e){$c.error("Error loading remote config",e)}}stop(){this.Pr&&(clearInterval(this.Pr),this.Pr=void 0)}refresh(){!this._instance.Er()&&Ee&&Ee.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Mr(){var e;if(!this.Pr){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.Pr=setInterval((()=>{this.refresh()}),n))}}Tr(e){var n;e||$c.error("Failed to fetch remote config from PostHog."),this._instance.Tr(e??{}),(e==null?void 0:e.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var os={GZipJS:"gzip-js",Base64:"base64"},ds=Uint8Array,wr=Uint16Array,Lu=Uint32Array,l2=new ds([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]),u2=new ds([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]),iE=new ds([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),A6=function(t,e){for(var n=new wr(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var s=new Lu(n[30]);for(r=1;30>r;++r)for(var i=n[r];n[r+1]>i;++i)s[i]=i-n[r]<<5|r;return[n,s]},R6=A6(l2,2),xy=R6[1];R6[0][28]=258,xy[258]=28;for(var oE=A6(u2,0)[1],I6=new wr(32768),Nt=0;32768>Nt;++Nt){var zl=(43690&Nt)>>>1|(21845&Nt)<<1;I6[Nt]=((65280&(zl=(61680&(zl=(52428&zl)>>>2|(13107&zl)<<2))>>>4|(3855&zl)<<4))>>>8|(255&zl)<<8)>>>1}var hd=function(t,e,n){for(var r=t.length,s=0,i=new wr(e);r>s;++s)++i[t[s]-1];var a,u=new wr(e);for(s=0;e>s;++s)u[s]=u[s-1]+i[s-1]<<1;for(a=new wr(r),s=0;r>s;++s)a[s]=I6[u[t[s]-1]++]>>>15-t[s];return a},cl=new ds(288);for(Nt=0;144>Nt;++Nt)cl[Nt]=8;for(Nt=144;256>Nt;++Nt)cl[Nt]=9;for(Nt=256;280>Nt;++Nt)cl[Nt]=7;for(Nt=280;288>Nt;++Nt)cl[Nt]=8;var sm=new ds(32);for(Nt=0;32>Nt;++Nt)sm[Nt]=5;var iN=hd(cl,9),oN=hd(sm,5),M6=function(t){return(t/8>>0)+(7&t&&1)},L6=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof wr?wr:t instanceof Lu?Lu:ds)(n-e);return r.set(t.subarray(e,n)),r},Ci=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},Hc=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},wv=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var s=n.length,i=n.slice();if(!s)return[new ds(0),0];if(s==1){var a=new ds(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort((function(A,O){return A.f-O.f})),n.push({s:-1,f:25001});var u=n[0],c=n[1],f=0,h=1,p=2;for(n[0]={s:-1,f:u.f+c.f,l:u,r:c};h!=s-1;)u=n[n[p].f>n[f].f?f++:p++],c=n[f!=h&&n[p].f>n[f].f?f++:p++],n[h++]={s:-1,f:u.f+c.f,l:u,r:c};var v=i[0].s;for(r=1;s>r;++r)i[r].s>v&&(v=i[r].s);var y=new wr(v+1),x=wy(n[h-1],y,0);if(x>e){r=0;var _=0,b=x-e,E=1<<b;for(i.sort((function(A,O){return y[O.s]-y[A.s]||A.f-O.f}));s>r;++r){var C=i[r].s;if(e>=y[C])break;_+=E-(1<<x-y[C]),y[C]=e}for(_>>>=b;_>0;){var P=i[r].s;e>y[P]?_-=1<<e-y[P]++-1:++r}for(;r>=0&&_;--r){var T=i[r].s;y[T]==e&&(--y[T],++_)}x=e}return[new ds(y),x]},wy=function(t,e,n){return t.s==-1?Math.max(wy(t.l,e,n+1),wy(t.r,e,n+1)):e[t.s]=n},aE=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new wr(++e),r=0,s=t[0],i=1,a=function(c){n[r++]=c},u=1;e>=u;++u)if(t[u]==s&&u!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(s),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(s);i=1,s=t[u]}return[n.subarray(0,r),e]},zc=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},by=function(t,e,n){var r=n.length,s=M6(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var i=0;r>i;++i)t[s+i+4]=n[i];return 8*(s+4+r)},lE=function(t,e,n,r,s,i,a,u,c,f,h){Ci(e,h++,n),++s[256];for(var p=wv(s,15),v=p[0],y=p[1],x=wv(i,15),_=x[0],b=x[1],E=aE(v),C=E[0],P=E[1],T=aE(_),A=T[0],O=T[1],M=new wr(19),R=0;C.length>R;++R)M[31&C[R]]++;for(R=0;A.length>R;++R)M[31&A[R]]++;for(var L=wv(M,7),N=L[0],j=L[1],V=19;V>4&&!N[iE[V-1]];--V);var G,Y,K,B,X=f+5<<3,$=zc(s,cl)+zc(i,sm)+a,ee=zc(s,v)+zc(i,_)+a+14+3*V+zc(M,N)+(2*M[16]+3*M[17]+7*M[18]);if($>=X&&ee>=X)return by(e,h,t.subarray(c,c+f));if(Ci(e,h,1+($>ee)),h+=2,$>ee){G=hd(v,y),Y=v,K=hd(_,b),B=_;var H=hd(N,j);for(Ci(e,h,P-257),Ci(e,h+5,O-1),Ci(e,h+10,V-4),h+=14,R=0;V>R;++R)Ci(e,h+3*R,N[iE[R]]);h+=3*V;for(var D=[C,A],q=0;2>q;++q){var re=D[q];for(R=0;re.length>R;++R)Ci(e,h,H[se=31&re[R]]),h+=N[se],se>15&&(Ci(e,h,re[R]>>>5&127),h+=re[R]>>>12)}}else G=iN,Y=cl,K=oN,B=sm;for(R=0;u>R;++R)if(r[R]>255){var se;Hc(e,h,G[257+(se=r[R]>>>18&31)]),h+=Y[se+257],se>7&&(Ci(e,h,r[R]>>>23&31),h+=l2[se]);var oe=31&r[R];Hc(e,h,K[oe]),h+=B[oe],oe>3&&(Hc(e,h,r[R]>>>5&8191),h+=u2[oe])}else Hc(e,h,G[r[R]]),h+=Y[r[R]];return Hc(e,h,G[256]),h+Y[256]},aN=new Lu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lN=(function(){for(var t=new Lu(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),bv=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function uN(t,e){e===void 0&&(e={});var n=(function(){var p=4294967295;return{p(v){for(var y=p,x=0;v.length>x;++x)y=lN[255&y^v[x]]^y>>>8;p=y},d(){return 4294967295^p}}})(),r=t.length;n.p(t);var s,i,a,u,c,f=(u=10+((s=e).filename&&s.filename.length+1||0),c=8,(function(p,v,y,x,_,b){var E=p.length,C=new ds(x+E+5*(1+Math.floor(E/7e3))+_),P=C.subarray(x,C.length-_),T=0;if(!v||8>E)for(var A=0;E>=A;A+=65535){var O=A+65535;E>O?T=by(P,T,p.subarray(A,O)):(P[A]=!0,T=by(P,T,p.subarray(A,E)))}else{for(var M=aN[v-1],R=M>>>13,L=8191&M,N=(1<<y)-1,j=new wr(32768),V=new wr(N+1),G=Math.ceil(y/3),Y=2*G,K=function(vt){return(p[vt]^p[vt+1]<<G^p[vt+2]<<Y)&N},B=new Lu(25e3),X=new wr(288),$=new wr(32),ee=0,H=0,D=(A=0,0),q=0,re=0;E>A;++A){var se=K(A),oe=32767&A,ue=V[se];if(j[oe]=ue,V[se]=oe,A>=q){var de=E-A;if((ee>7e3||D>24576)&&de>423){T=lE(p,P,0,B,X,$,H,D,re,A-re,T),D=ee=H=0,re=A;for(var ie=0;286>ie;++ie)X[ie]=0;for(ie=0;30>ie;++ie)$[ie]=0}var ae=2,me=0,Se=L,Re=oe-ue&32767;if(de>2&&se==K(A-Re))for(var Ke=Math.min(R,de)-1,it=Math.min(32767,A),Oe=Math.min(258,de);it>=Re&&--Se&&oe!=ue;){if(p[A+ae]==p[A+ae-Re]){for(var at=0;Oe>at&&p[A+at]==p[A+at-Re];++at);if(at>ae){if(ae=at,me=Re,at>Ke)break;var It=Math.min(Re,at-2),mt=0;for(ie=0;It>ie;++ie){var je=A-Re+ie+32768&32767,Qe=je-j[je]+32768&32767;Qe>mt&&(mt=Qe,ue=je)}}}Re+=(oe=ue)-(ue=j[oe])+32768&32767}if(me){B[D++]=268435456|xy[ae]<<18|oE[me];var lt=31&xy[ae],Je=31&oE[me];H+=l2[lt]+u2[Je],++X[257+lt],++$[Je],q=A+ae,++ee}else B[D++]=p[A],++X[p[A]]}}T=lE(p,P,!0,B,X,$,H,D,re,A-re,T)}return L6(C,0,x+M6(T)+_)})(i=t,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+a.mem,u,c)),h=f.length;return(function(p,v){var y=v.filename;if(p[0]=31,p[1]=139,p[2]=8,p[8]=2>v.level?4:v.level==9?2:0,p[9]=3,v.mtime!=0&&bv(p,4,Math.floor(new Date(v.mtime||Date.now())/1e3)),y){p[3]=8;for(var x=0;y.length>=x;++x)p[x+10]=y.charCodeAt(x)}})(f,e),bv(f,h-8,n.d()),bv(f,h-4,r),f}var cN=!!U1||!!z1,O6="text/plain",dp=!1,Sy=(t,e)=>{var[n,r]=t.split("#"),[s,i]=n.split("?");if(!i)return t;var a=i.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(a?"?"+a:"")+(r?"#"+r:"")},N6=function(t,e,n){var r;n===void 0&&(n=!0);var[s,i]=t.split("?"),a=pe({},e),u=(r=i==null?void 0:i.split("&").map((f=>{var h,[p,v]=f.split("="),y=n&&(h=a[p])!==null&&h!==void 0?h:v;return delete a[p],p+"="+y})))!==null&&r!==void 0?r:[],c=(function(f,h){var p,v;h===void 0&&(h="&");var y=[];return bt(f,(function(x,_){be(x)||be(_)||_==="undefined"||(p=encodeURIComponent((b=>b instanceof File)(x)?x.name:x.toString()),v=encodeURIComponent(_),y[y.length]=v+"="+p)})),y.join(h)})(a);return c&&u.push(c),s+"?"+u.join("&")},eu=(t,e)=>JSON.stringify(t,((n,r)=>typeof r=="bigint"?r.toString():r),e),uE=t=>{if(t.Lt)return t.Lt;var{data:e,compression:n}=t;if(e){if(n===os.GZipJS){var r=uN((function(u,c){var f=u.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(u);for(var h=new ds(u.length+(u.length>>>1)),p=0,v=function(b){h[p++]=b},y=0;f>y;++y){if(p+5>h.length){var x=new ds(p+8+(f-y<<1));x.set(h),h=x}var _=u.charCodeAt(y);128>_?v(_):2048>_?(v(192|_>>>6),v(128|63&_)):_>55295&&57344>_?(v(240|(_=65536+(1047552&_)|1023&u.charCodeAt(++y))>>>18),v(128|_>>>12&63),v(128|_>>>6&63),v(128|63&_)):(v(224|_>>>12),v(128|_>>>6&63),v(128|63&_))}return L6(h,0,p)})(eu(e)),{mtime:0});return{contentType:O6,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===os.Base64){var s=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,((c,f)=>String.fromCharCode(parseInt(f,16)))))})(eu(e)),i=(u=>"data="+encodeURIComponent(typeof u=="string"?u:eu(u)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var a=eu(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},D6=t=>{var e,n,r=()=>({url:Sy(t.url,"compression"),encodedBody:uE(pe({},t,{compression:void 0,Lt:void 0}))});try{e=uE(t)}catch(s){if(LS(t.compression,Iu(t.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",s),r();throw s}return e&&LS(t.compression,Iu(t.url,"compression"))&&!((n=e.body)instanceof ArrayBuffer?B1(new Uint8Array(n)):ArrayBuffer.isView(n)&&B1(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(dp=!0,r()):{url:t.url,encodedBody:e}},cE=t=>{try{return D6(t)}catch(e){return _e.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},dN=(function(){var t=en((function*(e){var n=eu(e.data),r=yield(function(i,a,u){return W1.apply(this,arguments)})(n,Vt.DEBUG,{rethrow:!0});if(!r)return e;var s=yield r.arrayBuffer();return pe({},e,{Lt:{contentType:O6,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),fN=["/e/","/s/"],dE=(t,e)=>{var n=(s=>{var i=(a=>{var u=Md(a),c=(u==null?void 0:u.pathname)||a.split(/[?#]/)[0];return c?c[0]==="/"?c:"/"+c:"/"})(s);return fN.some((a=>((u,c)=>u.slice(u.length-c.length)===c)(i,a)))})(t),r=n?Sy(t,"ver"):t;return N6(e===os.GZipJS?Sy(r,"compression"):r,pe({_:new Date().getTime().toString()},n?{}:{ver:Vt.JS_SDK_VERSION},e===os.GZipJS?{}:{compression:e}))},fp=[];z1&&fp.push({transport:"fetch",method(t){var e,n=cE(t);if(n){var{url:r,encodedBody:s}=n,{contentType:i,body:a,estimatedSize:u}=s??{},c=new Headers;bt(t.headers,(function(v,y){c.append(y,v)})),i&&c.append("Content-Type",i);var f=null,h=!1;if(CS){var p=new CS;f={signal:p.signal,timeout:setTimeout((()=>{var v,y;h=!0,p.abort((v=t.timeout,(y=new Error("PostHog request timed out"+(v?" after "+v+"ms":""))).name="AbortError",y))}),t.timeout)}}z1(r,pe({method:(t==null?void 0:t.method)||"GET",headers:c,keepalive:t.method==="POST"&&52428.8>(u||0),body:a,signal:(e=f)==null?void 0:e.signal},t.fetchOptions)).then((v=>v.text().then((y=>{var x={statusCode:v.status,text:y};if(v.status===200)try{x.json=JSON.parse(y)}catch(_){_e.error(_)}t.callback==null||t.callback(x)})))).catch((v=>{h&&(v==null?void 0:v.name)==="AbortError"?_e.warn(v):_e.error(v),t.callback==null||t.callback({statusCode:0,error:v})})).finally((()=>f?clearTimeout(f.timeout):null))}}}),U1&&fp.push({transport:"XHR",method(t){var e=cE(t);if(e){var n=new U1,{url:r,encodedBody:s}=e;n.open(t.method||"GET",r,!0);var{contentType:i,body:a}=s??{};bt(t.headers,(function(u,c){n.setRequestHeader(c,u)})),i&&n.setRequestHeader("Content-Type",i),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var u={statusCode:n.status,text:n.responseText};if(n.status===200)try{u.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(u)}},n.send(a)}}}),sr!=null&&sr.sendBeacon&&fp.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:n}=D6(t),{contentType:r,body:s}=n??{};if(!s)return;var i=s instanceof Blob?s:new Blob([s],{type:r});sr.sendBeacon(e,i)}catch{}}});var Ey=3e3;class hN{constructor(e,n){this.Rr=!0,this.Or=[],this.Lr=si((n==null?void 0:n.flush_interval_ms)||Ey,250,5e3,_e.createLogger("flush interval"),Ey),this.Fr=e}enqueue(e){this.Or.push(e),this.Ar||this.Dr()}unload(){this.$r();var e=this.Or.length>0?this.Nr():{},n=Object.values(e);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.qr(pe({},r,{transport:"sendBeacon"}))}))}enable(){this.Rr=!1,this.Dr()}Dr(){var e=this;this.Rr||(this.Ar=setTimeout((()=>{if(this.$r(),this.Or.length>0){var n=this.Nr(),r=function(){var i=n[s],a=new Date().getTime();i.data&&tt(i.data)&&bt(i.data,(u=>{u.offset=Math.abs(u.timestamp-a),delete u.timestamp})),e.qr(i)};for(var s in n)r()}}),this.Lr))}qr(e){try{this.Fr(e)}catch(n){_e.error(n)}}$r(){clearTimeout(this.Ar),this.Ar=void 0}Nr(){var e={};return bt(this.Or,(n=>{var r,s=n,i=(s?s.batchKey:null)||s.url;be(e[i])&&(e[i]=pe({},s,{data:[]})),(r=e[i].data)==null||r.push(s.data)})),this.Or=[],e}}var pN=["retriesPerformedSoFar"];class mN{constructor(e){this.Br=!1,this.jr=3e3,this.Or=[],this._instance=e,this.Or=[],this.Hr=!0,!be(te)&&"onLine"in te.navigator&&(this.Hr=te.navigator.onLine,this.Ur=()=>{this.Hr=!0,this.zr()},this.Vr=()=>{this.Hr=!1},$t(te,"online",this.Ur),$t(te,"offline",this.Vr))}get length(){return this.Or.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=g8(e,pN);Li(n)&&(r.url=N6(r.url,{retry_count:n})),this._instance._send_request(pe({},r,{callback:s=>{if(s.statusCode!==200&&(400>s.statusCode||s.statusCode>=500)){if((s.statusCode===0?3:10)>(n??0))return void this.st(pe({retriesPerformedSoFar:n},r));s.statusCode===0&&_e.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(s)}}))}st(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=(function(a){var u=3e3*Math.pow(2,a),c=u/2,f=Math.min(18e5,u),h=Math.random()-.5;return Math.ceil(f+h*(f-c))})(n),s=Date.now()+r;this.Or.push({retryAt:s,requestOptions:e});var i="Enqueued failed request for retry in "+r;navigator.onLine||(i+=" (Browser is offline)"),_e.warn(i),this.Br||(this.Br=!0,this.Wr())}Wr(){if(this.Gr&&clearTimeout(this.Gr),this.Or.length===0)return this.Br=!1,void(this.Gr=void 0);this.Gr=setTimeout((()=>{this.Hr&&this.Or.length>0&&this.zr(),this.Wr()}),this.jr)}zr(){var e=Date.now(),n=[],r=this.Or.filter((i=>e>i.retryAt||(n.push(i),!1)));if(this.Or=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Gr&&(clearTimeout(this.Gr),this.Gr=void 0),this.Br=!1,be(te)||(this.Ur&&(te.removeEventListener("online",this.Ur),this.Ur=void 0),this.Vr&&(te.removeEventListener("offline",this.Vr),this.Vr=void 0)),this.Or))try{this._instance._send_request(pe({},e,{transport:"sendBeacon"}))}catch(n){_e.error(n)}this.Or=[]}}class gN{constructor(e){this.Zr=()=>{var n,r,s,i;this.Qr||(this.Qr={});var a=this.scrollElement(),u=this.scrollY(),c=a?Math.max(0,a.scrollHeight-a.clientHeight):0,f=u+((a==null?void 0:a.clientHeight)||0),h=(a==null?void 0:a.scrollHeight)||0;this.Qr.lastScrollY=Math.ceil(u),this.Qr.maxScrollY=Math.max(u,(n=this.Qr.maxScrollY)!==null&&n!==void 0?n:0),this.Qr.maxScrollHeight=Math.max(c,(r=this.Qr.maxScrollHeight)!==null&&r!==void 0?r:0),this.Qr.lastContentY=f,this.Qr.maxContentY=Math.max(f,(s=this.Qr.maxContentY)!==null&&s!==void 0?s:0),this.Qr.maxContentHeight=Math.max(h,(i=this.Qr.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=e}get Jr(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var e=this.Qr;return setTimeout(this.Zr,0),e}startMeasuringScrollPosition(){$t(te,"scroll",this.Zr,{capture:!0}),$t(te,"scrollend",this.Zr,{capture:!0}),$t(te,"resize",this.Zr)}scrollElement(){if(!this.Jr)return te==null?void 0:te.document.documentElement;var e=tt(this.Jr)?this.Jr:[this.Jr];for(var n of e){var r=te==null?void 0:te.document.querySelector(n);if(r)return r}}Kr(e){var n=e==="y"?"scrollTop":"scrollLeft";if(this.Jr){var r=this.scrollElement();return r&&r[n]||0}return te?e==="y"?te.scrollY||te.pageYOffset||te.document.documentElement.scrollTop||0:te.scrollX||te.pageXOffset||te.document.documentElement.scrollLeft||0:0}scrollY(){return this.Kr("y")}scrollX(){return this.Kr("x")}}var vN=t=>k6(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties,t==null?void 0:t.config.disable_capture_url_hashes);class fE{constructor(e,n,r,s){this.Yr=i=>{var a=this.Xr();if(!a||a.sessionId!==i){var u={sessionId:i,props:this.ei(this._instance)};this.ti.register({[fy]:u})}},this._instance=e,this.ri=n,this.ti=r,this.ei=s||vN,this.ri.onSessionId(this.Yr)}Xr(){return this.ti.props[fy]}getSetOnceProps(){var e,n=(e=this.Xr())==null?void 0:e.props;return n?"r"in n?C6(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(){var e={};return bt(s2(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+G1(r)]=n})),e}}class c2{constructor(){this.ii={}}on(e,n){return this.ii[e]||(this.ii[e]=[]),this.ii[e].push(n),()=>{this.ii[e]=this.ii[e].filter((r=>r!==n))}}emit(e,n){for(var r of this.ii[e]||[])r(n);for(var s of this.ii["*"]||[])s(e,n)}}var Uc=Dt("[SessionId]");class hE{on(e,n){return this.ni.on(e,n)}constructor(e,n,r){var s;if(this.si=null,this.oi=[],this.ai=void 0,this.li=!1,this.ni=new c2,this.ui=(f,h)=>!(!Li(f)||!Li(h))&&Math.abs(f-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===zi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.ti=e.persistence,this.hi=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ci=n||Fi,this.vi=r||Fi;var i=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*si(this.Se.session_idle_timeout_seconds||1800,60,36e3,Uc.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+i+"_window_id",this.gi="ph_"+i+"_primary_window_exists",this.mi()){var a=jn.F(this.pi),u=jn.F(this.gi);a&&!u?this.hi=a:jn.P(this.pi),jn.q(this.gi,!0)}if((s=this.Se.bootstrap)!=null&&s.sessionID)try{var c=(f=>{var h=this.Se.bootstrap.sessionID.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})();this.yi(this.Se.bootstrap.sessionID,new Date().getTime(),c)}catch(f){Uc.error("Invalid sessionID in bootstrap",f)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return be(this.oi)&&(this.oi=[]),this.oi.push(e),this.di&&e(this.di,this.hi),()=>{this.oi=this.oi.filter((n=>n!==e))}}mi(){return this.Se.persistence!=="memory"&&!this.ti.rr&&jn.N()}wi(e){e!==this.hi&&(this.hi=e,this.mi()&&jn.q(this.pi,e))}xi(){return this.hi?this.hi:this.mi()?jn.F(this.pi):null}ki(e){var n=this.si;return!ar(n)&&!ar(e)&&5e3>Math.abs(e-n)}yi(e,n,r){var s=n!==this._sessionActivityTimestamp,i=!(e!==this.di||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.di=e,i&&!s||i&&this.ki(n)||(this.si=n,this.ti.register({[Jl]:[n,e,r]}))}Si(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return Li(n)&&n>0}Ci(){this.Si()?this.ti.refreshKey(Jl):(this.ti.flush(),this.ti.load())}Ii(){var e;if(!ar(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.si){this.Ci();var[,n,r]=this.Ti();n===this.di&&r===this._sessionStartTimestamp&&(this.si=this._sessionActivityTimestamp,this.ti.register({[Jl]:[this._sessionActivityTimestamp,(e=this.di)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.ti.flush())}}Mi(){var[e]=this.Ti(),n=Li(e)?e:0,r=Li(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}Ei(e){return this.Ci(),this.ui(e,this.Mi())}Ti(){var e=this.ti.props[Jl];return tt(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.si=null,clearTimeout(this.Pi),this.Pi=void 0,this.yi(null,null,null)}destroy(){this.li=!0,this.Ii(),clearTimeout(this.Pi),this.Pi=void 0,this.ai&&te&&(te.removeEventListener(Jp,this.ai,{capture:!1}),this.ai=void 0),this.oi=[]}bi(){this.ai=()=>{this.Ii(),this.mi()&&jn.P(this.gi)},$t(te,Jp,this.ai,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.Se.cookieless_mode===zi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[,s,i]=this.Ti(),a=this.Mi(),u=this.xi(),c=Li(i)&&Math.abs(r-i)>864e5,f=!1,h=!1,p=!s,v=s,y=!p&&!e&&this.ui(r,a);y&&((y=this.Ei(r))||Uc.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,i]=this.Ti()),p||y||c?(s=this.ci(),u=this.vi(),Uc.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:p,activityTimeout:y,sessionPastMaximumLength:c}}),i=r,f=!0):(u||(u=this.vi(),f=!0),(h=s!==v)&&(Uc.info("adopted cross-tab session id",{sessionId:s,windowId:u}),f=!0));var x=Li(a)&&e&&!c?a:r,_=Li(i)?i:new Date().getTime();this.wi(u),this.yi(s,x,_),e||this.fi();var b={noSessionId:p,activityTimeout:y,sessionPastMaximumLength:c,crossTabAdoption:h};return f&&this.oi.forEach((E=>E(s,u,b))),{sessionId:s,windowId:u,sessionStartTimestamp:_,changeReason:f?b:void 0,lastActivityTimestamp:a}}fi(){this.li||(clearTimeout(this.Pi),this.Pi=setTimeout((()=>{if(!this.li)if(this.Ei(new Date().getTime())){var e=this.di;this.resetSessionId(),this.ni.emit("forcedIdleReset",{idleSessionId:e})}else this.fi()}),1.1*this.sessionTimeoutMs))}}var j6=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&NS(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>NS(s==null?void 0:s.brand,e))))return!0}catch{}return!!t.webdriver};function F6(){return(F6=en((function*(){var t=sr==null?void 0:sr.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),n=e==null?void 0:e.model;return _t(n)&&n.length>0?n:void 0}catch(r){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var im=function(t,e){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function pE(t,e,n){return eu({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var V6={exact:(t,e)=>e.some((n=>t.some((r=>n===r)))),is_not:(t,e)=>e.every((n=>t.every((r=>n!==r)))),regex:(t,e)=>e.some((n=>t.some((r=>im(n,r))))),not_regex:(t,e)=>e.every((n=>t.every((r=>!im(n,r))))),icontains:(t,e)=>e.map(Dh).some((n=>t.map(Dh).some((r=>n.includes(r))))),not_icontains:(t,e)=>e.map(Dh).every((n=>t.map(Dh).every((r=>!n.includes(r))))),gt:(t,e)=>e.some((n=>{var r=parseFloat(n);return!isNaN(r)&&t.some((s=>r>parseFloat(s)))})),lt:(t,e)=>e.some((n=>{var r=parseFloat(n);return!isNaN(r)&&t.some((s=>r<parseFloat(s)))}))},Dh=t=>t.toLowerCase();function $6(t,e){return!t||Object.entries(t).every((n=>{var[r,s]=n,i=e==null?void 0:e[r];if(be(i)||ar(i))return!1;var a=[String(i)],u=V6[s.operator];return!!u&&u(s.values,a)}))}var ky="custom",mE="i.posthog.com",yN=/^\/static\//;class _N{constructor(e){this.Ri={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+mE,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Ri[this.apiHost]||(this.Ri[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":ky),this.Ri[this.apiHost]}Oi(e){if(yN.test(e)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(e==="assets"){var r=this.Oi(n);if(r)return""+r+n}if(this.region===ky)return this.apiHost+n;var s=mE+n;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var yt=Dt("[Surveys]"),Cy="seenSurvey_",H6=t=>{try{var e=(n=>((r,s)=>{var i=""+Cy+s.id;return s.current_iteration&&s.current_iteration>0&&(i=""+Cy+s.id+"_"+s.current_iteration),i})(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(n){yt.error("Failed to persist survey seen state",n)}},xN=[_v.Popover,_v.Widget,_v.API],wN={ignoreConditions:!1,ignoreDelay:!1,displayType:_y.Popover},bN=Dt("[PostHog ExternalIntegrations]"),SN={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class EN{constructor(e){this._instance=e}Bt(e,n){var r;(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(s=>{if(s)return bN.error("failed to load script",s);n()}))}startIfEnabledOrStop(){var e=this,n=function(a){var u,c,f;!s||(u=$e.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[a]||e.Bt(SN[a],(()=>{var h;(h=$e.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[a])==null||h.start(e._instance)})),!s&&(c=$e.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[a]&&((f=$e.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[a])==null||f.stop())};for(var[r,s]of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n(r)}}}var pd={},Sv=0,om=()=>{},gE='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Bc="Surveys module not available",vE="sanitize_properties is deprecated. Use before_send instead",z6="Invalid value for property_denylist config: ",Xl="posthog",U6=!cN&&(vr==null?void 0:vr.indexOf("MSIE"))===-1&&(vr==null?void 0:vr.indexOf("Mozilla"))===-1,yE=t=>{var e;return pe({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:PO(Ee==null?void 0:Ee.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:om,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:on&&_t(on==null?void 0:on.search)&&on.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,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(te==null||(e=te.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,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,surveys_request_timeout_ms:1e4,on_request_error(n){_e.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:gy,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Ey},error_tracking:{},_onCapture:om},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:VO,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},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)}))(t))},kN=[["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"]],_E=t=>{var e={};for(var[n,r]of kN)be(t[n])||(e[r]=t[n]);var s=At({},e,t),i=t.__preview_external_dependency_versioned_paths;return be(i)||(be(t.strict_script_versioning)&&(s.strict_script_versioning=!!i),_t(i)&&be(t.asset_host)&&(s.asset_host=i)),tt(t.property_blacklist)&&(be(t.property_denylist)?s.property_denylist=t.property_blacklist:tt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:_e.error(z6+t.property_denylist)),s};class CN{constructor(){this.__forceAllowLocalhost=!1}get Li(){return this.__forceAllowLocalhost}set Li(e){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class as{Fi(e,n){if(e){var r=this.Ai.indexOf(e);r!==-1&&this.Ai.splice(r,1)}return this.Ai.push(n),n.initialize==null||n.initialize(),n}Di(){return this.config.cookieless_mode===zi||this.config.cookieless_mode===Da&&this.consent.isRejected()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new CN,this.$i=!1,this.version=Vt.LIB_VERSION,this.Ni=new c2,this.Ai=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=yE(),this.SentryIntegration=ZO,this.sentryIntegration=r=>(function(s,i){var a=y6(s,i);return{name:v6,processEvent:u=>a(u)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.qi=!1,this.Bi=null,this.ji=null,this.Hi=null,this.scrollManager=new gN(this),this.pageViewManager=new tE(this),this.rateLimiter=new sN(this),this.requestRouter=new _N(this),this.consent=new OO(this),this.externalIntegrations=new EN(this);var n=(e=as.__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:(r,s,i)=>{var a=_t(r)?{[r]:s}:r;this.setPersonProperties(a),i==null||i({})},set_once:(r,s,i)=>{var a=_t(r)?{[r]:s}:r;this.setPersonProperties(void 0,a),i==null||i({})}},this.on("eventCaptured",(r=>_e.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(e,n,r){if(r&&r!==Xl){var s,i=(s=pd[r])!==null&&s!==void 0?s:new as;return i._init(e,n,r),pd[r]=i,pd[Xl][r]=i,i}return this._init(e,n,r)}_init(e,n,r){var s,i;n===void 0&&(n={});var a=_t(e)?e.trim():"";if(!a)return _e.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Ui(n.debug),this.zi=n,this.Vi=[],n.person_profiles?this.ji=n.person_profiles:n.process_person&&(this.ji=n.process_person);var u=yE(n.defaults),c=_E(n),f=At({},u,c,{name:r,token:a});Ot(u.rageclick)&&Ot(c.rageclick)&&(f.rageclick=At({},u.rageclick,c.rageclick)),Ot(u.session_recording)&&Ot(c.session_recording)&&(f.session_recording=At({},u.session_recording,c.session_recording)),this.set_config(f),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:os.GZipJS;var h=this.Wi();this.persistence=new yv(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yv(pe({},this.config,{persistence:"sessionStorage"}),h,!1);var p=pe({},this.persistence.props),v=pe({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Gi=new hN((T=>this.Zi(T)),this.config.request_queue_config),this.Qi=new mN(this),this.__request_queue=[];var y=this.Di();if(y||(this.sessionManager=new hE(this),this.sessionPropsManager=new fE(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ji(y)}),0)):(_e.info("Initializing extensions synchronously"),this.Ji(y)),Vt.DEBUG=Vt.DEBUG||this.config.debug,Vt.DEBUG&&_e.info("Starting in debug mode",{this:this,config:n,thisC:pe({},this.config),p,s:v}),!this.config.identity_distinct_id||(s=n.bootstrap)!=null&&s.distinctID||(n.bootstrap=pe({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((i=n.bootstrap)==null?void 0:i.distinctID)!==void 0){var x=n.bootstrap.distinctID,_=this.get_distinct_id(),b=this.persistence.get_property(Es);if(n.bootstrap.isIdentifiedID&&_!=null&&_!==x&&b===Vl)this.identify(x);else if(n.bootstrap.isIdentifiedID&&_!=null&&_!==x&&b===$l)_e.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{var E=this.config.get_device_id(Fi()),C=n.bootstrap.isIdentifiedID?E:x;this.persistence.set_property(Es,n.bootstrap.isIdentifiedID?$l:Vl),this.register({distinct_id:x,$device_id:C})}}if(y)this.register_once({distinct_id:Rh,$device_id:null},"");else if(!this.get_distinct_id()){var P=this.config.get_device_id(Fi());this.register_once({distinct_id:P,$device_id:P},""),this.persistence.set_property(Es,Vl)}return $t(te,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(T,A){var O=T.config.segment;if(!O)return A();(function(M,R){var L=M.config.segment;if(!L)return R();var N=V=>{var G=()=>V.anonymousId()||Fi();M.config.get_device_id=G,V.id()&&(M.register({distinct_id:V.id(),$device_id:G()}),M.persistence.set_property(Es,$l)),R()},j=L.user();"then"in j&&Ts(j.then)?j.then(N):N(j)})(T,(()=>{O.register((M=>{typeof Promise<"u"&&Promise.resolve||vv.warn("This browser does not have Promise support, and can not use the segment integration");var R=(L,N)=>{if(!N)return L;L.event.userId||L.event.anonymousId===M.get_distinct_id()||(vv.info("No userId set, resetting PostHog"),M.reset()),L.event.userId&&L.event.userId!==M.get_distinct_id()&&(vv.info("UserId set, identifying with PostHog"),M.identify(L.event.userId));var j=M.calculateEventProperties(N,L.event.properties);return L.event.properties=Object.assign({},j,L.event.properties),L};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:L=>R(L,L.event.event),page:L=>R(L,Yl),identify:L=>R(L,pv),screen:L=>R(L,"$screen")}})(T)).then((()=>{A()}))}))})(this,(()=>this.Ki())):this.Ki(),Ts(this.config._onCapture)&&this.config._onCapture!==om&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(T=>this.config._onCapture(T.event,T)))),this.config.ip&&_e.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 F6.apply(this,arguments)})().then((T=>{T&&this.register({[fv]:T})})).catch(om),this}Ji(e){var n,r,s,i,a,u,c,f,h=performance.now(),p=pe({},as.__defaultExtensionClasses,this.config.__extensionClasses),v=[];p.featureFlags&&this.Ai.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new p.featureFlags(this)),p.exceptions&&this.Ai.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new p.exceptions(this)),p.historyAutocapture&&this.Ai.push(this.historyAutocapture=new p.historyAutocapture(this)),p.tracingHeaders&&this.Ai.push(this.tracingHeaders=new p.tracingHeaders(this)),p.siteApps&&this.Ai.push(this.siteApps=new p.siteApps(this)),p.sessionRecording&&!e&&this.Ai.push(this.sessionRecording=new p.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),p.autocapture&&this.Ai.push(this.autocapture=new p.autocapture(this)),p.surveys&&this.Ai.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new p.surveys(this)),p.logs&&this.Ai.push(this.logs=(i=this.logs)!==null&&i!==void 0?i:new p.logs(this)),p.metrics&&this.Ai.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new p.metrics(this)),p.conversations&&this.Ai.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new p.conversations(this)),p.productTours&&this.Ai.push(this.productTours=new p.productTours(this)),p.heatmaps&&this.Ai.push(this.heatmaps=new p.heatmaps(this)),p.webVitalsAutocapture&&this.Ai.push(this.webVitalsAutocapture=new p.webVitalsAutocapture(this)),p.exceptionObserver&&this.Ai.push(this.exceptionObserver=new p.exceptionObserver(this)),p.deadClicksAutocapture&&this.Ai.push(this.deadClicksAutocapture=new p.deadClicksAutocapture(this,KO)),p.toolbar&&this.Ai.push(this.toolbar=(c=this.toolbar)!==null&&c!==void 0?c:new p.toolbar(this)),p.experiments&&this.Ai.push(this.experiments=(f=this.experiments)!==null&&f!==void 0?f:new p.experiments(this)),this.Ai.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Yi){var y=this.Yi;this.Yi=void 0,this.Tr(y)}})),this.Xi(v,h)}Xi(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout((()=>{this.Xi(e,n)}),0);var r=e.shift();if(r)try{r()}catch(i){_e.error("Error initializing extension:",i)}}var s=Math.round(performance.now()-n);this.register_for_session({[t6]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[n6]:s}),this.config.__preview_deferred_init_extensions&&_e.info("PostHog extensions initialized ("+s+"ms)")}Tr(e){var n;if(!Ee||!Ee.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Tr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Yi=e),this.en=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Be(e.supportedCompression,os.GZipJS)?os.GZipJS:Be(e.supportedCompression,os.Base64)?os.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ji?this.ji:gy}),this.Ai.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e)))}Ki(){try{this.config.loaded(this)}catch(r){_e.critical("`loaded` function failed",r)}if(this.tn(),this.config.internal_or_test_user_hostname&&on!=null&&on.hostname){var e=on.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.Di())&&this.rn()}),1),this.nn=new T6(this),this.nn.load()}tn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Gi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ih(this.__request_queue,(e=>this.Zi(e))),this.__request_queue=[],this.tn()}_handle_unload(){var e,n,r,s,i;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.sn()&&this.capture(hv),(r=this.logs)==null||r.flushLogs("sendBeacon"),(s=this.Gi)==null||s.unload(),(i=this.Qi)==null||i.unload()):this.sn()&&this.capture(hv,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?U6?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=pe({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(be(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,s,i,a=pe({},n);a.timeout=a.timeout||6e4,a.url=dE(a.url,a.compression);var u=(r=a.transport)!==null&&r!==void 0?r:"fetch",c=fp.filter((h=>!a.disableTransport||!h.transport||!a.disableTransport.includes(h.transport))),f=(s=(i=(function(h,p){for(var v=0;h.length>v;v++)if(h[v].transport===u)return h[v]})(c))==null?void 0:i.method)!==null&&s!==void 0?s:c[0].method;if(!f)throw new Error("No available transport method");u!=="sendBeacon"&&a.data&&a.compression===os.GZipJS&&RL&&typeof Promise<"u"&&!dp?dN(a).then((h=>{f(h)})).catch((h=>{if(OS(h))return dp=!0,void f(pe({},a,{compression:void 0,url:dE(n.url,void 0)}));(p=>{if(!p||typeof p!="object")return!1;var v="name"in p?String(p.name):"";return OS(p)||v===v8})(h)&&(dp=!0),f(a)})):f(a)})(pe({},e,{callback:n=>{var r,s;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,n),e.callback==null||e.callback(n)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Zi(e){this.Qi?this.Qi.retriableRequest(e):this._send_request(e)}_execute_array(e){Sv++;try{var n,r=[],s=[],i=[];Ih(e,(u=>{if(u)if(tt(n=u[0]))i.push(u);else if(Ts(u))try{u.call(this)}catch(c){_e.error("Error executing queued PostHog call",u,c)}else tt(u)&&n==="alias"?r.push(u):tt(u)&&n.indexOf("capture")!==-1&&Ts(this[n])?i.push(u):s.push(u)}));var a=function(u,c){Ih(u,(function(f){try{if(tt(f[0])){var h=c;bt(f,(function(p){h=h[p[0]].apply(h,p.slice(1))}))}else c[f[0]].apply(c,f.slice(1))}catch(p){_e.error("Error executing queued PostHog call",f,p)}}))};a(r,this),a(s,this),a(i,this)}finally{Sv--}}push(e){if(Sv>0&&tt(e)&&_t(e[0])){var n=as.prototype[e[0]];Ts(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var s,i,a,u,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gi){if(this.is_capturing())if(!be(e)&&_t(e)){var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var h=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h==null||!h.isRateLimited){n!=null&&n.$current_url&&!_t(n==null?void 0:n.$current_url)&&(_e.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"||r!=null&&r.an||_e.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&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var p=new Date,v=(r==null?void 0:r.timestamp)||p,y=VS(r==null?void 0:r.uuid,Fi),x={uuid:y,event:e,properties:this.calculateEventProperties(e,n||{},v,y)};e===Yl&&this.config.__preview_capture_bot_pageviews&&f&&(x.event="$bot_pageview",x.properties.$browser_type="bot"),h&&(x.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),r!=null&&r.$set&&(x.$set=r==null?void 0:r.$set);var _=r==null?void 0:r.$unset;_&&(x.$unset=_);var b,E,C,P=this.ln(r==null?void 0:r.$set_once,e!==BS,e===pv);if(P&&(x.$set_once=P),r!=null&&r._noTruncate||(i=this.config.properties_string_max_length,a=x,u=N=>_t(N)?N.slice(0,i):N,c=new Set,x=(function N(j,V){return j!==Object(j)?u?u(j):j:c.has(j)?void 0:(c.add(j),tt(j)?(G=[],Ih(j,(Y=>{G.push(N(Y))}))):(G={},bt(j,((Y,K)=>{c.has(Y)||(G[K]=N(Y))}))),G);var G})(a)),x.timestamp=v,be(r==null?void 0:r.timestamp)||(x.properties.$event_time_override_provided=!0,x.properties.$event_time_override_system_time=p),e===Ui.DISMISSED||e===Ui.SENT){var T=n==null?void 0:n[xv.SURVEY_ID],A=n==null?void 0:n[xv.SURVEY_ITERATION];H6({id:T,current_iteration:A}),x.$set=pe({},x.$set,{[(b={id:T,current_iteration:A},E=e===Ui.SENT?"responded":"dismissed",C="$survey_"+E+"/"+b.id,b.current_iteration&&b.current_iteration>0&&(C="$survey_"+E+"/"+b.id+"/"+b.current_iteration),C)]:!0})}else e===Ui.SHOWN&&(x.$set=pe({},x.$set,{[xv.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===rN.SHOWN){var O=n==null?void 0:n[rE.TOUR_TYPE];O&&(x.$set=pe({},x.$set,{[rE.TOUR_LAST_SEEN_DATE+"/"+O]:new Date().toISOString()}))}var M=pe({},x.properties.$set,x.$set);if(Do(M)||this.setPersonPropertiesForFlags(M),!Ye(this.config.before_send)){var R=this.it(x);if(!R)return;(x=R).uuid=VS(x.uuid,Fi)}this.Ni.emit("eventCaptured",x);var L={method:"POST",url:(s=r==null?void 0:r._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:x,compression:"best-available",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Zi(L):this.Gi.enqueue(L),x}_e.critical("This capture call is ignored due to client rate limiting.")}}else _e.error("No event name provided to posthog.capture")}else _e.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(n=>e(n.event,n)))}calculateEventProperties(e,n,r,s,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var a=i?void 0:this.persistence.remove_event_timer(e),u=pe({},n);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Di()&&(u.$cookieless_mode=!0),e==="$snapshot"){var c=pe({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=c.distinct_id,(!_t(u.distinct_id)&&!$n(u.distinct_id)||K1(u.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var f,h=(function(E,C,P,T){var A,O,M,R;if(T===void 0&&(T=!1),!vr)return{};var L,N,j,V,G,Y,K,B,X,$=E?[...Mu,...C||[]]:[],[ee,H]=(function(se){for(var oe=0;jS.length>oe;oe++){var[ue,de]=jS[oe],ie=ue.exec(se),ae=ie&&(Ts(de)?de(ie,se):de);if(ae)return ae}return["",""]})(vr),D=(L=typeof navigator<"u"?navigator:void 0)!=null&&L.brave?{brave:!0}:{},q={detectGoogleSearchApp:P},re=At(s2({$os:ee,$os_version:H,$browser:$8(vr,navigator.vendor,D,q),$device:FS(vr),$device_type:(j=vr,V={userAgentDataPlatform:(A=navigator)==null||(A=A.userAgentData)==null?void 0:A.platform,maxTouchPoints:(O=navigator)==null?void 0:O.maxTouchPoints,screenWidth:te==null||(M=te.screen)==null?void 0:M.width,screenHeight:te==null||(R=te.screen)==null?void 0:R.height,devicePixelRatio:te==null?void 0:te.devicePixelRatio},X=FS(j),X===b8||X===w8||X==="Kobo"||X==="Kindle Fire"||X===N8?Tu:X===Td||X===au||X===Ad||X===q1?"Console":X===E8?"Wearable":X?zr:(V==null?void 0:V.userAgentDataPlatform)==="Android"&&((G=V==null?void 0:V.maxTouchPoints)!==null&&G!==void 0?G:0)>0?600>Math.min((Y=V==null?void 0:V.screenWidth)!==null&&Y!==void 0?Y:0,(K=V==null?void 0:V.screenHeight)!==null&&K!==void 0?K:0)/((B=V==null?void 0:V.devicePixelRatio)!==null&&B!==void 0?B:1)?zr:Tu:"Desktop"),$timezone:P6(),$timezone_offset:JO()}),{$current_url:Ld(T?Wo(on==null?void 0:on.href):on==null?void 0:on.href,$,Od),$host:on==null?void 0:on.host,$pathname:on==null?void 0:on.pathname,$raw_user_agent:vr.length>1e3?vr.substring(0,997)+"...":vr,$browser_version:qL(vr,navigator.vendor,D,q),$browser_language:nE(),$browser_language_prefix:(N=nE(),typeof N=="string"?N.split("-")[0]:void 0),$screen_height:te==null?void 0:te.screen.height,$screen_width:te==null?void 0:te.screen.width,$viewport_height:te==null?void 0:te.innerHeight,$viewport_width:te==null?void 0:te.innerWidth,$lib:Vt.LIB_NAME,$lib_version:Vt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Vt.SDK_DIST_CHANNEL&&(re.$sdk_dist_channel=Vt.SDK_DIST_CHANNEL),re})(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){var{sessionId:p,windowId:v}=this.sessionManager.checkAndGetSessionAndWindowId(i,r.getTime());u.$session_id=p,u.$window_id=v}this.sessionPropsManager&&At(u,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&At(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=(y=this.Qi)==null?void 0:y.length}catch(E){u.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===ky&&(u.$lib_custom_api_host=this.config.api_host),f=e!==Yl||i?e!==hv||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=At(u,f),e===Yl&&Ee&&(u.title=Ee.title),!be(a)){var x=r.getTime()-a;u.$duration=parseFloat((x/1e3).toFixed(3))}vr&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser"),(u=At({},h,this.persistence.properties(),this.sessionPersistence.properties(),u)).$is_identified=this._isIdentified(),tt(this.config.property_denylist)?bt(this.config.property_denylist,(function(E){delete u[E]})):_e.error(z6+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(_e.error(vE),u=_(u,e));var b=this.un();return u.$process_person_profile=b,b&&!i&&this.hn("_calculate_event_properties"),u}ln(e,n,r){var s;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.un()||this.$i&&!r)return e;var i=this.persistence.get_initial_props(),a=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),u=At({},i,a||{},e||{}),c=this.config.sanitize_properties;return c&&(_e.error(vE),u=c(u,"$set_once")),n&&(this.$i=!0),Do(u)?void 0:u}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var s;(s=this.persistence)==null||s.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}dn(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var s;return n===void 0&&(n=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Ni.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:Bc}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:Bc})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Bc})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=wN),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:Bc}}canRenderSurveyAsync(e,n){var r,s;return n===void 0&&(n=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Bc})}cn(e){return!e||K1(e)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):e===Rh?(_e.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())||(_e.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,r){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if($n(e)&&(e=e.toString(),_e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.cn(e)&&this.hn("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Zp)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(nd)&&(this.unregister(nd),this.register({distinct_id:e}));var i,a=(this.persistence.get_property(Es)||Vl)===Vl;e!==s&&a?(this.persistence.set_property(Es,$l),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(pv,{distinct_id:e,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this.Hi=pE(e,n,r),(i=this.featureFlags)==null||i.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(dd))}}setPersonProperties(e,n){if((e||n)&&this.hn("posthog.setPersonProperties")){var r=pE(this.get_distinct_id(),e,n);this.Hi!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Hi=r):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var n,r=(tt(e)?e:[e]).filter((s=>_t(s)&&s.length>0));r.length!==0&&this.hn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Hi=null)}group(e,n,r){if(e&&n){var s=this.getGroups(),i=s[e]!==n;if(i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:pe({},s,{[e]:n})}),i||r){var a={$group_type:e,$group_key:n};r&&(a.$group_set=r),this.capture(BS,a)}r&&this.setGroupPropertiesForFlags({[e]:r}),i&&!r&&this.reloadFeatureFlags()}else _e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e){var n;e===void 0&&(e=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.hn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,r,s,i,a,u,c,f,h,p;if(_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");var v,y=this.get_property(Zp),x=this.get_property(fv),_=this.get_property(za);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),be(_)||(v=this.persistence)==null||v.register({[za]:_}),(s=this.surveys)==null||s.reset(),(i=this.nn)==null||i.stop(),(a=this.featureFlags)==null||a.reset(),(u=this.conversations)==null||u.reset(),(c=this.logs)==null||c.reset(),(f=this.metrics)==null||f.reset(),(h=this.persistence)==null||h.set_property(Es,Vl),(p=this.sessionManager)==null||p.resetSessionId(),this.Hi=null,this.config.cookieless_mode===zi)this.register_once({distinct_id:Rh,$device_id:null},"");else{var b=this.config.get_device_id(Fi());this.register_once({distinct_id:b,$device_id:e?b:y},""),e||be(x)||this.register({[fv]:x})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var n=this;return en((function*(){var r,s,i,a,u;n.__loaded?((r=n.logs)==null||r.flushLogs("sendBeacon"),(s=n.metrics)==null||s.flush("sendBeacon"),(i=n.Gi)==null||i.unload(),(a=n.Qi)==null||a.unload(),(u=n.featureFlags)==null||u.destroy()):_e.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,n){var r;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(r=this.conversations)==null||r.vn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.fn()}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?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var i,a=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0)}return s}alias(e,n){return e===this.get_property(Z8)?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this.hn("posthog.alias")?(be(n)&&(n=this.get_distinct_id()),e!==n?(this.dn(nd,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=pe({},this.config);if(Ot(e)){var r,s,i,a,u,c,f,h,p,v,y;At(this.config,_E(e));var x=this.Wi();(r=this.persistence)==null||r.update_config(this.config,n,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yv(pe({},this.config,{persistence:"sessionStorage"}),x,!1);var _=this.Ui(this.config.debug);ai(_)&&(this.config.debug=_),ai(this.config.debug)&&(this.config.debug?(Vt.DEBUG=!0,wt.N()&&wt.q("ph_debug",!0),_e.info("set_config",{config:e,oldConfig:n,newConfig:pe({},this.config)})):(Vt.DEBUG=!1,wt.N()&&wt.P("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(i=this.exceptions)==null||i.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(u=this.tracingHeaders)==null||u.startIfEnabledOrStop(),(c=this.autocapture)==null||c.startIfEnabled(),(f=this.heatmaps)==null||f.startIfEnabled(),(h=this.exceptionObserver)==null||h.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(v=this.surveys)==null||v.loadIfEnabled(),this.pn(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){Vt.LIB_NAME=e,Vt.LIB_VERSION=n}startSessionRecording(e){var n,r,s,i,a,u=e===!0,c={sampling:u||!(e==null||!e.sampling),linked_flag:u||!(e==null||!e.linked_flag),url_trigger:u||!(e==null||!e.url_trigger),event_trigger:u||!(e==null||!e.event_trigger)};Object.values(c).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),c.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),c.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),c.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),c.event_trigger&&((a=this.sessionRecording)==null||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.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(pe({},s,n))}}addExceptionStep(e,n){var r;(r=this.exceptions)==null||r.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:as.gn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Xl;return n!==Xl&&(n=Xl+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Es))===$l||((n=this.sessionPersistence)==null?void 0:n.get_property(Es))===$l}un(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===gy&&!this._isIdentified()&&Do(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[nd])&&((n=this.persistence)==null||(n=n.props)==null||!n[Xp]))}sn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.un()||this.hn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.hn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}hn(e){return this.config.person_profiles==="never"?(_e.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.dn(Xp,!0),!0)}Wi(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Da)}pn(){var e,n,r,s,i=this.Wi();return((e=this.persistence)==null?void 0:e.rr)!==i&&((r=this.persistence)==null||r.set_disabled(i)),((n=this.sessionPersistence)==null?void 0:n.rr)!==i&&((s=this.sessionPersistence)==null||s.set_disabled(i)),i}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==zi){if(this.Di()){var r,s,i,a,u;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new hE(this),this.pageViewManager=new tE(this),this.persistence&&(this.sessionPropsManager=new fE(this,this.sessionManager,this.persistence));var c,f=(i=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&i!==void 0?i:(u=as.__defaultExtensionClasses)==null?void 0:u.sessionRecording;f&&(this.sessionRecording=this.Fi(this.sessionRecording,new f(this)),this.en&&((c=this.sessionRecording)==null||c.onRemoteConfig==null||c.onRemoteConfig(this.en)))}var h,p;this.consent.optInOut(!0),this.pn(),this.tn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Da&&((h=this.surveys)==null||h.loadIfEnabled()),(be(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((p=e==null?void 0:e.captureEventName)!==null&&p!==void 0?p:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.rn()}else _e.warn(gE)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==zi?(this.config.cookieless_mode===Da&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.pn(),this.config.cookieless_mode===Da&&(this.register({distinct_id:Rh,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.rn(),this.tn())):_e.warn(gE)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===zi||(this.config.cookieless_mode===Da?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.pn()}_is_bot(){return sr?j6(sr,this.config.custom_blocked_useragents):void 0}rn(){Ee&&(Ee.visibilityState==="visible"?this.qi||(this.qi=!0,this.capture(Yl,{title:Ee.title},{send_instantly:!0}),this.Bi&&(Ee.removeEventListener(Qp,this.Bi),this.Bi=null)):this.Bi||(this.Bi=this.rn.bind(this),$t(Ee,Qp,this.Bi)))}debug(e){e===!1?(te==null||te.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(te==null||te.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}))}Er(){var e,n,r,s,i,a,u=this.zi||{};return"advanced_disable_flags"in u?!!u.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(_e.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):(r="advanced_disable_decide",s=_e,i=(n="advanced_disable_flags")in(e=u)&&!Ye(e[n]),a=r in e&&!Ye(e[r]),i?e[n]:!!a&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]))}it(e){var n;if(Ye(this.config.before_send))return e;var r=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(jL),s=tt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var a of s){if(i=a(i),Ye(i)){var u="Event '"+e.event+"' was rejected in beforeSend function";return DL(e.event)?_e.warn(u+". This can cause unexpected behavior."):_e.info(u),null}i.properties&&!Do(i.properties)||_e.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var c of r)if(i.properties&&Ye(i.properties[c]))return _e.warn("Event '"+e.event+"' had its '"+c+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return i}getPageViewId(){var e;return(e=this.pageViewManager.Ut)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Ui(e){var n=ai(e)&&!e,r=wt.N()&&wt.A("ph_debug")==="true";return!n&&(!!r||e)}}as.__defaultExtensionClasses={},as.gn=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=kO(t.prototype[e[n]])})(as,["identify"]);class xE{constructor(e){this.disabled=e===!1;var n=Ot(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(n-s.y)<this.thresholdPx&&this.timeoutMs>r-s.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var Ev="$copy_autocapture",kv=Dt("[AutoCapture]");function Cv(t,e){return e.length>t?e.slice(0,t)+"...":e}function PN(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Go(e));return e}function TN(t,e){var n,r,{e:s,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:u,elementsChainAsString:c,disableCaptureUrlHashes:f}=e;if(!Go(t))return{props:{}};for(var h=[t],p=t;p.parentNode&&!Vr(p,"body");)if(l6(p.parentNode))h.push(p.parentNode.host),p=p.parentNode.host;else{if(!Go(p.parentNode))break;h.push(p.parentNode),p=p.parentNode}var v,y,x=[],_={},b=!1,E=!1;if(bt(h,(O=>{var M=yy(O);if(Vr(O,"a")){var R=O.getAttribute("href");b=!!(M&&R&&fd(R))&&(f?Wo(R):R)}Be(tm(O),"ph-no-capture")&&(E=!0),x.push((function(N,j,V,G,Y){Y===void 0&&(Y=!1);var K=N.tagName.toLowerCase(),B={tag_name:K};o2.indexOf(K)>-1&&!V&&(B.$el_text=K.toLowerCase()==="a"||K.toLowerCase()==="button"?Cv(1024,QS(N)):Cv(1024,Id(N)));var X=tm(N);X.length>0&&(B.classes=X.filter((function(D){return D!==""}))),bt(N.attributes,(function(D){var q;if((!h6(N)||["name","id","class","aria-label"].indexOf(D.name)!==-1)&&(G==null||!G.includes(D.name))&&!j&&fd(D.value)&&(!_t(q=D.name)||q.substring(0,10)!=="_ngcontent"&&q.substring(0,7)!=="_nghost")){var re=D.value;D.name==="class"&&(re=i2(re).join(" ")),B["attr__"+D.name]=Cv(1024,D.name==="href"&&Y?Wo(re):re)}}));for(var $=1,ee=1,H=N;H=PN(H);)$++,H.tagName===N.tagName&&ee++;return B.nth_child=$,B.nth_of_type=ee,B})(O,i,a,u,f));var L=(function(N){if(!yy(N))return{};var j={};return bt(N.attributes,(function(V){if(V.name&&V.name.indexOf("data-ph-capture-attribute")===0){var G=V.name.replace("data-ph-capture-attribute-",""),Y=V.value;G&&Y&&fd(Y)&&(j[G]=Y)}})),j})(O);At(_,L)})),E)return{props:{},explicitNoCapture:E};if(a||(x[0].$el_text=Vr(t,"a")||Vr(t,"button")?QS(t):Id(t)),b){var C,P;x[0].attr__href=b;var T=(C=Md(b))==null?void 0:C.host,A=te==null||(P=te.location)==null?void 0:P.host;T&&A&&T!==A&&(v=b)}return{props:At({$event_type:s.type,$ce_version:1},c?{}:{$elements:x},{$elements_chain:(y=x,(function(O){return O.map((M=>{var R,L,N="";if(M.tag_name&&(N+=M.tag_name),M.attr_class)for(var j of(M.attr_class.sort(),M.attr_class))N+="."+j.replace(/"/g,"");var V=pe({},M.text?{text:M.text}:{},{"nth-child":(R=M.nth_child)!==null&&R!==void 0?R:0,"nth-of-type":(L=M.nth_of_type)!==null&&L!==void 0?L:0},M.href?{href:M.href}:{},M.attr_id?{attr_id:M.attr_id}:{},M.attributes),G={};return cp(V).sort(((Y,K)=>{var[B]=Y,[X]=K;return B.localeCompare(X)})).forEach((Y=>{var[K,B]=Y;return G[JS(K.toString())]=JS(B.toString())})),(N+=":")+cp(G).map((Y=>{var[K,B]=Y;return K+'="'+B+'"'})).join("")})).join(";")})((function(O){return O.map((M=>{var R,L,N={text:(R=M.$el_text)==null?void 0:R.slice(0,400),tag_name:M.tag_name,href:(L=M.attr__href)==null?void 0:L.slice(0,2048),attr_class:WO(M),attr_id:M.attr__id,nth_child:M.nth_child,nth_of_type:M.nth_of_type,attributes:{}};return cp(M).filter((j=>{var[V]=j;return V.indexOf("attr__")===0})).forEach((j=>{var[V,G]=j;return N.attributes[V]=G})),N}))})(y)))},(n=x[0])!=null&&n.$el_text?{$el_text:(r=x[0])==null?void 0:r.$el_text}:{},v&&s.type==="click"?{$external_click_url:v}:{},_)}}var Wc=Dt("[ExceptionAutocapture]"),wE=()=>{},AN=Dt("[TracingHeaders]"),Ea=Dt("[Web Vitals]"),bE=9e5,SE="disabled",EE="lazy_loading",Gc="awaiting_config",jh="missing_config";Dt("[SessionRecording]"),Dt("[SessionRecording]");var Py="[SessionRecording]",Pi=Dt(Py),RN=Dt("[Heatmaps]");function kE(t){return Ot(t)&&"clientX"in t&&"clientY"in t&&$n(t.clientX)&&$n(t.clientY)}var Pv=Dt("[Product Tours]"),Tv=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(t2))},IN=["$set_once","$set"],Ws=Dt("[SiteApps]"),CE="Error while initializing PostHog app with config id ";function Ul(t,e,n){if(Ye(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class MN{constructor(e){this.mn=new c2,this.yn=(n,r)=>this.bn(n,r)&&this._n(n,r)&&this.wn(n,r)&&this.xn(n,r),this.bn=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.kn=new Set,this.Sn=new Set}init(){var e,n;be((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((r,s)=>{this.on(r,s)}))}register(e){var n,r;if(!be((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach((a=>{var u,c;(u=this.Sn)==null||u.add(a),(c=a.steps)==null||c.forEach((f=>{var h;(h=this.kn)==null||h.add((f==null?void 0:f.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,i=new Set;e.forEach((a=>{var u;(u=a.steps)==null||u.forEach((c=>{c!=null&&c.selector&&i.add(c==null?void 0:c.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(i)}}on(e,n){var r;n!=null&&e.length!=0&&(this.kn.has(e)||this.kn.has(n==null?void 0:n.event))&&this.Sn&&((r=this.Sn)==null?void 0:r.size)>0&&this.Sn.forEach((s=>{this.Cn(n,s)&&this.mn.emit("actionCaptured",s.name)}))}In(e){this.onAction("actionCaptured",(n=>e(n)))}Cn(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.yn(e,r))return!0;return!1}onAction(e,n){return this.mn.on(e,n)}_n(e,n){if(n!=null&&n.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!Ul(s,n.url,n.url_matching||"contains"))return!1}return!0}wn(e,n){return!!this.Tn(e,n)&&!!this.Mn(e,n)&&!!this.En(e,n)}Tn(e,n){var r;if(n==null||!n.href)return!0;var s=this.Pn(e);if(s.length>0)return s.some((u=>Ul(u.href,n.href,n.href_matching||"exact")));var i,a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!a&&Ul((i=a.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}Mn(e,n){var r;if(n==null||!n.text)return!0;var s=this.Pn(e);if(s.length>0)return s.some((f=>Ul(f.text,n.text,n.text_matching||"exact")||Ul(f.$el_text,n.text,n.text_matching||"exact")));var i,a,u,c=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!c&&(i=(function(f){for(var h,p=[],v=/(?::|")text="(.*?)"/g;!Ye(h=v.exec(f));)p.includes(h[1])||p.push(h[1]);return p})(c),a=n.text,u=n.text_matching||"exact",i.some((f=>Ul(f,a,u))))}En(e,n){var r,s;if(n==null||!n.selector)return!0;var i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(n.selector_regex&&a)try{return new RegExp(n.selector_regex).test(a)}catch{return!1}return!1}Pn(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e==null?void 0:e.properties.$elements}xn(e,n){return n==null||!n.properties||n.properties.length===0||$6(n.properties.reduce(((r,s)=>{var i=tt(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:i,operator:s.operator||"exact"},r}),{}),e==null?void 0:e.properties)}}class LN{constructor(e){this.Rn=[],this._instance=e,this.On=new Map,this.Ln=new Map,this.Fn=new Map}An(e,n){return!!e&&$6(e.propertyFilters,n==null?void 0:n.properties)}Dn(e,n){var r=new Map;return e.forEach((s=>{var i;(i=s.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEach((a=>{if(a!=null&&a.name){var u=r.get(a.name)||[];u.push(s.id),r.set(a.name,u)}}))})),r}$n(e,n,r){var s=(r===Vc.Activation?this.On:this.Ln).get(e),i=[];return this.Nn((a=>{i=a.filter((u=>s==null?void 0:s.includes(u.id)))})),i.filter((a=>{var u,c=(u=a.conditions)==null||(u=u[r])==null||(u=u.values)==null?void 0:u.find((f=>f.name===e));return this.An(c,n)}))}register(e){var n;be((n=this._instance)==null?void 0:n._addCaptureHook)||(this.qn(e),this.Bn(e))}Bn(e){var n=e.filter((r=>{var s,i;return((s=r.conditions)==null?void 0:s.actions)&&((i=r.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0}));n.length!==0&&(this.jn==null&&(this.jn=new MN(this._instance),this.jn.init(),this.jn.In((r=>{this.onAction(r)}))),n.forEach((r=>{var s,i,a,u,c;r.conditions&&(s=r.conditions)!=null&&s.actions&&(i=r.conditions)!=null&&(i=i.actions)!=null&&i.values&&((a=r.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((u=this.jn)==null||u.register(r.conditions.actions.values),(c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach((f=>{if(f&&f.name){var h=this.Fn.get(f.name);h&&h.push(r.id),this.Fn.set(f.name,h||[r.id])}})))})))}qn(e){var n,r=e.filter((i=>{var a,u;return((a=i.conditions)==null?void 0:a.events)&&((u=i.conditions)==null||(u=u.events)==null||(u=u.values)==null?void 0:u.length)>0})),s=e.filter((i=>{var a,u;return((a=i.conditions)==null?void 0:a.cancelEvents)&&((u=i.conditions)==null||(u=u.cancelEvents)==null||(u=u.values)==null?void 0:u.length)>0}));r.length===0&&s.length===0||((n=this._instance)==null||n._addCaptureHook(((i,a)=>{this.onEvent(i,a)})),this.On=this.Dn(e,Vc.Activation),this.Ln=this.Dn(e,Vc.Cancellation))}onEvent(e,n){var r,s,i=this.Hn(),a=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(s=n.properties)==null?void 0:s.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var u=this.Un(e,a);if(u==="consume")return i.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.zn([a]);if(u==="persist")return i.info("shown item promoted to persisted activation",{event:e,itemId:a}),void this.Vn(a)}if(this.Ln.has(e)){var c=this.$n(e,n,Vc.Cancellation);c.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:c.map((h=>h.id))}),this.zn(c.map((h=>h.id))),c.forEach((h=>this.Wn(h.id))))}if(this.On.has(e)){i.info("event name matched",{event:e,eventPayload:n,items:this.On.get(e)});var f=this.$n(e,n,Vc.Activation);this.Gn(f.map((h=>h.id)))}}onAction(e){this.Fn.has(e)&&this.Gn(this.Fn.get(e)||[])}Gn(e){e.length!==0&&(this.Rn=[...new Set([...this.Rn,...e])],this.Hn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Vn(e){this.Rn=this.Rn.filter((r=>r!==e));var n=this.Zn();n.includes(e)||this.Qn([...n,e])}zn(e){var n=new Set(e);this.Rn=this.Rn.filter((i=>!n.has(i)));var r=this.Zn(),s=r.filter((i=>!n.has(i)));s.length!==r.length&&this.Qn(s)}Zn(){var e,n=this.Jn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getActivatedIds(){return[...new Set([...this.Zn(),...this.Rn])].filter((e=>!this.Kn(e)))}reset(){this.Rn=[],this.Zn().length>0&&this.Qn([])}getEventToItemsMap(){return this.On}Yn(){return this.jn}}class ON extends LN{constructor(e){super(e)}Jn(){return uy}Xn(){return Ui.SHOWN}Nn(e){var n;(n=this._instance)==null||n.getSurveys(e)}Wn(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}Hn(){return yt}Qn(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[uy]:e})}Kn(){return!1}Un(e,n){var r;this.Nn((i=>{r=i.find((a=>a.id===n))}));var s=!r||(function(i){var a,u,c,f=((a=(u=i.conditions)==null||(u=u.events)==null||(u=u.values)==null?void 0:u.length)!==null&&a!==void 0?a:0)>0;return i.schedule===nN.Always||!((c=i.conditions)==null||(c=c.events)==null||!c.repeatedActivation||!f)})(r);return s?e===Ui.SHOWN?"consume":"ignore":e===Ui.SHOWN?"persist":e===Ui.DISMISSED||e===Ui.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Av="SDK is not enabled or survey functionality is not yet loaded",PE="Disabled. Not loading surveys.",NN=te!=null&&te.location?nm(te.location.hash,"__posthog")||nm(location.hash,"state"):null,TE="_postHogToolbarParams",AE=Dt("[Toolbar]"),un=Dt("[FeatureFlags]"),ka=Dt("[FeatureFlags]",{debugEnabled:!0}),Rv=`" failed. Feature flags didn't load in time.`,RE=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},IE=t=>{var e={};for(var[n,r]of cp(t||{}))r&&(e[n]=r);return e},Ti=Dt("[Error tracking]"),ME="Refusing to render web experiment since the viewer is a likely bot",DN={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>im(e,t),not_regex:(t,e)=>!im(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Kn{get Se(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((s=>{Kn.es("retrieved web experiments from the server"),n.ts=new Map,s.forEach((i=>{if(i.feature_flag_key){var a;n.ts&&(Kn.es("setting flag key ",i.feature_flag_key," to web experiment ",i),(a=n.ts)==null||a.set(i.feature_flag_key,i));var u=n._instance.getFeatureFlag(i.feature_flag_key);_t(u)&&i.variants[u]&&n.rs(i.name,u,i.variants[u].transforms)}else if(i.variants)for(var c in i.variants){var f=i.variants[c];Kn.ns(f,n._instance)&&n.rs(i.name,c,f.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Kn.es(ME);else if(!this.Se.disable_web_experiments){if(Ye(this.ts))return this.ts=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Kn.es("applying feature flags",e),e.forEach((n=>{var r;if(this.ts&&(r=this.ts)!=null&&r.has(n)){var s,i=this._instance.getFeatureFlag(n),a=(s=this.ts)==null?void 0:s.get(n);i&&a!=null&&a.variants[i]&&this.rs(a.name,i,a.variants[i].transforms)}}))}}previewWebExperiment(){var e=Kn.getWindowLocation();if(e!=null&&e.search){var n=Iu(e==null?void 0:e.search,"__experiment_id"),r=Iu(e==null?void 0:e.search,"__experiment_variant");n&&r&&(Kn.es("previewing web experiments "+n+" && "+r),this.getWebExperiments((s=>{this.ss(parseInt(n),r,s)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.Se.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!n)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:i=>e(i.statusCode===200&&i.json&&i.json.experiments||[])})}ss(e,n,r){var s=r.filter((i=>i.id===e));s&&s.length>0&&(Kn.es("Previewing web experiment ["+s[0].name+"] with variant ["+n+"]"),this.rs(s[0].name,n,s[0].variants[n].transforms))}static ns(e,n){return!Ye(e.conditions)&&Kn.os(e,n)&&Kn.ls(e)}static os(e,n){var r;if(Ye(e.conditions)||Ye((r=e.conditions)==null?void 0:r.url))return!0;var s=Kn.getWindowLocation();if(s){var i,a,u,c=o6(n,s.href);return(i=e.conditions)==null||!i.url||DN[(a=(u=e.conditions)==null?void 0:u.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,c)}return!1}static getWindowLocation(){return te==null?void 0:te.location}static ls(e){var n;if(Ye(e.conditions)||Ye((n=e.conditions)==null?void 0:n.utm))return!0;var r=w6();if(r.utm_source){var s,i,a,u,c,f,h,p,v=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==r.utm_campaign,y=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_source)==r.utm_source,x=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_medium||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_medium)==r.utm_medium,_=(h=e.conditions)==null||(h=h.utm)==null||!h.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==r.utm_term;return v&&x&&_&&y}return!1}static es(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;n>s;s++)r[s-1]=arguments[s];_e.info("[WebExperiments] "+e,r)}rs(e,n,r){this._is_bot()?Kn.es(ME):n!=="control"?r.forEach((s=>{if(s.selector){var i;Kn.es("applying transform of variant "+n+" for experiment "+e+" ",s);var a=(i=document)==null?void 0:i.querySelectorAll(s.selector);a==null||a.forEach((u=>{var c=u;s.html&&(c.innerHTML=s.html),s.css&&c.setAttribute("style",s.css)}))}})):Kn.es("Control variants leave the page unmodified.")}_is_bot(){return sr&&this._instance?j6(sr,this.Se.custom_blocked_useragents):void 0}}var rs=Dt("[Conversations]"),Ca="Conversations not available yet.",LE="console",Um={featureFlags:class{constructor(t){this.us=!1,this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.gs=!1,this.ys=0,this.bs=()=>{var e=this._s();this.ys=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],te&&$t(te,"online",this.bs)}destroy(){te==null||te.removeEventListener("online",this.bs)}get Se(){return this._instance.config}get ti(){return this._instance.persistence}ws(t){return this._instance.get_property(t)}xs(){var t,e;return(t=(e=this.ti)==null?void 0:e.nr(this.Se.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}ks(){return!!this.xs()&&(this.gs||this.ds||(this.gs=!0,un.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ss(){var t,e=(t=this.Se.evaluation_contexts)!==null&&t!==void 0?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ps||(un.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ps=!0),e!=null&&e.length?e.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||un.error("Invalid evaluation context found:",n,"Expected non-empty string"),r})):[]}Cs(){return this.Ss().length>0}Is(){var t=this.Se.flag_keys;if(!be(t)){if(tt(t))return t.filter((e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||un.error("Invalid flag key found:",e,"Expected non-empty string"),n}));un.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,{config:n}=this._instance,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var s,i,a=(s=(i=n.bootstrap)==null?void 0:i.featureFlagPayloads)!==null&&s!==void 0?s:{},u=Object.keys(r).filter((f=>!!r[f])).reduce(((f,h)=>(f[h]=r[h]||!1,f)),{}),c=Object.keys(a).filter((f=>u[f])).reduce(((f,h)=>(a[h]&&(f[h]=a[h]),f)),{});this.receivedFeatureFlags({featureFlags:u,featureFlagPayloads:c})}}updateFlags(t,e,n){var r,s,i=n!=null&&n.merge&&(r=this.ws(Va))!==null&&r!==void 0?r:{},a=n!=null&&n.merge&&(s=this.ws(up))!==null&&s!==void 0?s:{},u=pe({},i,t),c=pe({},a,e),f={};for(var[h,p]of Object.entries(u))f[h]={key:h,enabled:RS(p),variant:IS(p),reason:void 0,metadata:be(c==null?void 0:c[h])?void 0:{id:0,version:void 0,description:void 0,payload:c[h]}};this.receivedFeatureFlags({flags:f})}get hasLoadedFlags(){return this.hs}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ws(oy),e=this.ws(Oi),n=this.ws(ql);if(!n&&!e)return t||{};var r=At({},t||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var i of s){var a,u,c=r[i],f=e==null?void 0:e[i],h=be(f)?(a=c==null?void 0:c.enabled)!==null&&a!==void 0&&a:!!f,p=be(f)?c.variant:typeof f=="string"?f:void 0,v=n==null?void 0:n[i],y=pe({},c,{enabled:h,variant:h?p??(c==null?void 0:c.variant):void 0});h!==(c==null?void 0:c.enabled)&&(y.original_enabled=c==null?void 0:c.enabled),p!==(c==null?void 0:c.variant)&&(y.original_variant=c==null?void 0:c.variant),v&&(y.metadata=pe({},c==null?void 0:c.metadata,{payload:v,original_payload:c==null||(u=c.metadata)==null?void 0:u.payload})),r[i]=y}return this.us||(un.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.us=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((n=>{var r=t[n];return{key:n,enabled:RS(r),variant:IS(r),payload:AS(e[n])}}))}getFlagVariants(){var t=this.ws(Va),e=this.ws(Oi);if(!e)return t||{};for(var n=At({},t),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.us||(un.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.us=!0),n}getFlagPayloads(){var t=this.ws(up),e=this.ws(ql);if(!e)return t||{};for(var n=At({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.us||(un.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.us=!0),n}reloadFeatureFlags(){this.cs||this.Se.advanced_disable_feature_flags||this._s()||this.Ts||(this._instance.Ni.emit("featureFlagsReloading",!0),this.Ts=setTimeout((()=>{this.Ms()}),5))}Es(){clearTimeout(this.Ts),this.Ts=void 0}ensureFlagsLoaded(){this.hs||this.ds||this.Ts||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.cs=t}Ms(t){var e;if(this.Es(),!this._instance.Er()&&!this._s())if(this.ds)this.vs=!0;else{var n=this.Se.token,r=this.ws(Zp),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:pe({},((e=this.ti)==null?void 0:e.get_initial_props())||{},this.ws(Oa)||{}),group_properties:this.ws(Na),timezone:P6()};ar(r)||be(r)||(s.$device_id=r),(t!=null&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Cs()&&(s.evaluation_contexts=this.Ss());var i=this.Is();be(i)||(s.flag_keys=i);var a=!!this.Se.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.ds=!0,this._instance._send_request({method:"POST",url:u,data:s,compression:this.Se.disable_compression?void 0:os.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:c=>{var f,h,p,v=!0;if(this.Ps(c.statusCode),c.statusCode===200&&(this.vs||(this.$anon_distinct_id=void 0),v=!1),this.ds=!1,!s.disable_flags||this.vs){this.fs=!v;var y=[];c.error?c.error instanceof Error?y.push(c.error.name==="AbortError"?"timeout":"connection_error"):y.push("unknown_error"):c.statusCode!==200&&y.push("api_error_"+c.statusCode),(f=c.json)!=null&&f.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");var x,_=!((h=c.json)==null||(h=h.quotaLimited)==null||!h.includes("feature_flags"));_&&y.push("quota_limited"),(p=this.ti)==null||p.register({[dy]:y}),_?un.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."):(s.disable_flags||this.receivedFeatureFlags((x=c.json)!==null&&x!==void 0?x:{},v,{partialResponse:a}),this.vs&&(this.vs=!1,this.Ms()))}}})}}_s(){return _6(this.ys,3)}Ps(t){this.ys=x6(t,this.ys,3,(()=>un.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===void 0&&(e={}),!e.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var r=this.getFeatureFlagResult(t,e);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else un.warn('getFeatureFlag for key "'+t+Rv)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var n=this.getFlagVariants(),r=t in n,s=n[t],i=this.getFlagPayloads()[t],a=String(s),u=this.ws(ay)||void 0,c=this.ws(Rd)||void 0,f=this.ws(dd)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var h,p=this._instance.get_session_id(),v=this.ws(cy);p&&p!==v&&(f={},(h=this.ti)==null||h.register({[dd]:f,[cy]:p}))}if((e.send_event||!("send_event"in e))&&(!(t in f)||!f[t].includes(a))){var y,x,_,b,E,C,P,T,A,O;tt(f[t])?f[t].push(a):f[t]=[a],(y=this.ti)==null||y.register({[dd]:f});var M=this.getFeatureFlagDetails(t),R=[...(x=this.ws(dy))!==null&&x!==void 0?x:[]];be(s)&&R.push("flag_missing");var L={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:i||null,$feature_flag_request_id:u,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((_=this.Se.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[t])||null,$feature_flag_bootstrapped_payload:((b=this.Se.bootstrap)==null||(b=b.featureFlagPayloads)==null?void 0:b[t])||null,$used_bootstrap_value:!this.fs};be(M==null||(E=M.metadata)==null?void 0:E.version)||(L.$feature_flag_version=M.metadata.version);var N,j=(C=M==null||(P=M.reason)==null?void 0:P.description)!==null&&C!==void 0?C:M==null||(T=M.reason)==null?void 0:T.code;j&&(L.$feature_flag_reason=j),M!=null&&(A=M.metadata)!=null&&A.id&&(L.$feature_flag_id=M.metadata.id),be(M==null?void 0:M.original_variant)&&be(M==null?void 0:M.original_enabled)||(L.$feature_flag_original_response=be(M.original_variant)?M.original_enabled:M.original_variant),M!=null&&(O=M.metadata)!=null&&O.original_payload&&(L.$feature_flag_original_payload=M==null||(N=M.metadata)==null?void 0:N.original_payload),R.length&&(L.$feature_flag_error=R.join(",")),this._instance.capture("$feature_flag_called",L)}if(r)return{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:AS(i)}}}else un.warn('getFeatureFlagResult for key "'+t+Rv)}getRemoteConfigPayload(t,e){var n=this.Se.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.Cs()&&(r.evaluation_contexts=this.Ss());var s=this.Is();be(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Se.disable_compression?void 0:os.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(i){var a,u=(a=i.json)==null?void 0:a.featureFlagPayloads;e((u==null?void 0:u[t])||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.fs){if(this.hs||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return be(n)?void 0:!!n}un.warn('isFeatureEnabled for key "'+t+Rv)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,n){if(this.ti){this.hs=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,u,c,f,h,p){c===void 0&&(c={}),f===void 0&&(f={}),h===void 0&&(h={});var v=(R=>{var L=R.flags;return L?(R.featureFlags=Object.fromEntries(Object.keys(L).map((N=>{var j;return[N,(j=L[N].variant)!==null&&j!==void 0?j:L[N].enabled]}))),R.featureFlagPayloads=Object.fromEntries(Object.keys(L).filter((N=>L[N].enabled)).filter((N=>{var j;return(j=L[N].metadata)==null?void 0:j.payload})).map((N=>{var j;return[N,(j=L[N].metadata)==null?void 0:j.payload]})))):R.featureFlags&&un.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),R})(a),y=v.flags,x=v.featureFlags,_=v.featureFlagPayloads;if(x){var b=a.requestId,E=a.evaluatedAt;if(tt(x)){un.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var C={};if(x)for(var P=0;x.length>P;P++)C[x[P]]=!0;u&&u.register({[lp]:x,[Va]:C})}else{var T=x,A=_,O=y;if(p!=null&&p.partialResponse)T=pe({},c,T),A=pe({},f,A),O=pe({},h,O);else if(a.errorsWhileComputingFlags)if(y){var M=new Set(Object.keys(y).filter((R=>{var L;return!((L=y[R])!=null&&L.failed)})));T=pe({},c,Object.fromEntries(Object.entries(T).filter((R=>{var[L]=R;return M.has(L)})))),A=pe({},f,Object.fromEntries(Object.entries(A||{}).filter((R=>{var[L]=R;return M.has(L)})))),O=pe({},h,Object.fromEntries(Object.entries(O||{}).filter((R=>{var[L]=R;return M.has(L)}))))}else T=pe({},c,T),A=pe({},f,A),O=pe({},h,O);u&&u.register(pe({[lp]:Object.keys(IE(T)),[Va]:T||{},[up]:A||{},[oy]:O||{}},b?{[ay]:b}:{},E?{[Rd]:E}:{}))}}})(t,this.ti,r,s,i,n),e||(this.gs=!1),this.Rs(e)}}override(t,e){e===void 0&&(e=!1),un.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ti)return un.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.ti.unregister(Oi),this.ti.unregister(ql),this.Rs(),ka.info("All overrides cleared");if(tt(t)){var e=RE(t);return this.ti.register({[Oi]:e}),this.Rs(),ka.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.us=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.ti.unregister(Oi),ka.info("Flag overrides cleared");else if(r.flags){if(tt(r.flags)){var s=RE(r.flags);this.ti.register({[Oi]:s})}else this.ti.register({[Oi]:r.flags});ka.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.ti.unregister(ql),ka.info("Payload overrides cleared")):r.payloads&&(this.ti.register({[ql]:r.payloads}),ka.info("Payload overrides set",{payloads:r.payloads}))),void this.Rs()}if(t&&typeof t=="object")return this.ti.register({[Oi]:t}),this.Rs(),ka.info("Flag overrides set",{flags:t});un.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.hs){var{flags:e,flagVariants:n}=this.Os();try{t(e,n)}catch(r){un.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r,s=(this.ws(sd)||[]).find((c=>c.flagKey===t)),i={["$feature_enrollment/"+t]:e},a={$feature_flag:t,$feature_enrollment:e,$set:i};s&&(a.$early_access_feature_name=s.name),n&&(a.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var u=pe({},this.getFlagVariants(),{[t]:e});(r=this.ti)==null||r.register({[lp]:Object.keys(IE(u)),[Va]:u}),this.Rs()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.ws(sd),s=n?"&"+n.map((i=>"stage="+i)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+s),method:"GET",callback:i=>{var a,u;if(i.json){var c=i.json.earlyAccessFeatures;return(a=this.ti)==null||a.unregister(sd),(u=this.ti)==null||u.register({[sd]:c}),t(c)}}})}Os(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((n=>e[n])),flagVariants:Object.keys(e).filter((n=>e[n])).reduce(((n,r)=>(n[r]=e[r],n)),{})}}Rs(t){var{flags:e,flagVariants:n}=this.Os();this.featureFlagEventHandlers.forEach((r=>{try{r(e,n,{errorsLoading:t})}catch(s){un.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ws(Oa)||{},r=(t==null?void 0:t.$set)||(t!=null&&t.$set_once?{}:t),s=t==null?void 0:t.$set_once,i={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in n||(i[a]=s[a]));this._instance.register({[Oa]:pe({},n,i,r)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=pe({},this.ws(Oa)||{});t.forEach((r=>{delete n[r]})),this._instance.register({[Oa]:n}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(Oa),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ws(Na)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=pe({},n[r],t[r]),delete t[r]})),this._instance.register({[Na]:pe({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ws(Na)||{};this._instance.register({[Na]:pe({},e,{[t]:{}})})}else this._instance.unregister(Na)}reset(){this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.$anon_distinct_id=void 0,this.Es(),this.us=!1,this.ys=0}}},jN={sessionRecording:class{get Se(){return this._instance.config}get ti(){return this._instance.persistence}get started(){var t;return!((t=this.Ls)==null||!t.isStarted)}get status(){var t,e;return this.Fs===Gc||this.Fs===jh?this.Fs:(t=(e=this.Ls)==null?void 0:e.status)!==null&&t!==void 0?t:this.Fs}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Fs=SE,this.As=void 0,this._instance=t,!this._instance.sessionManager)throw Pi.error("started without valid sessionManager"),new Error(Py+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===zi)throw new Error(Py+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ds(){var t,e=!((t=this._instance.get_property(za))==null||!t.enabled),n=!this.Se.disable_session_recording,r=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return te&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this.Ds||(e=this.Ls)==null||!e.isStarted){var n=!be(Object.assign)&&!be(Array.from);this.Ds&&n?(this.$s(t),Pi.info("starting")):(this.Fs=SE,this.stopRecording())}}$s(t){var e,n,r;this.Ds&&(this.Fs!==Gc&&this.Fs!==jh&&(this.Fs=EE),$e!=null&&(e=$e.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=$e.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Ns(t):(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.qs,(s=>{if(s)return Pi.error("could not load recorder",s);this.Ns(t)})))}stopRecording(){var t,e;(t=this.As)==null||t.call(this),this.As=void 0,(e=this.Ls)==null||e.stop()}Bs(){var t,e;(t=this.As)==null||t.call(this),this.As=void 0,(e=this.Ls)==null||e.discard()}js(){var t,e;(t=this.ti)==null||t.unregister(n2),(e=this.ti)==null||e.unregister(q8)}Hs(t,e){if(Ye(t))return null;var n,r=$n(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Pi.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Us(t){if(this.ti){var e,n,r=this.ti,s=()=>{var i,a=t.sessionRecording===!1?void 0:t.sessionRecording,u=this.Hs((i=this.Se.session_recording)==null?void 0:i.sampleRate,"session_recording.sampleRate"),c=this.Hs(a==null?void 0:a.sampleRate,"remote config sampleRate"),f=u??c;Ye(f)&&this.js();var h=a==null?void 0:a.minimumDurationMilliseconds;r.register({[za]:pe({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:pe({capturePerformance:t.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:f,minimumDurationMilliseconds:be(h)?null:h,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers,version:a==null?void 0:a.version,triggerGroups:a==null?void 0:a.triggerGroups})})};s(),(e=this.As)==null||e.call(this),this.As=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.Us(t),void this.Bs()):(this.Us(t),void this.startIfEnabledOrStop()):(this.Fs===Gc&&(this.Fs=jh,Pi.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.Ls)!=null&&n.log?this.Ls.log(t,e):Pi.warn("log called before recorder was ready")}get qs(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(za);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}zs(){var t,e,n=this._instance.get_property(za);if(!n)return!1;try{e=typeof n=="object"?n:JSON.parse(n)}catch(s){return Pi.warn("persisted remote config for session recording is invalid and will be ignored",s),!1}var r=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-r}Ns(t){var e,n;if((e=$e.__PosthogExtensions__)==null||!e.initSessionRecording)return Pi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[r6]:!0});if(this.Ls||(this.Ls=(n=$e.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Ls._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.zs())return this.Fs===jh||this.Fs===Gc?void 0:(this.Fs=Gc,Pi.info("persisted remote config is stale, requesting fresh config before starting"),void new T6(this._instance).load());this.Fs=EE,this.Ls.start(t)}onRRwebEmit(t){var e;(e=this.Ls)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Ls||(e=this.ti)==null||e.register({[X8]:!0}),(t=this.Ls)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Ls||(e=this.ti)==null||e.register({[Y8]:!0}),(t=this.Ls)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.Ls||(n=this.ti)==null||n.register({[t==="url"?Q8:J8]:!0}),(e=this.Ls)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Ls)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.Ls)==null||!n.tryAddCustomEvent(t,e))}}},FN={autocapture:class{constructor(t){this.Vs=!1,this.Ws=null,this.Gs=!1,this.instance=t,this.rageclicks=new xE(t.config.rageclick),this.Zs=null}initialize(){this.startIfEnabled()}get Se(){var t,e,n=Ot(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map((r=>new RegExp(r))),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map((r=>new RegExp(r))),n}Qs(){if(this.isBrowserSupported()){if(te&&Ee){var t=n=>{n=n||(te==null?void 0:te.event);try{this.Js(n)}catch(r){kv.error("Failed to capture event",r)}};if($t(Ee,"submit",t,{capture:!0}),$t(Ee,"change",t,{capture:!0}),$t(Ee,"click",t,{capture:!0}),this.Se.capture_copied_text){var e=n=>{n=n||(te==null?void 0:te.event);try{this.Js(n,Ev)}catch(r){kv.error("Failed to capture copy/cut event",r)}};$t(Ee,"copy",e,{capture:!0}),$t(Ee,"cut",e,{capture:!0})}}}else kv.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Vs&&(this.Qs(),this.Vs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Gs=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[J1]:!!t.autocapture_opt_out}),this.Ws=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Zs=t}getElementSelectors(t){var e,n=[];return(e=this.Zs)==null||e.forEach((r=>{var s=Ee==null?void 0:Ee.querySelectorAll(r);s==null||s.forEach((i=>{t===i&&n.push(r)}))})),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[J1];if(ar(this.Ws)&&!ai(n)&&!this.instance.Er())return!1;var r=(e=this.Ws)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}Js(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=gv(t);a6(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&XS(r,this.instance.config.rageclick)&&this.Js(t,"$rageclick");var s=e===Ev;if(r&&(function(p,v,y,x,_,b){var E,C,P,T,A,O;if(y===void 0&&(y=void 0),!te||a2(p)||(E=y)!=null&&E.url_allowlist&&!ZS(y.url_allowlist,b)||(C=y)!=null&&C.url_ignorelist&&ZS(y.url_ignorelist,b))return!1;if((P=y)!=null&&P.dom_event_allowlist){var M=y.dom_event_allowlist;if(M&&!M.some((V=>v.type===V)))return!1}var{parentIsUsefulElement:R,targetElementList:L}=f6(p,x);if(!(function(V,G){var Y=G==null?void 0:G.element_allowlist;if(be(Y))return!0;var K,B=function($){if(Y.some((ee=>$.tagName.toLowerCase()===ee)))return{v:!0}};for(var X of V)if(K=B(X))return K.v;return!1})(L,y)||!vy(L,(T=y)==null?void 0:T.css_selector_allowlist)||vy(L,(A=(O=y)==null?void 0:O.css_selector_ignorelist)!==null&&A!==void 0?A:FO))return!1;try{var N=te.getComputedStyle(p);if(N&&N.getPropertyValue("cursor")==="pointer"&&v.type==="click")return!0}catch{}var j=p.tagName.toLowerCase();switch(j){case"html":return!1;case"form":return(_||["submit"]).indexOf(v.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(v.type)>=0;default:return R?(_||["click"]).indexOf(v.type)>=0:(_||["click"]).indexOf(v.type)>=0&&(o2.indexOf(j)>-1||p.getAttribute("contenteditable")==="true")}})(r,t,this.Se,s,s?["copy","cut"]:void 0,this.instance)){var{props:i,explicitNoCapture:a}=TN(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Gs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(a)return!1;var u=this.getElementSelectors(r);if(u&&u.length>0&&(i.$element_selectors=u),e===Ev){var c,f=u6(te==null||(c=te.getSelection())==null?void 0:c.toString()),h=t.type||"clipboard";if(!f)return!1;i.$selected_content=f,i.$copy_type=h}return this.instance.capture(e,i),!0}}}isBrowserSupported(){return Ts(Ee==null?void 0:Ee.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ks=(te==null||(e=te.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(_e.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ys&&this.Ys(),this.Ys=void 0,_e.info("History API monitoring stopped")}monitorHistoryChanges(){te&&te.history&&(this.Xs("pushState"),this.Xs("replaceState"),this.eo())}Xs(t){var e;if(te&&((e=te.history[t])==null||!e.__posthog_wrapped__)){var n=this;(function(r,s,i){try{if(!(s in r))return wE;var a={next:r[s]},u=i((function(){for(var c=arguments.length,f=new Array(c),h=0;c>h;h++)f[h]=arguments[h];return a.next.apply(this,f)}));return Ts(u)&&(u.prototype=u.prototype||{},Object.defineProperties(u,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),r[s]=u,()=>{if(r[s]!==u)for(var c=r[s];Ts(c)&&c.__posthog_layer__;){var f=c.__posthog_layer__;if(f.next===u)return void(f.next=a.next);c=f.next}else r[s]=a.next}}catch{return wE}})(te.history,t,(r=>function(s,i,a){r.call(this,s,i,a),n.ro(t)}))}}ro(t){try{var e,n=te==null||(e=te.location)==null?void 0:e.pathname;if(!n)return;n!==this.Ks&&this.isEnabled&&this._instance.capture(Yl,{navigation_type:t}),this.Ks=n}catch(r){_e.error("Error capturing "+t+" pageview",r)}}eo(){if(!this.Ys){var t=()=>{this.ro("popstate")};$t(te,"popstate",t),this.Ys=()=>{te&&te.removeEventListener("popstate",t)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.io=!1,this.Vs=!1,this.no=null,this.instance=t,this.io=!((e=this.instance.persistence)==null||!e.props[ey]),this.rageclicks=new xE(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Ot(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Ye(this.Se.capture_heatmaps)?Ye(this.Se.enable_heatmaps)?this.io:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Vs)return;RN.info("starting..."),this.so(),this.ke()}else{var t;clearInterval((t=this.no)!==null&&t!==void 0?t:void 0),this.oo(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ey]:e}),this.io=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}ao(t){this.fe(t.originalEvent,"deadclick")}ke(){this.no&&clearInterval(this.no),this.no=(Ee==null?void 0:Ee.visibilityState)==="visible"?setInterval(this.zr.bind(this),this.flushIntervalMilliseconds):null}so(){te&&Ee&&(this.lo=this.zr.bind(this),$t(te,Jp,this.lo),this.uo=t=>this.fe(t||(te==null?void 0:te.event)),$t(Ee,"click",this.uo,{capture:!0}),this.ho=t=>this.do(t||(te==null?void 0:te.event)),$t(Ee,"mousemove",this.ho,{capture:!0}),this.co=new eE(this.instance,GO,this.ao.bind(this)),this.co.startIfEnabledOrStop(),this.vo=this.ke.bind(this),$t(Ee,Qp,this.vo),this.Vs=!0)}oo(){var t;te&&Ee&&(this.lo&&te.removeEventListener(Jp,this.lo),this.uo&&Ee.removeEventListener("click",this.uo,{capture:!0}),this.ho&&Ee.removeEventListener("mousemove",this.ho,{capture:!0}),this.vo&&Ee.removeEventListener(Qp,this.vo),clearTimeout(this.fo),(t=this.co)==null||t.stop(),this.Vs=!1)}po(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=(function(a,u,c){for(var f=a;f&&Go(f)&&!Vr(f,"body");){if(f===c)return!1;var h=void 0;try{var p,v,y;h=(p=(v=(y=f.ownerDocument)==null?void 0:y.defaultView)!==null&&v!==void 0?v:te)==null?void 0:p.getComputedStyle(f).position}catch{return!1}if(Be(u,h))return!0;f=c6(f)}return!1})(gv(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:r),y:t.clientY+(i?0:n),target_fixed:i,type:e}}fe(t,e){var n;if(e===void 0&&(e="click"),!KS(t.target)&&kE(t)){var r=this.po(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&XS(gv(t),this.instance.config.rageclick)&&this.kt(pe({},r,{type:"rageclick"})),this.kt(r)}}do(t){!KS(t.target)&&kE(t)&&(clearTimeout(this.fo),this.fo=setTimeout((()=>{this.kt(this.po(t,"mousemove"))}),500))}kt(t){if(te){var e=this.Se.disable_capture_url_hashes?Wo(te.location.href):te.location.href,n=this.Se.custom_personal_data_properties,r=this.Se.mask_personal_data_properties?[...Mu,...n||[]]:[],s=Ld(e,r,Od);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}zr(){this.R&&!Do(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:eE,webVitalsAutocapture:class{constructor(t){var e;this.io=!1,this.Vs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.mo=()=>{clearTimeout(this.yo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,r)=>pe({},n,{["$web_vitals_"+r.name+"_event"]:pe({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.bo=n=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._o();if(!be(s))if(Ye(n==null?void 0:n.name)||Ye(n==null?void 0:n.value))Ea.error("Invalid metric received",n);else if(!this.wo||this.wo>n.value){this.R.url!==s&&(this.mo(),this.yo=setTimeout(this.mo,this.flushToCaptureTimeoutMs)),be(this.R.url)&&(this.R.url=s),this.R.firstMetricTimestamp=be(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var i=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),a=pe({},n,{$current_url:s,timestamp:Date.now()});be(i)||(a.$session_id=i.sessionId,a.$window_id=i.windowId),this.R.metrics.push(a),this.R.metrics.length===this.allowedMetrics.length&&this.mo()}else Ea.error("Ignoring metric with value >= "+this.wo,n)},this.xo=()=>{if(!this.Vs){var n,r,s,i,a=$e.__PosthogExtensions__;be(a)||be(a.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:s,onINP:i}=a.postHogWebVitalsCallbacks),n&&r&&s&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.bo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.bo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.bo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.bo.bind(this)),this.Vs=!0):Ea.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.io=!((e=this._instance.persistence)==null||!e.props[sy]),this.startIfEnabled()}get ko(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=Ot(this.ko)?(t=this.ko)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Ye(n)?((e=this._instance.persistence)==null?void 0:e.props[iy])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ot(this.ko)?this.ko.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Ot(this.ko)?this.ko.web_vitals_attribution:void 0;return t!=null&&t}get wo(){var t=Ot(this.ko)&&$n(this.ko.__web_vitals_max_value)?this.ko.__web_vitals_max_value:bE;return t>0&&6e4>=t?bE:t}get isEnabled(){var t=on==null?void 0:on.protocol;if(t!=="http:"&&t!=="https:")return Ea.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Ot(this.ko)?this.ko.web_vitals:ai(this.ko)?this.ko:void 0;return ai(e)?e:this.io}startIfEnabled(){this.isEnabled&&!this.Vs&&(Ea.info("enabled, starting..."),this.Bt(this.xo))}onRemoteConfig(t){if("capturePerformance"in t){var e=Ot(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=Ot(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[sy]:e}),this._instance.persistence.register({[iy]:n})),this.io=e,this.startIfEnabled()}}Bt(t){var e,n;(e=$e.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=$e.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?Ea.error("failed to load script",r):t()}))}_o(){var t=te?this._instance.config.disable_capture_url_hashes?Wo(te.location.href):te.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Mu,...e||[]]:[];return Ld(t,n,Od)}Ea.error("Could not determine current URL")}}},VN={exceptionObserver:class{constructor(t){var e,n,r;this.xo=()=>{var s;if(te&&this.isEnabled&&(s=$e.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var i=$e.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$e.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,u=$e.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.So&&this.Se.capture_unhandled_errors&&(this.So=i(this.captureException.bind(this))),!this.Co&&this.Se.capture_unhandled_rejections&&(this.Co=a(this.captureException.bind(this))),!this.Io&&this.Se.capture_console_errors&&(this.Io=u(this.captureException.bind(this)))}catch(c){Wc.error("failed to start",c),this.To()}}},this._instance=t,this.Mo=!((e=this._instance.persistence)==null||!e.props[ty]),this.Eo=new $L({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Ae:Wc}),this.Se=this.Po(),this.startIfEnabledOrStop()}Po(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ot(t)?e=pe({},e,t):(be(t)?this.Mo:t)&&(e=pe({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Wc.info("enabled"),this.To(),this.Bt(this.xo)):this.To()}Bt(t){var e,n;(e=$e.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(n=$e.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return Wc.error("failed to load script",r);t()}))}To(){var t,e,n;(t=this.So)==null||t.call(this),this.So=void 0,(e=this.Co)==null||e.call(this),this.Co=void 0,(n=this.Io)==null||n.call(this),this.Io=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Mo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[ty]:this.Mo}),this.Se=this.Po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.Po()}captureException(t){var e,n,r,s=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.Eo.consumeRateLimit(s)?Wc.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Ro=[],this.Oo=new rO([new dO,new xO,new hO,new fO,new yO,new vO,new mO,new _O],(function(r){for(var s=arguments.length,i=new Array(s>1?s-1:0),a=1;s>a;a++)i[a-1]=arguments[a];return function(u,c){c===void 0&&(c=0);for(var f=[],h=u.split(`
|
|
17
|
+
*/var pS;function BM(){if(pS)return Dc;pS=1;var t=U_(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(u,c,f){var h,p={},v=null,y=null;f!==void 0&&(v=""+f),c.key!==void 0&&(v=""+c.key),c.ref!==void 0&&(y=c.ref);for(h in c)r.call(c,h)&&!i.hasOwnProperty(h)&&(p[h]=c[h]);if(u&&u.defaultProps)for(h in c=u.defaultProps,c)p[h]===void 0&&(p[h]=c[h]);return{$$typeof:e,type:u,key:v,ref:y,props:p,_owner:s.current}}return Dc.Fragment=n,Dc.jsx=a,Dc.jsxs=a,Dc}var mS;function WM(){return mS||(mS=1,sv.exports=BM()),sv.exports}var S=WM(),g=U_();const ve=$m(g),B_=zM({__proto__:null,default:ve},[g]);var uf=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ga,To,mu,GC,GM=(GC=class extends uf{constructor(){super();Ue(this,Ga);Ue(this,To);Ue(this,mu);Ae(this,mu,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){W(this,To)||this.setEventListener(W(this,mu))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,To))==null||e.call(this),Ae(this,To,void 0))}setEventListener(e){var n;Ae(this,mu,e),(n=W(this,To))==null||n.call(this),Ae(this,To,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){W(this,Ga)!==e&&(Ae(this,Ga,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof W(this,Ga)=="boolean"?W(this,Ga):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ga=new WeakMap,To=new WeakMap,mu=new WeakMap,GC),W_=new GM,KM={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Ao,z_,KC,ZM=(KC=class{constructor(){Ue(this,Ao,KM);Ue(this,z_,!1)}setTimeoutProvider(t){Ae(this,Ao,t)}setTimeout(t,e){return W(this,Ao).setTimeout(t,e)}clearTimeout(t){W(this,Ao).clearTimeout(t)}setInterval(t,e){return W(this,Ao).setInterval(t,e)}clearInterval(t){W(this,Ao).clearInterval(t)}},Ao=new WeakMap,z_=new WeakMap,KC),Ha=new ZM;function qM(t){setTimeout(t,0)}var YM=typeof window>"u"||"Deno"in globalThis;function _r(){}function XM(t,e){return typeof t=="function"?t(e):t}function P1(t){return typeof t=="number"&&t>=0&&t!==1/0}function n8(t,e){return Math.max(t+(e||0)-Date.now(),0)}function zo(t,e){return typeof t=="function"?t(e):t}function Nr(t,e){return typeof t=="function"?t(e):t}function gS(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:u}=t;if(a){if(r){if(e.queryHash!==G_(a,e.options))return!1}else if(!Cd(e.queryKey,a))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||s&&s!==e.state.fetchStatus||i&&!i(e))}function vS(t,e){const{exact:n,status:r,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(kd(e.options.mutationKey)!==kd(i))return!1}else if(!Cd(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function G_(t,e){return((e==null?void 0:e.queryKeyHashFn)||kd)(t)}function kd(t){return JSON.stringify(t,(e,n)=>A1(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Cd(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Cd(t[n],e[n])):!1}var QM=Object.prototype.hasOwnProperty;function r8(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=yS(t)&&yS(e);if(!r&&!(A1(t)&&A1(e)))return e;const i=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),u=a.length,c=r?new Array(u):{};let f=0;for(let h=0;h<u;h++){const p=r?h:a[h],v=t[p],y=e[p];if(v===y){c[p]=v,(r?h<i:QM.call(t,p))&&f++;continue}if(v===null||y===null||typeof v!="object"||typeof y!="object"){c[p]=y;continue}const x=r8(v,y,n+1);c[p]=x,x===v&&f++}return i===u&&f===i?t:c}function T1(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function yS(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function A1(t){if(!_S(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!_S(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function _S(t){return Object.prototype.toString.call(t)==="[object Object]"}function JM(t){return new Promise(e=>{Ha.setTimeout(e,t)})}function R1(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?r8(t,e):e}function eL(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function tL(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var K_=Symbol();function s8(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===K_?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function i8(t,e){return typeof t=="function"?t(...e):!!t}function nL(t,e,n){let r=!1,s;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(s??(s=e()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),t}var Pd=(()=>{let t=()=>YM;return{isServer(){return t()},setIsServer(e){t=e}}})();function I1(){let t,e;const n=new Promise((s,i)=>{t=s,e=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}var rL=qM;function sL(){let t=[],e=0,n=u=>{u()},r=u=>{u()},s=rL;const i=u=>{e?t.push(u):s(()=>{n(u)})},a=()=>{const u=t;t=[],u.length&&s(()=>{r(()=>{u.forEach(c=>{n(c)})})})};return{batch:u=>{let c;e++;try{c=u()}finally{e--,e||a()}return c},batchCalls:u=>(...c)=>{i(()=>{u(...c)})},schedule:i,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{s=u}}}var Fn=sL(),gu,Ro,vu,ZC,iL=(ZC=class extends uf{constructor(){super();Ue(this,gu,!0);Ue(this,Ro);Ue(this,vu);Ae(this,vu,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){W(this,Ro)||this.setEventListener(W(this,vu))}onUnsubscribe(){var e;this.hasListeners()||((e=W(this,Ro))==null||e.call(this),Ae(this,Ro,void 0))}setEventListener(e){var n;Ae(this,vu,e),(n=W(this,Ro))==null||n.call(this),Ae(this,Ro,e(this.setOnline.bind(this)))}setOnline(e){W(this,gu)!==e&&(Ae(this,gu,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return W(this,gu)}},gu=new WeakMap,Ro=new WeakMap,vu=new WeakMap,ZC),Fp=new iL;function oL(t){return Math.min(1e3*2**t,3e4)}function o8(t){return(t??"online")==="online"?Fp.isOnline():!0}var M1=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function a8(t){let e=!1,n=0,r;const s=I1(),i=()=>s.status!=="pending",a=_=>{var b;if(!i()){const E=new M1(_);v(E),(b=t.onCancel)==null||b.call(t,E)}},u=()=>{e=!0},c=()=>{e=!1},f=()=>W_.isFocused()&&(t.networkMode==="always"||Fp.isOnline())&&t.canRun(),h=()=>o8(t.networkMode)&&t.canRun(),p=_=>{i()||(r==null||r(),s.resolve(_))},v=_=>{i()||(r==null||r(),s.reject(_))},y=()=>new Promise(_=>{var b;r=E=>{(i()||f())&&_(E)},(b=t.onPause)==null||b.call(t)}).then(()=>{var _;r=void 0,i()||(_=t.onContinue)==null||_.call(t)}),x=()=>{if(i())return;let _;const b=n===0?t.initialPromise:void 0;try{_=b??t.fn()}catch(E){_=Promise.reject(E)}Promise.resolve(_).then(p).catch(E=>{var O;if(i())return;const C=t.retry??(Pd.isServer()?0:3),P=t.retryDelay??oL,T=typeof P=="function"?P(n,E):P,A=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,E);if(e||!A){v(E);return}n++,(O=t.onFail)==null||O.call(t,n,E),JM(T).then(()=>f()?void 0:y()).then(()=>{e?v(E):x()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(r==null||r(),s),cancelRetry:u,continueRetry:c,canStart:h,start:()=>(h()?x():y().then(x),s)}}var Ka,qC,l8=(qC=class{constructor(){Ue(this,Ka)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),P1(this.gcTime)&&Ae(this,Ka,Ha.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Pd.isServer()?1/0:300*1e3))}clearGcTimeout(){W(this,Ka)!==void 0&&(Ha.clearTimeout(W(this,Ka)),Ae(this,Ka,void 0))}},Ka=new WeakMap,qC);function aL(t){return{onFetch:(e,n)=>{var h,p,v,y,x;const r=e.options,s=(v=(p=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:v.direction,i=((y=e.state.data)==null?void 0:y.pages)||[],a=((x=e.state.data)==null?void 0:x.pageParams)||[];let u={pages:[],pageParams:[]},c=0;const f=async()=>{let _=!1;const b=P=>{nL(P,()=>e.signal,()=>_=!0)},E=s8(e.options,e.fetchOptions),C=async(P,T,A)=>{if(_)return Promise.reject(e.signal.reason);if(T==null&&P.pages.length)return Promise.resolve(P);const M=(()=>{const j={client:e.client,queryKey:e.queryKey,pageParam:T,direction:A?"backward":"forward",meta:e.options.meta};return b(j),j})(),R=await E(M),{maxPages:L}=e.options,N=A?tL:eL;return{pages:N(P.pages,R,L),pageParams:N(P.pageParams,T,L)}};if(s&&i.length){const P=s==="backward",T=P?lL:xS,A={pages:i,pageParams:a},O=T(r,A);u=await C(A,O,P)}else{const P=t??i.length;do{const T=c===0?a[0]??r.initialPageParam:xS(r,u);if(c>0&&T==null)break;u=await C(u,T),c++}while(c<P)}return u};e.options.persister?e.fetchFn=()=>{var _,b;return(b=(_=e.options).persister)==null?void 0:b.call(_,f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=f}}}function xS(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function lL(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var yu,Za,_u,is,qa,Pn,rf,Ya,Or,u8,Mi,YC,uL=(YC=class extends l8{constructor(e){super();Ue(this,Or);Ue(this,yu);Ue(this,Za);Ue(this,_u);Ue(this,is);Ue(this,qa);Ue(this,Pn);Ue(this,rf);Ue(this,Ya);Ae(this,Ya,!1),Ae(this,rf,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ae(this,qa,e.client),Ae(this,is,W(this,qa).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ae(this,Za,bS(this.options)),this.state=e.state??W(this,Za),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return W(this,yu)}get promise(){var e;return(e=W(this,Pn))==null?void 0:e.promise}setOptions(e){if(this.options={...W(this,rf),...e},e!=null&&e._type&&Ae(this,yu,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=bS(this.options);n.data!==void 0&&(this.setState(wS(n.data,n.dataUpdatedAt)),Ae(this,Za,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&W(this,is).remove(this)}setData(e,n){const r=R1(this.state.data,e,this.options);return ot(this,Or,Mi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){ot(this,Or,Mi).call(this,{type:"setState",state:e})}cancel(e){var r,s;const n=(r=W(this,Pn))==null?void 0:r.promise;return(s=W(this,Pn))==null||s.cancel(e),n?n.then(_r).catch(_r):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return W(this,Za)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Nr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===K_||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>zo(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!n8(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=W(this,Pn))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=W(this,Pn))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),W(this,is).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(W(this,Pn)&&(W(this,Ya)||ot(this,Or,u8).call(this)?W(this,Pn).cancel({revert:!0}):W(this,Pn).cancelRetry()),this.scheduleGc()),W(this,is).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ot(this,Or,Mi).call(this,{type:"invalidate"})}async fetch(e,n){var f,h,p,v,y,x,_,b,E,C,P;if(this.state.fetchStatus!=="idle"&&((f=W(this,Pn))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(W(this,Pn))return W(this,Pn).continueRetry(),W(this,Pn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const T=this.observers.find(A=>A.options.queryFn);T&&this.setOptions(T.options)}const r=new AbortController,s=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(Ae(this,Ya,!0),r.signal)})},i=()=>{const T=s8(this.options,n),O=(()=>{const M={client:W(this,qa),queryKey:this.queryKey,meta:this.meta};return s(M),M})();return Ae(this,Ya,!1),this.options.persister?this.options.persister(T,O,this):T(O)},u=(()=>{const T={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:W(this,qa),state:this.state,fetchFn:i};return s(T),T})(),c=W(this,yu)==="infinite"?aL(this.options.pages):this.options.behavior;c==null||c.onFetch(u,this),Ae(this,_u,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&ot(this,Or,Mi).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),Ae(this,Pn,a8({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:T=>{T instanceof M1&&T.revert&&this.setState({...W(this,_u),fetchStatus:"idle"}),r.abort()},onFail:(T,A)=>{ot(this,Or,Mi).call(this,{type:"failed",failureCount:T,error:A})},onPause:()=>{ot(this,Or,Mi).call(this,{type:"pause"})},onContinue:()=>{ot(this,Or,Mi).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const T=await W(this,Pn).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(y=(v=W(this,is).config).onSuccess)==null||y.call(v,T,this),(_=(x=W(this,is).config).onSettled)==null||_.call(x,T,this.state.error,this),T}catch(T){if(T instanceof M1){if(T.silent)return W(this,Pn).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw ot(this,Or,Mi).call(this,{type:"error",error:T}),(E=(b=W(this,is).config).onError)==null||E.call(b,T,this),(P=(C=W(this,is).config).onSettled)==null||P.call(C,this.state.data,T,this),T}finally{this.scheduleGc()}}},yu=new WeakMap,Za=new WeakMap,_u=new WeakMap,is=new WeakMap,qa=new WeakMap,Pn=new WeakMap,rf=new WeakMap,Ya=new WeakMap,Or=new WeakSet,u8=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Mi=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...c8(r.data,this.options),fetchMeta:e.meta??null};case"success":const s={...r,...wS(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ae(this,_u,e.manual?s:void 0),s;case"error":const i=e.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Fn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),W(this,is).notify({query:this,type:"updated",action:e})})},YC);function c8(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:o8(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function wS(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bS(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var gr,ut,sf,rr,Xa,xu,$i,Io,of,wu,bu,Qa,Ja,Mo,Su,pt,ed,L1,O1,N1,D1,j1,F1,V1,d8,XC,cL=(XC=class extends uf{constructor(e,n){super();Ue(this,pt);Ue(this,gr);Ue(this,ut);Ue(this,sf);Ue(this,rr);Ue(this,Xa);Ue(this,xu);Ue(this,$i);Ue(this,Io);Ue(this,of);Ue(this,wu);Ue(this,bu);Ue(this,Qa);Ue(this,Ja);Ue(this,Mo);Ue(this,Su,new Set);this.options=n,Ae(this,gr,e),Ae(this,Io,null),Ae(this,$i,I1()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(W(this,ut).addObserver(this),SS(W(this,ut),this.options)?ot(this,pt,ed).call(this):this.updateResult(),ot(this,pt,D1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $1(W(this,ut),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $1(W(this,ut),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ot(this,pt,j1).call(this),ot(this,pt,F1).call(this),W(this,ut).removeObserver(this)}setOptions(e){const n=this.options,r=W(this,ut);if(this.options=W(this,gr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Nr(this.options.enabled,W(this,ut))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ot(this,pt,V1).call(this),W(this,ut).setOptions(this.options),n._defaulted&&!T1(this.options,n)&&W(this,gr).getQueryCache().notify({type:"observerOptionsUpdated",query:W(this,ut),observer:this});const s=this.hasListeners();s&&ES(W(this,ut),r,this.options,n)&&ot(this,pt,ed).call(this),this.updateResult(),s&&(W(this,ut)!==r||Nr(this.options.enabled,W(this,ut))!==Nr(n.enabled,W(this,ut))||zo(this.options.staleTime,W(this,ut))!==zo(n.staleTime,W(this,ut)))&&ot(this,pt,L1).call(this);const i=ot(this,pt,O1).call(this);s&&(W(this,ut)!==r||Nr(this.options.enabled,W(this,ut))!==Nr(n.enabled,W(this,ut))||i!==W(this,Mo))&&ot(this,pt,N1).call(this,i)}getOptimisticResult(e){const n=W(this,gr).getQueryCache().build(W(this,gr),e),r=this.createResult(n,e);return fL(this,r)&&(Ae(this,rr,r),Ae(this,xu,this.options),Ae(this,Xa,W(this,ut).state)),r}getCurrentResult(){return W(this,rr)}trackResult(e,n){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&W(this,$i).status==="pending"&&W(this,$i).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(e){W(this,Su).add(e)}getCurrentQuery(){return W(this,ut)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=W(this,gr).defaultQueryOptions(e),r=W(this,gr).getQueryCache().build(W(this,gr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return ot(this,pt,ed).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),W(this,rr)))}createResult(e,n){var L;const r=W(this,ut),s=this.options,i=W(this,rr),a=W(this,Xa),u=W(this,xu),f=e!==r?e.state:W(this,sf),{state:h}=e;let p={...h},v=!1,y;if(n._optimisticResults){const N=this.hasListeners(),j=!N&&SS(e,n),V=N&&ES(e,r,n,s);(j||V)&&(p={...p,...c8(h.data,e.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:_,status:b}=p;y=p.data;let E=!1;if(n.placeholderData!==void 0&&y===void 0&&b==="pending"){let N;i!=null&&i.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(N=i.data,E=!0):N=typeof n.placeholderData=="function"?n.placeholderData((L=W(this,bu))==null?void 0:L.state.data,W(this,bu)):n.placeholderData,N!==void 0&&(b="success",y=R1(i==null?void 0:i.data,N,n),v=!0)}if(n.select&&y!==void 0&&!E)if(i&&y===(a==null?void 0:a.data)&&n.select===W(this,of))y=W(this,wu);else try{Ae(this,of,n.select),y=n.select(y),y=R1(i==null?void 0:i.data,y,n),Ae(this,wu,y),Ae(this,Io,null)}catch(N){Ae(this,Io,N)}W(this,Io)&&(x=W(this,Io),y=W(this,wu),_=Date.now(),b="error");const C=p.fetchStatus==="fetching",P=b==="pending",T=b==="error",A=P&&C,O=y!==void 0,R={status:b,fetchStatus:p.fetchStatus,isPending:P,isSuccess:b==="success",isError:T,isInitialLoading:A,isLoading:A,data:y,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:C,isRefetching:C&&!P,isLoadingError:T&&!O,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:T&&O,isStale:Z_(e,n),refetch:this.refetch,promise:W(this,$i),isEnabled:Nr(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const N=R.data!==void 0,j=R.status==="error"&&!N,V=K=>{j?K.reject(R.error):N&&K.resolve(R.data)},G=()=>{const K=Ae(this,$i,R.promise=I1());V(K)},Y=W(this,$i);switch(Y.status){case"pending":e.queryHash===r.queryHash&&V(Y);break;case"fulfilled":(j||R.data!==Y.value)&&G();break;case"rejected":(!j||R.error!==Y.reason)&&G();break}}return R}updateResult(){const e=W(this,rr),n=this.createResult(W(this,ut),this.options);if(Ae(this,Xa,W(this,ut).state),Ae(this,xu,this.options),W(this,Xa).data!==void 0&&Ae(this,bu,W(this,ut)),T1(n,e))return;Ae(this,rr,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!W(this,Su).size)return!0;const a=new Set(i??W(this,Su));return this.options.throwOnError&&a.add("error"),Object.keys(W(this,rr)).some(u=>{const c=u;return W(this,rr)[c]!==e[c]&&a.has(c)})};ot(this,pt,d8).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ot(this,pt,D1).call(this)}},gr=new WeakMap,ut=new WeakMap,sf=new WeakMap,rr=new WeakMap,Xa=new WeakMap,xu=new WeakMap,$i=new WeakMap,Io=new WeakMap,of=new WeakMap,wu=new WeakMap,bu=new WeakMap,Qa=new WeakMap,Ja=new WeakMap,Mo=new WeakMap,Su=new WeakMap,pt=new WeakSet,ed=function(e){ot(this,pt,V1).call(this);let n=W(this,ut).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(_r)),n},L1=function(){ot(this,pt,j1).call(this);const e=zo(this.options.staleTime,W(this,ut));if(Pd.isServer()||W(this,rr).isStale||!P1(e))return;const r=n8(W(this,rr).dataUpdatedAt,e)+1;Ae(this,Qa,Ha.setTimeout(()=>{W(this,rr).isStale||this.updateResult()},r))},O1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(W(this,ut)):this.options.refetchInterval)??!1},N1=function(e){ot(this,pt,F1).call(this),Ae(this,Mo,e),!(Pd.isServer()||Nr(this.options.enabled,W(this,ut))===!1||!P1(W(this,Mo))||W(this,Mo)===0)&&Ae(this,Ja,Ha.setInterval(()=>{(this.options.refetchIntervalInBackground||W_.isFocused())&&ot(this,pt,ed).call(this)},W(this,Mo)))},D1=function(){ot(this,pt,L1).call(this),ot(this,pt,N1).call(this,ot(this,pt,O1).call(this))},j1=function(){W(this,Qa)!==void 0&&(Ha.clearTimeout(W(this,Qa)),Ae(this,Qa,void 0))},F1=function(){W(this,Ja)!==void 0&&(Ha.clearInterval(W(this,Ja)),Ae(this,Ja,void 0))},V1=function(){const e=W(this,gr).getQueryCache().build(W(this,gr),this.options);if(e===W(this,ut))return;const n=W(this,ut);Ae(this,ut,e),Ae(this,sf,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},d8=function(e){Fn.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(W(this,rr))}),W(this,gr).getQueryCache().notify({query:W(this,ut),type:"observerResultsUpdated"})})},XC);function dL(t,e){return Nr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Nr(e.retryOnMount,t)===!1)}function SS(t,e){return dL(t,e)||t.state.data!==void 0&&$1(t,e,e.refetchOnMount)}function $1(t,e,n){if(Nr(e.enabled,t)!==!1&&zo(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Z_(t,e)}return!1}function ES(t,e,n,r){return(t!==e||Nr(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Z_(t,n)}function Z_(t,e){return Nr(e.enabled,t)!==!1&&t.isStaleByTime(zo(e.staleTime,t))}function fL(t,e){return!T1(t.getCurrentResult(),e)}var af,Xs,Zn,el,Qs,ko,QC,hL=(QC=class extends l8{constructor(e){super();Ue(this,Qs);Ue(this,af);Ue(this,Xs);Ue(this,Zn);Ue(this,el);Ae(this,af,e.client),this.mutationId=e.mutationId,Ae(this,Zn,e.mutationCache),Ae(this,Xs,[]),this.state=e.state||pL(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){W(this,Xs).includes(e)||(W(this,Xs).push(e),this.clearGcTimeout(),W(this,Zn).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ae(this,Xs,W(this,Xs).filter(n=>n!==e)),this.scheduleGc(),W(this,Zn).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){W(this,Xs).length||(this.state.status==="pending"?this.scheduleGc():W(this,Zn).remove(this))}continue(){var e;return((e=W(this,el))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,u,c,f,h,p,v,y,x,_,b,E,C,P,T,A,O,M;const n=()=>{ot(this,Qs,ko).call(this,{type:"continue"})},r={client:W(this,af),meta:this.options.meta,mutationKey:this.options.mutationKey};Ae(this,el,a8({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,L)=>{ot(this,Qs,ko).call(this,{type:"failed",failureCount:R,error:L})},onPause:()=>{ot(this,Qs,ko).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>W(this,Zn).canRun(this)}));const s=this.state.status==="pending",i=!W(this,el).canStart();try{if(s)n();else{ot(this,Qs,ko).call(this,{type:"pending",variables:e,isPaused:i}),W(this,Zn).config.onMutate&&await W(this,Zn).config.onMutate(e,this,r);const L=await((u=(a=this.options).onMutate)==null?void 0:u.call(a,e,r));L!==this.state.context&&ot(this,Qs,ko).call(this,{type:"pending",context:L,variables:e,isPaused:i})}const R=await W(this,el).start();return await((f=(c=W(this,Zn).config).onSuccess)==null?void 0:f.call(c,R,e,this.state.context,this,r)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,R,e,this.state.context,r)),await((y=(v=W(this,Zn).config).onSettled)==null?void 0:y.call(v,R,null,this.state.variables,this.state.context,this,r)),await((_=(x=this.options).onSettled)==null?void 0:_.call(x,R,null,e,this.state.context,r)),ot(this,Qs,ko).call(this,{type:"success",data:R}),R}catch(R){try{await((E=(b=W(this,Zn).config).onError)==null?void 0:E.call(b,R,e,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((P=(C=this.options).onError)==null?void 0:P.call(C,R,e,this.state.context,r))}catch(L){Promise.reject(L)}try{await((A=(T=W(this,Zn).config).onSettled)==null?void 0:A.call(T,void 0,R,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((M=(O=this.options).onSettled)==null?void 0:M.call(O,void 0,R,e,this.state.context,r))}catch(L){Promise.reject(L)}throw ot(this,Qs,ko).call(this,{type:"error",error:R}),R}finally{W(this,Zn).runNext(this)}}},af=new WeakMap,Xs=new WeakMap,Zn=new WeakMap,el=new WeakMap,Qs=new WeakSet,ko=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fn.batch(()=>{W(this,Xs).forEach(r=>{r.onMutationUpdate(e)}),W(this,Zn).notify({mutation:this,type:"updated",action:e})})},QC);function pL(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hi,Ps,lf,JC,mL=(JC=class extends uf{constructor(e={}){super();Ue(this,Hi);Ue(this,Ps);Ue(this,lf);this.config=e,Ae(this,Hi,new Set),Ae(this,Ps,new Map),Ae(this,lf,0)}build(e,n,r){const s=new hL({client:e,mutationCache:this,mutationId:++Ch(this,lf)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){W(this,Hi).add(e);const n=Ph(e);if(typeof n=="string"){const r=W(this,Ps).get(n);r?r.push(e):W(this,Ps).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(W(this,Hi).delete(e)){const n=Ph(e);if(typeof n=="string"){const r=W(this,Ps).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&W(this,Ps).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Ph(e);if(typeof n=="string"){const r=W(this,Ps).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=Ph(e);if(typeof n=="string"){const s=(r=W(this,Ps).get(n))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fn.batch(()=>{W(this,Hi).forEach(e=>{this.notify({type:"removed",mutation:e})}),W(this,Hi).clear(),W(this,Ps).clear()})}getAll(){return Array.from(W(this,Hi))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>vS(n,r))}findAll(e={}){return this.getAll().filter(n=>vS(e,n))}notify(e){Fn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Fn.batch(()=>Promise.all(e.map(n=>n.continue().catch(_r))))}},Hi=new WeakMap,Ps=new WeakMap,lf=new WeakMap,JC);function Ph(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Js,e8,gL=(e8=class extends uf{constructor(e={}){super();Ue(this,Js);this.config=e,Ae(this,Js,new Map)}build(e,n,r){const s=n.queryKey,i=n.queryHash??G_(s,n);let a=this.get(i);return a||(a=new uL({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(a)),a}add(e){W(this,Js).has(e.queryHash)||(W(this,Js).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=W(this,Js).get(e.queryHash);n&&(e.destroy(),n===e&&W(this,Js).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return W(this,Js).get(e)}getAll(){return[...W(this,Js).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>gS(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>gS(e,r)):n}notify(e){Fn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Js=new WeakMap,e8),Qt,Lo,Oo,Eu,ku,No,Cu,Pu,t8,vL=(t8=class{constructor(t={}){Ue(this,Qt);Ue(this,Lo);Ue(this,Oo);Ue(this,Eu);Ue(this,ku);Ue(this,No);Ue(this,Cu);Ue(this,Pu);Ae(this,Qt,t.queryCache||new gL),Ae(this,Lo,t.mutationCache||new mL),Ae(this,Oo,t.defaultOptions||{}),Ae(this,Eu,new Map),Ae(this,ku,new Map),Ae(this,No,0)}mount(){Ch(this,No)._++,W(this,No)===1&&(Ae(this,Cu,W_.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,Qt).onFocus())})),Ae(this,Pu,Fp.subscribe(async t=>{t&&(await this.resumePausedMutations(),W(this,Qt).onOnline())})))}unmount(){var t,e;Ch(this,No)._--,W(this,No)===0&&((t=W(this,Cu))==null||t.call(this),Ae(this,Cu,void 0),(e=W(this,Pu))==null||e.call(this),Ae(this,Pu,void 0))}isFetching(t){return W(this,Qt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return W(this,Lo).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=W(this,Qt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=W(this,Qt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(zo(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return W(this,Qt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=W(this,Qt).get(r.queryHash),i=s==null?void 0:s.state.data,a=XM(e,i);if(a!==void 0)return W(this,Qt).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return Fn.batch(()=>W(this,Qt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=W(this,Qt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=W(this,Qt);Fn.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=W(this,Qt);return Fn.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Fn.batch(()=>W(this,Qt).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(_r).catch(_r)}invalidateQueries(t,e={}){return Fn.batch(()=>(W(this,Qt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Fn.batch(()=>W(this,Qt).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(_r)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(_r)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=W(this,Qt).build(this,e);return n.isStaleByTime(zo(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(_r).catch(_r)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(_r).catch(_r)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Fp.isOnline()?W(this,Lo).resumePausedMutations():Promise.resolve()}getQueryCache(){return W(this,Qt)}getMutationCache(){return W(this,Lo)}getDefaultOptions(){return W(this,Oo)}setDefaultOptions(t){Ae(this,Oo,t)}setQueryDefaults(t,e){W(this,Eu).set(kd(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...W(this,Eu).values()],n={};return e.forEach(r=>{Cd(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){W(this,ku).set(kd(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...W(this,ku).values()],n={};return e.forEach(r=>{Cd(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...W(this,Oo).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=G_(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===K_&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...W(this,Oo).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){W(this,Qt).clear(),W(this,Lo).clear()}},Qt=new WeakMap,Lo=new WeakMap,Oo=new WeakMap,Eu=new WeakMap,ku=new WeakMap,No=new WeakMap,Cu=new WeakMap,Pu=new WeakMap,t8),f8=g.createContext(void 0),h8=t=>{const e=g.useContext(f8);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},yL=({client:t,children:e})=>(g.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),S.jsx(f8.Provider,{value:t,children:e})),p8=g.createContext(!1),_L=()=>g.useContext(p8);p8.Provider;function xL(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var wL=g.createContext(xL()),bL=()=>g.useContext(wL),SL=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?i8(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},EL=t=>{g.useEffect(()=>{t.clearReset()},[t])},kL=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||i8(n,[t.error,r])),CL=t=>{if(t.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},PL=(t,e)=>t.isLoading&&t.isFetching&&!e,TL=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,kS=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function AL(t,e,n){var y,x,_,b;const r=_L(),s=bL(),i=h8(),a=i.defaultQueryOptions(t);(x=(y=i.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,a);const u=i.getQueryCache().get(a.queryHash),c=t.subscribed!==!1;a._optimisticResults=r?"isRestoring":c?"optimistic":void 0,CL(a),SL(a,s,u),EL(s);const f=!i.getQueryCache().get(a.queryHash),[h]=g.useState(()=>new e(i,a)),p=h.getOptimisticResult(a),v=!r&&c;if(g.useSyncExternalStore(g.useCallback(E=>{const C=v?h.subscribe(Fn.batchCalls(E)):_r;return h.updateResult(),C},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),g.useEffect(()=>{h.setOptions(a)},[a,h]),TL(a,p))throw kS(a,h,s);if(kL({result:p,errorResetBoundary:s,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw p.error;if((b=(_=i.getDefaultOptions().queries)==null?void 0:_._experimental_afterQuery)==null||b.call(_,a,p),a.experimental_prefetchInRender&&!Pd.isServer()&&PL(p,r)){const E=f?kS(a,h,s):u==null?void 0:u.promise;E==null||E.catch(_r).finally(()=>{h.updateResult()})}return a.notifyOnChangeProps?p:h.trackResult(p)}function H1(t,e){return AL(t,cL)}var te=typeof window<"u"?window:void 0,_n=typeof globalThis<"u"?globalThis:te;typeof self>"u"&&(_n.self=_n),typeof File>"u"&&(_n.File=function(){});var sr=_n==null?void 0:_n.navigator,Ee=_n==null?void 0:_n.document,on=_n==null?void 0:_n.location,z1=_n==null?void 0:_n.fetch,U1=_n!=null&&_n.XMLHttpRequest&&"withCredentials"in new _n.XMLHttpRequest?_n.XMLHttpRequest:void 0,CS=_n==null?void 0:_n.AbortController,RL=_n==null?void 0:_n.CompressionStream,vr=sr==null?void 0:sr.userAgent,$e=te??{};function m8(){return!(!te||te.navigator.onLine===!1)}var PS="1.399.2",Vt={DEBUG:!1,LIB_VERSION:PS,LIB_NAME:"web",JS_SDK_VERSION:PS};function TS(t,e,n,r,s,i,a){try{var u=t[i](a),c=u.value}catch(f){return void n(f)}u.done?e(c):Promise.resolve(c).then(r,s)}function en(t){return function(){var e=this,n=arguments;return new Promise((function(r,s){var i=t.apply(e,n);function a(c){TS(i,r,s,a,u,"next",c)}function u(c){TS(i,r,s,a,u,"throw",c)}a(void 0)}))}}function pe(){return pe=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pe.apply(null,arguments)}function g8(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var AS=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function RS(t){return typeof t=="string"||t}function IS(t){return typeof t=="string"?t:void 0}var jc,Di=(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.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.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),MS=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),IL=["$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"],ML=["token"],v8="NativeGzipValidationError",B1=t=>t.length>=2&&t[0]===31&&t[1]===139,LS=(t,e)=>t===MS.GZipJS||e===MS.GZipJS||e==="gzip",OS=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",Th=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=v8,e},LL=(function(){var t=en((function*(e,n){18>e.size&&Th("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());B1(r)&&r[2]===8||Th("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(a=>{for(var u=(()=>{if(jc)return jc;jc=[];for(var h=0;256>h;h++){for(var p=h,v=0;8>v;v++)p=1&p?3988292384^p>>>1:p>>>1;jc[h]=p>>>0}return jc})(),c=4294967295,f=0;a.length>f;f++)c=u[255&(c^a[f])]^c>>>8;return(4294967295^c)>>>0})(n)&&Th("invalid-crc");var i=n.length>>>0;s.getUint32(4,!0)!==i&&Th("invalid-size")}));return function(e,n){return t.apply(this,arguments)}})();function W1(){return W1=en((function*(t,e,n){e===void 0&&(e=!0);try{var r=new TextEncoder().encode(t),s=new CompressionStream("gzip"),i=s.writable.getWriter(),a=i.write(r).then((()=>i.close())).catch((function(){var f=en((function*(h){try{yield i.abort(h)}catch{}throw h}));return function(h){return f.apply(this,arguments)}})()),u=new Response(s.readable).blob(),[c]=yield Promise.all([u,a]);return yield LL(c,r),c}catch(f){if(n!=null&&n.rethrow)throw f;return e&&console.error("Failed to gzip compress data",f),null}})),W1.apply(this,arguments)}var OL=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],NS=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return OL.concat(e).some((r=>{var s=r.toLowerCase();return n.indexOf(s)!==-1}))};function Be(t,e){return t.indexOf(e)!==-1}var Hm=function(t){return t.trim()},G1=function(t){return t.replace(/^\$/,"")},y8=Object.prototype,_8=y8.hasOwnProperty,zm=y8.toString,tt=Array.isArray||function(t){return zm.call(t)==="[object Array]"},Ts=t=>typeof t=="function",Ot=t=>t===Object(t)&&!tt(t),Do=t=>{if(Ot(t)){for(var e in t)if(_8.call(t,e))return!1;return!0}return!1},be=t=>t===void 0,_t=t=>zm.call(t)=="[object String]",K1=t=>_t(t)&&t.trim().length===0,ar=t=>t===null,Ye=t=>be(t)||ar(t),$n=t=>zm.call(t)=="[object Number]"&&t==t,Li=t=>$n(t)&&t>0,ai=t=>zm.call(t)==="[object Boolean]",NL=t=>t instanceof FormData,DL=t=>Be(IL,t),jL=t=>Be(ML,t);function x8(t){return t===null||typeof t!="object"}function Vp(t,e){return{}.toString.call(t)==="[object "+e+"]"}function q_(t){return typeof Event<"u"&&(function(e,n){try{return e instanceof n}catch{return!1}})(t,Event)}var FL=[!0,"true",1,"1","yes"],ov=t=>Be(FL,t),VL=[!1,"false",0,"0","no"];function si(t,e,n,r,s){return e>n&&(r.warn("min cannot be greater than max."),e=n),$n(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),si(s||n,e,n,r))}class $L{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=si(e.bucketSize,0,100,e.Ae),this.De=si(e.refillRate,0,this.Fe,e.Ae),this.$e=si(e.refillInterval,0,864e5,e.Ae)}Ne(e,n){var r=Math.floor((n-e.lastAccess)/this.$e);r>0&&(e.tokens=Math.min(e.tokens+r*this.De,this.Fe),e.lastAccess=e.lastAccess+r*this.$e)}consumeRateLimit(e){var n,r=Date.now(),s=String(e),i=this.Ee[s];return i?this.Ne(i,r):this.Ee[s]=i={tokens:this.Fe,lastAccess:r},i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.Pe)==null||n.call(this,e)),i.tokens===0)}stop(){this.Ee={}}}var zr="Mobile",$p="iOS",Wi="Android",Tu="Tablet",w8=Wi+" "+Tu,b8="iPad",S8="Apple",E8=S8+" Watch",ud="Safari",Au="BlackBerry",k8="Samsung",C8=k8+"Browser",P8=k8+" Internet",tl="Chrome",HL=tl+" OS",T8=tl+" "+$p,Y_="Internet Explorer",A8=Y_+" "+zr,X_="Opera",zL=X_+" Mini",Q_="Edge",R8="Microsoft "+Q_,ou="Firefox",I8=ou+" "+$p,Td="Nintendo",Ad="PlayStation",au="Xbox",M8=Wi+" "+zr,L8=zr+" "+ud,td="Windows",Z1=td+" Phone",DS="Nokia",q1="Ouya",O8="Generic",UL=O8+" "+zr.toLowerCase(),N8=O8+" "+Tu.toLowerCase(),Y1="Konqueror",D8="Oculus Browser",Hp="Vivaldi",j8="Yandex",zp="Whale",X1="DuckDuckGo",F8="Pale Moon",Up="Waterfox",cd="Brave",V8="Google Search App",Ft="(\\d+(\\.\\d+)?)",av=new RegExp("Version/"+Ft),BL=new RegExp(au,"i"),WL=new RegExp(Ad+" \\w+","i"),GL=new RegExp(Td+" \\w+","i"),J_=new RegExp(Au+"|PlayBook|BB10","i"),KL={"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"},$8=function(t,e,n,r){e=e||"";var s=(function(i){return i!=null&&i.brave?cd:null})(n);return s||(r!=null&&r.detectGoogleSearchApp&&Be(t,"GSA/")?V8:Be(t," OPR/")&&Be(t,"Mini")?zL:Be(t," OPR/")?X_:J_.test(t)?Au:Be(t,"IE"+zr)||Be(t,"WPDesktop")?A8:Be(t,"OculusBrowser")?D8:Be(t,C8)?P8:Be(t,Q_)||Be(t,"Edg/")?R8:Be(t,Hp+"/")?Hp:Be(t,"YaBrowser/")?j8:Be(t,zp+"/")?zp:Be(t,X1+"/")||Be(t,"Ddg/")?X1:Be(t,"FBIOS")?"Facebook "+zr:Be(t,"UCWEB")||Be(t,"UCBrowser")?"UC Browser":Be(t,"CriOS")?T8:Be(t,"CrMo")||Be(t,tl)?tl:Be(t,Wi)&&Be(t,ud)?M8:Be(t,"FxiOS")?I8:Be(t.toLowerCase(),Y1.toLowerCase())?Y1:Be(t,cd+"/")?cd:((i,a)=>a&&Be(a,S8)||(function(u){return Be(u,ud)&&!Be(u,tl)&&!Be(u,Wi)})(i))(t,e)?Be(t,zr)?L8:ud:Be(t,"PaleMoon/")?F8:Be(t,Up+"/")?Up:Be(t,ou)?ou:Be(t,"MSIE")||Be(t,"Trident/")?Y_:Be(t,"Gecko")?ou:"")},ZL={[A8]:[new RegExp("rv:"+Ft)],[R8]:[new RegExp(Q_+"?\\/"+Ft)],[tl]:[new RegExp("("+tl+"|CrMo)\\/"+Ft)],[T8]:[new RegExp("CriOS\\/"+Ft)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ft)],[ud]:[av],[L8]:[av],[X_]:[new RegExp("(Opera|OPR)\\/"+Ft)],[ou]:[new RegExp(ou+"\\/"+Ft)],[I8]:[new RegExp("FxiOS\\/"+Ft)],[Y1]:[new RegExp("Konqueror[:/]?"+Ft,"i")],[Au]:[new RegExp(Au+" "+Ft),av],[M8]:[new RegExp("android\\s"+Ft,"i")],[P8]:[new RegExp(C8+"\\/"+Ft)],[D8]:[new RegExp("OculusBrowser\\/"+Ft)],[Hp]:[new RegExp(Hp+"\\/"+Ft)],[j8]:[new RegExp("YaBrowser\\/"+Ft)],[zp]:[new RegExp(zp+"\\/"+Ft)],[cd]:[new RegExp(cd+"\\/"+Ft)],[X1]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ft)],[F8]:[new RegExp("PaleMoon\\/"+Ft)],[Up]:[new RegExp(Up+"\\/"+Ft)],[V8]:[new RegExp("GSA\\/"+Ft)],[Y_]:[new RegExp("(rv:|MSIE )"+Ft)],Mozilla:[new RegExp("rv:"+Ft)]},qL=function(t,e,n,r){var s=$8(t,e,n,r),i=ZL[s];if(be(i))return null;for(var a=0;i.length>a;a++){var u=t.match(i[a]);if(u)return parseFloat(u[u.length-2])}return null},jS=[[new RegExp(au+"; "+au+" (.*?)[);]","i"),t=>[au,t&&t[1]||""]],[new RegExp(Td,"i"),[Td,""]],[new RegExp(Ad,"i"),[Ad,""]],[J_,[Au,""]],[new RegExp(td,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Z1,""];if(new RegExp(zr).test(e)&&!/IEMobile\b/.test(e))return[td+" "+zr,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=KL[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[td,r]}return[td,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[$p,[t[3],t[4],t[5]||"0"].join(".")]:[$p,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=be(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Wi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Wi+")","i"),t=>t&&t[2]?[Wi,[t[2],t[3],t[4]||"0"].join(".")]:[Wi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var 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/,[HL,""]],[/Linux|debian/i,["Linux",""]]],FS=function(t){return GL.test(t)?Td:WL.test(t)?Ad:BL.test(t)?au:new RegExp(q1,"i").test(t)?q1:new RegExp("("+Z1+"|WPDesktop)","i").test(t)?Z1:/iPad/.test(t)?b8:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?E8:J_.test(t)?Au:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(DS,"i").test(t)?DS:/(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(zr).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)?Wi:w8:new RegExp("(pda|"+zr+")","i").test(t)?UL:new RegExp(Tu,"i").test(t)&&!new RegExp(Tu+" pc","i").test(t)?N8:""},YL=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function VS(t,e){return typeof(n=t)=="string"&&YL.test(n)?t:e();var n}function Wo(t){return t&&t.split("#")[0]}function ap(t,e){var n=setTimeout(t,e);return n!=null&&n.unref&&(n==null||n.unref()),n}var XL=t=>t instanceof Error,H8={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}},QL=H8.info;function z8(t){if(ai(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(tt(t))return{arrayValue:{values:t.map((e=>z8(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function Bp(t){var e=[];for(var n in t){var r=t[n];ar(r)||be(r)||e.push({key:n,value:z8(r)})}return e}function JL(t,e){var n=t.level||"info",{text:r,number:s}=H8[n]||QL,i=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Ye(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Ye(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);var u=pe({},a,t.attributes||{}),c={timeUnixNano:i,observedTimeUnixNano:i,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:Bp(u)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),be(t.trace_flags)||(c.flags=t.trace_flags),c}function U8(t,e,n){return pe({},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})}function B8(t,e,n,r){return{resourceLogs:[{resource:{attributes:Bp(e)},scopeLogs:[{scope:{name:n,version:r},logRecords:t}]}]}}let eO=class{constructor(t,e,n,r,s,i,a){var u;i===void 0&&(i=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=n,this.qe=r,this.Be=s,this.je=i,this.He=a,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max((u=e.maxQueueSize)!==null&&u!==void 0?u:e.maxBufferSize,e.maxBufferSize),this.Ke=e.flushIntervalMs,this.Ye=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ye=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.it(t);if(e!==null)if(e.body){if(this.nt()){var n={record:JL(e,this.qe())};this.Be((()=>this.st(n)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=tt(e)?e:[e],r=t;for(var s of n)try{var i=s(r);if(!i)return this.Ae.info("Log was rejected in beforeSend function"),null;r=i}catch(a){return this.Ae.error("Error in beforeSend function for log:",a),null}return r}nt(){if(this.et===void 0)return!0;var t=Date.now(),e=t-this.We;return this.Xe>e&&e>=0||(this.We=t,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var t=this;return en((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return en((function*(){var e;t.tt();var n=(e=t._instance.getPersistedProperty(Di.LogsQueue))!==null&&e!==void 0?e:[];if(n.length!==0)for(var r=n.length,s=0;n.length>0&&r>s;){var i,a;t.ze=0;var u=Math.min(n.length,t.Ye),c=n.slice(0,u),f=B8(c.map((p=>p.record)),t.ut(),(i=t.He)!==null&&i!==void 0?i:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.ht(f);if(h.kind==="too-large"&&c.length>1)t.Ye=Math.max(1,Math.floor(c.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+c.length+", reducing batch size to "+t.Ye);else if(h.kind==="retry-later"||(h.kind==="too-large"?t.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&t.Se.maxBatchRecordsPerPost>t.Ye&&(t.Ye=Math.min(t.Se.maxBatchRecordsPerPost,t.Ye+1)),yield t.dt(c.length),n=(a=t._instance.getPersistedProperty(Di.LogsQueue))!==null&&a!==void 0?a:[],s+=c.length,h.kind==="fatal"))throw h.error}}))()}dt(t){var e=this;return en((function*(){var n,r=Math.max(0,t-e.ze),s=(n=e._instance.getPersistedProperty(Di.LogsQueue))!==null&&n!==void 0?n:[];e._instance.setPersistedProperty(Di.LogsQueue,s.slice(r)),yield e.je()}))()}ut(){return U8(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var n=(e=this._instance.getPersistedProperty(Di.LogsQueue))!==null&&e!==void 0?e:[];this.Je>n.length||(n.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),n.push(t),this._instance.setPersistedProperty(Di.LogsQueue,n),this.Qe>n.length?this.ct():this.rt()}}ct(t){t===void 0&&(t=this.Ke),this.vt||(this.vt=ap((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.Ve-1),6);return this.Ke*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(Di.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return en((function*(){e.tt();var n=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([n,new Promise((r=>ap(r,t)))]):yield n}))()}flushWithTimeout(t){var e=this;return en((function*(){var n=!1,r=e.flush(),s=new Promise((i=>ap((()=>{n=!0,i()}),t)));try{yield Promise.race([r,s])}finally{n&&r.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(t=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var lv=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function $S(t){return String(t)+"000000"}function HS(t,e,n,r){var s="";return r&&(s=Object.keys(r).sort().map((i=>JSON.stringify(i)+":"+JSON.stringify(r[i]))).join(",")),t+"\0"+e+"\0"+(n??"")+"\0"+s}let tO=class{constructor(t,e,n){this._instance=t,this.Se=e,this.Ae=n,this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}count(t,e,n){e===void 0&&(e=1),this.kt({name:t,type:"count",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(t,e,n){this.kt({name:t,type:"gauge",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(t,e,n){this.kt({name:t,type:"histogram",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var t=this,e=this.Ue,n=(function(){var s=en((function*(){e&&(yield e.catch((()=>{}))),yield t.St()}));return function(){return s.apply(this,arguments)}})(),r=n().finally((()=>{this.Ue===r&&(this.Ue=null)}));return this.Ue=r,r}drainWindow(){if(this.bt.size===0)return null;var t=this.bt;return this.bt=new Map,this._t=!1,this.wt=new Map,this.xt=new Set,this.Ct(t)}reset(){this.tt(),this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}kt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.it(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ae.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var n=this.wt.get(e.name);n===void 0?this.wt.set(e.name,e.type):n===e.type||this.xt.has(e.name)||(this.xt.add(e.name),this.Ae.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name."));var r=HS(e.type,e.name,e.unit,e.attributes),s=this.bt.get(r);if(!s){if(this.bt.size>=this.Se.maxSeriesPerFlush)return void(this._t||(this._t=!0,this.Ae.warn("Metric series cap reached ("+this.Se.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")));s={name:e.name,type:e.type,unit:e.unit,attributes:e.attributes?pe({},e.attributes):void 0,windowStartMs:Date.now()},this.bt.set(r,s)}this.It(s,e.value),this.ct()}else this.Ae.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ae.warn("Dropping metric with empty name")}}It(t,e){var n;switch(t.type){case"count":t.total=((n=t.total)!==null&&n!==void 0?n:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(lv.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[(function(s,i){for(var a=0;i.length>a;a++)if(i[a]>=s)return a;return i.length})(e,lv)]+=1}}it(t){var e=this.Se.beforeSend;if(!e)return t;var n=tt(e)?e:[e],r=t;for(var s of n)try{var i=s(r);if(!i)return this.Ae.info("Metric was rejected in beforeSend function"),null;r=i}catch(a){return this.Ae.error("Error in beforeSend function for metric:",a),null}return r}ct(){this.vt||(this.vt=ap((()=>{this.vt=void 0,this.flush().catch((()=>{}))}),this.Se.flushIntervalMs))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}St(){var t=this;return en((function*(){if(t.bt.size!==0){var e=t.bt;t.bt=new Map,t._t=!1,t.wt=new Map,t.xt=new Set;var n=yield t._instance.Tt(t.Ct(e));switch(n.kind){case"ok":return;case"retry-later":return t.Mt(e),void t.ct();case"too-large":return void t.Ae.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ae.error("Failed to send metrics batch:",n.error)}}}))()}Ct(t){return(function(s,i,a,u){return{resourceMetrics:[{resource:{attributes:Bp(i)},scopeMetrics:[{scope:{name:a,version:u},metrics:s}]}]}})(this.Et(t),(e=this.Se,n=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),pe({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":n,"telemetry.sdk.version":r})),this._instance.getLibraryId(),this._instance.getLibraryVersion());var e,n,r}Et(t){var e=$S(Date.now()),n=new Map;for(var r of t.values()){var s,i=HS(r.type,r.name,r.unit,void 0),a=n.get(i);a||(a=pe({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},n.set(i,a));var u=Bp((s=r.attributes)!==null&&s!==void 0?s:{}),c=$S(r.windowStartMs);if(r.type==="count"){var f,h={attributes:u,startTimeUnixNano:c,timeUnixNano:e,asDouble:(f=r.total)!==null&&f!==void 0?f:0};a.sum.dataPoints.push(h)}else if(r.type==="gauge"){var p,v={attributes:u,timeUnixNano:e,asDouble:(p=r.last)!==null&&p!==void 0?p:0};a.gauge.dataPoints.push(v)}else r.hist&&a.histogram.dataPoints.push({attributes:u,startTimeUnixNano:c,timeUnixNano:e,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:lv})}return Array.from(n.values())}Mt(t){var e,n;for(var[r,s]of t){var i=this.bt.get(r);if(i)switch(i.windowStartMs=Math.min(i.windowStartMs,s.windowStartMs),i.type){case"count":i.total=((e=i.total)!==null&&e!==void 0?e:0)+((n=s.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(s.hist)if(i.hist){i.hist.count+=s.hist.count,i.hist.sum+=s.hist.sum,i.hist.min=Math.min(i.hist.min,s.hist.min),i.hist.max=Math.max(i.hist.max,s.hist.max);for(var a=0;i.hist.bucketCounts.length>a;a++)i.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else i.hist=s.hist}else this.bt.set(r,s)}}};var Ah,zS,uv;function nO(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return uv&&n.length===zS||(zS=n.length,uv=n.reduce(((r,s)=>{Ah||(Ah={});var i=Ah[s];if(i)r[i[0]]=i[1];else for(var a=t(s),u=a.length-1;u>=0;u--){var c=a[u],f=c==null?void 0:c.filename,h=e[s];if(f&&h){r[f]=h,Ah[s]=[f,h];break}}return r}),{})),uv}}class rO{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,n,0).apply(e),i=this.buildParsingContext(n),a=this.parseStacktrace(s,i);return{$exception_list:this.convertToExceptionList(a,r),$exception_level:"error"}}modifyFrames(e){var n=this;return en((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&tt(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),pe({},e,{cause:r,stack:s})}applyChunkIds(e,n){return e.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return en((function*(){var r=e;for(var s of n.modifiers)r=yield s(r);return r}))()}convertToExceptionList(e,n){var r,s,i,a={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(s=n.handled)===null||s===void 0||s,synthetic:(i=e.synthetic)!==null&&i!==void 0&&i}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var u=[a];return e.cause!=null&&u.push(...this.convertToExceptionList(e.cause,pe({},n,{handled:!0}))),u}buildParsingContext(e){var n;return{chunkIdMap:nO(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var s=(i,a)=>{if(4>=a){var u=this.buildCoercingContext(e,n,a);return this.applyCoercers(i,u)}};return pe({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:i=>s(i,r),next:i=>s(i,r+1)})}}var Ru="?";function Q1(t,e,n,r,s){var i={platform:t,filename:e,function:n==="<anonymous>"?Ru:n,in_app:!0};return be(r)||(i.lineno=r),be(s)||(i.colno=s),i}var W8=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Ru,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},sO=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,iO=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oO=/\((\S*)(?::(\d+))(?::(\d+))\)/,aO=(t,e)=>{var n=sO.exec(t);if(n){var[,r,s,i]=n;return Q1(e,r,Ru,+s,+i)}var a=iO.exec(t);if(a){if(a[2]&&a[2].indexOf("eval")===0){var u=oO.exec(a[2]);u&&(a[2]=u[1],a[3]=u[2],a[4]=u[3])}var[c,f]=W8(a[1]||Ru,a[2]);return Q1(e,f,c,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},lO=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,uO=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,cO=(t,e)=>{var n=lO.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=uO.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var s=n[3],i=n[1]||Ru;return[i,s]=W8(i,s),Q1(e,s,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},US=/\(error: (.*)\)/;class dO{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=_t(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?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){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return Vp(e,"DOMException")}isDOMError(e){return Vp(e,"DOMError")}}class fO{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class hO{constructor(){}match(e){return Vp(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var pO=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class mO{match(e){return typeof e=="string"}coerce(e,n){var r,[s,i]=this.getInfos(e);return{type:s??"Error",value:i??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,s=e.match(pO);return s&&(n=s[1],r=s[2]),[n,r]}}var gO=["fatal","error","warning","log","info","debug"];function G8(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var s=n.slice(0,r).join(", ");if(e>=s.length)return r===n.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class vO{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,s=this.getErrorPropertyFromObject(e);return s?n.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return q_(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+G8(e)}isSeverityLevel(e){return _t(e)&&!K1(e)&&gO.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(XL(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class yO{match(e){return q_(e)}coerce(e,n){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+G8(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class _O{match(e){return x8(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class xO{match(e){return Vp(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!q_(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,s=this.getUnhandledRejectionReason(e);return x8(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(s)}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}}var Wp="$message",Gp="$timestamp",wO=new Set([Wp,Gp]),cv={enabled:!0,max_bytes:32768};function Kp(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:cv.enabled,max_bytes:SO(t.max_bytes,cv.max_bytes)}:pe({},cv)}class bO{constructor(e){this.Pt=[],this.Rt=0,this.Se=Kp(e)}setConfig(e){this.Se=Kp(e),this.Ot()}add(e){var n=(function(s){var i,a,u;try{u=[],i=(a=JSON.stringify(s,(function(v,y){if(typeof y=="bigint")return y.toString();if(typeof y!="function"&&typeof y!="symbol"){if(y instanceof Error)return{name:y.name,message:y.message,stack:y.stack};if(y&&typeof y=="object"){for(;u.length>0&&u[u.length-1]!==this;)u.pop();if(u.includes(y))return"[Circular]";u.push(y)}return y}})))!==null&&a!==void 0?a:"null"}catch{return}try{var c=JSON.parse(i);if(!Ot(c))return;var f=c,h=f[Wp],p=f[Gp];return!_t(h)||h.trim().length===0||!_t(p)&&!$n(p)?void 0:{step:f,json:i}}catch{return}})(e);if(n){var r=(function(s){if(typeof TextEncoder<"u")return new TextEncoder().encode(s).length;for(var i=encodeURIComponent(s),a=0,u=0;i.length>u;u++)i[u]==="%"?(a+=1,u+=2):a+=1;return a})(n.json);r>this.Se.max_bytes||(this.Pt.push({step:n.step,bytes:r}),this.Rt+=r,this.Ot())}}getAttachable(){return this.Pt.map((e=>e.step))}clear(){this.Pt=[],this.Rt=0}size(){return this.Pt.length}Ot(){for(;this.Rt>this.Se.max_bytes&&this.Pt.length>0;){var e=this.Pt.shift();e&&(this.Rt-=e.bytes)}}}function SO(t,e){if(!$n(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var K8=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={k(s){if(te&&(Vt.DEBUG||$e.POSTHOG_DEBUG||n)&&!be(te.console)&&te.console){for(var i=("__rrweb_original__"in te.console[s])?te.console[s].__rrweb_original__:te.console[s],a=arguments.length,u=new Array(a>1?a-1:0),c=1;a>c;c++)u[c-1]=arguments[c];i(t,...u)}},debug(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("debug",...i)},info(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("log",...i)},warn(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("warn",...i)},error(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];r.k("error",...i)},critical(){for(var s=arguments.length,i=new Array(s),a=0;s>a;a++)i[a]=arguments[a];console.error(t,...i)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,i)=>K8(t+" "+s,i)};return r},_e=K8("[PostHog.js]"),Dt=_e.createLogger,EO=Dt("[ExternalScriptsLoader]"),dv=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return EO.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Ee==null?void 0:Ee.querySelectorAll("script");if(r){for(var s,i=function(){if(r[a].src===e){var c=r[a];return c.__posthog_loading_callback_fired?{v:n()}:(c.addEventListener("load",(f=>{c.__posthog_loading_callback_fired=!0,n(void 0,f)})),c.onerror=f=>n(f),{v:void 0})}},a=0;r.length>a;a++)if(s=i())return s.v}var u=()=>{if(!Ee)return n("document not found");var c=Ee.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=e,c.onload=p=>{c.__posthog_loading_callback_fired=!0,n(void 0,p)},c.onerror=p=>n(p),t.config.prepare_external_dependency_script&&(c=t.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")Ee.head.appendChild(c);else{var f,h=Ee.querySelectorAll("body > script");h.length>0?(f=h[0].parentNode)==null||f.insertBefore(c,h[0]):Ee.body.appendChild(c)}};Ee!=null&&Ee.body?u():Ee==null||Ee.addEventListener("DOMContentLoaded",u)};$e.__PosthogExtensions__=$e.__PosthogExtensions__||{},$e.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var i=3e5;s=s+"&t="+Math.floor(Date.now()/i)*i}r=t.requestRouter.endpointFor("assets",s)}dv(t,r,n)}else{var a=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");dv(t,a,n)}},$e.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);dv(t,r,n)};var Z8="$people_distinct_id",Zp="$device_id",fv="$device_model",nd="__alias",rd="__timers",J1="$autocapture_disabled_server_side",ey="$heatmaps_enabled_server_side",ty="$exception_capture_enabled_server_side",ny="$error_tracking_suppression_rules",ry="$error_tracking_capture_extension_exceptions",sy="$web_vitals_enabled_server_side",e2="$dead_clicks_enabled_server_side",t2="$product_tours_enabled_server_side",iy="$web_vitals_allowed_metrics",za="$session_recording_remote_config",q8="$replay_sample_rate",Y8="$replay_override_sampling",X8="$replay_override_linked_flag",Q8="$replay_override_url_trigger",J8="$replay_override_event_trigger",Jl="$sesid",n2="$session_is_sampled",Va="$enabled_feature_flags",lp="$active_feature_flags",sd="$early_access_features",oy="$feature_flag_details",up="$feature_flag_payloads",ay="$feature_flag_request_id",Oi="$override_feature_flags",ql="$override_feature_flag_payloads",Oa="$stored_person_properties",Na="$stored_group_properties",ly="$surveys",qp="$surveys_loaded_at",uy="$surveys_activated",id="ph_product_tours",dd="$flag_call_reported",cy="$flag_call_reported_session_id",dy="$feature_flag_errors",Rd="$feature_flag_evaluated_at",Es="$user_state",fy="$client_session_props",hy="$capture_rate_limit",py="$initial_campaign_params",my="$initial_referrer_info",Yp="$initial_person_info",Xp="$epp",e6="__POSTHOG_TOOLBAR__",Rh="$posthog_cookieless",t6="$sdk_debug_extensions_init_method",n6="$sdk_debug_extensions_init_time_ms",r6="$sdk_debug_recording_script_not_loaded",r2="PostHog loadExternalDependency extension not found.",Da="on_reject",zi="always",Vl="anonymous",$l="identified",gy="identified_only",Qp="visibilitychange",Jp="beforeunload",Yl="$pageview",hv="$pageleave",pv="$identify",BS="$groupidentify";function Ih(t,e){tt(t)&&t.forEach(e)}function bt(t,e){if(!Ye(t))if(tt(t))t.forEach(e);else if(NL(t))t.forEach(((r,s)=>e(r,s)));else for(var n in t)_8.call(t,n)&&e(t[n],n)}var At=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var s of n)for(var i in s)s[i]!==void 0&&(t[i]=s[i]);return t};function cp(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var WS=function(t){try{return t()}catch{return}},kO=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(s){_e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_e.critical(s)}}},s2=function(t){var e={};return bt(t,(function(n,r){(_t(n)&&n.length>0||$n(n))&&(e[r]=n)})),e},CO=["herokuapp.com","vercel.app","netlify.app"];function PO(t){var e=t==null?void 0:t.hostname;if(!_t(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of CO)if(n===r)return!1;return!0}function $t(t,e,n,r){var{capture:s=!1,passive:i=!0}=r??{};t==null||t.addEventListener(e,n,{capture:s,passive:i})}function s6(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return $n(t)&&isFinite(t)&&Math.floor(t)===t});class em{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>n||0>r||0>s||e>0xffffffffffff||n>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new em(i)}toString(){for(var e="",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 em(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class TO{constructor(){this.S=0,this.C=0,this.I=new AO}generate(){var e=this.generateOrAbort();if(be(e)){this.S=0;var n=this.generateOrAbort();if(be(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return em.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var GS,i6=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};te&&!be(te.crypto)&&crypto.getRandomValues&&(i6=t=>crypto.getRandomValues(t));class AO{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(i6(this.R),this.O=0),this.R[this.O++]}}var Fi=()=>RO().toString(),RO=()=>(GS||(GS=new TO)).generate(),Fc="",IO=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ti={N:()=>!!Ee,D(t){_e.error("cookieStore error: "+t)},A(t){if(Ee){try{for(var e=t+"=",n=Ee.cookie.split(";").filter((i=>i.length)),r=0;n.length>r;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},F(t){var e;try{e=JSON.parse(ti.A(t))||{}}catch{}return e},q(t,e,n,r,s){if(!Ee)return!1;try{var i="",a="",u=(function(h,p){if(p){var v=(function(x,_){if(_===void 0&&(_=Ee),Fc)return Fc;if(!_||["localhost","127.0.0.1"].includes(x))return"";for(var b=x.split("."),E=Math.min(b.length,8),C="dmn_chk_"+Fi();!Fc&&E--;){var P=b.slice(E).join("."),T=C+"=1;domain=."+P+";path=/";_.cookie=T+";max-age=3",_.cookie.includes(C)&&(_.cookie=T+";max-age=0",Fc=P)}return Fc})(h);if(!v){var y=(x=>{var _=x.match(IO);return _?_[0]:""})(h);y!==v&&_e.info("Warning: cookie subdomain discovery mismatch",y,v),v=y}return v?"; domain=."+v:""}return""})(Ee.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+864e5*n),i="; expires="+c.toUTCString()}s&&(a="; secure");var f=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+u+a;return f.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+f.length),Ee.cookie=f,!0}catch{return!1}},P(t,e){if(Ee!=null&&Ee.cookie)try{ti.q(t,"",-1,e)}catch{return}}},mv=null,wt={N(){if(!ar(mv))return mv;var t=!0;if(be(te))t=!1;else try{var e="__mplssupport__";wt.q(e,"xyz"),wt.A(e)!=='"xyz"'&&(t=!1),wt.P(e)}catch{t=!1}return t||_e.error("localStorage unsupported; falling back to cookie store"),mv=t,t},D(t){_e.error("localStorage error: "+t)},A(t){try{return te==null?void 0:te.localStorage.getItem(t)}catch(e){wt.D(e)}return null},F(t){try{return JSON.parse(wt.A(t))||{}}catch{}return null},q(t,e){try{return te==null||te.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){wt.D(n)}return!1},P(t){try{te==null||te.localStorage.removeItem(t)}catch(e){wt.D(e)}}},MO=[Zp,"distinct_id",Jl,n2,Xp,Yp,Es],Mh={},LO={N:()=>!0,D(t){_e.error("memoryStorage error: "+t)},A:t=>Mh[t]||null,F:t=>Mh[t]||null,q:(t,e)=>(Mh[t]=e,!0),P(t){delete Mh[t]}},ba=null,jn={N(){if(!ar(ba))return ba;if(ba=!0,be(te))ba=!1;else try{var t="__support__";jn.q(t,"xyz"),jn.A(t)!=='"xyz"'&&(ba=!1),jn.P(t)}catch{ba=!1}return ba},D(t){_e.error("sessionStorage error: ",t)},A(t){try{return te==null?void 0:te.sessionStorage.getItem(t)}catch(e){jn.D(e)}return null},F(t){try{return JSON.parse(jn.A(t))||null}catch{}return null},q(t,e){try{return te==null||te.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){jn.D(n)}return!1},P(t){try{te==null||te.sessionStorage.removeItem(t)}catch(e){jn.D(e)}}};class OO{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.Ft()?0:this.At}isOptedOut(){return this.Se.cookieless_mode===zi||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===Da}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Dt.q(this.$t,e?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Dt.P(this.$t,this.Se.cross_subdomain_cookie)}get $t(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get At(){var e=this.Dt.A(this.$t);return ov(e)?1:Be(VL,e)?0:-1}get Dt(){var e=this.Se.opt_out_capturing_persistence_type,n=e==="localStorage"?wt:ti;if(!this.Nt||this.Nt!==n){this.Nt=n;var r=e==="localStorage"?ti:wt;r.A(this.$t)&&(this.Nt.A(this.$t)||this.optInOut(ov(r.A(this.$t))),r.P(this.$t,this.Se.cross_subdomain_cookie))}return this.Nt}Ft(){return!!this.Se.respect_dnt&&[sr==null?void 0:sr.doNotTrack,sr==null?void 0:sr.msDoNotTrack,$e.doNotTrack].some((e=>ov(e)))}}function o6(t,e){var n,r=t==null||(n=t.config)==null?void 0:n.get_current_url;if(!Ts(r))return e;try{var s=r(e);return _t(s)&&s?s:e}catch(i){return _e.error("Error in get_current_url, falling back to window.location.href",i),e}}var NO=1,DO=3,jO=11;function KS(t){return t instanceof Element&&(t.id===e6||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Go(t){return!!t&&t.nodeType===NO}function Vr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function a6(t){return!!t&&t.nodeType===DO}function l6(t){return!!t&&t.nodeType===jO&&Go(t.host)}function i2(t){return t?Hm(t).split(/\s+/):[]}function ZS(t,e){var n=(function(r){var s,i=te==null||(s=te.location)==null?void 0:s.href;return be(i)?void 0:o6(r,i)})(e);return!!(n&&t&&t.some((r=>n.match(r))))}function tm(t){var 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 i2(e)}function u6(t){return Ye(t)?null:Hm(t).split(/(\s+)/).filter((e=>fd(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Id(t){var e="";return yy(t)&&!h6(t)&&t.childNodes&&t.childNodes.length&&bt(t.childNodes,(function(n){var r;a6(n)&&n.textContent&&(e+=(r=u6(n.textContent))!==null&&r!==void 0?r:"")})),Hm(e)}function gv(t){return be(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var o2=["a","button","form","input","select","textarea","label"];function vy(t,e){if(be(e))return!0;var n,r=function(i){if(e.some((a=>(function(u,c){var f=u.matches||u.matchesSelector||u.msMatchesSelector||u.mozMatchesSelector||u.webkitMatchesSelector||u.oMatchesSelector;try{return!!f&&f.call(u,c)}catch{return!1}})(i,a))))return{v:!0}};for(var s of t)if(n=r(s))return n.v;return!1}function c6(t){var e=t.parentNode;return!(!e||!Go(e))&&e}var FO=[".ph-no-autocapture","[data-ph-no-autocapture]"],d6=["next","previous","prev",">","<"],VO=[...d6,"+","-","−","–"],qS=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,YS=[".ph-no-rageclick",".ph-no-capture"],$O=["","text","search","email","password","url","tel","number"];function XS(t,e){if(!te||a2(t))return!1;var n,r,s,i,a;if(ai(e)?(n=!!e&&YS,r=void 0,s=!1):(n=(i=e==null?void 0:e.css_selector_ignorelist)!==null&&i!==void 0?i:YS,r=e==null?void 0:e.content_ignorelist,s=(a=e==null?void 0:e.ignore_text_selection)!==null&&a!==void 0&&a),n===!1||s&&(function(c){return!(!c||!Go(c))&&(!!Vr(c,"textarea")||(Vr(c,"input")?Be($O,(c.getAttribute("type")||"").toLowerCase()):(function(f){if(f.isContentEditable)return!0;var h=f.getAttribute==null?void 0:f.getAttribute("contenteditable");return h==="true"||h===""})(c)))})(t))return!1;var{targetElementList:u}=f6(t,!1);return!(function(c,f){if(c===!1||be(c))return!1;var h;if(c===!0)h=d6;else{if(!tt(c))return!1;if(c.length>10)return _e.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;h=c.map((p=>p.toLowerCase()))}return f.some((p=>{var{safeText:v,ariaLabel:y}=p;return h.some((x=>qS(v,x)||qS(y,x)))}))})(r,u.map((c=>{var f;return{safeText:Id(c).toLowerCase(),ariaLabel:((f=c.getAttribute("aria-label"))==null?void 0:f.toLowerCase().trim())||""}})))&&!vy(u,n)}var a2=t=>!t||Vr(t,"html")||!Go(t),f6=(t,e)=>{if(!te||a2(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],s=t;s.parentNode&&!Vr(s,"body");)if(l6(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var i=c6(s);if(!i)break;if(e||o2.indexOf(i.tagName.toLowerCase())>-1)n=!0;else try{var a=te.getComputedStyle(i);a&&a.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(i),s=i}return{parentIsUsefulElement:n,targetElementList:r}};function yy(t){for(var e=t;e.parentNode&&!Vr(e,"body");e=e.parentNode){var n=tm(e);if(Be(n,"ph-sensitive")||Be(n,"ph-no-capture"))return!1}if(Be(tm(t),"ph-include"))return!0;var r=t.type||"";if(_t(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!_t(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function h6(t){return!!(Vr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Vr(t,"select")||Vr(t,"textarea")||t.getAttribute("contenteditable")==="true")}var p6="(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})",HO=new RegExp("^(?:"+p6+")$"),zO=new RegExp(p6),m6="\\d{3}-?\\d{2}-?\\d{4}",UO=new RegExp("^("+m6+")$"),BO=new RegExp("("+m6+")");function fd(t,e){return e===void 0&&(e=!0),!(Ye(t)||_t(t)&&(t=Hm(t),(e?HO:zO).test((t||"").replace(/[- ]/g,""))||(e?UO:BO).test(t)))}function QS(t){var e=Id(t);return fd(e=(e+" "+g6(t)).trim())?e:""}function g6(t){var e="";return t&&t.childNodes&&t.childNodes.length&&bt(t.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Id(n);e=(e+" "+s).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+g6(n)).trim())}catch(i){_e.error("[AutoCapture]",i)}})),e}function JS(t){return t.replace(/"|\\"/g,'\\"')}function WO(t){var e=t.attr__class;return e?tt(e)?e:i2(e):void 0}var Lh=Dt("[Dead Clicks]"),GO=()=>!0,KO=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(e2)),r=t.instance.config.capture_dead_clicks;return ai(r)?r:!!Ot(r)||n};class eE{get lazyLoadedDeadClicksAutocapture(){return this.qt}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[e2]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Bt((()=>{this.jt()})):this.stop()}Bt(e){var n,r;(n=$e.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?e():(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Lh.error("failed to load script",s):e()}))}jt(){var e;if(Ee){if(!this.qt&&(e=$e.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=Ot(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.qt=$e.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.qt.start(Ee),Lh.info("starting...")}}else Lh.error("`document` not found. Cannot start.")}stop(){this.qt&&(this.qt.stop(),this.qt=void 0,Lh.info("stopping..."))}}var vv=Dt("[SegmentIntegration]"),v6="posthog-js";function y6(t,e){var{organization:n,projectId:r,prefix:s,severityAllowList:i=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return u=>{var c,f,h,p,v;if(i!=="*"&&!i.includes(u.level)||!t.__loaded)return u;u.tags||(u.tags={});var y=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());u.tags["PostHog Person URL"]=y,t.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var x,_=((c=u.exception)==null?void 0:c.values)||[],b=_.map((C=>pe({},C,{stacktrace:C.stacktrace?pe({},C.stacktrace,{type:"raw",frames:(C.stacktrace.frames||[]).map((P=>pe({},P,{platform:"web:javascript"})))}):void 0}))),E={$exception_message:((f=_[0])==null?void 0:f.value)||u.message,$exception_type:(h=_[0])==null?void 0:h.type,$exception_level:u.level,$exception_list:b,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((p=_[0])==null?void 0:p.value)||u.message,$sentry_exception_type:(v=_[0])==null?void 0:v.type,$sentry_tags:u.tags};return n&&r&&(E.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+u.event_id),a&&((x=t.exceptions)==null||x.sendExceptionEvent(E)),u}}class ZO{constructor(e,n,r,s,i,a){this.name=v6,this.setupOnce=function(u){u(y6(e,{organization:n,projectId:r,prefix:s,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}}class tE{constructor(e){this.Ht=(n,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:s}),this.Ut=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.zt()}zt(){var e;this.Vt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Ht)}destroy(){var e;(e=this.Vt)==null||e.call(this),this.Vt=void 0}doPageView(e,n){var r,s=this.Wt(e,n);return this.Ut={pathname:(r=te==null?void 0:te.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var n;return this.Wt(e,(n=this.Ut)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ut)==null?void 0:e.pageViewId}}Wt(e,n){var r=this.Ut;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:u,maxScrollY:c,maxContentHeight:f,lastContentY:h,maxContentY:p}=i;if(!(be(a)||be(u)||be(c)||be(f)||be(h)||be(p))){a=Math.ceil(a),u=Math.ceil(u),c=Math.ceil(c),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p);var v=a>1?si(u/a,0,1,_e):1,y=a>1?si(c/a,0,1,_e):1,x=f>1?si(h/f,0,1,_e):1,_=f>1?si(p/f,0,1,_e):1;s=At(s,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:x,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var Oh=["flags","surveys"],qO={[Z8]:{exposure:"hidden"},[nd]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[rd]:{exposure:"hidden"},[J1]:{exposure:"event"},[ey]:{exposure:"hidden"},[ty]:{exposure:"event"},[ny]:{exposure:"hidden"},[ry]:{exposure:"event"},[sy]:{exposure:"event"},[e2]:{exposure:"event"},[t2]:{exposure:"hidden"},[iy]:{exposure:"event"},[za]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Jl]:{exposure:"hidden"},[n2]:{exposure:"event"},[q8]:{exposure:"event",shouldSkipFromEventProperties:t=>ar(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Va]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Ot(t))return{};for(var e={},n=Object.keys(t),r=0;n.length>r;r++)e["$feature/"+n[r]]=t[n[r]];return e}},[lp]:{exposure:"event",storageGroup:"flags"},[sd]:{exposure:"hidden"},[oy]:{exposure:"hidden",storageGroup:"flags"},[up]:{exposure:"event",storageGroup:"flags"},[ay]:{exposure:"event",storageGroup:"flags",volatile:!0},[Oi]:{exposure:"event"},[ql]:{exposure:"hidden"},[Oa]:{exposure:"hidden"},[Na]:{exposure:"hidden"},[ly]:{exposure:"hidden",storageGroup:"surveys"},[qp]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[uy]:{exposure:"event"},[id]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[dd]:{exposure:"hidden"},[cy]:{exposure:"hidden"},[dy]:{exposure:"hidden"},[Rd]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Es]:{exposure:"hidden"},[fy]:{exposure:"hidden"},[hy]:{exposure:"hidden"},[py]:{exposure:"hidden"},[my]:{exposure:"hidden"},[Yp]:{exposure:"hidden"},[Xp]:{exposure:"hidden"},[Y8]:{exposure:"event"},[X8]:{exposure:"event"},[Q8]:{exposure:"event"},[J8]:{exposure:"event"},[t6]:{exposure:"event"},[n6]:{exposure:"event"},[r6]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},YO=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Sa=t=>{var e=qO[t];if(e)return e;for(var[n,r]of YO)if(t.indexOf(n)===0)return r},Md=t=>{var e=Ee==null?void 0:Ee.createElement("a");return be(e)?null:(e.href=t,e)},Iu=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var i=r[s].split("=");if(i[0]===e){n=i;break}}if(!tt(n)||2>n.length)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{_e.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ld=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],i=(r[0]||"").split("?"),a=i[1],u=i[0],c=(a||"").split("&"),f=[],h=0;c.length>h;h++){var p=c[h].split("=");tt(p)&&(e.includes(p[0])?f.push(p[0]+"="+n):f.push(c[h]))}var v=u;return a!=null&&(v+="?"+f.join("&")),s!=null&&(v+="#"+s),v},nm=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},_6=(t,e)=>t>=e&&m8(),x6=(t,e,n,r)=>{if(t===0){if(m8()){var s=e+1;return s===n&&r(),s}return e}return 0},Nh="https?://(.*)",Mu=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],XO=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Mu],Od="<masked>",QO=["li_fat_id"];function w6(t,e,n){if(!Ee)return{};var r,s=e?[...Mu,...n||[]]:[],i=b6(Ld(Ee.URL,s,Od),t),a=(r={},bt(QO,(function(u){var c=ti.A(u);r[u]=c||null})),r);return At(a,i)}function b6(t,e){var n=XO.concat(e||[]),r={};return bt(n,(function(s){var i=Iu(t,s);r[s]=i||null})),r}function S6(t){var e=(function(i){return i?i.search(Nh+"google.([^/?]*)")===0?"google":i.search(Nh+"bing.com")===0?"bing":i.search(Nh+"yahoo.com")===0?"yahoo":i.search(Nh+"duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",r={};if(!ar(e)){r.$search_engine=e;var s=Ee?Iu(Ee.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function nE(){return navigator.language||navigator.userLanguage}var rm="$direct";function E6(){return(Ee==null?void 0:Ee.referrer)||rm}function k6(t,e,n){n===void 0&&(n=!1);var r=t?[...Mu,...e||[]]:[],s=n?Wo(on==null?void 0:on.href):on==null?void 0:on.href,i=s==null?void 0:s.substring(0,1e3);return{r:E6().substring(0,1e3),u:i?Ld(i,r,Od):void 0}}function C6(t,e){var n;e===void 0&&(e=!1);var{r,u:s}=t,i=e?Wo(s):s,a={$referrer:r,$referring_domain:r==null?void 0:r==rm?rm:(n=Md(r))==null?void 0:n.host};if(i){a.$current_url=i;var u=Md(i);a.$host=u==null?void 0:u.host,a.$pathname=u==null?void 0:u.pathname;var c=b6(i);At(a,c)}if(r){var f=S6(r);At(a,f)}return a}function P6(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function JO(){try{return new Date().getTimezoneOffset()}catch{return}}var eN={flags:Rd,surveys:qp},tN=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Hl="main";class yv{constructor(e,n,r){if(r===void 0&&(r=!0),this.Gt={},this.Zt=!1,this.Qt=!1,this.Se=e,this.Jt=r,this.props={},this.Kt=!1,this.Yt=(i=>{var a="";return i.token&&(a=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+a+"_posthog"})(e),this.Dt=this.Xt(e),this.Qt=this.er(e),this.load(),e.debug&&_e.info("Persistence loaded",e.persistence,pe({},this.props)),this.update_config(e,e,n),this.save(),te){var s=()=>this.flush();$t(te,"beforeunload",s,{capture:!1}),$t(te,"pagehide",s,{capture:!1})}}tr(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return $n(n)&&n>0?n:0}isDisabled(){return!!this.rr}Xt(e){tN.indexOf(e.persistence.toLowerCase())===-1&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n,r=(function(a,u){a===void 0&&(a=[]),u===void 0&&(u=!1);var c=[...MO,...a];return pe({},wt,{F(f){try{var h={};try{h=ti.F(f)||{}}catch{}var p,v=JSON.parse(wt.A(f)||"{}");if(u){var y={};for(var x in h){var _=h[x];ar(_)||_===""||(y[x]=_)}p=At(v,y)}else p=At(h,v);return wt.q(f,p),p}catch{}return null},q(f,h,p,v,y,x){var _=wt.q(f,h,void 0,void 0,x);try{var b={};c.forEach((E=>{h[E]&&(b[E]=h[E])})),Object.keys(b).length&&ti.q(f,b,p,v,y,x)}catch(E){wt.D(E)}return _},P(f,h){try{te==null||te.localStorage.removeItem(f),ti.P(f,h)}catch(p){wt.D(p)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,i=e.persistence.toLowerCase();return i==="localstorage"&&wt.N()?(n=wt,s=!0):i==="localstorage+cookie"&&r.N()?(n=r,s=!0):i==="sessionstorage"&&jn.N()?n=jn:i==="memory"?n=LO:i==="cookie"?n=ti:r.N()?(n=r,s=!0):n=ti,this.Zt=s,n}ir(e){return this.Yt+"__"+e}er(e){return this.Zt&&!!e.split_storage}nr(e){var n=e??this.Se.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[Rd];return!r||typeof r!="number"||Date.now()-r>n}properties(){var e={};return bt(this.props,((n,r)=>{var s=Sa(r);if((s==null?void 0:s.exposure)==="derived"){if(s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(n,r===Va?()=>this.nr():()=>!1))return;s.transformToEventProperties&&At(e,s.transformToEventProperties(n))}else if(!s||s.exposure==="event"){if(s!=null&&s.shouldSkipFromEventProperties!=null&&s.shouldSkipFromEventProperties(n,(()=>!1)))return;e[r]=n}})),e}load(){if(!this.rr){var e=this.Dt.F(this.Yt);e&&(this.props=At({},e)),this.Qt&&this.sr()}}sr(){for(var e of Oh){var n=wt.F(this.ir(e));if(n&&!Do(n)){var r=this.ar(e);r.persisted=!0,this.lr(e)||(r.fingerprint=this.ur(n,e)),this.hr(e,n)||At(this.props,n)}}}lr(e){return Object.keys(this.props).some((n=>{var r;return((r=Sa(n))==null?void 0:r.storageGroup)===e}))}hr(e,n){var r=eN[e];if(!r)return!1;var s=n[r],i=this.props[r];return $n(s)&&$n(i)&&i>s}refreshKey(e){var n;if(!this.rr){var r=this.Qt?(n=Sa(e))==null?void 0:n.storageGroup:void 0,s=r?wt.F(this.ir(r)):this.Dt.F(this.Yt);if(s&&e in s)this.dr(e,s[e]);else{if(r){var i=this.Dt.F(this.Yt);if(i&&e in i)return void this.dr(e,i[e])}this.cr(e)}}}save(){if(!this.rr){var e=this.tr();e>0?be(this.vr)&&(this.vr=setTimeout((()=>{this.vr=void 0,this.pr()}),e)):this.pr()}}flush(){be(this.vr)||(clearTimeout(this.vr),this.vr=void 0,this.pr())}pr(){this.rr||(this.Qt?this.gr():this.mr(this.Dt,this.Yt,this.props,Hl))}gr(){var{main:e,groups:n}=this.yr();for(var r of(this.mr(this.Dt,this.Yt,e,Hl),Oh)){var s,i=n[r];(!Do(i)||(s=this.Gt[r])!=null&&s.persisted)&&this.mr(wt,this.ir(r),i,r)}}yr(){var e={},n={};for(var r of Oh)n[r]={};return bt(this.props,((s,i)=>{var a,u=(a=Sa(i))==null?void 0:a.storageGroup;u?n[u][i]=s:e[i]=s})),{main:e,groups:n}}ur(e,n){if(n===Hl)return JSON.stringify(e)+"|"+this.br+"|"+this._r+"|"+this.wr;var r={};return bt(e,((s,i)=>{var a;r[i]=(a=Sa(i))!=null&&a.volatile?"__volatile__":s})),JSON.stringify(r)}mr(e,n,r,s){var i=this.ar(s);if(s===Hl||i.dirty||be(i.fingerprint)){var a;try{if((a=this.ur(r,s))===i.fingerprint)return void(i.dirty=!1)}catch{a=void 0}e.q(n,r,this.br,this._r,this.wr,this.Se.debug)?(i.dirty=!1,s!==Hl&&(i.persisted=!0),be(a)||(i.fingerprint=a)):this.Se.debug&&_e.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(e){var{keepGroupEntries:n=!1}=e===void 0?{}:e;if(be(this.vr)||(clearTimeout(this.vr),this.vr=void 0),this.Dt.P(this.Yt,!1),this.Dt.P(this.Yt,!0),!n&&this.Jt)for(var r of Oh)wt.P(this.ir(r));n?delete this.Gt[Hl]:this.Gt={}}clear(){this.remove(),this.props={}}register_once(e,n,r){if(Ot(e)){be(n)&&(n="None"),this.br=be(r)?this.kr:r;var s=!1;if(bt(e,((i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.dr(a,i),s=!0)})),s)return this.save(),!0}return!1}register(e,n){if(Ot(e)){this.br=be(n)?this.kr:n;var r=!1;if(bt(e,((s,i)=>{e.hasOwnProperty(i)&&this.props[i]!==s&&(this.dr(i,s),r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.cr(e),this.save())}update_campaign_params(){if(!this.Kt){var e=w6(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);Do(s2(e))||this.register(e),this.Kt=!0}}update_search_keyword(){var e;this.register((e=Ee==null?void 0:Ee.referrer)?S6(e):{})}update_referrer_info(){var e;this.register_once({$referrer:E6(),$referring_domain:Ee!=null&&Ee.referrer&&((e=Md(Ee.referrer))==null?void 0:e.host)||rm},void 0)}set_initial_person_info(){this.props[py]||this.props[my]||this.register_once({[Yp]:k6(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};bt([my,py],(s=>{var i=this.props[s];i&&bt(i,(function(a,u){e["$initial_"+G1(u)]=a}))}));var n=this.props[Yp];if(n){var r=(function(s,i){i===void 0&&(i=!1);var a=C6(s,i),u={};return bt(a,(function(c,f){u["$initial_"+G1(f)]=c})),u})(n,this.Se.disable_capture_url_hashes);At(e,r)}return e}safe_merge(e){return bt(this.props,(function(n,r){r in e||(e[r]=n)})),e}update_config(e,n,r){this.kr=this.br=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==n.persistence||!((c,f)=>{if(c.length!==f.length)return!1;var h=[...c].sort(),p=[...f].sort();return h.every(((v,y)=>v===p[y]))})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),i=s?this.Xt(e):this.Dt,a=this.er(e);if(s||a!==this.Qt){var u=this.props;this.clear(),this.Dt=i,this.Qt=a,this.props=u,this.save()}}set_disabled(e){this.rr=e,this.rr?this.remove():this.save()}set_cross_subdomain(e){e!==this._r&&(this._r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.wr&&(this.wr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){var r=this.props[rd]||{};r[e]=n,this.dr(rd,r),this.save()}remove_event_timer(e){var n=this.props[rd]||{},r=n[e];return be(r)||(delete n[e],this.dr(rd,n),this.save()),r}get_property(e){return this.props[e]}set_property(e,n){this.dr(e,n),this.save()}dr(e,n){var r;this.props[e]=n,(r=Sa(e))!=null&&r.volatile||this.Sr(e)}cr(e){delete this.props[e],this.Sr(e)}Sr(e){var n,r=(n=Sa(e))==null?void 0:n.storageGroup;r&&(this.ar(r).dirty=!0)}ar(e){return this.Gt[e]||(this.Gt[e]={})}}var Vc={Activation:"events",Cancellation:"cancelEvents"},_v={Popover:"popover",API:"api",Widget:"widget"},nN={Always:"always"},Ui={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},xv={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},_y={Popover:"popover",Inline:"inline"},rN={SHOWN:"product tour shown"},rE={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},sE=Dt("[RateLimiter]");class sN{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((s=>{sE.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void sE.warn('could not rate limit - continuing. Error: "'+(s==null?void 0:s.message)+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,u=new Date().getTime(),c=(n=(r=this.instance.persistence)==null?void 0:r.get_property(hy))!==null&&n!==void 0?n:{tokens:i,last:u};c.tokens+=(u-c.last)/1e3*a,c.last=u,c.tokens>i&&(c.tokens=i);var f=1>c.tokens;return f||e||(c.tokens=Math.max(0,c.tokens-1)),!f||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=f,(s=this.instance.persistence)==null||s.set_property(hy,c),{isRateLimited:f,remainingTokens:c.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var $c=Dt("[RemoteConfig]");class T6{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$e._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Cr(e){var n,r;(n=$e.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ir(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return $c.info("Using preloaded remote config",this.remoteConfig),this.Tr(this.remoteConfig),void this.Mr();if(this._instance.Er())return void $c.warn("Remote config is disabled. Falling back to local config.");this.Cr((e=>{if(!e)return $c.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ir((n=>{this.Tr(n),this.Mr()}));this.Tr(e),this.Mr()}))}catch(e){$c.error("Error loading remote config",e)}}stop(){this.Pr&&(clearInterval(this.Pr),this.Pr=void 0)}refresh(){!this._instance.Er()&&Ee&&Ee.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Mr(){var e;if(!this.Pr){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.Pr=setInterval((()=>{this.refresh()}),n))}}Tr(e){var n;e||$c.error("Failed to fetch remote config from PostHog."),this._instance.Tr(e??{}),(e==null?void 0:e.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var os={GZipJS:"gzip-js",Base64:"base64"},ds=Uint8Array,wr=Uint16Array,Lu=Uint32Array,l2=new ds([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]),u2=new ds([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]),iE=new ds([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),A6=function(t,e){for(var n=new wr(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var s=new Lu(n[30]);for(r=1;30>r;++r)for(var i=n[r];n[r+1]>i;++i)s[i]=i-n[r]<<5|r;return[n,s]},R6=A6(l2,2),xy=R6[1];R6[0][28]=258,xy[258]=28;for(var oE=A6(u2,0)[1],I6=new wr(32768),Nt=0;32768>Nt;++Nt){var zl=(43690&Nt)>>>1|(21845&Nt)<<1;I6[Nt]=((65280&(zl=(61680&(zl=(52428&zl)>>>2|(13107&zl)<<2))>>>4|(3855&zl)<<4))>>>8|(255&zl)<<8)>>>1}var hd=function(t,e,n){for(var r=t.length,s=0,i=new wr(e);r>s;++s)++i[t[s]-1];var a,u=new wr(e);for(s=0;e>s;++s)u[s]=u[s-1]+i[s-1]<<1;for(a=new wr(r),s=0;r>s;++s)a[s]=I6[u[t[s]-1]++]>>>15-t[s];return a},cl=new ds(288);for(Nt=0;144>Nt;++Nt)cl[Nt]=8;for(Nt=144;256>Nt;++Nt)cl[Nt]=9;for(Nt=256;280>Nt;++Nt)cl[Nt]=7;for(Nt=280;288>Nt;++Nt)cl[Nt]=8;var sm=new ds(32);for(Nt=0;32>Nt;++Nt)sm[Nt]=5;var iN=hd(cl,9),oN=hd(sm,5),M6=function(t){return(t/8>>0)+(7&t&&1)},L6=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof wr?wr:t instanceof Lu?Lu:ds)(n-e);return r.set(t.subarray(e,n)),r},Ci=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},Hc=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},wv=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var s=n.length,i=n.slice();if(!s)return[new ds(0),0];if(s==1){var a=new ds(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort((function(A,O){return A.f-O.f})),n.push({s:-1,f:25001});var u=n[0],c=n[1],f=0,h=1,p=2;for(n[0]={s:-1,f:u.f+c.f,l:u,r:c};h!=s-1;)u=n[n[p].f>n[f].f?f++:p++],c=n[f!=h&&n[p].f>n[f].f?f++:p++],n[h++]={s:-1,f:u.f+c.f,l:u,r:c};var v=i[0].s;for(r=1;s>r;++r)i[r].s>v&&(v=i[r].s);var y=new wr(v+1),x=wy(n[h-1],y,0);if(x>e){r=0;var _=0,b=x-e,E=1<<b;for(i.sort((function(A,O){return y[O.s]-y[A.s]||A.f-O.f}));s>r;++r){var C=i[r].s;if(e>=y[C])break;_+=E-(1<<x-y[C]),y[C]=e}for(_>>>=b;_>0;){var P=i[r].s;e>y[P]?_-=1<<e-y[P]++-1:++r}for(;r>=0&&_;--r){var T=i[r].s;y[T]==e&&(--y[T],++_)}x=e}return[new ds(y),x]},wy=function(t,e,n){return t.s==-1?Math.max(wy(t.l,e,n+1),wy(t.r,e,n+1)):e[t.s]=n},aE=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new wr(++e),r=0,s=t[0],i=1,a=function(c){n[r++]=c},u=1;e>=u;++u)if(t[u]==s&&u!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(s),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(s);i=1,s=t[u]}return[n.subarray(0,r),e]},zc=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},by=function(t,e,n){var r=n.length,s=M6(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var i=0;r>i;++i)t[s+i+4]=n[i];return 8*(s+4+r)},lE=function(t,e,n,r,s,i,a,u,c,f,h){Ci(e,h++,n),++s[256];for(var p=wv(s,15),v=p[0],y=p[1],x=wv(i,15),_=x[0],b=x[1],E=aE(v),C=E[0],P=E[1],T=aE(_),A=T[0],O=T[1],M=new wr(19),R=0;C.length>R;++R)M[31&C[R]]++;for(R=0;A.length>R;++R)M[31&A[R]]++;for(var L=wv(M,7),N=L[0],j=L[1],V=19;V>4&&!N[iE[V-1]];--V);var G,Y,K,B,X=f+5<<3,$=zc(s,cl)+zc(i,sm)+a,ee=zc(s,v)+zc(i,_)+a+14+3*V+zc(M,N)+(2*M[16]+3*M[17]+7*M[18]);if($>=X&&ee>=X)return by(e,h,t.subarray(c,c+f));if(Ci(e,h,1+($>ee)),h+=2,$>ee){G=hd(v,y),Y=v,K=hd(_,b),B=_;var H=hd(N,j);for(Ci(e,h,P-257),Ci(e,h+5,O-1),Ci(e,h+10,V-4),h+=14,R=0;V>R;++R)Ci(e,h+3*R,N[iE[R]]);h+=3*V;for(var D=[C,A],q=0;2>q;++q){var re=D[q];for(R=0;re.length>R;++R)Ci(e,h,H[se=31&re[R]]),h+=N[se],se>15&&(Ci(e,h,re[R]>>>5&127),h+=re[R]>>>12)}}else G=iN,Y=cl,K=oN,B=sm;for(R=0;u>R;++R)if(r[R]>255){var se;Hc(e,h,G[257+(se=r[R]>>>18&31)]),h+=Y[se+257],se>7&&(Ci(e,h,r[R]>>>23&31),h+=l2[se]);var oe=31&r[R];Hc(e,h,K[oe]),h+=B[oe],oe>3&&(Hc(e,h,r[R]>>>5&8191),h+=u2[oe])}else Hc(e,h,G[r[R]]),h+=Y[r[R]];return Hc(e,h,G[256]),h+Y[256]},aN=new Lu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lN=(function(){for(var t=new Lu(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),bv=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function uN(t,e){e===void 0&&(e={});var n=(function(){var p=4294967295;return{p(v){for(var y=p,x=0;v.length>x;++x)y=lN[255&y^v[x]]^y>>>8;p=y},d(){return 4294967295^p}}})(),r=t.length;n.p(t);var s,i,a,u,c,f=(u=10+((s=e).filename&&s.filename.length+1||0),c=8,(function(p,v,y,x,_,b){var E=p.length,C=new ds(x+E+5*(1+Math.floor(E/7e3))+_),P=C.subarray(x,C.length-_),T=0;if(!v||8>E)for(var A=0;E>=A;A+=65535){var O=A+65535;E>O?T=by(P,T,p.subarray(A,O)):(P[A]=!0,T=by(P,T,p.subarray(A,E)))}else{for(var M=aN[v-1],R=M>>>13,L=8191&M,N=(1<<y)-1,j=new wr(32768),V=new wr(N+1),G=Math.ceil(y/3),Y=2*G,K=function(vt){return(p[vt]^p[vt+1]<<G^p[vt+2]<<Y)&N},B=new Lu(25e3),X=new wr(288),$=new wr(32),ee=0,H=0,D=(A=0,0),q=0,re=0;E>A;++A){var se=K(A),oe=32767&A,ue=V[se];if(j[oe]=ue,V[se]=oe,A>=q){var de=E-A;if((ee>7e3||D>24576)&&de>423){T=lE(p,P,0,B,X,$,H,D,re,A-re,T),D=ee=H=0,re=A;for(var ie=0;286>ie;++ie)X[ie]=0;for(ie=0;30>ie;++ie)$[ie]=0}var ae=2,me=0,Se=L,Re=oe-ue&32767;if(de>2&&se==K(A-Re))for(var Ke=Math.min(R,de)-1,it=Math.min(32767,A),Oe=Math.min(258,de);it>=Re&&--Se&&oe!=ue;){if(p[A+ae]==p[A+ae-Re]){for(var at=0;Oe>at&&p[A+at]==p[A+at-Re];++at);if(at>ae){if(ae=at,me=Re,at>Ke)break;var It=Math.min(Re,at-2),mt=0;for(ie=0;It>ie;++ie){var je=A-Re+ie+32768&32767,Qe=je-j[je]+32768&32767;Qe>mt&&(mt=Qe,ue=je)}}}Re+=(oe=ue)-(ue=j[oe])+32768&32767}if(me){B[D++]=268435456|xy[ae]<<18|oE[me];var lt=31&xy[ae],Je=31&oE[me];H+=l2[lt]+u2[Je],++X[257+lt],++$[Je],q=A+ae,++ee}else B[D++]=p[A],++X[p[A]]}}T=lE(p,P,!0,B,X,$,H,D,re,A-re,T)}return L6(C,0,x+M6(T)+_)})(i=t,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+a.mem,u,c)),h=f.length;return(function(p,v){var y=v.filename;if(p[0]=31,p[1]=139,p[2]=8,p[8]=2>v.level?4:v.level==9?2:0,p[9]=3,v.mtime!=0&&bv(p,4,Math.floor(new Date(v.mtime||Date.now())/1e3)),y){p[3]=8;for(var x=0;y.length>=x;++x)p[x+10]=y.charCodeAt(x)}})(f,e),bv(f,h-8,n.d()),bv(f,h-4,r),f}var cN=!!U1||!!z1,O6="text/plain",dp=!1,Sy=(t,e)=>{var[n,r]=t.split("#"),[s,i]=n.split("?");if(!i)return t;var a=i.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(a?"?"+a:"")+(r?"#"+r:"")},N6=function(t,e,n){var r;n===void 0&&(n=!0);var[s,i]=t.split("?"),a=pe({},e),u=(r=i==null?void 0:i.split("&").map((f=>{var h,[p,v]=f.split("="),y=n&&(h=a[p])!==null&&h!==void 0?h:v;return delete a[p],p+"="+y})))!==null&&r!==void 0?r:[],c=(function(f,h){var p,v;h===void 0&&(h="&");var y=[];return bt(f,(function(x,_){be(x)||be(_)||_==="undefined"||(p=encodeURIComponent((b=>b instanceof File)(x)?x.name:x.toString()),v=encodeURIComponent(_),y[y.length]=v+"="+p)})),y.join(h)})(a);return c&&u.push(c),s+"?"+u.join("&")},eu=(t,e)=>JSON.stringify(t,((n,r)=>typeof r=="bigint"?r.toString():r),e),uE=t=>{if(t.Lt)return t.Lt;var{data:e,compression:n}=t;if(e){if(n===os.GZipJS){var r=uN((function(u,c){var f=u.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(u);for(var h=new ds(u.length+(u.length>>>1)),p=0,v=function(b){h[p++]=b},y=0;f>y;++y){if(p+5>h.length){var x=new ds(p+8+(f-y<<1));x.set(h),h=x}var _=u.charCodeAt(y);128>_?v(_):2048>_?(v(192|_>>>6),v(128|63&_)):_>55295&&57344>_?(v(240|(_=65536+(1047552&_)|1023&u.charCodeAt(++y))>>>18),v(128|_>>>12&63),v(128|_>>>6&63),v(128|63&_)):(v(224|_>>>12),v(128|_>>>6&63),v(128|63&_))}return L6(h,0,p)})(eu(e)),{mtime:0});return{contentType:O6,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===os.Base64){var s=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,((c,f)=>String.fromCharCode(parseInt(f,16)))))})(eu(e)),i=(u=>"data="+encodeURIComponent(typeof u=="string"?u:eu(u)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var a=eu(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},D6=t=>{var e,n,r=()=>({url:Sy(t.url,"compression"),encodedBody:uE(pe({},t,{compression:void 0,Lt:void 0}))});try{e=uE(t)}catch(s){if(LS(t.compression,Iu(t.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",s),r();throw s}return e&&LS(t.compression,Iu(t.url,"compression"))&&!((n=e.body)instanceof ArrayBuffer?B1(new Uint8Array(n)):ArrayBuffer.isView(n)&&B1(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(dp=!0,r()):{url:t.url,encodedBody:e}},cE=t=>{try{return D6(t)}catch(e){return _e.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},dN=(function(){var t=en((function*(e){var n=eu(e.data),r=yield(function(i,a,u){return W1.apply(this,arguments)})(n,Vt.DEBUG,{rethrow:!0});if(!r)return e;var s=yield r.arrayBuffer();return pe({},e,{Lt:{contentType:O6,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),fN=["/e/","/s/"],dE=(t,e)=>{var n=(s=>{var i=(a=>{var u=Md(a),c=(u==null?void 0:u.pathname)||a.split(/[?#]/)[0];return c?c[0]==="/"?c:"/"+c:"/"})(s);return fN.some((a=>((u,c)=>u.slice(u.length-c.length)===c)(i,a)))})(t),r=n?Sy(t,"ver"):t;return N6(e===os.GZipJS?Sy(r,"compression"):r,pe({_:new Date().getTime().toString()},n?{}:{ver:Vt.JS_SDK_VERSION},e===os.GZipJS?{}:{compression:e}))},fp=[];z1&&fp.push({transport:"fetch",method(t){var e,n=cE(t);if(n){var{url:r,encodedBody:s}=n,{contentType:i,body:a,estimatedSize:u}=s??{},c=new Headers;bt(t.headers,(function(v,y){c.append(y,v)})),i&&c.append("Content-Type",i);var f=null,h=!1;if(CS){var p=new CS;f={signal:p.signal,timeout:setTimeout((()=>{var v,y;h=!0,p.abort((v=t.timeout,(y=new Error("PostHog request timed out"+(v?" after "+v+"ms":""))).name="AbortError",y))}),t.timeout)}}z1(r,pe({method:(t==null?void 0:t.method)||"GET",headers:c,keepalive:t.method==="POST"&&52428.8>(u||0),body:a,signal:(e=f)==null?void 0:e.signal},t.fetchOptions)).then((v=>v.text().then((y=>{var x={statusCode:v.status,text:y};if(v.status===200)try{x.json=JSON.parse(y)}catch(_){_e.error(_)}t.callback==null||t.callback(x)})))).catch((v=>{h&&(v==null?void 0:v.name)==="AbortError"?_e.warn(v):_e.error(v),t.callback==null||t.callback({statusCode:0,error:v})})).finally((()=>f?clearTimeout(f.timeout):null))}}}),U1&&fp.push({transport:"XHR",method(t){var e=cE(t);if(e){var n=new U1,{url:r,encodedBody:s}=e;n.open(t.method||"GET",r,!0);var{contentType:i,body:a}=s??{};bt(t.headers,(function(u,c){n.setRequestHeader(c,u)})),i&&n.setRequestHeader("Content-Type",i),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var u={statusCode:n.status,text:n.responseText};if(n.status===200)try{u.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(u)}},n.send(a)}}}),sr!=null&&sr.sendBeacon&&fp.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:n}=D6(t),{contentType:r,body:s}=n??{};if(!s)return;var i=s instanceof Blob?s:new Blob([s],{type:r});sr.sendBeacon(e,i)}catch{}}});var Ey=3e3;class hN{constructor(e,n){this.Rr=!0,this.Or=[],this.Lr=si((n==null?void 0:n.flush_interval_ms)||Ey,250,5e3,_e.createLogger("flush interval"),Ey),this.Fr=e}enqueue(e){this.Or.push(e),this.Ar||this.Dr()}unload(){this.$r();var e=this.Or.length>0?this.Nr():{},n=Object.values(e);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.qr(pe({},r,{transport:"sendBeacon"}))}))}enable(){this.Rr=!1,this.Dr()}Dr(){var e=this;this.Rr||(this.Ar=setTimeout((()=>{if(this.$r(),this.Or.length>0){var n=this.Nr(),r=function(){var i=n[s],a=new Date().getTime();i.data&&tt(i.data)&&bt(i.data,(u=>{u.offset=Math.abs(u.timestamp-a),delete u.timestamp})),e.qr(i)};for(var s in n)r()}}),this.Lr))}qr(e){try{this.Fr(e)}catch(n){_e.error(n)}}$r(){clearTimeout(this.Ar),this.Ar=void 0}Nr(){var e={};return bt(this.Or,(n=>{var r,s=n,i=(s?s.batchKey:null)||s.url;be(e[i])&&(e[i]=pe({},s,{data:[]})),(r=e[i].data)==null||r.push(s.data)})),this.Or=[],e}}var pN=["retriesPerformedSoFar"];class mN{constructor(e){this.Br=!1,this.jr=3e3,this.Or=[],this._instance=e,this.Or=[],this.Hr=!0,!be(te)&&"onLine"in te.navigator&&(this.Hr=te.navigator.onLine,this.Ur=()=>{this.Hr=!0,this.zr()},this.Vr=()=>{this.Hr=!1},$t(te,"online",this.Ur),$t(te,"offline",this.Vr))}get length(){return this.Or.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=g8(e,pN);Li(n)&&(r.url=N6(r.url,{retry_count:n})),this._instance._send_request(pe({},r,{callback:s=>{if(s.statusCode!==200&&(400>s.statusCode||s.statusCode>=500)){if((s.statusCode===0?3:10)>(n??0))return void this.st(pe({retriesPerformedSoFar:n},r));s.statusCode===0&&_e.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(s)}}))}st(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=(function(a){var u=3e3*Math.pow(2,a),c=u/2,f=Math.min(18e5,u),h=Math.random()-.5;return Math.ceil(f+h*(f-c))})(n),s=Date.now()+r;this.Or.push({retryAt:s,requestOptions:e});var i="Enqueued failed request for retry in "+r;navigator.onLine||(i+=" (Browser is offline)"),_e.warn(i),this.Br||(this.Br=!0,this.Wr())}Wr(){if(this.Gr&&clearTimeout(this.Gr),this.Or.length===0)return this.Br=!1,void(this.Gr=void 0);this.Gr=setTimeout((()=>{this.Hr&&this.Or.length>0&&this.zr(),this.Wr()}),this.jr)}zr(){var e=Date.now(),n=[],r=this.Or.filter((i=>e>i.retryAt||(n.push(i),!1)));if(this.Or=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Gr&&(clearTimeout(this.Gr),this.Gr=void 0),this.Br=!1,be(te)||(this.Ur&&(te.removeEventListener("online",this.Ur),this.Ur=void 0),this.Vr&&(te.removeEventListener("offline",this.Vr),this.Vr=void 0)),this.Or))try{this._instance._send_request(pe({},e,{transport:"sendBeacon"}))}catch(n){_e.error(n)}this.Or=[]}}class gN{constructor(e){this.Zr=()=>{var n,r,s,i;this.Qr||(this.Qr={});var a=this.scrollElement(),u=this.scrollY(),c=a?Math.max(0,a.scrollHeight-a.clientHeight):0,f=u+((a==null?void 0:a.clientHeight)||0),h=(a==null?void 0:a.scrollHeight)||0;this.Qr.lastScrollY=Math.ceil(u),this.Qr.maxScrollY=Math.max(u,(n=this.Qr.maxScrollY)!==null&&n!==void 0?n:0),this.Qr.maxScrollHeight=Math.max(c,(r=this.Qr.maxScrollHeight)!==null&&r!==void 0?r:0),this.Qr.lastContentY=f,this.Qr.maxContentY=Math.max(f,(s=this.Qr.maxContentY)!==null&&s!==void 0?s:0),this.Qr.maxContentHeight=Math.max(h,(i=this.Qr.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=e}get Jr(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var e=this.Qr;return setTimeout(this.Zr,0),e}startMeasuringScrollPosition(){$t(te,"scroll",this.Zr,{capture:!0}),$t(te,"scrollend",this.Zr,{capture:!0}),$t(te,"resize",this.Zr)}scrollElement(){if(!this.Jr)return te==null?void 0:te.document.documentElement;var e=tt(this.Jr)?this.Jr:[this.Jr];for(var n of e){var r=te==null?void 0:te.document.querySelector(n);if(r)return r}}Kr(e){var n=e==="y"?"scrollTop":"scrollLeft";if(this.Jr){var r=this.scrollElement();return r&&r[n]||0}return te?e==="y"?te.scrollY||te.pageYOffset||te.document.documentElement.scrollTop||0:te.scrollX||te.pageXOffset||te.document.documentElement.scrollLeft||0:0}scrollY(){return this.Kr("y")}scrollX(){return this.Kr("x")}}var vN=t=>k6(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties,t==null?void 0:t.config.disable_capture_url_hashes);class fE{constructor(e,n,r,s){this.Yr=i=>{var a=this.Xr();if(!a||a.sessionId!==i){var u={sessionId:i,props:this.ei(this._instance)};this.ti.register({[fy]:u})}},this._instance=e,this.ri=n,this.ti=r,this.ei=s||vN,this.ri.onSessionId(this.Yr)}Xr(){return this.ti.props[fy]}getSetOnceProps(){var e,n=(e=this.Xr())==null?void 0:e.props;return n?"r"in n?C6(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(){var e={};return bt(s2(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+G1(r)]=n})),e}}class c2{constructor(){this.ii={}}on(e,n){return this.ii[e]||(this.ii[e]=[]),this.ii[e].push(n),()=>{this.ii[e]=this.ii[e].filter((r=>r!==n))}}emit(e,n){for(var r of this.ii[e]||[])r(n);for(var s of this.ii["*"]||[])s(e,n)}}var Uc=Dt("[SessionId]");class hE{on(e,n){return this.ni.on(e,n)}constructor(e,n,r){var s;if(this.si=null,this.oi=[],this.ai=void 0,this.li=!1,this.ni=new c2,this.ui=(f,h)=>!(!Li(f)||!Li(h))&&Math.abs(f-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===zi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.ti=e.persistence,this.hi=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ci=n||Fi,this.vi=r||Fi;var i=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*si(this.Se.session_idle_timeout_seconds||1800,60,36e3,Uc.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+i+"_window_id",this.gi="ph_"+i+"_primary_window_exists",this.mi()){var a=jn.F(this.pi),u=jn.F(this.gi);a&&!u?this.hi=a:jn.P(this.pi),jn.q(this.gi,!0)}if((s=this.Se.bootstrap)!=null&&s.sessionID)try{var c=(f=>{var h=this.Se.bootstrap.sessionID.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})();this.yi(this.Se.bootstrap.sessionID,new Date().getTime(),c)}catch(f){Uc.error("Invalid sessionID in bootstrap",f)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return be(this.oi)&&(this.oi=[]),this.oi.push(e),this.di&&e(this.di,this.hi),()=>{this.oi=this.oi.filter((n=>n!==e))}}mi(){return this.Se.persistence!=="memory"&&!this.ti.rr&&jn.N()}wi(e){e!==this.hi&&(this.hi=e,this.mi()&&jn.q(this.pi,e))}xi(){return this.hi?this.hi:this.mi()?jn.F(this.pi):null}ki(e){var n=this.si;return!ar(n)&&!ar(e)&&5e3>Math.abs(e-n)}yi(e,n,r){var s=n!==this._sessionActivityTimestamp,i=!(e!==this.di||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.di=e,i&&!s||i&&this.ki(n)||(this.si=n,this.ti.register({[Jl]:[n,e,r]}))}Si(){var e,n=(e=this.Se)==null?void 0:e.persistence_save_debounce_ms;return Li(n)&&n>0}Ci(){this.Si()?this.ti.refreshKey(Jl):(this.ti.flush(),this.ti.load())}Ii(){var e;if(!ar(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.si){this.Ci();var[,n,r]=this.Ti();n===this.di&&r===this._sessionStartTimestamp&&(this.si=this._sessionActivityTimestamp,this.ti.register({[Jl]:[this._sessionActivityTimestamp,(e=this.di)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.ti.flush())}}Mi(){var[e]=this.Ti(),n=Li(e)?e:0,r=Li(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}Ei(e){return this.Ci(),this.ui(e,this.Mi())}Ti(){var e=this.ti.props[Jl];return tt(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.si=null,clearTimeout(this.Pi),this.Pi=void 0,this.yi(null,null,null)}destroy(){this.li=!0,this.Ii(),clearTimeout(this.Pi),this.Pi=void 0,this.ai&&te&&(te.removeEventListener(Jp,this.ai,{capture:!1}),this.ai=void 0),this.oi=[]}bi(){this.ai=()=>{this.Ii(),this.mi()&&jn.P(this.gi)},$t(te,Jp,this.ai,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.Se.cookieless_mode===zi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[,s,i]=this.Ti(),a=this.Mi(),u=this.xi(),c=Li(i)&&Math.abs(r-i)>864e5,f=!1,h=!1,p=!s,v=s,y=!p&&!e&&this.ui(r,a);y&&((y=this.Ei(r))||Uc.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,i]=this.Ti()),p||y||c?(s=this.ci(),u=this.vi(),Uc.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:p,activityTimeout:y,sessionPastMaximumLength:c}}),i=r,f=!0):(u||(u=this.vi(),f=!0),(h=s!==v)&&(Uc.info("adopted cross-tab session id",{sessionId:s,windowId:u}),f=!0));var x=Li(a)&&e&&!c?a:r,_=Li(i)?i:new Date().getTime();this.wi(u),this.yi(s,x,_),e||this.fi();var b={noSessionId:p,activityTimeout:y,sessionPastMaximumLength:c,crossTabAdoption:h};return f&&this.oi.forEach((E=>E(s,u,b))),{sessionId:s,windowId:u,sessionStartTimestamp:_,changeReason:f?b:void 0,lastActivityTimestamp:a}}fi(){this.li||(clearTimeout(this.Pi),this.Pi=setTimeout((()=>{if(!this.li)if(this.Ei(new Date().getTime())){var e=this.di;this.resetSessionId(),this.ni.emit("forcedIdleReset",{idleSessionId:e})}else this.fi()}),1.1*this.sessionTimeoutMs))}}var j6=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&NS(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>NS(s==null?void 0:s.brand,e))))return!0}catch{}return!!t.webdriver};function F6(){return(F6=en((function*(){var t=sr==null?void 0:sr.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),n=e==null?void 0:e.model;return _t(n)&&n.length>0?n:void 0}catch(r){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var im=function(t,e){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function pE(t,e,n){return eu({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var V6={exact:(t,e)=>e.some((n=>t.some((r=>n===r)))),is_not:(t,e)=>e.every((n=>t.every((r=>n!==r)))),regex:(t,e)=>e.some((n=>t.some((r=>im(n,r))))),not_regex:(t,e)=>e.every((n=>t.every((r=>!im(n,r))))),icontains:(t,e)=>e.map(Dh).some((n=>t.map(Dh).some((r=>n.includes(r))))),not_icontains:(t,e)=>e.map(Dh).every((n=>t.map(Dh).every((r=>!n.includes(r))))),gt:(t,e)=>e.some((n=>{var r=parseFloat(n);return!isNaN(r)&&t.some((s=>r>parseFloat(s)))})),lt:(t,e)=>e.some((n=>{var r=parseFloat(n);return!isNaN(r)&&t.some((s=>r<parseFloat(s)))}))},Dh=t=>t.toLowerCase();function $6(t,e){return!t||Object.entries(t).every((n=>{var[r,s]=n,i=e==null?void 0:e[r];if(be(i)||ar(i))return!1;var a=[String(i)],u=V6[s.operator];return!!u&&u(s.values,a)}))}var ky="custom",mE="i.posthog.com",yN=/^\/static\//;class _N{constructor(e){this.Ri={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+mE,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Ri[this.apiHost]||(this.Ri[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":ky),this.Ri[this.apiHost]}Oi(e){if(yN.test(e)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(e==="assets"){var r=this.Oi(n);if(r)return""+r+n}if(this.region===ky)return this.apiHost+n;var s=mE+n;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var yt=Dt("[Surveys]"),Cy="seenSurvey_",H6=t=>{try{var e=(n=>((r,s)=>{var i=""+Cy+s.id;return s.current_iteration&&s.current_iteration>0&&(i=""+Cy+s.id+"_"+s.current_iteration),i})(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(n){yt.error("Failed to persist survey seen state",n)}},xN=[_v.Popover,_v.Widget,_v.API],wN={ignoreConditions:!1,ignoreDelay:!1,displayType:_y.Popover},bN=Dt("[PostHog ExternalIntegrations]"),SN={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class EN{constructor(e){this._instance=e}Bt(e,n){var r;(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(s=>{if(s)return bN.error("failed to load script",s);n()}))}startIfEnabledOrStop(){var e=this,n=function(a){var u,c,f;!s||(u=$e.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[a]||e.Bt(SN[a],(()=>{var h;(h=$e.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[a])==null||h.start(e._instance)})),!s&&(c=$e.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[a]&&((f=$e.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[a])==null||f.stop())};for(var[r,s]of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n(r)}}}var pd={},Sv=0,om=()=>{},gE='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Bc="Surveys module not available",vE="sanitize_properties is deprecated. Use before_send instead",z6="Invalid value for property_denylist config: ",Xl="posthog",U6=!cN&&(vr==null?void 0:vr.indexOf("MSIE"))===-1&&(vr==null?void 0:vr.indexOf("Mozilla"))===-1,yE=t=>{var e;return pe({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:PO(Ee==null?void 0:Ee.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:om,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:on&&_t(on==null?void 0:on.search)&&on.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,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(te==null||(e=te.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,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,surveys_request_timeout_ms:1e4,on_request_error(n){_e.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:gy,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Ey},error_tracking:{},_onCapture:om},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:VO,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},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)}))(t))},kN=[["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"]],_E=t=>{var e={};for(var[n,r]of kN)be(t[n])||(e[r]=t[n]);var s=At({},e,t),i=t.__preview_external_dependency_versioned_paths;return be(i)||(be(t.strict_script_versioning)&&(s.strict_script_versioning=!!i),_t(i)&&be(t.asset_host)&&(s.asset_host=i)),tt(t.property_blacklist)&&(be(t.property_denylist)?s.property_denylist=t.property_blacklist:tt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:_e.error(z6+t.property_denylist)),s};class CN{constructor(){this.__forceAllowLocalhost=!1}get Li(){return this.__forceAllowLocalhost}set Li(e){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class as{Fi(e,n){if(e){var r=this.Ai.indexOf(e);r!==-1&&this.Ai.splice(r,1)}return this.Ai.push(n),n.initialize==null||n.initialize(),n}Di(){return this.config.cookieless_mode===zi||this.config.cookieless_mode===Da&&this.consent.isRejected()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new CN,this.$i=!1,this.version=Vt.LIB_VERSION,this.Ni=new c2,this.Ai=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=yE(),this.SentryIntegration=ZO,this.sentryIntegration=r=>(function(s,i){var a=y6(s,i);return{name:v6,processEvent:u=>a(u)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.qi=!1,this.Bi=null,this.ji=null,this.Hi=null,this.scrollManager=new gN(this),this.pageViewManager=new tE(this),this.rateLimiter=new sN(this),this.requestRouter=new _N(this),this.consent=new OO(this),this.externalIntegrations=new EN(this);var n=(e=as.__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:(r,s,i)=>{var a=_t(r)?{[r]:s}:r;this.setPersonProperties(a),i==null||i({})},set_once:(r,s,i)=>{var a=_t(r)?{[r]:s}:r;this.setPersonProperties(void 0,a),i==null||i({})}},this.on("eventCaptured",(r=>_e.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(e,n,r){if(r&&r!==Xl){var s,i=(s=pd[r])!==null&&s!==void 0?s:new as;return i._init(e,n,r),pd[r]=i,pd[Xl][r]=i,i}return this._init(e,n,r)}_init(e,n,r){var s,i;n===void 0&&(n={});var a=_t(e)?e.trim():"";if(!a)return _e.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Ui(n.debug),this.zi=n,this.Vi=[],n.person_profiles?this.ji=n.person_profiles:n.process_person&&(this.ji=n.process_person);var u=yE(n.defaults),c=_E(n),f=At({},u,c,{name:r,token:a});Ot(u.rageclick)&&Ot(c.rageclick)&&(f.rageclick=At({},u.rageclick,c.rageclick)),Ot(u.session_recording)&&Ot(c.session_recording)&&(f.session_recording=At({},u.session_recording,c.session_recording)),this.set_config(f),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:os.GZipJS;var h=this.Wi();this.persistence=new yv(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yv(pe({},this.config,{persistence:"sessionStorage"}),h,!1);var p=pe({},this.persistence.props),v=pe({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Gi=new hN((T=>this.Zi(T)),this.config.request_queue_config),this.Qi=new mN(this),this.__request_queue=[];var y=this.Di();if(y||(this.sessionManager=new hE(this),this.sessionPropsManager=new fE(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ji(y)}),0)):(_e.info("Initializing extensions synchronously"),this.Ji(y)),Vt.DEBUG=Vt.DEBUG||this.config.debug,Vt.DEBUG&&_e.info("Starting in debug mode",{this:this,config:n,thisC:pe({},this.config),p,s:v}),!this.config.identity_distinct_id||(s=n.bootstrap)!=null&&s.distinctID||(n.bootstrap=pe({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((i=n.bootstrap)==null?void 0:i.distinctID)!==void 0){var x=n.bootstrap.distinctID,_=this.get_distinct_id(),b=this.persistence.get_property(Es);if(n.bootstrap.isIdentifiedID&&_!=null&&_!==x&&b===Vl)this.identify(x);else if(n.bootstrap.isIdentifiedID&&_!=null&&_!==x&&b===$l)_e.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{var E=this.config.get_device_id(Fi()),C=n.bootstrap.isIdentifiedID?E:x;this.persistence.set_property(Es,n.bootstrap.isIdentifiedID?$l:Vl),this.register({distinct_id:x,$device_id:C})}}if(y)this.register_once({distinct_id:Rh,$device_id:null},"");else if(!this.get_distinct_id()){var P=this.config.get_device_id(Fi());this.register_once({distinct_id:P,$device_id:P},""),this.persistence.set_property(Es,Vl)}return $t(te,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(T,A){var O=T.config.segment;if(!O)return A();(function(M,R){var L=M.config.segment;if(!L)return R();var N=V=>{var G=()=>V.anonymousId()||Fi();M.config.get_device_id=G,V.id()&&(M.register({distinct_id:V.id(),$device_id:G()}),M.persistence.set_property(Es,$l)),R()},j=L.user();"then"in j&&Ts(j.then)?j.then(N):N(j)})(T,(()=>{O.register((M=>{typeof Promise<"u"&&Promise.resolve||vv.warn("This browser does not have Promise support, and can not use the segment integration");var R=(L,N)=>{if(!N)return L;L.event.userId||L.event.anonymousId===M.get_distinct_id()||(vv.info("No userId set, resetting PostHog"),M.reset()),L.event.userId&&L.event.userId!==M.get_distinct_id()&&(vv.info("UserId set, identifying with PostHog"),M.identify(L.event.userId));var j=M.calculateEventProperties(N,L.event.properties);return L.event.properties=Object.assign({},j,L.event.properties),L};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:L=>R(L,L.event.event),page:L=>R(L,Yl),identify:L=>R(L,pv),screen:L=>R(L,"$screen")}})(T)).then((()=>{A()}))}))})(this,(()=>this.Ki())):this.Ki(),Ts(this.config._onCapture)&&this.config._onCapture!==om&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(T=>this.config._onCapture(T.event,T)))),this.config.ip&&_e.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 F6.apply(this,arguments)})().then((T=>{T&&this.register({[fv]:T})})).catch(om),this}Ji(e){var n,r,s,i,a,u,c,f,h=performance.now(),p=pe({},as.__defaultExtensionClasses,this.config.__extensionClasses),v=[];p.featureFlags&&this.Ai.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new p.featureFlags(this)),p.exceptions&&this.Ai.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new p.exceptions(this)),p.historyAutocapture&&this.Ai.push(this.historyAutocapture=new p.historyAutocapture(this)),p.tracingHeaders&&this.Ai.push(this.tracingHeaders=new p.tracingHeaders(this)),p.siteApps&&this.Ai.push(this.siteApps=new p.siteApps(this)),p.sessionRecording&&!e&&this.Ai.push(this.sessionRecording=new p.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),p.autocapture&&this.Ai.push(this.autocapture=new p.autocapture(this)),p.surveys&&this.Ai.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new p.surveys(this)),p.logs&&this.Ai.push(this.logs=(i=this.logs)!==null&&i!==void 0?i:new p.logs(this)),p.metrics&&this.Ai.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new p.metrics(this)),p.conversations&&this.Ai.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new p.conversations(this)),p.productTours&&this.Ai.push(this.productTours=new p.productTours(this)),p.heatmaps&&this.Ai.push(this.heatmaps=new p.heatmaps(this)),p.webVitalsAutocapture&&this.Ai.push(this.webVitalsAutocapture=new p.webVitalsAutocapture(this)),p.exceptionObserver&&this.Ai.push(this.exceptionObserver=new p.exceptionObserver(this)),p.deadClicksAutocapture&&this.Ai.push(this.deadClicksAutocapture=new p.deadClicksAutocapture(this,KO)),p.toolbar&&this.Ai.push(this.toolbar=(c=this.toolbar)!==null&&c!==void 0?c:new p.toolbar(this)),p.experiments&&this.Ai.push(this.experiments=(f=this.experiments)!==null&&f!==void 0?f:new p.experiments(this)),this.Ai.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Yi){var y=this.Yi;this.Yi=void 0,this.Tr(y)}})),this.Xi(v,h)}Xi(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout((()=>{this.Xi(e,n)}),0);var r=e.shift();if(r)try{r()}catch(i){_e.error("Error initializing extension:",i)}}var s=Math.round(performance.now()-n);this.register_for_session({[t6]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[n6]:s}),this.config.__preview_deferred_init_extensions&&_e.info("PostHog extensions initialized ("+s+"ms)")}Tr(e){var n;if(!Ee||!Ee.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Tr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Yi=e),this.en=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Be(e.supportedCompression,os.GZipJS)?os.GZipJS:Be(e.supportedCompression,os.Base64)?os.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ji?this.ji:gy}),this.Ai.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e)))}Ki(){try{this.config.loaded(this)}catch(r){_e.critical("`loaded` function failed",r)}if(this.tn(),this.config.internal_or_test_user_hostname&&on!=null&&on.hostname){var e=on.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.Di())&&this.rn()}),1),this.nn=new T6(this),this.nn.load()}tn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Gi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ih(this.__request_queue,(e=>this.Zi(e))),this.__request_queue=[],this.tn()}_handle_unload(){var e,n,r,s,i;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.sn()&&this.capture(hv),(r=this.logs)==null||r.flushLogs("sendBeacon"),(s=this.Gi)==null||s.unload(),(i=this.Qi)==null||i.unload()):this.sn()&&this.capture(hv,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?U6?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=pe({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(be(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,s,i,a=pe({},n);a.timeout=a.timeout||6e4,a.url=dE(a.url,a.compression);var u=(r=a.transport)!==null&&r!==void 0?r:"fetch",c=fp.filter((h=>!a.disableTransport||!h.transport||!a.disableTransport.includes(h.transport))),f=(s=(i=(function(h,p){for(var v=0;h.length>v;v++)if(h[v].transport===u)return h[v]})(c))==null?void 0:i.method)!==null&&s!==void 0?s:c[0].method;if(!f)throw new Error("No available transport method");u!=="sendBeacon"&&a.data&&a.compression===os.GZipJS&&RL&&typeof Promise<"u"&&!dp?dN(a).then((h=>{f(h)})).catch((h=>{if(OS(h))return dp=!0,void f(pe({},a,{compression:void 0,url:dE(n.url,void 0)}));(p=>{if(!p||typeof p!="object")return!1;var v="name"in p?String(p.name):"";return OS(p)||v===v8})(h)&&(dp=!0),f(a)})):f(a)})(pe({},e,{callback:n=>{var r,s;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,n),e.callback==null||e.callback(n)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Zi(e){this.Qi?this.Qi.retriableRequest(e):this._send_request(e)}_execute_array(e){Sv++;try{var n,r=[],s=[],i=[];Ih(e,(u=>{if(u)if(tt(n=u[0]))i.push(u);else if(Ts(u))try{u.call(this)}catch(c){_e.error("Error executing queued PostHog call",u,c)}else tt(u)&&n==="alias"?r.push(u):tt(u)&&n.indexOf("capture")!==-1&&Ts(this[n])?i.push(u):s.push(u)}));var a=function(u,c){Ih(u,(function(f){try{if(tt(f[0])){var h=c;bt(f,(function(p){h=h[p[0]].apply(h,p.slice(1))}))}else c[f[0]].apply(c,f.slice(1))}catch(p){_e.error("Error executing queued PostHog call",f,p)}}))};a(r,this),a(s,this),a(i,this)}finally{Sv--}}push(e){if(Sv>0&&tt(e)&&_t(e[0])){var n=as.prototype[e[0]];Ts(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var s,i,a,u,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gi){if(this.is_capturing())if(!be(e)&&_t(e)){var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var h=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h==null||!h.isRateLimited){n!=null&&n.$current_url&&!_t(n==null?void 0:n.$current_url)&&(_e.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"||r!=null&&r.an||_e.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&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var p=new Date,v=(r==null?void 0:r.timestamp)||p,y=VS(r==null?void 0:r.uuid,Fi),x={uuid:y,event:e,properties:this.calculateEventProperties(e,n||{},v,y)};e===Yl&&this.config.__preview_capture_bot_pageviews&&f&&(x.event="$bot_pageview",x.properties.$browser_type="bot"),h&&(x.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),r!=null&&r.$set&&(x.$set=r==null?void 0:r.$set);var _=r==null?void 0:r.$unset;_&&(x.$unset=_);var b,E,C,P=this.ln(r==null?void 0:r.$set_once,e!==BS,e===pv);if(P&&(x.$set_once=P),r!=null&&r._noTruncate||(i=this.config.properties_string_max_length,a=x,u=N=>_t(N)?N.slice(0,i):N,c=new Set,x=(function N(j,V){return j!==Object(j)?u?u(j):j:c.has(j)?void 0:(c.add(j),tt(j)?(G=[],Ih(j,(Y=>{G.push(N(Y))}))):(G={},bt(j,((Y,K)=>{c.has(Y)||(G[K]=N(Y))}))),G);var G})(a)),x.timestamp=v,be(r==null?void 0:r.timestamp)||(x.properties.$event_time_override_provided=!0,x.properties.$event_time_override_system_time=p),e===Ui.DISMISSED||e===Ui.SENT){var T=n==null?void 0:n[xv.SURVEY_ID],A=n==null?void 0:n[xv.SURVEY_ITERATION];H6({id:T,current_iteration:A}),x.$set=pe({},x.$set,{[(b={id:T,current_iteration:A},E=e===Ui.SENT?"responded":"dismissed",C="$survey_"+E+"/"+b.id,b.current_iteration&&b.current_iteration>0&&(C="$survey_"+E+"/"+b.id+"/"+b.current_iteration),C)]:!0})}else e===Ui.SHOWN&&(x.$set=pe({},x.$set,{[xv.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===rN.SHOWN){var O=n==null?void 0:n[rE.TOUR_TYPE];O&&(x.$set=pe({},x.$set,{[rE.TOUR_LAST_SEEN_DATE+"/"+O]:new Date().toISOString()}))}var M=pe({},x.properties.$set,x.$set);if(Do(M)||this.setPersonPropertiesForFlags(M),!Ye(this.config.before_send)){var R=this.it(x);if(!R)return;(x=R).uuid=VS(x.uuid,Fi)}this.Ni.emit("eventCaptured",x);var L={method:"POST",url:(s=r==null?void 0:r._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:x,compression:"best-available",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Zi(L):this.Gi.enqueue(L),x}_e.critical("This capture call is ignored due to client rate limiting.")}}else _e.error("No event name provided to posthog.capture")}else _e.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(n=>e(n.event,n)))}calculateEventProperties(e,n,r,s,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var a=i?void 0:this.persistence.remove_event_timer(e),u=pe({},n);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Di()&&(u.$cookieless_mode=!0),e==="$snapshot"){var c=pe({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=c.distinct_id,(!_t(u.distinct_id)&&!$n(u.distinct_id)||K1(u.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var f,h=(function(E,C,P,T){var A,O,M,R;if(T===void 0&&(T=!1),!vr)return{};var L,N,j,V,G,Y,K,B,X,$=E?[...Mu,...C||[]]:[],[ee,H]=(function(se){for(var oe=0;jS.length>oe;oe++){var[ue,de]=jS[oe],ie=ue.exec(se),ae=ie&&(Ts(de)?de(ie,se):de);if(ae)return ae}return["",""]})(vr),D=(L=typeof navigator<"u"?navigator:void 0)!=null&&L.brave?{brave:!0}:{},q={detectGoogleSearchApp:P},re=At(s2({$os:ee,$os_version:H,$browser:$8(vr,navigator.vendor,D,q),$device:FS(vr),$device_type:(j=vr,V={userAgentDataPlatform:(A=navigator)==null||(A=A.userAgentData)==null?void 0:A.platform,maxTouchPoints:(O=navigator)==null?void 0:O.maxTouchPoints,screenWidth:te==null||(M=te.screen)==null?void 0:M.width,screenHeight:te==null||(R=te.screen)==null?void 0:R.height,devicePixelRatio:te==null?void 0:te.devicePixelRatio},X=FS(j),X===b8||X===w8||X==="Kobo"||X==="Kindle Fire"||X===N8?Tu:X===Td||X===au||X===Ad||X===q1?"Console":X===E8?"Wearable":X?zr:(V==null?void 0:V.userAgentDataPlatform)==="Android"&&((G=V==null?void 0:V.maxTouchPoints)!==null&&G!==void 0?G:0)>0?600>Math.min((Y=V==null?void 0:V.screenWidth)!==null&&Y!==void 0?Y:0,(K=V==null?void 0:V.screenHeight)!==null&&K!==void 0?K:0)/((B=V==null?void 0:V.devicePixelRatio)!==null&&B!==void 0?B:1)?zr:Tu:"Desktop"),$timezone:P6(),$timezone_offset:JO()}),{$current_url:Ld(T?Wo(on==null?void 0:on.href):on==null?void 0:on.href,$,Od),$host:on==null?void 0:on.host,$pathname:on==null?void 0:on.pathname,$raw_user_agent:vr.length>1e3?vr.substring(0,997)+"...":vr,$browser_version:qL(vr,navigator.vendor,D,q),$browser_language:nE(),$browser_language_prefix:(N=nE(),typeof N=="string"?N.split("-")[0]:void 0),$screen_height:te==null?void 0:te.screen.height,$screen_width:te==null?void 0:te.screen.width,$viewport_height:te==null?void 0:te.innerHeight,$viewport_width:te==null?void 0:te.innerWidth,$lib:Vt.LIB_NAME,$lib_version:Vt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Vt.SDK_DIST_CHANNEL&&(re.$sdk_dist_channel=Vt.SDK_DIST_CHANNEL),re})(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){var{sessionId:p,windowId:v}=this.sessionManager.checkAndGetSessionAndWindowId(i,r.getTime());u.$session_id=p,u.$window_id=v}this.sessionPropsManager&&At(u,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&At(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=(y=this.Qi)==null?void 0:y.length}catch(E){u.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===ky&&(u.$lib_custom_api_host=this.config.api_host),f=e!==Yl||i?e!==hv||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=At(u,f),e===Yl&&Ee&&(u.title=Ee.title),!be(a)){var x=r.getTime()-a;u.$duration=parseFloat((x/1e3).toFixed(3))}vr&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser"),(u=At({},h,this.persistence.properties(),this.sessionPersistence.properties(),u)).$is_identified=this._isIdentified(),tt(this.config.property_denylist)?bt(this.config.property_denylist,(function(E){delete u[E]})):_e.error(z6+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(_e.error(vE),u=_(u,e));var b=this.un();return u.$process_person_profile=b,b&&!i&&this.hn("_calculate_event_properties"),u}ln(e,n,r){var s;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.un()||this.$i&&!r)return e;var i=this.persistence.get_initial_props(),a=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),u=At({},i,a||{},e||{}),c=this.config.sanitize_properties;return c&&(_e.error(vE),u=c(u,"$set_once")),n&&(this.$i=!0),Do(u)?void 0:u}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var s;(s=this.persistence)==null||s.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}dn(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var s;return n===void 0&&(n=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Ni.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:Bc}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:Bc})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Bc})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=wN),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:Bc}}canRenderSurveyAsync(e,n){var r,s;return n===void 0&&(n=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Bc})}cn(e){return!e||K1(e)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):e===Rh?(_e.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())||(_e.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,r){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if($n(e)&&(e=e.toString(),_e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.cn(e)&&this.hn("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Zp)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(nd)&&(this.unregister(nd),this.register({distinct_id:e}));var i,a=(this.persistence.get_property(Es)||Vl)===Vl;e!==s&&a?(this.persistence.set_property(Es,$l),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(pv,{distinct_id:e,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this.Hi=pE(e,n,r),(i=this.featureFlags)==null||i.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(dd))}}setPersonProperties(e,n){if((e||n)&&this.hn("posthog.setPersonProperties")){var r=pE(this.get_distinct_id(),e,n);this.Hi!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Hi=r):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var n,r=(tt(e)?e:[e]).filter((s=>_t(s)&&s.length>0));r.length!==0&&this.hn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Hi=null)}group(e,n,r){if(e&&n){var s=this.getGroups(),i=s[e]!==n;if(i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:pe({},s,{[e]:n})}),i||r){var a={$group_type:e,$group_key:n};r&&(a.$group_set=r),this.capture(BS,a)}r&&this.setGroupPropertiesForFlags({[e]:r}),i&&!r&&this.reloadFeatureFlags()}else _e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e){var n;e===void 0&&(e=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.hn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,r,s,i,a,u,c,f,h,p;if(_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");var v,y=this.get_property(Zp),x=this.get_property(fv),_=this.get_property(za);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),be(_)||(v=this.persistence)==null||v.register({[za]:_}),(s=this.surveys)==null||s.reset(),(i=this.nn)==null||i.stop(),(a=this.featureFlags)==null||a.reset(),(u=this.conversations)==null||u.reset(),(c=this.logs)==null||c.reset(),(f=this.metrics)==null||f.reset(),(h=this.persistence)==null||h.set_property(Es,Vl),(p=this.sessionManager)==null||p.resetSessionId(),this.Hi=null,this.config.cookieless_mode===zi)this.register_once({distinct_id:Rh,$device_id:null},"");else{var b=this.config.get_device_id(Fi());this.register_once({distinct_id:b,$device_id:e?b:y},""),e||be(x)||this.register({[fv]:x})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var n=this;return en((function*(){var r,s,i,a,u;n.__loaded?((r=n.logs)==null||r.flushLogs("sendBeacon"),(s=n.metrics)==null||s.flush("sendBeacon"),(i=n.Gi)==null||i.unload(),(a=n.Qi)==null||a.unload(),(u=n.featureFlags)==null||u.destroy()):_e.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,n){var r;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(r=this.conversations)==null||r.vn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.fn()}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?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var i,a=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0)}return s}alias(e,n){return e===this.get_property(Z8)?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this.hn("posthog.alias")?(be(n)&&(n=this.get_distinct_id()),e!==n?(this.dn(nd,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=pe({},this.config);if(Ot(e)){var r,s,i,a,u,c,f,h,p,v,y;At(this.config,_E(e));var x=this.Wi();(r=this.persistence)==null||r.update_config(this.config,n,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new yv(pe({},this.config,{persistence:"sessionStorage"}),x,!1);var _=this.Ui(this.config.debug);ai(_)&&(this.config.debug=_),ai(this.config.debug)&&(this.config.debug?(Vt.DEBUG=!0,wt.N()&&wt.q("ph_debug",!0),_e.info("set_config",{config:e,oldConfig:n,newConfig:pe({},this.config)})):(Vt.DEBUG=!1,wt.N()&&wt.P("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(i=this.exceptions)==null||i.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(u=this.tracingHeaders)==null||u.startIfEnabledOrStop(),(c=this.autocapture)==null||c.startIfEnabled(),(f=this.heatmaps)==null||f.startIfEnabled(),(h=this.exceptionObserver)==null||h.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(v=this.surveys)==null||v.loadIfEnabled(),this.pn(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){Vt.LIB_NAME=e,Vt.LIB_VERSION=n}startSessionRecording(e){var n,r,s,i,a,u=e===!0,c={sampling:u||!(e==null||!e.sampling),linked_flag:u||!(e==null||!e.linked_flag),url_trigger:u||!(e==null||!e.url_trigger),event_trigger:u||!(e==null||!e.event_trigger)};Object.values(c).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),c.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),c.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),c.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),c.event_trigger&&((a=this.sessionRecording)==null||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.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(pe({},s,n))}}addExceptionStep(e,n){var r;(r=this.exceptions)==null||r.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:as.gn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Xl;return n!==Xl&&(n=Xl+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Es))===$l||((n=this.sessionPersistence)==null?void 0:n.get_property(Es))===$l}un(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===gy&&!this._isIdentified()&&Do(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[nd])&&((n=this.persistence)==null||(n=n.props)==null||!n[Xp]))}sn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.un()||this.hn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.hn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}hn(e){return this.config.person_profiles==="never"?(_e.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.dn(Xp,!0),!0)}Wi(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Da)}pn(){var e,n,r,s,i=this.Wi();return((e=this.persistence)==null?void 0:e.rr)!==i&&((r=this.persistence)==null||r.set_disabled(i)),((n=this.sessionPersistence)==null?void 0:n.rr)!==i&&((s=this.sessionPersistence)==null||s.set_disabled(i)),i}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==zi){if(this.Di()){var r,s,i,a,u;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new hE(this),this.pageViewManager=new tE(this),this.persistence&&(this.sessionPropsManager=new fE(this,this.sessionManager,this.persistence));var c,f=(i=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&i!==void 0?i:(u=as.__defaultExtensionClasses)==null?void 0:u.sessionRecording;f&&(this.sessionRecording=this.Fi(this.sessionRecording,new f(this)),this.en&&((c=this.sessionRecording)==null||c.onRemoteConfig==null||c.onRemoteConfig(this.en)))}var h,p;this.consent.optInOut(!0),this.pn(),this.tn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Da&&((h=this.surveys)==null||h.loadIfEnabled()),(be(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((p=e==null?void 0:e.captureEventName)!==null&&p!==void 0?p:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.rn()}else _e.warn(gE)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==zi?(this.config.cookieless_mode===Da&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.pn(),this.config.cookieless_mode===Da&&(this.register({distinct_id:Rh,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.rn(),this.tn())):_e.warn(gE)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===zi||(this.config.cookieless_mode===Da?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.pn()}_is_bot(){return sr?j6(sr,this.config.custom_blocked_useragents):void 0}rn(){Ee&&(Ee.visibilityState==="visible"?this.qi||(this.qi=!0,this.capture(Yl,{title:Ee.title},{send_instantly:!0}),this.Bi&&(Ee.removeEventListener(Qp,this.Bi),this.Bi=null)):this.Bi||(this.Bi=this.rn.bind(this),$t(Ee,Qp,this.Bi)))}debug(e){e===!1?(te==null||te.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(te==null||te.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}))}Er(){var e,n,r,s,i,a,u=this.zi||{};return"advanced_disable_flags"in u?!!u.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(_e.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):(r="advanced_disable_decide",s=_e,i=(n="advanced_disable_flags")in(e=u)&&!Ye(e[n]),a=r in e&&!Ye(e[r]),i?e[n]:!!a&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]))}it(e){var n;if(Ye(this.config.before_send))return e;var r=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(jL),s=tt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var a of s){if(i=a(i),Ye(i)){var u="Event '"+e.event+"' was rejected in beforeSend function";return DL(e.event)?_e.warn(u+". This can cause unexpected behavior."):_e.info(u),null}i.properties&&!Do(i.properties)||_e.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var c of r)if(i.properties&&Ye(i.properties[c]))return _e.warn("Event '"+e.event+"' had its '"+c+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return i}getPageViewId(){var e;return(e=this.pageViewManager.Ut)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Ui(e){var n=ai(e)&&!e,r=wt.N()&&wt.A("ph_debug")==="true";return!n&&(!!r||e)}}as.__defaultExtensionClasses={},as.gn=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=kO(t.prototype[e[n]])})(as,["identify"]);class xE{constructor(e){this.disabled=e===!1;var n=Ot(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(n-s.y)<this.thresholdPx&&this.timeoutMs>r-s.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var Ev="$copy_autocapture",kv=Dt("[AutoCapture]");function Cv(t,e){return e.length>t?e.slice(0,t)+"...":e}function PN(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Go(e));return e}function TN(t,e){var n,r,{e:s,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:u,elementsChainAsString:c,disableCaptureUrlHashes:f}=e;if(!Go(t))return{props:{}};for(var h=[t],p=t;p.parentNode&&!Vr(p,"body");)if(l6(p.parentNode))h.push(p.parentNode.host),p=p.parentNode.host;else{if(!Go(p.parentNode))break;h.push(p.parentNode),p=p.parentNode}var v,y,x=[],_={},b=!1,E=!1;if(bt(h,(O=>{var M=yy(O);if(Vr(O,"a")){var R=O.getAttribute("href");b=!!(M&&R&&fd(R))&&(f?Wo(R):R)}Be(tm(O),"ph-no-capture")&&(E=!0),x.push((function(N,j,V,G,Y){Y===void 0&&(Y=!1);var K=N.tagName.toLowerCase(),B={tag_name:K};o2.indexOf(K)>-1&&!V&&(B.$el_text=K.toLowerCase()==="a"||K.toLowerCase()==="button"?Cv(1024,QS(N)):Cv(1024,Id(N)));var X=tm(N);X.length>0&&(B.classes=X.filter((function(D){return D!==""}))),bt(N.attributes,(function(D){var q;if((!h6(N)||["name","id","class","aria-label"].indexOf(D.name)!==-1)&&(G==null||!G.includes(D.name))&&!j&&fd(D.value)&&(!_t(q=D.name)||q.substring(0,10)!=="_ngcontent"&&q.substring(0,7)!=="_nghost")){var re=D.value;D.name==="class"&&(re=i2(re).join(" ")),B["attr__"+D.name]=Cv(1024,D.name==="href"&&Y?Wo(re):re)}}));for(var $=1,ee=1,H=N;H=PN(H);)$++,H.tagName===N.tagName&&ee++;return B.nth_child=$,B.nth_of_type=ee,B})(O,i,a,u,f));var L=(function(N){if(!yy(N))return{};var j={};return bt(N.attributes,(function(V){if(V.name&&V.name.indexOf("data-ph-capture-attribute")===0){var G=V.name.replace("data-ph-capture-attribute-",""),Y=V.value;G&&Y&&fd(Y)&&(j[G]=Y)}})),j})(O);At(_,L)})),E)return{props:{},explicitNoCapture:E};if(a||(x[0].$el_text=Vr(t,"a")||Vr(t,"button")?QS(t):Id(t)),b){var C,P;x[0].attr__href=b;var T=(C=Md(b))==null?void 0:C.host,A=te==null||(P=te.location)==null?void 0:P.host;T&&A&&T!==A&&(v=b)}return{props:At({$event_type:s.type,$ce_version:1},c?{}:{$elements:x},{$elements_chain:(y=x,(function(O){return O.map((M=>{var R,L,N="";if(M.tag_name&&(N+=M.tag_name),M.attr_class)for(var j of(M.attr_class.sort(),M.attr_class))N+="."+j.replace(/"/g,"");var V=pe({},M.text?{text:M.text}:{},{"nth-child":(R=M.nth_child)!==null&&R!==void 0?R:0,"nth-of-type":(L=M.nth_of_type)!==null&&L!==void 0?L:0},M.href?{href:M.href}:{},M.attr_id?{attr_id:M.attr_id}:{},M.attributes),G={};return cp(V).sort(((Y,K)=>{var[B]=Y,[X]=K;return B.localeCompare(X)})).forEach((Y=>{var[K,B]=Y;return G[JS(K.toString())]=JS(B.toString())})),(N+=":")+cp(G).map((Y=>{var[K,B]=Y;return K+'="'+B+'"'})).join("")})).join(";")})((function(O){return O.map((M=>{var R,L,N={text:(R=M.$el_text)==null?void 0:R.slice(0,400),tag_name:M.tag_name,href:(L=M.attr__href)==null?void 0:L.slice(0,2048),attr_class:WO(M),attr_id:M.attr__id,nth_child:M.nth_child,nth_of_type:M.nth_of_type,attributes:{}};return cp(M).filter((j=>{var[V]=j;return V.indexOf("attr__")===0})).forEach((j=>{var[V,G]=j;return N.attributes[V]=G})),N}))})(y)))},(n=x[0])!=null&&n.$el_text?{$el_text:(r=x[0])==null?void 0:r.$el_text}:{},v&&s.type==="click"?{$external_click_url:v}:{},_)}}var Wc=Dt("[ExceptionAutocapture]"),wE=()=>{},AN=Dt("[TracingHeaders]"),Ea=Dt("[Web Vitals]"),bE=9e5,SE="disabled",EE="lazy_loading",Gc="awaiting_config",jh="missing_config";Dt("[SessionRecording]"),Dt("[SessionRecording]");var Py="[SessionRecording]",Pi=Dt(Py),RN=Dt("[Heatmaps]");function kE(t){return Ot(t)&&"clientX"in t&&"clientY"in t&&$n(t.clientX)&&$n(t.clientY)}var Pv=Dt("[Product Tours]"),Tv=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(t2))},IN=["$set_once","$set"],Ws=Dt("[SiteApps]"),CE="Error while initializing PostHog app with config id ";function Ul(t,e,n){if(Ye(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class MN{constructor(e){this.mn=new c2,this.yn=(n,r)=>this.bn(n,r)&&this._n(n,r)&&this.wn(n,r)&&this.xn(n,r),this.bn=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.kn=new Set,this.Sn=new Set}init(){var e,n;be((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((r,s)=>{this.on(r,s)}))}register(e){var n,r;if(!be((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach((a=>{var u,c;(u=this.Sn)==null||u.add(a),(c=a.steps)==null||c.forEach((f=>{var h;(h=this.kn)==null||h.add((f==null?void 0:f.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,i=new Set;e.forEach((a=>{var u;(u=a.steps)==null||u.forEach((c=>{c!=null&&c.selector&&i.add(c==null?void 0:c.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(i)}}on(e,n){var r;n!=null&&e.length!=0&&(this.kn.has(e)||this.kn.has(n==null?void 0:n.event))&&this.Sn&&((r=this.Sn)==null?void 0:r.size)>0&&this.Sn.forEach((s=>{this.Cn(n,s)&&this.mn.emit("actionCaptured",s.name)}))}In(e){this.onAction("actionCaptured",(n=>e(n)))}Cn(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.yn(e,r))return!0;return!1}onAction(e,n){return this.mn.on(e,n)}_n(e,n){if(n!=null&&n.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!Ul(s,n.url,n.url_matching||"contains"))return!1}return!0}wn(e,n){return!!this.Tn(e,n)&&!!this.Mn(e,n)&&!!this.En(e,n)}Tn(e,n){var r;if(n==null||!n.href)return!0;var s=this.Pn(e);if(s.length>0)return s.some((u=>Ul(u.href,n.href,n.href_matching||"exact")));var i,a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!a&&Ul((i=a.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}Mn(e,n){var r;if(n==null||!n.text)return!0;var s=this.Pn(e);if(s.length>0)return s.some((f=>Ul(f.text,n.text,n.text_matching||"exact")||Ul(f.$el_text,n.text,n.text_matching||"exact")));var i,a,u,c=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!c&&(i=(function(f){for(var h,p=[],v=/(?::|")text="(.*?)"/g;!Ye(h=v.exec(f));)p.includes(h[1])||p.push(h[1]);return p})(c),a=n.text,u=n.text_matching||"exact",i.some((f=>Ul(f,a,u))))}En(e,n){var r,s;if(n==null||!n.selector)return!0;var i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(n.selector_regex&&a)try{return new RegExp(n.selector_regex).test(a)}catch{return!1}return!1}Pn(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e==null?void 0:e.properties.$elements}xn(e,n){return n==null||!n.properties||n.properties.length===0||$6(n.properties.reduce(((r,s)=>{var i=tt(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:i,operator:s.operator||"exact"},r}),{}),e==null?void 0:e.properties)}}class LN{constructor(e){this.Rn=[],this._instance=e,this.On=new Map,this.Ln=new Map,this.Fn=new Map}An(e,n){return!!e&&$6(e.propertyFilters,n==null?void 0:n.properties)}Dn(e,n){var r=new Map;return e.forEach((s=>{var i;(i=s.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEach((a=>{if(a!=null&&a.name){var u=r.get(a.name)||[];u.push(s.id),r.set(a.name,u)}}))})),r}$n(e,n,r){var s=(r===Vc.Activation?this.On:this.Ln).get(e),i=[];return this.Nn((a=>{i=a.filter((u=>s==null?void 0:s.includes(u.id)))})),i.filter((a=>{var u,c=(u=a.conditions)==null||(u=u[r])==null||(u=u.values)==null?void 0:u.find((f=>f.name===e));return this.An(c,n)}))}register(e){var n;be((n=this._instance)==null?void 0:n._addCaptureHook)||(this.qn(e),this.Bn(e))}Bn(e){var n=e.filter((r=>{var s,i;return((s=r.conditions)==null?void 0:s.actions)&&((i=r.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0}));n.length!==0&&(this.jn==null&&(this.jn=new MN(this._instance),this.jn.init(),this.jn.In((r=>{this.onAction(r)}))),n.forEach((r=>{var s,i,a,u,c;r.conditions&&(s=r.conditions)!=null&&s.actions&&(i=r.conditions)!=null&&(i=i.actions)!=null&&i.values&&((a=r.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((u=this.jn)==null||u.register(r.conditions.actions.values),(c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach((f=>{if(f&&f.name){var h=this.Fn.get(f.name);h&&h.push(r.id),this.Fn.set(f.name,h||[r.id])}})))})))}qn(e){var n,r=e.filter((i=>{var a,u;return((a=i.conditions)==null?void 0:a.events)&&((u=i.conditions)==null||(u=u.events)==null||(u=u.values)==null?void 0:u.length)>0})),s=e.filter((i=>{var a,u;return((a=i.conditions)==null?void 0:a.cancelEvents)&&((u=i.conditions)==null||(u=u.cancelEvents)==null||(u=u.values)==null?void 0:u.length)>0}));r.length===0&&s.length===0||((n=this._instance)==null||n._addCaptureHook(((i,a)=>{this.onEvent(i,a)})),this.On=this.Dn(e,Vc.Activation),this.Ln=this.Dn(e,Vc.Cancellation))}onEvent(e,n){var r,s,i=this.Hn(),a=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(s=n.properties)==null?void 0:s.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var u=this.Un(e,a);if(u==="consume")return i.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.zn([a]);if(u==="persist")return i.info("shown item promoted to persisted activation",{event:e,itemId:a}),void this.Vn(a)}if(this.Ln.has(e)){var c=this.$n(e,n,Vc.Cancellation);c.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:c.map((h=>h.id))}),this.zn(c.map((h=>h.id))),c.forEach((h=>this.Wn(h.id))))}if(this.On.has(e)){i.info("event name matched",{event:e,eventPayload:n,items:this.On.get(e)});var f=this.$n(e,n,Vc.Activation);this.Gn(f.map((h=>h.id)))}}onAction(e){this.Fn.has(e)&&this.Gn(this.Fn.get(e)||[])}Gn(e){e.length!==0&&(this.Rn=[...new Set([...this.Rn,...e])],this.Hn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Vn(e){this.Rn=this.Rn.filter((r=>r!==e));var n=this.Zn();n.includes(e)||this.Qn([...n,e])}zn(e){var n=new Set(e);this.Rn=this.Rn.filter((i=>!n.has(i)));var r=this.Zn(),s=r.filter((i=>!n.has(i)));s.length!==r.length&&this.Qn(s)}Zn(){var e,n=this.Jn();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getActivatedIds(){return[...new Set([...this.Zn(),...this.Rn])].filter((e=>!this.Kn(e)))}reset(){this.Rn=[],this.Zn().length>0&&this.Qn([])}getEventToItemsMap(){return this.On}Yn(){return this.jn}}class ON extends LN{constructor(e){super(e)}Jn(){return uy}Xn(){return Ui.SHOWN}Nn(e){var n;(n=this._instance)==null||n.getSurveys(e)}Wn(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}Hn(){return yt}Qn(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[uy]:e})}Kn(){return!1}Un(e,n){var r;this.Nn((i=>{r=i.find((a=>a.id===n))}));var s=!r||(function(i){var a,u,c,f=((a=(u=i.conditions)==null||(u=u.events)==null||(u=u.values)==null?void 0:u.length)!==null&&a!==void 0?a:0)>0;return i.schedule===nN.Always||!((c=i.conditions)==null||(c=c.events)==null||!c.repeatedActivation||!f)})(r);return s?e===Ui.SHOWN?"consume":"ignore":e===Ui.SHOWN?"persist":e===Ui.DISMISSED||e===Ui.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Av="SDK is not enabled or survey functionality is not yet loaded",PE="Disabled. Not loading surveys.",NN=te!=null&&te.location?nm(te.location.hash,"__posthog")||nm(location.hash,"state"):null,TE="_postHogToolbarParams",AE=Dt("[Toolbar]"),un=Dt("[FeatureFlags]"),ka=Dt("[FeatureFlags]",{debugEnabled:!0}),Rv=`" failed. Feature flags didn't load in time.`,RE=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},IE=t=>{var e={};for(var[n,r]of cp(t||{}))r&&(e[n]=r);return e},Ti=Dt("[Error tracking]"),ME="Refusing to render web experiment since the viewer is a likely bot",DN={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>im(e,t),not_regex:(t,e)=>!im(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Kn{get Se(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((s=>{Kn.es("retrieved web experiments from the server"),n.ts=new Map,s.forEach((i=>{if(i.feature_flag_key){var a;n.ts&&(Kn.es("setting flag key ",i.feature_flag_key," to web experiment ",i),(a=n.ts)==null||a.set(i.feature_flag_key,i));var u=n._instance.getFeatureFlag(i.feature_flag_key);_t(u)&&i.variants[u]&&n.rs(i.name,u,i.variants[u].transforms)}else if(i.variants)for(var c in i.variants){var f=i.variants[c];Kn.ns(f,n._instance)&&n.rs(i.name,c,f.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Kn.es(ME);else if(!this.Se.disable_web_experiments){if(Ye(this.ts))return this.ts=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Kn.es("applying feature flags",e),e.forEach((n=>{var r;if(this.ts&&(r=this.ts)!=null&&r.has(n)){var s,i=this._instance.getFeatureFlag(n),a=(s=this.ts)==null?void 0:s.get(n);i&&a!=null&&a.variants[i]&&this.rs(a.name,i,a.variants[i].transforms)}}))}}previewWebExperiment(){var e=Kn.getWindowLocation();if(e!=null&&e.search){var n=Iu(e==null?void 0:e.search,"__experiment_id"),r=Iu(e==null?void 0:e.search,"__experiment_variant");n&&r&&(Kn.es("previewing web experiments "+n+" && "+r),this.getWebExperiments((s=>{this.ss(parseInt(n),r,s)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.Se.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!n)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:i=>e(i.statusCode===200&&i.json&&i.json.experiments||[])})}ss(e,n,r){var s=r.filter((i=>i.id===e));s&&s.length>0&&(Kn.es("Previewing web experiment ["+s[0].name+"] with variant ["+n+"]"),this.rs(s[0].name,n,s[0].variants[n].transforms))}static ns(e,n){return!Ye(e.conditions)&&Kn.os(e,n)&&Kn.ls(e)}static os(e,n){var r;if(Ye(e.conditions)||Ye((r=e.conditions)==null?void 0:r.url))return!0;var s=Kn.getWindowLocation();if(s){var i,a,u,c=o6(n,s.href);return(i=e.conditions)==null||!i.url||DN[(a=(u=e.conditions)==null?void 0:u.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,c)}return!1}static getWindowLocation(){return te==null?void 0:te.location}static ls(e){var n;if(Ye(e.conditions)||Ye((n=e.conditions)==null?void 0:n.utm))return!0;var r=w6();if(r.utm_source){var s,i,a,u,c,f,h,p,v=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==r.utm_campaign,y=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_source)==r.utm_source,x=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_medium||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_medium)==r.utm_medium,_=(h=e.conditions)==null||(h=h.utm)==null||!h.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==r.utm_term;return v&&x&&_&&y}return!1}static es(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;n>s;s++)r[s-1]=arguments[s];_e.info("[WebExperiments] "+e,r)}rs(e,n,r){this._is_bot()?Kn.es(ME):n!=="control"?r.forEach((s=>{if(s.selector){var i;Kn.es("applying transform of variant "+n+" for experiment "+e+" ",s);var a=(i=document)==null?void 0:i.querySelectorAll(s.selector);a==null||a.forEach((u=>{var c=u;s.html&&(c.innerHTML=s.html),s.css&&c.setAttribute("style",s.css)}))}})):Kn.es("Control variants leave the page unmodified.")}_is_bot(){return sr&&this._instance?j6(sr,this.Se.custom_blocked_useragents):void 0}}var rs=Dt("[Conversations]"),Ca="Conversations not available yet.",LE="console",Um={featureFlags:class{constructor(t){this.us=!1,this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.gs=!1,this.ys=0,this.bs=()=>{var e=this._s();this.ys=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],te&&$t(te,"online",this.bs)}destroy(){te==null||te.removeEventListener("online",this.bs)}get Se(){return this._instance.config}get ti(){return this._instance.persistence}ws(t){return this._instance.get_property(t)}xs(){var t,e;return(t=(e=this.ti)==null?void 0:e.nr(this.Se.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}ks(){return!!this.xs()&&(this.gs||this.ds||(this.gs=!0,un.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ss(){var t,e=(t=this.Se.evaluation_contexts)!==null&&t!==void 0?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ps||(un.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ps=!0),e!=null&&e.length?e.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||un.error("Invalid evaluation context found:",n,"Expected non-empty string"),r})):[]}Cs(){return this.Ss().length>0}Is(){var t=this.Se.flag_keys;if(!be(t)){if(tt(t))return t.filter((e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||un.error("Invalid flag key found:",e,"Expected non-empty string"),n}));un.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,{config:n}=this._instance,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var s,i,a=(s=(i=n.bootstrap)==null?void 0:i.featureFlagPayloads)!==null&&s!==void 0?s:{},u=Object.keys(r).filter((f=>!!r[f])).reduce(((f,h)=>(f[h]=r[h]||!1,f)),{}),c=Object.keys(a).filter((f=>u[f])).reduce(((f,h)=>(a[h]&&(f[h]=a[h]),f)),{});this.receivedFeatureFlags({featureFlags:u,featureFlagPayloads:c})}}updateFlags(t,e,n){var r,s,i=n!=null&&n.merge&&(r=this.ws(Va))!==null&&r!==void 0?r:{},a=n!=null&&n.merge&&(s=this.ws(up))!==null&&s!==void 0?s:{},u=pe({},i,t),c=pe({},a,e),f={};for(var[h,p]of Object.entries(u))f[h]={key:h,enabled:RS(p),variant:IS(p),reason:void 0,metadata:be(c==null?void 0:c[h])?void 0:{id:0,version:void 0,description:void 0,payload:c[h]}};this.receivedFeatureFlags({flags:f})}get hasLoadedFlags(){return this.hs}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ws(oy),e=this.ws(Oi),n=this.ws(ql);if(!n&&!e)return t||{};var r=At({},t||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var i of s){var a,u,c=r[i],f=e==null?void 0:e[i],h=be(f)?(a=c==null?void 0:c.enabled)!==null&&a!==void 0&&a:!!f,p=be(f)?c.variant:typeof f=="string"?f:void 0,v=n==null?void 0:n[i],y=pe({},c,{enabled:h,variant:h?p??(c==null?void 0:c.variant):void 0});h!==(c==null?void 0:c.enabled)&&(y.original_enabled=c==null?void 0:c.enabled),p!==(c==null?void 0:c.variant)&&(y.original_variant=c==null?void 0:c.variant),v&&(y.metadata=pe({},c==null?void 0:c.metadata,{payload:v,original_payload:c==null||(u=c.metadata)==null?void 0:u.payload})),r[i]=y}return this.us||(un.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.us=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((n=>{var r=t[n];return{key:n,enabled:RS(r),variant:IS(r),payload:AS(e[n])}}))}getFlagVariants(){var t=this.ws(Va),e=this.ws(Oi);if(!e)return t||{};for(var n=At({},t),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.us||(un.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.us=!0),n}getFlagPayloads(){var t=this.ws(up),e=this.ws(ql);if(!e)return t||{};for(var n=At({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.us||(un.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.us=!0),n}reloadFeatureFlags(){this.cs||this.Se.advanced_disable_feature_flags||this._s()||this.Ts||(this._instance.Ni.emit("featureFlagsReloading",!0),this.Ts=setTimeout((()=>{this.Ms()}),5))}Es(){clearTimeout(this.Ts),this.Ts=void 0}ensureFlagsLoaded(){this.hs||this.ds||this.Ts||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.cs=t}Ms(t){var e;if(this.Es(),!this._instance.Er()&&!this._s())if(this.ds)this.vs=!0;else{var n=this.Se.token,r=this.ws(Zp),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:pe({},((e=this.ti)==null?void 0:e.get_initial_props())||{},this.ws(Oa)||{}),group_properties:this.ws(Na),timezone:P6()};ar(r)||be(r)||(s.$device_id=r),(t!=null&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Cs()&&(s.evaluation_contexts=this.Ss());var i=this.Is();be(i)||(s.flag_keys=i);var a=!!this.Se.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.ds=!0,this._instance._send_request({method:"POST",url:u,data:s,compression:this.Se.disable_compression?void 0:os.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:c=>{var f,h,p,v=!0;if(this.Ps(c.statusCode),c.statusCode===200&&(this.vs||(this.$anon_distinct_id=void 0),v=!1),this.ds=!1,!s.disable_flags||this.vs){this.fs=!v;var y=[];c.error?c.error instanceof Error?y.push(c.error.name==="AbortError"?"timeout":"connection_error"):y.push("unknown_error"):c.statusCode!==200&&y.push("api_error_"+c.statusCode),(f=c.json)!=null&&f.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");var x,_=!((h=c.json)==null||(h=h.quotaLimited)==null||!h.includes("feature_flags"));_&&y.push("quota_limited"),(p=this.ti)==null||p.register({[dy]:y}),_?un.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."):(s.disable_flags||this.receivedFeatureFlags((x=c.json)!==null&&x!==void 0?x:{},v,{partialResponse:a}),this.vs&&(this.vs=!1,this.Ms()))}}})}}_s(){return _6(this.ys,3)}Ps(t){this.ys=x6(t,this.ys,3,(()=>un.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===void 0&&(e={}),!e.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var r=this.getFeatureFlagResult(t,e);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else un.warn('getFeatureFlag for key "'+t+Rv)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var n=this.getFlagVariants(),r=t in n,s=n[t],i=this.getFlagPayloads()[t],a=String(s),u=this.ws(ay)||void 0,c=this.ws(Rd)||void 0,f=this.ws(dd)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var h,p=this._instance.get_session_id(),v=this.ws(cy);p&&p!==v&&(f={},(h=this.ti)==null||h.register({[dd]:f,[cy]:p}))}if((e.send_event||!("send_event"in e))&&(!(t in f)||!f[t].includes(a))){var y,x,_,b,E,C,P,T,A,O;tt(f[t])?f[t].push(a):f[t]=[a],(y=this.ti)==null||y.register({[dd]:f});var M=this.getFeatureFlagDetails(t),R=[...(x=this.ws(dy))!==null&&x!==void 0?x:[]];be(s)&&R.push("flag_missing");var L={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:i||null,$feature_flag_request_id:u,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((_=this.Se.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[t])||null,$feature_flag_bootstrapped_payload:((b=this.Se.bootstrap)==null||(b=b.featureFlagPayloads)==null?void 0:b[t])||null,$used_bootstrap_value:!this.fs};be(M==null||(E=M.metadata)==null?void 0:E.version)||(L.$feature_flag_version=M.metadata.version);var N,j=(C=M==null||(P=M.reason)==null?void 0:P.description)!==null&&C!==void 0?C:M==null||(T=M.reason)==null?void 0:T.code;j&&(L.$feature_flag_reason=j),M!=null&&(A=M.metadata)!=null&&A.id&&(L.$feature_flag_id=M.metadata.id),be(M==null?void 0:M.original_variant)&&be(M==null?void 0:M.original_enabled)||(L.$feature_flag_original_response=be(M.original_variant)?M.original_enabled:M.original_variant),M!=null&&(O=M.metadata)!=null&&O.original_payload&&(L.$feature_flag_original_payload=M==null||(N=M.metadata)==null?void 0:N.original_payload),R.length&&(L.$feature_flag_error=R.join(",")),this._instance.capture("$feature_flag_called",L)}if(r)return{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:AS(i)}}}else un.warn('getFeatureFlagResult for key "'+t+Rv)}getRemoteConfigPayload(t,e){var n=this.Se.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.Cs()&&(r.evaluation_contexts=this.Ss());var s=this.Is();be(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Se.disable_compression?void 0:os.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(i){var a,u=(a=i.json)==null?void 0:a.featureFlagPayloads;e((u==null?void 0:u[t])||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.fs){if(this.hs||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return be(n)?void 0:!!n}un.warn('isFeatureEnabled for key "'+t+Rv)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,n){if(this.ti){this.hs=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,u,c,f,h,p){c===void 0&&(c={}),f===void 0&&(f={}),h===void 0&&(h={});var v=(R=>{var L=R.flags;return L?(R.featureFlags=Object.fromEntries(Object.keys(L).map((N=>{var j;return[N,(j=L[N].variant)!==null&&j!==void 0?j:L[N].enabled]}))),R.featureFlagPayloads=Object.fromEntries(Object.keys(L).filter((N=>L[N].enabled)).filter((N=>{var j;return(j=L[N].metadata)==null?void 0:j.payload})).map((N=>{var j;return[N,(j=L[N].metadata)==null?void 0:j.payload]})))):R.featureFlags&&un.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),R})(a),y=v.flags,x=v.featureFlags,_=v.featureFlagPayloads;if(x){var b=a.requestId,E=a.evaluatedAt;if(tt(x)){un.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var C={};if(x)for(var P=0;x.length>P;P++)C[x[P]]=!0;u&&u.register({[lp]:x,[Va]:C})}else{var T=x,A=_,O=y;if(p!=null&&p.partialResponse)T=pe({},c,T),A=pe({},f,A),O=pe({},h,O);else if(a.errorsWhileComputingFlags)if(y){var M=new Set(Object.keys(y).filter((R=>{var L;return!((L=y[R])!=null&&L.failed)})));T=pe({},c,Object.fromEntries(Object.entries(T).filter((R=>{var[L]=R;return M.has(L)})))),A=pe({},f,Object.fromEntries(Object.entries(A||{}).filter((R=>{var[L]=R;return M.has(L)})))),O=pe({},h,Object.fromEntries(Object.entries(O||{}).filter((R=>{var[L]=R;return M.has(L)}))))}else T=pe({},c,T),A=pe({},f,A),O=pe({},h,O);u&&u.register(pe({[lp]:Object.keys(IE(T)),[Va]:T||{},[up]:A||{},[oy]:O||{}},b?{[ay]:b}:{},E?{[Rd]:E}:{}))}}})(t,this.ti,r,s,i,n),e||(this.gs=!1),this.Rs(e)}}override(t,e){e===void 0&&(e=!1),un.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ti)return un.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.ti.unregister(Oi),this.ti.unregister(ql),this.Rs(),ka.info("All overrides cleared");if(tt(t)){var e=RE(t);return this.ti.register({[Oi]:e}),this.Rs(),ka.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.us=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.ti.unregister(Oi),ka.info("Flag overrides cleared");else if(r.flags){if(tt(r.flags)){var s=RE(r.flags);this.ti.register({[Oi]:s})}else this.ti.register({[Oi]:r.flags});ka.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.ti.unregister(ql),ka.info("Payload overrides cleared")):r.payloads&&(this.ti.register({[ql]:r.payloads}),ka.info("Payload overrides set",{payloads:r.payloads}))),void this.Rs()}if(t&&typeof t=="object")return this.ti.register({[Oi]:t}),this.Rs(),ka.info("Flag overrides set",{flags:t});un.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.hs){var{flags:e,flagVariants:n}=this.Os();try{t(e,n)}catch(r){un.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r,s=(this.ws(sd)||[]).find((c=>c.flagKey===t)),i={["$feature_enrollment/"+t]:e},a={$feature_flag:t,$feature_enrollment:e,$set:i};s&&(a.$early_access_feature_name=s.name),n&&(a.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var u=pe({},this.getFlagVariants(),{[t]:e});(r=this.ti)==null||r.register({[lp]:Object.keys(IE(u)),[Va]:u}),this.Rs()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.ws(sd),s=n?"&"+n.map((i=>"stage="+i)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+s),method:"GET",callback:i=>{var a,u;if(i.json){var c=i.json.earlyAccessFeatures;return(a=this.ti)==null||a.unregister(sd),(u=this.ti)==null||u.register({[sd]:c}),t(c)}}})}Os(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((n=>e[n])),flagVariants:Object.keys(e).filter((n=>e[n])).reduce(((n,r)=>(n[r]=e[r],n)),{})}}Rs(t){var{flags:e,flagVariants:n}=this.Os();this.featureFlagEventHandlers.forEach((r=>{try{r(e,n,{errorsLoading:t})}catch(s){un.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ws(Oa)||{},r=(t==null?void 0:t.$set)||(t!=null&&t.$set_once?{}:t),s=t==null?void 0:t.$set_once,i={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in n||(i[a]=s[a]));this._instance.register({[Oa]:pe({},n,i,r)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=pe({},this.ws(Oa)||{});t.forEach((r=>{delete n[r]})),this._instance.register({[Oa]:n}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(Oa),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ws(Na)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=pe({},n[r],t[r]),delete t[r]})),this._instance.register({[Na]:pe({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ws(Na)||{};this._instance.register({[Na]:pe({},e,{[t]:{}})})}else this._instance.unregister(Na)}reset(){this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.$anon_distinct_id=void 0,this.Es(),this.us=!1,this.ys=0}}},jN={sessionRecording:class{get Se(){return this._instance.config}get ti(){return this._instance.persistence}get started(){var t;return!((t=this.Ls)==null||!t.isStarted)}get status(){var t,e;return this.Fs===Gc||this.Fs===jh?this.Fs:(t=(e=this.Ls)==null?void 0:e.status)!==null&&t!==void 0?t:this.Fs}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Fs=SE,this.As=void 0,this._instance=t,!this._instance.sessionManager)throw Pi.error("started without valid sessionManager"),new Error(Py+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===zi)throw new Error(Py+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ds(){var t,e=!((t=this._instance.get_property(za))==null||!t.enabled),n=!this.Se.disable_session_recording,r=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return te&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this.Ds||(e=this.Ls)==null||!e.isStarted){var n=!be(Object.assign)&&!be(Array.from);this.Ds&&n?(this.$s(t),Pi.info("starting")):(this.Fs=SE,this.stopRecording())}}$s(t){var e,n,r;this.Ds&&(this.Fs!==Gc&&this.Fs!==jh&&(this.Fs=EE),$e!=null&&(e=$e.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=$e.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Ns(t):(r=$e.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.qs,(s=>{if(s)return Pi.error("could not load recorder",s);this.Ns(t)})))}stopRecording(){var t,e;(t=this.As)==null||t.call(this),this.As=void 0,(e=this.Ls)==null||e.stop()}Bs(){var t,e;(t=this.As)==null||t.call(this),this.As=void 0,(e=this.Ls)==null||e.discard()}js(){var t,e;(t=this.ti)==null||t.unregister(n2),(e=this.ti)==null||e.unregister(q8)}Hs(t,e){if(Ye(t))return null;var n,r=$n(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Pi.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Us(t){if(this.ti){var e,n,r=this.ti,s=()=>{var i,a=t.sessionRecording===!1?void 0:t.sessionRecording,u=this.Hs((i=this.Se.session_recording)==null?void 0:i.sampleRate,"session_recording.sampleRate"),c=this.Hs(a==null?void 0:a.sampleRate,"remote config sampleRate"),f=u??c;Ye(f)&&this.js();var h=a==null?void 0:a.minimumDurationMilliseconds;r.register({[za]:pe({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:pe({capturePerformance:t.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:f,minimumDurationMilliseconds:be(h)?null:h,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers,version:a==null?void 0:a.version,triggerGroups:a==null?void 0:a.triggerGroups})})};s(),(e=this.As)==null||e.call(this),this.As=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.Us(t),void this.Bs()):(this.Us(t),void this.startIfEnabledOrStop()):(this.Fs===Gc&&(this.Fs=jh,Pi.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.Ls)!=null&&n.log?this.Ls.log(t,e):Pi.warn("log called before recorder was ready")}get qs(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(za);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}zs(){var t,e,n=this._instance.get_property(za);if(!n)return!1;try{e=typeof n=="object"?n:JSON.parse(n)}catch(s){return Pi.warn("persisted remote config for session recording is invalid and will be ignored",s),!1}var r=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-r}Ns(t){var e,n;if((e=$e.__PosthogExtensions__)==null||!e.initSessionRecording)return Pi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[r6]:!0});if(this.Ls||(this.Ls=(n=$e.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Ls._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.zs())return this.Fs===jh||this.Fs===Gc?void 0:(this.Fs=Gc,Pi.info("persisted remote config is stale, requesting fresh config before starting"),void new T6(this._instance).load());this.Fs=EE,this.Ls.start(t)}onRRwebEmit(t){var e;(e=this.Ls)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Ls||(e=this.ti)==null||e.register({[X8]:!0}),(t=this.Ls)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Ls||(e=this.ti)==null||e.register({[Y8]:!0}),(t=this.Ls)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.Ls||(n=this.ti)==null||n.register({[t==="url"?Q8:J8]:!0}),(e=this.Ls)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Ls)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.Ls)==null||!n.tryAddCustomEvent(t,e))}}},FN={autocapture:class{constructor(t){this.Vs=!1,this.Ws=null,this.Gs=!1,this.instance=t,this.rageclicks=new xE(t.config.rageclick),this.Zs=null}initialize(){this.startIfEnabled()}get Se(){var t,e,n=Ot(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map((r=>new RegExp(r))),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map((r=>new RegExp(r))),n}Qs(){if(this.isBrowserSupported()){if(te&&Ee){var t=n=>{n=n||(te==null?void 0:te.event);try{this.Js(n)}catch(r){kv.error("Failed to capture event",r)}};if($t(Ee,"submit",t,{capture:!0}),$t(Ee,"change",t,{capture:!0}),$t(Ee,"click",t,{capture:!0}),this.Se.capture_copied_text){var e=n=>{n=n||(te==null?void 0:te.event);try{this.Js(n,Ev)}catch(r){kv.error("Failed to capture copy/cut event",r)}};$t(Ee,"copy",e,{capture:!0}),$t(Ee,"cut",e,{capture:!0})}}}else kv.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Vs&&(this.Qs(),this.Vs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Gs=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[J1]:!!t.autocapture_opt_out}),this.Ws=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Zs=t}getElementSelectors(t){var e,n=[];return(e=this.Zs)==null||e.forEach((r=>{var s=Ee==null?void 0:Ee.querySelectorAll(r);s==null||s.forEach((i=>{t===i&&n.push(r)}))})),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[J1];if(ar(this.Ws)&&!ai(n)&&!this.instance.Er())return!1;var r=(e=this.Ws)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}Js(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=gv(t);a6(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&XS(r,this.instance.config.rageclick)&&this.Js(t,"$rageclick");var s=e===Ev;if(r&&(function(p,v,y,x,_,b){var E,C,P,T,A,O;if(y===void 0&&(y=void 0),!te||a2(p)||(E=y)!=null&&E.url_allowlist&&!ZS(y.url_allowlist,b)||(C=y)!=null&&C.url_ignorelist&&ZS(y.url_ignorelist,b))return!1;if((P=y)!=null&&P.dom_event_allowlist){var M=y.dom_event_allowlist;if(M&&!M.some((V=>v.type===V)))return!1}var{parentIsUsefulElement:R,targetElementList:L}=f6(p,x);if(!(function(V,G){var Y=G==null?void 0:G.element_allowlist;if(be(Y))return!0;var K,B=function($){if(Y.some((ee=>$.tagName.toLowerCase()===ee)))return{v:!0}};for(var X of V)if(K=B(X))return K.v;return!1})(L,y)||!vy(L,(T=y)==null?void 0:T.css_selector_allowlist)||vy(L,(A=(O=y)==null?void 0:O.css_selector_ignorelist)!==null&&A!==void 0?A:FO))return!1;try{var N=te.getComputedStyle(p);if(N&&N.getPropertyValue("cursor")==="pointer"&&v.type==="click")return!0}catch{}var j=p.tagName.toLowerCase();switch(j){case"html":return!1;case"form":return(_||["submit"]).indexOf(v.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(v.type)>=0;default:return R?(_||["click"]).indexOf(v.type)>=0:(_||["click"]).indexOf(v.type)>=0&&(o2.indexOf(j)>-1||p.getAttribute("contenteditable")==="true")}})(r,t,this.Se,s,s?["copy","cut"]:void 0,this.instance)){var{props:i,explicitNoCapture:a}=TN(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Gs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(a)return!1;var u=this.getElementSelectors(r);if(u&&u.length>0&&(i.$element_selectors=u),e===Ev){var c,f=u6(te==null||(c=te.getSelection())==null?void 0:c.toString()),h=t.type||"clipboard";if(!f)return!1;i.$selected_content=f,i.$copy_type=h}return this.instance.capture(e,i),!0}}}isBrowserSupported(){return Ts(Ee==null?void 0:Ee.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ks=(te==null||(e=te.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(_e.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ys&&this.Ys(),this.Ys=void 0,_e.info("History API monitoring stopped")}monitorHistoryChanges(){te&&te.history&&(this.Xs("pushState"),this.Xs("replaceState"),this.eo())}Xs(t){var e;if(te&&((e=te.history[t])==null||!e.__posthog_wrapped__)){var n=this;(function(r,s,i){try{if(!(s in r))return wE;var a={next:r[s]},u=i((function(){for(var c=arguments.length,f=new Array(c),h=0;c>h;h++)f[h]=arguments[h];return a.next.apply(this,f)}));return Ts(u)&&(u.prototype=u.prototype||{},Object.defineProperties(u,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),r[s]=u,()=>{if(r[s]!==u)for(var c=r[s];Ts(c)&&c.__posthog_layer__;){var f=c.__posthog_layer__;if(f.next===u)return void(f.next=a.next);c=f.next}else r[s]=a.next}}catch{return wE}})(te.history,t,(r=>function(s,i,a){r.call(this,s,i,a),n.ro(t)}))}}ro(t){try{var e,n=te==null||(e=te.location)==null?void 0:e.pathname;if(!n)return;n!==this.Ks&&this.isEnabled&&this._instance.capture(Yl,{navigation_type:t}),this.Ks=n}catch(r){_e.error("Error capturing "+t+" pageview",r)}}eo(){if(!this.Ys){var t=()=>{this.ro("popstate")};$t(te,"popstate",t),this.Ys=()=>{te&&te.removeEventListener("popstate",t)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.io=!1,this.Vs=!1,this.no=null,this.instance=t,this.io=!((e=this.instance.persistence)==null||!e.props[ey]),this.rageclicks=new xE(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Ot(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Ye(this.Se.capture_heatmaps)?Ye(this.Se.enable_heatmaps)?this.io:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Vs)return;RN.info("starting..."),this.so(),this.ke()}else{var t;clearInterval((t=this.no)!==null&&t!==void 0?t:void 0),this.oo(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ey]:e}),this.io=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}ao(t){this.fe(t.originalEvent,"deadclick")}ke(){this.no&&clearInterval(this.no),this.no=(Ee==null?void 0:Ee.visibilityState)==="visible"?setInterval(this.zr.bind(this),this.flushIntervalMilliseconds):null}so(){te&&Ee&&(this.lo=this.zr.bind(this),$t(te,Jp,this.lo),this.uo=t=>this.fe(t||(te==null?void 0:te.event)),$t(Ee,"click",this.uo,{capture:!0}),this.ho=t=>this.do(t||(te==null?void 0:te.event)),$t(Ee,"mousemove",this.ho,{capture:!0}),this.co=new eE(this.instance,GO,this.ao.bind(this)),this.co.startIfEnabledOrStop(),this.vo=this.ke.bind(this),$t(Ee,Qp,this.vo),this.Vs=!0)}oo(){var t;te&&Ee&&(this.lo&&te.removeEventListener(Jp,this.lo),this.uo&&Ee.removeEventListener("click",this.uo,{capture:!0}),this.ho&&Ee.removeEventListener("mousemove",this.ho,{capture:!0}),this.vo&&Ee.removeEventListener(Qp,this.vo),clearTimeout(this.fo),(t=this.co)==null||t.stop(),this.Vs=!1)}po(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=(function(a,u,c){for(var f=a;f&&Go(f)&&!Vr(f,"body");){if(f===c)return!1;var h=void 0;try{var p,v,y;h=(p=(v=(y=f.ownerDocument)==null?void 0:y.defaultView)!==null&&v!==void 0?v:te)==null?void 0:p.getComputedStyle(f).position}catch{return!1}if(Be(u,h))return!0;f=c6(f)}return!1})(gv(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:r),y:t.clientY+(i?0:n),target_fixed:i,type:e}}fe(t,e){var n;if(e===void 0&&(e="click"),!KS(t.target)&&kE(t)){var r=this.po(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&XS(gv(t),this.instance.config.rageclick)&&this.kt(pe({},r,{type:"rageclick"})),this.kt(r)}}do(t){!KS(t.target)&&kE(t)&&(clearTimeout(this.fo),this.fo=setTimeout((()=>{this.kt(this.po(t,"mousemove"))}),500))}kt(t){if(te){var e=this.Se.disable_capture_url_hashes?Wo(te.location.href):te.location.href,n=this.Se.custom_personal_data_properties,r=this.Se.mask_personal_data_properties?[...Mu,...n||[]]:[],s=Ld(e,r,Od);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}zr(){this.R&&!Do(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:eE,webVitalsAutocapture:class{constructor(t){var e;this.io=!1,this.Vs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.mo=()=>{clearTimeout(this.yo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,r)=>pe({},n,{["$web_vitals_"+r.name+"_event"]:pe({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.bo=n=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._o();if(!be(s))if(Ye(n==null?void 0:n.name)||Ye(n==null?void 0:n.value))Ea.error("Invalid metric received",n);else if(!this.wo||this.wo>n.value){this.R.url!==s&&(this.mo(),this.yo=setTimeout(this.mo,this.flushToCaptureTimeoutMs)),be(this.R.url)&&(this.R.url=s),this.R.firstMetricTimestamp=be(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var i=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),a=pe({},n,{$current_url:s,timestamp:Date.now()});be(i)||(a.$session_id=i.sessionId,a.$window_id=i.windowId),this.R.metrics.push(a),this.R.metrics.length===this.allowedMetrics.length&&this.mo()}else Ea.error("Ignoring metric with value >= "+this.wo,n)},this.xo=()=>{if(!this.Vs){var n,r,s,i,a=$e.__PosthogExtensions__;be(a)||be(a.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:s,onINP:i}=a.postHogWebVitalsCallbacks),n&&r&&s&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.bo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.bo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.bo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.bo.bind(this)),this.Vs=!0):Ea.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.io=!((e=this._instance.persistence)==null||!e.props[sy]),this.startIfEnabled()}get ko(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=Ot(this.ko)?(t=this.ko)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Ye(n)?((e=this._instance.persistence)==null?void 0:e.props[iy])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ot(this.ko)?this.ko.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Ot(this.ko)?this.ko.web_vitals_attribution:void 0;return t!=null&&t}get wo(){var t=Ot(this.ko)&&$n(this.ko.__web_vitals_max_value)?this.ko.__web_vitals_max_value:bE;return t>0&&6e4>=t?bE:t}get isEnabled(){var t=on==null?void 0:on.protocol;if(t!=="http:"&&t!=="https:")return Ea.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Ot(this.ko)?this.ko.web_vitals:ai(this.ko)?this.ko:void 0;return ai(e)?e:this.io}startIfEnabled(){this.isEnabled&&!this.Vs&&(Ea.info("enabled, starting..."),this.Bt(this.xo))}onRemoteConfig(t){if("capturePerformance"in t){var e=Ot(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=Ot(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[sy]:e}),this._instance.persistence.register({[iy]:n})),this.io=e,this.startIfEnabled()}}Bt(t){var e,n;(e=$e.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=$e.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?Ea.error("failed to load script",r):t()}))}_o(){var t=te?this._instance.config.disable_capture_url_hashes?Wo(te.location.href):te.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Mu,...e||[]]:[];return Ld(t,n,Od)}Ea.error("Could not determine current URL")}}},VN={exceptionObserver:class{constructor(t){var e,n,r;this.xo=()=>{var s;if(te&&this.isEnabled&&(s=$e.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var i=$e.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$e.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,u=$e.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.So&&this.Se.capture_unhandled_errors&&(this.So=i(this.captureException.bind(this))),!this.Co&&this.Se.capture_unhandled_rejections&&(this.Co=a(this.captureException.bind(this))),!this.Io&&this.Se.capture_console_errors&&(this.Io=u(this.captureException.bind(this)))}catch(c){Wc.error("failed to start",c),this.To()}}},this._instance=t,this.Mo=!((e=this._instance.persistence)==null||!e.props[ty]),this.Eo=new $L({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Ae:Wc}),this.Se=this.Po(),this.startIfEnabledOrStop()}Po(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ot(t)?e=pe({},e,t):(be(t)?this.Mo:t)&&(e=pe({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Wc.info("enabled"),this.To(),this.Bt(this.xo)):this.To()}Bt(t){var e,n;(e=$e.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(n=$e.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return Wc.error("failed to load script",r);t()}))}To(){var t,e,n;(t=this.So)==null||t.call(this),this.So=void 0,(e=this.Co)==null||e.call(this),this.Co=void 0,(n=this.Io)==null||n.call(this),this.Io=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Mo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[ty]:this.Mo}),this.Se=this.Po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.Po()}captureException(t){var e,n,r,s=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.Eo.consumeRateLimit(s)?Wc.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Ro=[],this.Oo=new rO([new dO,new xO,new hO,new fO,new yO,new vO,new mO,new _O],(function(r){for(var s=arguments.length,i=new Array(s>1?s-1:0),a=1;s>a;a++)i[a-1]=arguments[a];return function(u,c){c===void 0&&(c=0);for(var f=[],h=u.split(`
|
|
18
18
|
`),p=c;h.length>p;p++){var v=h[p];if(1024>=v.length){var y=US.test(v)?v.replace(US,"$1"):v;if(!y.match(/\S*Error: /)){for(var x of i){var _=x(y,r);if(_){f.push(_);break}}if(f.length>=50)break}}}return(function(b){if(!b.length)return[];var E=Array.from(b);return E.reverse(),E.slice(0,50).map((C=>{return pe({},C,{filename:C.filename||(P=E,P[P.length-1]||{}).filename,function:C.function||Ru});var P}))})(f)}})("web:javascript",aO,cO)),this._instance=t,this.Ro=(e=(n=this._instance.persistence)==null?void 0:n.get_property(ny))!==null&&e!==void 0?e:[],this.Lo=Kp(this.Fo()),this.Ao=new bO(this.Lo)}onConfigChange(){this.Lo=Kp(this.Fo()),this.Ao.setConfig(this.Lo)}onRemoteConfig(t){var e,n,r;if("errorTracking"in t){var s=(e=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],i=(r=t.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Ro=s,this._instance.persistence&&this._instance.persistence.register({[ny]:this.Ro,[ry]:i})}}get Do(){var t,e=!!this._instance.get_property(ry),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.Oo.buildFromUnknown(t,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}addExceptionStep(t,e){if(this.Lo.enabled)try{if(!_t(t)||t.trim().length===0)return void Ti.warn("Ignoring exception step because message must be a non-empty string");var n=this.$o(e),{sanitizedProperties:r,droppedKeys:s}=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(i).reduce(((u,c)=>wO.has(c)?(a.push(c),u):(u[c]=i[c],u)),{}),droppedKeys:a}})(n);s.length>0&&Ti.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Ao.add(pe({[Wp]:t,[Gp]:new Date().toISOString()},r))}catch(i){Ti.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.No(e)){if(this.qo(e))return this.Bo("Exception dropped: matched a suppression rule"),void Ti.info("Skipping exception capture because a suppression rule matched");if(!this.Do&&this.jo(e))return this.Bo("Exception dropped: thrown by a browser extension"),void Ti.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Ho(e))return this.Bo("Exception dropped: thrown by the PostHog SDK"),void Ti.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.Lo.enabled&&Ye(t.$exception_steps)?this.Uo(t):t;try{var r=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",an:!0});return r&&this.Ao.clear(),r}catch(s){return Ti.error("Failed to capture exception event. Dropping this exception.",s),void this.Ao.clear()}}catch(s){return void Ti.error("Failed to process exception event. Ignoring this exception.",s)}}Uo(t){try{var e=this.Ao.getAttachable();return e.length===0?t:pe({},t,{$exception_steps:e})}catch(n){return Ti.error("Failed to read buffered exception steps. Capturing exception without steps.",n),t}}Bo(t){this.Lo.enabled&&this.Ao.add({[Wp]:t,[Gp]:new Date().toISOString()})}$o(t){return Ot(t)?pe({},t):{}}Fo(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}qo(t){if(t.length===0)return!1;var e=t.reduce(((n,r)=>{var{type:s,value:i}=r;return _t(s)&&s.length>0&&n.$exception_types.push(s),_t(i)&&i.length>0&&n.$exception_values.push(i),n}),{$exception_types:[],$exception_values:[]});return this.Ro.some((n=>{var r=n.values.map((s=>{var i,a=V6[s.operator],u=tt(s.value)?s.value:[s.value],c=(i=e[s.key])!==null&&i!==void 0?i:[];return u.length>0&&a(u,c)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}jo(t){return t.flatMap((e=>{var n,r;return(n=(r=e.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}Ho(t){if(t.length>0){var e,n,r,s,i=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],a=i[i.length-1];return(r=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}No(t){return!Ye(t)&&tt(t)}}},$N=pe({productTours:class{get ti(){return this._instance.persistence}constructor(t){this.zo=null,this.Vo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,n;if(this.ti&&this.ti.register({[t2]:!!t.productTours}),!Tv(this._instance))return!this.zo&&Ye((e=this.ti)==null?void 0:e.props[id])||Pv.info("product tours disabled; stopping and clearing cached tours"),(n=this.zo)==null||n.stop(),this.zo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.zo&&Tv(this._instance)&&this.Bt((()=>this.Wo()))}Bt(t){var e,n;(e=$e.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=$e.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?Pv.error("Could not load product tours script",r):t()}))}Wo(){var t;!this.zo&&(t=$e.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.zo=$e.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!tt(this.Vo)||e){var n=this.ti;if(n){var r=n.props[id];if(tt(r)&&!e)return this.Vo=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{if(Tv(this._instance)){var i=s.statusCode;if(i!==200||!s.json){var a="Product Tours API could not be loaded, status: "+i;return Pv.error(a),void t([],{isLoaded:!1,error:a})}var u=tt(s.json.product_tours)?s.json.product_tours:[];this.Vo=u,n&&n.register({[id]:u}),t(u,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Vo,{isLoaded:!0})}getActiveProductTours(t){Ye(this.zo)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.zo.getActiveProductTours(t)}showProductTour(t){var e;(e=this.zo)==null||e.showTourById(t)}previewTour(t){this.zo?this.zo.previewTour(t):this.Bt((()=>{var e;this.Wo(),(e=this.zo)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.zo)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.zo)==null||t.nextStep()}previousStep(){var t;(t=this.zo)==null||t.previousStep()}clearCache(){var t;this.Vo=null,(t=this.ti)==null||t.unregister(id)}resetTour(t){var e;(e=this.zo)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.zo)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.zo)==null||e.cancelPendingTour(t)}}},Um),HN={siteApps:class{constructor(t){this.Go=0,this._instance=t,this.Zo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qo(t,e){if(e){var n=this.globalsForEvent(e);this.Zo.push(n),this.Zo.length>1e3&&(this.Zo=this.Zo.slice(10))}}get siteAppLoaders(){var t;return(t=$e._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Qo.bind(this));this.Jo=()=>{t(),this.Zo=[],this.Jo=void 0}}}globalsForEvent(t){var e,n,r,s,i,a,u;if(!t)throw new Error("Event payload is required");var c={},f=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[p,v]of Object.entries(h))c[p]={id:f[p],type:p,properties:v};var{$set_once:y,$set:x}=t;return{event:pe({},g8(t,IN),{properties:pe({},t.properties,x?{$set:pe({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},x)}:{},y?{$set_once:pe({},(r=(s=t.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},y)}:{}),elements_chain:(i=(a=t.properties)==null?void 0:a.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(u=t.properties)==null?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}Ko(t){var e,n=(e=t.tagName)==null?void 0:e.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Ws.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)||(Ws.error("prepare_external_dependency_script returned null"),null):t}Yo(){var t,e,n,r,s,i,a,u;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var c=Ee==null?void 0:Ee.defaultView,f=c==null||(t=c.Node)==null?void 0:t.prototype;if(!c||!f)return()=>{};if(this.Go++,this.Xo)return this.ea();var h=[],p=this,v=new WeakSet,y=(b,E,C)=>{if(b!=null&&b[E]){var P=b[E];b[E]=C(P),h.push((()=>{b[E]=P}))}},x=b=>{if(v.has(b))return b;var E=p.Ko(b);return E&&v.add(E),E},_=b=>b.map((E=>typeof E=="string"?E:x(E))).filter((E=>!ar(E)));return y(f,"appendChild",(b=>function(E){var C=x(E);return C?b.call(this,C):E})),y(f,"insertBefore",(b=>function(E,C){var P=x(E);return P?b.call(this,P,C):E})),y(f,"replaceChild",(b=>function(E,C){var P=x(E);return P?b.call(this,P,C):C})),[(e=c.Element)==null?void 0:e.prototype,(n=c.Document)==null?void 0:n.prototype,(r=c.DocumentFragment)==null?void 0:r.prototype].forEach((b=>{y(b,"append",(E=>function(){for(var C=arguments.length,P=new Array(C),T=0;C>T;T++)P[T]=arguments[T];return E.apply(this,_(P))})),y(b,"prepend",(E=>function(){for(var C=arguments.length,P=new Array(C),T=0;C>T;T++)P[T]=arguments[T];return E.apply(this,_(P))}))})),[(s=c.Element)==null?void 0:s.prototype,(i=c.CharacterData)==null?void 0:i.prototype,(a=c.DocumentType)==null?void 0:a.prototype].forEach((b=>{y(b,"before",(E=>function(){for(var C=arguments.length,P=new Array(C),T=0;C>T;T++)P[T]=arguments[T];return E.apply(this,_(P))})),y(b,"after",(E=>function(){for(var C=arguments.length,P=new Array(C),T=0;C>T;T++)P[T]=arguments[T];return E.apply(this,_(P))})),y(b,"replaceWith",(E=>function(){for(var C=arguments.length,P=new Array(C),T=0;C>T;T++)P[T]=arguments[T];var A=_(P);return P.length&&!A.length?void 0:E.apply(this,A)}))})),y((u=c.Element)==null?void 0:u.prototype,"insertAdjacentElement",(b=>function(E,C){var P=x(C);return P?b.call(this,E,P):null})),this.Xo=()=>{h.forEach((b=>b())),this.Xo=void 0},this.ea()}ea(){var t=!1;return()=>{var e;t||(t=!0,this.Go--,this.Go===0&&((e=this.Xo)==null||e.call(this)))}}ta(t,e){e===void 0&&(e=!0);var n=this.Yo();try{var r=t(n);return e&&n(),r}catch(s){throw n(),s}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var a;!e.errored&&this.Zo.length&&(Ws.info("Processing "+this.Zo.length+" events for site app with id "+t.id),this.Zo.forEach((u=>this.ta((()=>e.processEvent==null?void 0:e.processEvent(u))))),e.processedBuffer=!0),Object.values(this.apps).every((u=>u.processedBuffer||u.errored))&&((a=this.Jo)==null||a.call(this))},r=!1,s=a=>{e.errored=!a,e.loaded=!0,Ws.info("Site app with id "+t.id+" "+(a?"loaded":"errored")),r&&n()};try{var{processEvent:i}=this.ta((a=>t.init({posthog:this._instance,callback(u){a(),s(u)}})),!1);i&&(e.processEvent=i),r=!0}catch(a){Ws.error(CE+t.id,a),s(!1)}if(r&&e.loaded)try{n()}catch(a){Ws.error("Error while processing buffered events PostHog app with config id "+t.id,a),e.errored=!0}}ra(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}ia(t){var e=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t),r=function(i){try{e.ta((()=>i.processEvent==null?void 0:i.processEvent(n)))}catch(a){Ws.error("Error while processing event "+t.event+" for site app "+i.id,a)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,n,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.ra(),void this._instance.on("eventCaptured",(c=>this.ia(c)))):void Ws.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Jo)==null||n.call(this),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var i=function(c){var f;$e["__$$ph_site_app_"+c]=s._instance,(f=$e.__PosthogExtensions__)==null||f.loadSiteApp==null||f.loadSiteApp(s._instance,u,(h=>{if(h)return Ws.error(CE+c,h)}))};for(var{id:a,url:u}of t.siteApps)i(a)}else Ws.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},zN={tracingHeaders:class{constructor(t){this.na=void 0,this.sa=void 0,this.oa=void 0,this.xo=()=>{var e,n,r=this.aa();r?(be(this.na)&&(this.na=(e=$e.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),be(this.sa)&&(this.sa=(n=$e.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.To()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Bt(t){var e,n;(e=$e.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(n=$e.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return AN.error("failed to load script",r);t()}))}la(){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}aa(){var t=this.la();return tt(t)?(tt(this.oa)?this.oa.splice(0,this.oa.length,...t):this.oa=[...t],t.length>0?this.oa:void 0):(tt(this.oa)&&this.oa.splice(0),this.oa=t||void 0,this.oa)}To(){var t,e;(t=this.na)==null||t.call(this),(e=this.sa)==null||e.call(this),this.na=void 0,this.sa=void 0}startIfEnabledOrStop(){this.aa()?this.Bt(this.xo):this.To()}}},UN=pe({surveys:class{get Se(){return this._instance.config}constructor(t){this.ua=void 0,this._surveyManager=null,this.ha=!1,this.da=[],this.ca=null,this.va=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Se.disable_surveys){var e=t.surveys;if(Ye(e))return yt.warn("Flags not loaded yet. Not loading surveys.");var n=tt(e);this.ua=n?e.length>0:e,yt.info("flags response received, isSurveysEnabled: "+this.ua),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(Cy)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((s=>localStorage.removeItem(s)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.ha)yt.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)yt.info(PE);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())yt.info("Not loading surveys in cookieless mode without consent.");else{var t=$e==null?void 0:$e.__PosthogExtensions__;if(t){if(!be(this.ua)||this.Se.advanced_enable_surveys){var e=this.ua||this.Se.advanced_enable_surveys;this.ha=!0;try{var n=t.generateSurveys;if(n)return void this.fa(n,e);var r=t.loadExternalDependency;if(!r)return void this.pa(r2);r(this._instance,"surveys",(s=>{s||!t.generateSurveys?this.pa("Could not load surveys script",s):this.fa(t.generateSurveys,e)}))}catch(s){throw this.pa("Error initializing surveys",s),s}finally{this.ha=!1}}}else yt.error("PostHog Extensions not found.")}}fa(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new ON(this._instance),yt.info("Surveys loaded successfully"),this.ga({isLoaded:!0})}pa(t,e){yt.error(t,e),this.ga({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.da.push(t),this._surveyManager&&this.ga({isLoaded:!0}),()=>{this.da=this.da.filter((e=>e!==t))}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Se.disable_surveys)return yt.info(PE),t([]);var n,r=this._instance.get_property(ly);if(r&&!e)return t(r,{isLoaded:!0}),void(this.ma()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.ca?this.ca.then((s=>{var{surveys:i,context:a}=s;return t(i,a)})):(typeof Promise<"u"&&(this.ca=new Promise((s=>{n=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:s=>{var i;this.ca=null;var a=s.statusCode;if(a!==200||!s.json){var u="Surveys API could not be loaded, status: "+a;yt.error(u),this.va=Date.now();var c={isLoaded:!1,error:u};return t([],c),void(n==null||n({surveys:[],context:c}))}this.va=null;var f,h=s.json.surveys||[],p=h.filter((y=>(function(x){return!(!x.start_date||x.end_date)})(y)&&((function(x){var _;return!((_=x.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)})(y)||(function(x){var _;return!((_=x.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)})(y))));p.length>0&&((f=this._surveyEventReceiver)==null||f.register(p)),(i=this._instance.persistence)==null||i.register({[ly]:h,[qp]:Date.now()});var v={isLoaded:!0};t(h,v),n==null||n({surveys:h,context:v})}}))}ma(){return this.ya()&&!this.ca&&!this.ba()}ya(){var t=this._instance.get_property(qp);return $n(t)&&Date.now()-t>3e5}ba(){return $n(this.va)&&3e5>Date.now()-this.va}markSurveyAsSeen(t,e){var n,r={id:t,current_iteration:(n=e==null?void 0:e.iteration)!==null&&n!==void 0?n:null};H6(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ga(t){for(var e of this.da)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(n){yt.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!Ye(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);yt.warn("init was not called")}_a(t){var e=null;return this.getSurveys((n=>{var r;e=(r=n.find((s=>s.id===t)))!==null&&r!==void 0?r:null})),e}wa(t){if(Ye(this._surveyManager))return{eligible:!1,reason:Av};var e=typeof t=="string"?this._a(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ye(this._surveyManager))return yt.warn("init was not called"),{visible:!1,disabledReason:Av};var e=this.wa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Ye(this._surveyManager)?(yt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Av})):new Promise((n=>{this.getSurveys((r=>{var s,i=(s=r.find((u=>u.id===t)))!==null&&s!==void 0?s:null;if(i){var a=this.wa(i);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,n){var r;if(Ye(this._surveyManager))yt.warn("init was not called");else{var s=typeof t=="string"?this._a(t):t;if(s!=null&&s.id)if(xN.includes(s.type)){var i=Ee==null?void 0:Ee.querySelector(e);if(i)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(yt.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,u;yt.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.renderSurvey(s,i,n),yt.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,i,n);yt.warn("Survey element not found")}else yt.warn("Surveys of type "+s.type+" cannot be rendered in the app");else yt.warn("Survey not found")}}displaySurvey(t,e){var n;if(Ye(this._surveyManager))yt.warn("init was not called");else{var r=this._a(t);if(r){var s=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=pe({},r,{appearance:pe({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==_y.Popover&&e.initialResponses&&yt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var i=this.canRenderSurvey(r);if(!i.visible)return void yt.warn("Survey is not eligible to be displayed: ",i.disabledReason)}e.displayType!==_y.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else yt.warn("Survey not found")}}cancelPendingSurvey(t){Ye(this._surveyManager)?yt.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}},Um),BN={toolbar:class{constructor(t){this.instance=t}xa(t){$e.ph_toolbar_state=t}ka(){var t;return(t=$e.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),s6(this.instance.config)||!te||!Ee)return!1;t=t??te.location,n=n??te.history;try{if(!e){try{te.localStorage.setItem("test","test"),te.localStorage.removeItem("test")}catch{return!1}e=te==null?void 0:te.localStorage}var r,s=NN||nm(t.hash,"__posthog")||nm(t.hash,"state"),i=s?WS((()=>JSON.parse(atob(decodeURIComponent(s)))))||WS((()=>JSON.parse(decodeURIComponent(s)))):null;return i&&i.action==="ph_authorize"?((r=i).source="url",r&&Object.keys(r).length>0&&(i.desiredHash?t.hash=i.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(TE)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Sa(t){var e=$e.ph_load_toolbar||$e.ph_load_editor;!Ye(e)&&Ts(e)?e(t,this.instance):AE.warn("No toolbar load function found")}loadToolbar(t){var e=!(Ee==null||!Ee.getElementById(e6));if(!te||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=pe({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(te.localStorage.setItem(TE,JSON.stringify(pe({},r,{source:void 0}))),this.ka()===2)this.Sa(r);else if(this.ka()===0){var s;this.xa(1),(s=$e.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(i=>{if(i)return AE.error("[Toolbar] Failed to load",i),void this.xa(0);this.xa(2),this.Sa(r)})),$t(te,"turbolinks:load",(()=>{this.xa(0),this.loadToolbar(r)}))}return!0}Ca(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},WN=pe({experiments:Kn},Um),GN={conversations:class{constructor(t){this.Ia=void 0,this._conversationsManager=null,this.Ta=!1,this.Ma=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;Ye(e)||(ai(e)?this.Ia=e:(this.Ia=e.enabled,this.Ma=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Ia=void 0,this.Ma=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ta||this._instance.config.disable_conversations||s6(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=$e==null?void 0:$e.__PosthogExtensions__;if(t&&!be(this.Ia)&&this.Ia)if(this.Ma&&this.Ma.token){this.Ta=!0;try{var e=t.initConversations;if(e)return this.Ea(e),void(this.Ta=!1);var n=t.loadExternalDependency;if(!n)return void this.Pa(r2);n(this._instance,"conversations",(r=>{r||!t.initConversations?this.Pa("Could not load conversations script",r):this.Ea(t.initConversations),this.Ta=!1}))}catch(r){this.Pa("Error initializing conversations",r),this.Ta=!1}}else rs.error("Conversations enabled but missing token in remote config.")}}Ea(t){if(this.Ma)try{this._conversationsManager=t(this.Ma,this._instance),rs.info("Conversations loaded successfully")}catch(e){this.Pa("Error completing conversations initialization",e)}else rs.error("Cannot complete initialization: remote config is null")}Pa(t,e){rs.error(t,e),this._conversationsManager=null,this.Ta=!1}show(){this._conversationsManager?this._conversationsManager.show():rs.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ia===!0&&!ar(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var r=this;return en((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,n):(rs.warn(Ca),null)}))()}getMessages(t,e){var n=this;return en((function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(rs.warn(Ca),null)}))()}markAsRead(t){var e=this;return en((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(rs.warn(Ca),null)}))()}getTickets(t){var e=this;return en((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(rs.warn(Ca),null)}))()}requestRestoreLink(t){var e=this;return en((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(rs.warn(Ca),null)}))()}restoreFromToken(t){var e=this;return en((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(rs.warn(Ca),null)}))()}restoreFromUrlToken(){var t=this;return en((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(rs.warn(Ca),null)}))()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}vn(){var t;(t=this._conversationsManager)==null||t.setIdentity()}fn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},KN={logs:class{constructor(t){var e;this.Ra=!1,this.Oa=!1,this.Ae=Dt("[logs]"),this.Or=[],this.La=[],this.ys=0,this.Fa=()=>{var n,r;this.ys=0,(n=this.Aa)==null||n.onReconnect(),(r=this.Da)==null||r.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Ra=!0),te&&$t(te,"online",this.Fa)}$a(t,e,n,r){var s,i=(function(a,u){var c,f,h,p,v,y,x,_=(c=a==null?void 0:a.flushIntervalMs)!==null&&c!==void 0?c:3e3,b=(f=a==null?void 0:a.maxBufferSize)!==null&&f!==void 0?f:100,E=u!=null&&u.consoleCapture?void 0:(h=a==null?void 0:a.maxLogsPerInterval)!==null&&h!==void 0?h:1e3,C=be(E)?Math.max(b,2048):Math.max(b,E),P=a==null?void 0:a.resourceAttributes;return{serviceName:(p=(v=P==null?void 0:P["service.name"])!==null&&v!==void 0?v:a==null?void 0:a.serviceName)!==null&&p!==void 0?p:u==null?void 0:u.serviceNameDefault,serviceVersion:(y=P==null?void 0:P["service.version"])!==null&&y!==void 0?y:a==null?void 0:a.serviceVersion,environment:(x=P==null?void 0:P["deployment.environment"])!==null&&x!==void 0?x:a==null?void 0:a.environment,resourceAttributes:P,beforeSend:a==null?void 0:a.beforeSend,flushIntervalMs:_,maxBufferSize:b,maxQueueSize:C,maxBatchRecordsPerPost:100,rateCapWindowMs:_,maxLogsPerInterval:E,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((s=this._instance)==null||(s=s.config)==null?void 0:s.logs,n);return[new eO(this.Na(t,e),i,this.Ae,(()=>this.qa()),(a=>a()),void 0,r),i]}Ba(){var t,e,n=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;return this.Aa&&this.ja===n||((e=this.Aa)==null||e.reset(),this.ja=n,[this.Aa,this.Ha]=this.$a((()=>this.Or),(r=>{this.Or=r}))),this.Aa}Ua(){var t,e,n=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;return this.Da&&this.za===n||((e=this.Da)==null||e.reset(),this.za=n,[this.Da,this.Va]=this.$a((()=>this.La),(r=>{this.La=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},LE)),this.Da}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,n=(e=t.logs)==null?void 0:e.captureConsoleLogs;!Ye(n)&&n&&(this.Ra=!0,this.loadIfEnabled())}reset(){var t,e;this.Or=[],(t=this.Aa)==null||t.reset(),this.La=[],(e=this.Da)==null||e.reset(),this.ys=0}captureLog(t){this.Ba().captureLog(t)}le(t){this.Ua().captureLog(t)}get logger(){return this.Wa||(this.Wa={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.Wa}flushLogs(t){t?this.Ga(t):(this.Aa&&this.Aa.flush().catch((e=>this.Ae.error("PostHog logs flush failed:",e))),this.Da&&this.Da.flush().catch((e=>this.Ae.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.Ra&&!this.Oa){var t=$e==null?void 0:$e.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?this.Ae.error("Could not load logs script",n):(t.logs.initializeLogs(this._instance),this.Oa=!0)})):this.Ae.error(r2)}else this.Ae.error("PostHog Extensions not found.")}}Na(t,e){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===Di.LogsQueue?t():void 0,setPersistedProperty(r,s){var i;r===Di.LogsQueue&&e((i=s)!==null&&i!==void 0?i:[])},ht:r=>this.ht(r),getLibraryId:()=>Vt.LIB_NAME,getLibraryVersion:()=>Vt.LIB_VERSION}}ht(t){return new Promise((e=>{if(_6(this.ys,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,r=i=>{n||(n=!0,clearTimeout(s),e(i))},s=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Za(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:i=>{var a=i.statusCode;if(this.Qa(a),a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==429&&500>a)r({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var u;r({kind:"retry-later",error:(u=i.error)!==null&&u!==void 0?u:new Error("logs request failed with status "+a)})}}})}}))}Qa(t){(t!==0||this._instance.__loaded)&&(this.ys=x6(t,this.ys,3,(()=>this.Ae.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."))))}Ga(t){this.Or.length>0&&this.Ja(t,this.Or,this.Ha,Vt.LIB_NAME,(e=>{this.Or=e})),this.La.length>0&&this.Ja(t,this.La,this.Va,LE,(e=>{this.La=e}))}Ja(t,e,n,r,s){if(e.length!==0){var i=e.map((u=>u.record));s([]);var a=B8(i,U8(n,Vt.LIB_NAME,Vt.LIB_VERSION),r,Vt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Za(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Za(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}qa(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n,windowId:r,sessionStartTimestamp:s,lastActivityTimestamp:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n,e.windowId=r,Ye(s)||(e.sessionStartTimestamp=s),Ye(i)||(e.lastActivityTimestamp=i)}if($e!=null&&(t=$e.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Wo($e.location.href):$e.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},ZN={metrics:class{constructor(t){this.Ae=Dt("[metrics]"),this._instance=t}initialize(){}Ba(){var t,e,n,r,s,i,a,u,c,f=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.Aa&&this.ja===f||((e=this.Aa)==null||e.reset(),this.ja=f,this.Aa=new tO(this.Na(),{serviceName:(r=(c=(n=f)==null?void 0:n.resourceAttributes)==null?void 0:c["service.name"])!==null&&r!==void 0?r:n==null?void 0:n.serviceName,serviceVersion:(s=c==null?void 0:c["service.version"])!==null&&s!==void 0?s:n==null?void 0:n.serviceVersion,environment:(i=c==null?void 0:c["deployment.environment"])!==null&&i!==void 0?i:n==null?void 0:n.environment,resourceAttributes:c,beforeSend:n==null?void 0:n.beforeSend,flushIntervalMs:(a=n==null?void 0:n.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(u=n==null?void 0:n.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3},this.Ae)),this.Aa}count(t,e,n){e===void 0&&(e=1),this.Ba().count(t,e,n)}gauge(t,e,n){this.Ba().gauge(t,e,n)}histogram(t,e,n){this.Ba().histogram(t,e,n)}flush(t){if(!this.Aa)return Promise.resolve();if(t){var e=this.Aa.drainWindow();return e&&this.Tt(e,t),Promise.resolve()}return this.Aa.flush().catch((n=>this.Ae.error("PostHog metrics flush failed:",n)))}reset(){var t;(t=this.Aa)==null||t.reset()}Na(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Tt:n=>e.Tt(n),getLibraryId:()=>Vt.LIB_NAME,getLibraryVersion:()=>Vt.LIB_VERSION}}Tt(t,e){return new Promise((n=>{var r=!1,s=a=>{r||(r=!0,clearTimeout(i),n(a))},i=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(pe({method:"POST",url:this.Ka(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(a){var u=a.statusCode;if(u>=200&&300>u)s({kind:"ok"});else if(u===413)s({kind:"too-large"});else if(u!==0&&u!==429&&500>u)s({kind:"fatal",error:new Error("metrics request failed with status "+u)});else{var c;s({kind:"retry-later",error:(c=a.error)!==null&&c!==void 0?c:new Error("metrics request failed with status "+u)})}}}))}))}Ka(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},qN=pe({},Um,jN,FN,VN,$N,HN,UN,zN,BN,WN,GN,KN,ZN);as.__defaultExtensionClasses=pe({},qN);var Te=(function(){Vt.SDK_DIST_CHANNEL="npm";var t=pd[Xl]=new as;return(function(){function e(){e.done||(e.done=!0,U6=!1,bt(pd,(function(n){n._dom_loaded()})))}Ee!=null&&Ee.addEventListener?Ee.readyState==="complete"?e():$t(Ee,"DOMContentLoaded",e,{capture:!1}):te&&_e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})(),B6;function YN(t){B6=t}function Ty(){return B6}var d2=g.createContext({get client(){return Ty()},bootstrap:void 0});function W6(t,e,n){if(n===void 0&&(n=new WeakMap),t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(n.has(t)&&n.get(t)===e)return!0;n.set(t,e);var r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(var i=0,a=r;i<a.length;i++){var u=a[i];if(!s.includes(u)||!W6(t[u],e[u],n))return!1}return!0}function XN(t){var e,n,r=t.children,s=t.client,i=t.apiKey,a=t.options,u=g.useRef(null),c=g.useMemo(function(){if(s)return i&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),a&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),s;var f=Ty();return i||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),f},[s,i,JSON.stringify(a)]);return g.useEffect(function(){if(!(s||!i)){var f=Ty(),h=u.current;h?(i!==h.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),a&&!W6(a,h.options)&&f.set_config(a),u.current={apiKey:i,options:a??{}}):(f.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),f.init(i,a),u.current={apiKey:i,options:a??{}})}},[s,i,JSON.stringify(a)]),ve.createElement(d2.Provider,{value:{client:c,bootstrap:(e=a==null?void 0:a.bootstrap)!==null&&e!==void 0?e:(n=s==null?void 0:s.config)===null||n===void 0?void 0:n.bootstrap}},r)}var Iv=function(t){return typeof t=="function"},QN=function(){var t=g.useContext(d2).client;return t},Ay=function(t,e){return Ay=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},Ay(t,e)};function JN(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ay(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var eD={componentStack:null,exceptionEvent:null,error:null},tD={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."},nD=(function(t){JN(e,t);function e(n){var r=t.call(this,n)||this;return r.state=eD,r}return e.prototype.componentDidCatch=function(n,r){var s=this.props.additionalProperties,i;Iv(s)?i=s(n):typeof s=="object"&&(i=s);var a=this.context.client,u=a.captureException(n,i),c=r.componentStack;this.setState({error:n,componentStack:c??null,exceptionEvent:u})},e.prototype.render=function(){var n=this.props,r=n.children,s=n.fallback,i=this.state;if(i.componentStack==null)return Iv(r)?r():r;var a=Iv(s)?ve.createElement(s,{error:i.error,componentStack:i.componentStack,exceptionEvent:i.exceptionEvent}):s;return ve.isValidElement(a)?a:(console.warn(tD.INVALID_FALLBACK),ve.createElement(ve.Fragment,null))},e.contextType=d2,e})(ve.Component);YN(Te);var Fh={},Mv={exports:{}},mr={},Lv={exports:{}},Ov={};/**
|
|
19
19
|
* @license React
|
|
20
20
|
* scheduler.production.min.js
|
|
@@ -108,7 +108,7 @@ function useAtomValueWithDelay<Value>(
|
|
|
108
108
|
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
109
109
|
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
110
110
|
`)},AH=0,Wl=[];function RH(t){var e=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),s=g.useState(AH++)[0],i=g.useState(U3)[0],a=g.useRef(t);g.useEffect(function(){a.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var _=X$([t.lockRef.current],(t.shards||[]).map(_k),!0).filter(Boolean);return _.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),_.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var u=g.useCallback(function(_,b){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!a.current.allowPinchZoom;var E=Zh(_),C=n.current,P="deltaX"in _?_.deltaX:C[0]-E[0],T="deltaY"in _?_.deltaY:C[1]-E[1],A,O=_.target,M=Math.abs(P)>Math.abs(T)?"h":"v";if("touches"in _&&M==="h"&&O.type==="range")return!1;var R=window.getSelection(),L=R&&R.anchorNode,N=L?L===O||L.contains(O):!1;if(N)return!1;var j=vk(M,O);if(!j)return!0;if(j?A=M:(A=M==="v"?"h":"v",j=vk(M,O)),!j)return!1;if(!r.current&&"changedTouches"in _&&(P||T)&&(r.current=A),!A)return!0;var V=r.current||A;return CH(V,b,_,V==="h"?P:T)},[]),c=g.useCallback(function(_){var b=_;if(!(!Wl.length||Wl[Wl.length-1]!==i)){var E="deltaY"in b?yk(b):Zh(b),C=e.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&PH(A.delta,E)})[0];if(C&&C.should){b.cancelable&&b.preventDefault();return}if(!C){var P=(a.current.shards||[]).map(_k).filter(Boolean).filter(function(A){return A.contains(b.target)}),T=P.length>0?u(b,P[0]):!a.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),f=g.useCallback(function(_,b,E,C){var P={name:_,delta:b,target:E,should:C,shadowParent:IH(E)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(T){return T!==P})},1)},[]),h=g.useCallback(function(_){n.current=Zh(_),r.current=void 0},[]),p=g.useCallback(function(_){f(_.type,yk(_),_.target,u(_,t.lockRef.current))},[]),v=g.useCallback(function(_){f(_.type,Zh(_),_.target,u(_,t.lockRef.current))},[]);g.useEffect(function(){return Wl.push(i),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",c,Bl),document.addEventListener("touchmove",c,Bl),document.addEventListener("touchstart",h,Bl),function(){Wl=Wl.filter(function(_){return _!==i}),document.removeEventListener("wheel",c,Bl),document.removeEventListener("touchmove",c,Bl),document.removeEventListener("touchstart",h,Bl)}},[]);var y=t.removeScrollBar,x=t.inert;return g.createElement(g.Fragment,null,x?g.createElement(i,{styles:TH(s)}):null,y?g.createElement(_H,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function IH(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const MH=oH(z3,RH);var G2=g.forwardRef(function(t,e){return g.createElement(Qm,ni({},t,{ref:e,sideCar:MH}))});G2.classNames=Qm.classNames;var LH=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Gl=new WeakMap,qh=new WeakMap,Yh={},r1=0,K3=function(t){return t&&(t.host||K3(t.parentNode))},OH=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=K3(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},NH=function(t,e,n,r){var s=OH(e,Array.isArray(t)?t:[t]);Yh[n]||(Yh[n]=new WeakMap);var i=Yh[n],a=[],u=new Set,c=new Set(s),f=function(p){!p||u.has(p)||(u.add(p),f(p.parentNode))};s.forEach(f);var h=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(v){if(u.has(v))h(v);else try{var y=v.getAttribute(r),x=y!==null&&y!=="false",_=(Gl.get(v)||0)+1,b=(i.get(v)||0)+1;Gl.set(v,_),i.set(v,b),a.push(v),_===1&&x&&qh.set(v,!0),b===1&&v.setAttribute(n,"true"),x||v.setAttribute(r,"true")}catch(E){console.error("aria-hidden: cannot operate on ",v,E)}})};return h(e),u.clear(),r1++,function(){a.forEach(function(p){var v=Gl.get(p)-1,y=i.get(p)-1;Gl.set(p,v),i.set(p,y),v||(qh.has(p)||p.removeAttribute(r),qh.delete(p)),y||p.removeAttribute(n)}),r1--,r1||(Gl=new WeakMap,Gl=new WeakMap,qh=new WeakMap,Yh={})}},Z3=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=LH(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),NH(r,s,n,"aria-hidden")):function(){return null}},Jm="Dialog",[q3]=na(Jm),[DH,Ms]=q3(Jm),e0=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!0}=t,u=g.useRef(null),c=g.useRef(null),[f,h]=fl({prop:r,defaultProp:s??!1,onChange:i,caller:Jm});return S.jsx(DH,{scope:e,triggerRef:u,contentRef:c,contentId:il(),titleId:il(),descriptionId:il(),open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),modal:a,children:n})};e0.displayName=Jm;var Y3="DialogTrigger",jH=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(Y3,n),i=Yt(e,s.triggerRef);return S.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Z2(s.open),...r,ref:i,onClick:Et(t.onClick,s.onOpenToggle)})});jH.displayName=Y3;var K2="DialogPortal",[FH,X3]=q3(K2,{forceMount:void 0}),t0=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=Ms(K2,e);return S.jsx(FH,{scope:e,forceMount:n,children:g.Children.map(r,a=>S.jsx(Qi,{present:n||i.open,children:S.jsx(Xm,{asChild:!0,container:s,children:a})}))})};t0.displayName=K2;var xm="DialogOverlay",n0=g.forwardRef((t,e)=>{const n=X3(xm,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Ms(xm,t.__scopeDialog);return i.modal?S.jsx(Qi,{present:r||i.open,children:S.jsx($H,{...s,ref:e})}):null});n0.displayName=xm;var VH=Vd("DialogOverlay.RemoveScroll"),$H=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(xm,n),i=N$(),a=Yt(e,i);return S.jsx(G2,{as:VH,allowPinchZoom:!0,shards:[s.contentRef],children:S.jsx(Rt.div,{"data-state":Z2(s.open),...r,ref:a,style:{pointerEvents:"auto",...r.style}})})}),ju="DialogContent",r0=g.forwardRef((t,e)=>{const n=X3(ju,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Ms(ju,t.__scopeDialog);return S.jsx(Qi,{present:r||i.open,children:i.modal?S.jsx(HH,{...s,ref:e}):S.jsx(zH,{...s,ref:e})})});r0.displayName=ju;var HH=g.forwardRef((t,e)=>{const n=Ms(ju,t.__scopeDialog),r=g.useRef(null),s=Yt(e,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return Z3(i)},[]),S.jsx(Q3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Et(t.onCloseAutoFocus,i=>{var a;i.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Et(t.onPointerDownOutside,i=>{const a=i.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&i.preventDefault()}),onFocusOutside:Et(t.onFocusOutside,i=>i.preventDefault())})}),zH=g.forwardRef((t,e)=>{const n=Ms(ju,t.__scopeDialog),r=g.useRef(!1),s=g.useRef(!1);return S.jsx(Q3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,u;(a=t.onCloseAutoFocus)==null||a.call(t,i),i.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,f;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Q3=g.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...a}=t,u=Ms(ju,n);return V3(),S.jsx(S.Fragment,{children:S.jsx(W2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:S.jsx(Ym,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Z2(u.open),...a,ref:e,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})}),J3="DialogTitle",s0=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(J3,n);return S.jsx(Rt.h2,{id:s.titleId,...r,ref:e})});s0.displayName=J3;var eT="DialogDescription",i0=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(eT,n);return S.jsx(Rt.p,{id:s.descriptionId,...r,ref:e})});i0.displayName=eT;var tT="DialogClose",UH=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(tT,n);return S.jsx(Rt.button,{type:"button",...r,ref:e,onClick:Et(t.onClick,()=>s.onOpenChange(!1))})});UH.displayName=tT;function Z2(t){return t?"open":"closed"}const BH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),g.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),WH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),g.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),GH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M200,112H56l72-72Z",opacity:"0.2"}),g.createElement("path",{d:"M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z"}))]]),KH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),g.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),ZH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,20A108,108,0,0,0,31.85,177.23L21,209.66A20,20,0,0,0,46.34,235l32.43-10.81A108,108,0,1,0,128,20Zm0,192a84,84,0,0,1-42.06-11.27,12,12,0,0,0-6-1.62,12.1,12.1,0,0,0-3.8.62l-29.79,9.93,9.93-29.79a12,12,0,0,0-1-9.81A84,84,0,1,1,128,212Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z",opacity:"0.2"}),g.createElement("path",{d:"M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232,128A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,26A102,102,0,0,0,38.35,176.69L26.73,211.56a14,14,0,0,0,17.71,17.71l34.87-11.62A102,102,0,1,0,128,26Zm0,192a90,90,0,0,1-45.06-12.08,6.09,6.09,0,0,0-3-.81,6.2,6.2,0,0,0-1.9.31L40.65,217.88a2,2,0,0,1-2.53-2.53L50.58,178a6,6,0,0,0-.5-4.91A90,90,0,1,1,128,218Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,28A100,100,0,0,0,40.53,176.5l-11.9,35.69a12,12,0,0,0,15.18,15.18l35.69-11.9A100,100,0,1,0,128,28Zm0,192a92,92,0,0,1-46.07-12.35,4.05,4.05,0,0,0-2-.54,3.93,3.93,0,0,0-1.27.21L41.28,219.78a4,4,0,0,1-5.06-5.06l12.46-37.38a4,4,0,0,0-.33-3.27A92,92,0,1,1,128,220Z"}))]]),qH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),g.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),YH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),g.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z"}))]]),XH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40V168H168V88H88V40Z",opacity:"0.2"}),g.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z"}))]]),QH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),g.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),JH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),g.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),ez=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36ZM44,60H76V196H44ZM212,196H100V60H212Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M88,48V208H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8Z",opacity:"0.2"}),g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H88V56H216V200Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM38,200V56a2,2,0,0,1,2-2H82V202H40A2,2,0,0,1,38,200Zm180,0a2,2,0,0,1-2,2H94V54H216a2,2,0,0,1,2,2Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM36,200V56a4,4,0,0,1,4-4H84V204H40A4,4,0,0,1,36,200Zm184,0a4,4,0,0,1-4,4H92V52H216a4,4,0,0,1,4,4Z"}))]]),tz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z",opacity:"0.2"}),g.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z"}))]]),nz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z",opacity:"0.2"}),g.createElement("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z"}))]]),rz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M242.79,149.32,223.7,97.11A20,20,0,0,0,198.12,85.2l-61.31,22.22L147.7,45.18A20,20,0,0,0,131.55,22L76.87,12.31A19.94,19.94,0,0,0,53.76,28.55l-25,143.13A48,48,0,0,0,67.4,227.26a51.19,51.19,0,0,0,8.7.74H224a20,20,0,0,0,20-20V156.19A21.74,21.74,0,0,0,242.79,149.32ZM99,184.18a23.84,23.84,0,0,1-9.86,15.56,23.28,23.28,0,0,1-17.56,3.89,24,24,0,0,1-19.23-27.82L76.71,36.66,123.37,45,99,184.18Zm23.64,4.13,9.39-53.64,70.49-25.54,16.3,44.59-96.23,34.87C122.62,188.5,122.65,188.41,122.66,188.31ZM220,204H150.52L220,178.82ZM89.22,174.07l-1.4,8A12,12,0,0,1,76,192a12.35,12.35,0,0,1-2.08-.18,12,12,0,0,1-9.75-13.89l1.4-8a12,12,0,0,1,23.64,4.14Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M135.88,43.11l-25,143.14a35.71,35.71,0,0,1-41.34,29.2h0a36,36,0,0,1-28.95-41.71l25-143.13a8,8,0,0,1,9.19-6.49l54.67,9.73A8,8,0,0,1,135.88,43.11Z",opacity:"0.2"}),g.createElement("path",{d:"M88,180a12,12,0,1,1-12-12A12,12,0,0,1,88,180Zm152-23.81V208a16,16,0,0,1-16,16H76a46.36,46.36,0,0,1-7.94-.68,44,44,0,0,1-35.43-50.95l25-143.13a15.94,15.94,0,0,1,18.47-13L130.84,26a16,16,0,0,1,12.92,18.52l-12.08,69L199.49,89a16,16,0,0,1,20.45,9.52L239,150.69A18.35,18.35,0,0,1,240,156.19ZM103,184.87,128,41.74,73.46,32l-25,143.1A28,28,0,0,0,70.9,207.57,27.29,27.29,0,0,0,91.46,203,27.84,27.84,0,0,0,103,184.87ZM116.78,195,224,156.11,204.92,104,128.5,131.7l-9.78,55.92A44.63,44.63,0,0,1,116.78,195ZM224,173.12,127.74,208H224Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M240,155.91a16,16,0,0,0-1-5.22L219.94,98.48A16,16,0,0,0,199.49,89l-67.81,24.57,12.08-69A16,16,0,0,0,130.84,26L76.17,16.25a15.94,15.94,0,0,0-18.47,13l-25,143.12A43.82,43.82,0,0,0,75.78,224H224a16,16,0,0,0,16-16ZM76,196a16,16,0,1,1,16-16A16,16,0,0,1,76,196Zm42.72-8.38,9.78-55.92L204.92,104,224,156.11,116.78,195A44.89,44.89,0,0,0,118.72,187.62ZM224,208H127.74L224,173.11Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M86,180a10,10,0,1,1-10-10A10,10,0,0,1,86,180Zm152-23.81V208a14,14,0,0,1-14,14H76a44.18,44.18,0,0,1-7.58-.65,42,42,0,0,1-33.81-48.64l25-143.13A13.94,13.94,0,0,1,75.82,18.22l54.67,9.72a14,14,0,0,1,11.3,16.21l-12.67,72.44,71-25.75a14,14,0,0,1,17.89,8.32l19.09,52.22A15.66,15.66,0,0,1,238,156.19Zm-133.07,29L130,42.08a2,2,0,0,0-1.58-2.32L73.72,30l-.34,0a1.84,1.84,0,0,0-1.07.35,2,2,0,0,0-.82,1.3l-25,143.13a30,30,0,0,0,24.09,34.76,29.25,29.25,0,0,0,22-4.89,29.81,29.81,0,0,0,12.33-19.44Zm8.25,13.17L224.71,158a2,2,0,0,0,1.11-1,1.86,1.86,0,0,0,.06-1.46l-19.09-52.21a2,2,0,0,0-2.53-1.17l-77.53,28.09-10,57.07A41.9,41.9,0,0,1,113.18,198.38ZM226,170.27,116.35,210H224a2,2,0,0,0,2-2Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M88,180a12,12,0,1,1-12-12A12,12,0,0,1,88,180Zm152-23.81V208a16,16,0,0,1-16,16H76a46.36,46.36,0,0,1-7.94-.68,44,44,0,0,1-35.43-50.95l25-143.13a15.94,15.94,0,0,1,18.47-13L130.84,26a16,16,0,0,1,12.92,18.52l-12.08,69L199.49,89a16,16,0,0,1,20.45,9.52L239,150.69A18.35,18.35,0,0,1,240,156.19ZM103,184.87,128,41.74,73.46,32l-25,143.1A28,28,0,0,0,70.9,207.57,27.29,27.29,0,0,0,91.46,203,27.84,27.84,0,0,0,103,184.87ZM116.78,195,224,156.11,204.92,104,128.5,131.7l-9.78,55.92A44.63,44.63,0,0,1,116.78,195ZM224,173.12,127.74,208H224Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M235.27,152.07,216.19,99.85a12,12,0,0,0-15.34-7.13l-74.3,26.92,13.27-75.83a12,12,0,0,0-9.68-13.9L75.47,20.19a11.75,11.75,0,0,0-8.89,2,11.9,11.9,0,0,0-4.94,7.77l-25,143.13A40,40,0,0,0,68.8,219.39,42.68,42.68,0,0,0,76,220H224a12,12,0,0,0,12-12V156.19A14,14,0,0,0,235.27,152.07Zm-31.7-51.83a4,4,0,0,1,5.1,2.36l19.09,52.21a3.9,3.9,0,0,1-.13,3,3.94,3.94,0,0,1-2.24,2L108.78,202.11a40,40,0,0,0,6-15.17L125,128.73ZM93.75,206.29a31.25,31.25,0,0,1-23.55,5.22,32,32,0,0,1-25.71-37.08l25-143.13a4,4,0,0,1,1.64-2.59A3.85,3.85,0,0,1,73.38,28a4,4,0,0,1,.69.06l54.67,9.73a4,4,0,0,1,3.2,4.64l-25,143.13h0A31.79,31.79,0,0,1,93.75,206.29ZM228,208a4,4,0,0,1-4,4H105l123-44.59ZM84,180a8,8,0,1,1-8-8A8,8,0,0,1,84,180Z"}))]]),sz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),g.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),iz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),g.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),oz=g.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),zn=g.forwardRef((t,e)=>{const{alt:n,color:r,size:s,weight:i,mirrored:a,children:u,weights:c,...f}=t,{color:h="currentColor",size:p,weight:v="regular",mirrored:y=!1,...x}=g.useContext(oz);return g.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:s??p,height:s??p,fill:r??h,viewBox:"0 0 256 256",transform:a||y?"scale(-1, 1)":void 0,...x,...f},!!n&&g.createElement("title",null,n),u,c.get(i??v))});zn.displayName="IconBase";const nT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:BH}));nT.displayName="ArrowLeftIcon";const az=nT,rT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:WH}));rT.displayName="ArrowSquareOutIcon";const lz=rT,sT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:GH}));sT.displayName="ArrowUpIcon";const uz=sT,iT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:KH}));iT.displayName="CaretDownIcon";const cz=iT,oT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:ZH}));oT.displayName="ChatCircleIcon";const dz=oT,aT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:qH}));aT.displayName="CheckIcon";const lT=aT,uT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:YH}));uT.displayName="CircleNotchIcon";const o0=uT,cT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:XH}));cT.displayName="CopyIcon";const $d=cT,dT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:QH}));dT.displayName="MagnifyingGlassIcon";const fz=dT,fT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:JH}));fT.displayName="PencilSimpleIcon";const hz=fT,hT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:ez}));hT.displayName="SidebarSimpleIcon";const pz=hT,pT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:tz}));pT.displayName="SignOutIcon";const mz=pT,mT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:nz}));mT.displayName="SparkleIcon";const s1=mT,gT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:rz}));gT.displayName="SwatchesIcon";const vT=gT,yT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:sz}));yT.displayName="TrashIcon";const gz=yT,_T=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:iz}));_T.displayName="XIcon";const xT=_T;function wT(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=wT(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function vz(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=wT(t))&&(r&&(r+=" "),r+=e);return r}const yz=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},_z=(t,e)=>({classGroupId:t,validator:e}),bT=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),wm="-",xk=[],xz="arbitrary..",wz=t=>{const e=Sz(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return bz(a);const u=a.split(wm),c=u[0]===""&&u.length>1?1:0;return ST(u,c,e)},getConflictingClassGroupIds:(a,u)=>{if(u){const c=r[a],f=n[a];return c?f?yz(f,c):c:f||xk}return n[a]||xk}}},ST=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const f=ST(t,e+1,i);if(f)return f}const a=n.validators;if(a===null)return;const u=e===0?t.join(wm):t.slice(e).join(wm),c=a.length;for(let f=0;f<c;f++){const h=a[f];if(h.validator(u))return h.classGroupId}},bz=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?xz+r:void 0})(),Sz=t=>{const{theme:e,classGroups:n}=t;return Ez(n,e)},Ez=(t,e)=>{const n=bT();for(const r in t){const s=t[r];q2(s,n,r,e)}return n},q2=(t,e,n,r)=>{const s=t.length;for(let i=0;i<s;i++){const a=t[i];kz(a,e,n,r)}},kz=(t,e,n,r)=>{if(typeof t=="string"){Cz(t,e,n);return}if(typeof t=="function"){Pz(t,e,n,r);return}Tz(t,e,n,r)},Cz=(t,e,n)=>{const r=t===""?e:ET(e,t);r.classGroupId=n},Pz=(t,e,n,r)=>{if(Az(t)){q2(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(_z(n,t))},Tz=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a<i;a++){const[u,c]=s[a];q2(c,ET(e,u),n,r)}},ET=(t,e)=>{let n=t;const r=e.split(wm),s=r.length;for(let i=0;i<s;i++){const a=r[i];let u=n.nextPart.get(a);u||(u=bT(),n.nextPart.set(a,u)),n=u}return n},Az=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Rz=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},a_="!",wk=":",Iz=[],bk=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Mz=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,u=0,c=0,f;const h=s.length;for(let _=0;_<h;_++){const b=s[_];if(a===0&&u===0){if(b===wk){i.push(s.slice(c,_)),c=_+1;continue}if(b==="/"){f=_;continue}}b==="["?a++:b==="]"?a--:b==="("?u++:b===")"&&u--}const p=i.length===0?s:s.slice(c);let v=p,y=!1;p.endsWith(a_)?(v=p.slice(0,-1),y=!0):p.startsWith(a_)&&(v=p.slice(1),y=!0);const x=f&&f>c?f-c:void 0;return bk(i,y,v,x)};if(e){const s=e+wk,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):bk(Iz,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},Lz=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const a=n[i],u=a[0]==="[",c=e.has(a);u||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},Oz=t=>({cache:Rz(t.cacheSize),parseClassName:Mz(t),sortModifiers:Lz(t),postfixLookupClassGroupIds:Nz(t),...wz(t)}),Nz=t=>{const e=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)e[n[r]]=!0;return e},Dz=/\s+/,jz=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i,postfixLookupClassGroupIds:a}=e,u=[],c=t.trim().split(Dz);let f="";for(let h=c.length-1;h>=0;h-=1){const p=c[h],{isExternal:v,modifiers:y,hasImportantModifier:x,baseClassName:_,maybePostfixModifierPosition:b}=n(p);if(v){f=p+(f.length>0?" "+f:f);continue}let E=!!b,C;if(E){const M=_.substring(0,b);C=r(M);const R=C&&a[C]?r(_):void 0;R&&R!==C&&(C=R,E=!1)}else C=r(_);if(!C){if(!E){f=p+(f.length>0?" "+f:f);continue}if(C=r(_),!C){f=p+(f.length>0?" "+f:f);continue}E=!1}const P=y.length===0?"":y.length===1?y[0]:i(y).join(":"),T=x?P+a_:P,A=T+C;if(u.indexOf(A)>-1)continue;u.push(A);const O=s(C,E);for(let M=0;M<O.length;++M){const R=O[M];u.push(T+R)}f=p+(f.length>0?" "+f:f)}return f},Fz=(...t)=>{let e=0,n,r,s="";for(;e<t.length;)(n=t[e++])&&(r=kT(n))&&(s&&(s+=" "),s+=r);return s},kT=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=kT(t[r]))&&(n&&(n+=" "),n+=e);return n},Vz=(t,...e)=>{let n,r,s,i;const a=c=>{const f=e.reduce((h,p)=>p(h),t());return n=Oz(f),r=n.cache.get,s=n.cache.set,i=u,u(c)},u=c=>{const f=r(c);if(f)return f;const h=jz(c,n);return s(c,h),h};return i=a,(...c)=>i(Fz(...c))},$z=[],gn=t=>{const e=n=>n[t]||$z;return e.isThemeGetter=!0,e},CT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Hz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uz=/\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$/,Bz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Wz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Gz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,So=t=>Hz.test(t),nt=t=>!!t&&!Number.isNaN(Number(t)),Zs=t=>!!t&&Number.isInteger(Number(t)),i1=t=>t.endsWith("%")&&nt(t.slice(0,-1)),Ai=t=>zz.test(t),TT=()=>!0,Kz=t=>Uz.test(t)&&!Bz.test(t),Y2=()=>!1,Zz=t=>Wz.test(t),qz=t=>Gz.test(t),Yz=t=>!Ie(t)&&!Le(t),Xz=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),Qz=t=>ra(t,IT,Y2),Ie=t=>CT.test(t),Ta=t=>ra(t,MT,Kz),Sk=t=>ra(t,oU,nt),Jz=t=>ra(t,OT,TT),eU=t=>ra(t,LT,Y2),Ek=t=>ra(t,AT,Y2),tU=t=>ra(t,RT,qz),Xh=t=>ra(t,NT,Zz),Le=t=>PT.test(t),Yc=t=>hl(t,MT),nU=t=>hl(t,LT),kk=t=>hl(t,AT),rU=t=>hl(t,IT),sU=t=>hl(t,RT),Qh=t=>hl(t,NT,!0),iU=t=>hl(t,OT,!0),ra=(t,e,n)=>{const r=CT.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},hl=(t,e,n=!1)=>{const r=PT.exec(t);return r?r[1]?e(r[1]):n:!1},AT=t=>t==="position"||t==="percentage",RT=t=>t==="image"||t==="url",IT=t=>t==="length"||t==="size"||t==="bg-size",MT=t=>t==="length",oU=t=>t==="number",LT=t=>t==="family-name",OT=t=>t==="number"||t==="weight",NT=t=>t==="shadow",aU=()=>{const t=gn("color"),e=gn("font"),n=gn("text"),r=gn("font-weight"),s=gn("tracking"),i=gn("leading"),a=gn("breakpoint"),u=gn("container"),c=gn("spacing"),f=gn("radius"),h=gn("shadow"),p=gn("inset-shadow"),v=gn("text-shadow"),y=gn("drop-shadow"),x=gn("blur"),_=gn("perspective"),b=gn("aspect"),E=gn("ease"),C=gn("animate"),P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...T(),Le,Ie],O=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],R=()=>[Le,Ie,c],L=()=>[So,"full","auto",...R()],N=()=>[Zs,"none","subgrid",Le,Ie],j=()=>["auto",{span:["full",Zs,Le,Ie]},Zs,Le,Ie],V=()=>[Zs,"auto",Le,Ie],G=()=>["auto","min","max","fr",Le,Ie],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...R()],X=()=>[So,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],$=()=>[So,"screen","full","dvw","lvw","svw","min","max","fit",...R()],ee=()=>[So,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],H=()=>[t,Le,Ie],D=()=>[...T(),kk,Ek,{position:[Le,Ie]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",rU,Qz,{size:[Le,Ie]}],se=()=>[i1,Yc,Ta],oe=()=>["","none","full",f,Le,Ie],ue=()=>["",nt,Yc,Ta],de=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[nt,i1,kk,Ek],me=()=>["","none",x,Le,Ie],Se=()=>["none",nt,Le,Ie],Re=()=>["none",nt,Le,Ie],Ke=()=>[nt,Le,Ie],it=()=>[So,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ai],breakpoint:[Ai],color:[TT],container:[Ai],"drop-shadow":[Ai],ease:["in","out","in-out"],font:[Yz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ai],shadow:[Ai],spacing:["px",nt],text:[Ai],"text-shadow":[Ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",So,Ie,Le,b]}],container:["container"],"container-type":[{"@container":["","normal","size",Le,Ie]}],"container-named":[Xz],columns:[{columns:[nt,Ie,Le,u]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"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"],sr:["sr-only","not-sr-only"],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:A()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Zs,"auto",Le,Ie]}],basis:[{basis:[So,"full","auto",u,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,So,"auto","initial","none",Ie]}],grow:[{grow:["",nt,Le,Ie]}],shrink:[{shrink:["",nt,Le,Ie]}],order:[{order:[Zs,"first","last","none",Le,Ie]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[u,"screen",...X()]}],"min-w":[{"min-w":[u,"screen","none",...X()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[a]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Yc,Ta]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,iU,Jz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",i1,Ie]}],"font-family":[{font:[nU,eU,e]}],"font-features":[{"font-features":[Ie]}],"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:[s,Le,Ie]}],"line-clamp":[{"line-clamp":[nt,"none",Le,Sk]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Le,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Le,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[nt,"from-font","auto",Le,Ta]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[nt,"auto",Le,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[Zs,Le,Ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le,Ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Le,Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zs,Le,Ie],radial:["",Le,Ie],conic:[Zs,Le,Ie]},sU,tU]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nt,Le,Ie]}],"outline-w":[{outline:["",nt,Yc,Ta]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",h,Qh,Xh]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",p,Qh,Xh]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[nt,Ta]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",v,Qh,Xh]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[nt,Le,Ie]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[Le,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Le,Ie]}],filter:[{filter:["","none",Le,Ie]}],blur:[{blur:me()}],brightness:[{brightness:[nt,Le,Ie]}],contrast:[{contrast:[nt,Le,Ie]}],"drop-shadow":[{"drop-shadow":["","none",y,Qh,Xh]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",nt,Le,Ie]}],"hue-rotate":[{"hue-rotate":[nt,Le,Ie]}],invert:[{invert:["",nt,Le,Ie]}],saturate:[{saturate:[nt,Le,Ie]}],sepia:[{sepia:["",nt,Le,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",Le,Ie]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[nt,Le,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[nt,Le,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,Le,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,Le,Ie]}],"backdrop-invert":[{"backdrop-invert":["",nt,Le,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[nt,Le,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[nt,Le,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,Le,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Le,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nt,"initial",Le,Ie]}],ease:[{ease:["linear","initial",E,Le,Ie]}],delay:[{delay:[nt,Le,Ie]}],animate:[{animate:["none",C,Le,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Le,Ie]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:Ke()}],"skew-x":[{"skew-x":Ke()}],"skew-y":[{"skew-y":Ke()}],transform:[{transform:[Le,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:it()}],"translate-x":[{"translate-x":it()}],"translate-y":[{"translate-y":it()}],"translate-z":[{"translate-z":it()}],"translate-none":["translate-none"],zoom:[{zoom:[Zs,Le,Ie]}],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Le,Ie]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":H()}],"scrollbar-track-color":[{"scrollbar-track":H()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",Le,Ie]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[nt,Yc,Ta,Sk]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","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-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},lU=Vz(aU);function lr(...t){return lU(vz(t))}const Hd={fast:{type:"spring",duration:.08,bounce:0},moderate:{type:"spring",duration:.16,bounce:.15}},Ck=["#f59e0b","#38bdf8","#34d399","#a78bfa","#fb7185","#22d3ee","#fb923c","#a3e635","#e879f9","#2dd4bf"];function DT(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)|0;const n=Ck[Math.abs(e)%Ck.length];return{color:n,backgroundColor:`${n}22`}}function jT(t,e={}){const{axis:n="y"}=e,r=g.useRef(new Map),[s,i]=g.useState(null),[a,u]=g.useState([]),c=g.useRef([]),f=g.useRef(0),h=g.useRef(null),p=g.useRef(null),v=g.useCallback(()=>{if(!t.current)return;const C=[];r.current.forEach((P,T)=>{C[T]={top:P.offsetTop,height:P.offsetHeight,left:P.offsetLeft,width:P.offsetWidth}}),c.current=C,u(C)},[t]),y=g.useCallback((E,C)=>{C?r.current.set(E,C):r.current.delete(E),p.current!==null&&cancelAnimationFrame(p.current),p.current=requestAnimationFrame(()=>{p.current=null,v()})},[v]),x=g.useCallback(E=>{const C=E.clientX,P=E.clientY;h.current!==null&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{h.current=null;const T=t.current;if(!T)return;const A=T.getBoundingClientRect(),O=n==="x"?C:P;let M=null,R=1/0,L=null;const N=c.current,j=n==="x"?T.scrollLeft:T.scrollTop,V=n==="x"?T.clientLeft:T.clientTop,G=n==="x"?A.left:A.top,Y=n==="x"?T.offsetWidth:T.offsetHeight,K=n==="x"?A.width:A.height,B=Y>0?K/Y:1;for(let X=0;X<N.length;X++){const $=N[X];if(!$)continue;const ee=n==="x"?$.left:$.top,H=G+(V+ee-j)*B,D=(n==="x"?$.width:$.height)*B,q=H+D;O>=H&&O<=q&&(L=X);const re=H+D/2,se=Math.abs(O-re);se<R&&(R=se,M=X)}i(L??M)})},[n,t]),_=g.useCallback(()=>{f.current+=1,v()},[v]),b=g.useCallback(()=>{h.current!==null&&(cancelAnimationFrame(h.current),h.current=null),i(null)},[]);return g.useEffect(()=>()=>{h.current!==null&&cancelAnimationFrame(h.current),p.current!==null&&cancelAnimationFrame(p.current)},[]),{activeIndex:s,setActiveIndex:i,itemRects:a,sessionRef:f,handlers:{onMouseMove:x,onMouseEnter:_,onMouseLeave:b},registerItem:y,measureItems:v}}function uU(t,e,n){g.useEffect(()=>(t(e,n.current),()=>t(e,null)),[e,t,n])}const FT=(t,e)=>`style:${t}:${e}`,VT=t=>`text:${t}`,$T=t=>{const e=[t.rivetId,t.xpath,t.cssSelector].filter(n=>!!n).map(n=>n.trim()).filter(Boolean);return e.length>0?[...new Set(e)]:["unknown"]},HT=t=>$T(t)[0],Jh=(t,e)=>$T(t).includes(e),cU=t=>{const e=HT(t.elementId),n=t.batchId?`:${t.batchId}`:"";return t.type==="style"?`${FT(e,t.property)}${n}`:`${VT(e)}${n}`},Nn=[];for(let t=0;t<256;++t)Nn.push((t+256).toString(16).slice(1));function dU(t,e=0){return(Nn[t[e+0]]+Nn[t[e+1]]+Nn[t[e+2]]+Nn[t[e+3]]+"-"+Nn[t[e+4]]+Nn[t[e+5]]+"-"+Nn[t[e+6]]+Nn[t[e+7]]+"-"+Nn[t[e+8]]+Nn[t[e+9]]+"-"+Nn[t[e+10]]+Nn[t[e+11]]+Nn[t[e+12]]+Nn[t[e+13]]+Nn[t[e+14]]+Nn[t[e+15]]).toLowerCase()}const fU=new Uint8Array(16);function hU(){return crypto.getRandomValues(fU)}function Pk(t,e,n){return crypto.randomUUID?crypto.randomUUID():pU(t)}function pU(t,e,n){var s;t=t||{};const r=t.random??((s=t.rng)==null?void 0:s.call(t))??hU();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,dU(r)}const mU=300;class gU{constructor(){bo(this,"history",{current:new Map,past:[],future:[]});bo(this,"pendingChanges",new Map);bo(this,"currentBatchId",null);bo(this,"debounceTimer",null);bo(this,"onChangeCallbacks",[]);bo(this,"stateBeforePending",null);bo(this,"transactionDepth",0)}recordChange(e){this.pendingChanges.size===0&&(this.currentBatchId=Pk(),this.stateBeforePending=new Map(this.history.current)),this.currentBatchId&&(e.batchId=this.currentBatchId);const n=HT(e.elementId),r=e.type==="style"?FT(n,e.property):VT(n),s=Array.from(this.history.current.entries()).find(([a])=>a===r||a.startsWith(`${r}:`));if(s){const a=s[1];e.type==="style"&&a.type==="style"?e.oldValue=a.oldValue:e.type==="text"&&a.type==="text"&&(e.oldText=a.oldText)}const i=cU(e);this.history.current.set(i,e),this.pendingChanges.set(i,e),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.commitPending()},mU),this.notifyChange()}flushPending(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.commitPending()}removeChange(e){const n=this.history.current.get(e)??this.pendingChanges.get(e)??null,r=this.history.current.has(e),s=this.pendingChanges.has(e);return!r&&!s?null:(r&&this.history.current.delete(e),s&&this.pendingChanges.delete(e),n&&this.stateBeforePending&&(this.stateBeforePending=this.removeChangeFromSnapshotById(this.stateBeforePending,n.id)),s&&this.pendingChanges.size===0&&(this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.stateBeforePending=null,this.currentBatchId=null),r&&(this.history.future=[]),n&&(this.history.past=this.history.past.map(i=>this.removeChangeFromSnapshotById(i,n.id)).filter(i=>i.size>0)),this.notifyChange(),n)}removeChangeById(e){const n=Array.from(this.history.current.entries()).find(([,s])=>s.id===e);if(n)return this.removeChange(n[0]);const r=Array.from(this.pendingChanges.entries()).find(([,s])=>s.id===e);return r?this.removeChange(r[0]):null}removeChangeFromSnapshotById(e,n){return new Map(Array.from(e.entries()).filter(([,r])=>r.id!==n))}commitPending(){this.pendingChanges.size===0||!this.stateBeforePending||this.transactionDepth>0||(this.history.past.push(this.stateBeforePending),this.history.future=[],this.pendingChanges.clear(),this.stateBeforePending=null,this.currentBatchId=null,this.notifyChange())}undo(){if(this.pendingChanges.size>0&&this.commitPending(),this.history.past.length===0)return null;const e=new Map(this.history.current);this.history.future.push(e),this.history.current=this.history.past.pop(),this.notifyChange();const n=[];for(const[r,s]of e)this.history.current.has(r)||n.push(s);return n}redo(){if(this.history.future.length===0)return null;const e=new Map(this.history.current);this.history.past.push(e),this.history.current=this.history.future.pop(),this.notifyChange();const n=[];for(const[r,s]of this.history.current)e.has(r)||n.push(s);return n}getChanges(){return Array.from(this.history.current.values())}getStyleChanges(){return Array.from(this.history.current.values()).filter(e=>e.type==="style")}getTextChanges(){return Array.from(this.history.current.values()).filter(e=>e.type==="text")}getChangeCount(){return this.getUniqueBatchCount(this.history.current.values())}getStyleBatchCount(){return this.getUniqueBatchCount(Array.from(this.history.current.values()).filter(e=>e.type==="style"))}getTextBatchCount(){return this.getUniqueBatchCount(Array.from(this.history.current.values()).filter(e=>e.type==="text"))}getUniqueBatchCount(e){const n=new Set;for(const r of e)r.batchId?n.add(r.batchId):n.add(r.id);return n.size}canUndo(){return this.history.past.length>0||this.pendingChanges.size>0}canRedo(){return this.history.future.length>0}clear(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.history={current:new Map,past:[],future:[]},this.pendingChanges.clear(),this.stateBeforePending=null,this.currentBatchId=null,this.notifyChange()}getStyleChange(e,n){return Array.from(this.history.current.values()).filter(s=>s.type==="style"&&Jh(s.elementId,e)&&s.property===n).sort((s,i)=>i.timestamp-s.timestamp)[0]}getTextChange(e){return Array.from(this.history.current.values()).filter(r=>r.type==="text"&&Jh(r.elementId,e)).sort((r,s)=>s.timestamp-r.timestamp)[0]}hasChanges(e){return Array.from(this.history.current.values()).some(n=>Jh(n.elementId,e))}getChangesForElement(e){return Array.from(this.history.current.values()).filter(n=>Jh(n.elementId,e))}onChange(e){return this.onChangeCallbacks.push(e),()=>{const n=this.onChangeCallbacks.indexOf(e);n!==-1&&this.onChangeCallbacks.splice(n,1)}}notifyChange(){this.onChangeCallbacks.forEach(e=>e())}export(){return{current:Array.from(this.history.current.entries()),past:this.history.past.map(e=>Array.from(e.entries())),future:this.history.future.map(e=>Array.from(e.entries()))}}import(e){this.history={current:new Map(e.current),past:e.past.map(n=>new Map(n)),future:e.future.map(n=>new Map(n))},this.notifyChange()}async transaction(e){const n=this.pendingChanges.size===0;n&&(this.currentBatchId=Pk(),this.stateBeforePending=new Map(this.history.current)),this.transactionDepth++;try{await e()}catch(r){throw n&&this.stateBeforePending&&(this.history.current=new Map(this.stateBeforePending),this.pendingChanges.clear(),this.currentBatchId=null,this.stateBeforePending=null),r}finally{this.transactionDepth--,n&&this.transactionDepth===0&&this.flushPending()}}}const bm={kind:"base"};function zd(t){return t.kind==="base"?"base":`variant:${t.sessionId}:${t.variantId}`}function vU(t,e){return t.kind==="base"&&e.kind,t.kind==="variant"&&e.kind==="variant"?t.sessionId===e.sessionId&&t.variantId===e.variantId:!1}const yU={resize:{default:!1},variants:{default:!1},designSystemEditor:{default:!1},branchDiff:{default:!1},gitUi:{default:!0},createProject:{default:!1},desktopForceUpgrade:{default:!1},deployPrototype:{default:!1},canvasShare:{default:!1},variantSend:{default:!1},generativeControls:{default:!1},refineMode:{default:!1},designContextViewer:{default:!1},variantReferences:{default:!1},inspectorUndoRedo:{default:!1}},zT=Object.fromEntries(Object.entries(yU).map(([t,e])=>[t,{isEnabled:e.default}]));et("view");const UT=et(!0),BT=et(null),_U=et("chat"),WT=et(0),GT=et({name:null,email:null}),Tk=et(bm);et(null);const Ud=new Map,xU=t=>{const e=zd(t);let n=Ud.get(e);return n||(n=new gU,Ud.set(e,n)),n};et(t=>xU(t(Tk)),(t,e,n)=>{Ud.set(zd(t(Tk)),n)});const wU=t=>{for(const e of[...Ud.keys()])e==="base"||t.has(e)||Ud.delete(e)},Bd=et(new Map),Ak=et(null);et(null);const l_=et(0),Sm=et(null),u_=et(!1),c_=et(null),KT=et(!1),ZT=et(!1),d_=et(null),f_=et(null),Wd=et(null),X2=et(null),qo=et(null),pf=et({active:!1}),qT=et([]),Rk=et(null),bU=(t,e,n)=>{let r=!1;const s=new Map(t);for(const[i,a]of t)a.target&&vU(a.target,e)&&(s.set(i,{...a,target:n}),r=!0);return r?s:t},SU=et(null,(t,e,n)=>{const r=c=>{const f=c??bm;return f.kind==="variant"&&!n.has(zd(f))},s=t(Bd);let i=null;for(const[c,f]of s)r(f.target)&&(i??(i=new Set)).add(c);if(i){const c=new Map(s);for(const f of i)c.delete(f);e(Bd,c)}const a=t(Ak);a&&r(a.target)&&(e(Ak,null),e(PU,!1));const u=t(Rk);u&&(i!=null&&i.has(u.commentId))&&e(Rk,null),wU(n)}),h_=et(zT),EU=et(!1),YT=et(null),mf=et(!0),XT=et(!1),QT=et(!1),JT=et(!1),e5=et(null),kU=()=>{var t;return typeof window>"u"?null:((t=window.__RIVET_BOOTSTRAP__)==null?void 0:t.agentApplyMode)??null},a0=et(kU()),CU=et(null),PU=et(!1);et(0);et(0);var Sp={exports:{}},TU=Sp.exports,Ik;function AU(){return Ik||(Ik=1,(function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(TU,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"],i={},a=null;function u(_,b){var E=_[b];if(typeof E.bind=="function")return E.bind(_);try{return Function.prototype.bind.call(E,_)}catch{return function(){return Function.prototype.apply.apply(E,[_,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(_){return _==="debug"&&(_="log"),typeof console===n?!1:_==="trace"&&r?c:console[_]!==void 0?u(console,_):console.log!==void 0?u(console,"log"):e}function h(){for(var _=this.getLevel(),b=0;b<s.length;b++){var E=s[b];this[E]=b<_?e:this.methodFactory(E,_,this.name)}if(this.log=this.debug,typeof console===n&&_<this.levels.SILENT)return"No console available for logging"}function p(_){return function(){typeof console!==n&&(h.call(this),this[_].apply(this,arguments))}}function v(_,b,E){return f(_)||p.apply(this,arguments)}function y(_,b){var E=this,C,P,T,A="loglevel";typeof _=="string"?A+=":"+_:typeof _=="symbol"&&(A=void 0);function O(j){var V=(s[j]||"silent").toUpperCase();if(!(typeof window===n||!A)){try{window.localStorage[A]=V;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+V+";"}catch{}}}function M(){var j;if(!(typeof window===n||!A)){try{j=window.localStorage[A]}catch{}if(typeof j===n)try{var V=window.document.cookie,G=encodeURIComponent(A),Y=V.indexOf(G+"=");Y!==-1&&(j=/^([^;]+)/.exec(V.slice(Y+G.length+1))[1])}catch{}return E.levels[j]===void 0&&(j=void 0),j}}function R(){if(!(typeof window===n||!A)){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function L(j){var V=j;if(typeof V=="string"&&E.levels[V.toUpperCase()]!==void 0&&(V=E.levels[V.toUpperCase()]),typeof V=="number"&&V>=0&&V<=E.levels.SILENT)return V;throw new TypeError("log.setLevel() called with invalid level: "+j)}E.name=_,E.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},E.methodFactory=b||v,E.getLevel=function(){return T??P??C},E.setLevel=function(j,V){return T=L(j),V!==!1&&O(T),h.call(E)},E.setDefaultLevel=function(j){P=L(j),M()||E.setLevel(j,!1)},E.resetLevel=function(){T=null,R(),h.call(E)},E.enableAll=function(j){E.setLevel(E.levels.TRACE,j)},E.disableAll=function(j){E.setLevel(E.levels.SILENT,j)},E.rebuild=function(){if(a!==E&&(C=L(a.getLevel())),h.call(E),a===E)for(var j in i)i[j].rebuild()},C=L(a?a.getLevel():"WARN");var N=M();N!=null&&(T=L(N)),h.call(E)}a=new y,a.getLogger=function(b){if(typeof b!="symbol"&&typeof b!="string"||b==="")throw new TypeError("You must supply a name when creating a logger.");var E=i[b];return E||(E=i[b]=new y(b,a.methodFactory)),E};var x=typeof window!==n?window.log:void 0;return a.noConflict=function(){return typeof window!==n&&window.log===a&&(window.log=x),a},a.getLoggers=function(){return i},a.default=a,a})})(Sp)),Sp.exports}var RU=AU();const Cs=$m(RU),IU="INFO",MU=IU.toUpperCase();Cs.setLevel(Cs.levels[MU]||Cs.levels.INFO);const hs=t=>{const e=t?`[${t}] `:"";return{trace:(n,...r)=>Cs.trace(`${e}${n}`,...r),debug:(n,...r)=>Cs.debug(`${e}${n}`,...r),info:(n,...r)=>Cs.info(`${e}${n}`,...r),warn:(n,...r)=>Cs.warn(`${e}${n}`,...r),error:(n,...r)=>{Cs.error(`${e}${n}`,...r);try{const i=r.map(u=>u instanceof Error?u.message:String(u)).join(" ").slice(0,512),a={source:"ui",error_message:n,service:t??"unknown",error_type:"logged_error",url:window.location.pathname,error_args_count:r.length,...i?{error_detail:i}:{}};Te.capture("logger_error",a)}catch(s){console.error("[logger] Failed to send logger_error to PostHog:",s)}},api:(n,...r)=>Cs.info(`${e}API: ${n}`,...r),hook:(n,...r)=>Cs.debug(`${e}Hook: ${n}`,...r),mount:(n,...r)=>Cs.debug(`${e}Mount: ${n}`,...r)}};let Ep=0;const LU=()=>{Ep+=1;let t=!1;return()=>{t||(t=!0,Ep=Math.max(0,Ep-1))}},OU=()=>Ep>0;function NU(t){return t==="cursor"?"Cursor":t==="codex"?"Codex":t==="claude-desktop"?"Claude":"Claude Code"}const DU=["⡡⠊⢔⠡","⠊⡰⡡⡘","⢔⢅⠈⢢","⡁⢂⠆⡍","⢔⠨⢑⢐","⠨⡑⡠⠊"],Q2=({className:t,"data-testid":e}={})=>S.jsx("div",{className:`rivet-sparkle relative overflow-hidden font-mono leading-none ${t??"text-base text-primary"}`,style:{height:"1em",width:"4ch"},"aria-hidden":"true","data-testid":e,children:S.jsx("div",{className:"rivet-sparkle-strip",children:DU.map((n,r)=>S.jsx("span",{className:"block",style:{height:"1em",lineHeight:"1em"},children:n},r))})}),jU=["top","right","bottom","left"],Yo=Math.min,jr=Math.max,Em=Math.round,ep=Math.floor,ci=t=>({x:t,y:t}),FU={left:"right",right:"left",bottom:"top",top:"bottom"};function p_(t,e,n){return jr(t,Yo(e,n))}function Zi(t,e){return typeof t=="function"?t(e):t}function qi(t){return t.split("-")[0]}function qu(t){return t.split("-")[1]}function J2(t){return t==="x"?"y":"x"}function ex(t){return t==="y"?"height":"width"}function ii(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function tx(t){return J2(ii(t))}function VU(t,e,n){n===void 0&&(n=!1);const r=qu(t),s=tx(t),i=ex(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=km(a)),[a,km(a)]}function $U(t){const e=km(t);return[m_(t),e,m_(e)]}function m_(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Mk=["left","right"],Lk=["right","left"],HU=["top","bottom"],zU=["bottom","top"];function UU(t,e,n){switch(t){case"top":case"bottom":return n?e?Lk:Mk:e?Mk:Lk;case"left":case"right":return e?HU:zU;default:return[]}}function BU(t,e,n,r){const s=qu(t);let i=UU(qi(t),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),e&&(i=i.concat(i.map(m_)))),i}function km(t){const e=qi(t);return FU[e]+t.slice(e.length)}function WU(t){return{top:0,right:0,bottom:0,left:0,...t}}function t5(t){return typeof t!="number"?WU(t):{top:t,right:t,bottom:t,left:t}}function Cm(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function Ok(t,e,n){let{reference:r,floating:s}=t;const i=ii(e),a=tx(e),u=ex(a),c=qi(e),f=i==="y",h=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[u]/2-s[u]/2;let y;switch(c){case"top":y={x:h,y:r.y-s.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(qu(e)){case"start":y[a]-=v*(n&&f?-1:1);break;case"end":y[a]+=v*(n&&f?-1:1);break}return y}async function GU(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:a,elements:u,strategy:c}=t,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:v=!1,padding:y=0}=Zi(e,t),x=t5(y),b=u[v?p==="floating"?"reference":"floating":p],E=Cm(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:f,rootBoundary:h,strategy:c})),C=p==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),T=await(i.isElement==null?void 0:i.isElement(P))?await(i.getScale==null?void 0:i.getScale(P))||{x:1,y:1}:{x:1,y:1},A=Cm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:C,offsetParent:P,strategy:c}):C);return{top:(E.top-A.top+x.top)/T.y,bottom:(A.bottom-E.bottom+x.bottom)/T.y,left:(E.left-A.left+x.left)/T.x,right:(A.right-E.right+x.right)/T.x}}const KU=50,ZU=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:GU},c=await(a.isRTL==null?void 0:a.isRTL(e));let f=await a.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:p}=Ok(f,r,c),v=r,y=0;const x={};for(let _=0;_<i.length;_++){const b=i[_];if(!b)continue;const{name:E,fn:C}=b,{x:P,y:T,data:A,reset:O}=await C({x:h,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:x,rects:f,platform:u,elements:{reference:t,floating:e}});h=P??h,p=T??p,x[E]={...x[E],...A},O&&y<KU&&(y++,typeof O=="object"&&(O.placement&&(v=O.placement),O.rects&&(f=O.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:s}):O.rects),{x:h,y:p}=Ok(f,v,c)),_=-1)}return{x:h,y:p,placement:v,strategy:s,middlewareData:x}},qU=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:a,elements:u,middlewareData:c}=e,{element:f,padding:h=0}=Zi(t,e)||{};if(f==null)return{};const p=t5(h),v={x:n,y:r},y=tx(s),x=ex(y),_=await a.getDimensions(f),b=y==="y",E=b?"top":"left",C=b?"bottom":"right",P=b?"clientHeight":"clientWidth",T=i.reference[x]+i.reference[y]-v[y]-i.floating[x],A=v[y]-i.reference[y],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let M=O?O[P]:0;(!M||!await(a.isElement==null?void 0:a.isElement(O)))&&(M=u.floating[P]||i.floating[x]);const R=T/2-A/2,L=M/2-_[x]/2-1,N=Yo(p[E],L),j=Yo(p[C],L),V=N,G=M-_[x]-j,Y=M/2-_[x]/2+R,K=p_(V,Y,G),B=!c.arrow&&qu(s)!=null&&Y!==K&&i.reference[x]/2-(Y<V?N:j)-_[x]/2<0,X=B?Y<V?Y-V:Y-G:0;return{[y]:v[y]+X,data:{[y]:K,centerOffset:Y-K-X,...B&&{alignmentOffset:X}},reset:B}}}),YU=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:u,platform:c,elements:f}=e,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:_=!0,...b}=Zi(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const E=qi(s),C=ii(u),P=qi(u)===u,T=await(c.isRTL==null?void 0:c.isRTL(f.floating)),A=v||(P||!_?[km(u)]:$U(u)),O=x!=="none";!v&&O&&A.push(...BU(u,_,x,T));const M=[u,...A],R=await c.detectOverflow(e,b),L=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&L.push(R[E]),p){const Y=VU(s,a,T);L.push(R[Y[0]],R[Y[1]])}if(N=[...N,{placement:s,overflows:L}],!L.every(Y=>Y<=0)){var j,V;const Y=(((j=i.flip)==null?void 0:j.index)||0)+1,K=M[Y];if(K&&(!(p==="alignment"?C!==ii(K):!1)||N.every($=>ii($.placement)===C?$.overflows[0]>0:!0)))return{data:{index:Y,overflows:N},reset:{placement:K}};let B=(V=N.filter(X=>X.overflows[0]<=0).sort((X,$)=>X.overflows[1]-$.overflows[1])[0])==null?void 0:V.placement;if(!B)switch(y){case"bestFit":{var G;const X=(G=N.filter($=>{if(O){const ee=ii($.placement);return ee===C||ee==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ee=>ee>0).reduce((ee,H)=>ee+H,0)]).sort(($,ee)=>$[1]-ee[1])[0])==null?void 0:G[0];X&&(B=X);break}case"initialPlacement":B=u;break}if(s!==B)return{reset:{placement:B}}}return{}}}};function Nk(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Dk(t){return jU.some(e=>t[e]>=0)}const XU=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=Zi(t,e);switch(s){case"referenceHidden":{const a=await r.detectOverflow(e,{...i,elementContext:"reference"}),u=Nk(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Dk(u)}}}case"escaped":{const a=await r.detectOverflow(e,{...i,altBoundary:!0}),u=Nk(a,n.floating);return{data:{escapedOffsets:u,escaped:Dk(u)}}}default:return{}}}}},n5=new Set(["left","top"]);async function QU(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=qi(n),u=qu(n),c=ii(n)==="y",f=n5.has(a)?-1:1,h=i&&c?-1:1,p=Zi(e,t);let{mainAxis:v,crossAxis:y,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof x=="number"&&(y=u==="end"?x*-1:x),c?{x:y*h,y:v*f}:{x:v*f,y:y*h}}const JU=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:a,middlewareData:u}=e,c=await QU(e,t);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},eB=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:a=!0,crossAxis:u=!1,limiter:c={fn:E=>{let{x:C,y:P}=E;return{x:C,y:P}}},...f}=Zi(t,e),h={x:n,y:r},p=await i.detectOverflow(e,f),v=ii(qi(s)),y=J2(v);let x=h[y],_=h[v];if(a){const E=y==="y"?"top":"left",C=y==="y"?"bottom":"right",P=x+p[E],T=x-p[C];x=p_(P,x,T)}if(u){const E=v==="y"?"top":"left",C=v==="y"?"bottom":"right",P=_+p[E],T=_-p[C];_=p_(P,_,T)}const b=c.fn({...e,[y]:x,[v]:_});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[v]:u}}}}}},tB=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:i,middlewareData:a}=e,{offset:u=0,mainAxis:c=!0,crossAxis:f=!0}=Zi(t,e),h={x:n,y:r},p=ii(s),v=J2(p);let y=h[v],x=h[p];const _=Zi(u,e),b=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(c){const P=v==="y"?"height":"width",T=i.reference[v]-i.floating[P]+b.mainAxis,A=i.reference[v]+i.reference[P]-b.mainAxis;y<T?y=T:y>A&&(y=A)}if(f){var E,C;const P=v==="y"?"width":"height",T=n5.has(qi(s)),A=i.reference[p]-i.floating[P]+(T&&((E=a.offset)==null?void 0:E[p])||0)+(T?0:b.crossAxis),O=i.reference[p]+i.reference[P]+(T?0:((C=a.offset)==null?void 0:C[p])||0)-(T?b.crossAxis:0);x<A?x=A:x>O&&(x=O)}return{[v]:y,[p]:x}}}},nB=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:a,elements:u}=e,{apply:c=()=>{},...f}=Zi(t,e),h=await a.detectOverflow(e,f),p=qi(s),v=qu(s),y=ii(s)==="y",{width:x,height:_}=i.floating;let b,E;p==="top"||p==="bottom"?(b=p,E=v===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(E=p,b=v==="end"?"top":"bottom");const C=_-h.top-h.bottom,P=x-h.left-h.right,T=Yo(_-h[b],C),A=Yo(x-h[E],P),O=!e.middlewareData.shift;let M=T,R=A;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=P),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(M=C),O&&!v){const N=jr(h.left,0),j=jr(h.right,0),V=jr(h.top,0),G=jr(h.bottom,0);y?R=x-2*(N!==0||j!==0?N+j:jr(h.left,h.right)):M=_-2*(V!==0||G!==0?V+G:jr(h.top,h.bottom))}await c({...e,availableWidth:R,availableHeight:M});const L=await a.getDimensions(u.floating);return x!==L.width||_!==L.height?{reset:{rects:!0}}:{}}}};function l0(){return typeof window<"u"}function Yu(t){return r5(t)?(t.nodeName||"").toLowerCase():"#document"}function Br(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function hi(t){var e;return(e=(r5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function r5(t){return l0()?t instanceof Node||t instanceof Br(t).Node:!1}function Rs(t){return l0()?t instanceof Element||t instanceof Br(t).Element:!1}function Ji(t){return l0()?t instanceof HTMLElement||t instanceof Br(t).HTMLElement:!1}function jk(t){return!l0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Br(t).ShadowRoot}function gf(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Is(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}function rB(t){return/^(table|td|th)$/.test(Yu(t))}function u0(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const sB=/transform|translate|scale|rotate|perspective|filter/,iB=/paint|layout|strict|content/,Aa=t=>!!t&&t!=="none";let o1;function nx(t){const e=Rs(t)?Is(t):t;return Aa(e.transform)||Aa(e.translate)||Aa(e.scale)||Aa(e.rotate)||Aa(e.perspective)||!rx()&&(Aa(e.backdropFilter)||Aa(e.filter))||sB.test(e.willChange||"")||iB.test(e.contain||"")}function oB(t){let e=Xo(t);for(;Ji(e)&&!Fu(e);){if(nx(e))return e;if(u0(e))return null;e=Xo(e)}return null}function rx(){return o1==null&&(o1=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),o1}function Fu(t){return/^(html|body|#document)$/.test(Yu(t))}function Is(t){return Br(t).getComputedStyle(t)}function c0(t){return Rs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Xo(t){if(Yu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||jk(t)&&t.host||hi(t);return jk(e)?e.host:e}function s5(t){const e=Xo(t);return Fu(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ji(e)&&gf(e)?e:s5(e)}function Gd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=s5(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),a=Br(s);if(i){const u=g_(a);return e.concat(a,a.visualViewport||[],gf(s)?s:[],u&&n?Gd(u):[])}else return e.concat(s,Gd(s,[],n))}function g_(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function i5(t){const e=Is(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Ji(t),i=s?t.offsetWidth:n,a=s?t.offsetHeight:r,u=Em(n)!==i||Em(r)!==a;return u&&(n=i,r=a),{width:n,height:r,$:u}}function sx(t){return Rs(t)?t:t.contextElement}function uu(t){const e=sx(t);if(!Ji(e))return ci(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=i5(e);let a=(i?Em(n.width):n.width)/r,u=(i?Em(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const aB=ci(0);function o5(t){const e=Br(t);return!rx()||!e.visualViewport?aB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lB(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Br(t)?!1:e}function dl(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=sx(t);let a=ci(1);e&&(r?Rs(r)&&(a=uu(r)):a=uu(t));const u=lB(i,n,r)?o5(i):ci(0);let c=(s.left+u.x)/a.x,f=(s.top+u.y)/a.y,h=s.width/a.x,p=s.height/a.y;if(i){const v=Br(i),y=r&&Rs(r)?Br(r):r;let x=v,_=g_(x);for(;_&&r&&y!==x;){const b=uu(_),E=_.getBoundingClientRect(),C=Is(_),P=E.left+(_.clientLeft+parseFloat(C.paddingLeft))*b.x,T=E.top+(_.clientTop+parseFloat(C.paddingTop))*b.y;c*=b.x,f*=b.y,h*=b.x,p*=b.y,c+=P,f+=T,x=Br(_),_=g_(x)}}return Cm({width:h,height:p,x:c,y:f})}function d0(t,e){const n=c0(t).scrollLeft;return e?e.left+n:dl(hi(t)).left+n}function a5(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-d0(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function uB(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",a=hi(r),u=e?u0(e.floating):!1;if(r===a||u&&i)return n;let c={scrollLeft:0,scrollTop:0},f=ci(1);const h=ci(0),p=Ji(r);if((p||!p&&!i)&&((Yu(r)!=="body"||gf(a))&&(c=c0(r)),p)){const y=dl(r);f=uu(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const v=a&&!p&&!i?a5(a,c):ci(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+h.x+v.x,y:n.y*f.y-c.scrollTop*f.y+h.y+v.y}}function cB(t){return Array.from(t.getClientRects())}function dB(t){const e=hi(t),n=c0(t),r=t.ownerDocument.body,s=jr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=jr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+d0(t);const u=-n.scrollTop;return Is(r).direction==="rtl"&&(a+=jr(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:u}}const Fk=25;function fB(t,e){const n=Br(t),r=hi(t),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,u=0,c=0;if(s){i=s.width,a=s.height;const h=rx();(!h||h&&e==="fixed")&&(u=s.offsetLeft,c=s.offsetTop)}const f=d0(r);if(f<=0){const h=r.ownerDocument,p=h.body,v=getComputedStyle(p),y=h.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-y);x<=Fk&&(i-=x)}else f<=Fk&&(i+=f);return{width:i,height:a,x:u,y:c}}function hB(t,e){const n=dl(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Ji(t)?uu(t):ci(1),a=t.clientWidth*i.x,u=t.clientHeight*i.y,c=s*i.x,f=r*i.y;return{width:a,height:u,x:c,y:f}}function Vk(t,e,n){let r;if(e==="viewport")r=fB(t,n);else if(e==="document")r=dB(hi(t));else if(Rs(e))r=hB(e,n);else{const s=o5(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Cm(r)}function l5(t,e){const n=Xo(t);return n===e||!Rs(n)||Fu(n)?!1:Is(n).position==="fixed"||l5(n,e)}function pB(t,e){const n=e.get(t);if(n)return n;let r=Gd(t,[],!1).filter(u=>Rs(u)&&Yu(u)!=="body"),s=null;const i=Is(t).position==="fixed";let a=i?Xo(t):t;for(;Rs(a)&&!Fu(a);){const u=Is(a),c=nx(a);!c&&u.position==="fixed"&&(s=null),(i?!c&&!s:!c&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||gf(a)&&!c&&l5(t,a))?r=r.filter(h=>h!==a):s=u,a=Xo(a)}return e.set(t,r),r}function mB(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const a=[...n==="clippingAncestors"?u0(e)?[]:pB(e,this._c):[].concat(n),r],u=Vk(e,a[0],s);let c=u.top,f=u.right,h=u.bottom,p=u.left;for(let v=1;v<a.length;v++){const y=Vk(e,a[v],s);c=jr(y.top,c),f=Yo(y.right,f),h=Yo(y.bottom,h),p=jr(y.left,p)}return{width:f-p,height:h-c,x:p,y:c}}function gB(t){const{width:e,height:n}=i5(t);return{width:e,height:n}}function vB(t,e,n){const r=Ji(e),s=hi(e),i=n==="fixed",a=dl(t,!0,i,e);let u={scrollLeft:0,scrollTop:0};const c=ci(0);function f(){c.x=d0(s)}if(r||!r&&!i)if((Yu(e)!=="body"||gf(s))&&(u=c0(e)),r){const y=dl(e,!0,i,e);c.x=y.x+e.clientLeft,c.y=y.y+e.clientTop}else s&&f();i&&!r&&s&&f();const h=s&&!r&&!i?a5(s,u):ci(0),p=a.left+u.scrollLeft-c.x-h.x,v=a.top+u.scrollTop-c.y-h.y;return{x:p,y:v,width:a.width,height:a.height}}function a1(t){return Is(t).position==="static"}function $k(t,e){if(!Ji(t)||Is(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return hi(t)===n&&(n=n.ownerDocument.body),n}function u5(t,e){const n=Br(t);if(u0(t))return n;if(!Ji(t)){let s=Xo(t);for(;s&&!Fu(s);){if(Rs(s)&&!a1(s))return s;s=Xo(s)}return n}let r=$k(t,e);for(;r&&rB(r)&&a1(r);)r=$k(r,e);return r&&Fu(r)&&a1(r)&&!nx(r)?n:r||oB(t)||n}const yB=async function(t){const e=this.getOffsetParent||u5,n=this.getDimensions,r=await n(t.floating);return{reference:vB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _B(t){return Is(t).direction==="rtl"}const xB={convertOffsetParentRelativeRectToViewportRelativeRect:uB,getDocumentElement:hi,getClippingRect:mB,getOffsetParent:u5,getElementRects:yB,getClientRects:cB,getDimensions:gB,getScale:uu,isElement:Rs,isRTL:_B};function c5(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function wB(t,e){let n=null,r;const s=hi(t);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,c){u===void 0&&(u=!1),c===void 0&&(c=1),i();const f=t.getBoundingClientRect(),{left:h,top:p,width:v,height:y}=f;if(u||e(),!v||!y)return;const x=ep(p),_=ep(s.clientWidth-(h+v)),b=ep(s.clientHeight-(p+y)),E=ep(h),P={rootMargin:-x+"px "+-_+"px "+-b+"px "+-E+"px",threshold:jr(0,Yo(1,c))||1};let T=!0;function A(O){const M=O[0].intersectionRatio;if(M!==c){if(!T)return a();M?a(!1,M):r=setTimeout(()=>{a(!1,1e-7)},1e3)}M===1&&!c5(f,t.getBoundingClientRect())&&a(),T=!1}try{n=new IntersectionObserver(A,{...P,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,P)}n.observe(t)}return a(!0),i}function bB(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,f=sx(t),h=s||i?[...f?Gd(f):[],...e?Gd(e):[]]:[];h.forEach(E=>{s&&E.addEventListener("scroll",n,{passive:!0}),i&&E.addEventListener("resize",n)});const p=f&&u?wB(f,n):null;let v=-1,y=null;a&&(y=new ResizeObserver(E=>{let[C]=E;C&&C.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var P;(P=y)==null||P.observe(e)})),n()}),f&&!c&&y.observe(f),e&&y.observe(e));let x,_=c?dl(t):null;c&&b();function b(){const E=dl(t);_&&!c5(_,E)&&n(),_=E,x=requestAnimationFrame(b)}return n(),()=>{var E;h.forEach(C=>{s&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),p==null||p(),(E=y)==null||E.disconnect(),y=null,c&&cancelAnimationFrame(x)}}const SB=JU,EB=eB,kB=YU,CB=nB,PB=XU,Hk=qU,TB=tB,AB=(t,e,n)=>{const r=new Map,s={platform:xB,...n},i={...s.platform,_c:r};return ZU(t,e,{...s,platform:i})};var RB=typeof document<"u",IB=function(){},kp=RB?g.useLayoutEffect:IB;function Pm(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Pm(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Pm(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function d5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function zk(t,e){const n=d5(t);return Math.round(e*n)/n}function l1(t){const e=g.useRef(t);return kp(()=>{e.current=t}),e}function MB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:u=!0,whileElementsMounted:c,open:f}=t,[h,p]=g.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[v,y]=g.useState(r);Pm(v,r)||y(r);const[x,_]=g.useState(null),[b,E]=g.useState(null),C=g.useCallback($=>{$!==O.current&&(O.current=$,_($))},[]),P=g.useCallback($=>{$!==M.current&&(M.current=$,E($))},[]),T=i||x,A=a||b,O=g.useRef(null),M=g.useRef(null),R=g.useRef(h),L=c!=null,N=l1(c),j=l1(s),V=l1(f),G=g.useCallback(()=>{if(!O.current||!M.current)return;const $={placement:e,strategy:n,middleware:v};j.current&&($.platform=j.current),AB(O.current,M.current,$).then(ee=>{const H={...ee,isPositioned:V.current!==!1};Y.current&&!Pm(R.current,H)&&(R.current=H,qm.flushSync(()=>{p(H)}))})},[v,e,n,j,V]);kp(()=>{f===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p($=>({...$,isPositioned:!1})))},[f]);const Y=g.useRef(!1);kp(()=>(Y.current=!0,()=>{Y.current=!1}),[]),kp(()=>{if(T&&(O.current=T),A&&(M.current=A),T&&A){if(N.current)return N.current(T,A,G);G()}},[T,A,G,N,L]);const K=g.useMemo(()=>({reference:O,floating:M,setReference:C,setFloating:P}),[C,P]),B=g.useMemo(()=>({reference:T,floating:A}),[T,A]),X=g.useMemo(()=>{const $={position:n,left:0,top:0};if(!B.floating)return $;const ee=zk(B.floating,h.x),H=zk(B.floating,h.y);return u?{...$,transform:"translate("+ee+"px, "+H+"px)",...d5(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ee,top:H}},[n,u,B.floating,h.x,h.y]);return g.useMemo(()=>({...h,update:G,refs:K,elements:B,floatingStyles:X}),[h,G,K,B,X])}const LB=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Hk({element:r.current,padding:s}).fn(n):{}:r?Hk({element:r,padding:s}).fn(n):{}}}},OB=(t,e)=>{const n=SB(t);return{name:n.name,fn:n.fn,options:[t,e]}},NB=(t,e)=>{const n=EB(t);return{name:n.name,fn:n.fn,options:[t,e]}},DB=(t,e)=>({fn:TB(t).fn,options:[t,e]}),jB=(t,e)=>{const n=kB(t);return{name:n.name,fn:n.fn,options:[t,e]}},FB=(t,e)=>{const n=CB(t);return{name:n.name,fn:n.fn,options:[t,e]}},VB=(t,e)=>{const n=PB(t);return{name:n.name,fn:n.fn,options:[t,e]}},$B=(t,e)=>{const n=LB(t);return{name:n.name,fn:n.fn,options:[t,e]}};var HB="Arrow",f5=g.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...i}=t;return S.jsx(Rt.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});f5.displayName=HB;var zB=f5;function h5(t){const[e,n]=g.useState(void 0);return ui(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let a,u;if("borderBoxSize"in i){const c=i.borderBoxSize,f=Array.isArray(c)?c[0]:c;a=f.inlineSize,u=f.blockSize}else a=t.offsetWidth,u=t.offsetHeight;n({width:a,height:u})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var ix="Popper",[p5,f0]=na(ix),[UB,m5]=p5(ix),g5=t=>{const{__scopePopper:e,children:n}=t,[r,s]=g.useState(null),[i,a]=g.useState(void 0);return S.jsx(UB,{scope:e,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:a,children:n})};g5.displayName=ix;var v5="PopperAnchor",y5=g.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,i=m5(v5,n),a=g.useRef(null),u=i.onAnchorChange,c=g.useCallback(x=>{a.current=x,x&&u(x)},[u]),f=Yt(e,c),h=g.useRef(null);g.useEffect(()=>{if(!r)return;const x=h.current;h.current=r.current,x!==h.current&&u(h.current)});const p=i.placementState&&ax(i.placementState),v=p==null?void 0:p[0],y=p==null?void 0:p[1];return r?null:S.jsx(Rt.div,{"data-radix-popper-side":v,"data-radix-popper-align":y,...s,ref:f})});y5.displayName=v5;var ox="PopperContent",[BB,WB]=p5(ox),_5=g.forwardRef((t,e)=>{var ie,ae,me,Se,Re,Ke;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:y="optimized",onPlaced:x,..._}=t,b=m5(ox,n),[E,C]=g.useState(null),P=Yt(e,C),[T,A]=g.useState(null),O=h5(T),M=(O==null?void 0:O.width)??0,R=(O==null?void 0:O.height)??0,L=r+(i!=="center"?"-"+i:""),N=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},j=Array.isArray(f)?f:[f],V=j.length>0,G={padding:N,boundary:j.filter(KB),altBoundary:V},{refs:Y,floatingStyles:K,placement:B,isPositioned:X,middlewareData:$}=MB({strategy:"fixed",placement:L,whileElementsMounted:(...it)=>bB(...it,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[OB({mainAxis:s+R,alignmentAxis:a}),c&&NB({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?DB():void 0,...G}),c&&jB({...G}),FB({...G,apply:({elements:it,rects:Oe,availableWidth:at,availableHeight:It})=>{const{width:mt,height:je}=Oe.reference,Qe=it.floating.style;Qe.setProperty("--radix-popper-available-width",`${at}px`),Qe.setProperty("--radix-popper-available-height",`${It}px`),Qe.setProperty("--radix-popper-anchor-width",`${mt}px`),Qe.setProperty("--radix-popper-anchor-height",`${je}px`)}}),T&&$B({element:T,padding:u}),ZB({arrowWidth:M,arrowHeight:R}),v&&VB({strategy:"referenceHidden",...G,boundary:V?G.boundary:void 0})]}),ee=b.setPlacementState;ui(()=>(ee(B),()=>{ee(void 0)}),[B,ee]);const[H,D]=ax(B),q=Du(x);ui(()=>{X&&(q==null||q())},[X,q]);const re=(ie=$.arrow)==null?void 0:ie.x,se=(ae=$.arrow)==null?void 0:ae.y,oe=((me=$.arrow)==null?void 0:me.centerOffset)!==0,[ue,de]=g.useState();return ui(()=>{E&&de(window.getComputedStyle(E).zIndex)},[E]),S.jsx("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:X?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(Se=$.transformOrigin)==null?void 0:Se.x,(Re=$.transformOrigin)==null?void 0:Re.y].join(" "),...((Ke=$.hide)==null?void 0:Ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:S.jsx(BB,{scope:n,placedSide:H,placedAlign:D,onArrowChange:A,arrowX:re,arrowY:se,shouldHideArrow:oe,children:S.jsx(Rt.div,{"data-side":H,"data-align":D,..._,ref:P,style:{..._.style,animation:X?void 0:"none"}})})})});_5.displayName=ox;var x5="PopperArrow",GB={top:"bottom",right:"left",bottom:"top",left:"right"},w5=g.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,i=WB(x5,r),a=GB[i.placedSide];return S.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:S.jsx(zB,{...s,ref:n,style:{...s.style,display:"block"}})})});w5.displayName=x5;function KB(t){return t!==null}var ZB=t=>({name:"transformOrigin",options:t,fn(e){var b,E,C;const{placement:n,rects:r,middlewareData:s}=e,a=((b=s.arrow)==null?void 0:b.centerOffset)!==0,u=a?0:t.arrowWidth,c=a?0:t.arrowHeight,[f,h]=ax(n),p={start:"0%",center:"50%",end:"100%"}[h],v=(((E=s.arrow)==null?void 0:E.x)??0)+u/2,y=(((C=s.arrow)==null?void 0:C.y)??0)+c/2;let x="",_="";return f==="bottom"?(x=a?p:`${v}px`,_=`${-c}px`):f==="top"?(x=a?p:`${v}px`,_=`${r.floating.height+c}px`):f==="right"?(x=`${-c}px`,_=a?p:`${y}px`):f==="left"&&(x=`${r.floating.width+c}px`,_=a?p:`${y}px`),{data:{x,y:_}}}});function ax(t){const[e,n="center"]=t.split("-");return[e,n]}var b5=g5,lx=y5,S5=_5,E5=w5,h0="Popover",[k5]=na(h0,[f0]),vf=f0(),[qB,sa]=k5(h0),C5=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,u=vf(e),c=g.useRef(null),[f,h]=g.useState(!1),[p,v]=fl({prop:r,defaultProp:s??!1,onChange:i,caller:h0});return S.jsx(b5,{...u,children:S.jsx(qB,{scope:e,contentId:il(),triggerRef:c,open:p,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:f,onCustomAnchorAdd:g.useCallback(()=>h(!0),[]),onCustomAnchorRemove:g.useCallback(()=>h(!1),[]),modal:a,children:n})})};C5.displayName=h0;var P5="PopoverAnchor",YB=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=sa(P5,n),i=vf(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:u}=s;return g.useEffect(()=>(a(),()=>u()),[a,u]),S.jsx(lx,{...i,...r,ref:e})});YB.displayName=P5;var T5="PopoverTrigger",A5=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=sa(T5,n),i=vf(n),a=Yt(e,s.triggerRef),u=S.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":O5(s.open),...r,ref:a,onClick:Et(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:S.jsx(lx,{asChild:!0,...i,children:u})});A5.displayName=T5;var ux="PopoverPortal",[XB,QB]=k5(ux,{forceMount:void 0}),R5=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=sa(ux,e);return S.jsx(XB,{scope:e,forceMount:n,children:S.jsx(Qi,{present:n||i.open,children:S.jsx(Xm,{asChild:!0,container:s,children:r})})})};R5.displayName=ux;var Vu="PopoverContent",I5=g.forwardRef((t,e)=>{const n=QB(Vu,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=sa(Vu,t.__scopePopover);return S.jsx(Qi,{present:r||i.open,children:i.modal?S.jsx(eW,{...s,ref:e}):S.jsx(tW,{...s,ref:e})})});I5.displayName=Vu;var JB=Vd("PopoverContent.RemoveScroll"),eW=g.forwardRef((t,e)=>{const n=sa(Vu,t.__scopePopover),r=g.useRef(null),s=Yt(e,r),i=g.useRef(!1);return g.useEffect(()=>{const a=r.current;if(a)return Z3(a)},[]),S.jsx(G2,{as:JB,allowPinchZoom:!0,children:S.jsx(M5,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Et(t.onCloseAutoFocus,a=>{var u;a.preventDefault(),i.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Et(t.onPointerDownOutside,a=>{const u=a.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,f=u.button===2||c;i.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Et(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),tW=g.forwardRef((t,e)=>{const n=sa(Vu,t.__scopePopover),r=g.useRef(!1),s=g.useRef(!1);return S.jsx(M5,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,u;(a=t.onCloseAutoFocus)==null||a.call(t,i),i.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,f;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),M5=g.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:h,...p}=t,v=sa(Vu,n),y=vf(n);return V3(),S.jsx(W2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:S.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onDismiss:()=>v.onOpenChange(!1),deferPointerDownOutside:!0,children:S.jsx(S5,{"data-state":O5(v.open),role:"dialog",id:v.contentId,...y,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),L5="PopoverClose",nW=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=sa(L5,n);return S.jsx(Rt.button,{type:"button",...r,ref:e,onClick:Et(t.onClick,()=>s.onOpenChange(!1))})});nW.displayName=L5;var rW="PopoverArrow",sW=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=vf(n);return S.jsx(E5,{...s,...r,ref:e})});sW.displayName=rW;function O5(t){return t?"open":"closed"}var N5=C5,D5=A5,j5=R5,F5=I5;const V5=({primaryLabel:t,primaryIcon:e,primaryAction:n,isDisabled:r=!1,isDropdownDisabled:s=!1,isLoading:i=!1,loadingLabel:a,dropdownAriaLabel:u="More actions",dropdownItems:c})=>{const[f,h]=g.useState(!1),p=i?a??t:t,v=c.length>0;return S.jsxs("div",{className:"flex items-stretch",children:[S.jsxs("button",{onClick:n,disabled:r||i,className:`bg-main-hover hover:bg-main-input flex h-7 shrink-0 items-center gap-1.5 px-3 text-xs font-medium text-white transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${v?"rounded-l-md":"rounded-md"}`,children:[e?S.jsx(e,{className:"h-3.5 w-3.5",weight:"bold"}):null,p]}),v?S.jsxs(N5,{open:f,onOpenChange:h,children:[S.jsx(D5,{asChild:!0,children:S.jsx("button",{"aria-label":u,disabled:s||i,title:u,className:"bg-main-hover hover:bg-main-input h-7 shrink-0 rounded-r-md border-l border-white/20 px-1.5 text-white transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(cz,{className:"h-3.5 w-3.5",weight:"bold"})})}),S.jsx(j5,{children:S.jsx(F5,{className:"border-divider bg-main z-[60] min-w-[140px] rounded-lg border p-1 shadow-lg",sideOffset:5,align:"end",children:c.map(y=>{const x=y.icon;return S.jsxs("button",{onClick:()=>{y.isDisabled||(y.onClick(),h(!1))},disabled:y.isDisabled,className:"text-content hover:bg-hover flex w-full items-center gap-2 rounded px-3 py-1.5 text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[x?S.jsx(x,{className:"h-3.5 w-3.5",weight:"bold"}):null,y.label]},y.label)})})})]}):null]})};var iW=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),oW="VisuallyHidden",$5=g.forwardRef((t,e)=>S.jsx(Rt.span,{...t,ref:e,style:{...iW,...t.style}}));$5.displayName=oW;var aW=$5,[p0]=na("Tooltip",[f0]),m0=f0(),H5="TooltipProvider",lW=700,v_="tooltip.open",[uW,cx]=p0(H5),z5=t=>{const{__scopeTooltip:e,delayDuration:n=lW,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=g.useRef(!0),u=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),S.jsx(uW,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),a.current=!1)},[r]),onClose:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:u,onPointerInTransitChange:g.useCallback(f=>{u.current=f},[]),disableHoverableContent:s,children:i})};z5.displayName=H5;var Kd="Tooltip",[cW,yf]=p0(Kd),U5=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:u}=t,c=cx(Kd,t.__scopeTooltip),f=m0(e),[h,p]=g.useState(null),v=il(),y=g.useRef(0),x=a??c.disableHoverableContent,_=u??c.delayDuration,b=g.useRef(!1),[E,C]=fl({prop:r,defaultProp:s??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(v_))):c.onClose(),i==null||i(M)},caller:Kd}),P=g.useMemo(()=>E?b.current?"delayed-open":"instant-open":"closed",[E]),T=g.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,C(!0)},[C]),A=g.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C(!1)},[C]),O=g.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,C(!0),y.current=0},_)},[_,C]);return g.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),S.jsx(b5,{...f,children:S.jsx(cW,{scope:e,contentId:v,open:E,stateAttribute:P,trigger:h,onTriggerChange:p,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?O():T()},[c.isOpenDelayedRef,O,T]),onTriggerLeave:g.useCallback(()=>{x?A():(window.clearTimeout(y.current),y.current=0)},[A,x]),onOpen:T,onClose:A,disableHoverableContent:x,children:n})})};U5.displayName=Kd;var y_="TooltipTrigger",B5=g.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=yf(y_,n),i=cx(y_,n),a=m0(n),u=g.useRef(null),c=Yt(e,u,s.onTriggerChange),f=g.useRef(!1),h=g.useRef(!1),p=g.useCallback(()=>f.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),S.jsx(lx,{asChild:!0,...a,children:S.jsx(Rt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Et(t.onPointerMove,v=>{v.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:Et(t.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:Et(t.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Et(t.onFocus,()=>{f.current||s.onOpen()}),onBlur:Et(t.onBlur,s.onClose),onClick:Et(t.onClick,s.onClose)})})});B5.displayName=y_;var dx="TooltipPortal",[dW,fW]=p0(dx,{forceMount:void 0}),W5=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=yf(dx,e);return S.jsx(dW,{scope:e,forceMount:n,children:S.jsx(Qi,{present:n||i.open,children:S.jsx(Xm,{asChild:!0,container:s,children:r})})})};W5.displayName=dx;var $u="TooltipContent",G5=g.forwardRef((t,e)=>{const n=fW($u,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=yf($u,t.__scopeTooltip);return S.jsx(Qi,{present:r||a.open,children:a.disableHoverableContent?S.jsx(K5,{side:s,...i,ref:e}):S.jsx(hW,{side:s,...i,ref:e})})}),hW=g.forwardRef((t,e)=>{const n=yf($u,t.__scopeTooltip),r=cx($u,t.__scopeTooltip),s=g.useRef(null),i=Yt(e,s),[a,u]=g.useState(null),{trigger:c,onClose:f}=n,h=s.current,{onPointerInTransitChange:p}=r,v=g.useCallback(()=>{u(null),p(!1)},[p]),y=g.useCallback((x,_)=>{const b=x.currentTarget,E={x:x.clientX,y:x.clientY},C=yW(E,b.getBoundingClientRect()),P=_W(E,C),T=xW(_.getBoundingClientRect()),A=bW([...P,...T]);u(A),p(!0)},[p]);return g.useEffect(()=>()=>v(),[v]),g.useEffect(()=>{if(c&&h){const x=b=>y(b,h),_=b=>y(b,c);return c.addEventListener("pointerleave",x),h.addEventListener("pointerleave",_),()=>{c.removeEventListener("pointerleave",x),h.removeEventListener("pointerleave",_)}}},[c,h,y,v]),g.useEffect(()=>{if(a){const x=_=>{const b=_.target,E={x:_.clientX,y:_.clientY},C=(c==null?void 0:c.contains(b))||(h==null?void 0:h.contains(b)),P=!wW(E,a);C?v():P&&(v(),f())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,h,a,f,v]),S.jsx(K5,{...t,ref:i})}),[pW,mW]=p0(Kd,{isInside:!1}),gW=_$("TooltipContent"),K5=g.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...u}=t,c=yf($u,n),f=m0(n),{onClose:h}=c;return g.useEffect(()=>(document.addEventListener(v_,h),()=>document.removeEventListener(v_,h)),[h]),g.useEffect(()=>{if(c.trigger){const p=v=>{v.target instanceof Node&&v.target.contains(c.trigger)&&h()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,h]),S.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:h,children:S.jsxs(S5,{"data-state":c.stateAttribute,...f,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[S.jsx(gW,{children:r}),S.jsx(pW,{scope:n,isInside:!0,children:S.jsx(aW,{id:c.contentId,role:"tooltip",children:s||r})})]})})});G5.displayName=$u;var Z5="TooltipArrow",vW=g.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=m0(n);return mW(Z5,n).isInside?null:S.jsx(E5,{...s,...r,ref:e})});vW.displayName=Z5;function yW(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function _W(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function xW(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function wW(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const u=e[i],c=e[a],f=u.x,h=u.y,p=c.x,v=c.y;h>r!=v>r&&n<(p-f)*(r-h)/(v-h)+f&&(s=!s)}return s}function bW(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),SW(e)}function SW(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var EW=z5,kW=U5,CW=B5,PW=W5,TW=G5;const _d={normal:"'wght' 400",medium:"'wght' 450",semibold:"'wght' 550"},q5={pill:{item:"rounded-[20px]",bg:"rounded-[20px]",focusRing:"rounded-[22px]",mergedBg:"rounded-2xl",container:"rounded-3xl",button:"rounded-[20px]",input:"rounded-[20px]"},rounded:{item:"rounded-lg",bg:"rounded-lg",focusRing:"rounded-[10px]",mergedBg:"rounded-lg",container:"rounded-xl",button:"rounded-lg",input:"rounded-lg"}},Y5=g.createContext(null);function g0(){const t=g.useContext(Y5);return t?t.classes:q5.pill}function AW(t){const e=document.documentElement;e.classList.add("transitioning"),e.offsetHeight,t(),setTimeout(()=>e.classList.remove("transitioning"),200)}function RW({children:t,defaultShape:e="pill"}){const[n,r]=g.useState(e),s=g.useCallback(i=>{AW(()=>r(i))},[]);return S.jsx(Y5.Provider,{value:{shape:n,setShape:s,classes:q5[n]},children:t})}const X5=g.createContext(null);function Q5({value:t,children:e}){return S.jsx(X5.Provider,{value:t,children:e})}function IW(t){switch(t){case"top":return{y:4};case"bottom":return{y:-4};case"left":return{x:4};case"right":return{x:-4}}}function fx({content:t,children:e,side:n="top",sideOffset:r=8,delayDuration:s=200,className:i,forceOpen:a,onOpenChange:u}){const[c,f]=g.useState(!1),h=a!==void 0?a:c,[p,v]=g.useState(!1),y=g0(),x=g.useContext(X5);g.useEffect(()=>{h&&v(!0)},[h]);const _=()=>{h||v(!1)},b=IW(n);return S.jsx(EW,{delayDuration:s,children:S.jsxs(kW,{open:h,onOpenChange:E=>{f(E),u==null||u(E)},children:[S.jsx(CW,{asChild:!0,children:e}),p&&S.jsx(PW,{forceMount:!0,container:x??void 0,children:S.jsx(TW,{side:n,sideOffset:r,forceMount:!0,className:"z-tooltip",children:S.jsx(Ki.div,{className:lr("bg-neutral-900 text-white text-[12px] px-2 py-1 border border-white/10 shadow-lg",y.bg,i),style:{fontVariationSettings:_d.medium},initial:{opacity:0,scale:.8,...b},animate:{opacity:h?1:0,scale:h?1:.9,x:0,y:0},transition:h?{type:"spring",duration:.34,bounce:.55}:{duration:.1},onAnimationComplete:_,children:t})})})]})})}const Fo=({label:t,children:e,side:n="top",sideOffset:r=8,delayDuration:s=300,disabled:i=!1,forceOpen:a})=>i?S.jsx(S.Fragment,{children:e}):S.jsx(fx,{content:t,side:n,sideOffset:r,delayDuration:s,forceOpen:a,children:e}),v0="/__rivet/preview",Uk=`${v0}/variant/`,Bk=`${v0}/history/`,J5=t=>t?t.startsWith("/")?t:`/${t}`:"/",MW=t=>`${v0}/variant/${encodeURIComponent(t.sessionId)}/${encodeURIComponent(t.variantId)}${J5(t.routePath)}`,LW=t=>`${v0}/history/${encodeURIComponent(t.sessionId)}/${encodeURIComponent(t.variantId)}${J5(t.routePath)}`,OW=t=>{try{const e=new URL(t,"http://localhost");return e.pathname.startsWith(Uk)||e.pathname.startsWith(Bk)}catch{return t.startsWith(Uk)||t.startsWith(Bk)}},Wk=t=>{var s,i,a,u;const{sessionId:e,variant:n,projectContext:r}=t;return n.status!=="succeeded"?null:((s=n.preview)==null?void 0:s.kind)==="static_artifact"?n.preview.url:e&&(((i=n.preview)==null?void 0:i.kind)==="dev_server"||typeof n.port=="number")?MW({sessionId:e,variantId:n.workItemId,routePath:t.routePath}):e&&(r==null?void 0:r.kind)==="fresh"&&((a=r.executionPlan)==null?void 0:a.mode)!=="vite_app"&&((u=n.preview)==null?void 0:u.kind)!=="dev_server"?`/api/variants/${e}/static/${n.workItemId}`:null},Gk="/rivet/",eA=t=>{if(!t.startsWith(Gk))return null;const e=t.slice(Gk.length);return!e||e==="/"?null:`/${e}`},Zd=(t,e=fetch)=>{if((t==null?void 0:t.source)!=="history-dev-server")return;const n=new URLSearchParams({sessionId:t.sessionId,variantId:t.variantId});e(`/api/variants/history/replay/stop?${n.toString()}`,{method:"POST"}).catch(()=>{})},NW=(t,e=fetch)=>{const n=new Set;for(const r of[t==null?void 0:t.left,t==null?void 0:t.right]){if((r==null?void 0:r.source)!=="history-dev-server")continue;const s=`${r.sessionId}:${r.variantId}`;n.has(s)||(n.add(s),Zd(r,e))}},Kk=6,__="original",hx="Original",px="The original state of your app before any variants were generated.",Zk=200,vn=hs("AgentVariantsPanel"),u1=()=>{var t;(t=window.getSelection())==null||t.removeAllRanges()},DW=t=>t?t.kind==="active"?t.variant.workItemId:`${t.entry.sessionId}:${t.entry.variantId}`:null,Xc=t=>{var e;return!!t.hasTree&&((e=t.serve)==null?void 0:e.kind)==="dev-server"},jW=t=>{var e;return t?t.kind==="existing"?!0:((e=t.executionPlan)==null?void 0:e.mode)==="vite_app":!1};function cu(t,...e){return t?e.some(n=>(n??"").toLowerCase().includes(t)):!0}async function Eo(t){try{const e=await t.json();return{message:typeof e.message=="string"?e.message:null,errorCode:typeof e.errorCode=="string"?e.errorCode:null}}catch{return{message:null,errorCode:null}}}const FW=t=>{var n,r;const e=((r=(n=t.actions)==null?void 0:n.commit)==null?void 0:r.enabled)??t.status==="succeeded";return t.status==="succeeded"&&e},$a=t=>{var e,n;return t.status!=="succeeded"?!1:((n=(e=t.actions)==null?void 0:e.view)==null?void 0:n.enabled)??(!!t.preview||typeof t.port=="number")},tA=t=>t.status==="succeeded"&&!$a(t)&&!t.previewUnavailable,Cp=t=>{var e,n;return((e=t.preview)==null?void 0:e.kind)==="static_artifact"?"static_artifact":((n=t.preview)==null?void 0:n.kind)==="dev_server"||typeof t.port=="number"?"dev_server":"none"},qk=(t,e,n)=>{const r=t.includes("?")?"&":"?";return`${t}${r}${encodeURIComponent(e)}=${encodeURIComponent(n)}`},VW=t=>{var e;return FW(t)&&((e=t.preview)==null?void 0:e.kind)==="static_artifact"},Yk=(t,e)=>t.map(n=>`${n.workItemId}:${e[n.workItemId]??""}`).join("|"),$W=(t,e)=>t.length===e.length&&t.every((n,r)=>{var i,a;const s=e[r];return n.sessionId===s.sessionId&&n.variantId===s.variantId&&n.label===s.label&&n.brief===s.brief&&n.createdAt===s.createdAt&&((i=n.serve)==null?void 0:i.kind)===((a=s.serve)==null?void 0:a.kind)&&n.hasTree===s.hasTree}),HW=()=>{var la,kf,sc,ua;const t=Xe(pf),e=Xe(qT),n=Xe(YT),r=Xe(mf),s=Xe(h_),i=((la=s.deployPrototype)==null?void 0:la.isEnabled)??!1,a=((kf=s.canvasShare)==null?void 0:kf.isEnabled)??!1,u=((sc=s.variantSend)==null?void 0:sc.isEnabled)??!1,c=((ua=s.designContextViewer)==null?void 0:ua.isEnabled)??!1,f=Xe(JT),h=Xe(e5),p=st(l_),v=st(Sm),y=st(u_),x=st(c_),_=st(KT),b=st(ZT),E=st(Wd),C=st(X2),P=st(BT);g.useEffect(()=>(P("Directions"),()=>P(null)),[P]);const T=Xe(qo),A=st(qo),O=g.useCallback(()=>{NW(T),A(null)},[A,T]),M=Xe(d_),R=st(d_),L=Xe(f_),N=st(f_),j=L?`${L.sessionId}:${L.variantId}`:null,[V,G]=g.useState(""),[Y,K]=g.useState(null),[B,X]=g.useState(null),[$,ee]=g.useState({}),[H,D]=g.useState(null),[q,re]=g.useState({}),[se,oe]=g.useState(null),[ue,de]=g.useState([]),ie=g.useRef([]);ie.current=ue;const[ae,me]=g.useState(!1),Se=g.useMemo(()=>t.active?t.variants:[],[t]),Re=g.useMemo(()=>Se.filter(VW),[Se]),Ke=g.useMemo(()=>Yk(Re,$),[Re,$]),it=(H==null?void 0:H.key)===Ke?H.shareUrl:null,Oe=t.active?t.sessionId:null,at=g.useMemo(()=>{const z=new Set;for(const le of ue){const xe=le.parentVariant;xe&&xe.sessionId!==le.sessionId&&z.add(xe.sessionId)}return z},[ue]),It=g.useMemo(()=>{var le;const z=new Set;for(const xe of Se)(le=xe.adoptedSource)!=null&&le.sessionId&&z.add(xe.adoptedSource.sessionId);return z},[Se]),mt=g.useMemo(()=>[...ue.filter(le=>le.sessionId!==Oe&&!at.has(le.sessionId)&&!It.has(le.sessionId))].sort((le,xe)=>{const ge=new Date(le.createdAt).getTime(),we=new Date(xe.createdAt).getTime();return(Number.isNaN(we)?0:we)-(Number.isNaN(ge)?0:ge)}),[ue,Oe,at,It]),je=g.useMemo(()=>L?Se.find(z=>{var le,xe;return((le=z.adoptedSource)==null?void 0:le.sessionId)===L.sessionId&&((xe=z.adoptedSource)==null?void 0:xe.variantId)===L.variantId})??null:null,[L,Se]),Qe=g.useMemo(()=>L?mt.find(z=>z.sessionId===L.sessionId&&z.variantId===L.variantId)??null:null,[L,mt]),lt=t.active?t.projectContext:null,Je=(lt==null?void 0:lt.kind)==="fresh"?lt.workspacePath:n,vt=!t.active&&mt.length>0&&mt.every(z=>z.projectKind==="fresh"),xn=t.active?jW(lt):!!n&&!vt,zt=g.useMemo(()=>Je?`?projectPath=${encodeURIComponent(Je)}`:"",[Je]),An=g.useRef(null),Xn=g.useRef(null),Pr=typeof window>"u"?"/":eA(window.location.pathname)??"/",Qn=g.useRef(null),wn=g.useRef(!1),Os=g.useCallback((z,le)=>{le.button!==0&&le.pointerType==="mouse"||(le.preventDefault(),u1(),Qn.current={kind:"live",variantId:z,startX:le.clientX,startY:le.clientY,committed:!1})},[]),Ns=g.useCallback((z,le)=>{le.button!==0&&le.pointerType==="mouse"||(le.preventDefault(),u1(),Qn.current={kind:"past",entry:z,startX:le.clientX,startY:le.clientY,committed:!1})},[]);g.useEffect(()=>{const z=ge=>{const we=Qn.current;if(!we)return;const Ce=ge.clientX-we.startX,We=ge.clientY-we.startY;if(!we.committed){if(Ce*Ce+We*We<Kk*Kk)return;if(u1(),we.kind==="live"){const ke=Se.find(Mn=>Mn.workItemId===we.variantId);if(!ke||ke.status!=="succeeded"){Qn.current=null;return}const hn=Wk({sessionId:Oe,variant:ke,projectContext:lt,routePath:Pr});E({sessionId:Oe??"",variantId:ke.workItemId,label:ke.label||"Direction",url:hn,source:"live",runLabel:ke.runLabel,description:ke.description})}else{const{entry:ke}=we,hn=Xc(ke),Mn=hn?LW({sessionId:ke.sessionId,variantId:ke.variantId,routePath:Pr}):`/api/variants/history/${encodeURIComponent(ke.sessionId)}/${encodeURIComponent(ke.variantId)}/preview${zt}`;if(E({sessionId:ke.sessionId,variantId:ke.variantId,label:ke.label||"Direction",url:Mn,source:hn?"history-dev-server":"history-static",runLabel:ke.runLabel,description:ke.brief}),hn){const Vs=qk(`/api/variants/history/${encodeURIComponent(ke.sessionId)}/${encodeURIComponent(ke.variantId)}/run${zt}`,"targetAddressed","1");(async()=>{try{if(!(await fetch(Vs,{method:"POST"})).ok)return;const qr=qk(Mn,"replay",String(Date.now()));E(Sn=>!Sn||Sn.sessionId!==ke.sessionId||Sn.variantId!==ke.variantId||Sn.source!=="history-dev-server"?Sn:{...Sn,url:qr}),A(Sn=>{if(!Sn)return Sn;const Yr=Ar=>!Ar||Ar.sessionId!==ke.sessionId||Ar.variantId!==ke.variantId?Ar:{...Ar,url:qr};return{...Sn,left:Yr(Sn.left),right:Yr(Sn.right)}})}catch($s){vn.warn("history replay drag boot failed",$s)}})()}}we.committed=!0}C({x:ge.clientX,y:ge.clientY})},le=()=>{const ge=Qn.current;ge!=null&&ge.committed&&(wn.current=!0),Qn.current=null,C(null)},xe=ge=>{if(ge.key!=="Escape")return;const we=Qn.current;we!=null&&we.committed&&(we.kind==="past"&&Xc(we.entry)&&Zd({sessionId:we.entry.sessionId,variantId:we.entry.variantId,source:"history-dev-server"}),Qn.current=null,E(null),C(null))};return window.addEventListener("pointermove",z),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",le),window.addEventListener("keydown",xe),()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",le),window.removeEventListener("keydown",xe)}},[Se,Oe,lt,Pr,zt,E,C,A]);const Rn=g.useMemo(()=>{var le;if(ae||j)return null;const z=M?Se.find(xe=>xe.workItemId===M):null;return M&&!z?null:z?$a(z)?z.workItemId:null:t.active?((le=Se.find(xe=>{var ge,we;return $a(xe)&&(((ge=xe.preview)==null?void 0:ge.kind)==="static_artifact"||((we=xe.preview)==null?void 0:we.kind)==="dev_server")}))==null?void 0:le.workItemId)??null:null},[M,j,ae,t,Se]),pi=g.useCallback(async z=>{var xe,ge,we,Ce;if(!Oe)return;const le=(z==null?void 0:z.workItemId)??null;K({kind:"switch",variantId:le??void 0});try{if(((xe=z==null?void 0:z.preview)==null?void 0:xe.kind)==="static_artifact"){if(y(!1),x(null),((ge=z.refinement)==null?void 0:ge.status)==="succeeded"){const ke=z.preview.url.includes("?")?"&":"?";v(`${z.preview.url}${ke}refinement=${encodeURIComponent(z.refinement.workItemId)}`)}else v(z.preview.url);p(ke=>ke+1);return}if(le&&Oe&&t.active&&t.projectContext.kind==="fresh"&&((we=t.projectContext.executionPlan)==null?void 0:we.mode)!=="vite_app"&&((Ce=z==null?void 0:z.preview)==null?void 0:Ce.kind)!=="dev_server"){y(!1),x(null),v(`/api/variants/${Oe}/static/${le}`),p(ke=>ke+1);return}const We=z&&le?Wk({sessionId:Oe,variant:z,projectContext:t.active?t.projectContext:null,routePath:Pr}):null;if(We){y(!1),x(null),v(We),p(ke=>ke+1);return}Te.capture("variants_panel.preview_display_failed",{sessionId:Oe,variantId:le,previewKind:z?Cp(z):"none",hasPreview:!!(z!=null&&z.preview),hasPort:typeof(z==null?void 0:z.port)=="number",errorMessage:"No addressable dev-server preview URL"}),y(!1),x(null)}catch(We){vn.warn("preview display failed",We),Te.capture("variants_panel.preview_display_failed",{sessionId:Oe,variantId:le,previewKind:z?Cp(z):"none",hasPreview:!!(z!=null&&z.preview),hasPort:typeof(z==null?void 0:z.port)=="number",errorMessage:We instanceof Error?We.message:String(We)}),y(!1),x(null)}finally{K(null)}},[Oe,t,Pr,p,v,y,x]),mi=g.useRef(!1),ps=g.useRef(null),Ds=g.useRef(0),ur=g.useCallback(()=>{if(Ds.current++,_(!1),b(!1),!mi.current)return;const z=ps.current;mi.current=!1,ps.current=null;const le=z?new URLSearchParams({sessionId:z.sessionId,variantId:z.variantId}):null,xe=le?`/api/variants/history/replay/stop?${le.toString()}`:"/api/variants/history/replay/stop";fetch(xe,{method:"POST"}).catch(ge=>vn.warn("history replay stop failed",ge))},[_,b]),In=g.useCallback(z=>{var Ce,We,ke,hn,Mn;if(wn.current){wn.current=!1;return}const le=$a(z),xe=z.status==="pending"||z.status==="running"||tA(z);if(!le&&!xe)return;ur();const ge=Cp(z),we=Se.find(Vs=>Vs.workItemId===M);Te.capture("variants_panel.preview_requested",{sessionId:Oe,fromVariantId:we==null?void 0:we.workItemId,toVariantId:z.workItemId,variantStatus:z.status,isPreviewReady:le,isArmed:xe,previewKind:ge,hasPreview:!!z.preview,hasPort:typeof z.port=="number",viewEnabled:((We=(Ce=z.actions)==null?void 0:Ce.view)==null?void 0:We.enabled)??null,previewUnavailableReason:((ke=z.previewUnavailable)==null?void 0:ke.reason)??null}),R(z.workItemId),N(null),le?(Xn.current=z.workItemId,me(!1),O(),pi(z)):(me(!1),v(null),y(!1),Te.capture("variants_panel.preview_armed",{sessionId:Oe,fromVariantId:we==null?void 0:we.workItemId,toVariantId:z.workItemId,variantStatus:z.status,previewKind:ge,hasPreview:!!z.preview,hasPort:typeof z.port=="number",viewEnabled:((Mn=(hn=z.actions)==null?void 0:hn.view)==null?void 0:Mn.enabled)??null})),Te.capture("variants_panel.preview_switched",{sessionId:Oe,fromVariantId:we==null?void 0:we.workItemId,toVariantId:z.workItemId,armed:xe})},[M,Oe,O,R,N,ur,pi,Se,v,y]),oa=t.active?`${t.sessionId}:${t.stage}`:"inactive";g.useEffect(()=>{if(r)return;let z=!1;return(async()=>{try{const le=await fetch(`/api/variants/history${zt}`,{credentials:"same-origin"});if(!le.ok)return;const xe=await le.json();if(z)return;const ge=(xe.variants??[]).filter(we=>{var Ce,We;return((Ce=we.preview)==null?void 0:Ce.kind)==="static"||((We=we.serve)==null?void 0:We.kind)==="static"||Xc(we)});if($W(ie.current,ge))return;ie.current=ge,de(ge)}catch(le){vn.warn("Failed to load past variants",le)}})(),()=>{z=!0}},[r,oa,zt]);const Zr=g.useCallback(()=>{mi.current=!1,ps.current=null,_(!1),b(!1),N(null),R(null),me(!0),y(!1),x(null),v(null),p(z=>z+1)},[R,_,b,p,v,x,N,y]),Tr=g.useCallback(z=>{if(wn.current){wn.current=!1;return}if(O(),N({sessionId:z.sessionId,variantId:z.variantId,previewKind:Xc(z)?"dev_server":"static"}),R(null),me(!1),Xc(z)){const le=++Ds.current;mi.current=!0,ps.current={sessionId:z.sessionId,variantId:z.variantId},_(!0),b(!0),(async()=>{K({kind:"switch"}),Te.capture("variants_panel.history_replay_started",{sessionId:z.sessionId,variantId:z.variantId});const xe=ge=>Te.capture("variants_panel.history_replay_failed",{sessionId:z.sessionId,variantId:z.variantId,...ge});try{const ge=await fetch(`/api/variants/history/${encodeURIComponent(z.sessionId)}/${encodeURIComponent(z.variantId)}/run${zt}`,{method:"POST"});if(le!==Ds.current)return;if(!ge.ok){const{errorCode:we}=await Eo(ge);vn.warn(`history replay failed: HTTP ${ge.status} ${we??""}`),xe({httpStatus:ge.status,errorCode:we}),Zr();return}b(!1),y(!0),x(null),v(null),p(we=>we+1),Te.capture("variants_panel.history_replay_ready",{sessionId:z.sessionId,variantId:z.variantId})}catch(ge){if(le!==Ds.current)return;vn.warn("history replay failed",ge),xe({errorMessage:ge instanceof Error?ge.message:String(ge)}),Zr()}finally{K(null)}})();return}ur(),y(!1),x(null),v(`/api/variants/history/${encodeURIComponent(z.sessionId)}/${encodeURIComponent(z.variantId)}/preview${zt}`)},[Zr,K,_,b,p,N,R,v,x,O,y,ur,zt]),gi=g.useCallback(async()=>{ur();const z=()=>{O(),R(null),N(null),me(!0),Xn.current=null,y(!1),x(null),v(null),p(le=>le+1)};if(!Oe){z();return}K({kind:"switch"});try{const le=await fetch(`/api/variants/${Oe}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})});if(!le.ok){vn.warn(`switch to original failed: HTTP ${le.status}`);return}z(),y(!0),Te.capture("variants_panel.preview_switched",{sessionId:Oe,fromVariantId:M,toVariantId:null,target:"original",armed:!1})}catch(le){vn.warn("preview-port original switch failed",le)}finally{K(null)}},[M,Oe,R,N,p,v,x,O,y,ur]),Ze=g.useCallback(async z=>{var xe,ge;const le=((ge=(xe=z.actions)==null?void 0:xe.commit)==null?void 0:ge.enabled)??z.status==="succeeded";if(!(!Oe||!le)){Te.capture("variants_panel.commit_clicked",{sessionId:Oe,variantId:z.workItemId,variantLabel:z.label}),K({kind:"commit",variantId:z.workItemId});try{const we=await fetch(`/api/variants/${Oe}/commit`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:z.workItemId})});if(!we.ok){const{message:We,errorCode:ke}=await Eo(we);vn.warn(`commit failed: HTTP ${we.status} ${ke??""} ${We??""}`),Te.capture("variants_panel.commit_failed",{sessionId:Oe,variantId:z.workItemId,httpStatus:we.status,errorCode:ke??null,errorMessage:We??null}),ht.error("Couldn't send direction",{description:We??`The server rejected the request (HTTP ${we.status}). Try again, or pick a different direction.`});return}const Ce=await we.json().catch(()=>null);Te.capture("variants_panel.commit_succeeded",{sessionId:Oe,variantId:z.workItemId,payloadKind:(Ce==null?void 0:Ce.payloadKind)??null,duplicate:(Ce==null?void 0:Ce.duplicate)??!1}),ht.success(`Sent "${z.label}" to your project`,{description:(Ce==null?void 0:Ce.payloadKind)==="project-created"?`Project created at ${(Ce==null?void 0:Ce.destinationPath)??"destination"}.`:"Direction diff applied to your working tree (uncommitted)."}),(Ce==null?void 0:Ce.payloadKind)!=="project-created"&&(v(null),y(!1),p(We=>We+1))}catch(we){vn.warn("commit failed",we),Te.capture("variants_panel.commit_failed",{sessionId:Oe,variantId:z.workItemId,httpStatus:null,errorCode:"NETWORK_ERROR",errorMessage:we instanceof Error?we.message:String(we)}),ht.error("Couldn't send direction",{description:"Network or server error. Check that the Rivet backend is reachable and try again."})}finally{K(null)}}},[Oe,p,v,y]),Pt=g.useCallback(async(z,le,xe)=>{Te.capture("variants_panel.deploy_clicked",{sessionId:z,variantId:le,variantLabel:xe});try{const ge=await fetch(`/api/variants/${z}/deploy`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:le,...n?{projectPath:n}:{}})});if(!ge.ok){const{message:We,errorCode:ke}=await Eo(ge);return vn.warn(`deploy failed: HTTP ${ge.status} ${ke??""} ${We??""}`),Te.capture("variants_panel.deploy_failed",{sessionId:z,variantId:le,httpStatus:ge.status,errorCode:ke??null,errorMessage:We??null}),ht.error("Couldn't deploy this direction",{description:We??`The server rejected the request (HTTP ${ge.status}). Try again.`}),null}const we=await ge.json().catch(()=>null),Ce=we==null?void 0:we.shareUrl;return Ce?(await navigator.clipboard.writeText(Ce).catch(()=>{}),Te.capture("variants_panel.deploy_succeeded",{sessionId:z,variantId:le}),ht.success(`"${xe}" is live — link copied`,{action:{label:"Open",onClick:()=>window.open(Ce,"_blank","noopener")}}),Ce):(ht.error("Couldn't deploy this direction",{description:"The deploy host returned an unexpected response."}),null)}catch(ge){return vn.warn("deploy failed",ge),Te.capture("variants_panel.deploy_failed",{sessionId:z,variantId:le,httpStatus:null,errorCode:"NETWORK_ERROR",errorMessage:ge instanceof Error?ge.message:String(ge)}),ht.error("Couldn't deploy this direction",{description:"Network or server error. Check that the Rivet backend is reachable and try again."}),null}},[n]),nn=g.useCallback(async z=>{if(!Oe)return;const le=$[z.workItemId];if(le){await navigator.clipboard.writeText(le).catch(()=>{}),ht.success("Share link copied",{action:{label:"Open",onClick:()=>window.open(le,"_blank","noopener")}});return}K({kind:"deploy",variantId:z.workItemId});try{const xe=await Pt(Oe,z.workItemId,z.label);xe&&ee(ge=>({...ge,[z.workItemId]:xe}))}finally{K(null)}},[Oe,$,Pt]),bn=g.useCallback(async()=>{if(!(!Oe||Re.length===0)){if(it){await navigator.clipboard.writeText(it).catch(()=>{}),ht.success("Canvas link copied",{action:{label:"Open",onClick:()=>window.open(it,"_blank","noopener")}});return}Te.capture("variants_panel.deploy_clicked",{sessionId:Oe,variantId:"canvas",variantLabel:"Canvas",variantCount:Re.length}),K({kind:"deploy-canvas"});try{const z=await fetch(`/api/variants/${Oe}/canvas/deploy`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantIds:Re.map(Ce=>Ce.workItemId),...n?{projectPath:n}:{}})});if(!z.ok){const{message:Ce,errorCode:We}=await Eo(z);vn.warn(`canvas deploy failed: HTTP ${z.status} ${We??""} ${Ce??""}`),Te.capture("variants_panel.deploy_failed",{sessionId:Oe,variantId:"canvas",httpStatus:z.status,errorCode:We??null,errorMessage:Ce??null,variantCount:Re.length}),ht.error("Couldn't share this canvas",{description:Ce??`The server rejected the request (HTTP ${z.status}). Try again.`});return}const le=await z.json().catch(()=>null),xe=le==null?void 0:le.shareUrl;if(!xe){ht.error("Couldn't share this canvas",{description:"The deploy host returned an unexpected response."});return}const ge=Object.fromEntries(((le==null?void 0:le.variants)??[]).filter(Ce=>typeof Ce.variantId=="string"&&typeof Ce.shareUrl=="string").map(Ce=>[Ce.variantId,Ce.shareUrl])),we=Object.keys(ge).length>0?{...$,...ge}:$;we!==$&&ee(we),await navigator.clipboard.writeText(xe).catch(()=>{}),D({key:Yk(Re,we),shareUrl:xe}),Te.capture("variants_panel.deploy_succeeded",{sessionId:Oe,variantId:"canvas",variantCount:Re.length}),ht.success("Canvas is live — link copied",{action:{label:"Open",onClick:()=>window.open(xe,"_blank","noopener")}})}catch(z){vn.warn("canvas deploy failed",z),Te.capture("variants_panel.deploy_failed",{sessionId:Oe,variantId:"canvas",httpStatus:null,errorCode:"NETWORK_ERROR",errorMessage:z instanceof Error?z.message:String(z),variantCount:Re.length}),ht.error("Couldn't share this canvas",{description:"Network or server error. Check that the Rivet backend is reachable and try again."})}finally{K(null)}}},[it,Re,$,n,Oe]),js=g.useCallback(async z=>{const le=`${z.sessionId}:${z.variantId}`,xe=q[le];if(xe){await navigator.clipboard.writeText(xe).catch(()=>{}),ht.success("Share link copied",{action:{label:"Open",onClick:()=>window.open(xe,"_blank","noopener")}});return}oe(le);try{const ge=await Pt(z.sessionId,z.variantId,z.label);ge&&re(we=>({...we,[le]:ge}))}finally{oe(null)}},[q,Pt]),Ut=g.useCallback(async z=>{if(Oe){Te.capture("variants_panel.remove_clicked",{sessionId:Oe,variantId:z.workItemId,variantLabelLength:z.label.length}),K({kind:"remove",variantId:z.workItemId});try{const le=await fetch(`/api/variants/${Oe}/${z.workItemId}/remove`,{method:"POST",headers:{"content-type":"application/json"},body:"{}"});if(!le.ok){const{message:xe}=await Eo(le);vn.warn(`remove failed: HTTP ${le.status} ${xe??""}`),ht.error("Couldn't remove direction",{description:xe??`The server rejected the request (HTTP ${le.status}). Try again.`});return}(z.workItemId===Rn||z.workItemId===M)&&(R(null),v(null),y(!1),p(xe=>xe+1))}catch(le){vn.warn("remove failed",le),ht.error("Couldn't remove direction",{description:"Network or server error. Try again."})}finally{K(null)}}},[Oe,M,Rn,R,v,y,p]),rn=g.useCallback(async z=>{if(!Je){ht.error("Couldn't remove direction",{description:"No project path available."});return}Te.capture("variants_panel.remove_past_clicked",{sessionId:z.sessionId,variantId:z.variantId});const le=`${z.sessionId}:${z.variantId}`,xe=ge=>ge.sessionId===z.sessionId&&ge.variantId===z.variantId;K({kind:"remove",variantId:le}),de(ge=>ge.filter(we=>!xe(we))),j===le&&(N(null),v(null),y(!1),p(ge=>ge+1));try{const ge=await fetch(`/api/variants/history/${encodeURIComponent(z.sessionId)}/${encodeURIComponent(z.variantId)}/remove`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectPath:Je})});if(!ge.ok){const{message:we}=await Eo(ge);de(Ce=>Ce.some(xe)?Ce:[...Ce,z]),ht.error("Couldn't remove direction",{description:we??`The server rejected the request (HTTP ${ge.status}). Try again.`})}}catch(ge){vn.warn("remove past failed",ge),de(we=>we.some(xe)?we:[...we,z]),ht.error("Couldn't remove direction",{description:"Network or server error. Try again."})}finally{K(null)}},[Je,j,N,v,y,p]),ms=g.useCallback(z=>{X(z)},[]),fn=g.useCallback(async()=>{if(B)try{B.kind==="active"?await Ut(B.variant):await rn(B.entry)}finally{X(null)}},[B,Ut,rn]),Jn=DW(B),Fs=(Y==null?void 0:Y.kind)==="remove"&&Y.variantId===Jn,[er,aa]=g.useState(null),[Qu,Ju]=g.useState(null),E0=g.useCallback(z=>{Ju(z)},[]),k0=g.useCallback(()=>{Ju(null)},[]),vi=g.useCallback(async z=>{const le=z.trim();if(le)try{await navigator.clipboard.writeText(le),ht.success("Copied")}catch{ht.error("Couldn't copy")}},[]),wf=g.useCallback(async(z,le)=>{Ju(null);const xe=le.trim();if(!xe||z.kind==="original")return;if(z.kind==="active"){if(!Oe||xe===z.variant.label)return;Te.capture("variants_panel.rename",{sessionId:Oe,variantId:z.variant.workItemId,labelLength:xe.length,past:!1});try{const Ce=await fetch(`/api/variants/${Oe}/${z.variant.workItemId}/rename`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:xe})});if(!Ce.ok){const{message:We}=await Eo(Ce);ht.error("Couldn't rename direction",{description:We??`The server rejected the request (HTTP ${Ce.status}). Try again.`})}}catch(Ce){vn.warn("rename failed",Ce),ht.error("Couldn't rename direction",{description:"Network or server error. Try again."})}return}const{entry:ge}=z;if(xe===ge.label.trim())return;if(!Je){ht.error("Couldn't rename direction",{description:"No project path available."});return}Te.capture("variants_panel.rename",{sessionId:ge.sessionId,variantId:ge.variantId,labelLength:xe.length,past:!0});const we=Ce=>Ce.sessionId===ge.sessionId&&Ce.variantId===ge.variantId;de(Ce=>Ce.map(We=>we(We)?{...We,label:xe}:We));try{const Ce=await fetch(`/api/variants/history/${encodeURIComponent(ge.sessionId)}/${encodeURIComponent(ge.variantId)}/rename`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:xe,projectPath:Je})});if(!Ce.ok){const{message:We}=await Eo(Ce);de(ke=>ke.map(hn=>we(hn)?{...hn,label:ge.label}:hn)),ht.error("Couldn't rename direction",{description:We??`The server rejected the request (HTTP ${Ce.status}). Try again.`})}}catch(Ce){vn.warn("rename failed",Ce),de(We=>We.map(ke=>we(ke)?{...ke,label:ge.label}:ke)),ht.error("Couldn't rename direction",{description:"Network or server error. Try again."})}},[Oe,Je]);g.useEffect(()=>{if(An.current!==Oe){const le=An.current===null;if(An.current=Oe,Xn.current=null,D(null),v(null),y(!1),x(null),O(),R(null),N(null),me(!1),!le)return}if(j||ae||!Rn||t.active!==!0||Xn.current===Rn)return;const z=Se.find(le=>le.workItemId===Rn);z&&(Xn.current=Rn,O(),pi(z))},[Oe,j,ae,Rn,t,Se,pi,O,R,N,v,x,y]),g.useEffect(()=>{!L||!je||(Xn.current=null,N(null),R(je.workItemId),me(!1))},[je,L,Oe,R,N]),g.useEffect(()=>{!L||je||Qe||N(null)},[je,L,Qe,Oe,N,mt]),g.useEffect(()=>{const z=V.trim().toLowerCase(),le=Se.filter(ke=>$a(ke)&&cu(z,ke.label,ke.runLabel)),xe=mt.filter(ke=>cu(z,ke.label,ke.runLabel,ke.brief)),ge=xn&&cu(z,hx,px);if(le.length===0&&xe.length===0&&!ge)return;const we=[...le.map(ke=>({source:"live",variant:ke})),...xe.map(ke=>({source:"past",entry:ke})),...ge?[{source:"original"}]:[]],Ce=ke=>ke.source==="live"?`live:${ke.variant.workItemId}`:ke.source==="past"?`past:${ke.entry.sessionId}:${ke.entry.variantId}`:__,We=ke=>{if(OU())return;if(ke.key==="Enter"){const Yr=Se.find(Ar=>Ar.workItemId===er);Yr&&$a(Yr)&&(ke.preventDefault(),In(Yr));return}if(ke.key!=="ArrowUp"&&ke.key!=="ArrowDown")return;ke.preventDefault();let Mn=Rn?`live:${Rn}`:null;j?Mn=`past:${j}`:ae&&(Mn=__);const Vs=Mn?we.findIndex(Yr=>Ce(Yr)===Mn):-1;let $s;if(Vs===-1?$s=ke.key==="ArrowDown"?0:we.length-1:ke.key==="ArrowDown"?$s=Math.min(Vs+1,we.length-1):$s=Math.max(Vs-1,0),$s===Vs)return;const qr=we[$s];qr.source==="live"?In(qr.variant):qr.source==="past"?Tr(qr.entry):gi();const Sn=document.querySelector(`[data-variant-key="${Ce(qr)}"]`);Sn instanceof HTMLElement&&Sn.focus({preventScroll:!0})};return window.addEventListener("keydown",We),()=>window.removeEventListener("keydown",We)},[Se,mt,V,xn,j,ae,Rn,er,In,Tr,gi]);const ml=Se.find(z=>z.workItemId===Rn)??null,ec=j?mt.find(z=>`${z.sessionId}:${z.variantId}`===j)??null:null,tc=!!ec,bf=t.active?t.artifacts??[]:[],nc=t.active?Se.filter(z=>z.status!=="cancelled"):[],eo=[...nc.map(z=>({kind:"active",variant:z})),...mt.map(z=>({kind:"past",entry:z})),...xn?[{kind:"original"}]:[]],Sf=V.trim().toLowerCase(),rc=Sf?eo.filter(z=>WW(z,Sf)):eo,Bt=new Set(Se.map(z=>z.requestId).filter(Boolean)),Ef=e.filter(z=>!Bt.has(z.requestId)),to=Ef.length>0,gl=r&&!to&&eo.length===0;return S.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[eo.length>0?S.jsx("div",{className:"px-3 pt-2 pb-1",children:S.jsxs("div",{className:"relative",children:[S.jsx(fz,{size:13,className:"text-content-muted pointer-events-none absolute top-1/2 left-2 -translate-y-1/2"}),S.jsx("input",{type:"text",value:V,onChange:z=>G(z.target.value),placeholder:"Search directions…","aria-label":"Search directions",className:"border-main-border bg-main-input/40 text-content placeholder:text-content-muted focus:ring-content-muted/40 w-full rounded-md border py-1.5 pr-2 pl-7 text-xs focus:ring-1 focus:outline-none"})]})}):null,S.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-2",children:[to?S.jsx(rG,{groups:Ef}):null,gl?S.jsx(sG,{}):null,t.active&&nc.length===0&&!to&&!gl?S.jsx(iG,{}):null,!t.active&&!to&&!gl&&mt.length===0&&!xn?S.jsx(oG,{isMCPSession:f,mcpEditor:h}):null,eo.length>0&&rc.length===0?S.jsxs("p",{className:"text-content-muted px-1 py-6 text-center text-xs",children:["No directions match “",V.trim(),"”."]}):null,rc.length>0?S.jsx(KW,{rows:rc,activeVariantId:M??Rn,activePastKey:j,isOriginalSelected:ae,busy:Y,editingKey:Qu,onSelectActive:In,onSelectPast:Tr,onSelectOriginal:gi,onActivePointerDown:Os,onPastPointerDown:Ns,onHover:aa,onRemove:z=>ms({kind:"active",variant:z}),onRemovePast:z=>ms({kind:"past",entry:z}),onStartRename:E0,onCommitRename:wf,onCancelRename:k0,onCopyDescription:vi}):null,t.active&&c?S.jsx(JW,{artifacts:bf}):null]}),tc&&ec?S.jsx(YW,{entry:ec,deploying:se===j,deployedUrl:j?q[j]??null:null,onDeploy:js,isDeployDisabled:!i}):null,!tc&&t.active?S.jsx(nG,{selectedVariant:ml,busy:Y,onSend:Ze,onDeploy:nn,onDeployCanvas:bn,canDeploy:i&&(lt==null?void 0:lt.kind)==="fresh",canDeployCanvas:i&&a&&(lt==null?void 0:lt.kind)==="fresh",canSendToAgent:u,canvasVariantCount:Re.length,canvasDeployedUrl:it,deployedUrl:ml?$[ml.workItemId]??null:null}):null,S.jsx(UW,{target:B,isConfirming:Fs,onCancel:()=>X(null),onConfirm:fn})]})},zW=t=>t.kind==="active"?t.variant.label.trim()||"this direction":t.entry.label.trim()||"this direction",UW=({target:t,isConfirming:e,onCancel:n,onConfirm:r})=>{if(!t)return null;const s=zW(t);return S.jsx(e0,{open:!0,onOpenChange:i=>{!i&&!e&&n()},children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{className:"fixed left-1/2 top-1/2 z-max w-[360px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Remove direction?"}),S.jsxs(i0,{className:"text-sm leading-5 text-content-subtle",children:['This removes "',s,'" from the directions list.']}),S.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[S.jsx("button",{type:"button",onClick:n,disabled:e,className:"rounded-md px-3 py-1.5 text-sm font-medium text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),S.jsx("button",{type:"button","aria-label":"Confirm remove direction",onClick:r,disabled:e,className:"rounded-md bg-red-500/15 px-3 py-1.5 text-sm font-medium text-red-200 transition-colors hover:bg-red-500/25 disabled:cursor-not-allowed disabled:opacity-50",children:e?"Removing...":"Remove direction"})]})]})})]})})},BW=t=>t.kind==="active"?`live:${t.variant.workItemId}`:t.kind==="past"?`past:${t.entry.sessionId}:${t.entry.variantId}`:__,WW=(t,e)=>t.kind==="active"?cu(e,t.variant.label,t.variant.runLabel):t.kind==="past"?cu(e,t.entry.label,t.entry.runLabel,t.entry.brief):cu(e,hx,px),GW=t=>t.length<=Zk?t:`${t.slice(0,Zk-1)}…`,KW=({rows:t,activeVariantId:e,activePastKey:n,isOriginalSelected:r,busy:s,editingKey:i,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:f,onPastPointerDown:h,onHover:p,onRemove:v,onRemovePast:y,onStartRename:x,onCommitRename:_,onCancelRename:b,onCopyDescription:E})=>{const C=g.useRef(null),{activeIndex:P,itemRects:T,sessionRef:A,handlers:O,registerItem:M}=jT(C),R=(s==null?void 0:s.kind)==="switch",L=P!==null?T[P]:null;return S.jsxs("div",{ref:C,className:"relative",onMouseEnter:O.onMouseEnter,onMouseMove:O.onMouseMove,onMouseLeave:O.onMouseLeave,children:[S.jsx(Gi,{children:L&&S.jsx(sl.div,{className:"bg-hover pointer-events-none absolute z-0 rounded-md",initial:{opacity:0,top:L.top,left:L.left,width:L.width,height:L.height},animate:{opacity:1,top:L.top,left:L.left,width:L.width,height:L.height},exit:{opacity:0,transition:{duration:.06}},transition:{...Hd.fast,opacity:{duration:.08}}},A.current)}),S.jsx("ul",{className:"relative",children:t.map((N,j)=>{const V=BW(N);let G=!1;return N.kind==="active"?G=N.variant.workItemId===e:N.kind==="past"?G=`${N.entry.sessionId}:${N.entry.variantId}`===n:G=r,S.jsx(ZW,{rowKey:V,row:N,index:j,isSelected:G,isEditing:i===V,isSwitchInFlight:R,busy:s,registerItem:M,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:f,onPastPointerDown:h,onHover:p,onRemove:v,onRemovePast:y,onStartRename:x,onCommitRename:_,onCancelRename:b,onCopyDescription:E},V)})})]})},ZW=({rowKey:t,row:e,index:n,isSelected:r,isEditing:s,isSwitchInFlight:i,busy:a,registerItem:u,onSelectActive:c,onSelectPast:f,onSelectOriginal:h,onActivePointerDown:p,onPastPointerDown:v,onHover:y,onRemove:x,onRemovePast:_,onStartRename:b,onCommitRename:E,onCancelRename:C,onCopyDescription:P})=>{var oe,ue;const T=g.useRef(null);uU(u,n,T);const A=e.kind==="active",O=e.kind==="original",M=e.kind==="active"?e.variant:null,R=e.kind==="past"?e.entry:null,L=A?M.status==="succeeded":!0,N=A?$a(M):!0,j=A?tA(M):!1,V=A&&(M.status==="pending"||M.status==="running"),G=A?L&&(N||j)||V:!0,Y=A&&M.status==="failed",K=A&&M.status==="cancelled",B=A&&(!G||i),X=A&&(a==null?void 0:a.kind)==="remove"&&a.variantId===M.workItemId,$=A&&(((oe=M.refinement)==null?void 0:oe.status)==="pending"||((ue=M.refinement)==null?void 0:ue.status)==="running");let ee=hx;A?ee=M.label||`Direction ${n+1}`:R&&(ee=R.label.trim()||"Untitled direction");let H;A?H=M.runLabel:R&&(H=R.runLabel);let D=px;A?D=M.description:R&&(D=R.brief);const q=D?GW(D):null,re=A?M.changedFilesCount:void 0,se=A&&M.status==="succeeded"&&Cp(M)==="none"&&typeof re=="number"&&re>0?`${re} file${re===1?"":"s"} changed`:null;return s?S.jsx("li",{ref:T,"data-proximity-index":n,className:"group relative z-10",children:S.jsx("div",{className:"bg-main-input flex w-full items-start gap-2 rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsx(qW,{initial:ee,onCommit:de=>E(e,de),onCancel:C}),q&&S.jsx("span",{className:"text-content-muted mt-1 line-clamp-2 block text-xs leading-snug",children:q})]})})}):S.jsxs("li",{ref:T,"data-proximity-index":n,className:"group relative z-10",children:[S.jsx("div",{role:"button",tabIndex:G?0:-1,"data-variant-id":A?M.workItemId:void 0,"data-variant-key":t,onClick:()=>{if(B)return;const de=window.getSelection();de&&!de.isCollapsed||(e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onKeyDown:de=>{B||(de.key==="Enter"||de.key===" ")&&(de.preventDefault(),de.stopPropagation(),e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onPointerDown:de=>{B||(e.kind==="active"?L&&p(e.variant.workItemId,de):e.kind==="past"&&v(e.entry,de))},"aria-pressed":G?r:void 0,"aria-disabled":A?!G:void 0,"aria-busy":V||$,onMouseEnter:A?()=>y(M.workItemId):void 0,onMouseLeave:A?()=>y(null):void 0,className:lr("focus-visible:ring-content-muted/40 flex w-full items-start gap-2 rounded-md px-3 py-2 text-left transition-colors focus:outline-none focus-visible:ring-1",r&&"bg-main-input ring-content-muted/40 ring-1 ring-inset",L&&N&&"cursor-grab active:cursor-grabbing",(V||j)&&"cursor-pointer",!L&&!V&&!j&&"cursor-not-allowed opacity-60",B&&"cursor-not-allowed opacity-50"),style:L?{touchAction:"none"}:void 0,children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[(V||$)&&S.jsx(Q2,{className:"text-content-muted shrink-0 text-sm","data-testid":$&&!V?"variant-refining":void 0}),S.jsx(Fo,{label:"Double-click to rename",disabled:O,children:S.jsx("span",{onDoubleClick:de=>{de.stopPropagation(),O||b(t)},className:lr("min-w-0 flex-1 truncate text-sm font-medium select-text",O?"cursor-default":"cursor-text",L||r?"text-content":"text-content-muted"),children:ee})}),Y&&S.jsx(Xk,{label:"Failed"}),K&&S.jsx(Xk,{label:"Cancelled"}),H&&S.jsx("span",{className:"ml-auto max-w-[8rem] shrink-0 truncate rounded px-1.5 py-0.5 text-[10px] font-medium opacity-100 transition-opacity duration-150 group-hover:opacity-0 group-has-[:focus-visible]:opacity-0",style:DT(H),children:H})]}),q&&S.jsx("span",{className:"text-content-muted mt-0.5 line-clamp-2 block cursor-text text-xs leading-snug select-text",children:q}),se&&S.jsx("span",{"data-testid":"variant-diff-summary",className:"text-content-muted mt-0.5 block text-[11px] leading-snug",children:se})]})}),S.jsxs("div",{className:lr("absolute top-1.5 right-2 flex items-center gap-0.5 transition-opacity duration-150","pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100"),children:[D&&S.jsx(Fo,{label:"Copy description",children:S.jsx("button",{type:"button","aria-label":"Copy description",onClick:de=>{de.stopPropagation();const ie=ee.trim();P(ie?`${ie}
|
|
111
|
-
${D}`:D)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx($d,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:de=>{de.stopPropagation(),b(t)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(hz,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Remove",children:S.jsx("button",{type:"button","data-variant-remove-id":e.kind==="active"?e.variant.workItemId:void 0,"aria-label":"Remove direction",disabled:X,onClick:de=>{de.stopPropagation(),e.kind==="active"?x(e.variant):_(e.entry)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 ml-1 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(gz,{size:13,weight:"bold"})})})]})]})},qW=({initial:t,onCommit:e,onCancel:n})=>{const[r,s]=g.useState(t),i=g.useRef(!1),a=g.useCallback(c=>{c&&(c.focus(),c.select())},[]),u=c=>{i.current||(i.current=!0,c?e(r):n())};return S.jsx("input",{ref:a,type:"text",value:r,maxLength:120,"aria-label":"Rename direction",onChange:c=>s(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),u(!0)):c.key==="Escape"&&(c.preventDefault(),u(!1))},onBlur:()=>u(!0),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),className:"border-content-muted/40 bg-main text-content focus:ring-content-muted/50 w-full rounded border px-1.5 py-0.5 text-sm font-medium focus:ring-1 focus:outline-none"})},Xk=({label:t})=>S.jsx("span",{className:"bg-main-input text-content-muted shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase",children:t}),YW=({entry:t,deploying:e,deployedUrl:n,onDeploy:r,isDeployDisabled:s=!1})=>{const a=e?"Deploying…":n?"Copy link":"Share";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),n?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}),S.jsxs("button",{type:"button",onClick:()=>r(t),disabled:e||s,title:n?`Copy share link (${n})`:"Deploy this direction and get a public link to share",className:"border-main-border text-content hover:bg-main-input flex shrink-0 items-center gap-1 rounded-md border px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[n&&!e?S.jsx($d,{size:12,weight:"bold"}):null,a]})]})},XW={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},QW={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},JW=({artifacts:t})=>{const[e,n]=g.useState(null),r=g.useMemo(()=>e&&t.some(i=>i.id===e)?e:null,[t,e]);if(t.length===0)return null;const s=i=>{n(a=>a===i?null:i)};return S.jsxs("section",{"aria-label":"Directions session artifacts",className:"mt-4",children:[S.jsx("div",{className:"flex shrink-0 items-center px-3 py-2",children:S.jsx("span",{className:"text-content truncate text-sm font-medium",children:"Artifacts"})}),S.jsx("ul",{className:"mt-2 space-y-1 px-1",children:t.map(i=>S.jsx(eG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},eG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=QW[t.kind],s=t.source?XW[t.source]:null,i=[t.kind==="design_context"?null:s,t.summary].filter(Boolean).join(" · "),a=t.kind==="design_context"&&!!t.viewUrl,u=`${e?"Hide":"View"} ${r} artifact${t.label?`: ${t.label}`:""}`;return a?S.jsx("li",{className:"border-main-border rounded-md border",children:S.jsxs("div",{className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"border-content-muted/30 bg-main-input text-content-muted shrink-0 rounded-full border px-2 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("a",{href:t.viewUrl,target:"_blank",rel:"noreferrer","aria-label":`Open ${r} artifact${t.label?`: ${t.label}`:""}`,className:"text-content-muted hover:bg-main-input hover:text-content focus-visible:ring-content-muted/40 shrink-0 rounded p-1 transition-colors focus:outline-none focus-visible:ring-1",children:S.jsx(lz,{className:"h-3.5 w-3.5",weight:"bold"})})]})}):S.jsxs("li",{className:"border-main-border rounded-md border",children:[S.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-label":u,className:"hover:bg-main-input flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs transition-colors",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-content-muted text-[10px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("span",{className:"text-content-muted shrink-0 text-[11px]",children:e?"Hide":"View"})]}),e?S.jsx("div",{className:"border-main-border bg-main-light border-t px-3 py-2",children:S.jsx(tG,{artifact:t})}):null]})},tG=({artifact:t})=>S.jsxs("div",{className:"text-content-muted space-y-1 text-[11px]",children:[t.summary?S.jsx("p",{children:t.summary}):null,t.path?S.jsxs("p",{children:["Stored at ",t.path]}):null,!t.summary&&!t.path?S.jsx("p",{children:"No inline content available for this artifact."}):null]}),nG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:f,deployedUrl:h})=>{var M,R,L,N;const p=t?((R=(M=t.actions)==null?void 0:M.commit)==null?void 0:R.enabled)??t.status==="succeeded":!1,v=p&&e===null,y=(e==null?void 0:e.kind)==="commit"&&e.variantId===(t==null?void 0:t.workItemId),x=(e==null?void 0:e.kind)==="deploy"&&e.variantId===(t==null?void 0:t.workItemId),_=(e==null?void 0:e.kind)==="deploy-canvas",b=!i||!p||e!==null,E=a&&c>0,P=x?"Deploying…":h?"Copy link":"Share",A=_?"Sharing…":f?"Copy canvas link":"Share canvas",O=y?"Applying…":"Apply to project";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsx("div",{className:"min-w-0",children:t?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),h?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}):null}),S.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[S.jsx(V5,{primaryLabel:P,primaryIcon:h&&!x?$d:void 0,primaryAction:()=>{t&&r(t)},isDisabled:b,isDropdownDisabled:e!==null,isLoading:x,loadingLabel:"Deploying…",dropdownAriaLabel:"More share actions",dropdownItems:E?[{label:A,icon:f&&!_?$d:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!v,title:(N=(L=t==null?void 0:t.actions)==null?void 0:L.commit)==null?void 0:N.reason,className:"bg-secondary text-secondary-foreground hover:bg-accent rounded-md px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:O}):null]})]})},nA=()=>S.jsx("div",{"data-testid":"direction-skeleton-row","aria-hidden":"true",className:"flex w-full items-start rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(Q2,{className:"text-content-muted shrink-0 text-sm"}),S.jsx("span",{className:"bg-muted-foreground/15 h-3.5 w-28 animate-pulse rounded"})]}),S.jsx("span",{className:"mt-1.5 flex",children:S.jsx("span",{className:"bg-muted-foreground/10 h-2.5 w-full max-w-[14rem] animate-pulse rounded"})})]})}),rG=({groups:t})=>S.jsx("div",{className:"space-y-0.5",children:t.flatMap(e=>Array.from({length:Math.max(1,e.count)}).map((n,r)=>S.jsx(nA,{},`${e.requestId}-${r}`)))}),sG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(nA,{},e))}),iG=()=>S.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[S.jsx("div",{className:"text-content text-sm",children:"No directions yet"}),S.jsx("div",{className:"text-content-muted text-xs",children:"They’ll appear here as they generate."})]}),Qk="Try different ways to create a dropdown that feels fluid and dynamic",oG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=g.useState(!1),s=NU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(Qk).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})};return S.jsxs("div",{className:"flex flex-col items-start gap-3 px-2 py-2",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"Create your first direction"}),S.jsxs("p",{className:"text-content-muted text-xs",children:["Use ",i," to generate directions."]}),S.jsxs("div",{className:"w-full",children:[S.jsx("p",{className:"text-content-muted mb-2 text-xs",children:"Here's a sample prompt to use:"}),S.jsxs("div",{className:"border-main-border bg-main-input relative rounded-md border px-3 py-2.5 pr-8",children:[S.jsxs("p",{className:"text-content-muted text-xs leading-snug",children:["“",Qk,"”"]}),S.jsx("button",{type:"button",onClick:a,className:"text-content-muted hover:bg-main-border hover:text-content absolute top-2 right-2 rounded p-0.5 transition-colors",title:"Copy to clipboard",children:n?S.jsx(lT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx($d,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},aG=({onClose:t})=>{const e=Xe(BT);return t?S.jsxs("div",{className:"z-10 flex flex-shrink-0 items-center justify-between gap-2 border-b border-main-border bg-main-light px-2.5 py-2.5",children:[e?S.jsx("span",{className:"text-content min-w-0 truncate text-sm font-medium",title:e,children:e}):S.jsx("span",{}),S.jsx(Fo,{label:"Close panel",side:"bottom",children:S.jsx("button",{onClick:t,className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded p-1 text-content-subtle transition-colors hover:bg-main-input hover:text-content",children:S.jsx(pz,{className:"h-4 w-4",weight:"bold"})})})]}):null},lG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',uG=({itemSelector:t=lG,loop:e=!1}={})=>{const n=g.useRef(null),r=g.useRef(null),s=g.useCallback(a=>{var u;n.current=a,a?r.current=LU():((u=r.current)==null||u.call(r),r.current=null)},[]),i=g.useCallback(a=>{var x;const{key:u}=a;if(u!=="ArrowDown"&&u!=="ArrowUp"&&u!=="Home"&&u!=="End")return;const c=n.current;if(!c)return;const f=Array.from(c.querySelectorAll(t));if(f.length===0)return;a.preventDefault(),a.stopPropagation();const h=f.indexOf(document.activeElement),p=f.length-1,v=_=>{if(h===-1)return _===1?0:p;const b=h+_;return e?(b+f.length)%f.length:Math.min(Math.max(b,0),p)};let y;u==="Home"?y=0:u==="End"?y=p:u==="ArrowDown"?y=v(1):y=v(-1),(x=f[y])==null||x.focus()},[t,e]);return{containerRef:s,onKeyDown:i}},Jk="/assets/arena-Db0j1set.png",cG=hs("useIntegrations"),eC=["integrations"],dG="rivet:connect-result",fG=t=>typeof t=="object"&&t!==null&&t.type===dG,hG=et(null),pG=()=>{const t=h8(),[e,n]=Q6(hG),r=H1({queryKey:eC,queryFn:async()=>{const u=await fetch("/api/integrations");if(!u.ok)throw new Error(`Failed to load integrations (${u.status})`);return(await u.json()).integrations??[]},staleTime:1e4}),s=g.useCallback(()=>t.invalidateQueries({queryKey:eC}),[t]),i=g.useCallback(async u=>{const c=window.open("","_blank","width=560,height=720");if(!c)throw new Error("Popup blocked. Allow popups to connect.");n(u);try{const f=await fetch(`/api/integrations/${u}/connect`,{method:"POST"}),h=await f.json().catch(()=>({}));if(!f.ok||!h.authUrl)throw c.close(),new Error(h.error||`Could not connect ${u}`);c.location.href=h.authUrl,await new Promise(p=>{const v=()=>{window.removeEventListener("message",y),clearInterval(x),s(),p()},y=_=>{fG(_.data)&&_.data.provider===u&&(_.data.status==="error"&&cG.warn(`Connect failed for ${u}:`,_.data.message),v())};window.addEventListener("message",y);const x=setInterval(()=>{c.closed&&v()},500)})}finally{n(null)}},[s,n]),a=g.useCallback(async u=>{n(u);try{const c=await fetch(`/api/integrations/${u}`,{method:"DELETE"});if(!c.ok){const f=await c.json().catch(()=>({}));throw new Error(f.error||`Could not disconnect ${u}`)}await s()}finally{n(null)}},[s,n]);return{integrations:r.data??[],isLoading:r.isPending,error:r.error instanceof Error?r.error.message:null,pendingProvider:e,connect:i,disconnect:a,refetch:s}},du=({onClick:t,title:e,shortcut:n,children:r,disabled:s=!1,className:i="",type:a="button","data-cy":u})=>{const c=S.jsx("button",{onClick:t,disabled:s,className:i,type:a,"data-cy":u,children:r});return e?S.jsx(fx,{content:S.jsxs("div",{className:"flex flex-row items-center gap-2",children:[S.jsx("span",{children:e}),n?S.jsx("span",{className:"rounded bg-white/15 px-1.5 py-0.5 text-[11px]",children:n}):null]}),children:c}):c},tC=hs("ConnectorsModal"),mG=()=>S.jsx("svg",{viewBox:"0 0 24 24",className:"h-6 w-6","aria-hidden":"true",children:S.jsx("path",{fill:"currentColor",d:"M12 0C5.373 0 0 5.372 0 12c0 5.084 3.163 9.426 7.627 11.174-.105-.949-.2-2.405.042-3.441.218-.937 1.407-5.965 1.407-5.965s-.359-.719-.359-1.781c0-1.669.967-2.915 2.171-2.915 1.024 0 1.518.769 1.518 1.69 0 1.029-.655 2.568-.994 3.995-.283 1.194.599 2.169 1.777 2.169 2.132 0 3.772-2.249 3.772-5.495 0-2.873-2.064-4.882-5.012-4.882-3.414 0-5.418 2.561-5.418 5.207 0 1.031.397 2.137.893 2.739.098.119.112.223.083.344-.091.379-.293 1.194-.333 1.361-.052.22-.174.266-.401.16-1.499-.698-2.436-2.889-2.436-4.649 0-3.785 2.75-7.262 7.929-7.262 4.163 0 7.398 2.967 7.398 6.931 0 4.136-2.607 7.464-6.227 7.464-1.216 0-2.36-.631-2.75-1.378l-.748 2.853c-.271 1.043-1.002 2.35-1.492 3.146A12.004 12.004 0 0 0 12 24c6.627 0 12-5.373 12-12C24 5.372 18.627 0 12 0z"})}),gG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${Jk})`,maskImage:`url(${Jk})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),vG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(mG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(gG,{})}],yG=({meta:t,integration:e,isPending:n,isHighlighted:r,onConnect:s,onDisconnect:i})=>{const a=(e==null?void 0:e.status)==="connected",u=e!=null&&e.externalUsername?`@${e.externalUsername}`:null;return S.jsxs("article",{className:`flex flex-col rounded-xl bg-main-light p-[18px] ${r?"ring-2 ring-secondary":""}`,children:[S.jsx("span",{className:`grid h-[52px] w-[52px] flex-none place-items-center rounded-xl ${t.tileClassName}`,"aria-hidden":"true",children:t.icon}),S.jsxs("div",{className:"mt-4 flex-1",children:[S.jsxs("h2",{className:"text-content flex items-center gap-1.5 text-[15px] font-semibold",children:[t.name,a?S.jsx(lT,{className:"h-3.5 w-3.5",weight:"bold","aria-hidden":"true"}):null]}),S.jsx("p",{className:"text-content-subtle mt-1 text-[13px] leading-relaxed",children:t.description}),a&&u?S.jsx("p",{className:"text-content-muted mt-2.5 text-xs font-medium",children:u}):null]}),a?S.jsx("button",{type:"button",onClick:i,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-main-input px-3.5 text-[13px] font-semibold text-content-muted transition-colors hover:bg-red-500/10 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:n?"Disconnecting…":"Disconnect"}):S.jsx("button",{type:"button",onClick:s,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-secondary px-3.5 text-[13px] font-semibold text-secondary-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:n?"Connecting…":"Connect"})]})},x_=({isOpen:t,onClose:e,context:n="menu",highlightProvider:r=null})=>{const{integrations:s,isLoading:i,error:a,pendingProvider:u,connect:c,disconnect:f}=pG(),[h,p]=g.useState(null),v=b=>s.find(E=>E.provider===b),y=g.useCallback(b=>{c(b).catch(E=>{const C=E instanceof Error?E.message:"Could not connect.";tC.warn(`Connect error for ${b}:`,C),ht.error(C)})},[c]),x=g.useCallback(b=>{f(b).catch(E=>{const C=E instanceof Error?E.message:"Could not disconnect.";tC.warn(`Disconnect error for ${b}:`,C),ht.error(C)})},[f]),_=n==="onboarding";return S.jsx(e0,{open:t,onOpenChange:b=>!b&&e(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:p,className:"fixed left-1/2 top-1/2 z-max w-[560px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:h,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(du,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Connect your design references to use them with Rivet’s MCP."}),a?S.jsx("p",{className:"rounded-lg bg-red-500/10 px-4 py-3 text-[13px] font-medium text-red-300",children:a}):null,S.jsx("div",{className:"grid grid-cols-2 gap-4",children:vG.map(b=>S.jsx(yG,{meta:b,integration:v(b.provider),isPending:i||u===b.provider,isHighlighted:r===b.provider,onConnect:()=>y(b.provider),onDisconnect:()=>x(b.provider)},b.provider))}),_?S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsx("p",{className:"text-xs text-content-subtle",children:"You can always do this later from the account menu."}),S.jsx("button",{type:"button",onClick:e,className:"active-push flex-none rounded-lg bg-secondary px-3.5 py-2 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent",children:"Skip for now"})]}):null]})]})})]})})},nC=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),_G=hs("SupportTicketModal"),rC=5e3,c1="feedback",xG=t=>{var r;if(!t)return null;const e=(r=t.formErrors)==null?void 0:r[0];if(e)return e;const n=t.fieldErrors??{};for(const s of Object.values(n)){const i=s==null?void 0:s[0];if(i)return i}return null},wG=async t=>{let e;try{e=await t.json()}catch{e=void 0}if(t.status===400){if(typeof(e==null?void 0:e.details)=="string"&&e.details.trim())return e.details;if(typeof(e==null?void 0:e.details)=="object"&&e.details!==null){const n=xG(e.details);if(n)return n}return"Please check your feedback and try again."}return t.status>=500?typeof(e==null?void 0:e.details)=="string"&&e.details.trim()?e.details:"Could not send feedback right now. Please try again later.":typeof(e==null?void 0:e.error)=="string"&&e.error.trim()?e.error:`HTTP ${t.status}`},bG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=QN(),[s,i]=g.useState(""),[a,u]=g.useState(!1),[c,f]=g.useState(null),h=g.useCallback(()=>{i("")},[]),p=g.useCallback(()=>{a||(h(),e())},[a,e,h]),v=g.useCallback(async()=>{const b=s.trim();if(!(!b||a)){u(!0);try{const E=typeof(r==null?void 0:r.get_session_id)=="function"?r.get_session_id():void 0,C=typeof(r==null?void 0:r.get_distinct_id)=="function"?r.get_distinct_id():void 0,P=n==null?void 0:n.trim(),T=await fetch("/api/support/tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:c1,message:b,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:C??void 0,appVersion:"0.13.0",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await wG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:c1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const C=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:c1,error:C}),_G.error("Failed to submit support ticket:",C),ht.error("Could not send feedback",{description:C})}finally{u(!1)}}},[n,a,s,e,r,h]),y=g.useCallback(b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),v())},[v]),x=rC-s.length,_=a||s.trim().length===0;return S.jsx(e0,{open:t,onOpenChange:b=>!b&&p(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:f,className:"fixed left-1/2 top-1/2 z-max w-[440px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:c,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(du,{onClick:p,disabled:a,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Tell us what happened or what we can improve."}),S.jsxs("div",{className:"rounded-lg bg-main-input outline outline-1 outline-transparent transition-[outline-color] focus-within:outline-white/20",children:[S.jsx("textarea",{id:"support-ticket-message","aria-label":"Your feedback",value:s,onChange:b=>i(b.target.value),onKeyDown:y,maxLength:rC,rows:6,disabled:a,placeholder:"What happened?",className:"max-h-64 w-full resize-none overflow-y-auto bg-transparent pb-1 pl-3 pr-3 pt-3 text-sm text-content placeholder-content-subtle focus:outline-none disabled:opacity-50"}),S.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[S.jsx("span",{className:"text-xs text-content-subtle",children:"Context details are included automatically."}),S.jsxs("div",{className:"flex items-center gap-2",children:[x<=500&&S.jsx("span",{className:"text-xs text-content-subtle",children:x}),S.jsx(du,{onClick:v,disabled:_,title:"Send feedback",shortcut:"⌘↵",className:"flex items-center justify-center rounded bg-primary p-1 text-content transition-colors hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-80",children:a?S.jsx(o0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(uz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},SG=hs("ProfileAvatar"),rA=(t,e)=>{const n=(t??"").trim();if(n)return n.split(/\s+/).filter(Boolean)[0]??"";const s=((e??"").split("@")[0]??"").split(/[._\-+]/).filter(Boolean)[0]??"";return s?s[0].toUpperCase()+s.slice(1):""},EG=(t,e)=>rA(t,e).charAt(0).toUpperCase(),kG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Xe(GT),i=Xe(QT),a=Xe(XT),[u,c]=g.useState(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),[y,x]=g.useState(!1),{containerRef:_,onKeyDown:b}=uG(),E=Xe(mf),C=EG(r,s);if(!C)return E?S.jsxs("span",{"data-testid":"profile-avatar-skeleton","aria-hidden":"true",className:`flex shrink-0 items-center gap-2 ${t}`.trim(),children:[S.jsx(nC,{className:"h-7 w-7 rounded-full"}),S.jsx(nC,{className:"h-3 w-16"})]}):null;const P=rA(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,O=async()=>{x(!0);try{const M=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!M.ok)throw new Error(`Logout failed: ${M.status}`)}catch(M){SG.warn("Logout request failed",M),ht.error("Could not log out. Please try again."),x(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(N5,{open:u,onOpenChange:c,children:[S.jsx(D5,{asChild:!0,children:S.jsxs("button",{type:"button","aria-label":"Account",className:`flex shrink-0 select-none items-center gap-2 text-content-muted transition-colors hover:text-content ${t}`,children:[S.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full border border-main-border bg-main-input text-[11px] font-semibold leading-none",children:C}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(j5,{children:S.jsxs(F5,{ref:_,onKeyDown:b,role:"menu",className:"z-[60] min-w-[180px] rounded-lg bg-surface-2 p-1 shadow-lg",side:e,sideOffset:6,align:n,children:[T||A?S.jsxs("div",{className:"border-b border-main-border px-3 py-2",children:[T?S.jsx("div",{className:"truncate text-xs font-medium text-content",children:T}):null,A?S.jsx("div",{className:"truncate text-[11px] text-content-muted",children:A}):null]}):null,S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),h(!0)},disabled:!i||a,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(vT,{className:"h-3.5 w-3.5",weight:"bold"}),"Connect design references"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),v(!0)},className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none",children:[S.jsx(dz,{className:"h-3.5 w-3.5",weight:"bold"}),"Share feedback"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:O,disabled:y,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(mz,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(x_,{isOpen:f,onClose:()=>h(!1)}),S.jsx(bG,{isOpen:p,onClose:()=>v(!1),contactEmail:s??void 0})]})},CG=({onClose:t})=>S.jsxs("div",{className:"bg-main font-main scrollbar-hide relative flex h-full w-full cursor-auto flex-col overflow-hidden shadow-2xl","data-cy":"element-inspector",children:[S.jsx(aG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(HW,{})}),S.jsx("div",{className:"border-main-border bg-main-light flex flex-shrink-0 items-center border-t px-2.5 py-1.5",children:S.jsx(kG,{side:"top",align:"start"})})]}),PG=hs("useServerConfig"),TG=()=>{const[t,e]=g.useState(null),[n,r]=g.useState(!0),[s,i]=g.useState(null),a=g.useCallback(async()=>{var u;try{r(!0),i(null);const c=await fetch("/api/health");if(!c.ok)throw new Error(`Failed to fetch config: ${c.status}`);const f=await c.json();if(!f.framework)throw new Error("Server did not return framework information");const h={userPort:((u=f.ports)==null?void 0:u.userDevServer)||3e3,framework:f.framework};return e(h),h}catch(c){const f=c instanceof Error?c.message:"Failed to fetch server config";throw i(f),PG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},AG="#1C1C20",Ri=[118,118,124],sC=.85,RG=3,IG=.15,tp=36,MG=4.4,LG=.7,OG=3.5,NG=.8,iC=9,DG=11,jG=[1.35,1.12,.95,.85],FG=[0,1.1,2.3,3.1],VG=[0,.35,.16,.13],$G=[.9,.5,.4,.35],Ra=3,d1=[[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.23,level:1},{x1:.14,y1:.28,x2:.3,y2:.87,level:1},{x1:.34,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.155,x2:.225,y2:.205,level:2},{x1:.7,y1:.155,x2:.755,y2:.205,level:2},{x1:.775,y1:.155,x2:.83,y2:.205,level:2},{x1:.165,y1:.32,x2:.275,y2:.375,level:2},{x1:.165,y1:.415,x2:.275,y2:.47,level:2},{x1:.165,y1:.51,x2:.275,y2:.565,level:2},{x1:.37,y1:.32,x2:.585,y2:.56,level:2},{x1:.615,y1:.32,x2:.83,y2:.56,level:2},{x1:.37,y1:.61,x2:.83,y2:.83,level:2},{hline:!0,x1:.39,x2:.81,y:.685,level:3},{hline:!0,x1:.39,x2:.75,y:.755,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.16,y1:.17,x2:.52,y2:.45,level:1},{x1:.58,y1:.17,x2:.685,y2:.29,level:1},{x1:.715,y1:.17,x2:.84,y2:.29,level:1},{x1:.58,y1:.33,x2:.685,y2:.45,level:1},{x1:.715,y1:.33,x2:.84,y2:.45,level:1},{x1:.16,y1:.55,x2:.84,y2:.85,level:1},{x1:.19,y1:.21,x2:.36,y2:.33,level:2},{hline:!0,x1:.19,x2:.48,y:.37,level:3},{hline:!0,x1:.19,x2:.42,y:.42,level:3},{x1:.19,y1:.6,x2:.49,y2:.8,level:2},{hline:!0,x1:.53,x2:.8,y:.63,level:3},{hline:!0,x1:.53,x2:.76,y:.7,level:3},{hline:!0,x1:.53,x2:.79,y:.77,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.22,level:1},{x1:.14,y1:.28,x2:.36,y2:.87,level:1},{x1:.39,y1:.28,x2:.61,y2:.87,level:1},{x1:.64,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.15,x2:.225,y2:.2,level:2},{x1:.165,y1:.32,x2:.335,y2:.52,level:2},{x1:.415,y1:.32,x2:.585,y2:.52,level:2},{x1:.665,y1:.32,x2:.835,y2:.52,level:2},{hline:!0,x1:.165,x2:.335,y:.6,level:3},{hline:!0,x1:.165,x2:.3,y:.67,level:3},{hline:!0,x1:.415,x2:.585,y:.6,level:3},{hline:!0,x1:.415,x2:.55,y:.67,level:3},{hline:!0,x1:.665,x2:.835,y:.6,level:3},{hline:!0,x1:.665,x2:.8,y:.67,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.3,y1:.22,x2:.7,y2:.74,level:1},{x1:.34,y1:.27,x2:.55,y2:.34,level:2},{hline:!0,x1:.36,x2:.64,y:.42,level:3},{hline:!0,x1:.36,x2:.6,y:.49,level:3},{hline:!0,x1:.36,x2:.62,y:.56,level:3},{x1:.5,y1:.63,x2:.575,y2:.69,level:2},{x1:.595,y1:.63,x2:.66,y2:.69,level:2}]],np=t=>{let e=t|0;return e=Math.imul(e^e>>>16,73244475),e=Math.imul(e^e>>>16,73244475),e^=e>>>16,(e>>>0)/4294967296},Pp=t=>{const e=Math.min(1,Math.max(0,t));return e*e*(3-2*e)},Ia=(t,e)=>(Math.round(t/e-.5)+.5)*e,HG=Math.sin(Math.PI/3),oC=(t,e,n,r,s)=>{if(t.beginPath(),e===0)t.arc(n,r,s,0,Math.PI*2);else if(e===1){const i=s*HG;t.moveTo(n,r-s),t.lineTo(n+i,r+s/2),t.lineTo(n-i,r+s/2),t.closePath()}else{const i=s*.85;t.rect(n-i,r-i,i*2,i*2)}t.fill()},zG=(t,e,n)=>{let r;if(n.hline){const s=Math.max(n.x1-t,t-n.x2,0),i=Math.abs(e-n.y1);r=Math.hypot(s,i)-iC}else{const s=Math.max(n.x1-t,t-n.x2,0),i=Math.max(n.y1-e,e-n.y2,0);s===0&&i===0?r=-Math.min(t-n.x1,n.x2-t,e-n.y1,n.y2-e):r=Math.hypot(s,i),r=Math.abs(r)-iC}return Pp(.5-r/(2*DG))},sA=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(WT),r=g.useRef(null),s=g.useCallback(i=>{var N;if((N=r.current)==null||N.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(j=>j+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],f=0,h=0,p=tp,v=tp,y=null,x=null,_=0,b=-1;const E=new Array(33),C=j=>{const V=Math.round(j*32);let G=E[V];if(!G){const Y=V/32,K=Math.round(Ri[0]+(255-Ri[0])*Y),B=Math.round(Ri[1]+(255-Ri[1])*Y),X=Math.round(Ri[2]+(255-Ri[2])*Y);G=`rgba(${K}, ${B}, ${X}, ${sC})`,E[V]=G}return G},P=j=>{const V=1-.35*j,G=Math.round(Ri[0]*V),Y=Math.round(Ri[1]*V),K=Math.round(Ri[2]*V);return`rgba(${G}, ${Y}, ${K}, ${sC})`},T=j=>{let V=Math.floor(Math.random()*d1.length);V===b&&(V=(V+1)%d1.length),b=V;const G=[0,0,0,0],Y=d1[V].map((D,q)=>{const re=D.level,se=G[re]++,oe=FG[re]+se*VG[re],ue=$G[re]+np(V*131+q*17+5)*.2;if(D.hline){const ae=Ia((D.y??0)*h,v);return{hline:!0,x1:Ia(D.x1*f,p),x2:Ia(D.x2*f,p),y1:ae,y2:ae,level:re,start:oe,dur:ue}}const de=Ia(D.x1*f,p),ie=Ia((D.y1??0)*h,v);return{hline:!1,x1:de,y1:ie,x2:Math.max(Ia(D.x2*f,p),de+p),y2:Math.max(Ia((D.y2??0)*h,v),ie+v),level:re,start:oe,dur:ue}}),K=Y.reduce((D,q)=>Math.max(D,q.start+q.dur),0),B=c.length,X=new Float32Array(B*Ra),$=new Int16Array(B*Ra).fill(-1),ee=new Uint8Array(B),H=Y[0];for(let D=0;D<B;D++){const q=c[D];q.x>H.x1&&q.x<H.x2&&q.y>H.y1&&q.y<H.y2&&(ee[D]=1);const re=D*Ra;for(let se=0;se<Y.length;se++){const oe=zG(q.x,q.y,Y[se]);if(oe<=.02)continue;let ue=re;for(let de=re;de<re+Ra;de++){if($[de]===-1){ue=de;break}X[de]<X[ue]&&(ue=de)}($[ue]===-1||oe>X[ue])&&(X[ue]=oe,$[ue]=se)}}return{startT:j,buildEnd:K,els:Y,frame:H,cellQ:X,cellEl:$,inFrame:ee}},A=()=>{const j=i.getBoundingClientRect();f=Math.max(1,j.width),h=Math.max(1,j.height);const V=Math.min(2,window.devicePixelRatio||1);i.width=Math.round(f*V),i.height=Math.round(h*V),a.setTransform(V,0,0,V,0,0);const G=Math.max(8,Math.round(f/tp)),Y=Math.max(6,Math.round(h/tp));p=f/G,v=h/Y,c=[];for(let K=0;K<Y;K++){const B=Y>1?K/(Y-1):.5,X=MG*(1+LG*.4*(B*2-1));for(let $=0;$<G;$++){const ee=K*8191+$*131+1,H={x:($+.5)*p,y:(K+.5)*v,size:X,seed:ee,phase:np(ee),kind:0};H.kind=Math.floor(np(ee*97)*3),c.push(H)}}x=null,y=null},O=new Float32Array(32),M=j=>{a.fillStyle=AG,a.fillRect(0,0,f,h),y||(y=T(j+.2)),j>=y.startT+y.buildEnd+OG&&(x=y,_=j,y=T(j+.2));let V=0;x&&(V=1-Pp((j-_)/NG),V<=0&&(x=null));const G=y;for(let H=0;H<G.els.length;H++){const D=G.els[H];O[H]=Pp(Math.min(1,Math.max(0,(j-G.startT-D.start)/D.dur)))}const Y=O[0],K=P(0),B=P(Y),X=V>0?P(V):K,$=V>0?P(Math.max(Y,V)):B,ee=c.length;for(let H=0;H<ee;H++){const D=c[H];let q=0,re=0;const se=H*Ra;for(let Se=se;Se<se+Ra;Se++){const Re=G.cellEl[Se];if(Re<0)break;const Ke=G.cellQ[Se]*O[Re];Ke>q&&(q=Ke,re=G.els[Re].level)}if(x)for(let Se=se;Se<se+Ra;Se++){const Re=x.cellEl[Se];if(Re<0)break;const Ke=x.cellQ[Se]*V;Ke>q&&(q=Ke,re=x.els[Re].level)}const oe=j/RG+D.phase,ue=Math.floor(oe),de=oe-ue,ie=Pp(Math.min(de,1-de)/IG),ae=Math.floor(np(D.seed*97+ue*7919)*3);ae!==D.kind&&q<.02&&ie<.05&&(D.kind=ae);const me=Math.max(ie*(1-q),q);if(!(me<.01))if(q<.02){const Se=G.inFrame[H]===1,Re=x?x.inFrame[H]===1:!1;Se?a.fillStyle=Re?$:B:a.fillStyle=Re?X:K;const Ke=Math.max(Se?Y:0,Re?V:0);oC(a,D.kind,D.x,D.y,D.size*me*(1-.2*Ke))}else{a.fillStyle=C(q);const Se=1+(jG[re]-1)*q;oC(a,D.kind,D.x,D.y,D.size*me*Se)}}};A();let R=0;if(u)y=T(-100),M(0);else{const j=performance.now(),V=G=>{M((G-j)/1e3),R=requestAnimationFrame(V)};R=requestAnimationFrame(V)}const L=new ResizeObserver(()=>{A(),u&&(y=T(-100),M(0))});L.observe(i),r.current=()=>{cancelAnimationFrame(R),L.disconnect(),e&&n(j=>j-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},UG=async(t=null)=>{if(t)return BG(t);let e;try{e=await fetch("/api/mcp/status")}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}if(e.status===404||!(e.headers.get("content-type")??"").toLowerCase().includes("application/json"))return rp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return rp()}const s=r.devServerHealth;return s?s.ownership==="none"?{isOk:!1,unavailableReason:"upstream_unreachable"}:s.isReachable===!0?{isOk:!0,unavailableReason:"upstream_unreachable"}:{isOk:!1,unavailableReason:s.reason==="rivet_unreachable"?"rivet_unreachable":"upstream_unreachable"}:rp()},BG=async t=>{try{const e=await fetch(t);return{isOk:e.status!==502&&e.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},rp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},aC=hs("usePreviewUpstreamHealth"),WG=500,GG=4e3,KG=15e3,ZG=(t,e={})=>{const n=g.useRef(null),r=g.useRef(null),s=e.probeMsWhileDown??WG,i=e.probeMsWhileUp??GG,a=e.firstUnreachableCaptureAfterMs??KG,u=e.rerunProbeImmediatelyOnVersion,c=e.probePath??null,f=e.skip??!1,[h,p]=g.useState(t==="static"),[v,y]=g.useState(0),[x,_]=g.useState(null),[b,E]=g.useState(0),[C,P]=g.useState(!1),[T,A]=g.useState(!1),[O,M]=g.useState(t==="static"?null:"upstream_unreachable");return g.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),M(null);return}if(f){p(!1),_(null),E(0),P(!1),A(!0),M("upstream_unreachable"),n.current=null;return}let R=!0;const L=Date.now();_(L),E(0),P(!1),p(!1),A(!1),M("upstream_unreachable");const N={current:!1},j={current:!1},V={current:!1},G={current:null},Y={current:!1};let K=null;const B=()=>{V.current||(V.current=!0,R&&A(!0))},X=()=>{K!==null&&(clearTimeout(K),K=null)},$=(H,D)=>{X(),K=setTimeout(D,H)},ee=async()=>{if(!R)return;E(se=>se+1);const{isOk:H,unavailableReason:D}=await UG(c);if(!R)return;if(B(),H){const se=!Y.current;Y.current=!0,p(!0),M(null),G.current=null,j.current=!1,P(!1),N.current?se&&(Te==null||Te.capture("preview_upstream_restored",{framework:t})):(N.current=!0,Te==null||Te.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-L})),$(i,ee);return}const q=Y.current;Y.current=!1,p(!1),M(D),G.current===null&&(G.current=Date.now(),j.current=!1,P(!1)),q&&(Te==null||Te.capture("preview_upstream_lost",{framework:t}),y(se=>se+1),aC.warn("Preview upstream became unavailable after it was ready"));const re=Date.now()-G.current;re>=a&&!j.current&&(j.current=!0,P(!0),Te==null||Te.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:re}),aC.warn("Dev server did not become ready within timeout window")),$(s,ee)};return n.current=()=>$(0,ee),$(0,ee),()=>{R=!1,n.current=null,X()}},[t,s,i,a,c,f]),g.useEffect(()=>{var L;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((L=n.current)==null||L.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:v,probeStartedAt:x,probeAttemptCount:b,isFirstUnreachableWindowExceeded:C,initialProbeComplete:T,unavailableReason:O}};function qG(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const iA=t=>{var e;return t!=="embedded"||typeof window>"u"?"":((e=window.__RIVET_BOOTSTRAP__)==null?void 0:e.previewOrigin)??`${window.location.protocol}//localhost:${window.location.port}`},oA=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${iA(t)}${e}`:e,YG="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",XG=t=>YG,QG=hs("PreviewSurface"),lC=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",aA=({target:t,src:e,framework:n,remountKey:r})=>(Xe(a0),S.jsx("div",{className:"relative h-full w-full",children:S.jsx("iframe",{src:e,className:"h-full w-full border-none",title:"Project Preview",sandbox:XG(),onLoad:()=>{Te==null||Te.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n}))},onError:()=>{Te==null||Te.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n})),QG.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),JG="modulepreload",eK=function(t){return"/"+t},uC={},tK=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),c=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=a(n.map(f=>{if(f=eK(f),f in uC)return;uC[f]=!0;const h=f.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":JG,h||(v.as="script"),v.crossOrigin="",v.href=f,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((y,x)=>{v.addEventListener("load",y),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return s.then(a=>{for(const u of a||[])u.status==="rejected"&&i(u.reason);return e().catch(i)})},nK=g.lazy(()=>tK(()=>Promise.resolve().then(()=>OZ),void 0)),rK={surface:"relative flex h-full w-full items-center justify-center bg-main px-6",overlay:"absolute inset-0 z-10 flex items-center justify-center bg-main/90 px-6",page:"relative flex h-screen w-full items-center justify-center bg-main px-6"},sK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},iK={neutral:"rounded-md border border-divider bg-transparent px-5 py-2 text-sm font-medium text-content transition-colors hover:bg-surface-3",ghost:"rounded-md px-5 py-2 text-sm font-medium text-content-muted transition-colors hover:text-content"},xd=({backdrop:t,media:e,title:n,description:r,actions:s,tone:i="neutral",fill:a="surface",size:u="md",children:c,state:f,role:h="status",busy:p=!1,className:v=""})=>{const y=g.useCallback(_=>{_&&f&&(Te==null||Te.capture("status_surface_shown",{state:f,tone:i,fill:a}))},[f,i,a]),x=!!(e||n||r||c||s!=null&&s.length);return S.jsxs("div",{ref:y,className:`${rK[a]} ${v}`.trim(),role:h,"aria-live":"polite","aria-busy":p||void 0,"data-state":f,children:[t?S.jsx("div",{className:"absolute inset-0",children:t}):null,x?S.jsxs("div",{className:"relative z-10 flex max-w-sm flex-col items-center gap-5 text-center",children:[e,n?S.jsx("h2",{className:sK[u],children:n}):null,r?S.jsx("p",{className:"text-content-muted text-base leading-relaxed",children:r}):null,c,s!=null&&s.length?S.jsx("div",{className:"flex flex-row items-center gap-3",children:s.map(_=>S.jsx("button",{type:"button",onClick:_.onClick,className:iK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},wd=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(sA,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(g.Suspense,{fallback:null,children:S.jsx(nK,{className:"absolute inset-0"})})}):S.jsx(xd,{...r,size:n,busy:!0,media:S.jsx(o0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),lA=({icon:t,...e})=>S.jsx(xd,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Tm=t=>S.jsx(xd,{...t,tone:"error",role:"alert"}),cC="/static/",oK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(cC)}catch{return t.endsWith(cC)}},aK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Xe(l_),a=st(l_),u=Xe(Sm),c=st(Sm),f=Xe(pf),h=Xe(a0),p=Xe(u_),v=Xe(c_),y=Xe(KT),x=Xe(ZT),_=st(c_),b=Xe(qo),E=Xe(f_),C=st(u_),P=f.active&&f.projectContext.kind==="fresh",T=Xe(d_),A=f.active?f.variants.find(je=>je.workItemId===T&&(je.status==="pending"||je.status==="running"||je.status==="succeeded"&&!je.preview&&typeof je.port!="number"&&!je.previewUnavailable))??null:null,O=f.active&&f.variants.some(je=>je.status==="pending"||je.status==="running"),M=P||O,R=f.active?f.variants.find(je=>je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable)??null:null,L=e==="static"&&u!==null&&oK(u);g.useEffect(()=>{f.active||C(!1)},[f.active,C]);const N=g.useRef(!1);g.useEffect(()=>{const je=!!(b!=null&&b.left||b!=null&&b.right),Qe=je&&!N.current;N.current=je;const lt=f.active?f.sessionId:null;!lt||!qG({enteringSplit:Qe,isExistingSession:f.active&&f.projectContext.kind==="existing",hasActiveVariantProxy:p&&v!==null})||(C(!1),_(null),a(Je=>Je+1),fetch(`/api/variants/${encodeURIComponent(lt)}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})}).catch(()=>{}))},[b,f,p,v,C,_,a]);const V=g.useMemo(()=>{var xn;if(p||u&&!L||!f.active)return null;const{stage:je,variants:Qe}=f,lt=je==="ready"||je==="degraded",Je=Qe.some(zt=>{var An,Xn;return((An=zt.refinement)==null?void 0:An.status)==="pending"||((Xn=zt.refinement)==null?void 0:Xn.status)==="running"});if(!lt&&!Je)return null;const vt=Qe.find(zt=>{var An;return zt.status==="succeeded"&&((An=zt.preview)==null?void 0:An.kind)==="static_artifact"});return((xn=vt==null?void 0:vt.preview)==null?void 0:xn.kind)==="static_artifact"?vt.preview.url:null},[L,u,p,f])??u,G=g.useMemo(()=>!f.active||!V?null:f.variants.find(je=>{var Qe;return((Qe=je.preview)==null?void 0:Qe.kind)==="static_artifact"&&V.startsWith(je.preview.url)})??null,[V,f]),Y=g.useMemo(()=>{if((E==null?void 0:E.previewKind)==="static")return{kind:"variant",sessionId:E.sessionId,variantId:E.variantId};if(!f.active)return bm;if(G)return{kind:"variant",sessionId:f.sessionId,variantId:G.workItemId};if(V){const Qe=V.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),lt=Qe!=null&&Qe[1]?decodeURIComponent(Qe[1]):null,Je=Qe!=null&&Qe[2]?decodeURIComponent(Qe[2]):null;if(lt===f.sessionId&&Je&&f.variants.some(zt=>zt.workItemId===Je))return{kind:"variant",sessionId:f.sessionId,variantId:Je};const vt=V.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=vt!=null&&vt[1]?decodeURIComponent(vt[1]):null;if(xn&&f.variants.some(zt=>zt.workItemId===xn))return{kind:"variant",sessionId:f.sessionId,variantId:xn}}const je=!!(b!=null&&b.left||b!=null&&b.right);return(!je||P)&&!V&&p&&v&&f.variants.some(Qe=>Qe.workItemId===v)?{kind:"variant",sessionId:f.sessionId,variantId:v}:(!je||P)&&!V&&T&&f.variants.some(Qe=>Qe.workItemId===T)?{kind:"variant",sessionId:f.sessionId,variantId:T}:bm},[E,G,f,p,v,V,b,P,T]),K=g.useRef(null);g.useEffect(()=>{var Je,vt;if(!G||((Je=G.preview)==null?void 0:Je.kind)!=="static_artifact"||((vt=G.refinement)==null?void 0:vt.status)!=="succeeded")return;const je=`${G.workItemId}:${G.refinement.workItemId}`;if(K.current===je)return;K.current=je;const Qe=G.preview.url.includes("?")?"&":"?",lt=`${G.preview.url}${Qe}refinement=${encodeURIComponent(G.refinement.workItemId)}`;V!==lt&&(c(lt),a(xn=>xn+1))},[V,G,a,c,f]);const B=V!==null&&OW(V),X=V!==null&&!B||P&&!p&&!B,{isUpstreamReady:$,iframeRemountKey:ee,probeAttemptCount:H,initialProbeComplete:D}=ZG(e,{rerunProbeImmediatelyOnVersion:i,probePath:B?V:null,skip:X}),[q,re]=g.useState(()=>y&&$?i:null),se=g.useRef(null);g.useEffect(()=>{if(!y){se.current=null,re(null);return}if(q===i){se.current=null;return}const je=se.current;if(!je||je.remountKey!==i){se.current={remountKey:i,probeAttemptCount:H};return}$&&H>je.probeAttemptCount&&(se.current=null,re(i))},[q,i,y,H,$]);const ue=V!==null&&!B||$,ie=x||y&&q!==i||y&&!ue,ae=`${ee}:${i}`,me=r?`/try/${encodeURIComponent(r)}`:"",Se=eA(window.location.pathname),Re=e==="static"?`${me}/static${Se??"/"}`:`${me}${Se??"/"}`,Ke=iA(h);let it=null;V&&(it=oA({agentApplyMode:h,url:V}));const at=A||ie?"about:blank":(B&&!ue?"about:blank":it)??(s||!ue?"about:blank":`${Ke}${Re}`),It=!!A||!!R||!ue&&D;let mt=null;return ie?mt=S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?mt=A.status==="succeeded"?S.jsx(wd,{fill:"overlay",loader:"spinner",state:"variant_building",title:"Starting preview",description:"Its preview server is starting up."}):S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?mt=S.jsx(Tm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):It&&(mt=M?S.jsx(lA,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Tm,{fill:"overlay",state:"preview_offline",title:"Preview isn't connected",description:"Rivet lost connection to your project.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]})),S.jsxs("div",{className:"relative h-full w-full",children:[mt,S.jsx(aA,{target:Y,src:at,framework:e,remountKey:ae})]})};function dC({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(qo),c=Xe(pf),f=Xe(a0),h=g.useRef(!1),p=g.useCallback(()=>{h.current||(h.current=!0,Zd({source:i,sessionId:e,variantId:n}))},[i,e,n]),v=g.useCallback(()=>{if(a){u(null);return}p(),u(C=>{if(!C)return null;const P={...C};return delete P[t],P.left||P.right?P:null})},[u,t,a,p]),y=g.useMemo(()=>({kind:"variant",sessionId:e,variantId:n}),[e,n]),x=g.useMemo(()=>!c.active||c.sessionId!==e?null:c.variants.find(C=>C.workItemId===n)??null,[e,n,c]),_=g.useMemo(()=>{var P,T;let C=r;if(((P=x==null?void 0:x.preview)==null?void 0:P.kind)==="static_artifact"&&((T=x.refinement)==null?void 0:T.status)==="succeeded"){const A=x.preview.url.includes("?")?"&":"?";C=`${x.preview.url}${A}refinement=${encodeURIComponent(x.refinement.workItemId)}`}return oA({agentApplyMode:f,url:C})},[f,x,r]),b=((E=x==null?void 0:x.refinement)==null?void 0:E.status)==="succeeded"?`${n}:${x.refinement.workItemId}`:n;return S.jsxs("div",{className:"variant-split-secondary","data-cy":"variant-split-pane","data-variant-id":n,children:[S.jsxs("div",{className:"variant-split-secondary-toolbar",children:[S.jsx("span",{className:"variant-split-secondary-label",title:s,children:s}),S.jsx(Fo,{label:"Collapse",children:S.jsx("button",{type:"button",className:"variant-split-secondary-close",onClick:v,"aria-label":"Collapse split view",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",children:S.jsx("path",{d:"M2.5 2.5 L9.5 9.5 M9.5 2.5 L2.5 9.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})})})]}),S.jsx("div",{className:"variant-split-secondary-body relative min-h-0 flex-1",children:S.jsx(aA,{target:y,src:_,framework:"static",remountKey:b})})]})}const fC=240;function lK(){const t=Xe(Wd),e=Xe(X2),n=g.useRef(null);return g.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-fC/2,s=e.y-22;n.current.style.transform=`translate3d(${r}px, ${s}px, 0)`},[t,e]),!t||!e?null:S.jsx("div",{ref:n,"aria-hidden":"true",className:"variant-drag-ghost",style:{width:fC},children:S.jsxs("div",{className:"variant-drag-ghost-body",children:[S.jsxs("div",{className:"variant-drag-ghost-row",children:[S.jsx("div",{className:"variant-drag-ghost-title",children:t.label}),t.runLabel?S.jsx("div",{className:"variant-drag-ghost-tag",style:DT(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function uK(){const t=Xe(Wd),e=Xe(X2),n=Xe(qo),r=st(Wd),s=st(qo),i=g.useRef(null),[a,u]=g.useState(null),[c,f]=g.useState("hidden");g.useEffect(()=>{if(!t){f("hidden"),u(null);return}const v=requestAnimationFrame(()=>f("visible"));return()=>cancelAnimationFrame(v)},[t]);const h=g.useCallback((v,y)=>{const x=i.current;if(!x)return null;const _=x.getBoundingClientRect();return v<_.left||v>_.right||y<_.top||y>_.bottom?null:v<(_.left+_.right)/2?"left":"right"},[]);if(g.useEffect(()=>{if(!t||!e)return;const v=h(e.x,e.y);u(y=>y===v?y:v)},[t,e,h]),g.useEffect(()=>{if(!t)return;const v=y=>{const x=h(y.clientX,y.clientY);if(x&&t.url){const _={sessionId:t.sessionId,variantId:t.variantId,label:t.label,url:t.url,source:t.source},b=n==null?void 0:n[x];b&&(b.sessionId!==_.sessionId||b.variantId!==_.variantId)&&Zd(b),s(E=>({...E??{},[x]:_})),f("exiting"),window.setTimeout(()=>r(null),220)}else Zd(t),f("exiting"),window.setTimeout(()=>r(null),220)};return window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),()=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)}},[t,h,r,s,n]),!t)return null;const p=["variant-drop-zones",c==="visible"&&"is-visible",c==="exiting"&&"is-exiting"].filter(Boolean).join(" ");return S.jsxs("div",{ref:i,className:p,"aria-hidden":"true",children:[S.jsx(hC,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(hC,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function hC({side:t,hovered:e,canDrop:n,label:r}){return S.jsxs("div",{className:["variant-drop-zone",`is-${t}`,e&&"is-hover",!n&&"is-disabled"].filter(Boolean).join(" "),children:[S.jsxs("div",{className:"variant-drop-zone-inner",children:[S.jsx("div",{className:`variant-drop-zone-icon is-${t}`}),S.jsx("div",{className:"variant-drop-zone-caption",children:n?`Add ${t} split`:"Split unavailable for this direction"})]}),S.jsx("div",{className:"variant-drop-zone-preview","aria-hidden":"true",children:S.jsx("div",{className:"variant-drop-zone-preview-label",children:r})}),S.jsx("div",{className:"variant-drop-zone-border"})]})}const uA=(t,e,n)=>{var i,a;if(!t.active||t.sessionId!==e)return null;const r=t.variants.find(u=>u.workItemId===n);if(((i=r==null?void 0:r.preview)==null?void 0:i.kind)!=="static_artifact")return null;if(((a=r.refinement)==null?void 0:a.status)!=="succeeded")return r.preview.url;const s=r.preview.url.includes("?")?"&":"?";return`${r.preview.url}${s}refinement=${encodeURIComponent(r.refinement.workItemId)}`},pC=(t,e)=>{if(!t)return;const n=uA(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},cK=()=>S.jsx("div",{"data-testid":"preview-boot-skeleton",role:"status","aria-busy":"true","aria-label":"Loading preview",className:"bg-main flex h-full min-h-0 w-full flex-1 flex-col p-3",children:S.jsx("div",{className:"border-main-border relative min-h-0 flex-1 overflow-hidden rounded-lg border",children:S.jsx(sA,{trackGlobalLoaderCount:!1})})}),dK=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=TG();return g.useEffect(()=>{i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})},[i]),a?r?S.jsx("div",{className:"bg-main flex h-full min-h-0 w-full flex-1","aria-busy":"true"}):S.jsx(cK,{}):u||!s?S.jsx(Tm,{fill:"surface",size:"sm",state:"preview_config_error",title:"Couldn't load preview",description:"We couldn't load the preview configuration.",actions:[{label:"Retry",onClick:()=>{Te==null||Te.capture("preview_config_retry_clicked"),i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(fK,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function fK(t){const e=Xe(qo),n=Xe(Wd),r=Xe(pf),s=Xe(Sm),i=e==null?void 0:e.left,a=e==null?void 0:e.right,u=g.useMemo(()=>{var A,O;if(!r.active||r.projectContext.kind!=="fresh"||!(!!i!=!!a))return;const _=(A=i??a)==null?void 0:A.variantId,b=r.variants.filter(M=>{var R;return M.status==="succeeded"&&((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=b.find(M=>{var R;return((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.preview.url===E})??b[0];if(((O=P==null?void 0:P.preview)==null?void 0:O.kind)!=="static_artifact")return;const T=uA(r,r.sessionId,P.workItemId);if(T)return{sessionId:r.sessionId,variantId:P.workItemId,label:P.label,url:T,source:"live"}},[r,i,a,s]),c=pC(i,r)??(a?u:void 0),f=pC(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!f,v=!!(c||f),y=S.jsx(aK,{isInteractionDisabled:t.isInteractionDisabled,framework:t.framework,userPort:t.userPort,activeDemoSessionId:t.activeDemoSessionId,holdPreviewNavigation:t.holdHostedTryoutPreviewNavigation});return S.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 flex-col",children:S.jsxs("div",{className:`variant-preview-region relative flex h-full min-h-0 w-full flex-1 flex-col ${n?"is-dragging":""} ${v?"is-split":""}`,children:[S.jsxs("div",{className:"variant-preview-row flex h-full min-h-0 w-full flex-1",children:[c&&S.jsx(dC,{side:"left",sessionId:c.sessionId,variantId:c.variantId,url:c.url,label:c.label,source:c.source,isFallback:h},`left-${c.sessionId}:${c.variantId}:${c.url}`),!(c&&f)&&S.jsx("div",{className:"variant-preview-primary flex h-full min-h-0 flex-1 flex-col",children:y}),f&&S.jsx(dC,{side:"right",sessionId:f.sessionId,variantId:f.variantId,url:f.url,label:f.label,source:f.source,isFallback:p},`right-${f.sessionId}:${f.variantId}:${f.url}`)]}),S.jsx("div",{className:"variant-preview-atmosphere","aria-hidden":"true"}),S.jsx(uK,{}),S.jsx(lK,{})]})})}const cA=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(o0,{className:"h-4 w-4 shrink-0 animate-spin text-primary",weight:"bold"}):null,S.jsx("span",{className:"whitespace-pre-wrap font-sans",children:t})]});function ji(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function dA(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
|
|
111
|
+
${D}`:D)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx($d,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:de=>{de.stopPropagation(),b(t)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(hz,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Remove",children:S.jsx("button",{type:"button","data-variant-remove-id":e.kind==="active"?e.variant.workItemId:void 0,"aria-label":"Remove direction",disabled:X,onClick:de=>{de.stopPropagation(),e.kind==="active"?x(e.variant):_(e.entry)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 ml-1 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(gz,{size:13,weight:"bold"})})})]})]})},qW=({initial:t,onCommit:e,onCancel:n})=>{const[r,s]=g.useState(t),i=g.useRef(!1),a=g.useCallback(c=>{c&&(c.focus(),c.select())},[]),u=c=>{i.current||(i.current=!0,c?e(r):n())};return S.jsx("input",{ref:a,type:"text",value:r,maxLength:120,"aria-label":"Rename direction",onChange:c=>s(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),u(!0)):c.key==="Escape"&&(c.preventDefault(),u(!1))},onBlur:()=>u(!0),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),className:"border-content-muted/40 bg-main text-content focus:ring-content-muted/50 w-full rounded border px-1.5 py-0.5 text-sm font-medium focus:ring-1 focus:outline-none"})},Xk=({label:t})=>S.jsx("span",{className:"bg-main-input text-content-muted shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase",children:t}),YW=({entry:t,deploying:e,deployedUrl:n,onDeploy:r,isDeployDisabled:s=!1})=>{const a=e?"Deploying…":n?"Copy link":"Share";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),n?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}),S.jsxs("button",{type:"button",onClick:()=>r(t),disabled:e||s,title:n?`Copy share link (${n})`:"Deploy this direction and get a public link to share",className:"border-main-border text-content hover:bg-main-input flex shrink-0 items-center gap-1 rounded-md border px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[n&&!e?S.jsx($d,{size:12,weight:"bold"}):null,a]})]})},XW={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},QW={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},JW=({artifacts:t})=>{const[e,n]=g.useState(null),r=g.useMemo(()=>e&&t.some(i=>i.id===e)?e:null,[t,e]);if(t.length===0)return null;const s=i=>{n(a=>a===i?null:i)};return S.jsxs("section",{"aria-label":"Directions session artifacts",className:"mt-4",children:[S.jsx("div",{className:"flex shrink-0 items-center px-3 py-2",children:S.jsx("span",{className:"text-content truncate text-sm font-medium",children:"Artifacts"})}),S.jsx("ul",{className:"mt-2 space-y-1 px-1",children:t.map(i=>S.jsx(eG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},eG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=QW[t.kind],s=t.source?XW[t.source]:null,i=[t.kind==="design_context"?null:s,t.summary].filter(Boolean).join(" · "),a=t.kind==="design_context"&&!!t.viewUrl,u=`${e?"Hide":"View"} ${r} artifact${t.label?`: ${t.label}`:""}`;return a?S.jsx("li",{className:"border-main-border rounded-md border",children:S.jsxs("div",{className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"border-content-muted/30 bg-main-input text-content-muted shrink-0 rounded-full border px-2 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("a",{href:t.viewUrl,target:"_blank",rel:"noreferrer","aria-label":`Open ${r} artifact${t.label?`: ${t.label}`:""}`,className:"text-content-muted hover:bg-main-input hover:text-content focus-visible:ring-content-muted/40 shrink-0 rounded p-1 transition-colors focus:outline-none focus-visible:ring-1",children:S.jsx(lz,{className:"h-3.5 w-3.5",weight:"bold"})})]})}):S.jsxs("li",{className:"border-main-border rounded-md border",children:[S.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-label":u,className:"hover:bg-main-input flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs transition-colors",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-content-muted text-[10px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("span",{className:"text-content-muted shrink-0 text-[11px]",children:e?"Hide":"View"})]}),e?S.jsx("div",{className:"border-main-border bg-main-light border-t px-3 py-2",children:S.jsx(tG,{artifact:t})}):null]})},tG=({artifact:t})=>S.jsxs("div",{className:"text-content-muted space-y-1 text-[11px]",children:[t.summary?S.jsx("p",{children:t.summary}):null,t.path?S.jsxs("p",{children:["Stored at ",t.path]}):null,!t.summary&&!t.path?S.jsx("p",{children:"No inline content available for this artifact."}):null]}),nG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:f,deployedUrl:h})=>{var M,R,L,N;const p=t?((R=(M=t.actions)==null?void 0:M.commit)==null?void 0:R.enabled)??t.status==="succeeded":!1,v=p&&e===null,y=(e==null?void 0:e.kind)==="commit"&&e.variantId===(t==null?void 0:t.workItemId),x=(e==null?void 0:e.kind)==="deploy"&&e.variantId===(t==null?void 0:t.workItemId),_=(e==null?void 0:e.kind)==="deploy-canvas",b=!i||!p||e!==null,E=a&&c>0,P=x?"Deploying…":h?"Copy link":"Share",A=_?"Sharing…":f?"Copy canvas link":"Share canvas",O=y?"Applying…":"Apply to project";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsx("div",{className:"min-w-0",children:t?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),h?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}):null}),S.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[S.jsx(V5,{primaryLabel:P,primaryIcon:h&&!x?$d:void 0,primaryAction:()=>{t&&r(t)},isDisabled:b,isDropdownDisabled:e!==null,isLoading:x,loadingLabel:"Deploying…",dropdownAriaLabel:"More share actions",dropdownItems:E?[{label:A,icon:f&&!_?$d:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!v,title:(N=(L=t==null?void 0:t.actions)==null?void 0:L.commit)==null?void 0:N.reason,className:"bg-secondary text-secondary-foreground hover:bg-accent rounded-md px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:O}):null]})]})},nA=()=>S.jsx("div",{"data-testid":"direction-skeleton-row","aria-hidden":"true",className:"flex w-full items-start rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(Q2,{className:"text-content-muted shrink-0 text-sm"}),S.jsx("span",{className:"bg-muted-foreground/15 h-3.5 w-28 animate-pulse rounded"})]}),S.jsx("span",{className:"mt-1.5 flex",children:S.jsx("span",{className:"bg-muted-foreground/10 h-2.5 w-full max-w-[14rem] animate-pulse rounded"})})]})}),rG=({groups:t})=>S.jsx("div",{className:"space-y-0.5",children:t.flatMap(e=>Array.from({length:Math.max(1,e.count)}).map((n,r)=>S.jsx(nA,{},`${e.requestId}-${r}`)))}),sG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(nA,{},e))}),iG=()=>S.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[S.jsx("div",{className:"text-content text-sm",children:"No directions yet"}),S.jsx("div",{className:"text-content-muted text-xs",children:"They’ll appear here as they generate."})]}),Qk="Try different ways to create a dropdown that feels fluid and dynamic",oG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=g.useState(!1),s=NU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(Qk).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})};return S.jsxs("div",{className:"flex flex-col items-start gap-3 px-2 py-2",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"Create your first direction"}),S.jsxs("p",{className:"text-content-muted text-xs",children:["Use ",i," to generate directions."]}),S.jsxs("div",{className:"w-full",children:[S.jsx("p",{className:"text-content-muted mb-2 text-xs",children:"Here's a sample prompt to use:"}),S.jsxs("div",{className:"border-main-border bg-main-input relative rounded-md border px-3 py-2.5 pr-8",children:[S.jsxs("p",{className:"text-content-muted text-xs leading-snug",children:["“",Qk,"”"]}),S.jsx("button",{type:"button",onClick:a,className:"text-content-muted hover:bg-main-border hover:text-content absolute top-2 right-2 rounded p-0.5 transition-colors",title:"Copy to clipboard",children:n?S.jsx(lT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx($d,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},aG=({onClose:t})=>{const e=Xe(BT);return t?S.jsxs("div",{className:"z-10 flex flex-shrink-0 items-center justify-between gap-2 border-b border-main-border bg-main-light px-2.5 py-2.5",children:[e?S.jsx("span",{className:"text-content min-w-0 truncate text-sm font-medium",title:e,children:e}):S.jsx("span",{}),S.jsx(Fo,{label:"Close panel",side:"bottom",children:S.jsx("button",{onClick:t,className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded p-1 text-content-subtle transition-colors hover:bg-main-input hover:text-content",children:S.jsx(pz,{className:"h-4 w-4",weight:"bold"})})})]}):null},lG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',uG=({itemSelector:t=lG,loop:e=!1}={})=>{const n=g.useRef(null),r=g.useRef(null),s=g.useCallback(a=>{var u;n.current=a,a?r.current=LU():((u=r.current)==null||u.call(r),r.current=null)},[]),i=g.useCallback(a=>{var x;const{key:u}=a;if(u!=="ArrowDown"&&u!=="ArrowUp"&&u!=="Home"&&u!=="End")return;const c=n.current;if(!c)return;const f=Array.from(c.querySelectorAll(t));if(f.length===0)return;a.preventDefault(),a.stopPropagation();const h=f.indexOf(document.activeElement),p=f.length-1,v=_=>{if(h===-1)return _===1?0:p;const b=h+_;return e?(b+f.length)%f.length:Math.min(Math.max(b,0),p)};let y;u==="Home"?y=0:u==="End"?y=p:u==="ArrowDown"?y=v(1):y=v(-1),(x=f[y])==null||x.focus()},[t,e]);return{containerRef:s,onKeyDown:i}},Jk="/assets/arena-Db0j1set.png",cG=hs("useIntegrations"),eC=["integrations"],dG="rivet:connect-result",fG=t=>typeof t=="object"&&t!==null&&t.type===dG,hG=et(null),pG=()=>{const t=h8(),[e,n]=Q6(hG),r=H1({queryKey:eC,queryFn:async()=>{const u=await fetch("/api/integrations");if(!u.ok)throw new Error(`Failed to load integrations (${u.status})`);return(await u.json()).integrations??[]},staleTime:1e4}),s=g.useCallback(()=>t.invalidateQueries({queryKey:eC}),[t]),i=g.useCallback(async u=>{const c=window.open("","_blank","width=560,height=720");if(!c)throw new Error("Popup blocked. Allow popups to connect.");n(u);try{const f=await fetch(`/api/integrations/${u}/connect`,{method:"POST"}),h=await f.json().catch(()=>({}));if(!f.ok||!h.authUrl)throw c.close(),new Error(h.error||`Could not connect ${u}`);c.location.href=h.authUrl,await new Promise(p=>{const v=()=>{window.removeEventListener("message",y),clearInterval(x),s(),p()},y=_=>{fG(_.data)&&_.data.provider===u&&(_.data.status==="error"&&cG.warn(`Connect failed for ${u}:`,_.data.message),v())};window.addEventListener("message",y);const x=setInterval(()=>{c.closed&&v()},500)})}finally{n(null)}},[s,n]),a=g.useCallback(async u=>{n(u);try{const c=await fetch(`/api/integrations/${u}`,{method:"DELETE"});if(!c.ok){const f=await c.json().catch(()=>({}));throw new Error(f.error||`Could not disconnect ${u}`)}await s()}finally{n(null)}},[s,n]);return{integrations:r.data??[],isLoading:r.isPending,error:r.error instanceof Error?r.error.message:null,pendingProvider:e,connect:i,disconnect:a,refetch:s}},du=({onClick:t,title:e,shortcut:n,children:r,disabled:s=!1,className:i="",type:a="button","data-cy":u})=>{const c=S.jsx("button",{onClick:t,disabled:s,className:i,type:a,"data-cy":u,children:r});return e?S.jsx(fx,{content:S.jsxs("div",{className:"flex flex-row items-center gap-2",children:[S.jsx("span",{children:e}),n?S.jsx("span",{className:"rounded bg-white/15 px-1.5 py-0.5 text-[11px]",children:n}):null]}),children:c}):c},tC=hs("ConnectorsModal"),mG=()=>S.jsx("svg",{viewBox:"0 0 24 24",className:"h-6 w-6","aria-hidden":"true",children:S.jsx("path",{fill:"currentColor",d:"M12 0C5.373 0 0 5.372 0 12c0 5.084 3.163 9.426 7.627 11.174-.105-.949-.2-2.405.042-3.441.218-.937 1.407-5.965 1.407-5.965s-.359-.719-.359-1.781c0-1.669.967-2.915 2.171-2.915 1.024 0 1.518.769 1.518 1.69 0 1.029-.655 2.568-.994 3.995-.283 1.194.599 2.169 1.777 2.169 2.132 0 3.772-2.249 3.772-5.495 0-2.873-2.064-4.882-5.012-4.882-3.414 0-5.418 2.561-5.418 5.207 0 1.031.397 2.137.893 2.739.098.119.112.223.083.344-.091.379-.293 1.194-.333 1.361-.052.22-.174.266-.401.16-1.499-.698-2.436-2.889-2.436-4.649 0-3.785 2.75-7.262 7.929-7.262 4.163 0 7.398 2.967 7.398 6.931 0 4.136-2.607 7.464-6.227 7.464-1.216 0-2.36-.631-2.75-1.378l-.748 2.853c-.271 1.043-1.002 2.35-1.492 3.146A12.004 12.004 0 0 0 12 24c6.627 0 12-5.373 12-12C24 5.372 18.627 0 12 0z"})}),gG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${Jk})`,maskImage:`url(${Jk})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),vG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(mG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(gG,{})}],yG=({meta:t,integration:e,isPending:n,isHighlighted:r,onConnect:s,onDisconnect:i})=>{const a=(e==null?void 0:e.status)==="connected",u=e!=null&&e.externalUsername?`@${e.externalUsername}`:null;return S.jsxs("article",{className:`flex flex-col rounded-xl bg-main-light p-[18px] ${r?"ring-2 ring-secondary":""}`,children:[S.jsx("span",{className:`grid h-[52px] w-[52px] flex-none place-items-center rounded-xl ${t.tileClassName}`,"aria-hidden":"true",children:t.icon}),S.jsxs("div",{className:"mt-4 flex-1",children:[S.jsxs("h2",{className:"text-content flex items-center gap-1.5 text-[15px] font-semibold",children:[t.name,a?S.jsx(lT,{className:"h-3.5 w-3.5",weight:"bold","aria-hidden":"true"}):null]}),S.jsx("p",{className:"text-content-subtle mt-1 text-[13px] leading-relaxed",children:t.description}),a&&u?S.jsx("p",{className:"text-content-muted mt-2.5 text-xs font-medium",children:u}):null]}),a?S.jsx("button",{type:"button",onClick:i,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-main-input px-3.5 text-[13px] font-semibold text-content-muted transition-colors hover:bg-red-500/10 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:n?"Disconnecting…":"Disconnect"}):S.jsx("button",{type:"button",onClick:s,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-secondary px-3.5 text-[13px] font-semibold text-secondary-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:n?"Connecting…":"Connect"})]})},x_=({isOpen:t,onClose:e,context:n="menu",highlightProvider:r=null})=>{const{integrations:s,isLoading:i,error:a,pendingProvider:u,connect:c,disconnect:f}=pG(),[h,p]=g.useState(null),v=b=>s.find(E=>E.provider===b),y=g.useCallback(b=>{c(b).catch(E=>{const C=E instanceof Error?E.message:"Could not connect.";tC.warn(`Connect error for ${b}:`,C),ht.error(C)})},[c]),x=g.useCallback(b=>{f(b).catch(E=>{const C=E instanceof Error?E.message:"Could not disconnect.";tC.warn(`Disconnect error for ${b}:`,C),ht.error(C)})},[f]),_=n==="onboarding";return S.jsx(e0,{open:t,onOpenChange:b=>!b&&e(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:p,className:"fixed left-1/2 top-1/2 z-max w-[560px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:h,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(du,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Connect your design references to use them with Rivet’s MCP."}),a?S.jsx("p",{className:"rounded-lg bg-red-500/10 px-4 py-3 text-[13px] font-medium text-red-300",children:a}):null,S.jsx("div",{className:"grid grid-cols-2 gap-4",children:vG.map(b=>S.jsx(yG,{meta:b,integration:v(b.provider),isPending:i||u===b.provider,isHighlighted:r===b.provider,onConnect:()=>y(b.provider),onDisconnect:()=>x(b.provider)},b.provider))}),_?S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsx("p",{className:"text-xs text-content-subtle",children:"You can always do this later from the account menu."}),S.jsx("button",{type:"button",onClick:e,className:"active-push flex-none rounded-lg bg-secondary px-3.5 py-2 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent",children:"Skip for now"})]}):null]})]})})]})})},nC=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),_G=hs("SupportTicketModal"),rC=5e3,c1="feedback",xG=t=>{var r;if(!t)return null;const e=(r=t.formErrors)==null?void 0:r[0];if(e)return e;const n=t.fieldErrors??{};for(const s of Object.values(n)){const i=s==null?void 0:s[0];if(i)return i}return null},wG=async t=>{let e;try{e=await t.json()}catch{e=void 0}if(t.status===400){if(typeof(e==null?void 0:e.details)=="string"&&e.details.trim())return e.details;if(typeof(e==null?void 0:e.details)=="object"&&e.details!==null){const n=xG(e.details);if(n)return n}return"Please check your feedback and try again."}return t.status>=500?typeof(e==null?void 0:e.details)=="string"&&e.details.trim()?e.details:"Could not send feedback right now. Please try again later.":typeof(e==null?void 0:e.error)=="string"&&e.error.trim()?e.error:`HTTP ${t.status}`},bG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=QN(),[s,i]=g.useState(""),[a,u]=g.useState(!1),[c,f]=g.useState(null),h=g.useCallback(()=>{i("")},[]),p=g.useCallback(()=>{a||(h(),e())},[a,e,h]),v=g.useCallback(async()=>{const b=s.trim();if(!(!b||a)){u(!0);try{const E=typeof(r==null?void 0:r.get_session_id)=="function"?r.get_session_id():void 0,C=typeof(r==null?void 0:r.get_distinct_id)=="function"?r.get_distinct_id():void 0,P=n==null?void 0:n.trim(),T=await fetch("/api/support/tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:c1,message:b,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:C??void 0,appVersion:"0.13.2",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await wG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:c1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const C=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:c1,error:C}),_G.error("Failed to submit support ticket:",C),ht.error("Could not send feedback",{description:C})}finally{u(!1)}}},[n,a,s,e,r,h]),y=g.useCallback(b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),v())},[v]),x=rC-s.length,_=a||s.trim().length===0;return S.jsx(e0,{open:t,onOpenChange:b=>!b&&p(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:f,className:"fixed left-1/2 top-1/2 z-max w-[440px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:c,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(du,{onClick:p,disabled:a,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Tell us what happened or what we can improve."}),S.jsxs("div",{className:"rounded-lg bg-main-input outline outline-1 outline-transparent transition-[outline-color] focus-within:outline-white/20",children:[S.jsx("textarea",{id:"support-ticket-message","aria-label":"Your feedback",value:s,onChange:b=>i(b.target.value),onKeyDown:y,maxLength:rC,rows:6,disabled:a,placeholder:"What happened?",className:"max-h-64 w-full resize-none overflow-y-auto bg-transparent pb-1 pl-3 pr-3 pt-3 text-sm text-content placeholder-content-subtle focus:outline-none disabled:opacity-50"}),S.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[S.jsx("span",{className:"text-xs text-content-subtle",children:"Context details are included automatically."}),S.jsxs("div",{className:"flex items-center gap-2",children:[x<=500&&S.jsx("span",{className:"text-xs text-content-subtle",children:x}),S.jsx(du,{onClick:v,disabled:_,title:"Send feedback",shortcut:"⌘↵",className:"flex items-center justify-center rounded bg-primary p-1 text-content transition-colors hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-80",children:a?S.jsx(o0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(uz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},SG=hs("ProfileAvatar"),rA=(t,e)=>{const n=(t??"").trim();if(n)return n.split(/\s+/).filter(Boolean)[0]??"";const s=((e??"").split("@")[0]??"").split(/[._\-+]/).filter(Boolean)[0]??"";return s?s[0].toUpperCase()+s.slice(1):""},EG=(t,e)=>rA(t,e).charAt(0).toUpperCase(),kG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Xe(GT),i=Xe(QT),a=Xe(XT),[u,c]=g.useState(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),[y,x]=g.useState(!1),{containerRef:_,onKeyDown:b}=uG(),E=Xe(mf),C=EG(r,s);if(!C)return E?S.jsxs("span",{"data-testid":"profile-avatar-skeleton","aria-hidden":"true",className:`flex shrink-0 items-center gap-2 ${t}`.trim(),children:[S.jsx(nC,{className:"h-7 w-7 rounded-full"}),S.jsx(nC,{className:"h-3 w-16"})]}):null;const P=rA(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,O=async()=>{x(!0);try{const M=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!M.ok)throw new Error(`Logout failed: ${M.status}`)}catch(M){SG.warn("Logout request failed",M),ht.error("Could not log out. Please try again."),x(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(N5,{open:u,onOpenChange:c,children:[S.jsx(D5,{asChild:!0,children:S.jsxs("button",{type:"button","aria-label":"Account",className:`flex shrink-0 select-none items-center gap-2 text-content-muted transition-colors hover:text-content ${t}`,children:[S.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full border border-main-border bg-main-input text-[11px] font-semibold leading-none",children:C}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(j5,{children:S.jsxs(F5,{ref:_,onKeyDown:b,role:"menu",className:"z-[60] min-w-[180px] rounded-lg bg-surface-2 p-1 shadow-lg",side:e,sideOffset:6,align:n,children:[T||A?S.jsxs("div",{className:"border-b border-main-border px-3 py-2",children:[T?S.jsx("div",{className:"truncate text-xs font-medium text-content",children:T}):null,A?S.jsx("div",{className:"truncate text-[11px] text-content-muted",children:A}):null]}):null,S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),h(!0)},disabled:!i||a,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(vT,{className:"h-3.5 w-3.5",weight:"bold"}),"Connect design references"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),v(!0)},className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none",children:[S.jsx(dz,{className:"h-3.5 w-3.5",weight:"bold"}),"Share feedback"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:O,disabled:y,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(mz,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(x_,{isOpen:f,onClose:()=>h(!1)}),S.jsx(bG,{isOpen:p,onClose:()=>v(!1),contactEmail:s??void 0})]})},CG=({onClose:t})=>S.jsxs("div",{className:"bg-main font-main scrollbar-hide relative flex h-full w-full cursor-auto flex-col overflow-hidden shadow-2xl","data-cy":"element-inspector",children:[S.jsx(aG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(HW,{})}),S.jsx("div",{className:"border-main-border bg-main-light flex flex-shrink-0 items-center border-t px-2.5 py-1.5",children:S.jsx(kG,{side:"top",align:"start"})})]}),PG=hs("useServerConfig"),TG=()=>{const[t,e]=g.useState(null),[n,r]=g.useState(!0),[s,i]=g.useState(null),a=g.useCallback(async()=>{var u;try{r(!0),i(null);const c=await fetch("/api/health");if(!c.ok)throw new Error(`Failed to fetch config: ${c.status}`);const f=await c.json();if(!f.framework)throw new Error("Server did not return framework information");const h={userPort:((u=f.ports)==null?void 0:u.userDevServer)||3e3,framework:f.framework};return e(h),h}catch(c){const f=c instanceof Error?c.message:"Failed to fetch server config";throw i(f),PG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},AG="#1C1C20",Ri=[118,118,124],sC=.85,RG=3,IG=.15,tp=36,MG=4.4,LG=.7,OG=3.5,NG=.8,iC=9,DG=11,jG=[1.35,1.12,.95,.85],FG=[0,1.1,2.3,3.1],VG=[0,.35,.16,.13],$G=[.9,.5,.4,.35],Ra=3,d1=[[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.23,level:1},{x1:.14,y1:.28,x2:.3,y2:.87,level:1},{x1:.34,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.155,x2:.225,y2:.205,level:2},{x1:.7,y1:.155,x2:.755,y2:.205,level:2},{x1:.775,y1:.155,x2:.83,y2:.205,level:2},{x1:.165,y1:.32,x2:.275,y2:.375,level:2},{x1:.165,y1:.415,x2:.275,y2:.47,level:2},{x1:.165,y1:.51,x2:.275,y2:.565,level:2},{x1:.37,y1:.32,x2:.585,y2:.56,level:2},{x1:.615,y1:.32,x2:.83,y2:.56,level:2},{x1:.37,y1:.61,x2:.83,y2:.83,level:2},{hline:!0,x1:.39,x2:.81,y:.685,level:3},{hline:!0,x1:.39,x2:.75,y:.755,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.16,y1:.17,x2:.52,y2:.45,level:1},{x1:.58,y1:.17,x2:.685,y2:.29,level:1},{x1:.715,y1:.17,x2:.84,y2:.29,level:1},{x1:.58,y1:.33,x2:.685,y2:.45,level:1},{x1:.715,y1:.33,x2:.84,y2:.45,level:1},{x1:.16,y1:.55,x2:.84,y2:.85,level:1},{x1:.19,y1:.21,x2:.36,y2:.33,level:2},{hline:!0,x1:.19,x2:.48,y:.37,level:3},{hline:!0,x1:.19,x2:.42,y:.42,level:3},{x1:.19,y1:.6,x2:.49,y2:.8,level:2},{hline:!0,x1:.53,x2:.8,y:.63,level:3},{hline:!0,x1:.53,x2:.76,y:.7,level:3},{hline:!0,x1:.53,x2:.79,y:.77,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.22,level:1},{x1:.14,y1:.28,x2:.36,y2:.87,level:1},{x1:.39,y1:.28,x2:.61,y2:.87,level:1},{x1:.64,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.15,x2:.225,y2:.2,level:2},{x1:.165,y1:.32,x2:.335,y2:.52,level:2},{x1:.415,y1:.32,x2:.585,y2:.52,level:2},{x1:.665,y1:.32,x2:.835,y2:.52,level:2},{hline:!0,x1:.165,x2:.335,y:.6,level:3},{hline:!0,x1:.165,x2:.3,y:.67,level:3},{hline:!0,x1:.415,x2:.585,y:.6,level:3},{hline:!0,x1:.415,x2:.55,y:.67,level:3},{hline:!0,x1:.665,x2:.835,y:.6,level:3},{hline:!0,x1:.665,x2:.8,y:.67,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.3,y1:.22,x2:.7,y2:.74,level:1},{x1:.34,y1:.27,x2:.55,y2:.34,level:2},{hline:!0,x1:.36,x2:.64,y:.42,level:3},{hline:!0,x1:.36,x2:.6,y:.49,level:3},{hline:!0,x1:.36,x2:.62,y:.56,level:3},{x1:.5,y1:.63,x2:.575,y2:.69,level:2},{x1:.595,y1:.63,x2:.66,y2:.69,level:2}]],np=t=>{let e=t|0;return e=Math.imul(e^e>>>16,73244475),e=Math.imul(e^e>>>16,73244475),e^=e>>>16,(e>>>0)/4294967296},Pp=t=>{const e=Math.min(1,Math.max(0,t));return e*e*(3-2*e)},Ia=(t,e)=>(Math.round(t/e-.5)+.5)*e,HG=Math.sin(Math.PI/3),oC=(t,e,n,r,s)=>{if(t.beginPath(),e===0)t.arc(n,r,s,0,Math.PI*2);else if(e===1){const i=s*HG;t.moveTo(n,r-s),t.lineTo(n+i,r+s/2),t.lineTo(n-i,r+s/2),t.closePath()}else{const i=s*.85;t.rect(n-i,r-i,i*2,i*2)}t.fill()},zG=(t,e,n)=>{let r;if(n.hline){const s=Math.max(n.x1-t,t-n.x2,0),i=Math.abs(e-n.y1);r=Math.hypot(s,i)-iC}else{const s=Math.max(n.x1-t,t-n.x2,0),i=Math.max(n.y1-e,e-n.y2,0);s===0&&i===0?r=-Math.min(t-n.x1,n.x2-t,e-n.y1,n.y2-e):r=Math.hypot(s,i),r=Math.abs(r)-iC}return Pp(.5-r/(2*DG))},sA=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(WT),r=g.useRef(null),s=g.useCallback(i=>{var N;if((N=r.current)==null||N.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(j=>j+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],f=0,h=0,p=tp,v=tp,y=null,x=null,_=0,b=-1;const E=new Array(33),C=j=>{const V=Math.round(j*32);let G=E[V];if(!G){const Y=V/32,K=Math.round(Ri[0]+(255-Ri[0])*Y),B=Math.round(Ri[1]+(255-Ri[1])*Y),X=Math.round(Ri[2]+(255-Ri[2])*Y);G=`rgba(${K}, ${B}, ${X}, ${sC})`,E[V]=G}return G},P=j=>{const V=1-.35*j,G=Math.round(Ri[0]*V),Y=Math.round(Ri[1]*V),K=Math.round(Ri[2]*V);return`rgba(${G}, ${Y}, ${K}, ${sC})`},T=j=>{let V=Math.floor(Math.random()*d1.length);V===b&&(V=(V+1)%d1.length),b=V;const G=[0,0,0,0],Y=d1[V].map((D,q)=>{const re=D.level,se=G[re]++,oe=FG[re]+se*VG[re],ue=$G[re]+np(V*131+q*17+5)*.2;if(D.hline){const ae=Ia((D.y??0)*h,v);return{hline:!0,x1:Ia(D.x1*f,p),x2:Ia(D.x2*f,p),y1:ae,y2:ae,level:re,start:oe,dur:ue}}const de=Ia(D.x1*f,p),ie=Ia((D.y1??0)*h,v);return{hline:!1,x1:de,y1:ie,x2:Math.max(Ia(D.x2*f,p),de+p),y2:Math.max(Ia((D.y2??0)*h,v),ie+v),level:re,start:oe,dur:ue}}),K=Y.reduce((D,q)=>Math.max(D,q.start+q.dur),0),B=c.length,X=new Float32Array(B*Ra),$=new Int16Array(B*Ra).fill(-1),ee=new Uint8Array(B),H=Y[0];for(let D=0;D<B;D++){const q=c[D];q.x>H.x1&&q.x<H.x2&&q.y>H.y1&&q.y<H.y2&&(ee[D]=1);const re=D*Ra;for(let se=0;se<Y.length;se++){const oe=zG(q.x,q.y,Y[se]);if(oe<=.02)continue;let ue=re;for(let de=re;de<re+Ra;de++){if($[de]===-1){ue=de;break}X[de]<X[ue]&&(ue=de)}($[ue]===-1||oe>X[ue])&&(X[ue]=oe,$[ue]=se)}}return{startT:j,buildEnd:K,els:Y,frame:H,cellQ:X,cellEl:$,inFrame:ee}},A=()=>{const j=i.getBoundingClientRect();f=Math.max(1,j.width),h=Math.max(1,j.height);const V=Math.min(2,window.devicePixelRatio||1);i.width=Math.round(f*V),i.height=Math.round(h*V),a.setTransform(V,0,0,V,0,0);const G=Math.max(8,Math.round(f/tp)),Y=Math.max(6,Math.round(h/tp));p=f/G,v=h/Y,c=[];for(let K=0;K<Y;K++){const B=Y>1?K/(Y-1):.5,X=MG*(1+LG*.4*(B*2-1));for(let $=0;$<G;$++){const ee=K*8191+$*131+1,H={x:($+.5)*p,y:(K+.5)*v,size:X,seed:ee,phase:np(ee),kind:0};H.kind=Math.floor(np(ee*97)*3),c.push(H)}}x=null,y=null},O=new Float32Array(32),M=j=>{a.fillStyle=AG,a.fillRect(0,0,f,h),y||(y=T(j+.2)),j>=y.startT+y.buildEnd+OG&&(x=y,_=j,y=T(j+.2));let V=0;x&&(V=1-Pp((j-_)/NG),V<=0&&(x=null));const G=y;for(let H=0;H<G.els.length;H++){const D=G.els[H];O[H]=Pp(Math.min(1,Math.max(0,(j-G.startT-D.start)/D.dur)))}const Y=O[0],K=P(0),B=P(Y),X=V>0?P(V):K,$=V>0?P(Math.max(Y,V)):B,ee=c.length;for(let H=0;H<ee;H++){const D=c[H];let q=0,re=0;const se=H*Ra;for(let Se=se;Se<se+Ra;Se++){const Re=G.cellEl[Se];if(Re<0)break;const Ke=G.cellQ[Se]*O[Re];Ke>q&&(q=Ke,re=G.els[Re].level)}if(x)for(let Se=se;Se<se+Ra;Se++){const Re=x.cellEl[Se];if(Re<0)break;const Ke=x.cellQ[Se]*V;Ke>q&&(q=Ke,re=x.els[Re].level)}const oe=j/RG+D.phase,ue=Math.floor(oe),de=oe-ue,ie=Pp(Math.min(de,1-de)/IG),ae=Math.floor(np(D.seed*97+ue*7919)*3);ae!==D.kind&&q<.02&&ie<.05&&(D.kind=ae);const me=Math.max(ie*(1-q),q);if(!(me<.01))if(q<.02){const Se=G.inFrame[H]===1,Re=x?x.inFrame[H]===1:!1;Se?a.fillStyle=Re?$:B:a.fillStyle=Re?X:K;const Ke=Math.max(Se?Y:0,Re?V:0);oC(a,D.kind,D.x,D.y,D.size*me*(1-.2*Ke))}else{a.fillStyle=C(q);const Se=1+(jG[re]-1)*q;oC(a,D.kind,D.x,D.y,D.size*me*Se)}}};A();let R=0;if(u)y=T(-100),M(0);else{const j=performance.now(),V=G=>{M((G-j)/1e3),R=requestAnimationFrame(V)};R=requestAnimationFrame(V)}const L=new ResizeObserver(()=>{A(),u&&(y=T(-100),M(0))});L.observe(i),r.current=()=>{cancelAnimationFrame(R),L.disconnect(),e&&n(j=>j-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},UG=async(t=null)=>{if(t)return BG(t);let e;try{e=await fetch("/api/mcp/status")}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}if(e.status===404||!(e.headers.get("content-type")??"").toLowerCase().includes("application/json"))return rp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return rp()}const s=r.devServerHealth;return s?s.ownership==="none"?{isOk:!1,unavailableReason:"upstream_unreachable"}:s.isReachable===!0?{isOk:!0,unavailableReason:"upstream_unreachable"}:{isOk:!1,unavailableReason:s.reason==="rivet_unreachable"?"rivet_unreachable":"upstream_unreachable"}:rp()},BG=async t=>{try{const e=await fetch(t);return{isOk:e.status!==502&&e.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},rp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},aC=hs("usePreviewUpstreamHealth"),WG=500,GG=4e3,KG=15e3,ZG=(t,e={})=>{const n=g.useRef(null),r=g.useRef(null),s=e.probeMsWhileDown??WG,i=e.probeMsWhileUp??GG,a=e.firstUnreachableCaptureAfterMs??KG,u=e.rerunProbeImmediatelyOnVersion,c=e.probePath??null,f=e.skip??!1,[h,p]=g.useState(t==="static"),[v,y]=g.useState(0),[x,_]=g.useState(null),[b,E]=g.useState(0),[C,P]=g.useState(!1),[T,A]=g.useState(!1),[O,M]=g.useState(t==="static"?null:"upstream_unreachable");return g.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),M(null);return}if(f){p(!1),_(null),E(0),P(!1),A(!0),M("upstream_unreachable"),n.current=null;return}let R=!0;const L=Date.now();_(L),E(0),P(!1),p(!1),A(!1),M("upstream_unreachable");const N={current:!1},j={current:!1},V={current:!1},G={current:null},Y={current:!1};let K=null;const B=()=>{V.current||(V.current=!0,R&&A(!0))},X=()=>{K!==null&&(clearTimeout(K),K=null)},$=(H,D)=>{X(),K=setTimeout(D,H)},ee=async()=>{if(!R)return;E(se=>se+1);const{isOk:H,unavailableReason:D}=await UG(c);if(!R)return;if(B(),H){const se=!Y.current;Y.current=!0,p(!0),M(null),G.current=null,j.current=!1,P(!1),N.current?se&&(Te==null||Te.capture("preview_upstream_restored",{framework:t})):(N.current=!0,Te==null||Te.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-L})),$(i,ee);return}const q=Y.current;Y.current=!1,p(!1),M(D),G.current===null&&(G.current=Date.now(),j.current=!1,P(!1)),q&&(Te==null||Te.capture("preview_upstream_lost",{framework:t}),y(se=>se+1),aC.warn("Preview upstream became unavailable after it was ready"));const re=Date.now()-G.current;re>=a&&!j.current&&(j.current=!0,P(!0),Te==null||Te.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:re}),aC.warn("Dev server did not become ready within timeout window")),$(s,ee)};return n.current=()=>$(0,ee),$(0,ee),()=>{R=!1,n.current=null,X()}},[t,s,i,a,c,f]),g.useEffect(()=>{var L;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((L=n.current)==null||L.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:v,probeStartedAt:x,probeAttemptCount:b,isFirstUnreachableWindowExceeded:C,initialProbeComplete:T,unavailableReason:O}};function qG(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const iA=t=>{var e;return t!=="embedded"||typeof window>"u"?"":((e=window.__RIVET_BOOTSTRAP__)==null?void 0:e.previewOrigin)??`${window.location.protocol}//localhost:${window.location.port}`},oA=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${iA(t)}${e}`:e,YG="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",XG=t=>YG,QG=hs("PreviewSurface"),lC=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",aA=({target:t,src:e,framework:n,remountKey:r})=>(Xe(a0),S.jsx("div",{className:"relative h-full w-full",children:S.jsx("iframe",{src:e,className:"h-full w-full border-none",title:"Project Preview",sandbox:XG(),onLoad:()=>{Te==null||Te.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n}))},onError:()=>{Te==null||Te.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n})),QG.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),JG="modulepreload",eK=function(t){return"/"+t},uC={},tK=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),c=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=a(n.map(f=>{if(f=eK(f),f in uC)return;uC[f]=!0;const h=f.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":JG,h||(v.as="script"),v.crossOrigin="",v.href=f,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((y,x)=>{v.addEventListener("load",y),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return s.then(a=>{for(const u of a||[])u.status==="rejected"&&i(u.reason);return e().catch(i)})},nK=g.lazy(()=>tK(()=>Promise.resolve().then(()=>OZ),void 0)),rK={surface:"relative flex h-full w-full items-center justify-center bg-main px-6",overlay:"absolute inset-0 z-10 flex items-center justify-center bg-main/90 px-6",page:"relative flex h-screen w-full items-center justify-center bg-main px-6"},sK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},iK={neutral:"rounded-md border border-divider bg-transparent px-5 py-2 text-sm font-medium text-content transition-colors hover:bg-surface-3",ghost:"rounded-md px-5 py-2 text-sm font-medium text-content-muted transition-colors hover:text-content"},xd=({backdrop:t,media:e,title:n,description:r,actions:s,tone:i="neutral",fill:a="surface",size:u="md",children:c,state:f,role:h="status",busy:p=!1,className:v=""})=>{const y=g.useCallback(_=>{_&&f&&(Te==null||Te.capture("status_surface_shown",{state:f,tone:i,fill:a}))},[f,i,a]),x=!!(e||n||r||c||s!=null&&s.length);return S.jsxs("div",{ref:y,className:`${rK[a]} ${v}`.trim(),role:h,"aria-live":"polite","aria-busy":p||void 0,"data-state":f,children:[t?S.jsx("div",{className:"absolute inset-0",children:t}):null,x?S.jsxs("div",{className:"relative z-10 flex max-w-sm flex-col items-center gap-5 text-center",children:[e,n?S.jsx("h2",{className:sK[u],children:n}):null,r?S.jsx("p",{className:"text-content-muted text-base leading-relaxed",children:r}):null,c,s!=null&&s.length?S.jsx("div",{className:"flex flex-row items-center gap-3",children:s.map(_=>S.jsx("button",{type:"button",onClick:_.onClick,className:iK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},wd=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(sA,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(g.Suspense,{fallback:null,children:S.jsx(nK,{className:"absolute inset-0"})})}):S.jsx(xd,{...r,size:n,busy:!0,media:S.jsx(o0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),lA=({icon:t,...e})=>S.jsx(xd,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Tm=t=>S.jsx(xd,{...t,tone:"error",role:"alert"}),cC="/static/",oK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(cC)}catch{return t.endsWith(cC)}},aK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Xe(l_),a=st(l_),u=Xe(Sm),c=st(Sm),f=Xe(pf),h=Xe(a0),p=Xe(u_),v=Xe(c_),y=Xe(KT),x=Xe(ZT),_=st(c_),b=Xe(qo),E=Xe(f_),C=st(u_),P=f.active&&f.projectContext.kind==="fresh",T=Xe(d_),A=f.active?f.variants.find(je=>je.workItemId===T&&(je.status==="pending"||je.status==="running"||je.status==="succeeded"&&!je.preview&&typeof je.port!="number"&&!je.previewUnavailable))??null:null,O=f.active&&f.variants.some(je=>je.status==="pending"||je.status==="running"),M=P||O,R=f.active?f.variants.find(je=>je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable)??null:null,L=e==="static"&&u!==null&&oK(u);g.useEffect(()=>{f.active||C(!1)},[f.active,C]);const N=g.useRef(!1);g.useEffect(()=>{const je=!!(b!=null&&b.left||b!=null&&b.right),Qe=je&&!N.current;N.current=je;const lt=f.active?f.sessionId:null;!lt||!qG({enteringSplit:Qe,isExistingSession:f.active&&f.projectContext.kind==="existing",hasActiveVariantProxy:p&&v!==null})||(C(!1),_(null),a(Je=>Je+1),fetch(`/api/variants/${encodeURIComponent(lt)}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})}).catch(()=>{}))},[b,f,p,v,C,_,a]);const V=g.useMemo(()=>{var xn;if(p||u&&!L||!f.active)return null;const{stage:je,variants:Qe}=f,lt=je==="ready"||je==="degraded",Je=Qe.some(zt=>{var An,Xn;return((An=zt.refinement)==null?void 0:An.status)==="pending"||((Xn=zt.refinement)==null?void 0:Xn.status)==="running"});if(!lt&&!Je)return null;const vt=Qe.find(zt=>{var An;return zt.status==="succeeded"&&((An=zt.preview)==null?void 0:An.kind)==="static_artifact"});return((xn=vt==null?void 0:vt.preview)==null?void 0:xn.kind)==="static_artifact"?vt.preview.url:null},[L,u,p,f])??u,G=g.useMemo(()=>!f.active||!V?null:f.variants.find(je=>{var Qe;return((Qe=je.preview)==null?void 0:Qe.kind)==="static_artifact"&&V.startsWith(je.preview.url)})??null,[V,f]),Y=g.useMemo(()=>{if((E==null?void 0:E.previewKind)==="static")return{kind:"variant",sessionId:E.sessionId,variantId:E.variantId};if(!f.active)return bm;if(G)return{kind:"variant",sessionId:f.sessionId,variantId:G.workItemId};if(V){const Qe=V.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),lt=Qe!=null&&Qe[1]?decodeURIComponent(Qe[1]):null,Je=Qe!=null&&Qe[2]?decodeURIComponent(Qe[2]):null;if(lt===f.sessionId&&Je&&f.variants.some(zt=>zt.workItemId===Je))return{kind:"variant",sessionId:f.sessionId,variantId:Je};const vt=V.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=vt!=null&&vt[1]?decodeURIComponent(vt[1]):null;if(xn&&f.variants.some(zt=>zt.workItemId===xn))return{kind:"variant",sessionId:f.sessionId,variantId:xn}}const je=!!(b!=null&&b.left||b!=null&&b.right);return(!je||P)&&!V&&p&&v&&f.variants.some(Qe=>Qe.workItemId===v)?{kind:"variant",sessionId:f.sessionId,variantId:v}:(!je||P)&&!V&&T&&f.variants.some(Qe=>Qe.workItemId===T)?{kind:"variant",sessionId:f.sessionId,variantId:T}:bm},[E,G,f,p,v,V,b,P,T]),K=g.useRef(null);g.useEffect(()=>{var Je,vt;if(!G||((Je=G.preview)==null?void 0:Je.kind)!=="static_artifact"||((vt=G.refinement)==null?void 0:vt.status)!=="succeeded")return;const je=`${G.workItemId}:${G.refinement.workItemId}`;if(K.current===je)return;K.current=je;const Qe=G.preview.url.includes("?")?"&":"?",lt=`${G.preview.url}${Qe}refinement=${encodeURIComponent(G.refinement.workItemId)}`;V!==lt&&(c(lt),a(xn=>xn+1))},[V,G,a,c,f]);const B=V!==null&&OW(V),X=V!==null&&!B||P&&!p&&!B,{isUpstreamReady:$,iframeRemountKey:ee,probeAttemptCount:H,initialProbeComplete:D}=ZG(e,{rerunProbeImmediatelyOnVersion:i,probePath:B?V:null,skip:X}),[q,re]=g.useState(()=>y&&$?i:null),se=g.useRef(null);g.useEffect(()=>{if(!y){se.current=null,re(null);return}if(q===i){se.current=null;return}const je=se.current;if(!je||je.remountKey!==i){se.current={remountKey:i,probeAttemptCount:H};return}$&&H>je.probeAttemptCount&&(se.current=null,re(i))},[q,i,y,H,$]);const ue=V!==null&&!B||$,ie=x||y&&q!==i||y&&!ue,ae=`${ee}:${i}`,me=r?`/try/${encodeURIComponent(r)}`:"",Se=eA(window.location.pathname),Re=e==="static"?`${me}/static${Se??"/"}`:`${me}${Se??"/"}`,Ke=iA(h);let it=null;V&&(it=oA({agentApplyMode:h,url:V}));const at=A||ie?"about:blank":(B&&!ue?"about:blank":it)??(s||!ue?"about:blank":`${Ke}${Re}`),It=!!A||!!R||!ue&&D;let mt=null;return ie?mt=S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?mt=A.status==="succeeded"?S.jsx(wd,{fill:"overlay",loader:"spinner",state:"variant_building",title:"Starting preview",description:"Its preview server is starting up."}):S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?mt=S.jsx(Tm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):It&&(mt=M?S.jsx(lA,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Tm,{fill:"overlay",state:"preview_offline",title:"Preview isn't connected",description:"Rivet lost connection to your project.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]})),S.jsxs("div",{className:"relative h-full w-full",children:[mt,S.jsx(aA,{target:Y,src:at,framework:e,remountKey:ae})]})};function dC({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(qo),c=Xe(pf),f=Xe(a0),h=g.useRef(!1),p=g.useCallback(()=>{h.current||(h.current=!0,Zd({source:i,sessionId:e,variantId:n}))},[i,e,n]),v=g.useCallback(()=>{if(a){u(null);return}p(),u(C=>{if(!C)return null;const P={...C};return delete P[t],P.left||P.right?P:null})},[u,t,a,p]),y=g.useMemo(()=>({kind:"variant",sessionId:e,variantId:n}),[e,n]),x=g.useMemo(()=>!c.active||c.sessionId!==e?null:c.variants.find(C=>C.workItemId===n)??null,[e,n,c]),_=g.useMemo(()=>{var P,T;let C=r;if(((P=x==null?void 0:x.preview)==null?void 0:P.kind)==="static_artifact"&&((T=x.refinement)==null?void 0:T.status)==="succeeded"){const A=x.preview.url.includes("?")?"&":"?";C=`${x.preview.url}${A}refinement=${encodeURIComponent(x.refinement.workItemId)}`}return oA({agentApplyMode:f,url:C})},[f,x,r]),b=((E=x==null?void 0:x.refinement)==null?void 0:E.status)==="succeeded"?`${n}:${x.refinement.workItemId}`:n;return S.jsxs("div",{className:"variant-split-secondary","data-cy":"variant-split-pane","data-variant-id":n,children:[S.jsxs("div",{className:"variant-split-secondary-toolbar",children:[S.jsx("span",{className:"variant-split-secondary-label",title:s,children:s}),S.jsx(Fo,{label:"Collapse",children:S.jsx("button",{type:"button",className:"variant-split-secondary-close",onClick:v,"aria-label":"Collapse split view",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",children:S.jsx("path",{d:"M2.5 2.5 L9.5 9.5 M9.5 2.5 L2.5 9.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})})})]}),S.jsx("div",{className:"variant-split-secondary-body relative min-h-0 flex-1",children:S.jsx(aA,{target:y,src:_,framework:"static",remountKey:b})})]})}const fC=240;function lK(){const t=Xe(Wd),e=Xe(X2),n=g.useRef(null);return g.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-fC/2,s=e.y-22;n.current.style.transform=`translate3d(${r}px, ${s}px, 0)`},[t,e]),!t||!e?null:S.jsx("div",{ref:n,"aria-hidden":"true",className:"variant-drag-ghost",style:{width:fC},children:S.jsxs("div",{className:"variant-drag-ghost-body",children:[S.jsxs("div",{className:"variant-drag-ghost-row",children:[S.jsx("div",{className:"variant-drag-ghost-title",children:t.label}),t.runLabel?S.jsx("div",{className:"variant-drag-ghost-tag",style:DT(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function uK(){const t=Xe(Wd),e=Xe(X2),n=Xe(qo),r=st(Wd),s=st(qo),i=g.useRef(null),[a,u]=g.useState(null),[c,f]=g.useState("hidden");g.useEffect(()=>{if(!t){f("hidden"),u(null);return}const v=requestAnimationFrame(()=>f("visible"));return()=>cancelAnimationFrame(v)},[t]);const h=g.useCallback((v,y)=>{const x=i.current;if(!x)return null;const _=x.getBoundingClientRect();return v<_.left||v>_.right||y<_.top||y>_.bottom?null:v<(_.left+_.right)/2?"left":"right"},[]);if(g.useEffect(()=>{if(!t||!e)return;const v=h(e.x,e.y);u(y=>y===v?y:v)},[t,e,h]),g.useEffect(()=>{if(!t)return;const v=y=>{const x=h(y.clientX,y.clientY);if(x&&t.url){const _={sessionId:t.sessionId,variantId:t.variantId,label:t.label,url:t.url,source:t.source},b=n==null?void 0:n[x];b&&(b.sessionId!==_.sessionId||b.variantId!==_.variantId)&&Zd(b),s(E=>({...E??{},[x]:_})),f("exiting"),window.setTimeout(()=>r(null),220)}else Zd(t),f("exiting"),window.setTimeout(()=>r(null),220)};return window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),()=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)}},[t,h,r,s,n]),!t)return null;const p=["variant-drop-zones",c==="visible"&&"is-visible",c==="exiting"&&"is-exiting"].filter(Boolean).join(" ");return S.jsxs("div",{ref:i,className:p,"aria-hidden":"true",children:[S.jsx(hC,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(hC,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function hC({side:t,hovered:e,canDrop:n,label:r}){return S.jsxs("div",{className:["variant-drop-zone",`is-${t}`,e&&"is-hover",!n&&"is-disabled"].filter(Boolean).join(" "),children:[S.jsxs("div",{className:"variant-drop-zone-inner",children:[S.jsx("div",{className:`variant-drop-zone-icon is-${t}`}),S.jsx("div",{className:"variant-drop-zone-caption",children:n?`Add ${t} split`:"Split unavailable for this direction"})]}),S.jsx("div",{className:"variant-drop-zone-preview","aria-hidden":"true",children:S.jsx("div",{className:"variant-drop-zone-preview-label",children:r})}),S.jsx("div",{className:"variant-drop-zone-border"})]})}const uA=(t,e,n)=>{var i,a;if(!t.active||t.sessionId!==e)return null;const r=t.variants.find(u=>u.workItemId===n);if(((i=r==null?void 0:r.preview)==null?void 0:i.kind)!=="static_artifact")return null;if(((a=r.refinement)==null?void 0:a.status)!=="succeeded")return r.preview.url;const s=r.preview.url.includes("?")?"&":"?";return`${r.preview.url}${s}refinement=${encodeURIComponent(r.refinement.workItemId)}`},pC=(t,e)=>{if(!t)return;const n=uA(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},cK=()=>S.jsx("div",{"data-testid":"preview-boot-skeleton",role:"status","aria-busy":"true","aria-label":"Loading preview",className:"bg-main flex h-full min-h-0 w-full flex-1 flex-col p-3",children:S.jsx("div",{className:"border-main-border relative min-h-0 flex-1 overflow-hidden rounded-lg border",children:S.jsx(sA,{trackGlobalLoaderCount:!1})})}),dK=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=TG();return g.useEffect(()=>{i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})},[i]),a?r?S.jsx("div",{className:"bg-main flex h-full min-h-0 w-full flex-1","aria-busy":"true"}):S.jsx(cK,{}):u||!s?S.jsx(Tm,{fill:"surface",size:"sm",state:"preview_config_error",title:"Couldn't load preview",description:"We couldn't load the preview configuration.",actions:[{label:"Retry",onClick:()=>{Te==null||Te.capture("preview_config_retry_clicked"),i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(fK,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function fK(t){const e=Xe(qo),n=Xe(Wd),r=Xe(pf),s=Xe(Sm),i=e==null?void 0:e.left,a=e==null?void 0:e.right,u=g.useMemo(()=>{var A,O;if(!r.active||r.projectContext.kind!=="fresh"||!(!!i!=!!a))return;const _=(A=i??a)==null?void 0:A.variantId,b=r.variants.filter(M=>{var R;return M.status==="succeeded"&&((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=b.find(M=>{var R;return((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.preview.url===E})??b[0];if(((O=P==null?void 0:P.preview)==null?void 0:O.kind)!=="static_artifact")return;const T=uA(r,r.sessionId,P.workItemId);if(T)return{sessionId:r.sessionId,variantId:P.workItemId,label:P.label,url:T,source:"live"}},[r,i,a,s]),c=pC(i,r)??(a?u:void 0),f=pC(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!f,v=!!(c||f),y=S.jsx(aK,{isInteractionDisabled:t.isInteractionDisabled,framework:t.framework,userPort:t.userPort,activeDemoSessionId:t.activeDemoSessionId,holdPreviewNavigation:t.holdHostedTryoutPreviewNavigation});return S.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 flex-col",children:S.jsxs("div",{className:`variant-preview-region relative flex h-full min-h-0 w-full flex-1 flex-col ${n?"is-dragging":""} ${v?"is-split":""}`,children:[S.jsxs("div",{className:"variant-preview-row flex h-full min-h-0 w-full flex-1",children:[c&&S.jsx(dC,{side:"left",sessionId:c.sessionId,variantId:c.variantId,url:c.url,label:c.label,source:c.source,isFallback:h},`left-${c.sessionId}:${c.variantId}:${c.url}`),!(c&&f)&&S.jsx("div",{className:"variant-preview-primary flex h-full min-h-0 flex-1 flex-col",children:y}),f&&S.jsx(dC,{side:"right",sessionId:f.sessionId,variantId:f.variantId,url:f.url,label:f.label,source:f.source,isFallback:p},`right-${f.sessionId}:${f.variantId}:${f.url}`)]}),S.jsx("div",{className:"variant-preview-atmosphere","aria-hidden":"true"}),S.jsx(uK,{}),S.jsx(lK,{})]})})}const cA=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(o0,{className:"h-4 w-4 shrink-0 animate-spin text-primary",weight:"bold"}):null,S.jsx("span",{className:"whitespace-pre-wrap font-sans",children:t})]});function ji(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function dA(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
|
|
112
112
|
* GSAP 3.15.0
|
|
113
113
|
* https://gsap.com
|
|
114
114
|
*
|
|
@@ -416,4 +416,4 @@ ${D}`:D)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted h
|
|
|
416
416
|
<body>
|
|
417
417
|
<div class="panel">${UC}</div>
|
|
418
418
|
</body>
|
|
419
|
-
</html>`,_Q="Too many people are trying Rivet right now. Please try again in a few minutes.",oI="Failed to start an isolated demo session.",xQ=async t=>{if(t.status===429)return _Q;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return oI},$_=274,Vm=395,C1=Math.min(Vm,Math.round(($_+Vm)/2*1.1)),WC="rivet:panelWidth:v2",wQ=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},bQ=({projectPath:t,activeDemoSessionId:e=null,showLoginGate:n=!1,onStartLogin:r,isStartingLogin:s=!1,loginError:i=null,fullPageHostedLoginProgressMessage:a=null,holdHostedTryoutPreviewNavigation:u=!1,hostedTryoutPreviewHoldMessage:c=null,deferInspectorUntilPreviewReady:f=!1})=>{const h=Xe(WT)>0,[p,v]=Q6(UT),y=jV(),[x,_]=g.useState(()=>{if(typeof window>"u")return C1;const Y=Number(window.localStorage.getItem(WC));return Number.isFinite(Y)&&Y>=$_&&Y<=Vm?Y:C1}),[b,E]=g.useState(!1),[C,P]=g.useState(YZ),T=p?x:0,[A,O]=g.useState(p);g.useEffect(()=>{if(!p){O(!1);return}P(Y=>qZ({position:Y,boundsLeftPx:x}))},[p,x]),g.useEffect(()=>{window.localStorage.setItem(WC,String(x))},[x]),g.useEffect(()=>{if(!p)return;const Y=K=>{K.key==="Escape"&&(wQ(K.target)||(K.preventDefault(),v(!1)))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[p,v]);const M=g.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation();const K=Y.clientX,B=x;E(!0);const X=ee=>{const H=Math.min(Vm,Math.max($_,B+(ee.clientX-K)));_(H)},$=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[x]),R=g.useCallback(()=>_(C1),[]),L=uq(),N=Xe(mf);fq({enabled:!N});const j=L.isProcessing?"Completing authentication...":a,V=j!==null,G=st(YT);return g.useEffect(()=>{G(t??null)},[t,G]),g.useEffect(()=>{n&&(document.body.style.cursor="auto")},[n]),S.jsxs(sl.div,{className:"relative flex h-screen overflow-hidden",initial:!1,animate:{opacity:1},transition:{duration:.5,ease:"easeOut"},"data-cy":"rivet-app",children:[j!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(DZ,{message:j})}):null,n?S.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/45 backdrop-blur-[2px]",children:S.jsx(aR,{isSigningIn:s||V,onStartSignIn:()=>{r==null||r()},errorMessage:i,displayMode:"modal"})}):null,S.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col ${n?"pointer-events-none select-none":""}`,children:[S.jsx(dK,{holdHostedTryoutPreviewNavigation:u,isInteractionDisabled:n,activeDemoSessionId:e}),u&&c?S.jsx("div",{className:"bg-main absolute inset-0 z-30 flex items-center justify-center",children:S.jsx("div",{className:"border-divider bg-main-light rounded-lg border p-6 shadow-lg",children:S.jsx(cA,{message:c})})}):null]}),n?null:S.jsx(S.Fragment,{children:!f&&!h?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"relative order-first h-full flex-shrink-0",style:{width:A?x:0},children:S.jsxs(sl.div,{className:"absolute inset-y-0 left-0 z-30",initial:!1,animate:{x:p?0:-x},transition:y?{duration:0}:{duration:.2,ease:[.22,1,.36,1]},onAnimationComplete:()=>{p&&O(!0)},style:{width:x,willChange:"transform"},children:[S.jsx(CG,{onClose:()=>v(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:M,onDoubleClick:R,className:"group/resize absolute inset-y-0 right-0 z-20 flex w-3 cursor-col-resize touch-none justify-end",children:S.jsx("span",{className:`h-full transition-all duration-150 ${b?"w-0.5 bg-content-muted":"w-px bg-divider group-hover/resize:w-0.5 group-hover/resize:bg-content-muted"}`})})]})}),b&&S.jsx("div",{className:"fixed inset-0 z-[100] cursor-col-resize"}),S.jsx(JZ,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:C,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>v(Y=>!Y)})]}):null}),S.jsx(d$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},H_="rivet_connect_deep_link",SQ=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(H_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(H_,n),e){t.delete("connect");const r=t.toString();window.history.replaceState(null,document.title,window.location.pathname+(r?`?${r}`:"")+window.location.hash)}return n},EQ=SQ(),kQ=()=>{const[t,e]=g.useState(window.location.hash),[n]=g.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Mp)==="1"),[r,s]=g.useState(!1),[i,a]=g.useState(EQ);g.useEffect(()=>{n&&window.sessionStorage.removeItem(Mp)},[n]);const{config:u,refetchConfig:c,loading:f,error:h}=aq(),p=st(mf),[v,y]=g.useState(!1),[x,_]=g.useState(null),[b,E]=g.useState(!1),[C,P]=g.useState(!1),[T,A]=g.useState(null),[O,M]=g.useState(!1),R=g.useRef(!1),L=g.useRef(!1),N=pQ(window.location.pathname),j=(u==null?void 0:u.activeDemoSessionId)??null,V=N??T??j,G=g.useMemo(()=>cQ(u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V),[u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V]),Y=g.useMemo(()=>uQ({configLoading:f,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:N,activeDemoSessionId:T,configuredDemoSessionId:j}),[u,f,N,T,j]);g.useLayoutEffect(()=>{if(!Y){M(!1);return}M(!0)},[Y]);const K=O,B=g.useMemo(()=>dQ(K),[K]),X=(u==null?void 0:u.demoMode)===!0&&K,$=g.useRef(null);$.current=V;const ee=g.useCallback(async()=>{if(!R.current)return;A(null);const me=await c();if((me==null?void 0:me.demoMode)===!0&&me.agentModeAvailable!==!0){P(!1);return}(me==null?void 0:me.demoMode)===!0&&P(!0)},[c]);g.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return iQ(()=>{ee()})},[u==null?void 0:u.demoMode,ee]),g.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const me=window.fetch.bind(window);return lQ({nativeFetch:me,pageOrigin:window.location.origin,getShouldIntercept:()=>R.current})},[u==null?void 0:u.demoMode]),g.useEffect(()=>{(u==null?void 0:u.agentModeAvailable)===!0&&P(!1)},[u==null?void 0:u.agentModeAvailable]);const H=g.useCallback(async me=>{const Se=$.current;if(!(me!=null&&me.forceRefresh)&&Se)return Se;if(L.current)return"";L.current=!0;try{const Re=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!Re.ok){const it=await xQ(Re);throw new Error(it)}const Ke=await Re.json();if(!Ke.sessionId)throw new Error("Demo session response missing session id.");return A(Ke.sessionId),Ke.sessionId}finally{L.current=!1}},[]);g.useEffect(()=>{j&&A(j)},[j]),g.useEffect(()=>{u!=null&&u.userId?(Te.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Te.alias(u.email,u.userId)):u!=null&&u.email&&Te.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),g.useEffect(()=>{if(!u)return;const me=!!u.demoMode,Se=me?V:null;Te.register({source:me?"tryout":"core",demo_mode:me,...Se?{demo_session_id:Se}:{}})},[u,V]);const D=g.useCallback(async()=>{var Se;y(!0),_(null);let me=null;try{if(me=window.open("","_blank"),!me)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{me.document.open(),me.document.write(yQ),me.document.close()}catch(it){k1.warn("Failed to render loading state in auth popup:",it)}const Re=await fetch(`${BC}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),Ke=await Re.json();if(!Re.ok||!Ke.success||!Ke.authUrl||!Ke.sessionId||!Ke.pollSecret)throw new Error(Ke.error||Ke.message||"Failed to start Google login");if(me.closed)throw new Error("Sign-in window was closed before Google login started.");me.location.href=Ke.authUrl;for(let it=0;it<vQ;it+=1){if(me.closed)throw new Error("Sign-in window was closed before authentication completed.");const at=await(await fetch(`${BC}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:Ke.sessionId,pollSecret:Ke.pollSecret})})).json();if(at.success&&at.token&&((Se=at.user)!=null&&Se.email)){if(!(await fetch("/api/auth/store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:at.user.email,token:at.token,refreshToken:at.refreshToken,userId:at.user.id})})).ok)throw new Error("Signed in, but failed to store session locally.");if(me.close(),window.sessionStorage.setItem(Mp,"1"),(u==null?void 0:u.demoMode)===!0){await H({forceRefresh:!0}),window.location.reload();return}window.location.reload();return}if(at.error&&at.error!=="Pending")throw new Error(at.error||"Google login failed");await new Promise(It=>setTimeout(It,gQ))}throw new Error("Authentication timed out. Please try again.")}catch(Re){me&&!me.closed&&me.close();const Ke=Re instanceof Error?Re.message:"Failed to start login flow";k1.warn("Hosted login failed:",Ke),_(Ke),y(!1)}},[u==null?void 0:u.demoMode,H]),q=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||C||v),re=u!=null&&u.agentModeAvailable!==!0,se=mQ(t),oe=g.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(g.useEffect(()=>{if(!Y)return;let me=!1;return H({forceRefresh:!0}).catch(Se=>{const Re=Se instanceof Error?Se.message:oI;k1.warn("Hosted session bootstrap failed:",Re),_(Re),ht.error(Re)}).finally(()=>{me||M(!1)}),()=>{me=!0}},[Y,H]),g.useEffect(()=>{const me=()=>{const Se=window.location.hash;e(Se)};return window.addEventListener("hashchange",me),()=>window.removeEventListener("hashchange",me)},[]),se==="design-system")return S.jsx(tQ,{});const ue={pathname:window.location.pathname,configLoading:f,hasConfig:u!==null,isRetryingConfig:b};if(hQ(ue)){const me=h||"Could not load Rivet configuration.";return S.jsx("div",{className:"bg-main flex h-screen items-center justify-center px-6",children:S.jsxs("div",{className:"border-divider bg-main w-full max-w-md rounded-lg border p-6 text-center shadow-lg",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"We could not start Rivet yet."}),S.jsx("p",{className:"text-content-dim mt-2 text-xs",children:me}),S.jsx("button",{type:"button",className:"border-divider text-content hover:bg-main/80 mt-4 rounded-md border px-3 py-1.5 text-xs",onClick:()=>{oe()},children:"Retry"})]})})}if(re)return S.jsx(aR,{isSigningIn:v,onStartSignIn:()=>{D()},errorMessage:x,displayMode:"full"});const ie=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,ae=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!ie;return S.jsxs(S.Fragment,{children:[S.jsx(bQ,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:G,showLoginGate:q,onStartLogin:D,isStartingLogin:v,loginError:x,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&v?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:K,hostedTryoutPreviewHoldMessage:B,deferInspectorUntilPreviewReady:X}),S.jsx(x_,{context:"onboarding",isOpen:ae,onClose:()=>s(!0)}),S.jsx(x_,{context:"menu",isOpen:ie,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(H_),a(null)}})]})},CQ="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",PQ=new vL,TQ={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},AQ=()=>S.jsx("div",{style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center"},children:S.jsx("p",{style:{fontSize:"14px",color:"#6b7280"},children:"Something went wrong. Please reload the page."})});lD.createRoot(document.getElementById("root")).render(S.jsx(ve.StrictMode,{children:S.jsx(XN,{apiKey:CQ,options:{api_host:"https://rivet-proxy.onrender.com/ingest",ui_host:"https://us.posthog.com",person_profiles:"always",capture_exceptions:!0,autocapture:!0,capture_pageview:!0,capture_performance:!0,persistence:"localStorage",...TQ,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.13.0",env:"production"})}},children:S.jsx(nD,{fallback:S.jsx(AQ,{}),children:S.jsx(yL,{client:PQ,children:S.jsx(RW,{defaultShape:"rounded",children:S.jsx(kX,{defaultLibrary:"lucide",children:S.jsx(kQ,{})})})})})})}));
|
|
419
|
+
</html>`,_Q="Too many people are trying Rivet right now. Please try again in a few minutes.",oI="Failed to start an isolated demo session.",xQ=async t=>{if(t.status===429)return _Q;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return oI},$_=274,Vm=395,C1=Math.min(Vm,Math.round(($_+Vm)/2*1.1)),WC="rivet:panelWidth:v2",wQ=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},bQ=({projectPath:t,activeDemoSessionId:e=null,showLoginGate:n=!1,onStartLogin:r,isStartingLogin:s=!1,loginError:i=null,fullPageHostedLoginProgressMessage:a=null,holdHostedTryoutPreviewNavigation:u=!1,hostedTryoutPreviewHoldMessage:c=null,deferInspectorUntilPreviewReady:f=!1})=>{const h=Xe(WT)>0,[p,v]=Q6(UT),y=jV(),[x,_]=g.useState(()=>{if(typeof window>"u")return C1;const Y=Number(window.localStorage.getItem(WC));return Number.isFinite(Y)&&Y>=$_&&Y<=Vm?Y:C1}),[b,E]=g.useState(!1),[C,P]=g.useState(YZ),T=p?x:0,[A,O]=g.useState(p);g.useEffect(()=>{if(!p){O(!1);return}P(Y=>qZ({position:Y,boundsLeftPx:x}))},[p,x]),g.useEffect(()=>{window.localStorage.setItem(WC,String(x))},[x]),g.useEffect(()=>{if(!p)return;const Y=K=>{K.key==="Escape"&&(wQ(K.target)||(K.preventDefault(),v(!1)))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[p,v]);const M=g.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation();const K=Y.clientX,B=x;E(!0);const X=ee=>{const H=Math.min(Vm,Math.max($_,B+(ee.clientX-K)));_(H)},$=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[x]),R=g.useCallback(()=>_(C1),[]),L=uq(),N=Xe(mf);fq({enabled:!N});const j=L.isProcessing?"Completing authentication...":a,V=j!==null,G=st(YT);return g.useEffect(()=>{G(t??null)},[t,G]),g.useEffect(()=>{n&&(document.body.style.cursor="auto")},[n]),S.jsxs(sl.div,{className:"relative flex h-screen overflow-hidden",initial:!1,animate:{opacity:1},transition:{duration:.5,ease:"easeOut"},"data-cy":"rivet-app",children:[j!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(DZ,{message:j})}):null,n?S.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/45 backdrop-blur-[2px]",children:S.jsx(aR,{isSigningIn:s||V,onStartSignIn:()=>{r==null||r()},errorMessage:i,displayMode:"modal"})}):null,S.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col ${n?"pointer-events-none select-none":""}`,children:[S.jsx(dK,{holdHostedTryoutPreviewNavigation:u,isInteractionDisabled:n,activeDemoSessionId:e}),u&&c?S.jsx("div",{className:"bg-main absolute inset-0 z-30 flex items-center justify-center",children:S.jsx("div",{className:"border-divider bg-main-light rounded-lg border p-6 shadow-lg",children:S.jsx(cA,{message:c})})}):null]}),n?null:S.jsx(S.Fragment,{children:!f&&!h?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"relative order-first h-full flex-shrink-0",style:{width:A?x:0},children:S.jsxs(sl.div,{className:"absolute inset-y-0 left-0 z-30",initial:!1,animate:{x:p?0:-x},transition:y?{duration:0}:{duration:.2,ease:[.22,1,.36,1]},onAnimationComplete:()=>{p&&O(!0)},style:{width:x,willChange:"transform"},children:[S.jsx(CG,{onClose:()=>v(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:M,onDoubleClick:R,className:"group/resize absolute inset-y-0 right-0 z-20 flex w-3 cursor-col-resize touch-none justify-end",children:S.jsx("span",{className:`h-full transition-all duration-150 ${b?"w-0.5 bg-content-muted":"w-px bg-divider group-hover/resize:w-0.5 group-hover/resize:bg-content-muted"}`})})]})}),b&&S.jsx("div",{className:"fixed inset-0 z-[100] cursor-col-resize"}),S.jsx(JZ,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:C,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>v(Y=>!Y)})]}):null}),S.jsx(d$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},H_="rivet_connect_deep_link",SQ=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(H_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(H_,n),e){t.delete("connect");const r=t.toString();window.history.replaceState(null,document.title,window.location.pathname+(r?`?${r}`:"")+window.location.hash)}return n},EQ=SQ(),kQ=()=>{const[t,e]=g.useState(window.location.hash),[n]=g.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Mp)==="1"),[r,s]=g.useState(!1),[i,a]=g.useState(EQ);g.useEffect(()=>{n&&window.sessionStorage.removeItem(Mp)},[n]);const{config:u,refetchConfig:c,loading:f,error:h}=aq(),p=st(mf),[v,y]=g.useState(!1),[x,_]=g.useState(null),[b,E]=g.useState(!1),[C,P]=g.useState(!1),[T,A]=g.useState(null),[O,M]=g.useState(!1),R=g.useRef(!1),L=g.useRef(!1),N=pQ(window.location.pathname),j=(u==null?void 0:u.activeDemoSessionId)??null,V=N??T??j,G=g.useMemo(()=>cQ(u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V),[u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V]),Y=g.useMemo(()=>uQ({configLoading:f,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:N,activeDemoSessionId:T,configuredDemoSessionId:j}),[u,f,N,T,j]);g.useLayoutEffect(()=>{if(!Y){M(!1);return}M(!0)},[Y]);const K=O,B=g.useMemo(()=>dQ(K),[K]),X=(u==null?void 0:u.demoMode)===!0&&K,$=g.useRef(null);$.current=V;const ee=g.useCallback(async()=>{if(!R.current)return;A(null);const me=await c();if((me==null?void 0:me.demoMode)===!0&&me.agentModeAvailable!==!0){P(!1);return}(me==null?void 0:me.demoMode)===!0&&P(!0)},[c]);g.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return iQ(()=>{ee()})},[u==null?void 0:u.demoMode,ee]),g.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const me=window.fetch.bind(window);return lQ({nativeFetch:me,pageOrigin:window.location.origin,getShouldIntercept:()=>R.current})},[u==null?void 0:u.demoMode]),g.useEffect(()=>{(u==null?void 0:u.agentModeAvailable)===!0&&P(!1)},[u==null?void 0:u.agentModeAvailable]);const H=g.useCallback(async me=>{const Se=$.current;if(!(me!=null&&me.forceRefresh)&&Se)return Se;if(L.current)return"";L.current=!0;try{const Re=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!Re.ok){const it=await xQ(Re);throw new Error(it)}const Ke=await Re.json();if(!Ke.sessionId)throw new Error("Demo session response missing session id.");return A(Ke.sessionId),Ke.sessionId}finally{L.current=!1}},[]);g.useEffect(()=>{j&&A(j)},[j]),g.useEffect(()=>{u!=null&&u.userId?(Te.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Te.alias(u.email,u.userId)):u!=null&&u.email&&Te.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),g.useEffect(()=>{if(!u)return;const me=!!u.demoMode,Se=me?V:null;Te.register({source:me?"tryout":"core",demo_mode:me,...Se?{demo_session_id:Se}:{}})},[u,V]);const D=g.useCallback(async()=>{var Se;y(!0),_(null);let me=null;try{if(me=window.open("","_blank"),!me)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{me.document.open(),me.document.write(yQ),me.document.close()}catch(it){k1.warn("Failed to render loading state in auth popup:",it)}const Re=await fetch(`${BC}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),Ke=await Re.json();if(!Re.ok||!Ke.success||!Ke.authUrl||!Ke.sessionId||!Ke.pollSecret)throw new Error(Ke.error||Ke.message||"Failed to start Google login");if(me.closed)throw new Error("Sign-in window was closed before Google login started.");me.location.href=Ke.authUrl;for(let it=0;it<vQ;it+=1){if(me.closed)throw new Error("Sign-in window was closed before authentication completed.");const at=await(await fetch(`${BC}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:Ke.sessionId,pollSecret:Ke.pollSecret})})).json();if(at.success&&at.token&&((Se=at.user)!=null&&Se.email)){if(!(await fetch("/api/auth/store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:at.user.email,token:at.token,refreshToken:at.refreshToken,userId:at.user.id})})).ok)throw new Error("Signed in, but failed to store session locally.");if(me.close(),window.sessionStorage.setItem(Mp,"1"),(u==null?void 0:u.demoMode)===!0){await H({forceRefresh:!0}),window.location.reload();return}window.location.reload();return}if(at.error&&at.error!=="Pending")throw new Error(at.error||"Google login failed");await new Promise(It=>setTimeout(It,gQ))}throw new Error("Authentication timed out. Please try again.")}catch(Re){me&&!me.closed&&me.close();const Ke=Re instanceof Error?Re.message:"Failed to start login flow";k1.warn("Hosted login failed:",Ke),_(Ke),y(!1)}},[u==null?void 0:u.demoMode,H]),q=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||C||v),re=u!=null&&u.agentModeAvailable!==!0,se=mQ(t),oe=g.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(g.useEffect(()=>{if(!Y)return;let me=!1;return H({forceRefresh:!0}).catch(Se=>{const Re=Se instanceof Error?Se.message:oI;k1.warn("Hosted session bootstrap failed:",Re),_(Re),ht.error(Re)}).finally(()=>{me||M(!1)}),()=>{me=!0}},[Y,H]),g.useEffect(()=>{const me=()=>{const Se=window.location.hash;e(Se)};return window.addEventListener("hashchange",me),()=>window.removeEventListener("hashchange",me)},[]),se==="design-system")return S.jsx(tQ,{});const ue={pathname:window.location.pathname,configLoading:f,hasConfig:u!==null,isRetryingConfig:b};if(hQ(ue)){const me=h||"Could not load Rivet configuration.";return S.jsx("div",{className:"bg-main flex h-screen items-center justify-center px-6",children:S.jsxs("div",{className:"border-divider bg-main w-full max-w-md rounded-lg border p-6 text-center shadow-lg",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"We could not start Rivet yet."}),S.jsx("p",{className:"text-content-dim mt-2 text-xs",children:me}),S.jsx("button",{type:"button",className:"border-divider text-content hover:bg-main/80 mt-4 rounded-md border px-3 py-1.5 text-xs",onClick:()=>{oe()},children:"Retry"})]})})}if(re)return S.jsx(aR,{isSigningIn:v,onStartSignIn:()=>{D()},errorMessage:x,displayMode:"full"});const ie=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,ae=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!ie;return S.jsxs(S.Fragment,{children:[S.jsx(bQ,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:G,showLoginGate:q,onStartLogin:D,isStartingLogin:v,loginError:x,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&v?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:K,hostedTryoutPreviewHoldMessage:B,deferInspectorUntilPreviewReady:X}),S.jsx(x_,{context:"onboarding",isOpen:ae,onClose:()=>s(!0)}),S.jsx(x_,{context:"menu",isOpen:ie,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(H_),a(null)}})]})},CQ="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",PQ=new vL,TQ={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},AQ=()=>S.jsx("div",{style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center"},children:S.jsx("p",{style:{fontSize:"14px",color:"#6b7280"},children:"Something went wrong. Please reload the page."})});lD.createRoot(document.getElementById("root")).render(S.jsx(ve.StrictMode,{children:S.jsx(XN,{apiKey:CQ,options:{api_host:"https://rivet-proxy.onrender.com/ingest",ui_host:"https://us.posthog.com",person_profiles:"always",capture_exceptions:!0,autocapture:!0,capture_pageview:!0,capture_performance:!0,persistence:"localStorage",...TQ,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.13.2",env:"production"})}},children:S.jsx(nD,{fallback:S.jsx(AQ,{}),children:S.jsx(yL,{client:PQ,children:S.jsx(RW,{defaultShape:"rounded",children:S.jsx(kX,{defaultLibrary:"lucide",children:S.jsx(kQ,{})})})})})})}));
|