@hellcoder/companion 0.123.0 → 0.124.0
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/assets/{AgentsPage-D_ZGmkrU.js → AgentsPage-Byq8wvdn.js} +1 -1
- package/dist/assets/{CronManager-u5KuicVz.js → CronManager-Bq2lOMbZ.js} +1 -1
- package/dist/assets/{DashboardPage-Dab8XyGT.js → DashboardPage-V77HIt8S.js} +1 -1
- package/dist/assets/{IntegrationsPage-Bc7SgfqX.js → IntegrationsPage-C3aW9cDI.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-CxyO36qY.js → LinearOAuthSettingsPage-_eAbciJN.js} +1 -1
- package/dist/assets/{LinearSettingsPage-BWfwYF05.js → LinearSettingsPage-DDHFHt7j.js} +1 -1
- package/dist/assets/{MagicUIDashboard-CfD7iyXm.js → MagicUIDashboard-Cl18AKjV.js} +1 -1
- package/dist/assets/{MagicUIView-CO6pZB0M.js → MagicUIView-C0aiMTet.js} +1 -1
- package/dist/assets/{Playground-BiB_VDIl.js → Playground-CvoHRMBd.js} +1 -1
- package/dist/assets/{PromptsPage-BIE70OT1.js → PromptsPage-CzTs1_Se.js} +1 -1
- package/dist/assets/{RunsPage-BAblQKAW.js → RunsPage-B7xru-Xy.js} +1 -1
- package/dist/assets/{SandboxManager-DsR3hQz1.js → SandboxManager-C3tFkiWz.js} +1 -1
- package/dist/assets/{SettingsPage-DuzHKBe_.js → SettingsPage-BZ2fBrHD.js} +1 -1
- package/dist/assets/{TailscalePage-C3y_bGkT.js → TailscalePage-DFRiFKcb.js} +1 -1
- package/dist/assets/index-C7nK12tB.js +142 -0
- package/dist/assets/index-OAVDFR0O.css +1 -0
- package/dist/assets/{sw-register-CUhVLAo0.js → sw-register-Dc72vh_Y.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/cli-launcher.test.ts +16 -0
- package/server/cli-launcher.ts +14 -0
- package/server/routes.test.ts +29 -0
- package/server/routes.ts +14 -0
- package/dist/assets/index-BnF_YIhB.css +0 -1
- package/dist/assets/index-Cd0HGwTS.js +0 -141
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-CvoHRMBd.js","assets/MagicUIDashboard-Cl18AKjV.js","assets/MagicUIView-C0aiMTet.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var i4=Object.defineProperty;var r4=(e,t,n)=>t in e?i4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var w_=(e,t,n)=>r4(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const a4="modulepreload",l4=function(e){return"/"+e},S_={},Zn=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));a=u(n.map(p=>{if(p=l4(p),p in S_)return;S_[p]=!0;const g=p.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":a4,g||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),g)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return a.then(u=>{for(const h of u||[])h.status==="rejected"&&o(h.reason);return t().catch(o)})};function wx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jm={exports:{}},Bc={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var k_;function o4(){if(k_)return Bc;k_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var h in a)h!=="key"&&(o[h]=a[h])}else o=a;return a=o.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:o}}return Bc.Fragment=t,Bc.jsx=n,Bc.jsxs=n,Bc}var j_;function c4(){return j_||(j_=1,Jm.exports=o4()),Jm.exports}var l=c4(),eg={exports:{}},Ke={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var N_;function u4(){if(N_)return Ke;N_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),y=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function C(B,oe,be){this.props=B,this.context=oe,this.refs=S,this.updater=be||j}C.prototype.isReactComponent={},C.prototype.setState=function(B,oe){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,oe,"setState")},C.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function E(){}E.prototype=C.prototype;function R(B,oe,be){this.props=B,this.context=oe,this.refs=S,this.updater=be||j}var A=R.prototype=new E;A.constructor=R,N(A,C.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function P(){}var z={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function I(B,oe,be){var je=be.ref;return{$$typeof:e,type:B,key:oe,ref:je!==void 0?je:null,props:be}}function q(B,oe){return I(B.type,oe,B.props)}function L(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function de(B){var oe={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(be){return oe[be]})}var Q=/\/+/g;function V(B,oe){return typeof B=="object"&&B!==null&&B.key!=null?de(""+B.key):oe.toString(36)}function G(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(P,P):(B.status="pending",B.then(function(oe){B.status==="pending"&&(B.status="fulfilled",B.value=oe)},function(oe){B.status==="pending"&&(B.status="rejected",B.reason=oe)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function H(B,oe,be,je,Ee){var Be=typeof B;(Be==="undefined"||Be==="boolean")&&(B=null);var Oe=!1;if(B===null)Oe=!0;else switch(Be){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(B.$$typeof){case e:case t:Oe=!0;break;case g:return Oe=B._init,H(Oe(B._payload),oe,be,je,Ee)}}if(Oe)return Ee=Ee(B),Oe=je===""?"."+V(B,0):je,O(Ee)?(be="",Oe!=null&&(be=Oe.replace(Q,"$&/")+"/"),H(Ee,oe,be,"",function(Ft){return Ft})):Ee!=null&&(L(Ee)&&(Ee=q(Ee,be+(Ee.key==null||B&&B.key===Ee.key?"":(""+Ee.key).replace(Q,"$&/")+"/")+Oe)),oe.push(Ee)),1;Oe=0;var Te=je===""?".":je+":";if(O(B))for(var Re=0;Re<B.length;Re++)je=B[Re],Be=Te+V(je,Re),Oe+=H(je,oe,be,Be,Ee);else if(Re=_(B),typeof Re=="function")for(B=Re.call(B),Re=0;!(je=B.next()).done;)je=je.value,Be=Te+V(je,Re++),Oe+=H(je,oe,be,Be,Ee);else if(Be==="object"){if(typeof B.then=="function")return H(G(B),oe,be,je,Ee);throw oe=String(B),Error("Objects are not valid as a React child (found: "+(oe==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":oe)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function ae(B,oe,be){if(B==null)return B;var je=[],Ee=0;return H(B,je,"","",function(Be){return oe.call(be,Be,Ee++)}),je}function ye(B){if(B._status===-1){var oe=B._result,be=oe();be.then(function(je){(B._status===0||B._status===-1)&&(B._status=1,B._result=je,be.status===void 0&&(be.status="fulfilled",be.value=je))},function(je){(B._status===0||B._status===-1)&&(B._status=2,B._result=je,be.status===void 0&&(be.status="rejected",be.reason=je))}),B._status===-1&&(B._status=0,B._result=be)}if(B._status===1)return B._result.default;throw B._result}var T=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var oe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(oe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)};function Ne(B){var oe=z.T,be={};be.types=oe!==null?oe.types:null,z.T=be;try{var je=B(),Ee=z.S;Ee!==null&&Ee(be,je),typeof je=="object"&&je!==null&&typeof je.then=="function"&&je.then(P,T)}catch(Be){T(Be)}finally{oe!==null&&be.types!==null&&(oe.types=be.types),z.T=oe}}function Ce(B){var oe=z.T;if(oe!==null){var be=oe.types;be===null?oe.types=[B]:be.indexOf(B)===-1&&be.push(B)}else Ne(Ce.bind(null,B))}var $={map:ae,forEach:function(B,oe,be){ae(B,function(){oe.apply(this,arguments)},be)},count:function(B){var oe=0;return ae(B,function(){oe++}),oe},toArray:function(B){return ae(B,function(oe){return oe})||[]},only:function(B){if(!L(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ke.Activity=v,Ke.Children=$,Ke.Component=C,Ke.Fragment=n,Ke.Profiler=a,Ke.PureComponent=R,Ke.StrictMode=i,Ke.Suspense=f,Ke.ViewTransition=b,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(B){return z.H.useMemoCache(B)}},Ke.addTransitionType=Ce,Ke.cache=function(B){return function(){return B.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(B,oe,be){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var je=N({},B.props),Ee=B.key;if(oe!=null)for(Be in oe.key!==void 0&&(Ee=""+oe.key),oe)!Z.call(oe,Be)||Be==="key"||Be==="__self"||Be==="__source"||Be==="ref"&&oe.ref===void 0||(je[Be]=oe[Be]);var Be=arguments.length-2;if(Be===1)je.children=be;else if(1<Be){for(var Oe=Array(Be),Te=0;Te<Be;Te++)Oe[Te]=arguments[Te+2];je.children=Oe}return I(B.type,Ee,je)},Ke.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},Ke.createElement=function(B,oe,be){var je,Ee={},Be=null;if(oe!=null)for(je in oe.key!==void 0&&(Be=""+oe.key),oe)Z.call(oe,je)&&je!=="key"&&je!=="__self"&&je!=="__source"&&(Ee[je]=oe[je]);var Oe=arguments.length-2;if(Oe===1)Ee.children=be;else if(1<Oe){for(var Te=Array(Oe),Re=0;Re<Oe;Re++)Te[Re]=arguments[Re+2];Ee.children=Te}if(B&&B.defaultProps)for(je in Oe=B.defaultProps,Oe)Ee[je]===void 0&&(Ee[je]=Oe[je]);return I(B,Be,Ee)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(B){return{$$typeof:h,render:B}},Ke.isValidElement=L,Ke.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:ye}},Ke.memo=function(B,oe){return{$$typeof:p,type:B,compare:oe===void 0?null:oe}},Ke.startTransition=Ne,Ke.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ke.use=function(B){return z.H.use(B)},Ke.useActionState=function(B,oe,be){return z.H.useActionState(B,oe,be)},Ke.useCallback=function(B,oe){return z.H.useCallback(B,oe)},Ke.useContext=function(B){return z.H.useContext(B)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(B,oe){return z.H.useDeferredValue(B,oe)},Ke.useEffect=function(B,oe){return z.H.useEffect(B,oe)},Ke.useEffectEvent=function(B){return z.H.useEffectEvent(B)},Ke.useId=function(){return z.H.useId()},Ke.useImperativeHandle=function(B,oe,be){return z.H.useImperativeHandle(B,oe,be)},Ke.useInsertionEffect=function(B,oe){return z.H.useInsertionEffect(B,oe)},Ke.useLayoutEffect=function(B,oe){return z.H.useLayoutEffect(B,oe)},Ke.useMemo=function(B,oe){return z.H.useMemo(B,oe)},Ke.useOptimistic=function(B,oe){return z.H.useOptimistic(B,oe)},Ke.useReducer=function(B,oe,be){return z.H.useReducer(B,oe,be)},Ke.useRef=function(B){return z.H.useRef(B)},Ke.useState=function(B){return z.H.useState(B)},Ke.useSyncExternalStore=function(B,oe,be){return z.H.useSyncExternalStore(B,oe,be)},Ke.useTransition=function(){return z.H.useTransition()},Ke.version="19.3.0",Ke}var C_;function Sx(){return C_||(C_=1,eg.exports=u4()),eg.exports}var k=Sx();const oh=wx(k);var tg={exports:{}},Fc={},ng={exports:{}},sg={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var E_;function d4(){return E_||(E_=1,(function(e){function t(G,H){var ae=G.length;G.push(H);e:for(;0<ae;){var ye=ae-1>>>1,T=G[ye];if(0<a(T,H))G[ye]=H,G[ae]=T,ae=ye;else break e}}function n(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var H=G[0],ae=G.pop();if(ae!==H){G[0]=ae;e:for(var ye=0,T=G.length,Ne=T>>>1;ye<Ne;){var Ce=2*(ye+1)-1,$=G[Ce],B=Ce+1,oe=G[B];if(0>a($,ae))B<T&&0>a(oe,$)?(G[ye]=oe,G[B]=ae,ye=B):(G[ye]=$,G[Ce]=ae,ye=Ce);else if(B<T&&0>a(oe,ae))G[ye]=oe,G[B]=ae,ye=B;else break e}}return H}function a(G,H){var ae=G.sortIndex-H.sortIndex;return ae!==0?ae:G.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],p=[],g=1,v=null,b=3,y=!1,_=!1,j=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(G){for(var H=n(p);H!==null;){if(H.callback===null)i(p);else if(H.startTime<=G)i(p),H.sortIndex=H.expirationTime,t(f,H);else break;H=n(p)}}function A(G){if(j=!1,R(G),!_)if(n(f)!==null)_=!0,O||(O=!0,L());else{var H=n(p);H!==null&&V(A,H.startTime-G)}}var O=!1,P=-1,z=5,Z=-1;function I(){return N?!0:!(e.unstable_now()-Z<z)}function q(){if(N=!1,O){var G=e.unstable_now();Z=G;var H=!0;try{e:{_=!1,j&&(j=!1,C(P),P=-1),y=!0;var ae=b;try{t:{for(R(G),v=n(f);v!==null&&!(v.expirationTime>G&&I());){var ye=v.callback;if(typeof ye=="function"){v.callback=null,b=v.priorityLevel;var T=ye(v.expirationTime<=G);if(G=e.unstable_now(),typeof T=="function"){v.callback=T,R(G),H=!0;break t}v===n(f)&&i(f),R(G)}else i(f);v=n(f)}if(v!==null)H=!0;else{var Ne=n(p);Ne!==null&&V(A,Ne.startTime-G),H=!1}}break e}finally{v=null,b=ae,y=!1}H=void 0}}finally{H?L():O=!1}}}var L;if(typeof E=="function")L=function(){E(q)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,Q=de.port2;de.port1.onmessage=q,L=function(){Q.postMessage(null)}}else L=function(){S(q,0)};function V(G,H){P=S(function(){G(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(G){switch(b){case 1:case 2:case 3:var H=3;break;default:H=b}var ae=b;b=H;try{return G()}finally{b=ae}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(G,H){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var ae=b;b=G;try{return H()}finally{b=ae}},e.unstable_scheduleCallback=function(G,H,ae){var ye=e.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?ye+ae:ye):ae=ye,G){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=ae+T,G={id:g++,callback:H,priorityLevel:G,startTime:ae,expirationTime:T,sortIndex:-1},ae>ye?(G.sortIndex=ae,t(p,G),n(f)===null&&G===n(p)&&(j?(C(P),P=-1):j=!0,V(A,ae-ye))):(G.sortIndex=T,t(f,G),_||y||(_=!0,O||(O=!0,L()))),G},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(G){var H=b;return function(){var ae=b;b=H;try{return G.apply(this,arguments)}finally{b=ae}}}})(sg)),sg}var T_;function h4(){return T_||(T_=1,ng.exports=d4()),ng.exports}var ig={exports:{}},Hn={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var M_;function f4(){if(M_)return Hn;M_=1;var e=Sx();function t(g){var v="https://react.dev/errors/"+g;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)v+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+g+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal"),o=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function h(g,v,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:y==null?null:y===u?u:""+y,children:g,containerInfo:v,implementation:b}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(g,v){if(g==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Hn.browser=function(g){return{$$typeof:o,_reason:g}},Hn.createPortal=function(g,v){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(t(299));return h(g,v,null,b)},Hn.flushSync=function(g){var v=f.T,b=i.p;try{if(f.T=null,i.p=2,g)return g()}finally{f.T=v,i.p=b,i.d.f()}},Hn.preconnect=function(g,v){typeof g=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,i.d.C(g,v))},Hn.prefetchDNS=function(g){typeof g=="string"&&i.d.D(g)},Hn.preinit=function(g,v){if(typeof g=="string"&&v&&typeof v.as=="string"){var b=v.as,y=p(b,v.crossOrigin),_=typeof v.integrity=="string"?v.integrity:void 0,j=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;b==="style"?i.d.S(g,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:y,integrity:_,fetchPriority:j}):b==="script"&&i.d.X(g,{crossOrigin:y,integrity:_,fetchPriority:j,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Hn.preinitModule=function(g,v){if(typeof g=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var b=p(v.as,v.crossOrigin);i.d.M(g,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}}else v==null&&i.d.M(g)},Hn.preload=function(g,v){if(typeof g=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var b=v.as,y=p(b,v.crossOrigin);i.d.L(g,b,{crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Hn.preloadModule=function(g,v){if(typeof g=="string")if(v){var b=p(v.as,v.crossOrigin);i.d.m(g,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}else i.d.m(g)},Hn.requestFormReset=function(g){i.d.r(g)},Hn.unstable_batchedUpdates=function(g,v){return g(v)},Hn.useFormState=function(g,v,b){return f.H.useFormState(g,v,b)},Hn.useFormStatus=function(){return f.H.useHostTransitionStatus()},Hn.version="19.3.0",Hn}var A_;function sS(){if(A_)return ig.exports;A_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ig.exports=f4(),ig.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var R_;function p4(){if(R_)return Fc;R_=1;var e=h4(),t=Sx(),n=sS();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){for(var r=s,c=r;c&&!c.alternate;)r=c,(r.flags&4098)!==0&&(s=r.return),c=r.return;for(;r.return;)r=r.return;return r.tag===3?s:null}function u(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function h(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(i(188))}function p(s){var r=s.alternate;if(!r){if(r=o(s),r===null)throw Error(i(188));return r!==s?null:s}for(var c=s,d=r;;){var m=c.return;if(m===null)break;var x=m.alternate;if(x===null){if(d=m.return,d!==null){c=d;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===c)return f(m),s;if(x===d)return f(m),r;x=x.sibling}throw Error(i(188))}if(c.return!==d.return)c=m,d=x;else{for(var w=!1,M=m.child;M;){if(M===c){w=!0,c=m,d=x;break}if(M===d){w=!0,d=m,c=x;break}M=M.sibling}if(!w){for(M=x.child;M;){if(M===c){w=!0,c=x,d=m;break}if(M===d){w=!0,d=x,c=m;break}M=M.sibling}if(!w)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:r}function g(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=g(s),r!==null)return r;s=s.sibling}return null}function v(s,r,c,d,m,x){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&c(s,d,m,x)||(s.tag!==22||s.memoizedState===null)&&(r||s.tag!==5&&s.tag!==27)&&v(s.child,r,c,d,m,x))return!0;s=s.sibling}return!1}function b(s){for(s=s.return;s!==null;){if(s.tag===3||s.tag===5||s.tag===27)return s;s=s.return}return null}function y(s){var r=!1;for(s=s.return;s!==null&&(s.tag===4&&(r=!0),!(s.tag===3||s.tag===5||s.tag===27));)s=s.return;return r}function _(s){var r=[null,null],c=b(s);return c===null||j(r,s,c.child,{foundSelf:!1}),r}function j(s,r,c,d){for(;c!==null;){if(c===r)d.foundSelf=!0;else if(c.tag===5||c.tag===27||c.tag===6){if(d.foundSelf)return s[1]=c,!0;s[0]=c}else if((c.tag!==22||c.memoizedState===null)&&j(s,r,c.child,d))return!0;c=c.sibling}return!1}function N(s){switch(s.tag){case 5:case 27:case 6:return s.stateNode;case 3:return s.stateNode.containerInfo;default:throw Error(i(559))}}var S=null,C=null;function E(s,r,c){return s===c?!0:s===r?(S=s,!0):!1}function R(s,r,c){return s===c?(C=s,!1):s===r?(C!==null&&(S=s),!0):!1}function A(s){if(s===null)return null;do s=s===null?null:s.return;while(s&&s.tag!==5&&s.tag!==27&&s.tag!==3);return s||null}function O(s,r,c){for(var d=0,m=s;m;m=c(m))d++;m=0;for(var x=r;x;x=c(x))m++;for(;0<d-m;)s=c(s),d--;for(;0<m-d;)r=c(r),m--;for(;d--;){if(s===r||r!==null&&s===r.alternate)return s;s=c(s),r=c(r)}return null}var P=Object.assign,z=Symbol.for("react.element"),Z=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),V=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),ye=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),Ne=Symbol.for("react.activity"),Ce=Symbol.for("react.legacy_hidden"),$=Symbol.for("react.memo_cache_sentinel"),B=Symbol.for("react.view_transition"),oe=Symbol.for("react.recoverable"),be=Symbol.iterator;function je(s){return s===null||typeof s!="object"?null:(s=be&&s[be]||s["@@iterator"],typeof s=="function"?s:null)}var Ee=Symbol.for("react.client.reference");function Be(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Ee?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case q:return"Fragment";case de:return"Profiler";case L:return"StrictMode";case H:return"Suspense";case ae:return"SuspenseList";case Ne:return"Activity";case B:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case I:return"Portal";case V:return s.displayName||"Context";case Q:return(s._context.displayName||"Context")+".Consumer";case G:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case ye:return r=s.displayName||null,r!==null?r:Be(s.type)||"Memo";case T:r=s._payload,s=s._init;try{return Be(s(r))}catch{}}return null}var Oe=Array.isArray,Te=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ft={pending:!1,data:null,method:null,action:null},vn=[],Vt=-1;function St(s){return{current:s}}function wt(s){0>Vt||(s.current=vn[Vt],vn[Vt]=null,Vt--)}function We(s,r){Vt++,vn[Vt]=s.current,s.current=r}var xt=St(null),Zt=St(null),ie=St(null),ke=St(null);function Qe(s,r){switch(We(ie,r),We(Zt,s),We(xt,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?Ay(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=Ay(r),s=Ry(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}wt(xt),We(xt,s)}function nt(){wt(xt),wt(Zt),wt(ie)}function Kt(s){var r=s.memoizedState;r!==null&&(Kl._currentValue=r.memoizedState,We(ke,s)),r=xt.current;var c=Ry(r,s.type);r!==c&&(We(Zt,s),We(xt,c))}function It(s){Zt.current===s&&(wt(xt),wt(Zt)),ke.current===s&&(wt(ke),Kl._currentValue=Ft)}var ce,U;function fe(s){if(ce===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);ce=r&&r[1]||"",U=-1<c.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+ce+s+U}var Ae=!1;function tt(s,r){if(!s||Ae)return"";Ae=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(r){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(Me){var K=Me}Reflect.construct(s,[],pe)}else{try{pe.call()}catch(Me){K=Me}pe=!1;try{var re=Object.getOwnPropertyDescriptor(s.prototype,"props");Object.defineProperty(s.prototype,"props",{configurable:!0,set:function(){throw Error()}}),pe=!0,new s}finally{pe&&(re!==void 0?Object.defineProperty(s.prototype,"props",re):delete s.prototype.props)}}}else{try{throw Error()}catch(Me){K=Me}(pe=s())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(Me){if(Me&&K&&typeof Me.stack=="string")return[Me.stack,K.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=d.DetermineComponentFrameRoot(),w=x[0],M=x[1];if(w&&M){var F=w.split(`
|
|
45
|
+
`),ee=M.split(`
|
|
46
|
+
`);for(m=d=0;d<F.length&&!F[d].includes("DetermineComponentFrameRoot");)d++;for(;m<ee.length&&!ee[m].includes("DetermineComponentFrameRoot");)m++;if(d===F.length||m===ee.length)for(d=F.length-1,m=ee.length-1;1<=d&&0<=m&&F[d]!==ee[m];)m--;for(;1<=d&&0<=m;d--,m--)if(F[d]!==ee[m]){if(d!==1||m!==1)do if(d--,m--,0>m||F[d]!==ee[m]){var le=`
|
|
47
|
+
`+F[d].replace(" at new "," at ");return s.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",s.displayName)),le}while(1<=d&&0<=m);break}}}finally{Ae=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?fe(c):""}function ze(s,r){switch(s.tag){case 26:case 27:case 5:return fe(s.type);case 16:return fe("Lazy");case 13:return s.child!==r&&r!==null?fe("Suspense Fallback"):fe("Suspense");case 19:return fe("SuspenseList");case 0:case 15:return tt(s.type,!1);case 11:return tt(s.type.render,!1);case 1:return tt(s.type,!0);case 31:return fe("Activity");case 30:return fe("ViewTransition");default:return""}}function st(s){try{var r="",c=null;do r+=ze(s,c),c=s,s=s.return;while(s);return r}catch(d){return`
|
|
48
|
+
Error generating stack: `+d.message+`
|
|
49
|
+
`+d.stack}}var rn=Object.prototype.hasOwnProperty,Jn=e.unstable_scheduleCallback,ln=e.unstable_cancelCallback,Fs=e.unstable_shouldYield,ks=e.unstable_requestPaint,Ut=e.unstable_now,Jt=e.unstable_getCurrentPriorityLevel,hn=e.unstable_ImmediatePriority,en=e.unstable_UserBlockingPriority,yi=e.unstable_NormalPriority,_i=e.unstable_LowPriority,kr=e.unstable_IdlePriority,wi=e.log,ya=e.unstable_setDisableYieldValue,Ln=null,fn=null;function Vn(s){if(typeof wi=="function"&&ya(s),fn&&typeof fn.setStrictMode=="function")try{fn.setStrictMode(Ln,s)}catch{}}var tn=Math.clz32?Math.clz32:me,te=Math.log,ve=Math.LN2;function me(s){return s>>>=0,s===0?32:31-(te(s)/ve|0)|0}var Ge=256,jt=262144,pn=4194304;function Dn(s){var r=s&42;if(r!==0)return r;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&-s;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ot(s,r,c){var d=s.pendingLanes;if(d===0)return 0;var m=0,x=s.suspendedLanes,w=s.pingedLanes;s=s.warmLanes;var M=d&134217727;return M!==0?(d=M&~x,d!==0?m=Dn(d):(w&=M,w!==0?m=Dn(w):c||(c=M&~s,c!==0&&(m=Dn(c))))):(M=d&~x,M!==0?m=Dn(M):w!==0?m=Dn(w):c||(c=d&~s,c!==0&&(m=Dn(c)))),m===0?0:r!==0&&r!==m&&(r&x)===0&&(x=m&-m,c=r&-r,x>=c||x===32&&(c&4194048)!==0)?r:m}function zn(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function ti(s,r){(r&8)!==0&&(r|=r&32);var c=s.entangledLanes;if(c!==0)for(s=s.entanglements,c&=r;0<c;){var d=31-tn(c),m=1<<d;r|=s[d],c&=~m}return r}function Of(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Iu(){var s=pn;return pn<<=1,(pn&62914560)===0&&(pn=4194304),s}function Yi(s){for(var r=[],c=0;31>c;c++)r.push(s);return r}function Si(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function fl(s,r,c,d,m,x){var w=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var M=s.entanglements,F=s.expirationTimes,ee=s.hiddenUpdates;for(c=w&~c;0<c;){var le=31-tn(c),pe=1<<le;M[le]=0,F[le]=-1;var K=ee[le];if(K!==null)for(ee[le]=null,le=0;le<K.length;le++){var re=K[le];re!==null&&(re.lane&=-536870913)}c&=~pe}d!==0&&_a(s,d,0),x!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=x&~(w&~r))}function _a(s,r,c){s.pendingLanes|=r,s.suspendedLanes&=~r;var d=31-tn(r);s.entangledLanes|=r,s.entanglements[d]=s.entanglements[d]|1073741824|c&261930}function Fo(s,r){var c=s.entangledLanes|=r;for(s=s.entanglements;c;){var d=31-tn(c),m=1<<d;m&r|s[d]&r&&(s[d]|=r),c&=~m}}function ki(s,r){var c=r&-r;return c=(c&42)!==0?1:Io(c),(c&(s.suspendedLanes|r))!==0?0:c}function Io(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function wa(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Sa(){var s=Re.p;return s!==0?s:(s=window.event,s===void 0?32:m_(s.type))}function ds(s,r){var c=Re.p;try{return Re.p=s,r()}finally{Re.p=c}}var js=Math.random().toString(36).slice(2),mn="__reactFiber$"+js,Tn="__reactProps$"+js,ji="__reactContainer$"+js,Uo="__reactEvents$"+js,on="__reactListeners$"+js,Lf="__reactHandles$"+js,Ho="__reactResources$"+js,ka="__reactMarker$"+js,pl="__reactLoad$"+js;function ml(s){delete s[mn],delete s[Tn],delete s[on],delete s[Lf]}function Xi(s){var r;if(r=s[mn])return r;for(var c=s.parentNode;c;){if(r=c[ji]||c[mn]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(s=Qy(s);s!==null;){if(c=s[mn])return c;s=Qy(s)}return r}s=c,c=s.parentNode}return null}function Ni(s){if(s=s[mn]||s[ji]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function jr(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function hs(s){var r=s[Ho];return r||(r=s[Ho]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function cn(s){s[ka]=!0}function Ns(s){s[pl]=void 0}var ni=new Set,gl={};function Qi(s,r){Wi(s,r),Wi(s+"Capture",r)}function Wi(s,r){for(gl[s]=r,s=0;s<r.length;s++)ni.add(r[s])}var Df=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),xl={},qo={};function zf(s){return rn.call(qo,s)?!0:rn.call(xl,s)?!1:Df.test(s)?qo[s]=!0:(xl[s]=!0,!1)}var vt=!1;function Uu(){var s=vt;return vt=!1,s}function vl(s,r,c){if(zf(r))if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var d=r.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,c)}}function ja(s,r,c){if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,c)}}function Is(s,r,c,d){if(d===null)s.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(r,c,d)}}function es(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Hu(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function qu(s,r,c){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return m.call(this)},set:function(w){c=""+w,x.call(this,w)}}),Object.defineProperty(s,r,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function Nr(s){if(!s._valueTracker){var r=Hu(s)?"checked":"value";s._valueTracker=qu(s,r,""+s[r])}}function Vo(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var c=r.getValue(),d="";return s&&(d=Hu(s)?s.checked?"true":"false":s.value),s=d,s!==c?(r.setValue(s),!0):!1}var $f=/[\n"\\]/g;function fs(s){return s.replace($f,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Go(s,r,c,d,m,x,w,M){s.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?s.type=w:s.removeAttribute("type"),r!=null?w==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+es(r)):s.value!==""+es(r)&&(s.value=""+es(r)):w!=="submit"&&w!=="reset"||s.removeAttribute("value"),r!=null?w==="number"&&s.value==r?Yo(s,es(s.value)):Yo(s,es(r)):c!=null?Yo(s,es(c)):d!=null&&s.removeAttribute("value"),m==null&&x!=null&&(s.defaultChecked=!!x),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?s.name=""+es(M):s.removeAttribute("name")}function Vu(s,r,c,d,m,x,w,M){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),r!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){Nr(s);return}c=c!=null?""+es(c):"",r=r!=null?""+es(r):c,M||r===s.value||(s.value=r),s.defaultValue=r}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=M?s.checked:!!d,s.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(s.name=w),Nr(s)}function Yo(s,r){s.defaultValue!==""+r&&(s.defaultValue=""+r)}function Cr(s,r,c,d){if(s=s.options,r){r={};for(var m=0;m<c.length;m++)r["$"+c[m]]=!0;for(c=0;c<s.length;c++)m=r.hasOwnProperty("$"+s[c].value),s[c].selected!==m&&(s[c].selected=m),m&&d&&(s[c].defaultSelected=!0)}else{for(c=""+es(c),r=null,m=0;m<s.length;m++){if(s[m].value===c){s[m].selected=!0,d&&(s[m].defaultSelected=!0);return}r!==null||s[m].disabled||(r=s[m])}r!==null&&(r.selected=!0)}}function Xo(s,r,c){if(r!=null&&(r=""+es(r),r!==s.value&&(s.value=r),c==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=c!=null?""+es(c):""}function Qo(s,r,c,d){if(r==null){if(d!=null){if(c!=null)throw Error(i(92));if(Oe(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),r=c}c=es(r),s.defaultValue=c,d=s.textContent,d===c&&d!==""&&d!==null&&(s.value=d),Nr(s)}function Zi(s,r){if(r){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=r;return}}s.textContent=r}var X=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xe(s,r,c){var d=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":d?s.setProperty(r,c):typeof c!="number"||c===0||X.has(r)?r==="float"?s.cssFloat=c:s[r]=(""+c).trim():s[r]=c+"px"}function at(s,r,c){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||r!=null&&r.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="",vt=!0);for(var m in r)d=r[m],r.hasOwnProperty(m)&&c[m]!==d&&(xe(s,m,d),vt=!0)}else for(var x in r)r.hasOwnProperty(x)&&xe(s,x,r[x])}function pt(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mt=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ye=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function $n(s){return Ye.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function ts(){}var Er=null;function bl(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Cs=null,si=null;function Wo(s){var r=Ni(s);if(r&&(s=r.stateNode)){var c=s[Tn]||null;e:switch(s=r.stateNode,r.type){case"input":if(Go(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+fs(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var d=c[r];if(d!==s&&d.form===s.form){var m=d[Tn]||null;if(!m)throw Error(i(90));Go(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<c.length;r++)d=c[r],d.form===s.form&&Vo(d)}break e;case"textarea":Xo(s,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&Cr(s,!!c.multiple,r,!1)}}}var Tr=!1;function Es(s,r,c){if(Tr)return s(r,c);Tr=!0;try{var d=s(r);return d}finally{if(Tr=!1,(Cs!==null||si!==null)&&(qd(),Cs&&(r=Cs,s=si,si=Cs=null,Wo(r),s)))for(r=0;r<s.length;r++)Wo(s[r])}}function Mr(s,r){var c=s.stateNode;if(c===null)return null;var d=c[Tn]||null;if(d===null)return null;c=d[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,r,typeof c));return c}var ii=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zo=!1;if(ii)try{var Na={};Object.defineProperty(Na,"passive",{get:function(){Zo=!0}}),window.addEventListener("test",Na,Na),window.removeEventListener("test",Na,Na)}catch{Zo=!1}var ri=null,Gu=null,Ca=null;function Ko(){if(Ca)return Ca;var s,r=Gu,c=r.length,d,m="value"in ri?ri.value:ri.textContent,x=m.length;for(s=0;s<c&&r[s]===m[s];s++);var w=c-s;for(d=1;d<=w&&r[c-d]===m[x-d];d++);return Ca=m.slice(s,1<d?1-d:void 0)}function Ts(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function Yu(){return!0}function Ev(){return!1}function ns(s){function r(c,d,m,x,w){this._reactName=c,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var M in s)s.hasOwnProperty(M)&&(c=s[M],this[M]=c?c(x):x[M]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Yu:Ev,this.isPropagationStopped=Ev,this}return P(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Yu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Yu)},persist:function(){},isPersistent:Yu}),r}var Ar={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xu=ns(Ar),Jo=P({},Ar,{view:0,detail:0}),TC=ns(Jo),Pf,Bf,ec,Qu=P({},Jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:If,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ec&&(ec&&s.type==="mousemove"?(Pf=s.screenX-ec.screenX,Bf=s.screenY-ec.screenY):Bf=Pf=0,ec=s),Pf)},movementY:function(s){return"movementY"in s?s.movementY:Bf}}),Tv=ns(Qu),MC=P({},Qu,{dataTransfer:0}),AC=ns(MC),RC=P({},Jo,{relatedTarget:0}),Ff=ns(RC),OC=P({},Ar,{animationName:0,elapsedTime:0,pseudoElement:0}),LC=ns(OC),DC=P({},Ar,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),zC=ns(DC),$C=P({},Ar,{data:0}),Mv=ns($C),PC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BC={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},FC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=FC[s])?!!r[s]:!1}function If(){return IC}var UC=P({},Jo,{key:function(s){if(s.key){var r=PC[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Ts(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?BC[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:If,charCode:function(s){return s.type==="keypress"?Ts(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Ts(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),HC=ns(UC),qC=P({},Qu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Av=ns(qC),VC=P({},Ar,{submitter:0}),GC=ns(VC),YC=P({},Jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:If}),XC=ns(YC),QC=P({},Ar,{propertyName:0,elapsedTime:0,pseudoElement:0}),WC=ns(QC),ZC=P({},Qu,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),KC=ns(ZC),JC=P({},Ar,{newState:0,oldState:0,source:0}),e3=ns(JC),t3=[9,13,27,32],Uf=ii&&"CompositionEvent"in window,tc=null;ii&&"documentMode"in document&&(tc=document.documentMode);var n3=ii&&"TextEvent"in window&&!tc,Rv=ii&&(!Uf||tc&&8<tc&&11>=tc),Ov=" ",Lv=!1;function Dv(s,r){switch(s){case"keyup":return t3.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var yl=!1;function s3(s,r){switch(s){case"compositionend":return zv(r);case"keypress":return r.which!==32?null:(Lv=!0,Ov);case"textInput":return s=r.data,s===Ov&&Lv?null:s;default:return null}}function i3(s,r){if(yl)return s==="compositionend"||!Uf&&Dv(s,r)?(s=Ko(),Ca=Gu=ri=null,yl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Rv&&r.locale!=="ko"?null:r.data;default:return null}}var r3={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function $v(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!r3[s.type]:r==="textarea"}function Pv(s,r,c,d){Cs?si?si.push(d):si=[d]:Cs=d,r=Wd(r,"onChange"),0<r.length&&(c=new Xu("onChange","change",null,c,d),s.push({event:c,listeners:r}))}var nc=null,sc=null;function a3(s){jy(s,0)}function Wu(s){var r=jr(s);if(Vo(r))return s}function Bv(s,r){if(s==="change")return r}var Fv=!1;if(ii){var Hf;if(ii){var qf="oninput"in document;if(!qf){var Iv=document.createElement("div");Iv.setAttribute("oninput","return;"),qf=typeof Iv.oninput=="function"}Hf=qf}else Hf=!1;Fv=Hf&&(!document.documentMode||9<document.documentMode)}function Uv(){nc&&(nc.detachEvent("onpropertychange",Hv),sc=nc=null)}function Hv(s){if(s.propertyName==="value"&&Wu(sc)){var r=[];Pv(r,sc,s,bl(s)),Es(a3,r)}}function l3(s,r,c){s==="focusin"?(Uv(),nc=r,sc=c,nc.attachEvent("onpropertychange",Hv)):s==="focusout"&&Uv()}function o3(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Wu(sc)}function c3(s,r){if(s==="click")return Wu(r)}function u3(s,r){if(s==="input"||s==="change")return Wu(r)}function d3(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Ms=typeof Object.is=="function"?Object.is:d3;function ic(s,r){if(Ms(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var c=Object.keys(s),d=Object.keys(r);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var m=c[d];if(!rn.call(r,m)||!Ms(s[m],r[m]))return!1}return!0}function Vf(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function qv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Vv(s,r){var c=qv(s);s=0;for(var d;c;){if(c.nodeType===3){if(d=s+c.textContent.length,s<=r&&d>=r)return{node:c,offset:r-s};s=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=qv(c)}}function Gv(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Gv(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Yv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=Vf(s.document);r instanceof s.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)s=r.contentWindow;else break;r=Vf(s.document)}return r}function Gf(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var h3=ii&&"documentMode"in document&&11>=document.documentMode,_l=null,Yf=null,rc=null,Xf=!1;function Xv(s,r,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Xf||_l==null||_l!==Vf(d)||(d=_l,"selectionStart"in d&&Gf(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),rc&&ic(rc,d)||(rc=d,d=Wd(Yf,"onSelect"),0<d.length&&(r=new Xu("onSelect","select",null,r,c),s.push({event:r,listeners:d}),r.target=_l)))}function Ea(s,r){var c={};return c[s.toLowerCase()]=r.toLowerCase(),c["Webkit"+s]="webkit"+r,c["Moz"+s]="moz"+r,c}var wl={animationend:Ea("Animation","AnimationEnd"),animationiteration:Ea("Animation","AnimationIteration"),animationstart:Ea("Animation","AnimationStart"),transitionrun:Ea("Transition","TransitionRun"),transitionstart:Ea("Transition","TransitionStart"),transitioncancel:Ea("Transition","TransitionCancel"),transitionend:Ea("Transition","TransitionEnd")},Qf={},Qv={};ii&&(Qv=document.createElement("div").style,"AnimationEvent"in window||(delete wl.animationend.animation,delete wl.animationiteration.animation,delete wl.animationstart.animation),"TransitionEvent"in window||delete wl.transitionend.transition);function Ta(s){if(Qf[s])return Qf[s];if(!wl[s])return s;var r=wl[s],c;for(c in r)if(r.hasOwnProperty(c)&&c in Qv)return Qf[s]=r[c];return s}var Wv=Ta("animationend"),Zv=Ta("animationiteration"),Kv=Ta("animationstart"),f3=Ta("transitionrun"),p3=Ta("transitionstart"),m3=Ta("transitioncancel"),Jv=Ta("transitionend"),e1=new Map,Wf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Wf.push("scrollEnd");function ai(s,r){e1.set(s,r),Qi(r,[s])}var g3=0;function Ki(s,r){if(s.name!=null&&s.name!=="auto")return s.name;if(r.autoName!==null)return r.autoName;s=ui.identifierPrefix;var c=g3++;return s="_"+s+"t_"+c.toString(32)+"_",r.autoName=s}function t1(s){if(s==null||typeof s=="string")return s;var r=null,c=Ul;if(c!==null)for(var d=0;d<c.length;d++){var m=s[c[d]];if(m!=null){if(m==="none")return"none";r=r==null?m:r+(" "+m)}}return r??s.default}function Ji(s,r){return s=t1(s),r=t1(r),r==null?s==="auto"?null:s:r==="auto"?null:r}var Zu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Us=[],Sl=0,Zf=0;function Ku(){for(var s=Sl,r=Zf=Sl=0;r<s;){var c=Us[r];Us[r++]=null;var d=Us[r];Us[r++]=null;var m=Us[r];Us[r++]=null;var x=Us[r];if(Us[r++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&n1(c,m,x)}}function Ju(s,r,c,d){Us[Sl++]=s,Us[Sl++]=r,Us[Sl++]=c,Us[Sl++]=d,Zf|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Kf(s,r,c,d){return Ju(s,r,c,d),ed(s)}function Ma(s,r){return Ju(s,null,null,r),ed(s)}function n1(s,r,c){s.lanes|=c;var d=s.alternate;d!==null&&(d.lanes|=c);for(var m=!1,x=s.return;x!==null;)x.childLanes|=c,d=x.alternate,d!==null&&(d.childLanes|=c),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(m=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,m&&r!==null&&(m=31-tn(c),s=x.hiddenUpdates,d=s[m],d===null?s[m]=[r]:d.push(r),r.lane=c|536870912),x):null}function ed(s){if(50<Cc)throw Cc=0,Hd=null,Error(i(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var kl={};function x3(s,r,c,d){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ps(s,r,c,d){return new x3(s,r,c,d)}function Jf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function er(s,r){var c=s.alternate;return c===null?(c=ps(s.tag,r,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=r,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&1206910976,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,r=s.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function s1(s,r){s.flags&=1206910978;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,r=c.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function td(s,r,c,d,m,x){var w=0;if(d=s,typeof d=="function")Jf(d)&&(w=1);else if(typeof d=="string")w=VE(s,c,xt.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case Ne:return s=ps(31,c,r,m),s.elementType=Ne,s.lanes=x,s;case q:return Aa(c.children,m,x,r);case L:w=8,m|=24;break;case de:return s=ps(12,c,r,m|2),s.elementType=de,s.lanes=x,s;case H:return s=ps(13,c,r,m),s.elementType=H,s.lanes=x,s;case ae:return s=ps(19,c,r,m),s.elementType=ae,s.lanes=x,s;case Ce:case B:return s=m|32,s=ps(30,c,r,s),s.elementType=B,s.lanes=x,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case V:w=10;break e;case Q:w=9;break e;case G:w=11;break e;case ye:w=14;break e;case T:w=16,d=null;break e}w=29,c=Error(i(130,s===null?"null":typeof s,"")),d=null}return r=ps(w,c,r,m),r.elementType=s,r.type=d,r.lanes=x,r}function Aa(s,r,c,d){return s=ps(7,s,d,r),s.lanes=c,s}function ep(s,r,c){return s=ps(6,s,null,r),s.lanes=c,s}function i1(s){var r=ps(18,null,null,0);return r.stateNode=s,r}function tp(s,r,c){return r=ps(4,s.children!==null?s.children:[],s.key,r),r.lanes=c,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var r1=new WeakMap;function Hs(s,r){if(typeof s=="object"&&s!==null){var c=r1.get(s);return c!==void 0?c:(r={value:s,source:r,stack:st(r)},r1.set(s,r),r)}return{value:s,source:r,stack:st(r)}}var jl=[],Nl=0,nd=null,ac=0,qs=[],Vs=0,Rr=null,Ci=1,Ei="";function tr(s,r){jl[Nl++]=ac,jl[Nl++]=nd,nd=s,ac=r}function a1(s,r,c){qs[Vs++]=Ci,qs[Vs++]=Ei,qs[Vs++]=Rr,Rr=s;var d=Ci;s=Ei;var m=32-tn(d)-1;d&=~(1<<m),c+=1;var x=32-tn(r)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Ci=1<<32-tn(r)+m|c<<m|d,Ei=x+s}else Ci=1<<x|c<<m|d,Ei=s}function sd(s){s.return!==null&&(tr(s,1),a1(s,1,0))}function np(s){for(;s===nd;)nd=jl[--Nl],jl[Nl]=null,ac=jl[--Nl],jl[Nl]=null;for(;s===Rr;)Rr=qs[--Vs],qs[Vs]=null,Ei=qs[--Vs],qs[Vs]=null,Ci=qs[--Vs],qs[Vs]=null}function l1(s,r){qs[Vs++]=Ci,qs[Vs++]=Ei,qs[Vs++]=Rr,Ci=r.id,Ei=r.overflow,Rr=s}var Mn=null,Ht=null,lt=!1,Or=null,Gs=!1,sp=Error(i(519));function Lr(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw lc(Hs(r,s)),sp}function o1(s){var r=s.stateNode,c=s.type,d=s.memoizedProps;switch(r[mn]=s,r[Tn]=d,c){case"dialog":dt("cancel",r),dt("close",r);break;case"iframe":case"object":case"embed":dt("load",r);break;case"video":case"audio":for(c=0;c<Tc.length;c++)dt(Tc[c],r);break;case"source":dt("error",r);break;case"img":case"image":case"link":dt("error",r),dt("load",r);break;case"details":dt("toggle",r);break;case"input":dt("invalid",r),Vu(r,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":dt("invalid",r);break;case"textarea":dt("invalid",r),Qo(r,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||d.suppressHydrationWarning===!0||Ty(r.textContent,c)?(d.popover!=null&&(dt("beforetoggle",r),dt("toggle",r)),d.onScroll!=null&&dt("scroll",r),d.onScrollEnd!=null&&dt("scrollend",r),d.onClick!=null&&(r.onclick=ts),r=!0):r=!1,r||Lr(s,!0)}function id(s){for(Mn=s.return;Mn;)switch(Mn.tag){case 5:case 31:case 13:Gs=!1;return;case 27:case 3:Gs=!0;return;default:Mn=Mn.return}}function Cl(s){if(s!==Mn)return!1;if(!lt)return id(s),lt=!0,!1;var r=s.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Om(s.type,s.memoizedProps)),c=!c),c&&Ht&&Lr(s),id(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Xy(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Xy(s)}else r===27?(r=Ht,Wr(s.type)?(s=Um,Um=null,Ht=s):Ht=r):Ht=Mn?Xs(s.stateNode.nextSibling):null;return!0}function Ra(){Ht=Mn=null,lt=!1}function ip(){var s=Or;return s!==null&&(xs===null?xs=s:xs.push.apply(xs,s),Or=null),s}function lc(s){Or===null?Or=[s]:Or.push(s)}var rp=St(null),Oa=null,nr=null;function Dr(s,r,c){We(rp,r._currentValue),r._currentValue=c}function sr(s){s._currentValue=rp.current,wt(rp)}function rd(s,r,c){for(;s!==null;){var d=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,d!==null&&(d.childLanes|=r)):d!==null&&(d.childLanes&r)!==r&&(d.childLanes|=r),s===c)break;s=s.return}}function ap(s,r,c,d){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var M=x;x=m;for(var F=0;F<r.length;F++)if(M.context===r[F]){x.lanes|=c,M=x.alternate,M!==null&&(M.lanes|=c),rd(x.return,c,s),d||(w=null);break e}x=M.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=c,x=w.alternate,x!==null&&(x.lanes|=c),rd(w,c,s),w=null}else m.tag===13&&m.memoizedState!==null&&m.memoizedState.dehydrated===null?(m.lanes|=c,w=m.alternate,w!==null&&(w.lanes|=c),rd(m.return,c,s),w=m.child,w=w!==null?w.sibling:null):w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===s){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function La(s,r,c,d){s=null;for(var m=r,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var M=m.type;Ms(m.pendingProps.value,w.value)||(s!==null?s.push(M):s=[M])}}else if(m===ke.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Kl):s=[Kl])}m=m.return}return s!==null&&ap(r,s,c,d),r.flags|=262144,s!==null}function ad(s){for(s=s.firstContext;s!==null;){if(!Ms(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Da(s){Oa=s,nr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Pn(s){return c1(Oa,s)}function ld(s,r){return Oa===null&&Da(s),c1(s,r)}function c1(s,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},nr===null){if(s===null)throw Error(i(308));nr=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else nr=nr.next=r;return c}var v3=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(c,d){s.push(d)}};this.abort=function(){r.aborted=!0,s.forEach(function(c){return c()})}},b3=e.unstable_scheduleCallback,y3=e.unstable_NormalPriority,bn={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lp(){return{controller:new v3,data:new Map,refCount:0}}function oc(s){s.refCount--,s.refCount===0&&b3(y3,function(){s.controller.abort()})}function u1(s,r){if((s.pendingLanes&4194048)!==0){var c=s.transitionTypes;for(c===null&&(c=s.transitionTypes=[]),s=0;s<r.length;s++){var d=r[s];c.indexOf(d)===-1&&c.push(d)}}}var cc=null;function _3(s){var r=s.transitionTypes;return s.transitionTypes=null,r}var uc=null,op=0,za=0,El=null;function w3(s,r){if(uc===null){var c=uc=[];op=0,za=km(),El={status:"pending",value:void 0,then:function(d){c.push(d)}}}return op++,r.then(d1,d1),r}function d1(){if(--op===0&&(cc=null,uc!==null)){El!==null&&(El.status="fulfilled");var s=uc;uc=null,za=0,El=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function S3(s,r){var c=[],d={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return s.then(function(){d.status="fulfilled",d.value=r;for(var m=0;m<c.length;m++)(0,c[m])(r)},function(m){for(d.status="rejected",d.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),d}var h1=Te.S;Te.S=function(s,r){if(iy=Ut(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&w3(s,r),cc!==null)for(var c=Gl;c!==null;)u1(c,cc),c=c.next;if(c=s.types,c!==null){for(var d=Gl;d!==null;)u1(d,c),d=d.next;if(za!==0){d=cc,d===null&&(d=cc=[]);for(var m=0;m<c.length;m++){var x=c[m];d.indexOf(x)===-1&&d.push(x)}}}h1!==null&&h1(s,r)};var $a=St(null);function cp(){var s=$a.current;return s!==null?s:Lt.pooledCache}function od(s,r){r===null?We($a,$a.current):We($a,r.pool)}function f1(){var s=cp();return s===null?null:{parent:bn._currentValue,pool:s}}var Tl=Error(i(460)),up=Error(i(474)),cd=Error(i(542)),ud={then:function(){}};function p1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function m1(s,r,c){switch(c=s[c],c===void 0?s.push(r):c!==r&&(r.then(ts,ts),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,x1(s),s===void 0&&!("reason"in r)?Error(i(600)):s;default:if(typeof r.status=="string")r.then(ts,ts);else{if(s=Lt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=r,s.status="pending",s.then(function(d){if(r.status==="pending"){var m=r;m.status="fulfilled",m.value=d}},function(d){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=d}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,x1(s),s}throw Ba=r,Tl}}function Pa(s){try{var r=s._init;return r(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ba=c,Tl):c}}var Ba=null;function g1(){if(Ba===null)throw Error(i(459));var s=Ba;return Ba=null,s}function x1(s){if(s===Tl||s===cd)throw Error(i(483))}var Ml=null,dc=0;function dd(s){var r=dc;return dc+=1,Ml===null&&(Ml=[]),m1(Ml,s,r)}function zr(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function hd(s,r){throw r.$$typeof===z?Error(i(525)):(s=Object.prototype.toString.call(r),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function v1(s){function r(J,Y){if(s){var ne=J.deletions;ne===null?(J.deletions=[Y],J.flags|=16):ne.push(Y)}}function c(J,Y){if(!s)return null;for(;Y!==null;)r(J,Y),Y=Y.sibling;return null}function d(J){for(var Y=new Map;J!==null;)J.key===null?Y.set(J.index,J):Y.set(J.key,J),J=J.sibling;return Y}function m(J,Y){return J=er(J,Y),J.index=0,J.sibling=null,J}function x(J,Y,ne){return J.index=ne,s?(ne=J.alternate,ne!==null?(ne=ne.index,ne<Y?(J.flags|=2,Y):ne):(J.flags|=134217730,Y)):(J.flags|=1048576,Y)}function w(J){return s&&J.alternate===null&&(J.flags|=134217730),J}function M(J,Y,ne,he){return Y===null||Y.tag!==6?(Y=ep(ne,J.mode,he),Y.return=J,Y):(Y=m(Y,ne),Y.return=J,Y)}function F(J,Y,ne,he){var Le=ne.type;return Le===q?(J=le(J,Y,ne.props.children,he,ne.key),zr(J,ne),J):Y!==null&&(Y.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&Pa(Le)===Y.type)?(Y=m(Y,ne.props),zr(Y,ne),Y.return=J,Y):(Y=td(ne.type,ne.key,ne.props,null,J.mode,he),zr(Y,ne),Y.return=J,Y)}function ee(J,Y,ne,he){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ne.containerInfo||Y.stateNode.implementation!==ne.implementation?(Y=tp(ne,J.mode,he),Y.return=J,Y):(Y=m(Y,ne.children||[]),Y.return=J,Y)}function le(J,Y,ne,he,Le){return Y===null||Y.tag!==7?(Y=Aa(ne,J.mode,he,Le),Y.return=J,Y):(Y=m(Y,ne),Y.return=J,Y)}function pe(J,Y,ne){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=ep(""+Y,J.mode,ne),Y.return=J,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case Z:return ne=td(Y.type,Y.key,Y.props,null,J.mode,ne),zr(ne,Y),ne.return=J,ne;case I:return Y=tp(Y,J.mode,ne),Y.return=J,Y;case T:return Y=Pa(Y),pe(J,Y,ne)}if(Oe(Y)||je(Y))return Y=Aa(Y,J.mode,ne,null),Y.return=J,Y;if(typeof Y.then=="function")return pe(J,dd(Y),ne);if(Y.$$typeof===V)return pe(J,ld(J,Y),ne);hd(J,Y)}return null}function K(J,Y,ne,he){var Le=Y!==null?Y.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Le!==null?null:M(J,Y,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case Z:return ne.key===Le?F(J,Y,ne,he):null;case I:return ne.key===Le?ee(J,Y,ne,he):null;case T:return ne=Pa(ne),K(J,Y,ne,he)}if(Oe(ne)||je(ne))return Le!==null?null:le(J,Y,ne,he,null);if(typeof ne.then=="function")return K(J,Y,dd(ne),he);if(ne.$$typeof===V)return K(J,Y,ld(J,ne),he);hd(J,ne)}return null}function re(J,Y,ne,he,Le){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return J=J.get(ne)||null,M(Y,J,""+he,Le);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case Z:return J=J.get(he.key===null?ne:he.key)||null,F(Y,J,he,Le);case I:return J=J.get(he.key===null?ne:he.key)||null,ee(Y,J,he,Le);case T:return he=Pa(he),re(J,Y,ne,he,Le)}if(Oe(he)||je(he))return J=J.get(ne)||null,le(Y,J,he,Le,null);if(typeof he.then=="function")return re(J,Y,ne,dd(he),Le);if(he.$$typeof===V)return re(J,Y,ne,ld(Y,he),Le);hd(Y,he)}return null}function Me(J,Y,ne,he){for(var Le=null,ft=null,He=Y,Xe=Y=0,wn=null;He!==null&&Xe<ne.length;Xe++){He.index>Xe?(wn=He,He=null):wn=He.sibling;var bt=K(J,He,ne[Xe],he);if(bt===null){He===null&&(He=wn);break}s&&He&&bt.alternate===null&&r(J,He),Y=x(bt,Y,Xe),ft===null?Le=bt:ft.sibling=bt,ft=bt,He=wn}if(Xe===ne.length)return c(J,He),lt&&tr(J,Xe),Le;if(He===null){for(;Xe<ne.length;Xe++)He=pe(J,ne[Xe],he),He!==null&&(Y=x(He,Y,Xe),ft===null?Le=He:ft.sibling=He,ft=He);return lt&&tr(J,Xe),Le}for(He=d(He);Xe<ne.length;Xe++)wn=re(He,J,Xe,ne[Xe],he),wn!==null&&(s&&(bt=wn.alternate,bt!==null&&He.delete(bt.key===null?Xe:bt.key)),Y=x(wn,Y,Xe),ft===null?Le=wn:ft.sibling=wn,ft=wn);return s&&He.forEach(function(ta){return r(J,ta)}),lt&&tr(J,Xe),Le}function Pe(J,Y,ne,he){if(ne==null)throw Error(i(151));for(var Le=null,ft=null,He=Y,Xe=Y=0,wn=null,bt=ne.next();He!==null&&!bt.done;Xe++,bt=ne.next()){He.index>Xe?(wn=He,He=null):wn=He.sibling;var ta=K(J,He,bt.value,he);if(ta===null){He===null&&(He=wn);break}s&&He&&ta.alternate===null&&r(J,He),Y=x(ta,Y,Xe),ft===null?Le=ta:ft.sibling=ta,ft=ta,He=wn}if(bt.done)return c(J,He),lt&&tr(J,Xe),Le;if(He===null){for(;!bt.done;Xe++,bt=ne.next())bt=pe(J,bt.value,he),bt!==null&&(Y=x(bt,Y,Xe),ft===null?Le=bt:ft.sibling=bt,ft=bt);return lt&&tr(J,Xe),Le}for(He=d(He);!bt.done;Xe++,bt=ne.next())bt=re(He,J,Xe,bt.value,he),bt!==null&&(s&&(wn=bt.alternate,wn!==null&&He.delete(wn.key===null?Xe:wn.key)),Y=x(bt,Y,Xe),ft===null?Le=bt:ft.sibling=bt,ft=bt);return s&&He.forEach(function(s4){return r(J,s4)}),lt&&tr(J,Xe),Le}function rt(J,Y,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===q&&ne.key===null&&ne.props.ref===void 0&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case Z:e:{for(var Le=ne.key;Y!==null;){if(Y.key===Le){if(Le=ne.type,Le===q){if(Y.tag===7){c(J,Y.sibling),he=m(Y,ne.props.children),zr(he,ne),he.return=J,J=he;break e}}else if(Y.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&Pa(Le)===Y.type){c(J,Y.sibling),he=m(Y,ne.props),zr(he,ne),he.return=J,J=he;break e}c(J,Y);break}else r(J,Y);Y=Y.sibling}ne.type===q?(he=Aa(ne.props.children,J.mode,he,ne.key),zr(he,ne),he.return=J,J=he):(he=td(ne.type,ne.key,ne.props,null,J.mode,he),zr(he,ne),he.return=J,J=he)}return w(J);case I:e:{for(Le=ne.key;Y!==null;){if(Y.key===Le)if(Y.tag===4&&Y.stateNode.containerInfo===ne.containerInfo&&Y.stateNode.implementation===ne.implementation){c(J,Y.sibling),he=m(Y,ne.children||[]),he.return=J,J=he;break e}else{c(J,Y);break}else r(J,Y);Y=Y.sibling}he=tp(ne,J.mode,he),he.return=J,J=he}return w(J);case T:return ne=Pa(ne),rt(J,Y,ne,he)}if(Oe(ne))return Me(J,Y,ne,he);if(je(ne)){if(Le=je(ne),typeof Le!="function")throw Error(i(150));return ne=Le.call(ne),Pe(J,Y,ne,he)}if(typeof ne.then=="function")return rt(J,Y,dd(ne),he);if(ne.$$typeof===V)return rt(J,Y,ld(J,ne),he);hd(J,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Y!==null&&Y.tag===6?(c(J,Y.sibling),he=m(Y,ne),he.return=J,J=he):(c(J,Y),he=ep(ne,J.mode,he),he.return=J,J=he),w(J)):c(J,Y)}return function(J,Y,ne,he){try{dc=0;var Le=rt(J,Y,ne,he);return Ml=null,Le}catch(He){if(He===Tl||He===cd)throw He;var ft=ps(29,He,null,J.mode);return ft.lanes=he,ft.return=J,ft}finally{}}}var Fa=v1(!0),b1=v1(!1),$r=!1;function dp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hp(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Pr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Br(s,r,c){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(Nt&2)!==0){var m=d.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),d.pending=r,r=ed(s),n1(s,null,c),r}return Ju(s,d,r,c),ed(s)}function hc(s,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Fo(s,c)}}function fp(s,r){var c=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var m=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,c=c.next}while(c!==null);x===null?m=x=r:x=x.next=r}else m=x=r;c={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=r:s.next=r,c.lastBaseUpdate=r}var pp=!1;function fc(){if(pp){var s=El;if(s!==null)throw s}}function pc(s,r,c,d){pp=!1;var m=s.updateQueue;$r=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,M=m.shared.pending;if(M!==null){m.shared.pending=null;var F=M,ee=F.next;F.next=null,w===null?x=ee:w.next=ee,w=F;var le=s.alternate;le!==null&&(le=le.updateQueue,M=le.lastBaseUpdate,M!==w&&(M===null?le.firstBaseUpdate=ee:M.next=ee,le.lastBaseUpdate=F))}if(x!==null){var pe=m.baseState;w=0,le=ee=F=null,M=x;do{var K=M.lane&-536870913,re=K!==M.lane;if(re?(ht&K)===K:(d&K)===K){K!==0&&K===za&&(pp=!0),le!==null&&(le=le.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Me=s,Pe=M;K=r;var rt=c;switch(Pe.tag){case 1:if(Me=Pe.payload,typeof Me=="function"){pe=Me.call(rt,pe,K);break e}pe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Pe.payload,K=typeof Me=="function"?Me.call(rt,pe,K):Me,K==null)break e;pe=P({},pe,K);break e;case 2:$r=!0}}K=M.callback,K!==null&&(s.flags|=64,re&&(s.flags|=8192),re=m.callbacks,re===null?m.callbacks=[K]:re.push(K))}else re={lane:K,tag:M.tag,payload:M.payload,callback:M.callback,next:null},le===null?(ee=le=re,F=pe):le=le.next=re,w|=K;if(M=M.next,M===null){if(M=m.shared.pending,M===null)break;re=M,M=re.next,re.next=null,m.lastBaseUpdate=re,m.shared.pending=null}}while(!0);le===null&&(F=pe),m.baseState=F,m.firstBaseUpdate=ee,m.lastBaseUpdate=le,x===null&&(m.shared.lanes=0),Gr|=w,s.lanes=w,s.memoizedState=pe}}function y1(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function _1(s,r){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)y1(c[s],r)}var Fr=St(null),fd=St(0);function w1(s,r){s=or,We(fd,s),We(Fr,r),or=s|r.baseLanes}function mp(){We(fd,or),We(Fr,Fr.current)}function gp(){or=fd.current,wt(Fr),wt(fd)}var Bn=St(null),Gn=null;function Ir(s){var r=s.alternate;We(Fn,Fn.current&1),We(Bn,s),Gn===null&&(r===null||Fr.current!==null||r.memoizedState!==null)&&(Gn=s)}function xp(s){We(Fn,Fn.current),We(Bn,s),Gn===null&&(Gn=s)}function S1(s){s.tag===22?(We(Fn,Fn.current),We(Bn,s),Gn===null&&(Gn=s)):Ur()}function Ur(){We(Fn,Fn.current),We(Bn,Bn.current)}function As(s){wt(Bn),Gn===s&&(Gn=null),wt(Fn)}var Fn=St(0);function mc(s,r){We(Bn,Bn.current),We(Fn,r)}function vp(s){wt(Fn),wt(Bn),Gn===s&&(Gn=null)}function pd(s){for(var r=s;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Fm(c)||Im(c)))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!=="independent"){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var ir=0,it=null,Rt=null,yn=null,md=!1,Al=!1,Ia=!1,gd=0,gc=0,Rl=null,k3=0;function un(){throw Error(i(321))}function bp(s,r){if(r===null)return!1;for(var c=0;c<r.length&&c<s.length;c++)if(!Ms(s[c],r[c]))return!1;return!0}function yp(s,r,c,d,m,x){return ir=x,it=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Te.H=s===null||s.memoizedState===null?ab:lb,Ia=!1,x=c(d,m),Ia=!1,Al&&(x=j1(r,c,d,m)),k1(s),x}function k1(s){Te.H=Sd;var r=Rt!==null&&Rt.next!==null;if(ir=0,yn=Rt=it=null,md=!1,gc=0,Rl=null,r)throw Error(i(300));s===null||_n||(s=s.dependencies,s!==null&&ad(s)&&(_n=!0))}function j1(s,r,c,d){it=s;var m=0;do{if(Al&&(Rl=null),gc=0,Al=!1,25<=m)throw Error(i(301));if(m+=1,yn=Rt=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}Te.H=R3,x=r(c,d)}while(Al);return x}function j3(){var s=Te.H,r=s.useState()[0];return r=typeof r.then=="function"?xc(r):r,s=s.useState()[0],(Rt!==null?Rt.memoizedState:null)!==s&&(it.flags|=1024),r}function _p(){var s=gd!==0;return gd=0,s}function wp(s,r,c){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~c}function Sp(s){if(md){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}md=!1}ir=0,yn=Rt=it=null,Al=!1,gc=gd=0,Rl=null}function ss(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yn===null?it.memoizedState=yn=s:yn=yn.next=s,yn}function gn(){if(Rt===null){var s=it.alternate;s=s!==null?s.memoizedState:null}else s=Rt.next;var r=yn===null?it.memoizedState:yn.next;if(r!==null)yn=r,Rt=s;else{if(s===null)throw it.alternate===null?Error(i(467)):Error(i(310));Rt=s,s={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},yn===null?it.memoizedState=yn=s:yn=yn.next=s}return yn}function xd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xc(s){var r=gc;return gc+=1,Rl===null&&(Rl=[]),s=m1(Rl,s,r),r=it,(yn===null?r.memoizedState:yn.next)===null&&(r=r.alternate,Te.H=r===null||r.memoizedState===null?ab:lb),s}function vd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return xc(s);if(s.$$typeof===oe)return;if(s.$$typeof===V)return Pn(s)}throw Error(i(438,String(s)))}function kp(s){var r=null,c=it.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var d=it.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(r={data:d.data.map(function(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=xd(),it.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(s),d=0;d<s;d++)c[d]=$;return r.index++,c}function rr(s,r){return typeof r=="function"?r(s):r}function bd(s){var r=gn();return jp(r,Rt,s)}function jp(s,r,c){var d=s.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var m=s.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}r.baseQueue=m=x,d.pending=null}if(x=s.baseState,m===null)s.memoizedState=x;else{r=m.next;var M=w=null,F=null,ee=r,le=!1;do{var pe=ee.lane&-536870913;if(pe!==ee.lane?(ht&pe)===pe:(ir&pe)===pe){var K=ee.revertLane;if(K===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),pe===za&&(le=!0);else if((ir&K)===K){ee=ee.next,K===za&&(le=!0);continue}else pe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(M=F=pe,w=x):F=F.next=pe,it.lanes|=K,Gr|=K;pe=ee.action,Ia&&c(x,pe),x=ee.hasEagerState?ee.eagerState:c(x,pe)}else K={lane:pe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(M=F=K,w=x):F=F.next=K,it.lanes|=pe,Gr|=pe;ee=ee.next}while(ee!==null&&ee!==r);if(F===null?w=x:F.next=M,!Ms(x,s.memoizedState)&&(_n=!0,le&&(c=El,c!==null)))throw c;s.memoizedState=x,s.baseState=w,s.baseQueue=F,d.lastRenderedState=x}return m===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Np(s){var r=gn(),c=r.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var d=c.dispatch,m=c.pending,x=r.memoizedState;if(m!==null){c.pending=null;var w=m=m.next;do x=s(x,w.action),w=w.next;while(w!==m);Ms(x,r.memoizedState)||(_n=!0),r.memoizedState=x,r.baseQueue===null&&(r.baseState=x),c.lastRenderedState=x}return[x,d]}function N1(s,r,c){var d=it,m=gn(),x=lt;if(x){if(c===void 0)throw Error(i(407));c=c()}else c=r();var w=!Ms((Rt||m).memoizedState,c);if(w&&(m.memoizedState=c,_n=!0),m=m.queue,Tp(T1.bind(null,d,m,s),[s]),s=m.getSnapshot!==r||w||yn!==null&&(yn.memoizedState.tag&1)!==0,Ol(s?9:8,{destroy:void 0},E1.bind(null,d,m,c,r),null),s){if(d.flags|=2048,Lt===null)throw Error(i(349));x||(ir&127)!==0||C1(d,r,c)}return c}function C1(s,r,c){s.flags|=16384,s={getSnapshot:r,value:c},r=it.updateQueue,r===null?(r=xd(),it.updateQueue=r,r.stores=[s]):(c=r.stores,c===null?r.stores=[s]:c.push(s))}function E1(s,r,c,d){r.value=c,r.getSnapshot=d,M1(r)&&A1(s)}function T1(s,r,c){return c(function(){M1(r)&&A1(s)})}function M1(s){var r=s.getSnapshot;s=s.value;try{var c=r();return!Ms(s,c)}catch{return!0}}function A1(s){var r=Ma(s,2);r!==null&&vs(r,s,2)}function Cp(s){var r=ss();if(typeof s=="function"){var c=s;if(s=c(),Ia){Vn(!0);try{c()}finally{Vn(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:s},r}function R1(s,r,c,d){return s.baseState=c,jp(s,Rt,typeof d=="function"?d:rr)}function N3(s,r,c,d,m){if(wd(s))throw Error(i(485));if(s=r.action,s!==null){var x={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};Te.T!==null?c(!0):x.isTransition=!1,d(x),c=r.pending,c===null?(x.next=r.pending=x,O1(r,x)):(x.next=c.next,r.pending=c.next=x)}}function O1(s,r){var c=r.action,d=r.payload,m=s.state;if(r.isTransition){var x=Te.T,w={};w.types=x!==null?x.types:null,Te.T=w;try{var M=c(m,d),F=Te.S;F!==null&&F(w,M),L1(s,r,M)}catch(ee){Ep(s,r,ee)}finally{x!==null&&w.types!==null&&(x.types=w.types),Te.T=x}}else try{x=c(m,d),L1(s,r,x)}catch(ee){Ep(s,r,ee)}}function L1(s,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){D1(s,r,d)},function(d){return Ep(s,r,d)}):D1(s,r,c)}function D1(s,r,c){r.status="fulfilled",r.value=c,z1(r),s.state=c,r=s.pending,r!==null&&(c=r.next,c===r?s.pending=null:(c=c.next,r.next=c,O1(s,c)))}function Ep(s,r,c){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do r.status="rejected",r.reason=c,z1(r),r=r.next;while(r!==d)}s.action=null}function z1(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function $1(s,r){return r}function P1(s,r){if(lt){var c=Lt.formState;if(c!==null){e:{var d=it;if(lt){if(Ht){t:{for(var m=Ht,x=Gs;m.nodeType!==8;){if(!x){m=null;break t}if(m=Xs(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Ht=Xs(m.nextSibling),d=m.data==="F!";break e}}Lr(d)}d=!1}d&&(r=c[0])}}return c=ss(),c.memoizedState=c.baseState=r,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$1,lastRenderedState:r},c.queue=d,c=sb.bind(null,it,d),d.dispatch=c,d=Cp(!1),x=Lp.bind(null,it,!1,d.queue),d=ss(),m={state:r,dispatch:null,action:s,pending:null},d.queue=m,c=N3.bind(null,it,m,x,c),m.dispatch=c,d.memoizedState=s,[r,c,!1]}function B1(s){var r=gn();return F1(r,Rt,s)}function F1(s,r,c){if(r=jp(s,r,$1)[0],s=bd(rr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var d=xc(r)}catch(w){throw w===Tl?cd:w}else d=r;r=gn();var m=r.queue,x=m.dispatch;return c!==r.memoizedState&&(it.flags|=2048,Ol(9,{destroy:void 0},C3.bind(null,m,c),null)),[d,x,s]}function C3(s,r){s.action=r}function I1(s){var r=gn(),c=Rt;if(c!==null)return F1(r,c,s);gn(),r=r.memoizedState,c=gn();var d=c.queue.dispatch;return c.memoizedState=s,[r,d,!1]}function Ol(s,r,c,d){return s={tag:s,create:c,deps:d,inst:r,next:null},r=it.updateQueue,r===null&&(r=xd(),it.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=s.next=s:(d=c.next,c.next=s,s.next=d,r.lastEffect=s),s}function U1(){return gn().memoizedState}function yd(s,r,c,d){var m=ss();it.flags|=s,m.memoizedState=Ol(1|r,{destroy:void 0},c,d===void 0?null:d)}function _d(s,r,c,d){var m=gn();d=d===void 0?null:d;var x=m.memoizedState.inst;Rt!==null&&d!==null&&bp(d,Rt.memoizedState.deps)?m.memoizedState=Ol(r,x,c,d):(it.flags|=s,m.memoizedState=Ol(1|r,x,c,d))}function H1(s,r){yd(8390656,8,s,r)}function Tp(s,r){_d(2048,8,s,r)}function E3(s){it.flags|=4;var r=it.updateQueue;if(r===null)r=xd(),it.updateQueue=r,r.events=[s];else{var c=r.events;c===null?r.events=[s]:c.push(s)}}function q1(s){var r=gn().memoizedState;return E3({ref:r,nextImpl:s}),function(){if((Nt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function V1(s,r){return _d(4,2,s,r)}function G1(s,r){return _d(4,4,s,r)}function Y1(s,r){if(typeof r=="function"){s=s();var c=r(s);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function X1(s,r,c){c=c!=null?c.concat([s]):null,_d(4,4,Y1.bind(null,r,s),c)}function Mp(){}function Q1(s,r){var c=gn();r=r===void 0?null:r;var d=c.memoizedState;return r!==null&&bp(r,d[1])?d[0]:(c.memoizedState=[s,r],s)}function W1(s,r){var c=gn();r=r===void 0?null:r;var d=c.memoizedState;if(r!==null&&bp(r,d[1]))return d[0];if(d=s(),Ia){Vn(!0);try{s()}finally{Vn(!1)}}return c.memoizedState=[d,r],d}function Ap(s,r,c){return c===void 0||(ir&1073741824)!==0&&(ht&261930)===0?s.memoizedState=r:(s.memoizedState=c,s=ay(),it.lanes|=s,Gr|=s,c)}function Z1(s,r,c,d){return Ms(c,r)?c:Fr.current!==null?(s=Ap(s,c,d),Ms(s,r)||(_n=!0),s):(ir&106)===0||(ir&1073741824)!==0&&(ht&261930)===0?(_n=!0,s.memoizedState=c):(s=ay(),it.lanes|=s,Gr|=s,r)}function K1(s,r,c,d,m){var x=Re.p;Re.p=x!==0&&8>x?x:8;var w=Te.T,M={};M.types=w!==null?w.types:null,Te.T=M,Lp(s,!1,r,c);try{var F=m(),ee=Te.S;if(ee!==null&&ee(M,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var le=S3(F,d);vc(s,r,le,Ds(s))}else vc(s,r,d,Ds(s))}catch(pe){vc(s,r,{then:function(){},status:"rejected",reason:pe},Ds())}finally{Re.p=x,w!==null&&M.types!==null&&(w.types=M.types),Te.T=w}}function T3(){}function Rp(s,r,c,d){if(s.tag!==5)throw Error(i(476));var m=J1(s).queue;K1(s,m,r,Ft,c===null?T3:function(){return eb(s),c(d)})}function J1(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:Ft,baseState:Ft,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:Ft},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:c},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function eb(s){var r=J1(s);r.next===null&&(r=s.alternate.memoizedState),vc(s,r.next.queue,{},Ds())}function Op(){return Pn(Kl)}function tb(){return gn().memoizedState}function nb(){return gn().memoizedState}function M3(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var c=Ds();s=Pr(c);var d=Br(r,s,c);d!==null&&(vs(d,r,c),hc(d,r,c)),r={cache:lp()},s.payload=r;return}r=r.return}}function A3(s,r,c){var d=Ds();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},wd(s)?ib(r,c):(c=Kf(s,r,c,d),c!==null&&(vs(c,s,d),rb(c,r,d)))}function sb(s,r,c){var d=Ds();vc(s,r,c,d)}function vc(s,r,c,d){var m={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(wd(s))ib(r,m);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var w=r.lastRenderedState,M=x(w,c);if(m.hasEagerState=!0,m.eagerState=M,Ms(M,w))return Ju(s,r,m,0),Lt===null&&Ku(),!1}catch{}finally{}if(c=Kf(s,r,m,d),c!==null)return vs(c,s,d),rb(c,r,d),!0}return!1}function Lp(s,r,c,d){if(d={lane:2,revertLane:km(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},wd(s)){if(r)throw Error(i(479))}else r=Kf(s,c,d,2),r!==null&&vs(r,s,2)}function wd(s){var r=s.alternate;return s===it||r!==null&&r===it}function ib(s,r){Al=md=!0;var c=s.pending;c===null?r.next=r:(r.next=c.next,c.next=r),s.pending=r}function rb(s,r,c){if((c&4194048)!==0){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Fo(s,c)}}var Sd={readContext:Pn,use:vd,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useLayoutEffect:un,useInsertionEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useSyncExternalStore:un,useId:un,useHostTransitionStatus:un,useFormState:un,useActionState:un,useOptimistic:un,useMemoCache:un,useCacheRefresh:un,useEffectEvent:un},ab={readContext:Pn,use:vd,useCallback:function(s,r){return ss().memoizedState=[s,r===void 0?null:r],s},useContext:Pn,useEffect:H1,useImperativeHandle:function(s,r,c){c=c!=null?c.concat([s]):null,yd(4194308,4,Y1.bind(null,r,s),c)},useLayoutEffect:function(s,r){return yd(4194308,4,s,r)},useInsertionEffect:function(s,r){yd(4,2,s,r)},useMemo:function(s,r){var c=ss();r=r===void 0?null:r;var d=s();if(Ia){Vn(!0);try{s()}finally{Vn(!1)}}return c.memoizedState=[d,r],d},useReducer:function(s,r,c){var d=ss();if(c!==void 0){var m=c(r);if(Ia){Vn(!0);try{c(r)}finally{Vn(!1)}}}else m=r;return d.memoizedState=d.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},d.queue=s,s=s.dispatch=A3.bind(null,it,s),[d.memoizedState,s]},useRef:function(s){var r=ss();return s={current:s},r.memoizedState=s},useState:function(s){s=Cp(s);var r=s.queue,c=sb.bind(null,it,r);return r.dispatch=c,[s.memoizedState,c]},useDebugValue:Mp,useDeferredValue:function(s,r){var c=ss();return Ap(c,s,r)},useTransition:function(){var s=Cp(!1);return s=K1.bind(null,it,s.queue,!0,!1),ss().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,c){var d=it,m=ss();if(lt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=r(),Lt===null)throw Error(i(349));(ht&127)!==0||C1(d,r,c)}m.memoizedState=c;var x={value:c,getSnapshot:r};return m.queue=x,H1(T1.bind(null,d,x,s),[s]),d.flags|=2048,Ol(9,{destroy:void 0},E1.bind(null,d,x,c,r),null),c},useId:function(){var s=ss(),r=Lt.identifierPrefix;if(lt){var c=Ei,d=Ci;c=(d&~(1<<32-tn(d)-1)).toString(32)+c,r="_"+r+"R_"+c,c=gd++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=k3++,r="_"+r+"r_"+c.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Op,useFormState:P1,useActionState:P1,useOptimistic:function(s){var r=ss();r.memoizedState=r.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=Lp.bind(null,it,!0,c),c.dispatch=r,[s,r]},useMemoCache:kp,useCacheRefresh:function(){return ss().memoizedState=M3.bind(null,it)},useEffectEvent:function(s){var r=ss(),c={impl:s};return r.memoizedState=c,function(){if((Nt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},lb={readContext:Pn,use:vd,useCallback:Q1,useContext:Pn,useEffect:Tp,useImperativeHandle:X1,useInsertionEffect:V1,useLayoutEffect:G1,useMemo:W1,useReducer:bd,useRef:U1,useState:function(){return bd(rr)},useDebugValue:Mp,useDeferredValue:function(s,r){var c=gn();return Z1(c,Rt.memoizedState,s,r)},useTransition:function(){var s=bd(rr)[0],r=gn().memoizedState;return[typeof s=="boolean"?s:xc(s),r]},useSyncExternalStore:N1,useId:tb,useHostTransitionStatus:Op,useFormState:B1,useActionState:B1,useOptimistic:function(s,r){var c=gn();return R1(c,Rt,s,r)},useMemoCache:kp,useCacheRefresh:nb,useEffectEvent:q1},R3={readContext:Pn,use:vd,useCallback:Q1,useContext:Pn,useEffect:Tp,useImperativeHandle:X1,useInsertionEffect:V1,useLayoutEffect:G1,useMemo:W1,useReducer:Np,useRef:U1,useState:function(){return Np(rr)},useDebugValue:Mp,useDeferredValue:function(s,r){var c=gn();return Rt===null?Ap(c,s,r):Z1(c,Rt.memoizedState,s,r)},useTransition:function(){var s=Np(rr)[0],r=gn().memoizedState;return[typeof s=="boolean"?s:xc(s),r]},useSyncExternalStore:N1,useId:tb,useHostTransitionStatus:Op,useFormState:I1,useActionState:I1,useOptimistic:function(s,r){var c=gn();return Rt!==null?R1(c,Rt,s,r):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:kp,useCacheRefresh:nb,useEffectEvent:q1};function Dp(s,r,c,d){r=s.memoizedState,c=c(d,r),c=c==null?r:P({},r,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var zp={enqueueSetState:function(s,r,c){s=s._reactInternals;var d=Ds(),m=Pr(d);m.payload=r,c!=null&&(m.callback=c),r=Br(s,m,d),r!==null&&(vs(r,s,d),hc(r,s,d))},enqueueReplaceState:function(s,r,c){s=s._reactInternals;var d=Ds(),m=Pr(d);m.tag=1,m.payload=r,c!=null&&(m.callback=c),r=Br(s,m,d),r!==null&&(vs(r,s,d),hc(r,s,d))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var c=Ds(),d=Pr(c);d.tag=2,r!=null&&(d.callback=r),r=Br(s,d,c),r!==null&&(vs(r,s,c),hc(r,s,c))}};function ob(s,r,c,d,m,x,w){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,x,w):r.prototype&&r.prototype.isPureReactComponent?!ic(c,d)||!ic(m,x):!0}function cb(s,r,c,d){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,d),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,d),r.state!==s&&zp.enqueueReplaceState(r,r.state,null)}function Ua(s,r){var c=r;if("ref"in r){c={};for(var d in r)d!=="ref"&&(c[d]=r[d])}if(s=s.defaultProps){c===r&&(c=P({},c));for(var m in s)c[m]===void 0&&(c[m]=s[m])}return c}function ub(s){Zu(s)}function db(s){console.error(s)}function hb(s){Zu(s)}function kd(s,r){try{var c=s.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(d){setTimeout(function(){throw d})}}function fb(s,r,c){try{var d=s.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function $p(s,r,c){return c=Pr(c),c.tag=3,c.payload={element:null},c.callback=function(){kd(s,r)},c}function pb(s){return s=Pr(s),s.tag=3,s}function mb(s,r,c,d){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;s.payload=function(){return m(x)},s.callback=function(){fb(r,c,d)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(s.callback=function(){fb(r,c,d),typeof m!="function"&&(Yr===null?Yr=new Set([this]):Yr.add(this));var M=d.stack;this.componentDidCatch(d.value,{componentStack:M!==null?M:""})})}function O3(s,r,c,d,m){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(r=c.alternate,r!==null&&La(r,c,m,!0),c=Bn.current,c!==null){switch(c.tag){case 31:case 13:case 19:return Gn===null?Vd():c.alternate===null&&dn===0&&(dn=3),c.flags&=-257,c.flags|=65536,c.lanes=m,d===ud?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([d]):r.add(d),_m(s,d,m)),!1;case 22:return c.flags|=65536,d===ud?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([d]):c.add(d)),_m(s,d,m)),!1}throw Error(i(435,c.tag))}return _m(s,d,m),Vd(),!1}if(lt)return r=Bn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,d!==sp&&(s=Error(i(422),{cause:d}),lc(Hs(s,c)))):(d!==sp&&(r=Error(i(423),{cause:d}),lc(Hs(r,c))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,d=Hs(d,c),m=$p(s.stateNode,d,m),fp(s,m),dn!==4&&(dn=2)),!1;var x=Error(i(520),{cause:d});if(x=Hs(x,c),Nc===null?Nc=[x]:Nc.push(x),dn!==4&&(dn=2),r===null)return!0;d=Hs(d,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,s=m&-m,c.lanes|=s,s=$p(c.stateNode,d,s),fp(c,s),!1;case 1:if(r=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Yr===null||!Yr.has(x))))return c.flags|=65536,m&=-m,c.lanes|=m,m=pb(m),mb(m,s,c,d),fp(c,m),!1;break;case 22:if(c.memoizedState!==null)return c.flags|=65536,!1}c=c.return}while(c!==null);return!1}var Pp=Error(i(461)),_n=!1;function Cn(s,r,c,d){r.child=s===null?b1(r,null,c,d):Fa(r,s.child,c,d)}function gb(s,r,c,d,m){c=c.render;var x=r.ref;if("ref"in d){var w={};for(var M in d)M!=="ref"&&(w[M]=d[M])}else w=d;return Da(r),d=yp(s,r,c,w,x,m),M=_p(),s!==null&&!_n?(wp(s,r,m),ar(s,r,m)):(lt&&M&&sd(r),r.flags|=1,Cn(s,r,d,m),r.child)}function xb(s,r,c,d,m){if(s===null){var x=c.type;return typeof x=="function"&&!Jf(x)&&x.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=x,vb(s,r,x,d,m)):(s=td(c.type,null,d,r,r.mode,m),s.ref=r.ref,s.return=r,r.child=s)}if(x=s.child,!Gp(s,m)){var w=x.memoizedProps;if(c=c.compare,c=c!==null?c:ic,c(w,d)&&s.ref===r.ref)return ar(s,r,m)}return r.flags|=1,s=er(x,d),s.ref=r.ref,s.return=r,r.child=s}function vb(s,r,c,d,m){if(s!==null){var x=s.memoizedProps;if(ic(x,d)&&s.ref===r.ref)if(_n=!1,r.pendingProps=d=x,Gp(s,m))(s.flags&131072)!==0&&(_n=!0);else return r.lanes=s.lanes,ar(s,r,m)}return Bp(s,r,c,d,m)}function bb(s,r,c,d){var m=d.children,x=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((r.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,s!==null){for(d=r.child=s.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,r.child=null;return yb(s,r,x,c,d)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&od(r,x!==null?x.cachePool:null),x!==null?w1(r,x):mp(),S1(r);else return d=r.lanes=536870912,yb(s,r,x!==null?x.baseLanes|c:c,c,d)}else x!==null?(od(r,x.cachePool),w1(r,x),Ur(),r.memoizedState=null):(s!==null&&od(r,null),mp(),Ur());return Cn(s,r,m,c),r.child}function bc(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function yb(s,r,c,d,m){var x=cp();return x=x===null?null:{parent:bn._currentValue,pool:x},r.memoizedState={baseLanes:c,cachePool:x},s!==null&&od(r,null),mp(),S1(r),s!==null&&La(s,r,d,!0),r.childLanes=m,null}function jd(s,r){return r=Nd({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function _b(s,r,c){return Fa(r,s.child,null,c),s=jd(r,r.pendingProps),s.flags|=2,As(r),r.memoizedState=null,s}function L3(s,r,c){var d=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(lt){if(d.mode==="hidden")return s=jd(r,d),r.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},bc(null,s);if(xp(r),(s=Ht)?(s=Yy(s,Gs),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Rr!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},c=i1(s),c.return=r,r.child=c,Mn=r,Ht=null)):s=null,s===null)throw Lr(r);return r.lanes=536870912,null}return jd(r,d)}var x=s.memoizedState;if(x!==null){var w=x.dehydrated;if(xp(r),m)if(r.flags&256)r.flags&=-257,r=_b(s,r,c);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(_n||La(s,r,c,!1),m=(c&s.childLanes)!==0,_n||m){if(Fr.current===null){if(d=Lt,d!==null&&(w=ki(d,c),w!==0&&w!==x.retryLane))throw x.retryLane=w,Ma(s,w),vs(d,s,w),Pp;Vd()}r=_b(s,r,c)}else s=x.treeContext,Ht=Xs(w.nextSibling),Mn=r,lt=!0,Or=null,Gs=!1,s!==null&&l1(r,s),r=jd(r,d),r.flags|=134221824;return r}return s=er(s.child,{mode:d.mode,children:d.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Ll(s,r){var c=r.ref;if(c===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(r.flags|=4194816)}}function Bp(s,r,c,d,m){return Da(r),c=yp(s,r,c,d,void 0,m),d=_p(),s!==null&&!_n?(wp(s,r,m),ar(s,r,m)):(lt&&d&&sd(r),r.flags|=1,Cn(s,r,c,m),r.child)}function wb(s,r,c,d,m,x){return Da(r),r.updateQueue=null,c=j1(r,d,c,m),k1(s),d=_p(),s!==null&&!_n?(wp(s,r,x),ar(s,r,x)):(lt&&d&&sd(r),r.flags|=1,Cn(s,r,c,x),r.child)}function Sb(s,r,c,d,m){if(Da(r),r.stateNode===null){var x=kl,w=c.contextType;typeof w=="object"&&w!==null&&(x=Pn(w)),x=new c(d,x),r.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=zp,r.stateNode=x,x._reactInternals=r,x=r.stateNode,x.props=d,x.state=r.memoizedState,x.refs={},dp(r),w=c.contextType,x.context=typeof w=="object"&&w!==null?Pn(w):kl,x.state=r.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(Dp(r,c,w,d),x.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&zp.enqueueReplaceState(x,x.state,null),pc(r,d,x,m),fc(),x.state=r.memoizedState),typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!0}else if(s===null){x=r.stateNode;var M=r.memoizedProps,F=Ua(c,M);x.props=F;var ee=x.context,le=c.contextType;w=kl,typeof le=="object"&&le!==null&&(w=Pn(le));var pe=c.getDerivedStateFromProps;le=typeof pe=="function"||typeof x.getSnapshotBeforeUpdate=="function",M=r.pendingProps!==M,le||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(M||ee!==w)&&cb(r,x,d,w),$r=!1;var K=r.memoizedState;x.state=K,pc(r,d,x,m),fc(),ee=r.memoizedState,M||K!==ee||$r?(typeof pe=="function"&&(Dp(r,c,pe,d),ee=r.memoizedState),(F=$r||ob(r,c,F,d,K,ee,w))?(le||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(r.flags|=4194308)):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=ee),x.props=d,x.state=ee,x.context=w,d=F):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{x=r.stateNode,hp(s,r),w=r.memoizedProps,le=Ua(c,w),x.props=le,pe=r.pendingProps,K=x.context,ee=c.contextType,F=kl,typeof ee=="object"&&ee!==null&&(F=Pn(ee)),M=c.getDerivedStateFromProps,(ee=typeof M=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==pe||K!==F)&&cb(r,x,d,F),$r=!1,K=r.memoizedState,x.state=K,pc(r,d,x,m),fc();var re=r.memoizedState;w!==pe||K!==re||$r||s!==null&&s.dependencies!==null&&ad(s.dependencies)?(typeof M=="function"&&(Dp(r,c,M,d),re=r.memoizedState),(le=$r||ob(r,c,le,d,K,re,F)||s!==null&&s.dependencies!==null&&ad(s.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,re,F),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,re,F)),typeof x.componentDidUpdate=="function"&&(r.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===s.memoizedProps&&K===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&K===s.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=re),x.props=d,x.state=re,x.context=F,d=le):(typeof x.componentDidUpdate!="function"||w===s.memoizedProps&&K===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&K===s.memoizedState||(r.flags|=1024),d=!1)}return x=d,Ll(s,r),d=(r.flags&128)!==0,x||d?(x=r.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:x.render(),r.flags|=1,s!==null&&d?(r.child=Fa(r,s.child,null,m),r.child=Fa(r,null,c,m)):Cn(s,r,c,m),r.memoizedState=x.state,s=r.child):s=ar(s,r,m),s}function kb(s,r,c,d){return Ra(),r.flags|=256,Cn(s,r,c,d),r.child}var Fp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ip(s){return{baseLanes:s,cachePool:f1()}}function Up(s,r,c){return s=s!==null?s.childLanes&~c:0,r&&(s|=Ls),s}function jb(s,r,c){var d=r.pendingProps,m=!1,x=(r.flags&128)!==0,w;if((w=x)||(w=s!==null&&s.memoizedState===null?!1:(Fn.current&2)!==0),w&&(m=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,s===null){if(lt){if(m?Ir(r):Ur(),(s=Ht)?(s=Yy(s,Gs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Rr!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},c=i1(s),c.return=r,r.child=c,Mn=r,Ht=null)):s=null,s===null)throw Lr(r);return Im(s)?r.lanes=32:r.lanes=536870912,null}return x=d.children,d=d.fallback,m?(Ur(),m=r.mode,x=Nd({mode:"hidden",children:x},m),d=Aa(d,m,c,null),x.return=r,d.return=r,x.sibling=d,r.child=x,d=r.child,d.memoizedState=Ip(c),d.childLanes=Up(s,w,c),r.memoizedState=Fp,bc(null,d)):(Ir(r),Hp(r,x))}var M=s.memoizedState;if(M!==null){var F=M.dehydrated;if(F!==null)return D3(s,r,x,w,d,F,M,c)}return m?(Ur(),m=d.fallback,x=r.mode,M=s.child,F=M.sibling,d=er(M,{mode:"hidden",children:d.children}),d.subtreeFlags=M.subtreeFlags&1206910976,F!==null?m=er(F,m):(m=Aa(m,x,c,null),m.flags|=2),m.return=r,d.return=r,d.sibling=m,r.child=d,bc(null,d),d=r.child,m=s.child.memoizedState,m===null?m=Ip(c):(x=m.cachePool,x!==null?(M=bn._currentValue,x=x.parent!==M?{parent:M,pool:M}:x):x=f1(),m={baseLanes:m.baseLanes|c,cachePool:x}),d.memoizedState=m,d.childLanes=Up(s,w,c),r.memoizedState=Fp,bc(s.child,d)):(Ir(r),c=s.child,s=c.sibling,c=er(c,{mode:"visible",children:d.children}),c.return=r,c.sibling=null,s!==null&&(w=r.deletions,w===null?(r.deletions=[s],r.flags|=16):w.push(s)),r.child=c,r.memoizedState=null,c)}function Hp(s,r){return r=Nd({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Nd(s,r){return s=ps(22,s,null,r),s.lanes=0,s}function Cd(s,r,c){return Fa(r,s.child,null,c),s=Hp(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function D3(s,r,c,d,m,x,w,M){if(c)return r.flags&256?(Ir(r),r.flags&=-257,Cd(s,r,M)):r.memoizedState!==null?(Ur(),r.child=s.child,r.flags|=128,null):(Ur(),x=m.fallback,w=r.mode,m=Nd({mode:"visible",children:m.children},w),x=Aa(x,w,M,null),x.flags|=2,m.return=r,x.return=r,m.sibling=x,r.child=m,Fa(r,s.child,null,M),m=r.child,m.memoizedState=Ip(M),m.childLanes=Up(s,d,M),r.memoizedState=Fp,bc(null,m));if(Ir(r),Im(x)){if(d=x.nextSibling&&x.nextSibling.dataset,d)var F=d.dgst;return d=F,d!==""&&(m=Error(i(419)),m.stack="",m.digest=d,lc({value:m,source:null,stack:null})),Cd(s,r,M)}if(_n||La(s,r,M,!1),d=(M&s.childLanes)!==0,_n||d){if(Fr.current!==null)return Cd(s,r,M);if(d=Lt,d!==null&&(m=ki(d,M),m!==0&&m!==w.retryLane))throw w.retryLane=m,Ma(s,m),vs(d,s,m),Pp;return Fm(x)||Vd(),Cd(s,r,M)}return Fm(x)?(r.flags|=192,r.child=s.child,null):(s=w.treeContext,Ht=Xs(x.nextSibling),Mn=r,lt=!0,Or=null,Gs=!1,s!==null&&l1(r,s),r=Hp(r,m.children),r.flags|=134221824,r)}function Nb(s,r,c){s.lanes|=r;var d=s.alternate;d!==null&&(d.lanes|=r),rd(s.return,r,c)}function Cb(s){for(var r=null;s!==null;){var c=s.alternate;c!==null&&pd(c)===null&&(r=s),s=s.sibling}return r}function Ed(s,r,c,d,m,x){var w=s.memoizedState;w===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:m,treeForkCount:x}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=c,w.tailMode=m,w.treeForkCount=x)}function qp(s){var r=s.child;for(s.child=null;r!==null;){var c=r.sibling;r.sibling=s.child,s.child=r,r=c}}function Vp(s,r,c){var d=r.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=Fn.current;if(r.flags&128)return mc(r,w),null;var M=(w&2)!==0;if(M?(w=w&1|2,r.flags|=128):w&=1,mc(r,w),m==="backwards"&&s!==null?(qp(s),Cn(s,r,d,c),qp(s)):Cn(s,r,d,c),d=lt?ac:0,!M&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Nb(s,c,r);else if(s.tag===19)Nb(s,c,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"backwards":c=Cb(r.child),c===null?(m=r.child,r.child=null):(m=c.sibling,c.sibling=null,qp(r)),Ed(r,!0,m,null,x,d);break;case"unstable_legacy-backwards":for(c=null,m=r.child,r.child=null;m!==null;){if(s=m.alternate,s!==null&&pd(s)===null){r.child=m;break}s=m.sibling,m.sibling=c,c=m,m=s}Ed(r,!0,c,null,x,d);break;case"together":Ed(r,!1,null,null,void 0,d);break;case"independent":r.memoizedState=null;break;default:c=Cb(r.child),c===null?(m=r.child,r.child=null):(m=c.sibling,c.sibling=null),Ed(r,!1,m,c,x,d)}return r.child}function Eb(s,r,c){var d=r.pendingProps;return Dr(r,r.type,d.value),Cn(s,r,d.children,c),r.child}function ar(s,r,c){if(s!==null&&(r.dependencies=s.dependencies),Gr|=r.lanes,(c&r.childLanes)===0)if(s!==null){if(La(s,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(i(153));if(r.child!==null){for(s=r.child,c=er(s,s.pendingProps),r.child=c,c.return=r;s.sibling!==null;)s=s.sibling,c=c.sibling=er(s,s.pendingProps),c.return=r;c.sibling=null}return r.child}function Gp(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&ad(s)))}function z3(s,r,c){switch(r.tag){case 3:Qe(r,r.stateNode.containerInfo),Dr(r,bn,s.memoizedState.cache),Ra();break;case 27:case 5:Kt(r);break;case 4:Qe(r,r.stateNode.containerInfo);break;case 10:Dr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,xp(r),null;break;case 13:var d=r.memoizedState;if(d!==null){if(d.dehydrated!==null)return Ir(r),r.flags|=128,null;d=La(s,r,c,!1);var m=r.child.childLanes;return d||(c&m)!==0?jb(s,r,c):(Ir(r),s=ar(s,r,c),s!==null?s.sibling:null)}Ir(r);break;case 19:if(r.flags&128)return Vp(s,r,c);if(m=(s.flags&128)!==0,d=(c&r.childLanes)!==0,d||(La(s,r,c,!1),d=(c&r.childLanes)!==0),m){if(d)return Vp(s,r,c);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),mc(r,Fn.current),d)break;return null;case 22:return r.lanes=0,bb(s,r,c,r.pendingProps);case 24:Dr(r,bn,s.memoizedState.cache)}return ar(s,r,c)}function Tb(s,r,c){if(s!==null)if(s.memoizedProps!==r.pendingProps)_n=!0;else{if(!Gp(s,c)&&(r.flags&128)===0)return _n=!1,z3(s,r,c);_n=(s.flags&131072)!==0}else _n=!1,lt&&(r.flags&1048576)!==0&&a1(r,ac,r.index);switch(r.lanes=0,r.tag){case 16:e:{var d=r.pendingProps;if(s=Pa(r.elementType),r.type=s,typeof s=="function")Jf(s)?(d=Ua(s,d),r.tag=1,r=Sb(null,r,s,d,c)):(r.tag=0,r=Bp(null,r,s,d,c));else{if(s!=null){var m=s.$$typeof;if(m===G){r.tag=11,r=gb(null,r,s,d,c);break e}else if(m===ye){r.tag=14,r=xb(null,r,s,d,c);break e}else if(m===V){r.tag=10,r.type=s,r=Eb(null,r,c);break e}}throw r=Be(s)||s,Error(i(306,r,""))}}return r;case 0:return Bp(s,r,r.type,r.pendingProps,c);case 1:return d=r.type,m=Ua(d,r.pendingProps),Sb(s,r,d,m,c);case 3:e:{if(Qe(r,r.stateNode.containerInfo),s===null)throw Error(i(387));d=r.pendingProps;var x=r.memoizedState;m=x.element,hp(s,r),pc(r,d,null,c);var w=r.memoizedState;if(d=w.cache,Dr(r,bn,d),d!==x.cache&&ap(r,[bn],c,!0),fc(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=x,r.memoizedState=x,r.flags&256){r=kb(s,r,d,c);break e}else if(d!==m){m=Hs(Error(i(424)),r),lc(m),r=kb(s,r,d,c);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Ht=Xs(s.firstChild),Mn=r,lt=!0,Or=null,Gs=!0,c=b1(r,null,d,c),r.child=c;c;)c.flags=c.flags&-3|134221824,c=c.sibling}else{if(Ra(),d===m){r=ar(s,r,c);break e}Cn(s,r,d,c)}r=r.child}return r;case 26:return Ll(s,r),s===null?(c=e_(r.type,null,r.pendingProps,null))?r.memoizedState=c:lt||(r.stateNode=Oy(r.type,r.pendingProps,ie.current,r)):r.memoizedState=e_(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return Kt(r),s===null&<&&(d=r.stateNode=Wy(r.type,r.pendingProps,ie.current),Mn=r,Gs=!0,m=Ht,Wr(r.type)?(Um=m,Ht=Xs(d.firstChild)):Ht=m),Cn(s,r,r.pendingProps.children,c),Ll(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&<&&((m=d=Ht)&&(d=ME(d,r.type,r.pendingProps,Gs),d!==null?(r.stateNode=d,Mn=r,Ht=Xs(d.firstChild),Gs=!1,m=!0):m=!1),m||Lr(r)),Kt(r),m=r.type,x=r.pendingProps,w=s!==null?s.memoizedProps:null,d=x.children,Om(m,x)?d=null:w!==null&&Om(m,w)&&(r.flags|=32),r.memoizedState!==null&&(m=yp(s,r,j3,null,null,c),Kl._currentValue=m),Ll(s,r),Cn(s,r,d,c),r.child;case 6:return s===null&<&&((s=c=Ht)&&(c=AE(c,r.pendingProps,Gs),c!==null?(r.stateNode=c,Mn=r,Ht=null,s=!0):s=!1),s||Lr(r)),null;case 13:return jb(s,r,c);case 4:return Qe(r,r.stateNode.containerInfo),d=r.pendingProps,s===null?r.child=Fa(r,null,d,c):Cn(s,r,d,c),r.child;case 11:return gb(s,r,r.type,r.pendingProps,c);case 7:return d=r.pendingProps,Ll(s,r),Cn(s,r,d,c),r.child;case 8:return Cn(s,r,r.pendingProps.children,c),r.child;case 12:return Cn(s,r,r.pendingProps.children,c),r.child;case 10:return Eb(s,r,c);case 9:return m=r.type._context,d=r.pendingProps.children,Da(r),m=Pn(m),d=d(m),r.flags|=1,Cn(s,r,d,c),r.child;case 14:return xb(s,r,r.type,r.pendingProps,c);case 15:return vb(s,r,r.type,r.pendingProps,c);case 19:return Vp(s,r,c);case 31:return L3(s,r,c);case 22:return bb(s,r,c,r.pendingProps);case 24:return Da(r),d=Pn(bn),s===null?(m=cp(),m===null&&(m=Lt,x=lp(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=c),m=x),r.memoizedState={parent:d,cache:m},dp(r),Dr(r,bn,m)):((s.lanes&c)!==0&&(hp(s,r),pc(r,null,null,c),fc()),m=s.memoizedState,x=r.memoizedState,m.parent!==d?(m={parent:d,cache:d},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),Dr(r,bn,d)):(d=x.cache,Dr(r,bn,d),d!==m.cache&&ap(r,[bn],c,!0))),Cn(s,r,r.pendingProps.children,c),r.child;case 30:return r.stateNode===null&&(r.stateNode={autoName:null,paired:null,clones:null,ref:null}),d=r.pendingProps,d.name!=null&&d.name!=="auto"?r.flags|=s===null?18882560:18874368:lt&&sd(r),s!==null&&s.memoizedProps.name!==d.name?r.flags|=4194816:Ll(s,r),Cn(s,r,d.children,c),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function lr(s){s.flags|=4}function Yp(s,r,c,d,m){var x;if((x=(s.mode&32)!==0)&&(x=c===null?i_(r,d):i_(r,d)&&(d.src!==c.src||d.srcSet!==c.srcSet)),x){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(uy())s.flags|=8192;else throw Ba=ud,up}else s.flags&=-16777217}function Mb(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!r_(r))if(uy())s.flags|=8192;else throw Ba=ud,up}function Td(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?Iu():536870912,s.lanes|=r,Bl|=r)}function yc(s,r){if(!lt)switch(s.tailMode){case"visible":break;case"collapsed":for(var c=s.tail,d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null;break;default:for(r=s.tail,c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s.tail=null:c.sibling=null}}function qt(s){var r=s.alternate!==null&&s.alternate.child===s.child,c=0,d=0;if(r)for(var m=s.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags&1206910976,d|=m.flags&1206910976,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=d,s.childLanes=c,r}function $3(s,r,c){var d=r.pendingProps;switch(np(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(r),null;case 1:return qt(r),null;case 3:return c=r.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),r.memoizedState.cache!==d&&(r.flags|=2048),sr(bn),nt(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(Cl(r)?lr(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,ip())),qt(r),null;case 26:var m=r.type,x=r.memoizedState;return s===null?(lr(r),x!==null?(qt(r),Mb(r,x)):(qt(r),Yp(r,m,null,d,c))):x?x!==s.memoizedState?(lr(r),qt(r),Mb(r,x)):(qt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==d&&lr(r),qt(r),Yp(r,m,s,d,c)),null;case 27:if(It(r),c=ie.current,m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&lr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}s=xt.current,Cl(r)?o1(r):(s=Wy(m,d,c),r.stateNode=s,lr(r))}return qt(r),r.subtreeFlags&=-33554433,null;case 5:if(It(r),m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&lr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}if(x=xt.current,Cl(r))o1(r);else{var w=Ac(ie.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[mn]=r,x[Tn]=d;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===r)break e;for(;w.sibling===null;){if(w.return===null||w.return===r)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}r.stateNode=x;e:switch(Un(x,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&lr(r)}}return qt(r),r.subtreeFlags&=-33554433,Yp(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,c),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==d&&lr(r);else{if(typeof d!="string"&&r.stateNode===null)throw Error(i(166));if(s=ie.current,Cl(r)){if(s=r.stateNode,c=r.memoizedProps,d=null,m=Mn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}s[mn]=r,s=!!(s.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||Ty(s.nodeValue,c)),s||Lr(r,!0)}else s=Ac(s).createTextNode(d),s[mn]=r,r.stateNode=s}return qt(r),null;case 31:if(c=r.memoizedState,s===null||s.memoizedState!==null){if(d=Cl(r),c!==null){if(s===null){if(!d)throw Error(i(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[mn]=r}else Ra(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),s=!1}else c=ip(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return r.flags&256?(As(r),r):(As(r),null);if((r.flags&128)!==0)throw Error(i(558))}return qt(r),null;case 13:if(d=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Cl(r),d!==null&&d.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[mn]=r}else Ra(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),m=!1}else m=ip(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return r.flags&256?(As(r),r):(As(r),null)}return As(r),(r.flags&128)!==0?(r.lanes=c,r):(c=d!==null,s=s!==null&&s.memoizedState!==null,c&&(d=r.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),c!==s&&c&&(r.child.flags|=8192),Td(r,r.updateQueue),qt(r),null);case 4:return nt(),s===null&&Em(r.stateNode.containerInfo),r.flags|=67108864,qt(r),null;case 10:return sr(r.type),qt(r),null;case 19:if(vp(r),d=r.memoizedState,d===null)return qt(r),null;if(m=(r.flags&128)!==0,x=d.rendering,x===null)if(m)yc(d,!1);else{if(dn!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(x=pd(s),x!==null){for(r.flags|=128,yc(d,!1),s=x.updateQueue,r.updateQueue=s,Td(r,s),r.subtreeFlags=0,s=c,c=r.child;c!==null;)s1(c,s),c=c.sibling;return mc(r,Fn.current&1|2),lt&&tr(r,d.treeForkCount),r.child}s=s.sibling}d.tail!==null&&Ut()>Id&&(r.flags|=128,m=!0,yc(d,!1),r.lanes=4194304)}else{if(!m)if(s=pd(x),s!==null){if(r.flags|=128,m=!0,s=s.updateQueue,r.updateQueue=s,Td(r,s),yc(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!x.alternate&&!lt)return qt(r),null}else 2*Ut()-d.renderingStartTime>Id&&c!==536870912&&(r.flags|=128,m=!0,yc(d,!1),r.lanes=4194304);d.isBackwards?(x.sibling=r.child,r.child=x):(s=d.last,s!==null?s.sibling=x:r.child=x,d.last=x)}if(d.tail!==null){s=d.tail;e:{for(c=s;c!==null;){if(c.alternate!==null){c=!1;break e}c=c.sibling}c=!0}return d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Ut(),s.sibling=null,x=Fn.current,x=m?x&1|2:x&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!c||lt?mc(r,x):(c=x,We(Bn,r),We(Fn,c),Gn===null&&(Gn=r)),lt&&tr(r,d.treeForkCount),s}return qt(r),null;case 22:case 23:return As(r),gp(),d=r.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(r.flags|=8192):d&&(r.flags|=8192),d?(c&536870912)!==0&&(r.flags&128)===0&&(qt(r),r.subtreeFlags&6&&(r.flags|=8192)):qt(r),c=r.updateQueue,c!==null&&Td(r,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==c&&(r.flags|=2048),s!==null&&wt($a),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),sr(bn),qt(r),null;case 25:return null;case 30:return r.flags|=33554432,qt(r),null}throw Error(i(156,r.tag))}function P3(s,r){switch(np(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return sr(bn),nt(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return It(r),null;case 31:if(r.memoizedState!==null){if(As(r),r.alternate===null)throw Error(i(340));Ra()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(As(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Ra()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return vp(r),s=r.flags,s&65536?(r.flags=s&-65537|128,s=r.memoizedState,s!==null&&(s.rendering=null,s.tail=null),r.flags|=4,r):null;case 4:return nt(),null;case 10:return sr(r.type),null;case 22:case 23:return As(r),gp(),s!==null&&wt($a),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return sr(bn),null;case 25:return null;default:return null}}function Ab(s,r){switch(np(r),r.tag){case 3:sr(bn),nt();break;case 26:case 27:case 5:It(r);break;case 4:nt();break;case 31:r.memoizedState!==null&&As(r);break;case 13:As(r);break;case 19:vp(r);break;case 10:sr(r.type);break;case 22:case 23:As(r),gp(),s!==null&&wt($a);break;case 24:sr(bn)}}function _c(s,r){try{var c=r.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var m=d.next;c=m;do{if((c.tag&s)===s){d=void 0;var x=c.create,w=c.inst;d=x(),w.destroy=d}c=c.next}while(c!==m)}}catch(M){Tt(r,r.return,M)}}function Hr(s,r,c){try{var d=r.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&s)===s){var w=d.inst,M=w.destroy;if(M!==void 0){w.destroy=void 0,m=r;var F=c,ee=M;try{ee()}catch(le){Tt(m,F,le)}}}d=d.next}while(d!==x)}}catch(le){Tt(r,r.return,le)}}function Rb(s){var r=s.updateQueue;if(r!==null){var c=s.stateNode;try{_1(r,c)}catch(d){Tt(s,s.return,d)}}}function Ob(s,r,c){c.props=Ua(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(d){Tt(s,r,d)}}function Ti(s,r){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:var m=s.stateNode,x=Ki(s.memoizedProps,m);(m.ref===null||m.ref.name!==x)&&(m.ref=Fy(x)),d=m.ref;break;case 7:if(s.stateNode===null){var w=new zs(s);v(s.child,!1,EE,w,void 0,void 0),s.stateNode=w}d=s.stateNode;break;default:d=s.stateNode}typeof c=="function"?s.refCleanup=c(d):c.current=d}}catch(M){Tt(s,r,M)}}function In(s,r){var c=s.ref,d=s.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(m){Tt(s,r,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Tt(s,r,m)}else c.current=null}function Md(s,r){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&r!==null)for(var c=0;c<r.length;c++)Gy(s.stateNode,r[c])}function Lb(s){for(var r=s.return;r!==null&&(Qp(r)&&Gy(s.stateNode,r.stateNode),!Xp(r));)r=r.return}function wc(s){for(var r=s.return;r!==null&&(Qp(r)&&TE(s.stateNode,r.stateNode),!Xp(r));)r=r.return}function Xp(s){return s.tag===5||s.tag===3||s.tag===27}function Qp(s){return s&&s.tag===7&&s.stateNode!==null}function Wp(s){var r=s.type,c=s.memoizedProps,d=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(m){Tt(s,s.return,m)}}function Zp(s,r,c){try{var d=s.stateNode;uE(d,s.type,c,r),d[Tn]=r}catch(m){Tt(s,s.return,m)}}function Db(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Wr(s.type)||s.tag===4}function Kp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Db(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Wr(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Jp(s,r,c,d){var m=s.tag;if(m===5||m===6)m=s.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(m,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(m),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=ts)),Md(s,d),vt=!0;else if(m!==4&&(m===27&&(Md(s,d),d=null,Wr(s.type)&&(c=s.stateNode,r=null)),s=s.child,s!==null))for(Jp(s,r,c,d),s=s.sibling;s!==null;)Jp(s,r,c,d),s=s.sibling}function Ad(s,r,c,d){var m=s.tag;if(m===5||m===6)m=s.stateNode,r?c.insertBefore(m,r):c.appendChild(m),Md(s,d),vt=!0;else if(m!==4&&(m===27&&(Md(s,d),d=null,Wr(s.type)&&(c=s.stateNode)),s=s.child,s!==null))for(Ad(s,r,c,d),s=s.sibling;s!==null;)Ad(s,r,c,d),s=s.sibling}function zb(s){var r=s.stateNode,c=s.memoizedProps;try{for(var d=s.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);Un(r,d,c),r[mn]=s,r[Tn]=c}catch(x){Tt(s,s.return,x)}}var Rd=!1,Rs=null;function $b(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Rd=!0)}var Mi=null;function Pb(){var s=Mi;return Mi=null,s}var ms=0;function Dl(s,r,c,d,m){return ms=0,Bb(s.child,r,c,d,m)}function Bb(s,r,c,d,m){for(var x=!1;s!==null;){if(s.tag===5){var w=s.stateNode;if(d!==null){var M=zm(w);d.push(M),M.view&&(x=!0)}else x||zm(w).view&&(x=!0);Rd=!0,Py(w,ms===0?r:r+"_"+ms,c),ms++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&m||Bb(s.child,r,c,d,m)&&(x=!0));s=s.sibling}return x}function Ai(s,r){for(;s!==null;)s.tag===5?By(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&r||Ai(s.child,r)),s=s.sibling}function Od(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(Od(s),s.tag===30&&(s.flags&18874368)!==0&&s.stateNode.paired)){var r=s.memoizedProps;if(r.name==null||r.name==="auto")throw Error(i(544));var c=r.name;r=Ji(r.default,r.share),r!=="none"&&(Dl(s,c,r,null,!1)||Ai(s.child,!1))}s=s.sibling}}function em(s,r){if(s.tag===30){var c=s.stateNode,d=s.memoizedProps,m=Ki(d,c),x=Ji(d.default,c.paired?d.share:d.enter);x!=="none"?Dl(s,m,x,null,!1)?(Od(s),c.paired||r||Hl(s,d.onEnter)):Ai(s.child,!1):Od(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)em(s,r),s=s.sibling;else Od(s)}function tm(s){if(Rs!==null&&Rs.size!==0){var r=Rs;if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var c=s.memoizedProps,d=c.name;if(d!=null&&d!=="auto"){var m=r.get(d);if(m!==void 0){var x=Ji(c.default,c.share);if(x!=="none"&&(Dl(s,d,x,null,!1)?(x=s.stateNode,m.paired=x,x.paired=m,Hl(s,c.onShare)):Ai(s.child,!1)),r.delete(d),r.size===0)break}}}tm(s)}s=s.sibling}}}function nm(s){if(s.tag===30){var r=s.memoizedProps,c=Ki(r,s.stateNode),d=Rs!==null?Rs.get(c):void 0,m=Ji(r.default,d!==void 0?r.share:r.exit);m!=="none"&&(Dl(s,c,m,null,!1)?d!==void 0?(m=s.stateNode,d.paired=m,m.paired=d,Rs.delete(c),Hl(s,r.onShare)):Hl(s,r.onExit):Ai(s.child,!1)),Rs!==null&&tm(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)nm(s),s=s.sibling;else Rs!==null&&tm(s)}function Fb(s){for(s=s.child;s!==null;){if(s.tag===30){var r=s.memoizedProps,c=Ki(r,s.stateNode);r=Ji(r.default,r.update),s.flags&=-5,r!=="none"&&Dl(s,c,r,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&Fb(s);s=s.sibling}}function sm(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var r=s.stateNode;r.paired!==null&&(r.paired=null,Ai(s.child,!1))}sm(s)}s=s.sibling}}function Ld(s){if(s.tag===30)s.stateNode.paired=null,Ai(s.child,!1),sm(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Ld(s),s=s.sibling;else sm(s)}function Ib(s){for(s=s.child;s!==null;)s.tag===30?Ai(s.child,!1):(s.subtreeFlags&33554432)!==0&&Ib(s),s=s.sibling}function im(s,r,c,d,m,x,w){for(var M=!1;r!==null;){if(r.tag===5){var F=r.stateNode;if(x!==null&&ms<x.length){var ee=x[ms],le=zm(F);(ee.view||le.view)&&(M=!0);var pe;if(pe=(s.flags&4)===0)if(le.clip)pe=!0;else{pe=ee.rect;var K=le.rect;pe=pe.y!==K.y||pe.x!==K.x||pe.height!==K.height||pe.width!==K.width}pe&&(s.flags|=4),le.abs?le=!ee.abs:(ee=ee.rect,le=le.rect,le=ee.height!==le.height||ee.width!==le.width),le&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&Py(F,ms===0?c:c+"_"+ms,m),M&&(s.flags&4)!==0||(Mi===null&&(Mi=[]),Mi.push(F,ms===0?d:d+"_"+ms,r.memoizedProps)),ms++}else(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&w?s.flags|=r.flags&32:im(s,r.child,c,d,m,x,w)&&(M=!0));r=r.sibling}return M}function Ub(s,r){for(s=s.child;s!==null;){if(s.tag===30){var c=s.memoizedProps,d=s.stateNode,m=Ki(c,d),x=Ji(c.default,c.update),w;w=s.memoizedState,s.memoizedState=null,d=s;var M=s.child;ms=0,m=im(d,M,m,m,x,w,!1),(s.flags&4)!==0&&m&&Hl(s,c.onUpdate)}else(s.subtreeFlags&33554432)!==0&&Ub(s);s=s.sibling}}var An=!1,Ct=!1,Ri=!1,rm=!1,Hb=typeof WeakSet=="function"?WeakSet:Set,Rn=null,Oi=!1,Sc=!1,Dd=!1,am=!1;function B3(s,r,c){if(s=s.containerInfo,Am=Jl,s=Yv(s),Gf(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var x=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var M=0,F=-1,ee=-1,le=0,pe=0,K=s,re=null;t:for(;;){for(var Me;K!==d||x!==0&&K.nodeType!==3||(F=M+x),K!==w||m!==0&&K.nodeType!==3||(ee=M+m),K.nodeType===3&&(M+=K.nodeValue.length),(Me=K.firstChild)!==null;)re=K,K=Me;for(;;){if(K===s)break t;if(re===d&&++le===x&&(F=M),re===w&&++pe===m&&(ee=M),(Me=K.nextSibling)!==null)break;K=re,re=K.parentNode}K=Me}d=F===-1||ee===-1?null:{start:F,end:ee}}else d=null}d=d||{start:0,end:0}}else d=null;for(Rm={focusedElem:s,selectionRange:d},Jl=!1,c=(c&335544064)===c,Rn=r,r=c?9270:1024;Rn!==null;){if(s=Rn,c&&(d=s.deletions,d!==null))for(x=0;x<d.length;x++)c&&nm(d[x]);if(s.alternate===null&&(s.flags&2)!==0)c&&$b(s),zd(c);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&c&&nm(d),zd(c);continue}else if(d!==null&&d.memoizedState!==null){c&&$b(s),zd(c);continue}}d=s.child,(s.subtreeFlags&r)!==0&&d!==null?(d.return=s,Rn=d):(c&&Fb(s),zd(c))}}Rs=null}function zd(s){for(;Rn!==null;){var r=Rn,c=s,d=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 15:break;case 1:if((m&1024)!==0&&d!==null){c=void 0,m=d.memoizedProps,d=d.memoizedState;var x=r.stateNode;try{var w=Ua(r.type,m);c=x.getSnapshotBeforeUpdate(w,d),x.__reactInternalSnapshotBeforeUpdate=c}catch(M){Tt(r,r.return,M)}}break;case 3:if((m&1024)!==0){if(d=r.stateNode.containerInfo,c=d.nodeType,c===9)Bm(d);else if(c===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":Bm(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:c&&d!==null&&(c=Ki(d.memoizedProps,d.stateNode),m=r.memoizedProps,m=Ji(m.default,m.update),m!=="none"&&Dl(d,c,m,d.memoizedState=[],!0));break;default:if((m&1024)!==0)throw Error(i(163))}if(d=r.sibling,d!==null){d.return=r.return,Rn=d;break}Rn=r.return}}function qb(s,r,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Li(s,c),d&4&&_c(5,c);break;case 1:if(Li(s,c),d&4)if(s=c.stateNode,r===null)try{s.componentDidMount()}catch(w){Tt(c,c.return,w)}else{var m=Ua(c.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(m,r,s.__reactInternalSnapshotBeforeUpdate)}catch(w){Tt(c,c.return,w)}}d&64&&Rb(c),d&512&&Ti(c,c.return);break;case 3:if(Li(s,c),d&64&&(s=c.updateQueue,s!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{_1(s,r)}catch(w){Tt(c,c.return,w)}}break;case 27:r===null&&d&4&&zb(c);case 26:case 5:Li(s,c),r===null&&d&4&&Wp(c),d&512&&Ti(c,c.return);break;case 12:Li(s,c);break;case 31:Li(s,c),d&4&&Xb(s,c);break;case 13:Li(s,c),d&4&&Qb(s,c),d&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=Z3.bind(null,c),RE(s,c))));break;case 22:if(d=c.memoizedState!==null||An,!d){var x=r!==null&&r.memoizedState!==null||Ct;r=An,m=Ct,An=d,(Ct=x)&&!m?(d=2,(c.subtreeFlags&8772)!==0&&(d|=1),ci(s,c,d)):Li(s,c),An=r,Ct=m}break;case 30:Li(s,c),d&512&&Ti(c,c.return);break;case 7:d&512&&Ti(c,c.return);default:Li(s,c)}}function lm(s,r){for(s=s.child;s!==null;)Vb(s,r),s=s.sibling}function Vb(s,r){switch(s.tag){case 5:case 26:try{var c=s.stateNode;if(r){var d=c.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var m=s.stateNode,x=s.memoizedProps.style,w=x!=null&&x.hasOwnProperty("display")?x.display:null;m.style.display=w==null||typeof w=="boolean"?"":(""+w).trim()}}catch(F){Tt(s,s.return,F)}om(s,r);break;case 6:try{s.stateNode.nodeValue=r?"":s.memoizedProps,vt=!0}catch(F){Tt(s,s.return,F)}break;case 18:try{var M=s.stateNode;r?$y(M,!0):$y(s.stateNode,!1)}catch(F){Tt(s,s.return,F)}break;case 22:case 23:s.memoizedState===null&&lm(s,r);break;default:lm(s,r)}}function om(s,r){if(s.subtreeFlags&67108864)for(s=s.child;s!==null;){e:{var c=s,d=r;switch(c.tag){case 4:Vb(c,d);break e;case 22:c.memoizedState===null&&om(c,d);break e;default:om(c,d)}}s=s.sibling}}function Gb(s){var r=s.alternate;r!==null&&(s.alternate=null,Gb(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&ml(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var nn=null,gs=!1;function li(s,r,c){for(c=c.child;c!==null;)Yb(s,r,c),c=c.sibling}function Yb(s,r,c){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(Ln,c)}catch{}switch(c.tag){case 26:Ct||In(c,r),li(s,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&!Ct&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Ct||In(c,r),wc(c);var d=nn,m=gs;Wr(c.type)&&(nn=c.stateNode,gs=!1),li(s,r,c),Zy(c.stateNode,c.type,c.memoizedProps),nn=d,gs=m;break;case 5:Ct||In(c,r),wc(c);case 6:if(c.tag===6&&wc(c),d=nn,m=gs,nn=null,li(s,r,c),nn=d,gs=m,nn!==null)if(gs)try{(nn.nodeType===9?nn.body:nn.nodeName==="HTML"?nn.ownerDocument.body:nn).removeChild(c.stateNode),vt=!0}catch(x){Tt(c,r,x)}else try{nn.removeChild(c.stateNode),vt=!0}catch(x){Tt(c,r,x)}break;case 18:nn!==null&&(gs?(s=nn,zy(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),eo(s)):zy(nn,c.stateNode));break;case 4:d=nn,m=gs,nn=c.stateNode.containerInfo,gs=!0,li(s,r,c),nn=d,gs=m;break;case 0:case 11:case 14:case 15:Hr(2,c,r),Ct||Hr(4,c,r),li(s,r,c);break;case 1:Ct||(In(c,r),d=c.stateNode,typeof d.componentWillUnmount=="function"&&Ob(c,r,d)),li(s,r,c);break;case 21:li(s,r,c);break;case 22:Ct=(d=Ct)||c.memoizedState!==null,li(s,r,c),Ct=d;break;case 30:In(c,r),li(s,r,c);break;case 7:Ct||In(c,r),li(s,r,c);break;default:li(s,r,c)}}function Xb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{eo(s)}catch(c){Tt(r,r.return,c)}}}function Qb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{eo(s)}catch(c){Tt(r,r.return,c)}}function F3(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new Hb),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new Hb),r;default:throw Error(i(435,s.tag))}}function $d(s,r){var c=F3(s);r.forEach(function(d){if(!c.has(d)){c.add(d);var m=K3.bind(null,s,d);d.then(m,m)}})}function is(s,r,c){var d=r.deletions;if(d!==null)for(var m=0;m<d.length;m++){var x=d[m],w=s,M=r,F=M;e:for(;F!==null;){switch(F.tag){case 27:if(Wr(F.type)){nn=F.stateNode,gs=!1;break e}break;case 5:nn=F.stateNode,gs=!1;break e;case 3:case 4:nn=F.stateNode.containerInfo,gs=!0;break e}F=F.return}if(nn===null)throw Error(i(160));Yb(w,M,x),nn=null,gs=!1,w=x.alternate,w!==null&&(w.return=null),x.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Wb(r,s,c),r=r.sibling}var oi=null;function Wb(s,r,c){var d=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(m&4&&(d=s.updateQueue,d=d!==null?d.events:null,d!==null))for(var x=0;x<d.length;x++){var w=d[x];w.ref.impl=w.nextImpl}is(r,s,c),rs(s),m&4&&(Hr(3,s,s.return),_c(3,s),Hr(5,s,s.return));break;case 1:is(r,s,c),rs(s),m&512&&(Ct||d===null||In(d,d.return)),m&64&&An&&(s=s.updateQueue,s!==null&&(r=s.callbacks,r!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?r:c.concat(r))));break;case 26:if(x=oi,is(r,s,c),rs(s),m&512&&(Ct||d===null||In(d,d.return)),m&4)if(m=d!==null?d.memoizedState:null,c=s.memoizedState,d===null)if(c===null)if(s.stateNode===null)if(An)s.stateNode=Oy(s.type,s.memoizedProps,r.containerInfo,s);else{e:{r=s.type,c=s.memoizedProps,m=x.ownerDocument||x;t:switch(r){case"title":d=m.getElementsByTagName("title")[0],(!d||d[ka]||d[mn]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=m.createElement(r),m.head.insertBefore(d,m.querySelector("head > title"))),Un(d,r,c),d[mn]=s,cn(d),r=d;break e;case"link":if(x=s_("link","href",m).get(r+(c.href||""))){for(w=0;w<x.length;w++)if(d=x[w],d.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&d.getAttribute("rel")===(c.rel==null?null:c.rel)&&d.getAttribute("title")===(c.title==null?null:c.title)&&d.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){x.splice(w,1);break t}}d=m.createElement(r),Un(d,r,c),m.head.appendChild(d);break;case"meta":if(x=s_("meta","content",m).get(r+(c.content||""))){for(w=0;w<x.length;w++)if(d=x[w],d.getAttribute("content")===(c.content==null?null:""+c.content)&&d.getAttribute("name")===(c.name==null?null:c.name)&&d.getAttribute("property")===(c.property==null?null:c.property)&&d.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&d.getAttribute("charset")===(c.charSet==null?null:c.charSet)){x.splice(w,1);break t}}d=m.createElement(r),Un(d,r,c),m.head.appendChild(d);break;default:throw Error(i(468,r))}d[mn]=s,cn(d),r=d}s.stateNode=r}else An||Gm(x,s.type,s.stateNode);else s.stateNode=n_(x,c,s.memoizedProps);else m!==c?(m===null?(r=d.stateNode,r===null||Ct||r.parentNode.removeChild(r)):m.count--,c===null?An||Gm(x,s.type,s.stateNode):n_(x,c,s.memoizedProps)):c===null&&s.stateNode!==null&&Zp(s,s.memoizedProps,d.memoizedProps);break;case 27:is(r,s,c),rs(s),m&512&&(Ct||d===null||In(d,d.return)),d!==null&&m&4&&Zp(s,s.memoizedProps,d.memoizedProps);break;case 5:if(x=Ri,Ri=!1,is(r,s,c),Ri=x,rs(s),m&512&&(Ct||d===null||In(d,d.return)),s.flags&32){r=s.stateNode;try{Zi(r,""),vt=!0}catch(le){Tt(s,s.return,le)}}m&4&&s.stateNode!=null&&(r=s.memoizedProps,Zp(s,r,d!==null?d.memoizedProps:r)),m&1024&&(rm=!0);break;case 6:if(is(r,s,c),rs(s),m&4){if(s.stateNode===null)throw Error(i(162));r=s.memoizedProps,c=s.stateNode;try{c.nodeValue=r,vt=!0}catch(le){Tt(s,s.return,le)}}break;case 3:if(vt=!1,Kd=null,x=oi,oi=Rc(r.containerInfo),is(r,s,c),oi=x,rs(s),m&4&&d!==null&&d.memoizedState.isDehydrated)try{eo(r.containerInfo)}catch(le){Tt(s,s.return,le)}rm&&(rm=!1,Zb(s)),vt=!1;break;case 4:m=Ri,Ri=An,d=Uu(),x=oi,oi=Rc(s.stateNode.containerInfo),is(r,s,c),rs(s),oi=x,vt&&Sc&&(Dd=!0),vt=d,Ri=m;break;case 12:is(r,s,c),rs(s);break;case 31:is(r,s,c),rs(s),m&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,$d(s,r)));break;case 13:is(r,s,c),rs(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Fd=Ut()),m&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,$d(s,r)));break;case 22:x=s.memoizedState!==null,w=d!==null&&d.memoizedState!==null;var M=An,F=Ct,ee=Ri;An=M||x,Ri=ee||x,Ct=F||w,is(r,s,c),Ct=F,Ri=ee,An=M,rs(s),m&8192&&(r=s.stateNode,r._visibility=x?r._visibility&-2:r._visibility|1,!x||d===null||w||An||Ct||(r=w||Ct,c=An,d=Ct,An=x||An,Ct=r,qr(s,2),An=c,Ct=d),!x&&Ri||lm(s,x)),m&4&&(r=s.updateQueue,r!==null&&(c=r.retryQueue,c!==null&&(r.retryQueue=null,$d(s,c))));break;case 19:is(r,s,c),rs(s),m&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,$d(s,r)));break;case 30:m&512&&(Ct||d===null||In(d,d.return)),m=Uu(),x=Sc,w=(c&335544064)===c,M=s.memoizedProps,Sc=w&&Ji(M.default,M.update)!=="none",is(r,s,c),rs(s),w&&d!==null&&vt&&(s.flags|=4),Sc=x,vt=m;break;case 21:break;case 7:m&512&&(Ct||d===null||In(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=s);default:is(r,s,c),rs(s)}}function rs(s){var r=s.flags;if(r&2){try{for(var c,d=s.return;d!==null;){if(Db(d)){c=d;break}d=d.return}d=null;for(var m=s.return;m!==null;){if(Qp(m)){var x=m.stateNode;d===null?d=[x]:d.push(x)}if(Xp(m))break;m=m.return}var w=d;if(c==null)throw Error(i(160));switch(c.tag){case 27:var M=c.stateNode,F=Kp(s);Ad(s,F,M,w);break;case 5:var ee=c.stateNode;c.flags&32&&(Zi(ee,""),c.flags&=-33);var le=Kp(s);Ad(s,le,ee,w);break;case 3:case 4:var pe=c.stateNode.containerInfo,K=Kp(s);Jp(s,K,pe,w);break;default:throw Error(i(161))}}catch(re){Tt(s,s.return,re)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function Zb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;Zb(r),r.tag===5&&r.flags&1024&&(r=r.stateNode,Jl=!0,r.reset(),Jl=!1),s=s.sibling}}function zl(s,r){if(r.subtreeFlags&9270)for(r=r.child;r!==null;)Kb(r,s),r=r.sibling;else Ub(r)}function Kb(s,r){var c=s.alternate;if(c===null)em(s,!1);else switch(s.tag){case 3:if(am=Oi=!1,Pb(),zl(r,s),!Oi&&!Dd){if(s=Mi,s!==null)for(var d=0;d<s.length;d+=3){c=s[d];var m=s[d+1];By(c,s[d+2]),c=c.ownerDocument.documentElement,c!==null&&c.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+m+")"})}s=r.containerInfo,s=s.nodeType===9?s.documentElement:s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName===""&&(s.style.viewTransitionName="none",s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),s.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),am=!0}Mi=null;break;case 5:zl(r,s);break;case 4:d=Oi,Oi=!1,zl(r,s),Oi&&(Dd=!0),Oi=d;break;case 22:s.memoizedState===null&&(c.memoizedState!==null?em(s,!1):zl(r,s));break;case 30:d=Oi,m=Pb(),Oi=!1,zl(r,s),Oi&&(s.flags|=4);var x=s.memoizedProps,w=s.stateNode;r=Ki(x,w),w=Ki(c.memoizedProps,w);var M=Ji(x.default,x.update);M==="none"?r=!1:(x=c.memoizedState,c.memoizedState=null,c=s.child,ms=0,r=im(s,c,r,w,M,x,!0),ms!==(x===null?0:x.length)&&(s.flags|=32)),(s.flags&4)!==0&&r?(Hl(s,s.memoizedProps.onUpdate),Mi=m):m!==null&&(m.push.apply(m,Mi),Mi=m),Oi=(s.flags&32)!==0?!0:d;break;default:zl(r,s)}}function Li(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)qb(s,r.alternate,r),r=r.sibling}function qr(s,r){for(s=s.child;s!==null;){var c=s,d=r;switch(c.tag){case 0:case 11:case 14:case 15:Hr(4,c,c.return),qr(c,d);break;case 1:In(c,c.return);var m=c.stateNode;typeof m.componentWillUnmount=="function"&&Ob(c,c.return,m),qr(c,d);break;case 27:(d&2)!==0&&Zy(c.stateNode,c.type,c.memoizedProps);case 5:In(c,c.return),c.tag!==5&&c.tag!==27||wc(c),qr(c,d);break;case 6:wc(c);break;case 26:In(c,c.return),m=c.stateNode,c.memoizedState!==null||m===null||Ct||m.parentNode.removeChild(m),qr(c,d);break;case 22:c.memoizedState===null&&qr(c,d);break;case 30:In(c,c.return),qr(c,d);break;case 7:In(c,c.return);default:qr(c,d)}s=s.sibling}}function ci(s,r,c){for(c=(r.subtreeFlags&8772)!==0?c:c&-2,r=r.child;r!==null;){var d=r.alternate,m=s,x=r,w=x.flags,M=(c&1)!==0;switch(x.tag){case 0:case 11:case 15:ci(m,x,c),_c(4,x);break;case 1:if(ci(m,x,c),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(le){Tt(d,d.return,le)}if(d=x,m=d.updateQueue,m!==null){var F=d.stateNode;try{var ee=m.shared.hiddenCallbacks;if(ee!==null)for(m.shared.hiddenCallbacks=null,m=0;m<ee.length;m++)y1(ee[m],F)}catch(le){Tt(d,d.return,le)}}M&&w&64&&Rb(x),Ti(x,x.return);break;case 27:(c&2)!==0&&zb(x);case 5:x.tag!==5&&x.tag!==27||Lb(x),ci(m,x,c),M&&d===null&&w&4&&Wp(x),Ti(x,x.return);break;case 6:Lb(x);break;case 26:F=x.stateNode,x.memoizedState!==null||F===null||An||Gm(Rc(F.ownerDocument),x.type,F),ci(m,x,c),M&&d===null&&w&4&&Wp(x),Ti(x,x.return);break;case 12:ci(m,x,c);break;case 31:ci(m,x,c),M&&w&4&&Xb(m,x);break;case 13:ci(m,x,c),M&&w&4&&Qb(m,x);break;case 22:x.memoizedState===null&&ci(m,x,c),Ti(x,x.return);break;case 30:ci(m,x,c),Ti(x,x.return);break;case 7:Ti(x,x.return);default:ci(m,x,c)}r=r.sibling}}function cm(s,r){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&oc(c))}function um(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&oc(s))}function Ys(s,r,c,d){var m=(c&335544064)===c;if(r.subtreeFlags&(m?10262:10256))for(r=r.child;r!==null;)Jb(s,r,c,d),r=r.sibling;else m&&Ib(r)}function Jb(s,r,c,d){var m=(c&335544064)===c;m&&r.alternate===null&&r.return!==null&&r.return.alternate!==null&&Ld(r);var x=r.flags;switch(r.tag){case 0:case 11:case 15:Ys(s,r,c,d),x&2048&&_c(9,r);break;case 1:Ys(s,r,c,d);break;case 3:Ys(s,r,c,d),m&&am&&(s=s.containerInfo,s=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,s.style.viewTransitionName==="root"&&(s.style.viewTransitionName=""),s=s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName==="none"&&(s.style.viewTransitionName="")),x&2048&&(x=null,r.alternate!==null&&(x=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==x&&(r.refCount++,x!=null&&oc(x)));break;case 12:if(x&2048){Ys(s,r,c,d),x=r.stateNode;try{var w=r.memoizedProps,M=w.id,F=w.onPostCommit;typeof F=="function"&&F(M,r.alternate===null?"mount":"update",x.passiveEffectDuration,-0)}catch(ee){Tt(r,r.return,ee)}}else Ys(s,r,c,d);break;case 31:Ys(s,r,c,d);break;case 13:Ys(s,r,c,d);break;case 23:break;case 22:w=r.stateNode,M=r.alternate,r.memoizedState!==null?(m&&M!==null&&M.memoizedState===null&&Ld(M),w._visibility&2?Ys(s,r,c,d):kc(s,r)):(m&&M!==null&&M.memoizedState!==null&&Ld(r),w._visibility&2?Ys(s,r,c,d):(w._visibility|=2,$l(s,r,c,d,(r.subtreeFlags&10256)!==0||!1))),x&2048&&cm(M,r);break;case 24:Ys(s,r,c,d),x&2048&&um(r.alternate,r);break;case 30:m&&(x=r.alternate,x!==null&&(Ai(x.child,!0),Ai(r.child,!0))),Ys(s,r,c,d);break;default:Ys(s,r,c,d)}}function $l(s,r,c,d,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var x=s,w=r,M=c,F=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:$l(x,w,M,F,m),_c(8,w);break;case 23:break;case 22:var le=w.stateNode;w.memoizedState!==null?le._visibility&2?$l(x,w,M,F,m):kc(x,w):(le._visibility|=2,$l(x,w,M,F,m)),m&&ee&2048&&cm(w.alternate,w);break;case 24:$l(x,w,M,F,m),m&&ee&2048&&um(w.alternate,w);break;default:$l(x,w,M,F,m)}r=r.sibling}}function kc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=s,d=r,m=d.flags;switch(d.tag){case 22:kc(c,d),m&2048&&cm(d.alternate,d);break;case 24:kc(c,d),m&2048&&um(d.alternate,d);break;default:kc(c,d)}r=r.sibling}}var Ha=8192;function qa(s,r,c){if(s.subtreeFlags&Ha)for(s=s.child;s!==null;)ey(s,r,c),s=s.sibling}function ey(s,r,c){switch(s.tag){case 26:qa(s,r,c),s.flags&Ha&&(s.memoizedState!==null?GE(c,oi,s.memoizedState,s.memoizedProps):(s=s.stateNode,(r&335544128)===r&&l_(c,s)));break;case 5:qa(s,r,c),s.flags&Ha&&(s=s.stateNode,(r&335544128)===r&&l_(c,s));break;case 3:case 4:var d=oi;oi=Rc(s.stateNode.containerInfo),qa(s,r,c),oi=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Ha,Ha=16777216,qa(s,r,c),Ha=d):qa(s,r,c));break;case 30:if((s.flags&Ha)!==0&&(d=s.memoizedProps.name,d!=null&&d!=="auto")){var m=s.stateNode;m.paired=null,Rs===null&&(Rs=new Map),Rs.set(d,m)}qa(s,r,c);break;default:qa(s,r,c)}}function ty(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function jc(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var d=r[c];Rn=d,sy(d,s)}ty(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)ny(s),s=s.sibling}function ny(s){switch(s.tag){case 0:case 11:case 15:jc(s),s.flags&2048&&Hr(9,s,s.return);break;case 3:jc(s);break;case 12:jc(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Pd(s)):jc(s);break;default:jc(s)}}function Pd(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var d=r[c];Rn=d,sy(d,s)}ty(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Hr(8,r,r.return),Pd(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,Pd(r));break;default:Pd(r)}s=s.sibling}}function sy(s,r){for(;Rn!==null;){var c=Rn;switch(c.tag){case 0:case 11:case 15:Hr(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:oc(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Rn=d;else e:for(c=s;Rn!==null;){d=Rn;var m=d.sibling,x=d.return;if(Gb(d),d===c){Rn=null;break e}if(m!==null){m.return=x,Rn=m;break e}Rn=x}}}var I3={getCacheForType:function(s){var r=Pn(bn),c=r.data.get(s);return c===void 0&&(c=s(),r.data.set(s,c)),c},cacheSignal:function(){return Pn(bn).controller.signal}},U3=typeof WeakMap=="function"?WeakMap:Map,Nt=0,Lt=null,ut=null,ht=0,Et=0,Os=null,Vr=!1,Pl=!1,dm=!1,or=0,dn=0,Gr=0,Va=0,Bd=0,Ls=0,Bl=0,Nc=null,xs=null,hm=!1,Fd=0,iy=0,Id=1/0,Ud=null,Yr=null,an=0,ui=null,Ga=null,Di=0,fm=0,pm=null,ry=null,Fl=null,Il=null,Ul=null,Cc=0,Hd=null;function Ds(){return(Nt&2)!==0&&ht!==0?ht&-ht:Te.T!==null?km():Sa()}function ay(){if(Ls===0)if((ht&536870912)===0||lt){var s=jt;jt<<=1,(jt&3932160)===0&&(jt=262144),Ls=s}else Ls=536870912;return s=Bn.current,s!==null&&(s.flags|=32),Ls}function Hl(s,r){if(r!=null){var c=s.stateNode,d=c.ref;d===null&&(d=c.ref=Fy(Ki(s.memoizedProps,c))),Il===null&&(Il=[]),Il.push(r.bind(null,d))}}function vs(s,r,c){(s===Lt&&(Et===2||Et===9)||s.cancelPendingCommit!==null)&&(ql(s,0),Xr(s,ht,Ls,!1)),Si(s,c),((Nt&2)===0||s!==Lt)&&(s===Lt&&((Nt&2)===0&&(Va|=c),dn===4&&Xr(s,ht,Ls,!1)),zi(s))}function ly(s,r,c){if((Nt&6)!==0)throw Error(i(327));var d=!c&&(r&127)===0&&(r&s.expiredLanes)===0||zn(s,r),m=d?V3(s,r):gm(s,r,!0),x=d;do{if(m===0){Pl&&!d&&Xr(s,r,0,!1);break}else{if(c=s.current.alternate,x&&!H3(c)){m=gm(s,r,!1),x=!1;continue}if(m===2){if(x=r,s.errorRecoveryDisabledLanes&x)var w=0;else w=s.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var M=s;m=Nc;var F=M.current.memoizedState.isDehydrated;if(F&&(ql(M,w).flags|=256),w=gm(M,w,!1),w!==2&&w!==6){if(dm&&!F){M.errorRecoveryDisabledLanes|=x,Va|=x,m=4;break e}x=xs,xs=m,x!==null&&(xs===null?xs=x:xs.push.apply(xs,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){ql(s,0),Xr(s,r,0,!0);break}e:{switch(d=s,x=m,x){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r&&(r&62914560)!==r)break;case 6:Xr(d,r,Ls,!Vr);break e;case 2:xs=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(m=Fd+300-Ut(),10<m)){if(Xr(d,r,Ls,!Vr),Ot(d,0,!0)!==0)break e;Di=r,d.timeoutHandle=Dm(oy.bind(null,d,c,xs,Ud,hm,r,Ls,Va,Bl,Vr,x,"Throttled",-0,0),m);break e}oy(d,c,xs,Ud,hm,r,Ls,Va,Bl,Vr,x,null,-0,0)}}break}while(!0);zi(s)}function oy(s,r,c,d,m,x,w,M,F,ee,le,pe,K,re){s.timeoutHandle=-1;var Me=r.subtreeFlags,Pe=(x&335544064)===x;if(pe=null,(Pe||Me&8192||(Me&16785408)===16785408)&&(pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ts},Rs=null,ey(r,x,pe),Pe&&(Me=pe,Pe=s.containerInfo,Pe=(Pe.nodeType===9?Pe:Pe.ownerDocument).__reactViewTransition,Pe!=null&&(Me.count++,Me.waitingForViewTransition=!0,Me=Dc.bind(Me),Pe.finished.then(Me,Me))),Me=(x&62914560)===x?Fd-Ut():(x&4194048)===x?iy-Ut():0,Me=YE(pe,Me),Me!==null)){Di=x,s.cancelPendingCommit=Me(gy.bind(null,s,r,x,c,d,m,w,M,F,ee,le,pe,null,K,re)),Xr(s,x,w,!ee);return}gy(s,r,x,c,d,m,w,M,F,ee,le,pe)}function H3(s){for(var r=s;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var m=c[d],x=m.getSnapshot;m=m.value;try{if(!Ms(x(),m))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Xr(s,r,c,d){r=ti(s,r),r&=~Bd,r&=~Va,s.suspendedLanes|=r,s.pingedLanes&=~r,d&&(s.warmLanes|=r),d=s.expirationTimes;for(var m=r;0<m;){var x=31-tn(m),w=1<<x;d[x]=-1,m&=~w}c!==0&&_a(s,c,r)}function qd(){return(Nt&6)===0?(Ec(0),!1):!0}function mm(){if(ut!==null){if(Et===0)var s=ut.return;else s=ut,nr=Oa=null,Sp(s),Ml=null,dc=0,s=ut;for(;s!==null;)Ab(s.alternate,s),s=s.return;ut=null}}function ql(s,r){var c=s.timeoutHandle;return c!==-1&&(s.timeoutHandle=-1,fE(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Di=0,mm(),Lt=s,ut=c=er(s.current,null),ht=r,Et=0,Os=null,Vr=!1,Pl=zn(s,r),dm=!1,Bl=Ls=Bd=Va=Gr=dn=0,xs=Nc=null,hm=!1,or=ti(s,r),Ku(),c}function cy(s,r){it=null,Te.H=Sd,r===Tl||r===cd?(r=g1(),Et=3):r===up?(r=g1(),Et=4):Et=r===Pp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Os=r,ut===null&&(dn=1,kd(s,Hs(r,s.current)))}function uy(){var s=Bn.current;return s===null?!0:(ht&4194048)===ht?Gn===null:(ht&62914560)===ht||(ht&536870912)!==0?s===Gn:!1}function dy(){var s=Te.H;return Te.H=Sd,s===null?Sd:s}function hy(){var s=Te.A;return Te.A=I3,s}function Vd(){dn=4,Vr||(ht&4194048)!==ht&&Bn.current!==null||(Pl=!0),(Gr&134217727)===0&&(Va&134217727)===0||Lt===null||Xr(Lt,ht,Ls,!1)}function gm(s,r,c){var d=Nt;Nt|=2;var m=dy(),x=hy();(Lt!==s||ht!==r)&&(Ud=null,ql(s,r)),r=!1;var w=dn;e:do try{if(Et!==0&&ut!==null){var M=ut,F=Os;switch(Et){case 8:mm(),w=6;break e;case 3:case 2:case 9:case 6:Bn.current===null&&(r=!0);var ee=Et;if(Et=0,Os=null,Vl(s,M,F,ee),c&&Pl){w=0;break e}break;default:ee=Et,Et=0,Os=null,Vl(s,M,F,ee)}}q3(),w=dn;break}catch(le){cy(s,le)}while(!0);return r&&s.shellSuspendCounter++,nr=Oa=null,Nt=d,Te.H=m,Te.A=x,ut===null&&(Lt=null,ht=0,Ku()),w}function q3(){for(;ut!==null;)fy(ut)}function V3(s,r){var c=Nt;Nt|=2;var d=dy(),m=hy();Lt!==s||ht!==r?(Ud=null,Id=Ut()+500,ql(s,r)):Pl=zn(s,r);e:do try{if(Et!==0&&ut!==null){r=ut;var x=Os;t:switch(Et){case 1:Et=0,Os=null,Vl(s,r,x,1);break;case 2:case 9:if(p1(x)){Et=0,Os=null,py(r);break}r=function(){Et!==2&&Et!==9||Lt!==s||(Et=7),zi(s)},x.then(r,r);break e;case 3:Et=7;break e;case 4:Et=5;break e;case 7:p1(x)?(Et=0,Os=null,py(r)):(Et=0,Os=null,Vl(s,r,x,7));break;case 5:var w=null;switch(ut.tag){case 26:w=ut.memoizedState;case 5:case 27:var M=ut;if(w?r_(w):M.stateNode.complete){Et=0,Os=null;var F=M.sibling;if(F!==null)ut=F;else{var ee=M.return;ee!==null?(ut=ee,Gd(ee)):ut=null}break t}}Et=0,Os=null,Vl(s,r,x,5);break;case 6:Et=0,Os=null,Vl(s,r,x,6);break;case 8:mm(),dn=6;break e;default:throw Error(i(462))}}G3();break}catch(le){cy(s,le)}while(!0);return nr=Oa=null,Te.H=d,Te.A=m,Nt=c,ut!==null?0:(Lt=null,ht=0,Ku(),dn)}function G3(){for(;ut!==null&&!Fs();)fy(ut)}function fy(s){var r=Tb(s.alternate,s,or);s.memoizedProps=s.pendingProps,r===null?Gd(s):ut=r}function py(s){var r=s,c=r.alternate;switch(r.tag){case 15:case 0:r=wb(c,r,r.pendingProps,r.type,void 0,ht);break;case 11:r=wb(c,r,r.pendingProps,r.type.render,r.ref,ht);break;case 5:Sp(r);var d=r;d===Mn&&(lt?(id(d),d.tag===5&&d.stateNode!=null&&(Ht=d.stateNode)):(id(d),lt=!0));default:Ab(c,r),r=ut=s1(r,or),r=Tb(c,r,or)}s.memoizedProps=s.pendingProps,r===null?Gd(s):ut=r}function Vl(s,r,c,d){nr=Oa=null,Sp(r),Ml=null,dc=0;var m=r.return;try{if(O3(s,m,r,c,ht)){dn=1,kd(s,Hs(c,s.current)),ut=null;return}}catch(x){if(m!==null)throw ut=m,x;dn=1,kd(s,Hs(c,s.current)),ut=null;return}r.flags&32768?(lt||d===1?s=!0:Pl||(ht&536870912)!==0?s=!1:(Vr=s=!0,(d===2||d===9||d===3||d===6)&&(d=Bn.current,d!==null&&d.tag===13&&(d.flags|=16384))),my(r,s)):Gd(r)}function Gd(s){var r=s;do{if((r.flags&32768)!==0){my(r,Vr);return}s=r.return;var c=$3(r.alternate,r,or);if(c!==null){ut=c;return}if(r=r.sibling,r!==null){ut=r;return}ut=r=s}while(r!==null);dn===0&&(dn=5)}function my(s,r){do{var c=P3(s.alternate,s);if(c!==null){c.flags&=32767,ut=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(s=s.sibling,s!==null)){ut=s;return}ut=s=c}while(s!==null);dn=6,ut=null}function gy(s,r,c,d,m,x,w,M,F,ee,le,pe){s.cancelPendingCommit=null;do Yd();while(an!==0);if((Nt&6)!==0)throw Error(i(327));if(r!==null){if(r===s.current)throw Error(i(177));s===Lt&&(ut=Lt=null,ht=0),Ga=r,ui=s,Di=c,pm=m,ry=d,Y3(s,r,c,w,M,F,pe)}}function Y3(s,r,c,d,m,x,w){var M=r.lanes|r.childLanes;if(fm=M,M|=Zf,fl(s,c,M,d,m,x),Il=null,(c&335544064)===c?(Ul=_3(s),d=10262):(Ul=null,d=10256),(r.subtreeFlags&d)!==0||(r.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,J3(yi,function(){return ym(),null})):(s.callbackNode=null,s.callbackPriority=0),Rd=!1,d=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||d){d=Te.T,Te.T=null,m=Re.p,Re.p=2,x=Nt,Nt|=4;try{B3(s,r,c)}finally{Nt=x,Re.p=m,Te.T=d}}an=1,Rd?Fl=bE(w,s.containerInfo,Ul,xm,vm,Q3,bm,ym,X3):(xm(),vm(),bm())}function X3(s){if(an!==0){var r=ui.onRecoverableError;r(s,{componentStack:null})}}function Q3(){an===3&&(an=0,Kb(Ga,ui),an=4)}function xm(){if(an===1){an=0;var s=ui,r=Ga,c=Di,d=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||d){d=Te.T,Te.T=null;var m=Re.p;Re.p=2;var x=Nt;Nt|=4;try{Sc=Dd=!1,Wb(r,s,c),c=Rm;var w=Yv(s.containerInfo),M=c.focusedElem,F=c.selectionRange;if(w!==M&&M&&M.ownerDocument&&Gv(M.ownerDocument.documentElement,M)){if(F!==null&&Gf(M)){var ee=F.start,le=F.end;if(le===void 0&&(le=ee),"selectionStart"in M)M.selectionStart=ee,M.selectionEnd=Math.min(le,M.value.length);else{var pe=M.ownerDocument||document,K=pe&&pe.defaultView||window;if(K.getSelection){var re=K.getSelection(),Me=M.textContent.length,Pe=Math.min(F.start,Me),rt=F.end===void 0?Pe:Math.min(F.end,Me);!re.extend&&Pe>rt&&(w=rt,rt=Pe,Pe=w);var J=Vv(M,Pe),Y=Vv(M,rt);if(J&&Y&&(re.rangeCount!==1||re.anchorNode!==J.node||re.anchorOffset!==J.offset||re.focusNode!==Y.node||re.focusOffset!==Y.offset)){var ne=pe.createRange();ne.setStart(J.node,J.offset),re.removeAllRanges(),Pe>rt?(re.addRange(ne),re.extend(Y.node,Y.offset)):(ne.setEnd(Y.node,Y.offset),re.addRange(ne))}}}}for(pe=[],re=M;re=re.parentNode;)re.nodeType===1&&pe.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<pe.length;M++){var he=pe[M];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Jl=!!Am,Rm=Am=null}finally{Nt=x,Re.p=m,Te.T=d}}s.current=r,an=2}}function vm(){if(an===2){an=0;var s=ui,r=Ga,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=Te.T,Te.T=null;var d=Re.p;Re.p=2;var m=Nt;Nt|=4;try{qb(s,r.alternate,r)}finally{Nt=m,Re.p=d,Te.T=c}}an=3}}function bm(){if(an===4||an===3){an=0;var s=Fl;Fl=null,ks();var r=ui,c=Ga,d=Di,m=ry,x=(d&335544064)===d?10262:10256;if((c.subtreeFlags&x)!==0||(c.flags&x)!==0?an=5:(an=0,Ga=ui=null,xy(r,r.pendingLanes)),x=r.pendingLanes,x===0&&(Yr=null),wa(d),c=c.stateNode,fn&&typeof fn.onCommitFiberRoot=="function")try{fn.onCommitFiberRoot(Ln,c,void 0,(c.current.flags&128)===128)}catch{}if(m!==null){c=Te.T,x=Re.p,Re.p=2,Te.T=null;try{for(var w=r.onRecoverableError,M=0;M<m.length;M++){var F=m[M];w(F.value,{componentStack:F.stack})}}finally{Te.T=c,Re.p=x}}if(m=Il,w=Ul,Ul=null,m!==null&&(Il=null,w===null&&(w=[]),s!==null))for(F=0;F<m.length;F++)c=(0,m[F])(w),c!==void 0&&s.finished.finally(c);(Di&3)!==0&&Yd(),zi(r),x=r.pendingLanes,(d&261930)!==0&&(x&42)!==0?r===Hd?Cc++:(Cc=0,Hd=r):(Cc=0,Hd=null),Ec(0)}}function xy(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,oc(r)))}function Yd(){return Fl!==null&&(Fl.skipTransition(),Fl=null),xm(),vm(),bm(),ym()}function ym(){if(an!==5)return!1;var s=ui,r=fm;fm=0;var c=wa(Di),d=Te.T,m=Re.p;try{Re.p=32>c?32:c,Te.T=null,c=pm,pm=null;var x=ui,w=Di;if(an=0,Ga=ui=null,Di=0,(Nt&6)!==0)throw Error(i(331));var M=Nt;if(Nt|=4,ny(x.current),Jb(x,x.current,w,c),Nt=M,Ec(0,!1),fn&&typeof fn.onPostCommitFiberRoot=="function")try{fn.onPostCommitFiberRoot(Ln,x)}catch{}return!0}finally{Re.p=m,Te.T=d,xy(s,r)}}function vy(s,r,c){r=Hs(c,r),r=$p(s.stateNode,r,2),s=Br(s,r,2),s!==null&&(Si(s,2),zi(s))}function Tt(s,r,c){if(s.tag===3)vy(s,s,c);else for(;r!==null;){if(r.tag===3){vy(r,s,c);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Yr===null||!Yr.has(d))){s=Hs(c,s),c=pb(2),d=Br(r,c,2),d!==null&&(mb(c,d,r,s),Si(d,2),zi(d));break}}r=r.return}}function _m(s,r,c){var d=s.pingCache;if(d===null){d=s.pingCache=new U3;var m=new Set;d.set(r,m)}else m=d.get(r),m===void 0&&(m=new Set,d.set(r,m));m.has(c)||(dm=!0,m.add(c),s=W3.bind(null,s,r,c),r.then(s,s))}function W3(s,r,c){var d=s.pingCache;d!==null&&d.delete(r),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Lt===s&&(ht&c)===c&&((dn===4||dn===3&&(ht&62914560)===ht&&300>Ut()-Fd)&&(Nt&2)===0?ql(s,0):Bd|=c,Bl===ht&&(Bl=0)),zi(s)}function by(s,r){r===0&&(r=Iu()),s=Ma(s,r),s!==null&&(Si(s,r),zi(s))}function Z3(s){var r=s.memoizedState,c=0;r!==null&&(c=r.retryLane),by(s,c)}function K3(s,r){var c=0;switch(s.tag){case 31:case 13:var d=s.stateNode,m=s.memoizedState;m!==null&&(c=m.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(r),by(s,c)}function J3(s,r){return Jn(s,r)}var Gl=null,Yl=null,wm=!1,Xd=!1,Sm=!1,Qr=0;function zi(s){s!==Yl&&s.next===null&&(Yl===null?Gl=Yl=s:Yl=Yl.next=s),Xd=!0,wm||(wm=!0,tE())}function Ec(s,r){if(!Sm&&Xd){Sm=!0;do for(var c=!1,d=Gl;d!==null;){if(s!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,M=d.pingedLanes;x=(1<<31-tn(42|s)+1)-1,x&=m&~(w&~M),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Sy(d,x))}else x=ht,x=Ot(d,d===Lt?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||zn(d,x)||(c=!0,Sy(d,x));d=d.next}while(c);Sm=!1}}function eE(){yy()}function yy(){Xd=wm=!1;var s=0;Qr!==0&&hE()&&(s=Qr);for(var r=Ut(),c=null,d=Gl;d!==null;){var m=d.next,x=_y(d,r);x===0?(d.next=null,c===null?Gl=m:c.next=m,m===null&&(Yl=c)):(c=d,(s!==0||(x&3)!==0)&&(Xd=!0)),d=m}an!==0&&an!==5||Ec(s),Qr!==0&&(Qr=0)}function _y(s,r){for(var c=s.suspendedLanes,d=s.pingedLanes,m=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var w=31-tn(x),M=1<<w,F=m[w];F===-1?((M&c)===0||(M&d)!==0)&&(m[w]=Of(M,r)):F<=r&&(s.expiredLanes|=M),x&=~M}if(r=Lt,c=ht,c=Ot(s,s===r?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,c===0||s===r&&(Et===2||Et===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&ln(d),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||zn(s,c)){if(r=c&-c,r===s.callbackPriority)return r;switch(d!==null&&ln(d),wa(c)){case 2:case 8:c=en;break;case 32:c=yi;break;case 268435456:c=kr;break;default:c=yi}return d=wy.bind(null,s),c=Jn(c,d),s.callbackPriority=r,s.callbackNode=c,r}return d!==null&&d!==null&&ln(d),s.callbackPriority=2,s.callbackNode=null,2}function wy(s,r){if(an!==0&&an!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(Yd()&&s.callbackNode!==c)return null;var d=ht;return d=Ot(s,s===Lt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(ly(s,d,r),_y(s,Ut()),s.callbackNode!=null&&s.callbackNode===c?wy.bind(null,s):null)}function Sy(s,r){if(Yd())return null;ly(s,r,!0)}function tE(){pE(function(){(Nt&6)!==0?Jn(hn,eE):yy()})}function km(){if(Qr===0){var s=za;s===0&&(s=Ge,Ge<<=1,(Ge&261888)===0&&(Ge=256)),Qr=s}return Qr}function ky(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:$n(s)}function nE(s,r,c,d,m){if(r==="submit"&&c&&c.stateNode===m){var x=ky((m[Tn]||null).action),w=d.submitter;w&&(r=(r=w[Tn]||null)?ky(r.formAction):w.getAttribute("formAction"),r!==null&&(x=r,w=null));var M=new Xu("action","action",null,d,m);s.push({event:M,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Qr!==0){var F=new FormData(m,w);Rp(c,{pending:!0,data:F,method:m.method,action:x},null,F)}}else typeof x=="function"&&(M.preventDefault(),F=new FormData(m,w),Rp(c,{pending:!0,data:F,method:m.method,action:x},x,F))},currentTarget:m}]})}}for(var jm=0;jm<Wf.length;jm++){var Nm=Wf[jm],sE=Nm.toLowerCase(),iE=Nm[0].toUpperCase()+Nm.slice(1);ai(sE,"on"+iE)}ai(Wv,"onAnimationEnd"),ai(Zv,"onAnimationIteration"),ai(Kv,"onAnimationStart"),ai("dblclick","onDoubleClick"),ai("focusin","onFocus"),ai("focusout","onBlur"),ai(f3,"onTransitionRun"),ai(p3,"onTransitionStart"),ai(m3,"onTransitionCancel"),ai(Jv,"onTransitionEnd"),Wi("onMouseEnter",["mouseout","mouseover"]),Wi("onMouseLeave",["mouseout","mouseover"]),Wi("onPointerEnter",["pointerout","pointerover"]),Wi("onPointerLeave",["pointerout","pointerover"]),Qi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),rE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tc));function jy(s,r){r=(r&4)!==0;for(var c=0;c<s.length;c++){var d=s[c],m=d.event;d=d.listeners;e:{var x=void 0;if(r)for(var w=d.length-1;0<=w;w--){var M=d[w],F=M.instance,ee=M.currentTarget;if(M=M.listener,F!==x&&m.isPropagationStopped())break e;x=M,m.currentTarget=ee;try{x(m)}catch(le){Zu(le)}m.currentTarget=null,x=F}else for(w=0;w<d.length;w++){if(M=d[w],F=M.instance,ee=M.currentTarget,M=M.listener,F!==x&&m.isPropagationStopped())break e;x=M,m.currentTarget=ee;try{x(m)}catch(le){Zu(le)}m.currentTarget=null,x=F}}}}function dt(s,r){var c=r[Uo];c===void 0&&(c=r[Uo]=new Set);var d=s+"__bubble";c.has(d)||(Ny(r,s,2,!1),c.add(d))}function Cm(s,r,c){var d=0;r&&(d|=4),Ny(c,s,d,r)}var Qd="_reactListening"+Math.random().toString(36).slice(2);function Em(s){if(!s[Qd]){s[Qd]=!0,ni.forEach(function(c){c!=="selectionchange"&&(rE.has(c)||Cm(c,!1,s),Cm(c,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Qd]||(r[Qd]=!0,Cm("selectionchange",!1,r))}}function Ny(s,r,c,d){switch(m_(r)){case 2:var m=ZE;break;case 8:m=KE;break;default:m=Xm}c=m.bind(null,r,c,s),m=void 0,!Zo||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),d?m!==void 0?s.addEventListener(r,c,{capture:!0,passive:m}):s.addEventListener(r,c,!0):m!==void 0?s.addEventListener(r,c,{passive:m}):s.addEventListener(r,c,!1)}function Tm(s,r,c,d,m){var x=d;if((r&1)===0&&(r&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var M=d.stateNode.containerInfo;if(M===m)break;if(w===4)for(w=d.return;w!==null;){var F=w.tag;if((F===3||F===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;M!==null;){if(w=Xi(M),w===null)return;if(F=w.tag,F===5||F===6||F===26||F===27){d=x=w;continue e}M=M.parentNode}}d=d.return}Es(function(){var ee=x,le=bl(c),pe=[];e:{var K=e1.get(s);if(K!==void 0){var re=Xu,Me=s;switch(s){case"keypress":if(Ts(c)===0)break e;case"keydown":case"keyup":re=HC;break;case"focusin":Me="focus",re=Ff;break;case"focusout":Me="blur",re=Ff;break;case"beforeblur":case"afterblur":re=Ff;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=Tv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=AC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=XC;break;case Wv:case Zv:case Kv:re=LC;break;case Jv:re=WC;break;case"scroll":case"scrollend":re=TC;break;case"wheel":re=KC;break;case"copy":case"cut":case"paste":re=zC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=Av;break;case"submit":re=GC;break;case"toggle":case"beforetoggle":re=e3}var Pe=(r&4)!==0,rt=!Pe&&(s==="scroll"||s==="scrollend"),J=Pe?K!==null?K+"Capture":null:K;Pe=[];for(var Y=ee,ne;Y!==null;){var he=Y;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||J===null||(he=Mr(Y,J),he!=null&&Pe.push(Mc(Y,he,ne))),rt)break;Y=Y.return}0<Pe.length&&(K=new re(K,Me,null,c,le),pe.push({event:K,listeners:Pe}))}}if((r&7)===0){e:{if(re=s==="mouseover"||s==="pointerover",K=s==="mouseout"||s==="pointerout",re&&c!==Er&&(Me=c.relatedTarget||c.fromElement)&&(Xi(Me)||Me[ji]))break e;(K||re)&&(Me=le.window===le?le:(re=le.ownerDocument)?re.defaultView||re.parentWindow:window,K?(re=c.relatedTarget||c.toElement,K=ee,re=re?Xi(re):null,re!==null&&(rt=o(re),Pe=re.tag,re!==rt||Pe!==5&&Pe!==27&&Pe!==6)&&(re=null)):(K=null,re=ee),K!==re&&(Pe=Tv,he="onMouseLeave",J="onMouseEnter",Y="mouse",(s==="pointerout"||s==="pointerover")&&(Pe=Av,he="onPointerLeave",J="onPointerEnter",Y="pointer"),rt=K==null?Me:jr(K),ne=re==null?Me:jr(re),Me=new Pe(he,Y+"leave",K,c,le),Me.target=rt,Me.relatedTarget=ne,he=null,Xi(le)===ee&&(Pe=new Pe(J,Y+"enter",re,c,le),Pe.target=ne,Pe.relatedTarget=rt,he=Pe),rt=he,Pe=K&&re?O(K,re,aE):null,K!==null&&Cy(pe,Me,K,Pe,!1),re!==null&&rt!==null&&Cy(pe,rt,re,Pe,!0)))}e:{if(K=ee?jr(ee):window,re=K.nodeName&&K.nodeName.toLowerCase(),re==="select"||re==="input"&&K.type==="file")var Le=Bv;else if($v(K))if(Fv)Le=u3;else{Le=o3;var ft=l3}else re=K.nodeName,!re||re.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?ee&&pt(ee.elementType)&&(Le=Bv):Le=c3;if(Le&&(Le=Le(s,ee))){Pv(pe,Le,c,le);break e}ft&&ft(s,K,ee)}switch(ft=ee?jr(ee):window,s){case"focusin":($v(ft)||ft.contentEditable==="true")&&(_l=ft,Yf=ee,rc=null);break;case"focusout":rc=Yf=_l=null;break;case"mousedown":Xf=!0;break;case"contextmenu":case"mouseup":case"dragend":Xf=!1,Xv(pe,c,le);break;case"selectionchange":if(h3)break;case"keydown":case"keyup":Xv(pe,c,le)}var He;if(Uf)e:{switch(s){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else yl?Dv(s,c)&&(Xe="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(Xe="onCompositionStart");Xe&&(Rv&&c.locale!=="ko"&&(yl||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&yl&&(He=Ko()):(ri=le,Gu="value"in ri?ri.value:ri.textContent,yl=!0)),ft=Wd(ee,Xe),0<ft.length&&(Xe=new Mv(Xe,s,null,c,le),pe.push({event:Xe,listeners:ft}),He?Xe.data=He:(He=zv(c),He!==null&&(Xe.data=He)))),(He=n3?s3(s,c):i3(s,c))&&(Xe=Wd(ee,"onBeforeInput"),0<Xe.length&&(ft=new Mv("onBeforeInput","beforeinput",null,c,le),pe.push({event:ft,listeners:Xe}),ft.data=He)),nE(pe,s,ee,c,le)}jy(pe,r)})}function Mc(s,r,c){return{instance:s,listener:r,currentTarget:c}}function Wd(s,r){for(var c=r+"Capture",d=[];s!==null;){var m=s,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=Mr(s,c),m!=null&&d.unshift(Mc(s,m,x)),m=Mr(s,r),m!=null&&d.push(Mc(s,m,x))),s.tag===3)return d;s=s.return}return[]}function aE(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Cy(s,r,c,d,m){for(var x=r._reactName,w=[];c!==null&&c!==d;){var M=c,F=M.alternate,ee=M.stateNode;if(M=M.tag,F!==null&&F===d)break;M!==5&&M!==26&&M!==27||ee===null||(F=ee,m?(ee=Mr(c,x),ee!=null&&w.unshift(Mc(c,ee,F))):m||(ee=Mr(c,x),ee!=null&&w.push(Mc(c,ee,F)))),c=c.return}w.length!==0&&s.push({event:r,listeners:w})}var lE=/\r\n?/g,oE=/\u0000|\uFFFD/g;function Ey(s){return(typeof s=="string"?s:""+s).replace(lE,`
|
|
50
|
+
`).replace(oE,"")}function Ty(s,r){return r=Ey(r),Ey(s)===r}function Mt(s,r,c,d,m,x){switch(c){case"children":if(typeof d=="string")r==="body"||r==="textarea"&&d===""||Zi(s,d);else if(typeof d=="number"||typeof d=="bigint")r!=="body"&&Zi(s,""+d);else return;break;case"className":ja(s,"class",d);break;case"tabIndex":ja(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ja(s,c,d);break;case"style":at(s,d,x);return;case"data":if(r!=="object"){ja(s,"data",d);break}case"src":case"href":if(d===""&&(r!=="a"||c!=="href")){s.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=$n(d),s.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(r!=="input"&&Mt(s,r,"name",m.name,m,null),Mt(s,r,"formEncType",m.formEncType,m,null),Mt(s,r,"formMethod",m.formMethod,m,null),Mt(s,r,"formTarget",m.formTarget,m,null)):(Mt(s,r,"encType",m.encType,m,null),Mt(s,r,"method",m.method,m,null),Mt(s,r,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=$n(d),s.setAttribute(c,d);break;case"onClick":d!=null&&(s.onclick=ts);return;case"onScroll":d!=null&&dt("scroll",s);return;case"onScrollEnd":d!=null&&dt("scrollend",s);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));(x!=null?x.__html:void 0)!==c&&(s.innerHTML=c)}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}c=$n(d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":d===!0?s.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(c,d):s.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(c):s.setAttribute(c,d);break;case"popover":dt("beforetoggle",s),dt("toggle",s),vl(s,"popover",d);break;case"xlinkActuate":Is(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Is(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Is(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Is(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Is(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Is(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Is(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Is(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Is(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":vl(s,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")c=mt.get(c)||c,vl(s,c,d);else return}vt=!0}function Mm(s,r,c,d,m,x){switch(c){case"style":at(s,d,x);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));(x!=null?x.__html:void 0)!==c&&(s.innerHTML=c)}}break;case"children":if(typeof d=="string")Zi(s,d);else if(typeof d=="number"||typeof d=="bigint")Zi(s,""+d);else return;break;case"onScroll":d!=null&&dt("scroll",s);return;case"onScrollEnd":d!=null&&dt("scrollend",s);return;case"onClick":d!=null&&(s.onclick=ts);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!gl.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),x=c.slice(2,m?c.length-7:void 0),r=s[Tn]||null,r=r!=null?r[c]:null,typeof r=="function"&&s.removeEventListener(x,r,m),typeof d=="function")){typeof r!="function"&&r!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(x,d,m);break e}vt=!0,c in s?s[c]=d:d===!0?s.setAttribute(c,""):vl(s,c,d)}return}vt=!0}function Un(s,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dt("error",s),dt("load",s);var d=!1,m=!1,x;for(x in c)if(c.hasOwnProperty(x)){var w=c[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Mt(s,r,x,w,c,null)}}m&&Mt(s,r,"srcSet",c.srcSet,c,null),d&&Mt(s,r,"src",c.src,c,null);return;case"input":dt("invalid",s);var M=x=w=m=null,F=null,ee=null;for(d in c)if(c.hasOwnProperty(d)){var le=c[d];if(le!=null)switch(d){case"name":m=le;break;case"type":w=le;break;case"checked":F=le;break;case"defaultChecked":ee=le;break;case"value":x=le;break;case"defaultValue":M=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,r));break;default:Mt(s,r,d,le,c,null)}}Vu(s,x,M,F,ee,w,m,!1);return;case"select":dt("invalid",s),d=w=x=null;for(m in c)if(c.hasOwnProperty(m)&&(M=c[m],M!=null))switch(m){case"value":x=M;break;case"defaultValue":w=M;break;case"multiple":d=M;default:Mt(s,r,m,M,c,null)}r=x,c=w,s.multiple=!!d,r!=null?Cr(s,!!d,r,!1):c!=null&&Cr(s,!!d,c,!0);return;case"textarea":dt("invalid",s),x=m=d=null;for(w in c)if(c.hasOwnProperty(w)&&(M=c[w],M!=null))switch(w){case"value":d=M;break;case"defaultValue":m=M;break;case"children":x=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(i(91));break;default:Mt(s,r,w,M,c,null)}Qo(s,d,m,x);return;case"option":for(F in c)if(c.hasOwnProperty(F)&&(d=c[F],d!=null))switch(F){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Mt(s,r,F,d,c,null)}return;case"dialog":dt("beforetoggle",s),dt("toggle",s),dt("cancel",s),dt("close",s);break;case"iframe":case"object":dt("load",s);break;case"video":case"audio":for(d=0;d<Tc.length;d++)dt(Tc[d],s);break;case"image":dt("error",s),dt("load",s);break;case"details":dt("toggle",s);break;case"embed":case"source":case"link":dt("error",s),dt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in c)if(c.hasOwnProperty(ee)&&(d=c[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Mt(s,r,ee,d,c,null)}return;default:if(pt(r)){for(le in c)c.hasOwnProperty(le)&&(d=c[le],d!==void 0&&Mm(s,r,le,d,c,void 0));return}}for(M in c)c.hasOwnProperty(M)&&(d=c[M],d!=null&&Mt(s,r,M,d,c,null))}var cE={};function uE(s,r,c,d){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,M=null,F=null,ee=null,le=null;for(re in c){var pe=c[re];if(c.hasOwnProperty(re)&&pe!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":F=pe;default:d.hasOwnProperty(re)||Mt(s,r,re,null,d,pe)}}for(var K in d){var re=d[K];if(pe=c[K],d.hasOwnProperty(K)&&(re!=null||pe!=null))switch(K){case"type":re!==pe&&(vt=!0),x=re;break;case"name":re!==pe&&(vt=!0),m=re;break;case"checked":re!==pe&&(vt=!0),ee=re;break;case"defaultChecked":re!==pe&&(vt=!0),le=re;break;case"value":re!==pe&&(vt=!0),w=re;break;case"defaultValue":re!==pe&&(vt=!0),M=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,r));break;default:re!==pe&&Mt(s,r,K,re,d,pe)}}Go(s,w,M,F,ee,le,x,m);return;case"select":re=w=M=K=null;for(x in c)if(F=c[x],c.hasOwnProperty(x)&&F!=null)switch(x){case"value":break;case"multiple":re=F;default:d.hasOwnProperty(x)||Mt(s,r,x,null,d,F)}for(m in d)if(x=d[m],F=c[m],d.hasOwnProperty(m)&&(x!=null||F!=null))switch(m){case"value":x!==F&&(vt=!0),K=x;break;case"defaultValue":x!==F&&(vt=!0),M=x;break;case"multiple":x!==F&&(vt=!0),w=x;default:x!==F&&Mt(s,r,m,x,d,F)}r=M,c=w,d=re,K!=null?Cr(s,!!c,K,!1):!!d!=!!c&&(r!=null?Cr(s,!!c,r,!0):Cr(s,!!c,c?[]:"",!1));return;case"textarea":re=K=null;for(M in c)if(m=c[M],c.hasOwnProperty(M)&&m!=null&&!d.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:Mt(s,r,M,null,d,m)}for(w in d)if(m=d[w],x=c[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":m!==x&&(vt=!0),K=m;break;case"defaultValue":m!==x&&(vt=!0),re=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==x&&Mt(s,r,w,m,d,x)}Xo(s,K,re);return;case"option":for(var Me in c)if(K=c[Me],c.hasOwnProperty(Me)&&K!=null&&!d.hasOwnProperty(Me))switch(Me){case"selected":s.selected=!1;break;default:Mt(s,r,Me,null,d,K)}for(F in d)if(K=d[F],re=c[F],d.hasOwnProperty(F)&&K!==re&&(K!=null||re!=null))switch(F){case"selected":K!==re&&(vt=!0),s.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:Mt(s,r,F,K,d,re)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Pe in c)K=c[Pe],c.hasOwnProperty(Pe)&&K!=null&&!d.hasOwnProperty(Pe)&&Mt(s,r,Pe,null,d,K);for(ee in d)if(K=d[ee],re=c[ee],d.hasOwnProperty(ee)&&K!==re&&(K!=null||re!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(i(137,r));break;default:Mt(s,r,ee,K,d,re)}return;default:if(pt(r)){for(var rt in c)K=c[rt],c.hasOwnProperty(rt)&&K!==void 0&&!d.hasOwnProperty(rt)&&Mm(s,r,rt,void 0,d,K);for(le in d)K=d[le],re=c[le],!d.hasOwnProperty(le)||K===re||K===void 0&&re===void 0||Mm(s,r,le,K,d,re);return}}for(var J in c)K=c[J],c.hasOwnProperty(J)&&K!=null&&!d.hasOwnProperty(J)&&Mt(s,r,J,null,d,K);for(pe in d)K=d[pe],re=c[pe],!d.hasOwnProperty(pe)||K===re||K==null&&re==null||Mt(s,r,pe,K,d,re)}function My(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dE(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var m=c[d],x=m.transferSize,w=m.initiatorType,M=m.duration;if(x&&M&&My(w)){for(w=0,M=m.responseEnd,d+=1;d<c.length;d++){var F=c[d],ee=F.startTime;if(ee>M)break;var le=F.transferSize,pe=F.initiatorType;le&&My(pe)&&(F=F.responseEnd,w+=le*(F<M?1:(M-ee)/(F-ee)))}if(--d,r+=8*(x+w)/(m.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Am=null,Rm=null;function Ac(s){return s.nodeType===9?s:s.ownerDocument}function Ay(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ry(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function Oy(s,r,c,d){return c=Ac(c).createElement(s),c[mn]=d,c[Tn]=r,Un(c,s,r),cn(c),c}function Om(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Lm=null;function hE(){var s=window.event;return s&&s.type==="popstate"?s===Lm?!1:(Lm=s,!0):(Lm=null,!1)}var Dm=typeof setTimeout=="function"?setTimeout:void 0,fE=typeof clearTimeout=="function"?clearTimeout:void 0,Ly=typeof Promise=="function"?Promise:void 0,Dy=typeof requestAnimationFrame=="function"?requestAnimationFrame:Dm,pE=typeof queueMicrotask=="function"?queueMicrotask:typeof Ly<"u"?function(s){return Ly.resolve(null).then(s).catch(mE)}:Dm;function mE(s){setTimeout(function(){throw s})}function Wr(s){return s==="head"}function zy(s,r){var c=r,d=0;do{var m=c.nextSibling;if(s.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(d===0){s.removeChild(m),eo(r);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Hm(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Hm(c);for(var x=c.firstChild;x;){var w=x.nextSibling,M=x.nodeName;x[ka]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=w}}else c==="body"&&Hm(s.ownerDocument.body);c=m}while(c);eo(r)}function $y(s,r){var c=s;s=0;do{var d=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=d}while(c)}function Py(s,r,c){if(r=CSS.escape(r)!==r?"r-"+btoa(r).replace(/=/g,""):r,s.style.viewTransitionName=r,c!=null&&(s.style.viewTransitionClass=c),c=getComputedStyle(s),c.display==="inline"){if(r=s.getClientRects(),r.length===1)var d=1;else for(var m=d=0;m<r.length;m++){var x=r[m];0<x.width&&0<x.height&&d++}d===1&&(s=s.style,s.display=r.length===1?"inline-block":"block",s.marginTop="-"+c.paddingTop,s.marginBottom="-"+c.paddingBottom)}}function By(s,r){s=s.style,r=r.style;var c=r!=null?r.hasOwnProperty("viewTransitionName")?r.viewTransitionName:r.hasOwnProperty("view-transition-name")?r["view-transition-name"]:null:null;s.viewTransitionName=c==null||typeof c=="boolean"?"":(""+c).trim(),c=r!=null?r.hasOwnProperty("viewTransitionClass")?r.viewTransitionClass:r.hasOwnProperty("view-transition-class")?r["view-transition-class"]:null:null,s.viewTransitionClass=c==null||typeof c=="boolean"?"":(""+c).trim(),s.display==="inline-block"&&(r==null?s.display=s.margin="":(c=r.display,s.display=c==null||typeof c=="boolean"?"":c,c=r.margin,c!=null?s.margin=c:(c=r.hasOwnProperty("marginTop")?r.marginTop:r["margin-top"],s.marginTop=c==null||typeof c=="boolean"?"":c,r=r.hasOwnProperty("marginBottom")?r.marginBottom:r["margin-bottom"],s.marginBottom=r==null||typeof r=="boolean"?"":r)))}function gE(s,r,c){return c=c.ownerDocument.defaultView,{rect:s,abs:r.position==="absolute"||r.position==="fixed",clip:r.clipPath!=="none"||r.overflow!=="visible"||r.filter!=="none"||r.mask!=="none"||r.mask!=="none"||r.borderRadius!=="0px",view:0<=s.bottom&&0<=s.right&&s.top<=c.innerHeight&&s.left<=c.innerWidth}}function zm(s){var r=s.getBoundingClientRect(),c=getComputedStyle(s);return gE(r,c,s)}function xE(s){return s.documentElement.clientHeight}function vE(s){this.addEventListener("load",s),this.addEventListener("error",s)}function bE(s,r,c,d,m,x,w,M,F){var ee=r.nodeType===9?r:r.ownerDocument;try{var le=ee.startViewTransition({update:function(){var K=ee.defaultView,re=K.navigation&&K.navigation.transition,Me=ee.fonts.status;d();var Pe=[];if(Me==="loaded"&&(xE(ee),ee.fonts.status==="loading"&&Pe.push(ee.fonts.ready)),Me=Pe.length,s!==null)for(var rt=s.suspenseyImages,J=0,Y=0;Y<rt.length;Y++){var ne=rt[Y];if(!ne.complete){var he=ne.getBoundingClientRect();if(0<he.bottom&&0<he.right&&he.top<K.innerHeight&&he.left<K.innerWidth){if(J+=a_(ne),J>Jd){Pe.length=Me;break}ne=new Promise(vE.bind(ne)),Pe.push(ne)}}}if(0<Pe.length)return K=Promise.race([Promise.all(Pe),new Promise(function(Le){return setTimeout(Le,500)})]).then(m,m),(re?Promise.allSettled([re.finished,K]):K).then(x,x);if(m(),re)return re.finished.then(x,x);x()},types:c});ee.__reactViewTransition=le;var pe=[];return le.ready.then(function(){for(var K=ee.documentElement.getAnimations({subtree:!0}),re=0;re<K.length;re++){var Me=K[re],Pe=Me.effect,rt=Pe.pseudoElement;if(rt!=null&&rt.startsWith("::view-transition")){pe.push(Me),Me=Pe.getKeyframes();for(var J=rt=void 0,Y=!0,ne=0;ne<Me.length;ne++){var he=Me[ne],Le=he.width;if(rt===void 0)rt=Le;else if(rt!==Le){Y=!1;break}if(Le=he.height,J===void 0)J=Le;else if(J!==Le){Y=!1;break}delete he.width,delete he.height,he.transform==="none"&&delete he.transform}Y&&rt!==void 0&&J!==void 0&&(Pe.setKeyframes(Me),Y=getComputedStyle(Pe.target,Pe.pseudoElement),Y.width!==rt||Y.height!==J)&&(Y=Me[0],Y.width=rt,Y.height=J,Y=Me[Me.length-1],Y.width=rt,Y.height=J,Pe.setKeyframes(Me))}}w()},function(K){ee.__reactViewTransition===le&&(ee.__reactViewTransition=null);try{if(typeof K=="object"&&K!==null)switch(K.name){case"InvalidStateError":(K.message==="View transition was skipped because document visibility state is hidden."||K.message==="Skipping view transition because document visibility state has become hidden."||K.message==="Skipping view transition because viewport size changed."||K.message==="Transition was aborted because of invalid state")&&(K=null)}K!==null&&F(K)}finally{d(),m(),w()}}),le.finished.finally(function(){for(var K=0;K<pe.length;K++)pe[K].cancel();ee.__reactViewTransition===le&&(ee.__reactViewTransition=null),M()}),le}catch{return d(),m(),w(),null}}function Ya(s,r){this._scope=document.documentElement,this._selector="::view-transition-"+s+"("+r+")"}Ya.prototype.animate=function(s,r){return r=typeof r=="number"?{duration:r}:P({},r),r.pseudoElement=this._selector,this._scope.animate(s,r)},Ya.prototype.getAnimations=function(){for(var s=this._scope,r=this._selector,c=s.getAnimations({subtree:!0}),d=[],m=0;m<c.length;m++){var x=c[m].effect;x!==null&&x.target===s&&x.pseudoElement===r&&d.push(c[m])}return d},Ya.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Fy(s){return{name:s,group:new Ya("group",s),imagePair:new Ya("image-pair",s),old:new Ya("old",s),new:new Ya("new",s)}}function zs(s){this._fragmentFiber=s,this._observers=this._eventListeners=null}zs.prototype.addEventListener=function(s,r,c){var d=null,m=null;if(!(c!=null&&typeof c!="boolean"&&(d=c.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var x=this._eventListeners;if(Uy(x,s,r,c)===-1){var w=this,M=r;c!=null&&typeof c!="boolean"&&c.once===!0&&(M=function(F){w.removeEventListener(s,r,c),typeof r=="function"?r.call(this,F):r.handleEvent(F)}),d!==null&&(m=w.removeEventListener.bind(w,s,r,c),d.addEventListener("abort",m,{once:!0}),m=d.removeEventListener.bind(d,"abort",m)),d=Xl(c),x.push({type:s,listener:r,optionsOrUseCapture:c,attachedListener:M,cleanup:m}),v(this._fragmentFiber.child,!1,yE,s,M,d)}this._eventListeners=x}};function yE(s,r,c,d){return N(s).addEventListener(r,c,d),!1}zs.prototype.removeEventListener=function(s,r,c){var d=this._eventListeners;if(d!==null&&(r=Uy(d,s,r,c),r!==-1)){var m=d[r];c=m.attachedListener;var x=m.cleanup;m=Xl(m.optionsOrUseCapture),v(this._fragmentFiber.child,!1,_E,s,c,m),d.splice(r,1),x!==null&&x()}};function _E(s,r,c,d){return N(s).removeEventListener(r,c,d),!1}function Xl(s){return s!=null&&typeof s!="boolean"&&(s.once===!0||s.signal instanceof AbortSignal)?{capture:s.capture,passive:s.passive}:s}function Iy(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function Uy(s,r,c,d){if(s.length===0)return-1;d=Iy(d);for(var m=0;m<s.length;m++){var x=s[m];if(x.type===r&&x.listener===c&&Iy(x.optionsOrUseCapture)===d)return m}return-1}zs.prototype.dispatchEvent=function(s){var r=b(this._fragmentFiber);if(r===null)return!0;r=N(r);var c=this._eventListeners;if(c!==null&&0<c.length||!s.bubbles){var d=r.nodeType===9?r.createComment(""):document.createTextNode("");if(c)for(var m=0;m<c.length;m++){var x=c[m];d.addEventListener(x.type,x.attachedListener,Xl(x.optionsOrUseCapture))}if(r.appendChild(d),s=d.dispatchEvent(s),c)for(m=0;m<c.length;m++)x=c[m],d.removeEventListener(x.type,x.attachedListener,Xl(x.optionsOrUseCapture));return r.removeChild(d),s}return r.dispatchEvent(s)},zs.prototype.focus=function(s){v(this._fragmentFiber.child,!0,Hy,s,void 0,void 0)};function Hy(s,r){return s.tag===6?!1:(s=N(s),OE(s,r))}zs.prototype.focusLast=function(s){var r=[];v(this._fragmentFiber.child,!0,$m,r,void 0,void 0);for(var c=r.length-1;0<=c&&!Hy(r[c],s);c--);};function $m(s,r){return r.push(s),!1}zs.prototype.blur=function(){var s=b(this._fragmentFiber);s!==null&&(s=N(s),s=Ac(s).activeElement,s!==null&&v(this._fragmentFiber.child,!1,wE,s,void 0,void 0))};function wE(s,r){return s.tag===6?!1:(s=N(s),s===r||s.contains(r)?(r.blur(),!0):!1)}zs.prototype.observeUsing=function(s){this._observers===null&&(this._observers=new Set),this._observers.add(s),v(this._fragmentFiber.child,!1,SE,s,void 0,void 0)};function SE(s,r){return s.tag===6||(s=N(s),r.observe(s)),!1}zs.prototype.unobserveUsing=function(s){var r=this._observers;if(r!==null&&r.has(s)){r.delete(s),v(this._fragmentFiber.child,!1,kE,s,void 0,void 0);for(var c=r=0;c<di.length;c++){var d=di[c];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):di[r++]=d}di.length=r}};function kE(s,r){return s.tag===6||(s=N(s),r.unobserve(s)),!1}var di=[],Pm=!1;function jE(s,r,c){di.push({fragmentInstance:s,observer:r,instance:c}),Pm||(Pm=!0,LE(function(){Pm=!1;var d=di;di=[];for(var m=0;m<d.length;m++){var x=d[m];x.observer.unobserve(x.instance)}}))}zs.prototype.getClientRects=function(){var s=[];return v(this._fragmentFiber.child,!1,NE,s,void 0,void 0),s};function NE(s,r){if(s.tag===6){s=s.stateNode;var c=s.ownerDocument.createRange();c.selectNodeContents(s),r.push.apply(r,c.getClientRects())}else s=N(s),r.push.apply(r,s.getClientRects());return!1}zs.prototype.getRootNode=function(s){var r=b(this._fragmentFiber);return r===null?this:N(r).getRootNode(s)},zs.prototype.compareDocumentPosition=function(s){var r=b(this._fragmentFiber);if(r===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var c=[];v(this._fragmentFiber.child,!1,$m,c,void 0,void 0);var d=N(r);if(c.length===0){if(c=d,y(this._fragmentFiber)){e:{for(r=this._fragmentFiber.return;r!==null;){if(r.tag===4){r=r.stateNode.containerInfo;break e}if(r.tag===3||r.tag===5||r.tag===27)break;r=r.return}r=null}r!=null&&(c=r)}r=this._fragmentFiber;var m=d=c.compareDocumentPosition(s);return c===s?m=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(c=_(r)[1],c===null?m=Node.DOCUMENT_POSITION_PRECEDING:(s=N(c).compareDocumentPosition(s),m=s===0||s&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),m|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}r=N(c[0]),m=N(c[c.length-1]);var x=y(this._fragmentFiber)?r.parentElement:d;if(x==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=x.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY,x=x.compareDocumentPosition(m)&Node.DOCUMENT_POSITION_CONTAINED_BY;var w=r.compareDocumentPosition(s),M=m.compareDocumentPosition(s),F=w&Node.DOCUMENT_POSITION_CONTAINED_BY||M&Node.DOCUMENT_POSITION_CONTAINED_BY;return M=d&&x&&w&Node.DOCUMENT_POSITION_FOLLOWING&&M&Node.DOCUMENT_POSITION_PRECEDING,r=d&&r===s||x&&m===s||F||M?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&r===s||!x&&m===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:w,r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||CE(r,this._fragmentFiber,c[0],c[c.length-1],s)?r:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function CE(s,r,c,d,m){var x=Xi(m);if(s&Node.DOCUMENT_POSITION_CONTAINED_BY){if(c=!!x)e:{for(;x!==null;){if(x.tag===7&&(x===r||x.alternate===r)){c=!0;break e}x=x.return}c=!1}return c}if(s&Node.DOCUMENT_POSITION_CONTAINS){if(x===null)return x=m.ownerDocument,m===x||m===x.documentElement||m===x.body;e:{for(x=r,r=b(r);x!==null;){if(!(x.tag!==5&&x.tag!==3&&x.tag!==27||x!==r&&x.alternate!==r)){x=!0;break e}x=x.return}x=!1}return x}return s&Node.DOCUMENT_POSITION_PRECEDING?((r=!!x)&&!(r=x===c)&&(r=O(c,x,A),r===null?r=!1:(v(r,!0,E,x,c),x=S,S=null,r=x!==null)),r):s&Node.DOCUMENT_POSITION_FOLLOWING?((r=!!x)&&!(r=x===d)&&(r=O(d,x,A),r===null?r=!1:(v(r,!0,R,x,d),x=S,C=S=null,r=x!==null)),r):!1}function qy(s,r){var c=s.ownerDocument.createRange();c.selectNodeContents(s),s=c.getBoundingClientRect(),window.scrollTo(window.scrollX+s.left,r?window.scrollY+s.top:window.scrollY+s.bottom-window.innerHeight)}zs.prototype.scrollIntoView=function(s){if(typeof s=="object")throw Error(i(566));var r=[];v(this._fragmentFiber.child,!1,$m,r,void 0,void 0);var c=s!==!1;if(r.length===0){var d=_(this._fragmentFiber);if(d=c?d[1]||d[0]||b(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){s=N(d),qy(s,c);return}if(d=N(d),d.nodeType!==9){if(d.nodeType===11){c="host"in d?d.host:null,c!==null&&c.scrollIntoView(s);return}d.scrollIntoView(s)}}for(d=c?r.length-1:0;d!==(c?-1:r.length);){var m=r[d];m.tag===6?(m=N(m),qy(m,c)):N(m).scrollIntoView(s),d+=c?-1:1}};function EE(s,r){return s=N(s),Vy(s,r),!1}function Vy(s,r){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(r)}function Gy(s,r){var c=r._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d];s.addEventListener(m.type,m.attachedListener,Xl(m.optionsOrUseCapture))}s.nodeType!==3&&(c=r._observers,c!==null&&c.forEach(function(x){for(var w=0,M=0;M<di.length;M++){var F=di[M];(F.fragmentInstance!==r||F.observer!==x||F.instance!==s)&&(di[w++]=F)}di.length=w,x.observe(s)}),Vy(s,r))}function TE(s,r){var c=r._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d];s.removeEventListener(m.type,m.attachedListener,Xl(m.optionsOrUseCapture))}s.nodeType!==3&&(c=r._observers,c!==null&&c.forEach(function(x){typeof x.rootMargin=="string"?jE(r,x,s):x.unobserve(s)}),s.reactFragments!=null&&s.reactFragments.delete(r))}function Bm(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Bm(c),ml(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function ME(s,r,c,d){for(;s.nodeType===1;){var m=c;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[ka])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(x=s.getAttribute("src"),(x!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=Xs(s.nextSibling),s===null)break}return null}function AE(s,r,c){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Xs(s.nextSibling),s===null))return null;return s}function Yy(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=Xs(s.nextSibling),s===null))return null;return s}function Fm(s){return s.data==="$?"||s.data==="$~"}function Im(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function RE(s,r){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||c.readyState!=="loading")r();else{var d=function(){r(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Xs(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Um=null;function Xy(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(r===0)return Xs(s.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}s=s.nextSibling}return null}function Qy(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return s;r--}else c!=="/$"&&c!=="/&"||r++}s=s.previousSibling}return null}function OE(s,r){function c(){d=!0}if(s.ownerDocument.activeElement===s)return!0;var d=!1;try{s.ownerDocument.addEventListener("focus",c,!0),(s.focus||HTMLElement.prototype.focus).call(s,r)}finally{s.ownerDocument.removeEventListener("focus",c,!0)}return d}function LE(s){Dy(function(){Dy(function(r){return s(r)})})}function Wy(s,r,c){switch(r=Ac(c),s){case"html":if(s=r.documentElement,!s)throw Error(i(452));return s;case"head":if(s=r.head,!s)throw Error(i(453));return s;case"body":if(s=r.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Zy(s,r,c){for(var d in c){var m=c[d];c.hasOwnProperty(d)&&m!=null&&Mt(s,r,d,null,cE,m)}c.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===ts&&(s.onclick=null),ml(s)}function Hm(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);ml(s)}var Qs=new Map,Ky=new Set;function Rc(s){if(typeof s.getRootNode=="function"){var r=s.getRootNode();if(r.nodeType===9||r.nodeType===11)return r}return s.nodeType===9?s:s.ownerDocument}var cr=Re.d;Re.d={f:DE,r:zE,D:$E,C:PE,L:BE,m:FE,X:UE,S:IE,M:HE};function DE(){var s=cr.f(),r=qd();return s||r}function zE(s){var r=Ni(s);r!==null&&r.tag===5&&r.type==="form"?eb(r):cr.r(s)}var Ql=typeof document>"u"?null:document;function Jy(s,r,c){var d=Ql;if(d&&typeof r=="string"&&r){var m=fs(r);m='link[rel="'+s+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),Ky.has(m)||(Ky.add(m),s={rel:s,crossOrigin:c,href:r},d.querySelector(m)===null&&(r=d.createElement("link"),Un(r,"link",s),cn(r),d.head.appendChild(r)))}}function $E(s){cr.D(s),Jy("dns-prefetch",s,null)}function PE(s,r){cr.C(s,r),Jy("preconnect",s,r)}function BE(s,r,c){cr.L(s,r,c);var d=Ql;if(d&&s&&r){var m='link[rel="preload"][as="'+fs(r)+'"]';r==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+fs(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+fs(c.imageSizes)+'"]')):m+='[href="'+fs(s)+'"]';var x=m;switch(r){case"style":x=Wl(s);break;case"script":x=Zl(s)}if(!(Qs.has(x)||(s=P({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:s,as:r},c),Qs.set(x,s),d.querySelector(m)!==null||r==="style"&&d.querySelector(Oc(x))||r==="script"&&d.querySelector(Lc(x))))){var w=d.createElement("link");Un(w,"link",s),r==="style"&&(w[pl]=!0,w.onload=w.onerror=function(){Ns(w)}),cn(w),d.head.appendChild(w)}}}function FE(s,r){cr.m(s,r);var c=Ql;if(c&&s){var d=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+fs(d)+'"][href="'+fs(s)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Zl(s)}if(!Qs.has(x)&&(s=P({rel:"modulepreload",href:s},r),Qs.set(x,s),c.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Lc(x)))return}d=c.createElement("link"),Un(d,"link",s),cn(d),c.head.appendChild(d)}}}function IE(s,r,c){cr.S(s,r,c);var d=Ql;if(d&&s){var m=hs(d).hoistableStyles,x=Wl(s);r=r||"default";var w=m.get(x);if(!w){var M={loading:0,preload:null};if(w=d.querySelector(Oc(x)))M.loading=5;else{s=P({rel:"stylesheet",href:s,"data-precedence":r},c),(c=Qs.get(x))&&qm(s,c);var F=w=d.createElement("link");cn(F),Un(F,"link",s),F._p=new Promise(function(ee,le){F.onload=ee,F.onerror=le}),F.addEventListener("load",function(){M.loading|=1}),F.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Zd(w,r,d)}w={type:"stylesheet",instance:w,count:1,state:M},m.set(x,w)}}}function UE(s,r){cr.X(s,r);var c=Ql;if(c&&s){var d=hs(c).hoistableScripts,m=Zl(s),x=d.get(m);x||(x=c.querySelector(Lc(m)),x||(s=P({src:s,async:!0},r),(r=Qs.get(m))&&Vm(s,r),x=c.createElement("script"),cn(x),Un(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function HE(s,r){cr.M(s,r);var c=Ql;if(c&&s){var d=hs(c).hoistableScripts,m=Zl(s),x=d.get(m);x||(x=c.querySelector(Lc(m)),x||(s=P({src:s,async:!0,type:"module"},r),(r=Qs.get(m))&&Vm(s,r),x=c.createElement("script"),cn(x),Un(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function e_(s,r,c,d){var m=(m=ie.current)?Rc(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(c=Wl(c.href),r=hs(m).hoistableStyles,d=r.get(c),d||(d={type:"style",instance:null,count:0,state:null},r.set(c,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Wl(c.href);var x=hs(m).hoistableStyles,w=x.get(s);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,w),(x=m.querySelector(Oc(s)))?x._p||(w.instance=x,w.state.loading=5):(x=Qs.get(s),x||(x={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Qs.set(s,x)),qE(m,s,x,w.state))),r&&d===null)throw Error(i(528,""));return w}if(r&&d!==null)throw Error(i(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(c=Zl(c),r=hs(m).hoistableScripts,d=r.get(c),d||(d={type:"script",instance:null,count:0,state:null},r.set(c,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Wl(s){return'href="'+fs(s)+'"'}function Oc(s){return'link[rel="stylesheet"]['+s+"]"}function t_(s){return P({},s,{"data-precedence":s.precedence,precedence:null})}function qE(s,r,c,d){if(r=s.querySelector('link[rel="preload"][as="style"]['+r+"]")){if(r[pl]!==!0){d.loading=1;return}}else r=s.createElement("link"),r[pl]=!0,r.onload=r.onerror=Ns.bind(null,r),Un(r,"link",c),cn(r),s.head.appendChild(r);d.preload=r,r.addEventListener("load",function(){return d.loading|=1}),r.addEventListener("error",function(){return d.loading|=2})}function Zl(s){return'[src="'+fs(s)+'"]'}function Lc(s){return"script[async]"+s}function n_(s,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var d=s.querySelector('style[data-href~="'+fs(c.href)+'"]');if(d)return r.instance=d,cn(d),d;var m=P({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),cn(d),Un(d,"style",m),Zd(d,c.precedence,s),r.instance=d;case"stylesheet":m=Wl(c.href);var x=s.querySelector(Oc(m));if(x)return r.state.loading|=4,r.instance=x,cn(x),x;d=t_(c),(m=Qs.get(m))&&qm(d,m),x=(s.ownerDocument||s).createElement("link"),cn(x);var w=x;return w._p=new Promise(function(M,F){w.onload=M,w.onerror=F}),Un(x,"link",d),r.state.loading|=4,Zd(x,c.precedence,s),r.instance=x;case"script":return x=Zl(c.src),(m=s.querySelector(Lc(x)))?(r.instance=m,cn(m),m):(d=c,(m=Qs.get(x))&&(d=P({},c),Vm(d,m)),s=s.ownerDocument||s,m=s.createElement("script"),cn(m),Un(m,"link",d),s.head.appendChild(m),r.instance=m);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(d=r.instance,r.state.loading|=4,Zd(d,c.precedence,s));return r.instance}function Zd(s,r,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var M=d[w];if(M.dataset.precedence===r)x=M;else if(x!==m)break}x?x.parentNode.insertBefore(s,x.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(s,r.firstChild))}function qm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Vm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var Kd=null;function s_(s,r,c){if(Kd===null){var d=new Map,m=Kd=new Map;m.set(c,d)}else m=Kd,d=m.get(c),d||(d=new Map,m.set(c,d));if(d.has(s))return d;for(d.set(s,null),c=c.getElementsByTagName(s),m=0;m<c.length;m++){var x=c[m];if(!(x[ka]||x[mn]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(r)||"";w=s+w;var M=d.get(w);M?M.push(x):d.set(w,[x])}}return d}function Gm(s,r,c){s=s.ownerDocument||s,s.head.insertBefore(c,r==="title"?s.querySelector("head > title"):null)}function VE(s,r,c){if(c===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function i_(s,r){return s==="img"&&r.src!=null&&r.src!==""&&r.onLoad==null&&r.loading!=="lazy"}function r_(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function a_(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function l_(s,r){typeof r.decode=="function"&&(s.imgCount++,r.complete||(s.imgBytes+=a_(r),s.suspenseyImages.push(r)),s=XE.bind(s),r.decode().then(s,s))}function GE(s,r,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=Wl(d.href),x=r.querySelector(Oc(m));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Dc.bind(s),r.then(s,s)),c.state.loading|=4,c.instance=x,cn(x);return}x=r.ownerDocument||r,d=t_(d),(m=Qs.get(m))&&qm(d,m),x=x.createElement("link"),cn(x);var w=x;w._p=new Promise(function(M,F){w.onload=M,w.onerror=F}),Un(x,"link",d),c.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=Dc.bind(s),r.addEventListener("load",c),r.addEventListener("error",c))}}var Jd=0;function YE(s,r){return s.stylesheets&&s.count===0&&th(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var d=setTimeout(function(){if(s.stylesheets&&th(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+r);0<s.imgBytes&&Jd===0&&(Jd=62500*dE());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&th(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>Jd?50:800)+r);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function o_(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)th(s,s.stylesheets);else if(s.unsuspend){var r=s.unsuspend;s.unsuspend=null,r()}}}function Dc(){this.count--,o_(this)}function XE(){this.imgCount--,o_(this)}var eh=null;function th(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,eh=new Map,r.forEach(QE,s),eh=null,Dc.call(s))}function QE(s,r){if(!(r.state.loading&4)){var c=eh.get(s);if(c)var d=c.get(null);else{c=new Map,eh.set(s,c);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(c.set(w.dataset.precedence,w),d=w)}d&&c.set(null,d)}m=r.instance,w=m.getAttribute("data-precedence"),x=c.get(w)||d,x===d&&c.set(null,m),c.set(w,m),this.count++,d=Dc.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),r.state.loading|=4}}var Kl={$$typeof:V,Provider:null,Consumer:null,_currentValue:Ft,_currentValue2:Ft,_threadCount:0};function WE(s,r,c,d,m,x,w,M,F){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Yi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yi(0),this.hiddenUpdates=Yi(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.transitionTypes=null,this.incompleteTransitions=new Map}function c_(s,r,c,d,m,x,w,M,F,ee,le,pe){return s=new WE(s,r,c,w,F,ee,le,pe,M),r=1,x===!0&&(r|=24),x=ps(3,null,null,r),s.current=x,x.stateNode=s,r=lp(),r.refCount++,s.pooledCache=r,r.refCount++,x.memoizedState={element:d,isDehydrated:c,cache:r},dp(x),s}function u_(s){return s?(s=kl,s):kl}function d_(s,r,c,d,m,x){m=u_(m),d.context===null?d.context=m:d.pendingContext=m,d=Pr(r),d.payload={element:c},x=x===void 0?null:x,x!==null&&(d.callback=x),c=Br(s,d,r),c!==null&&(vs(c,s,r),hc(c,s,r))}function h_(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<r?c:r}}function Ym(s,r){h_(s,r),(s=s.alternate)&&h_(s,r)}function f_(s){if(s.tag===13||s.tag===31){var r=Ma(s,67108864);r!==null&&vs(r,s,67108864),Ym(s,67108864)}}function p_(s){if(s.tag===13||s.tag===31){var r=Ds();r=Io(r);var c=Ma(s,r);c!==null&&vs(c,s,r),Ym(s,r)}}var Jl=!0;function ZE(s,r,c,d){var m=Te.T;Te.T=null;var x=Re.p;try{Re.p=2,Xm(s,r,c,d)}finally{Re.p=x,Te.T=m}}function KE(s,r,c,d){var m=Te.T;Te.T=null;var x=Re.p;try{Re.p=8,Xm(s,r,c,d)}finally{Re.p=x,Te.T=m}}function Xm(s,r,c,d){if(Jl){var m=Qm(d);if(m===null)Tm(s,r,d,nh,c),g_(s,d);else if(e4(m,s,r,c,d))d.stopPropagation();else if(g_(s,d),r&4&&-1<JE.indexOf(s)){for(;m!==null;){var x=Ni(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=Dn(x.pendingLanes);if(w!==0){var M=x;for(M.pendingLanes|=2,M.entangledLanes|=2;w;){var F=1<<31-tn(w);M.entanglements[1]|=F,w&=~F}zi(x),(Nt&6)===0&&(Id=Ut()+500,Ec(0))}}break;case 31:case 13:M=Ma(x,2),M!==null&&vs(M,x,2),qd(),Ym(x,2)}if(x=Qm(d),x===null&&Tm(s,r,d,nh,c),x===m)break;m=x}m!==null&&d.stopPropagation()}else Tm(s,r,d,null,c)}}function Qm(s){return s=bl(s),Wm(s)}var nh=null;function Wm(s){if(nh=null,s=Xi(s),s!==null){var r=o(s);if(r===null)s=null;else{var c=r.tag;if(c===13){if(s=u(r),s!==null)return s;s=null}else if(c===31){if(s=h(r),s!==null)return s;s=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return nh=s,null}function m_(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Jt()){case hn:return 2;case en:return 8;case yi:case _i:return 32;case kr:return 268435456;default:return 32}default:return 32}}var Zm=!1,Zr=null,Kr=null,Jr=null,zc=new Map,$c=new Map,ea=[],JE="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function g_(s,r){switch(s){case"focusin":case"focusout":Zr=null;break;case"dragenter":case"dragleave":Kr=null;break;case"mouseover":case"mouseout":Jr=null;break;case"pointerover":case"pointerout":zc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":$c.delete(r.pointerId)}}function Pc(s,r,c,d,m,x){return s===null||s.nativeEvent!==x?(s={blockedOn:r,domEventName:c,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},r!==null&&(r=Ni(r),r!==null&&f_(r)),s):(s.eventSystemFlags|=d,r=s.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),s)}function e4(s,r,c,d,m){switch(r){case"focusin":return Zr=Pc(Zr,s,r,c,d,m),!0;case"dragenter":return Kr=Pc(Kr,s,r,c,d,m),!0;case"mouseover":return Jr=Pc(Jr,s,r,c,d,m),!0;case"pointerover":var x=m.pointerId;return zc.set(x,Pc(zc.get(x)||null,s,r,c,d,m)),!0;case"gotpointercapture":return x=m.pointerId,$c.set(x,Pc($c.get(x)||null,s,r,c,d,m)),!0}return!1}function x_(s){var r=Xi(s.target);if(r!==null){var c=o(r);if(c!==null){if(r=c.tag,r===13){if(r=u(c),r!==null){s.blockedOn=r,ds(s.priority,function(){p_(c)});return}}else if(r===31){if(r=h(c),r!==null){s.blockedOn=r,ds(s.priority,function(){p_(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function sh(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var c=Qm(s.nativeEvent);if(c===null){c=s.nativeEvent;var d=new c.constructor(c.type,c);Er=d,c.target.dispatchEvent(d),Er=null}else return r=Ni(c),r!==null&&f_(r),s.blockedOn=c,!1;r.shift()}return!0}function v_(s,r,c){sh(s)&&c.delete(r)}function t4(){Zm=!1,Zr!==null&&sh(Zr)&&(Zr=null),Kr!==null&&sh(Kr)&&(Kr=null),Jr!==null&&sh(Jr)&&(Jr=null),zc.forEach(v_),$c.forEach(v_)}function ih(s,r){s.blockedOn===r&&(s.blockedOn=null,Zm||(Zm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,t4)))}var rh=null;function b_(s){rh!==s&&(rh=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){rh===s&&(rh=null);for(var r=0;r<s.length;r+=3){var c=s[r],d=s[r+1],m=s[r+2];if(typeof d!="function"){if(Wm(d||c)===null)continue;break}var x=Ni(c);x!==null&&(s.splice(r,3),r-=3,Rp(x,{pending:!0,data:m,method:c.method,action:d},d,m))}}))}function eo(s){function r(F){return ih(F,s)}Zr!==null&&ih(Zr,s),Kr!==null&&ih(Kr,s),Jr!==null&&ih(Jr,s),zc.forEach(r),$c.forEach(r);for(var c=0;c<ea.length;c++){var d=ea[c];d.blockedOn===s&&(d.blockedOn=null)}for(;0<ea.length&&(c=ea[0],c.blockedOn===null);)x_(c),c.blockedOn===null&&ea.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var m=c[d],x=c[d+1],w=m[Tn]||null;if(typeof x=="function")w||b_(c);else if(w){var M=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[Tn]||null)M=w.formAction;else if(Wm(m)!==null)continue}else M=w.action;typeof M=="function"?c[d+1]=M:(c.splice(d,3),d-=3),b_(c)}}}function y_(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),m!==null&&(m(),m=null)}}}function Km(s){this._internalRoot=s}ah.prototype.render=Km.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var c=r.current,d=Ds();d_(c,d,s,r,null,null)},ah.prototype.unmount=Km.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;d_(s.current,2,null,s,null,null),qd(),r[ji]=null}};function ah(s){this._internalRoot=s}ah.prototype.unstable_scheduleHydration=function(s){if(s){var r=Sa();s={blockedOn:null,target:s,priority:r};for(var c=0;c<ea.length&&r!==0&&r<ea[c].priority;c++);ea.splice(c,0,s),c===0&&x_(s)}};var __=t.version;if(__!=="19.3.0")throw Error(i(527,__,"19.3.0"));Re.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=p(r),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var n4={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:Te,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lh.isDisabled&&lh.supportsFiber)try{Ln=lh.inject(n4),fn=lh}catch{}}return Fc.createRoot=function(s,r){if(!a(s))throw Error(i(299));var c=!1,d="",m=ub,x=db,w=hb;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=c_(s,1,!1,null,null,c,d,null,m,x,w,y_),s[ji]=r.current,Em(s),new Km(r)},Fc.hydrateRoot=function(s,r,c){if(!a(s))throw Error(i(299));var d=!1,m="",x=ub,w=db,M=hb,F=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(M=c.onRecoverableError),c.formState!==void 0&&(F=c.formState)),r=c_(s,1,!0,r,c??null,d,m,F,x,w,M,y_),r.context=u_(null),c=r.current,d=Ds(),d=Io(d),m=Pr(d),m.callback=null,Br(c,m,d),c=d,r.current.lanes=c,Si(r,c),zi(r),s[ji]=r.current,Em(s),new ah(r)},Fc.version="19.3.0",Fc}var O_;function m4(){if(O_)return tg.exports;O_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),tg.exports=p4(),tg.exports}var g4=m4();const L_=e=>{let t;const n=new Set,i=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const b=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(y=>y(t,b))}},a=()=>t,h={setState:i,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(i,a,h);return h},x4=(e=>e?L_(e):L_),v4=e=>e;function b4(e,t=v4){const n=oh.useSyncExternalStore(e.subscribe,oh.useCallback(()=>t(e.getState()),[e,t]),oh.useCallback(()=>t(e.getInitialState()),[e,t]));return oh.useDebugValue(n),n}const D_=e=>{const t=x4(e),n=i=>b4(t,i);return Object.assign(n,t),n},y4=(e=>e?D_(e):D_),b0="companion_auth_token";function z_(){return typeof window>"u"?null:localStorage.getItem(b0)||null}const _4=e=>({authToken:z_(),isAuthenticated:z_()!==null,setAuthToken:t=>{localStorage.setItem(b0,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(b0),e({authToken:null,isAuthenticated:!1})}});function Gt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function w4(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function S4(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function k4(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function j4(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const N4=e=>({sessions:new Map,sdkSessions:[],currentSessionId:k4(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:S4(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:j4(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const i=Gt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Gt(n.sessions,t),connectionStatus:Gt(n.connectionStatus,t),cliConnected:Gt(n.cliConnected,t),cliReconnecting:Gt(n.cliReconnecting,t),sessionStatus:Gt(n.sessionStatus,t),previousPermissionMode:Gt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:w4(n.recentlyRenamed,t),mcpServers:Gt(n.mcpServers,t),rateLimit:Gt(n.rateLimit,t),prStatus:Gt(n.prStatus,t),linkedLinearIssues:Gt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Gt(n.messages,t),streaming:Gt(n.streaming,t),streamingStartedAt:Gt(n.streamingStartedAt,t),streamingOutputTokens:Gt(n.streamingOutputTokens,t),pendingPermissions:Gt(n.pendingPermissions,t),aiResolvedPermissions:Gt(n.aiResolvedPermissions,t),sessionTasks:Gt(n.sessionTasks,t),changedFilesTick:Gt(n.changedFilesTick,t),gitChangedFilesCount:Gt(n.gitChangedFilesCount,t),sessionProcesses:Gt(n.sessionProcesses,t),toolProgress:Gt(n.toolProgress,t),toolActivity:Gt(n.toolActivity,t),diffPanelSelectedFile:Gt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Gt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const a=new Map(i.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(i=>{const a=new Map(i.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(i=>{const a=new Map(i.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(i=>{const a=new Map(i.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(i=>{const a=new Map(i.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(i=>{const a=new Map(i.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const a=new Map(i.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(i=>{const a=new Map(i.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(i=>{const a=new Map(i.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(i=>{const a=new Map(i.rateLimit);return a.set(t,n),{rateLimit:a}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,magicUiActive:n}),{sessions:a}):{}})}),C4=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const o=new Map(i.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),o=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),E4=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),T4=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const a=new Map(i.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(h=>h.id===n?{...h,...i}:h)),{sessionTasks:o}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.taskId===n?{...h,...i}:h)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionBackgroundAgents:o}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,i),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(h=>h.toolUseId===n.toolUseId);if(u>=0){const h=o[u];o[u]={...h,...n,startedAt:h.startedAt,completedAt:n.completedAt??h.completedAt,elapsedSeconds:Math.max(h.elapsedSeconds,n.elapsedSeconds),isError:h.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{toolActivity:o}})}),yr=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"server-disk",label:"Server Disk",description:"Free space on the Companion data volume",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],M4=yr.map(e=>e.id),iS="cc-task-panel-config";function y0(){return{order:[...M4],enabled:Object.fromEntries(yr.map(e=>[e.id,!0]))}}function A4(){if(typeof window>"u")return y0();try{const e=localStorage.getItem(iS);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of yr)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(yr.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return y0()}function ch(e){try{localStorage.setItem(iS,JSON.stringify(e))}catch{}}function R4(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-dark-mode");return e!==null?e==="true":window.matchMedia("(prefers-color-scheme: dark)").matches}function O4(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function L4(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function rS(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}function D4(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const z4=e=>({darkMode:R4(),notificationSound:O4(),notificationDesktop:L4(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:A4(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:rS(),density:D4(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setMagicUiAvailable:t=>e({magicUiAvailable:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return ch(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<=0)return n;[i[a-1],i[a]]=[i[a],i[a-1]];const o={...n.taskPanelConfig,order:i};return ch(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const o={...n.taskPanelConfig,order:i};return ch(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=y0();ch(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),a=(i.get(t)??0)+1;return i.set(t,a),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const a=new Map(i.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})},setDensity:t=>{typeof window<"u"&&localStorage.setItem("cc-density",t),e({density:t})},toggleDensity:()=>e(t=>{const n=t.density==="compact"?"standard":"compact";return typeof window<"u"&&localStorage.setItem("cc-density",n),{density:n}})});function aS(){if(typeof window>"u")return"bottom";const e=window.localStorage.getItem("cc-terminal-placement");return e==="top"||e==="right"||e==="bottom"||e==="left"?e:"bottom"}const $4=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:aS(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const i=t.target==="docker",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=i?a:a+1,h=i?o+1:o,f={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,f],activeQuickTerminalTabId:f.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:h}}),closeQuickTerminalTab:t=>e(n=>{var o;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=i[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function P4(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const B4=e=>({updateInfo:null,updateDismissedVersion:P4(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,creationDraft:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],a=i.findIndex(o=>o.step===t.step);if(a>=0){const o=[...i];return o[a]=t,{creationProgress:o}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,creationDraft:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:(t,n)=>e({creationError:t,creationDraft:n??null}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),F4=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(i=>{const a=i.magicUiState.get(t);if(a&&a.version>n.version)return{};const o=new Map(i.magicUiState);return o.set(t,n),{magicUiState:o}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const i=new Map(n.magicUiState);return i.delete(t),{magicUiState:i}})}),W=y4((...e)=>({..._4(...e),...N4(...e),...C4(...e),...E4(...e),...T4(...e),...z4(...e),...$4(...e),...B4(...e),...F4(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,magicUiState:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:rS(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:aS(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),I4=Object.freeze(Object.defineProperty({__proto__:null,useStore:W},Symbol.toStringTag,{value:"Module"})),U4="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",H4=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function q4(e){return H4.test(e)}function V4(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:q4(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const $_=["Swift","Calm","Bold","Bright","Warm","Keen","Vast","Crisp","Agile","Noble","Vivid","Lucid","Brisk","Deft","Fleet","Grand","Lush","Prime","Sage","True","Clear","Deep","Fair","Firm","Glad","Kind","Pure","Rich","Safe","Wise","Fresh","Sharp","Steady","Quick","Gentle","Silent","Golden","Radiant","Serene","Verdant"],P_=["Falcon","River","Cedar","Stone","Ember","Frost","Bloom","Ridge","Crane","Birch","Coral","Dawn","Flint","Grove","Heron","Lark","Maple","Opal","Pearl","Quartz","Reef","Sage","Tide","Vale","Wren","Aspen","Brook","Cliff","Delta","Eagle","Fern","Harbor","Iris","Jade","Lotus","Mesa","Nova","Orbit","Pebble","Summit"];function B_(){const e=$_[Math.floor(Math.random()*$_.length)],t=P_[Math.floor(Math.random()*P_.length)];return`${e} ${t}`}function lS(e){for(let t=0;t<100;t++){const n=B_();if(!e.has(n))return n}return B_()}let rg=null;function G4(){return rg||(rg=new AudioContext),rg}function Y4(){try{const e=G4();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class oS{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const o=this.castInput(t,i),u=this.castInput(n,i),h=this.removeEmpty(this.tokenize(o,i)),f=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(h,f,i,a)}diffWithOptionsObj(t,n,i,a){var o;const u=C=>{if(C=this.postProcess(C,i),a){setTimeout(function(){a(C)},0);return}else return C},h=n.length,f=t.length;let p=1,g=h+f;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const v=(o=i.timeout)!==null&&o!==void 0?o:1/0,b=Date.now()+v,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=f&&_+1>=h)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const S=()=>{for(let C=Math.max(j,-p);C<=Math.min(N,p);C+=2){let E;const R=y[C-1],A=y[C+1];R&&(y[C-1]=void 0);let O=!1;if(A){const z=A.oldPos-C;O=A&&0<=z&&z<h}const P=R&&R.oldPos+1<f;if(!O&&!P){y[C]=void 0;continue}if(!P||O&&R.oldPos<A.oldPos?E=this.addToPath(A,!0,!1,0,i):E=this.addToPath(R,!1,!0,1,i),_=this.extractCommon(E,n,t,C,i),E.oldPos+1>=f&&_+1>=h)return u(this.buildValues(E.lastComponent,n,t))||!0;y[C]=E,E.oldPos+1>=f&&(N=Math.min(N,C-1)),_+1>=h&&(j=Math.max(j,C+1))}p++};if(a)(function C(){setTimeout(function(){if(p>g||Date.now()>b)return a(void 0);S()||C()},0)})();else for(;p<=g&&Date.now()<=b;){const C=S();if(C)return C}}addToPath(t,n,i,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,o){const u=n.length,h=i.length;let f=t.oldPos,p=f-a,g=0;for(;p+1<u&&f+1<h&&this.equals(i[f+1],n[p+1],o);)p++,f++,g++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!o.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=f,p}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let h=0,f=0,p=0;for(;h<u;h++){const g=a[h];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(f,f+g.count);v=v.map(function(b,y){const _=i[p+y];return _.length>b.length?_:b}),g.value=this.join(v)}else g.value=this.join(n.slice(f,f+g.count));f+=g.count,g.added||(p+=g.count)}}return a}}function F_(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function I_(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function _0(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function w0(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Ic(e,t){return _0(e,t,"")}function uh(e,t){return w0(e,t,"")}function U_(e,t){return t.slice(0,X4(e,t))}function X4(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const a=Array(i);let o=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function cS(e,t){const n=[];for(const i of Array.from(t.segment(e))){const a=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function S0(e,t){if(t)return au(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ho(e,t){if(t)return au(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function au(e,t){if(!t)return[ho(e),S0(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=cS(e,t),i=n[0],a=n[n.length-1],o=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[o,u]}const H_="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Q4=new RegExp(`[${H_}]+|\\s+|[^${H_}]`,"ug");class W4 extends oS{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=cS(t,u)}else i=t.match(Q4)||[];const a=[];let o=null;return i.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&q_(i,o,a,u,n.intlSegmenter),i=u,a=null,o=null)}),(a||o)&&q_(i,o,a,null,n.intlSegmenter),t}}const Z4=new W4;function K4(e,t,n){return Z4.diff(e,t,n)}function q_(e,t,n,i,a){if(t&&n){const[o,u]=au(t.value,a),[h,f]=au(n.value,a);if(e){const p=F_(o,h);e.value=w0(e.value,h,p),t.value=Ic(t.value,p),n.value=Ic(n.value,p)}if(i){const p=I_(u,f);i.value=_0(i.value,f,p),t.value=uh(t.value,p),n.value=uh(n.value,p)}}else if(n){if(e){const o=ho(n.value,a);n.value=n.value.substring(o.length)}if(i){const o=ho(i.value,a);i.value=i.value.substring(o.length)}}else if(e&&i){const o=ho(i.value,a),[u,h]=au(t.value,a),f=F_(o,u);t.value=Ic(t.value,f);const p=I_(Ic(o,f),h);t.value=uh(t.value,p),i.value=_0(i.value,o,p),e.value=w0(e.value,o,o.slice(0,o.length-p.length))}else if(i){const o=ho(i.value,a),u=S0(t.value,a),h=U_(u,o);t.value=uh(t.value,h)}else if(e){const o=S0(e.value,a),u=ho(t.value,a),h=U_(o,u);t.value=Ic(t.value,h)}}class J4 extends oS{constructor(){super(...arguments),this.tokenize=tT}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
51
|
+
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
52
|
+
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
53
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
54
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const eT=new J4;function V_(e,t,n){return eT.diff(e,t,n)}function tT(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
55
|
+
`));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let a=0;a<i.length;a++){const o=i[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function nT(e,t,n,i,a,o,u){let h;u?typeof u=="function"?h={callback:u}:h=u:h={},typeof h.context>"u"&&(h.context=4);const f=h.context;if(h.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(h.callback){const{callback:g}=h;V_(n,i,Object.assign(Object.assign({},h),{callback:v=>{const b=p(v);g(b)}}))}else return p(V_(n,i,h));function p(g){if(!g)return;g.push({value:"",lines:[]});function v(C){return C.map(function(E){return" "+E})}const b=[];let y=0,_=0,j=[],N=1,S=1;for(let C=0;C<g.length;C++){const E=g[C],R=E.lines||sT(E.value);if(E.lines=R,E.added||E.removed){if(!y){const A=g[C-1];y=N,_=S,A&&(j=f>0?v(A.lines.slice(-f)):[],y-=j.length,_-=j.length)}for(const A of R)j.push((E.added?"+":"-")+A);E.added?S+=R.length:N+=R.length}else{if(y)if(R.length<=f*2&&C<g.length-2)for(const A of v(R))j.push(A);else{const A=Math.min(R.length,f);for(const P of v(R.slice(0,A)))j.push(P);const O={oldStart:y,oldLines:N-y+A,newStart:_,newLines:S-_+A,lines:j};b.push(O),y=0,_=0,j=[]}N+=R.length,S+=R.length}}for(const C of b)for(let E=0;E<C.lines.length;E++)C.lines[E].endsWith(`
|
|
56
|
+
`)?C.lines[E]=C.lines[E].slice(0,-1):(C.lines.splice(E+1,0,"\"),E++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:o,hunks:b}}}function sT(e){const t=e.endsWith(`
|
|
57
|
+
`),n=e.split(`
|
|
58
|
+
`).map(i=>i+`
|
|
59
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function iT(e,t){return nT("","",e,t,"","",{context:3}).hunks.map(i=>{const a=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,o=[];let u=i.oldStart,h=i.newStart;for(const f of i.lines){const p=f[0],g=f.slice(1);p==="-"?o.push({type:"del",content:g,oldLineNo:u++}):p==="+"?o.push({type:"add",content:g,newLineNo:h++}):o.push({type:"context",content:g,oldLineNo:u++,newLineNo:h++})}return uS(o),{header:a,lines:o}})}function rT(e){const t=[],n=e.split(`
|
|
60
|
+
`);let i=null,a=null,o=0,u=0;for(const h of n){if(h.startsWith("diff --git")||h.startsWith("diff --cc")){a&&i&&i.hunks.push(a),i&&t.push(i),i={fileName:"",hunks:[]},a=null;continue}if(h.startsWith("--- a/")||h.startsWith("--- /dev/null"))continue;if(h.startsWith("+++ b/")){i&&(i.fileName=h.slice(6));continue}if(h.startsWith("+++ /dev/null")||h.startsWith("index ")||h.startsWith("new file")||h.startsWith("deleted file")||h.startsWith("old mode")||h.startsWith("new mode")||h.startsWith("rename from")||h.startsWith("rename to")||h.startsWith("similarity index")||h.startsWith("Binary files"))continue;const f=h.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(f){a&&i&&i.hunks.push(a),o=parseInt(f[1],10),u=parseInt(f[2],10),a={header:h,lines:[]};continue}a&&(h.startsWith("+")?a.lines.push({type:"add",content:h.slice(1),newLineNo:u++}):h.startsWith("-")?a.lines.push({type:"del",content:h.slice(1),oldLineNo:o++}):h.startsWith(" ")&&a.lines.push({type:"context",content:h.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&i&&i.hunks.push(a),i&&t.push(i);for(const h of t)for(const f of h.hunks)uS(f.lines);return t}function uS(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=i-n,h=o-a;if(u>0&&h>0){const f=Math.min(u,h);for(let p=0;p<f;p++){const g=e[n+p],v=e[a+p],b=K4(g.content,v.content);g.wordChanges=b.filter(y=>!y.added).map(y=>({value:y.value,removed:y.removed})),v.wordChanges=b.filter(y=>!y.removed).map(y=>({value:y.value,added:y.added}))}}t===n&&t++}}function aT({line:e}){return e.wordChanges?l.jsx(l.Fragment,{children:e.wordChanges.map((t,n)=>t.added?l.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?l.jsx("span",{className:"diff-word-del",children:t.value},n):l.jsx("span",{children:t.value},n))}):l.jsx(l.Fragment,{children:e.content})}function lT({hunk:e,showLineNumbers:t}){return l.jsxs("div",{className:"diff-hunk",children:[l.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>l.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),l.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),l.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),l.jsxs("span",{className:"diff-content",children:[l.jsx(aT,{line:n}),!n.content&&" "]})]},i))]})}function oT({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return l.jsxs("div",{className:"diff-file-header",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&l.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function Oo({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:a="compact"}){const o=a==="compact",u=!o,h=k.useMemo(()=>{if(n)return rT(n);const f=e??"",p=t??"";if(!f&&!p)return[];const g=iT(f,p);return[{fileName:i||"",hunks:g}]},[e,t,n,i]);return h.length===0||h.every(f=>f.hunks.length===0)?l.jsx("div",{className:"diff-viewer diff-empty",children:l.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):l.jsx("div",{className:`diff-viewer ${o?"diff-compact":"diff-full"}`,children:h.map((f,p)=>l.jsxs("div",{className:"diff-file",children:[(f.fileName||i)&&l.jsx(oT,{fileName:f.fileName||i||""}),f.hunks.map((g,v)=>l.jsx(lT,{hunk:g,showLineNumbers:u},v))]},p))})}const dS=k.createContext(null);function oF({value:e,children:t}){return l.jsx(dS.Provider,{value:e,children:t})}function cT(){const e=k.useContext(dS),t=W(n=>n.density);return e??t}function va(){return cT()==="compact"}function _f({open:e,onToggle:t,marker:n,label:i,meta:a,labelClassName:o=""}){return l.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${e?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),n&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-muted/40 select-none shrink-0",children:n}),l.jsx("span",{className:`text-[11px] text-cc-muted/60 group-hover:text-cc-muted truncate min-w-0 ${o}`,children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const uT={Bash:"terminal",Read:"file",Write:"file-plus",Edit:"file-edit",Glob:"search",Grep:"search",WebFetch:"globe",WebSearch:"globe",NotebookEdit:"notebook",Task:"agent",TodoWrite:"checklist",TaskCreate:"list",TaskUpdate:"list",SendMessage:"message",web_search:"globe",mcp_tool_call:"tool"};function Lo(e){return uT[e]||"tool"}function Hi(e){return e==="Bash"?"Terminal":e==="Read"?"Read File":e==="Write"?"Write File":e==="Edit"?"Edit File":e==="Glob"?"Find Files":e==="Grep"?"Search Content":e==="WebSearch"?"Web Search":e==="WebFetch"?"Web Fetch":e==="Task"?"Subagent":e==="TodoWrite"?"Tasks":e==="NotebookEdit"?"Notebook":e==="SendMessage"?"Message":e==="web_search"?"Web Search":e==="mcp_tool_call"?"MCP Tool":e.startsWith("mcp:")?e.split(":").slice(1).join(":"):e}function hS({name:e,input:t,toolUseId:n}){const[i,a]=k.useState(e==="Edit"),o=Lo(e),u=Hi(e),h=wo(e,t);return e==="Edit"?l.jsx(dT,{input:t,toolUseId:n}):e==="Bash"?l.jsx(hT,{input:t,toolUseId:n}):l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[l.jsxs("button",{onClick:()=>a(!i),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ol,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),h&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:h})]}),i&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:l.jsx("div",{className:"mt-2",children:l.jsx(fT,{name:e,input:t})})})]})}function dT({input:e,toolUseId:t}){const n=va(),[i,a]=k.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",h=String(e.old_string||""),f=String(e.new_string||""),p=!!(h||f),g=!!e.replace_all,[v,b]=k.useState(!1),_=(Array.isArray(e.changes)?e.changes:[]).map(C=>({path:typeof C.path=="string"?C.path:"",kind:typeof C.kind=="string"?C.kind:"update"})).filter(C=>C.path),j=(h+f).split(`
|
|
61
|
+
`).length,N=j>15,S=l.jsx(l.Fragment,{children:p?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${N&&!v?"max-h-[240px]":""}`,children:l.jsx(Oo,{oldText:h,newText:f,mode:"compact"})}),N&&!v&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),N&&l.jsx("button",{type:"button",onClick:()=>b(!v),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:v?"Show less":`Show all ${j} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((C,E)=>{const R=C.path.split("/").pop()||C.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${C.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":C.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:C.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:R})]},`${C.path}-${E}`)})}):l.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})});return n?l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(_f,{open:i,onToggle:()=>a(!i),marker:"±",label:`Edit ${u||"file"}${g?" (all)":""}`,meta:p?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),i&&l.jsx("div",{className:"mt-0.5",children:S})]}):l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),u&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:u}),g&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),S]})}function hT({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=va(),[o,u]=k.useState(!1);if(a){const h=n.split(`
|
|
62
|
+
`)[0]||"",f=i||h||"Command",p=n?n.split(`
|
|
63
|
+
`).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(_f,{open:o,onToggle:()=>u(!o),marker:"$",label:f,meta:!o&&p>0?`+${p}`:void 0,labelClassName:i?"italic":"font-mono-code"}),o&&l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 mt-1 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}return l.jsxs("div",{"data-tool-use-id":t,children:[i&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function fT({name:e,input:t}){switch(e){case"Bash":return l.jsx(pT,{input:t});case"Edit":return l.jsx(mT,{input:t});case"Write":return l.jsx(gT,{input:t});case"Read":return l.jsx(xT,{input:t});case"Glob":return l.jsx(vT,{input:t});case"Grep":return l.jsx(bT,{input:t});case"WebSearch":case"web_search":return l.jsx(yT,{input:t});case"WebFetch":return l.jsx(_T,{input:t});case"Task":return l.jsx(wT,{input:t});case"TodoWrite":return l.jsx(ST,{input:t});case"NotebookEdit":return l.jsx(kT,{input:t});case"SendMessage":return l.jsx(jT,{input:t});default:return l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(t,null,2)})}}function pT({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),l.jsxs("pre",{className:"px-3 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function mT({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),o=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?l.jsx(Oo,{oldText:n,newText:i,fileName:t,mode:"compact"}):o.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),o.map((u,h)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${h}`))]}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function gT({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Oo,{newText:n,fileName:t,mode:"compact"})}function xT({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),i!=null&&l.jsxs("span",{children:["limit: ",i]})]})]})}function vT({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function bT({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code overflow-x-auto",children:String(e.pattern||"")}),l.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&l.jsxs("span",{children:["path: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&l.jsxs("span",{children:["glob: ",l.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&l.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&l.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&l.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function yT({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function _T({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.url&&l.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&l.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function wT({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary",children:String(e.subagent_type)}),!!e.prompt&&l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-40 overflow-y-auto",children:String(e.prompt)})]})}function ST({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function kT({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),i&&l.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function jT({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&l.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",l.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&l.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function wo(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),i=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+i;return a.length>60?a.slice(0,60)+"...":a}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function ol({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("polyline",{points:"3 11 6 8 3 5"}),l.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"7",cy:"7",r:"4"}),l.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M2 8h12M8 2c2 2 3 4 3 6s-1 4-3 6c-2-2-3-4-3-6s1-4 3-6z"})]}):e==="message"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"5",r:"3"}),l.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),l.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const NT=2e3,fS=6,CT=new Set(["assistant","stream_event","result","tool_progress","tool_use_summary","status_change","system_event","permission_request","permission_auto_resolved","streamlined_text","streamlined_tool_use_summary"]),gi=new Map,br=new Map,Hh=new Map,Ah=new Map,la=new Map,lu=new Map,Su=new Map,qh=new Map;function pS(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function kx(e){return!e.archived&&e.state!=="exited"}function jx(e){const t=W.getState();if(t.currentSessionId===e)return!0;const n=t.sdkSessions.find(i=>i.sessionId===e);return n?kx(n):!1}function ET(){const e=W.getState(),t=new Set;e.currentSessionId&&t.add(e.currentSessionId);for(const n of e.sdkSessions)kx(n)&&t.add(n.sessionId);return Array.from(t)}const So=[];function mS(){let e=0;for(const t of gi.values())t.readyState===WebSocket.CONNECTING&&e++;return e}function gS(e){const t=So.indexOf(e);t>=0&&So.splice(t,1)}function G_(){if(!ko)for(;So.length>0&&mS()<fS;){const e=So.shift();jx(e)&&Do(e)}}let ko=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){ko=!0;for(const[e,t]of br)clearTimeout(t),br.delete(e)}else{ko=!1;for(const e of ET()){if(!jx(e))continue;const t=gi.get(e);if(!pS(t)){if(t){try{t.close()}catch{}gi.delete(e)}Do(e)}}}});function Rh(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const a of n)if(!(!a||a===".")){if(a===".."){i.length>0&&i.pop();continue}i.push(a)}return`${t?"/":""}${i.join("/")}`}function TT(e,t){return e.startsWith("/")||!t?Rh(e):Rh(`${t}/${e}`)}function MT(e,t){if(!t)return!0;const n=Rh(t);return e===n||e.startsWith(`${n}/`)}function AT(e){let t=qh.get(e);return t||(t=new Set,qh.set(e,t)),t}function ag(e,t){const n=W.getState(),i=AT(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:h}=a;if(h){if(i.has(h))continue;i.add(h)}if(o==="TodoWrite"){const f=u.todos;if(Array.isArray(f)){const p=f.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),Ah.set(e,p.length)}continue}if(o==="TaskCreate"){const f=(Ah.get(e)||0)+1;Ah.set(e,f);const p={id:String(f),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const f=u.taskId;if(f){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,f,p)}}}}function lg(e,t){var o,u;const n=W.getState(),i=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(h=>h.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const h of t){if(h.type!=="tool_use")continue;const{name:f,input:p}=h;if((f==="Edit"||f==="Write")&&typeof p.file_path=="string"){const g=TT(p.file_path,i);MT(g,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const tu=new Map,RT=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function og(e,t){const n=W.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const a=i.input;if(a.run_in_background===!0){let o=tu.get(e);o||(o=new Map,tu.set(e,o)),o.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,o=tu.get(e),u=o==null?void 0:o.get(a);if(o&&u){const f=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(RT);if(f){const p={taskId:f[1],toolUseId:a,command:u.command,description:u.description,outputFile:f[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&tu.delete(e)}}}}const dh=new Map,Vh=new Map;function cg(e,t){const n=W.getState();let i=Vh.get(e);i||(i=new Set,Vh.set(e,i));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&i.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&i.add(a.id);let u=dh.get(e);u||(u=new Map,dh.set(e,u));const h={toolUseId:a.id,name:o.name||o.description||"Background agent",description:o.description||"",agentType:o.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:h.name,description:h.description,agentType:h.agentType,startedAt:h.startedAt}),n.addBackgroundAgent(e,h)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=dh.get(e),h=u==null?void 0:u.get(o);if(u&&h){const f=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(g=>"text"in g?g.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:p?"failed":"completed",completedAt:Date.now(),summary:f.length>200?f.slice(0,200)+"...":f}),u.delete(o),u.size===0&&dh.delete(e)}}}}function Y_(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function X_(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function Q_(e){if(e.subtype==="compact_boundary")return`Context compacted (${e.compact_metadata.trigger}, pre-tokens: ${e.compact_metadata.pre_tokens}).`;if(e.subtype==="task_notification")return`Task ${e.status}: ${e.task_id}.`;if(e.subtype==="files_persisted"){const t=e.files.length,n=e.failed.length;return n>0?`Persisted ${t} file(s), ${n} failed.`:`Persisted ${t} file(s).`}if(e.subtype==="hook_started")return`Hook started: ${e.hook_name} (${e.hook_event}).`;if(e.subtype==="hook_response"){const t=typeof e.exit_code=="number"?` (exit ${e.exit_code})`:"";return`Hook ${e.outcome}: ${e.hook_name} (${e.hook_event})${t}.`}return null}let OT=0,LT=0;function Pi(){return`msg-${Date.now()}-${++OT}`}function W_(e){var n;const t=(n=e.errors)!=null&&n.length?e.errors.join(", "):e.result||(e.api_error_status?`API error ${e.api_error_status}`:"The turn ended with an error but no details were provided.");return V4(e)?`${U4}
|
|
64
|
+
|
|
65
|
+
Details: ${t}`:`Error: ${t}`}function DT(e,t){const n=Su.get(e)||[];n.push(t),Su.set(e,n)}function zT(e,t){const n=Su.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){Su.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const fr=new Map;function Z_(e,t,n){const i=W.getState(),a=i.messages.get(e)||[],o=lu.get(e);let u=a.filter(f=>!f.isStreaming||f.id===o),h=-1;if(o&&(h=u.findIndex(f=>f.id===o),h===-1&&lu.delete(e)),h===-1){const f=`stream-${e}-${Pi()}`;lu.set(e,f),u=[...u,{id:f,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const f=u[h];u[h]={...f,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}i.setMessages(e,u)}function na(e){lu.delete(e);const t=W.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const K_=new Map,$T=8e3;function to(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),a=K_.get(e);a&&a.code===t&&i-a.at<$T||(K_.set(e,{code:t,at:i}),W.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function xS(){return`cmsg-${Date.now()}-${++LT}`}function k0(){return xS()}const PT=new Set(["user_message","permission_response","interrupt","set_model","set_permission_mode","mcp_get_status","mcp_toggle","mcp_reconnect","mcp_set_servers","set_ai_validation","set_magic_ui"]);function BT(e){const t=location.protocol==="https:"?"wss:":"ws:",n=localStorage.getItem("companion_auth_token")||"";return`${t}//${location.host}/ws/browser/${e}?token=${encodeURIComponent(n)}`}function vS(e){return`companion:last-seq:${e}`}function j0(e){const t=Hh.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(vS(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return Hh.set(e,a),a}catch{return 0}}function J_(e,t){const n=Math.max(0,Math.floor(t));Hh.set(e,n);try{localStorage.setItem(vS(e),String(n))}catch{}}function ew(e,t){Xn(e,{type:"session_ack",last_seq:t})}function Oh(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
66
|
+
`)}function ug(e){return e.type==="thinking"?`thinking:${e.thinking}`:e.type==="text"?`text:${e.text}`:e.type==="tool_use"?`tool_use:${e.id}`:e.type==="tool_result"?`tool_result:${e.tool_use_id}`:JSON.stringify(e)}function FT(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const a=new Map;for(const h of i)a.set(ug(h),h);const o=[],u=new Set;for(const h of n){const f=ug(h);u.has(f)||(u.add(f),o.push(a.get(f)||h))}for(const h of i){const f=ug(h);u.has(f)||(u.add(f),o.push(h))}return o}function tw(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:wo(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function N0(e,t){const n=FT(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?Oh(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function IT(e,t){const n=W.getState(),i=n.messages.get(e)||[],a=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...i];o[a]=N0(o[a],t),n.setMessages(e,o)}function UT(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const i=W.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),bS(e,n)}function bS(e,t,n={}){var u,h,f,p,g,v;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,o=W.getState();if(i&&typeof t.seq=="number"){const b=j0(e);if(t.seq<=b)return;J_(e,t.seq),a&&ew(e,t.seq)}switch(CT.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const y=new Set(o.sessionNames.values()),_=lS(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){na(e),o.setStreaming(e,null),to(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Oh(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=Oh(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(na(e),IT(e,_),o.setStreaming(e,null),la.delete(e),fr.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&o.clearToolProgress(e,j.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now()}),(h=b.content)!=null&&h.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,tw(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&o.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(f=b.content)!=null&&f.length&&(ag(e,b.content),lg(e,b.content),og(e,b.content),cg(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(la.delete(e),fr.delete(e),na(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),b.type==="content_block_delta"){const y=b.delta;if((y==null?void 0:y.type)==="text_delta"&&typeof y.text=="string"){const _=fr.get(e)||{thinking:"",text:""};la.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,fr.set(e,_),la.set(e,"text"),o.setStreaming(e,_.text),Z_(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=fr.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,fr.set(e,_),la.set(e,"thinking"),o.setStreaming(e,_.thinking),Z_(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&o.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{qh.delete(e),Vh.delete(e);const b=t.data,y={total_cost_usd:b.total_cost_usd,num_turns:b.num_turns};if(typeof b.total_lines_added=="number"&&(y.total_lines_added=b.total_lines_added),typeof b.total_lines_removed=="number"&&(y.total_lines_removed=b.total_lines_removed),b.modelUsage){for(const _ of Object.values(b.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}o.updateSession(e,y),na(e),o.setStreaming(e,null),la.delete(e),fr.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&Y4(),!document.hasFocus()&&o.notificationDesktop&&Y_("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:Pi(),role:"system",content:W_(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;Y_("Permission needed",`${y.tool_name}: approve or deny`,y.request_id)}const b=t.request;if(b.tool_name&&b.input){const y=[{type:"tool_use",id:b.tool_use_id,name:b.tool_name,input:b.input}];ag(e,y),lg(e,y),og(e,y),cg(e,y)}break}case"permission_cancelled":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:Pi(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||Pi(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&o.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=Q_(t.event);if(!b)break;o.appendMessage(e,{id:Pi(),role:"system",content:b,timestamp:t.timestamp||Date.now(),...X_(t.event)});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:Pi(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:Pi(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),na(e)?to(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):to(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),na(e)&&to(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b==="ready"?o.setSessionStatus(e,"idle"):b==="streaming"?o.setSessionStatus(e,"running"):b==="compacting"?o.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),na(e)?to(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):to(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const b=o.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const b=[],y=new Map;for(let j=0;j<t.messages.length;j++){const N=t.messages[j];if(N.type==="user_message")b.push({id:N.id||Pi(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const S=N.message,C=Oh(S.content),E={id:S.id,role:"assistant",content:C,contentBlocks:S.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:S.model,stopReason:S.stop_reason},R=b.findIndex(A=>A.role==="assistant"&&A.id===E.id);if(R===-1?b.push(E):b[R]=N0(b[R],E),(v=S.content)!=null&&v.length){ag(e,S.content),lg(e,S.content),og(e,S.content),cg(e,S.content);const A=N.timestamp||Date.now();for(const O of S.content){if(O.type==="tool_use"){const P=O.input||{},z=y.get(O.id);y.set(O.id,z??tw(O.id,O.name,P,A,N.parent_tool_use_id))}if(O.type==="tool_result"){const P=y.get(O.tool_use_id);P&&y.set(O.tool_use_id,{...P,completedAt:A,isError:P.isError||!!O.is_error,elapsedSeconds:Math.max(P.elapsedSeconds,P.completedAt?P.elapsedSeconds:Math.max(0,(A-P.startedAt)/1e3))})}}}}else if(N.type==="result"){const S=N.data;S.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:W_(S),timestamp:Date.now()});const C={total_cost_usd:S.total_cost_usd,num_turns:S.num_turns};if(typeof S.total_lines_added=="number"&&(C.total_lines_added=S.total_lines_added),typeof S.total_lines_removed=="number"&&(C.total_lines_removed=S.total_lines_removed),S.modelUsage){for(const E of Object.values(S.modelUsage))if(E.contextWindow>0){const R=E,A=Math.round((R.inputTokens+R.outputTokens)/R.contextWindow*100);C.context_used_percent=Math.max(0,Math.min(A,100))}}o.updateSession(e,C)}else if(N.type==="system_event"){const S=Q_(N.event);if(!S)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:S,timestamp:N.timestamp||Date.now(),...X_(N.event)})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const S of b){const C=N.findIndex(R=>R.id===S.id);if(C===-1){N.push(S);continue}const E=N[C];E.role==="assistant"&&S.role==="assistant"?N[C]=N0(E,S):N[C]=S}N.sort((S,C)=>(S.timestamp??0)-(C.timestamp??0)),o.setMessages(e,N)}}o.setToolActivity(e,Array.from(y.values()).sort((j,N)=>j.startedAt-N.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(na(e),o.setStreaming(e,null),la.delete(e),fr.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=j0(e);y.seq<=_||(J_(e,y.seq),b=y.seq,bS(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&ew(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:Pi(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:Pi(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}case"magic_ui_state":{o.setMagicUiState(e,t.state);break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Do(e){const t=gi.get(e);if(pS(t))return;if(t){try{t.close()}catch{}gi.delete(e)}const n=W.getState();if(n.setConnectionStatus(e,"connecting"),n.currentSessionId!==e&&mS()>=fS){So.includes(e)||So.push(e);return}gS(e);const i=new WebSocket(BT(e));gi.set(e,i),i.onopen=()=>{const a=j0(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),zT(e,i);const o=br.get(e);o&&(clearTimeout(o),br.delete(e)),G_()},i.onmessage=a=>UT(e,a),i.onclose=()=>{gi.get(e)===i&&(gi.delete(e),W.getState().setConnectionStatus(e,"disconnected"),HT(e),G_())},i.onerror=()=>{i.close()}}function HT(e){if(br.has(e)||ko)return;const t=setTimeout(()=>{br.delete(e),!ko&&jx(e)&&Do(e)},NT);br.set(e,t)}function C0(e){gS(e);const t=br.get(e);t&&(clearTimeout(t),br.delete(e));const n=gi.get(e);n&&(n.close(),gi.delete(e)),W.getState().setConnectionStatus(e,"disconnected"),qh.delete(e),Vh.delete(e),tu.delete(e),Ah.delete(e),la.delete(e),lu.delete(e),fr.delete(e),Hh.delete(e),Su.delete(e)}function qT(e){if(ko)return;const t=W.getState().currentSessionId,n=e.filter(kx),i=t?[...n.filter(a=>a.sessionId===t),...n.filter(a=>a.sessionId!==t)]:n;for(const a of i)Do(a.sessionId)}function Xn(e,t){const n=gi.get(e);let i=t;const a=PT.has(t.type);if(a)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":case"set_magic_ui":t.client_msg_id||(i={...t,client_msg_id:xS()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&DT(e,i)}function nw(e){Xn(e,{type:"mcp_get_status"})}function VT(e,t,n){Xn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function GT(e,t){Xn(e,{type:"mcp_reconnect",serverName:t})}function YT(e,t){Xn(e,{type:"mcp_set_servers",servers:t})}function sw(e,t){Xn(e,{type:"set_magic_ui",magicUiActive:t})}function cF(e){Xn(e,{type:"magic_ui_sync"})}function XT(e,t){Xn(e,{type:"set_ai_validation",...t})}const se="u">typeof window?window:void 0,Qn="u">typeof globalThis?globalThis:se,En=Qn==null?void 0:Qn.navigator,ge=Qn==null?void 0:Qn.document,zt=Qn==null?void 0:Qn.location,ku=Qn==null?void 0:Qn.fetch,Nx=Qn!=null&&Qn.XMLHttpRequest&&"withCredentials"in new Qn.XMLHttpRequest?Qn.XMLHttpRequest:void 0,iw=Qn==null?void 0:Qn.AbortController,QT=Qn==null?void 0:Qn.CompressionStream,ls=En==null?void 0:En.userAgent,Uc=typeof globalThis<"u"?globalThis:se;Uc&&typeof self>"u"&&(Uc.self=Uc),Uc&&typeof File>"u"&&(Uc.File=function(){});const $e=se??{},WT="0.9.2",vr={DEBUG:!1,LIB_VERSION:WT,LIB_NAME:"browser-common"};var Fi=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),E0=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const ZT=["$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"],KT=["token"];function Fe(e,t){return e.indexOf(t)!==-1}const jo=function(e){return e.trim()},T0=function(e){return e.replace(/^\$/,"")};function yS(e){var t;const n=[];return(t=JSON.stringify(e,function(i,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}}))!==null&&t!==void 0?t:"null"}const _S=Object.prototype,Cx=_S.hasOwnProperty,wf=_S.toString,Ie=Array.isArray||function(e){return wf.call(e)==="[object Array]"},xn=e=>typeof e=="function",Ze=e=>e===Object(e)&&!Ie(e),_s=e=>{if(Ze(e)){for(const t in e)if(Cx.call(e,t))return!1;return!0}return!1},ue=e=>e===void 0,et=e=>wf.call(e)=="[object String]",ou=e=>et(e)&&e.trim().length===0,Xt=e=>e===null,qe=e=>ue(e)||Xt(e),sn=e=>wf.call(e)=="[object Number]"&&e==e,pr=e=>sn(e)&&e>0,cs=e=>wf.call(e)==="[object Boolean]",JT=e=>Fe(ZT,e),e6=e=>Fe(KT,e);function wS(e){return e===null||typeof e!="object"}function Gh(e,t){return{}.toString.call(e)===`[object ${t}]`}function zo(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return SS(e,Error)}}function Ex(e){return"u">typeof Event&&SS(e,Event)}function SS(e,t){try{return e instanceof t}catch{return!1}}const t6=[!0,"true",1,"1","yes"],dg=e=>Fe(t6,e),n6=[!1,"false",0,"0","no"];function rw(e,t,n,i,a,o,u){try{var h=e[o](u),f=h.value}catch(p){return void n(p)}h.done?t(f):Promise.resolve(f).then(i,a)}function Pt(e){return function(){var t=this,n=arguments;return new Promise(function(i,a){var o=e.apply(t,n);function u(f){rw(o,i,a,u,h,"next",f)}function h(f){rw(o,i,a,u,h,"throw",f)}u(void 0)})}}const s6=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],hh=new Map,aw=function(e,t=[]){if(!e)return!1;const n=(function(u,h){let f="";for(let p=0;h.length>p;p++){const g=h[p];f+=g.length+":"+g}return u.length+":"+u+"|"+h.length+":"+f})(e,t),i=hh.get(n);if(i!==void 0)return i;const a=e.toLowerCase(),o=s6.concat(t).some(u=>a.indexOf(u.toLowerCase())!==-1);return 256>hh.size||hh.clear(),hh.set(n,o),o};function Ui(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),sn(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),Ui(a??n,t,n,i))}var i6=class{constructor(e){this.C={},this.I=e.I,this.R=Ui(e.bucketSize,0,100,e.A),this.$=Ui(e.refillRate,0,this.R,e.A),this.O=Ui(e.refillInterval,0,864e5,e.A)}F(e,t){const n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.$,this.R),e.lastAccess=e.lastAccess+n*this.O)}consumeRateLimit(e){var t;const n=Date.now(),i=String(e);let a=this.C[i];return a?this.F(a,n):(a={tokens:this.R,lastAccess:n},this.C[i]=a),a.tokens===0||(a.tokens--,a.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),a.tokens===0)}stop(){this.C={}}};const No="Mobile",ju="Android",Yh="Tablet",kS="Android Tablet",jS="iPad",NS="Apple Watch",Lh="Safari",Sf="BlackBerry",CS="Samsung Internet",Dh="Chrome",ES="Chrome iOS",TS="Internet Explorer",MS="Internet Explorer Mobile",AS="Opera",RS="Microsoft Edge",zh="Firefox",OS="Firefox iOS",Xh="Nintendo",Qh="PlayStation",kf="Xbox",LS="Android Mobile",DS="Mobile Safari",hg="Windows",zS="Windows Phone",lw="Nokia",M0="Ouya",r6="Generic "+No.toLowerCase(),$S="Generic "+Yh.toLowerCase(),A0="Konqueror",PS="Oculus Browser",BS="Vivaldi",FS="Yandex",IS="Whale",US="DuckDuckGo",HS="Pale Moon",qS="Waterfox",R0="Brave",VS="Claude",GS="Codex",YS="ChatGPT",XS="Google Search App",fg=new RegExp("Version/(\\d+(\\.\\d+)?)"),pg=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),a6=new RegExp(kf,"i"),l6=new RegExp("PlayStation \\w+","i"),o6=new RegExp("Nintendo \\w+","i"),Tx=new RegExp("BlackBerry|PlayBook|BB10","i"),c6={"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"},QS=function(e,t,n,i){return t=t||"",(function(o){return o!=null&&o.brave?R0:null})(n)||(i!=null&&i.detectGoogleSearchApp&&Fe(e,"GSA/")?XS:Fe(e," OPR/")&&Fe(e,"Mini")?"Opera Mini":Fe(e," OPR/")?AS:Tx.test(e)?Sf:Fe(e,"IEMobile")||Fe(e,"WPDesktop")?MS:Fe(e,"OculusBrowser")?PS:Fe(e,"SamsungBrowser")?CS:Fe(e,"Edge")||Fe(e,"Edg/")?RS:Fe(e,"Vivaldi/")?BS:Fe(e,"YaBrowser/")?FS:Fe(e,"Whale/")?IS:Fe(e,"DuckDuckGo/")||Fe(e,"Ddg/")?US:Fe(e,"Claude/")?VS:Fe(e,"Codex/")?GS:Fe(e,"ChatGPT/")?YS:Fe(e,"FBIOS")?"Facebook Mobile":Fe(e,"UCWEB")||Fe(e,"UCBrowser")?"UC Browser":Fe(e,"CriOS")?ES:Fe(e,"CrMo")||Fe(e,Dh)?Dh:Fe(e,ju)&&Fe(e,Lh)?LS:Fe(e,"FxiOS")?OS:Fe(e.toLowerCase(),A0.toLowerCase())?A0:Fe(e,"Brave/")?R0:((o,u)=>u&&Fe(u,"Apple")||(function(h){return Fe(h,Lh)&&!Fe(h,Dh)&&!Fe(h,ju)})(o))(e,t)?Fe(e,No)?DS:Lh:Fe(e,"PaleMoon/")?HS:Fe(e,"Waterfox/")?qS:Fe(e,zh)?zh:Fe(e,"MSIE")||Fe(e,"Trident/")?TS:Fe(e,"Gecko")?zh:"")},u6={[MS]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[RS]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Dh]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ES]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Lh]:[fg],[DS]:[fg],[AS]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[zh]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[OS]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[A0]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Sf]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),fg],[LS]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[CS]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[PS]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[BS]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[FS]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[IS]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[R0]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[VS]:[pg],[GS]:[pg],[YS]:[pg],[US]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[HS]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[qS]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[XS]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[TS]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},d6=function(e,t,n,i){const a=QS(e,t,n,i),o=u6[a];if(ue(o))return null;for(let u=0;o.length>u;u++){const h=e.match(o[u]);if(h)return parseFloat(h[h.length-2])}return null},ow=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[kf,e&&e[1]||""]],[new RegExp(Xh,"i"),[Xh,""]],[new RegExp(Qh,"i"),[Qh,""]],[Tx,[Sf,""]],[new RegExp(hg,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[zS,""];if(new RegExp(No).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let i=c6[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[hg,i]}return[hg,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=ue(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[ju,[e[2],e[3],e[4]||"0"].join(".")]:[ju,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],WS=function(e){for(let t=0;ow.length>t;t++){const[n,i]=ow[t],a=n.exec(e),o=a&&(xn(i)?i(a,e):i);if(o)return o}return["",""]},ZS=function(e){return o6.test(e)?Xh:l6.test(e)?Qh:a6.test(e)?kf:new RegExp(M0,"i").test(e)?M0:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?zS:/iPad/.test(e)?jS:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?NS:Tx.test(e)?Sf:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(lw,"i").test(e)?lw:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(No).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ju:kS:new RegExp("(pda|Mobile)","i").test(e)?r6:new RegExp(Yh,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?$S:""},h6=function(e,t){var n;const i=ZS(e);return i===jS||i===kS||i==="Kobo"||i==="Kindle Fire"||i===$S?Yh:i===Xh||i===kf||i===Qh||i===M0?"Console":i===NS?"Wearable":i?No:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((n=t==null?void 0:t.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((a=t==null?void 0:t.screenWidth)!==null&&a!==void 0?a:0,(o=t==null?void 0:t.screenHeight)!==null&&o!==void 0?o:0)/((u=t==null?void 0:t.devicePixelRatio)!==null&&u!==void 0?u:1)?No:Yh:"Desktop";var a,o,u},mg=/\bFBAV\/(\d+(?:\.\d+)*)/i,cw=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",mg],[/\bFBAN\/EMA\b/i,"Facebook Lite",mg],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",mg],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],O0="[Truncated]",Lu="[Unserializable]";function bo(e){let t="";for(let n=0;e.length>n;n++){const i=e.charCodeAt(n);if(55296>i||i>56319)t+=56320>i||i>57343?e[n]:"�";else{const a=e.charCodeAt(n+1);56320>a||a>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}function KS(e,t){if(!t)return e;let n=[];try{n=Object.keys(t)}catch{n=[]}for(const i of n){let a;try{a=t[i]}catch{a=Lu}Object.defineProperty(e,i,{value:a,enumerable:!0,writable:!0,configurable:!0})}return e}const $h=3e5;var JS=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),n=Date.now(),i=Math.min(e.retryAfterMs,$h);if(!t)return this.ts=n,void(this.es=n+i);this.es=Math.max(this.es,Math.min(n+i,this.ts+$h))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min($h,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const f6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function uw(e,t){return typeof(n=e)=="string"&&f6.test(n)?e:t();var n}function ek(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function ma(e){return e&&e.split("#")[0]}function dw(e){try{return e()}catch{return}}function tk(e,t){const n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function hw(e,t,n){return nk.apply(this,arguments)}function nk(){return(nk=Pt(function*(e,t,n){let i;try{return yield Promise.race([e,new Promise((a,o)=>{i=tk(()=>{try{n==null||n(),a()}catch(u){o(u)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let fh,fw,gg;function p6(e){const t=globalThis._posthogChunkIds;if(!t)return;const n=Object.keys(t);return gg&&n.length===fw||(fw=n.length,gg=n.reduce((i,a)=>{fh||(fh={});const o=fh[a];if(o)i[o[0]]=o[1];else{const u=e(a);for(let h=u.length-1;h>=0;h--){const f=u[h],p=f==null?void 0:f.filename,g=t[a];if(p&&g){i[p]=g,fh[a]=[p,g];break}}}return i},{})),gg}function cu(e){return cu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cu(e)}function m6(e,t,n){return(t=(function(i){var a=(function(o){if(cu(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var h=u.call(o,"string");if(cu(h)!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)})(i);return cu(a)=="symbol"?a:a+""})(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function D(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pw(Object(n),!0).forEach(function(i){m6(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pw(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}var g6=class{constructor(e,t,n=[]){this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t={}){const n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),a=this.buildParsingContext(t),o=this.parseStacktrace(i,a);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var t=this;return Pt(function*(){for(const n of e)n.stacktrace&&n.stacktrace.frames&&Ie(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var n;let i,a;if(e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{a=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return D(D({},e),{},{cause:i,stack:a,errors:(n=e.errors)===null||n===void 0?void 0:n.map(o=>this.parseStacktrace(o,t))})}applyChunkIds(e,t){return e.map(n=>(n.filename&&t&&(n.chunk_id=t[n.filename]),n))}applyCoercers(e,t){for(const n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Pt(function*(){let n=e;for(const i of t.modifiers)n=yield i(n);return n})()}convertToExceptionList(e,t){const n=[],i=(a,o,u)=>{var h;const f=n.length,p=o===void 0?D(D({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:a.synthetic,exception_id:f}):{type:"chained",source:u,synthetic:a.synthetic,exception_id:f,parent_id:o},g={type:a.type,value:a.value,mechanism:p};a.stack&&(g.stacktrace={type:"raw",frames:a.stack}),n.push(g),a.cause&&i(a.cause,f,"cause");for(const v of(h=a.errors)!==null&&h!==void 0?h:[])i(v,f,"member")};return i(e),n}buildParsingContext(e){var t;return{chunkIdMap:p6(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(zo(e)){let n=Object.getPrototypeOf(e);for(let i=0;n&&100>i;i++){var t;const a=(t=Object.getOwnPropertyDescriptor(n,"constructor"))===null||t===void 0?void 0:t.value;if(typeof a=="function"&&a.name==="AggregateError"){const o=e.errors;return Ie(o)?o:void 0}n=Object.getPrototypeOf(n)}}}catch{}}buildCoercingContext(e,t,n=0){let i=0,a=0,o=!1;const u=new Set,h=[],f={},p=(b,y,_=0)=>{const j=g(y,_),N=j.apply;if(j.apply=O=>{h.push(b);try{return N(O)}finally{h.pop()}},_>4||_>0&&h.indexOf(b)!==-1)return this.coerceFallback(j);const S=typeof b=="object"&&b!==null||typeof b=="function";if(_===0&&i>=50||S&&u.has(b))return;S&&u.add(b),_===0&&i++;const C=this.getAggregateErrors(b);let E,R;o||(o=!!C);try{if(E=this.applyCoercers(b,j),!E)throw f}catch(O){if(O===f)return void(_===0&&i--);if(!o)throw O;E=this.coerceFallback(j)}if(!C||i>=50)return E;try{R=C.length}catch{return E}if(!Number.isInteger(R)||0>R||R>4294967295)return E;const A=[];for(let O=0;50>i&&1e3>a&&R>O;O++){let P;a++;try{P=j.next(C[O])}catch{i++,P=this.coerceFallback(g(y+1))}P&&A.push(P)}return D(D({},E),{},{errors:A})},g=(b,y=0)=>D(D({},t),{},{syntheticException:b==0?t.syntheticException:void 0,mechanism:b==0?e:{},apply(_){const j=p(_,b,y+1);if(!j)throw f;return j},next:_=>p(_,b+1)}),v=g(n);return D(D({},v),{},{apply:b=>{var y;return(y=p(b,n))!==null&&y!==void 0?y:this.coerceFallback(v)}})}};const x6=/^([a-z][a-z0-9.+-]+):/i,v6=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function b6(e){if(!e||e==="<anonymous>")return!1;const t=x6.exec(e);return!t||v6.includes(t[1].toLowerCase())}function L0(e,t,n,i,a){const o={platform:e,filename:t,function:n==="<anonymous>"?"?":n,in_app:b6(t)};return ue(i)||(o.lineno=i),ue(a)||(o.colno=a),o}const sk=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:"?",n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},y6=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,_6=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,w6=/\((\S*)(?::(\d+))(?::(\d+))\)/,S6=(e,t)=>{const n=y6.exec(e);if(n){const[,a,o,u]=n;return L0(t,a,"?",+o,+u)}const i=_6.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const u=w6.exec(i[2]);u&&(i[2]=u[1],i[3]=u[2],i[4]=u[3])}const[a,o]=sk(i[1]||"?",i[2]);return L0(t,o,a,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},k6=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,j6=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,N6=(e,t)=>{const n=k6.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const o=j6.exec(n[3]);o&&(n[1]=n[1]||"eval",n[3]=o[1],n[4]=o[2],n[5]="")}let i=n[3],a=n[1]||"?";return[a,i]=sk(a,i),L0(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},mw=/\(error: (.*)\)/;function Mx(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function C6(e){for(let t=1;10>=t;t++){const n=e.length-2*t;if(0>n)break;let i=!0;for(let a=0;t>a;a++)if(!Mx(e[n+a],e[n+t+a])){i=!1;break}if(i){for(let a=0;t>a;a++)e[n+a]=e[n+t+a];return e.length=n+t,{start:n,length:t}}}}function E6(e,t){const n=t.start+t.length,i=rk(e,t);i&&e.splice(n+i===e.length?n:t.start,i)}function ik(e,t){let n=t.start;for(;n>0&&Mx(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function rk(e,t){const n=t.start+t.length;let i=n;for(;e.length>i&&Mx(e[i],e[i-t.length]);)i++;return i-n}function T6(e,t){const n=t[0];let i=e.length-(n?ik(e,n):0);for(const a of t)i-=rk(e,a);return i}function M6(e,t,n){for(let i=0;e.length>i;i++){const a=e[(t+i)%e.length],o=e[(n+i)%e.length];if(a!==o)return o>a}return!1}var A6=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const n=et(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Gh(e,"DOMException")}isDOMError(e){return Gh(e,"DOMError")}},R6=class{match(e){return zo(e)}coerce(e,t){var n;const i=this.getStack(e),a=i===void 0?(n=t.syntheticException)===null||n===void 0?void 0:n.stack:void 0,o=!!a;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??a,cause:e.cause?t.next(e.cause):void 0,synthetic:o}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const n=e.stack;return typeof n=="string"&&n.length>0?n:void 0}catch{return}}},O6=class{match(e){return!!Gh(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var n;if(e.error!=null)return t.apply(e.error);const i=t.apply(e.message);return D(D({},i),{},{stack:(n=this.lr(e))!==null&&n!==void 0?n:i.stack,synthetic:!0})}ar(e){return et(e.message)&&e.message.length>0}lr(e){var t,n;const i=e,a=(t=i.lineno)!==null&&t!==void 0?t:0,o=(n=i.colno)!==null&&n!==void 0?n:0;if(et(i.filename)&&i.filename.length!==0&&a!==0)return`Error
|
|
67
|
+
at ${i.filename}:${a}:${o}`}};const L6=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var D6=class{match(e){return typeof e=="string"}coerce(e,t){var n;const[i,a]=this.getInfos(e);return{type:i??"Error",value:a??e,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}getInfos(e){let t="Error",n=e;const i=e.match(L6);return i&&(t=i[1],n=i[2]),[t,n]}};const z6=["fatal","error","warning","log","info","debug"];function ak(e,t=40){const n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(let i=n.length;i>0;i--){const a=n.slice(0,i).join(", ");if(t>=a.length)return i===n.length?a:a.length>t?`${a.slice(0,t)}...`:a}return""}var $6=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,i;const a=this.getErrorPropertyFromObject(e);return a?t.apply(a):{type:this.getType(e),value:this.getValue(e),stack:(n=this.getStack(e))!==null&&n!==void 0?n:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Ex(e))return e.constructor.name;const t="name"in e?e.name:void 0;return et(t)&&!ou(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let 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;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${ak(e)}`}isSeverityLevel(e){return et(e)&&!ou(e)&&z6.indexOf(e)>=0}getStack(e){try{return et(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:et(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const n=e[t];if(zo(n))return n}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},P6=class{match(e){return Ex(e)}coerce(e,t){var n;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${ak(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},B6=class{match(e){return wS(e)}coerce(e,t){var n;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},F6=class{match(e){return Gh(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ex(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var n;const i=this.getUnhandledRejectionReason(e);return wS(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const Wh="$message",Zh="$timestamp",I6=new Set([Wh,Zh]),xg={enabled:!0,max_bytes:32768};function Kh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:xg.enabled,max_bytes:H6(e.max_bytes,xg.max_bytes)}:D({},xg)}var U6=class{constructor(e){this.ns=[],this.ss=0,this.Mr=Kh(e)}setConfig(e){this.Mr=Kh(e),this.rs()}add(e){const t=(function(i){let a;try{a=yS(i)}catch{return}try{const o=JSON.parse(a);if(!Ze(o))return;const u=o,h=u[Wh],f=u[Zh];return!et(h)||h.trim().length===0||!et(f)&&!sn(f)?void 0:{step:u,json:a}}catch{return}})(e);if(!t)return;const n=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const a=encodeURIComponent(i);let o=0;for(let u=0;a.length>u;u++)a[u]==="%"?(o+=1,u+=2):o+=1;return o})(t.json);n>this.Mr.max_bytes||(this.ns.push({step:t.step,bytes:n}),this.ss+=n,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function H6(e,t){if(!sn(e)||e===1/0||e===-1/0)return t;const n=Math.floor(e);return 0>n?t:n}const gw=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function xw(e){return typeof e=="string"||e}function vw(e){return typeof e=="string"?e:void 0}const q6=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server","$react_native_version"],lk="NativeGzipValidationError",D0=e=>e.length>=2&&e[0]===31&&e[1]===139,bw=(e,t)=>e===E0.GZipJS||t===E0.GZipJS||t==="gzip",yw=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let Hc;const ph=e=>{throw ek(lk,`Native gzip produced invalid output: ${e}`)},V6=(_w=Pt(function*(e,t){18>e.size&&ph("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());D0(n)&&n[2]===8||ph("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(o=>{const u=(()=>{if(Hc)return Hc;Hc=[];for(let f=0;256>f;f++){let p=f;for(let g=0;8>g;g++)p=1&p?3988292384^p>>>1:p>>>1;Hc[f]=p>>>0}return Hc})();let h=4294967295;for(let f=0;o.length>f;f++)h=u[255&(h^o[f])]^h>>>8;return(4294967295^h)>>>0})(t)&&ph("invalid-crc");const a=t.length>>>0;i.getUint32(4,!0)!==a&&ph("invalid-size")}),function(e,t){return _w.apply(this,arguments)});var _w;function z0(){return z0=Pt(function*(e,t=!0,n){try{const a=new TextEncoder().encode(e),o=new globalThis.CompressionStream("gzip"),u=o.writable.getWriter(),h=u.write(a).then(()=>u.close()).catch((i=Pt(function*(g){try{yield u.abort(g)}catch{}throw g}),function(g){return i.apply(this,arguments)})),f=new Response(o.readable).blob(),[p]=yield Promise.all([f,h]);return yield V6(p,a),p}catch(a){if(n!=null&&n.rethrow)throw a;return t&&console.error("Failed to gzip compress data",a),null}var i}),z0.apply(this,arguments)}function ok(e,t){if(e==null)return{};var n,i,a=(function(u,h){if(u==null)return{};var f={};for(var p in u)if({}.hasOwnProperty.call(u,p)){if(h.includes(p))continue;f[p]=u[p]}return f})(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;o.length>i;i++)t.includes(n=o[i])||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const Yn="[redacted]",G6=/^[A-Za-z0-9+/\n\r]+=*$/,Y6=/^[A-Za-z0-9_-]+={0,2}$/,X6=/[-_]/,Q6=/^data:[^,\s]*;base64,/i,W6=/^[A-Za-z0-9+/_-]+={0,2}$/,Z6=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,K6=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,ck=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,J6=/[\s<>"]/,uk=new RegExp(ck.source,"i"),dk=/[a-z][a-z0-9+.-]{0,63}:\/\//i,eM=new RegExp(`^${dk.source}`,"i"),tM=new RegExp(dk.source,"gi"),nM=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,sM=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,iM=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,rM=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,aM=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,lM=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,oM=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,cM=/\b\d(?:[ ./-]?\d){12,}\b/g,ww=/\d+/g,uM=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,dM=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function $0(e){return(function(t){return K6.test(t)})(e)||nM.test(e)||sM.test(e)}function vg(e){return e.split("&",129).length>128}function hM(e,t,n){return $0(e)||t.includes(";")&&(function(i){return i.split(";").some(a=>$0(a.split("=",1)[0]))})(t)?Yn:uk.test(t)?n?Ax(t,{allowNestedUrls:!1,stripPunctuation:!0}):Yn:t}function hk(e,t){const n=new URLSearchParams;let i=!1,a=!1;for(const[o,u]of new URLSearchParams(e)){const h=hM(o,u,t);i||(i=h!==u),a=$0(o)||h!==u,n.append(o,h)}return{changed:i,lastFieldSensitive:a,serialized:n.toString()}}function Sw(e,t){if(!e.includes("="))return{value:fM(e,t),lastFieldSensitive:!1};const n=hk(e,t);return{value:n.changed?n.serialized:e,lastFieldSensitive:n.lastFieldSensitive}}function fM(e,t){return t?Ax(e,{allowNestedUrls:!1,stripPunctuation:!0}):uk.test(e)?Yn:e}function pM(e,t,n){return e==="#"?!t.fragment&&(t.fragment=!0):e==="?"&&(t.fragment?n!=="="&&!t.fragmentQuery&&(t.fragmentQuery=!0):!t.query&&(t.query=!0))}function bg(e,t){var n;if(e.length>8192&&eM.test(e))return Yn;const{address:i,suffix:a}=t.stripPunctuation?(function(N){let S=N.length;for(;S>0&&".,;:!?)]}'".includes(N[S-1]);)S--;return{address:N.slice(0,S),suffix:N.slice(S)}})(e):{address:e,suffix:""};let o;try{o=new URL(i)}catch{return Yn+a}const u=o.search.slice(1),h=o.hash!=="",f=(function(N){const S=N.slice(1),C=S.indexOf("?");return 0>C?{head:S,tail:null}:{head:S.slice(0,C),tail:S.slice(C+1)}})(o.hash);if(vg(u)||vg(f.head)||vg((n=f.tail)!==null&&n!==void 0?n:""))return Yn+a;let p=!1;(o.username||o.password)&&(o.username=Yn,o.password="",p=!0);const g=hk(u,t.allowNestedUrls);g.changed&&(o.search=g.serialized,p=!0);const v=Sw(f.head,t.allowNestedUrls),b=f.tail===null?null:(y=f.tail,v.lastFieldSensitive?{value:y===""?"":Yn,lastFieldSensitive:!0}:Sw(y,t.allowNestedUrls));var y;const _=b===null?v.value:`${v.value}?${b.value}`;_!==o.hash.slice(1)&&(o.hash=_,p=!0);const j=h?b??v:g;return(p?o.toString():i)+(j.lastFieldSensitive?"":a)}function Ax(e,t){return e.replace(ck,n=>(function(i,a){const o=(function(f){if(!f.includes("://"))return[];const p=[...f.matchAll(tM)].map(j=>j.index),g=[],v={query:!1,fragment:!1,fragmentQuery:!1};let b=0,y=!1,_="";for(let j=0;f.length>j&&p.length>b;j++){p[b]===j&&(j>0&&_!=="="&&g.push(j),b++);const N=f[j];pM(N,v,_)?(_=N,y=!0):y&&"=&".includes(N)&&(_=N)}return g})(i);if(o.length===0)return bg(i,a);let u="",h=0;for(const f of o)u+=bg(i.slice(h,f),D(D({},a),{},{stripPunctuation:!1})),h=f;return u+bg(i.slice(h),a)})(n,D(D({},t),{},{stripPunctuation:t.stripPunctuation&&n.length!==e.length})))}function mM(e,t){return(function(n){return n.length>=10240&&(G6.test(n)||(function(i){const a=Q6.exec(i);if(!a)return!1;let o;try{o=decodeURIComponent(i.slice(a[0].length))}catch{return!1}return W6.test(o.replace(/[\r\n]/g,""))})(n)||X6.test(n)&&Y6.test(n))})(e)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(n,i,a){const o=4*a.maxStringLength;if(n.length>o){const u=i(n.slice(0,(function(h,f){let p=f;for(;p>0&&!J6.test(h[p-1]);)p--;return p})(n,o)));if(u.length>=2*a.maxStringLength)return u+a.truncationSuffix}return i(n)})(e,n=>(function(i){return Ax(i,{allowNestedUrls:!0,stripPunctuation:!0})})((function(i){let a=i.replace(iM," ");return a=a.replace(rM,Yn),a=a.replace(aM,Yn),a=a.replace(lM,`$1${Yn}`),a=a.replace(cM,xM),a=a.replace(oM,Yn),a=a.replace(uM,`$1${Yn}`),a=a.replace(dM,`$1${Yn}`),a})((function(i){return i.replace(Z6,Yn)})(n))),t)}function gM(e){let t=0,n=!1;for(let i=e.length-1;i>=0;i--){let a=e.charCodeAt(i)-48;if(0>a||a>9)return!1;n&&(a*=2,a>9&&(a-=9)),t+=a,n=!n}return t%10==0}function xM(e){const t=[];for(let o=ww.exec(e);o!==null;o=ww.exec(e))t.push({digits:o[0],start:o.index,end:o.index+o[0].length});let n="",i=0,a=0;for(;t.length>a;){let o="",u=-1;for(let h=a;t.length>h&&(o+=t[h].digits,19>=o.length);h++)o.length>=13&&gM(o)&&(u=h);0>u?a++:(n+=e.slice(i,t[a].start)+Yn,i=t[u].end,a=u+1)}return n+e.slice(i)}const vM={}.propertyIsEnumerable;function Jh(e,t){try{return fk(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Rx(e,t,n,i){if(0>=n.remainingNodes)return{stringValue:O0};if(n.remainingNodes--,cs(e))return{boolValue:e};if(typeof e=="bigint")return(function(a,o){const u=a.toString(),h=BigInt("9223372036854775808");return a>=h||-h>a?(o==null||o.debug(`Attribute ${u} is outside the int64 range; encoding it as a string`),{stringValue:u}):{intValue:u}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const a=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t==null||t.debug(`Attribute ${a} is outside the int64 range; encoding it as a string`),{stringValue:a}):{intValue:a}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:bo(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:"[Circular]"};if(i>=20)return{stringValue:O0};if(e instanceof Date){const a=e.getTime(),o=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof o=="string"?bo(o):String(o)}}n.ancestors.add(e);try{try{const a=e.toJSON;if(typeof a=="function")return Rx(a.call(e),t,n,i+1)}catch{}return Ie(e)?{arrayValue:{values:bM(e,t,n,i+1)}}:{kvlistValue:{values:fk(e,t,n,i+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:bo(String(e))}}function bM(e,t,n,i){const a=[],o=Math.min(e.length,1e3);let u=0;for(;o>u&&n.remainingNodes>0;u++)try{const h=u in e?e[u]:void 0;if(qe(h))continue;a.push(Rx(h,t,n,i))}catch{a.push({stringValue:Lu})}return e.length>u&&a.push({stringValue:O0}),a}function fk(e,t,n,i){const a=[];for(const o in e)if(vM.call(e,o)){if(!o){t==null||t.debug("Dropping an attribute with an empty key");continue}if(a.length>=1e3||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const u=e[o];if(Xt(u)||ue(u))continue;a.push({key:bo(o),value:Rx(u,t,n,i)})}catch{a.push({key:bo(o),value:{stringValue:Lu}})}}return a}function pk(e,t,n){return D(D(D(D({},KS({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}const yM=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function mk(e,t){const n=KS({},e),i={};for(const a of yM)({}).hasOwnProperty.call(n,a)&&(i[a]=n[a],delete n[a]);return[...Jh(n,t),...Jh(i,t)]}const kw={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},gk={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}},_M=gk.info;function wM(e){try{return bo(String(e))}catch{return Lu}}function SM(e,t,n,i){const a=e.level||"info",{text:o,number:u}=gk[a]||_M,h=(function(b=Date.now()){return String(b)+"000000"})(sn(i)?i:void 0),f={};t.distinctId&&(f.posthogDistinctId=t.distinctId),t.sessionId&&(f.sessionId=t.sessionId),t.windowId&&(f["window.id"]=t.windowId),qe(t.sessionStartTimestamp)||(f.sessionStartTimestamp=String(t.sessionStartTimestamp)),qe(t.lastActivityTimestamp)||(f.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(f["url.full"]=t.currentUrl),t.screenName&&(f["screen.name"]=t.screenName),t.appState&&(f["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(f.feature_flags=t.activeFeatureFlags);const p=D({},f),g=e.attributes;if(g){let b=[];try{b=Object.keys(g)}catch{b=[]}for(const y of b){let _;try{_=g[y]}catch{_=Lu}Object.defineProperty(p,y,{value:_,enumerable:!0,writable:!0,configurable:!0})}}const v={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:u,severityText:o,body:{stringValue:wM(e.body)},attributes:Jh(p,n)};return e.trace_id&&(v.traceId=e.trace_id),e.span_id&&(v.spanId=e.span_id),ue(e.trace_flags)||(v.flags=e.trace_flags),v}function xk(e,t,n){return pk(e,t,n)}function vk(e,t,n,i){return{resourceLogs:[{resource:{attributes:mk(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var bk=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.cs}arm(e){this.clear(),this.us=Date.now()+e,this.cs=tk(()=>{this.cs=void 0,this.ls()},e)}armNoEarlierThan(e){this.cs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function yk(){return .75+.5*Math.random()}function _k(e,t,n,i){const a=Math.min(Math.max(0,t-1),6),o=e*Math.pow(2,a);return Math.round(Math.min(o,Math.max(i,e))*n)}var kM=class{constructor(e,t,n,i,a,o=()=>Promise.resolve(),u){var h;this._instance=e,this.Mr=t,this.A=n,this.hs=i,this.ds=a,this.vs=o,this.fs=u,this.ps=new bk(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new JS,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((h=t.maxQueueSize)!==null&&h!==void 0?h:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(Fi.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var n;if(this._instance.isDisabled||this._instance.optedOut||!(e!=null&&e.body))return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const a={record:SM(i,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.hs(),this.A,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(a))}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const n=Ie(t)?t:[t];let i=e;for(const a of n)try{const o=a(i);if(!o)return this.A.info("Log was rejected in beforeSend function"),null;i=o}catch(o){return this.A.error("Error in beforeSend function for log:",o),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var e=this;return Pt(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Pt(function*(){var t;e.ps.clear();let n=(t=e._instance.getPersistedProperty(Fi.LogsQueue))!==null&&t!==void 0?t:[];if(n.length===0)return;const i=n.length;let a=0;for(;n.length>0&&i>a;){var o,u;const h=e._s;e.bs=0;const f=Math.min(n.length,e.Es),p=n.slice(0,f),g=vk(p.map(b=>b.record),e.qs(),(o=e.fs)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),v=yield e._instance.js(g);if(e._s!==h)return;if(v.kind==="too-large"&&p.length>1)e.Es=Math.max(1,Math.floor(p.length/2)),e.A.warn(`Logs batch of size ${p.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(v),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),v.kind==="retry-later"||(v.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):v.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(p.length),n=(u=e._instance.getPersistedProperty(Fi.LogsQueue))!==null&&u!==void 0?u:[],a+=p.length,v.kind==="fatal"))throw v.error}})()}Bs(e){var t=this;return Pt(function*(){var n;const i=Math.max(0,e-t.bs),a=(n=t._instance.getPersistedProperty(Fi.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Fi.LogsQueue,a.slice(i)),yield t.vs()})()}qs(){return xk(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const n=(t=this._instance.getPersistedProperty(Fi.LogsQueue))!==null&&t!==void 0?t:[];this.Is>n.length||(n.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Fi.LogsQueue,n),this.Ts>n.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(_k(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Fi.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Pt(function*(){t.ps.clear();const n=t.flush().catch(()=>{});e!==void 0?yield hw(n,e):yield n})()}flushWithTimeout(e){var t=this;return Pt(function*(){const n=t.flush();yield hw(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=yk(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const yg=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function jw(e){return String(e)+"000000"}function Nw(e,t,n,i){let a="";return i&&(a=Object.keys(i).sort().map(o=>`${JSON.stringify(o)}:${JSON.stringify(i[o])}`).join(",")),`${e}\0${t}\0${n??""}\0${a}`}var jM=class{constructor(e,t,n){this._instance=e,this.Mr=t,this.A=n,this.Hs=new Map,this.ps=new bk(()=>this.flush().catch(i=>{this.A.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new JS,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Qs({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Qs({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Qs({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this;const t=this.ys,n=(function(){var i=Pt(function*(){t&&(yield t.catch(()=>{})),yield e.Zs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===n&&(this.ys=null)});return this.ys=n,n}drainWindow(){if(this.Hs.size===0)return null;const e=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.A.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.A.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let n,i;try{n=t.attributes?D({},t.attributes):void 0,i=Nw(t.type,t.name,t.unit,n)}catch(u){return void this.A.warn(`Dropping metric '${t.name}': attributes could not be serialized`,u)}let a=this.Hs.get(i);if(!a){if(!this.Ks())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Hs.set(i,a)}const o=this.Ws.get(t.name);o===void 0?this.Ws.set(t.name,t.type):o===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.A.warn(`Metric name '${t.name}' is already used as a ${o}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(a,t.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var n;e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(yg.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(a,o){for(let u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,yg)]+=1;break}}}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const n=Ie(t)?t:[t];let i=e;for(const a of n)try{const o=a(i);if(!o)return this.A.info("Metric was rejected in beforeSend function"),null;i=o}catch(o){return this.A.error("Error in beforeSend function for metric:",o),null}return i}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(_k(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var e=this;return Pt(function*(){if(e.ps.clear(),e.Hs.size===0)return;const t=e.Hs;e.Hs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const n=e.Gs,i=yield e._instance.Ys(e.Js(t));if(n===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=yk()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.zs()),i.kind){case"ok":return;case"retry-later":return e.co(t),void e.ps.armNoEarlierThan(e.zs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",i.error)}})()}Js(e){return t=this.ho(e),n=(function(o,u,h){return pk(o,u,h)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:mk(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}ho(e){const t=jw(Date.now()),n=new Map;for(const u of e.values()){var i;const h=Nw(u.type,u.name,u.unit,void 0);let f=n.get(h);f||(f=D({name:u.name},u.unit&&{unit:u.unit}),u.type==="count"?f.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:u.type==="gauge"?f.gauge={dataPoints:[]}:f.histogram={aggregationTemporality:1,dataPoints:[]},n.set(h,f));const p=Jh((i=u.attributes)!==null&&i!==void 0?i:{},this.A),g=jw(u.windowStartMs);if(u.type==="count"){var a;const v={attributes:p,startTimeUnixNano:g,timeUnixNano:t,asDouble:(a=u.total)!==null&&a!==void 0?a:0};f.sum.dataPoints.push(v)}else if(u.type==="gauge"){var o;const v={attributes:p,timeUnixNano:t,asDouble:(o=u.last)!==null&&o!==void 0?o:0};f.gauge.dataPoints.push(v)}else u.hist&&f.histogram.dataPoints.push({attributes:p,startTimeUnixNano:g,timeUnixNano:t,count:u.hist.count,sum:u.hist.sum,min:u.hist.min,max:u.hist.max,bucketCounts:u.hist.bucketCounts,explicitBounds:yg})}return Array.from(n.values())}co(e){for(const[i,a]of e){const o=this.Hs.get(i);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,a.windowStartMs),o.type){case"count":var t,n;o.total=((t=o.total)!==null&&t!==void 0?t:0)+((n=a.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(a.hist)if(o.hist){o.hist.count+=a.hist.count,o.hist.sum+=a.hist.sum,o.hist.min=Math.min(o.hist.min,a.hist.min),o.hist.max=Math.max(o.hist.max,a.hist.max);for(let u=0;o.hist.bucketCounts.length>u;u++)o.hist.bucketCounts[u]+=a.hist.bucketCounts[u]}else o.hist=a.hist}else this.Ks()&&this.Hs.set(i,a)}}};const wk=(e,{debugEnabled:t}={})=>{const n={N(i,...a){let o;try{o=typeof window>"u"?void 0:window}catch{return}o&&(vr.DEBUG||o.POSTHOG_DEBUG||t)&&!ue(o.console)&&o.console&&("__rrweb_original__"in o.console[i]?o.console[i].__rrweb_original__:o.console[i])(e,...a)},debug(...i){n.N("debug",...i)},info(...i){n.N("log",...i)},warn(...i){n.N("warn",...i)},error(...i){n.N("error",...i)},critical(...i){console.error(e,...i)},uninitializedWarning(i){n.error(`You must initialize PostHog before calling ${i}`)},createLogger:(i,a)=>wk(`${e} ${i}`,a)};return n},_e=wk("[PostHog.js]"),Wt=_e.createLogger,NM=Wt("[ExternalScriptsLoader]"),ef=e=>{const t=ge==null?void 0:ge.querySelectorAll("script");if(t){for(let n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},el=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return NM.warn(`${t} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const i=ef(t);if(i){if(i.__posthog_loading_callback_fired)return n();const o=i.__posthog_loading_error;return o?n(o):(i.addEventListener("load",u=>{i.__posthog_loading_callback_fired=!0,n(void 0,u)}),void i.addEventListener("error",u=>{i.__posthog_loading_error=u,n(u)}))}const a=()=>{if(!ge)return n("document not found");if(ef(t))return el(e,t,n);let o=ge.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=t,o.onload=h=>{o.__posthog_loading_callback_fired=!0,n(void 0,h)},o.onerror=h=>{o.__posthog_loading_error=h,n(h)},e.config.prepare_external_dependency_script&&(o=e.config.prepare_external_dependency_script(o)),!o)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")ge.head.appendChild(o);else{const h=ge.querySelectorAll("body > script");var u;h.length>0?(u=h[0].parentNode)===null||u===void 0||u.insertBefore(o,h[0]):ge.body.appendChild(o)}};ge!=null&&ge.body?a():ge==null||ge.addEventListener("DOMContentLoaded",a)},_g={},Cw=(e,t)=>{let n=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",n)};$e.__PosthogExtensions__=$e.__PosthogExtensions__||{},$e.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t==="remote-config"){const a=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void el(e,a,n)}const i=e.config.strict_script_versioning;if(i){const a=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),o=_g[a];if(i==="fallback"&&o){if(ef(o))return void el(e,o,n);delete _g[a]}return void el(e,a,i==="fallback"?(u,h)=>{if(u)if(typeof u=="string")n(u);else{var f;const p=Cw(e,t);_g[a]=p;const g=ef(a);g==null||(f=g.parentNode)===null||f===void 0||f.removeChild(g),el(e,p,n)}else n(void 0,h)}:n)}el(e,Cw(e,t),n)},$e.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{const i=e.requestRouter.endpointFor("api",t);el(e,i,n)},vr.DEBUG=!1,vr.LIB_VERSION="1.438.2",vr.LIB_NAME="web";var jn=vr;const P0="$early_access_features",gr="$active_feature_flags",il="$feature_flag_details",Nu="$feature_flag_errors",fa="$feature_flag_evaluated_at",rl="$feature_flag_request_id",uu="$minimal_flag_called_events",pi="$enabled_feature_flags",ca="$stored_group_properties",ua="$stored_person_properties",da="$flag_call_reported",nu="$flag_call_reported_session_id",ha="$feature_flag_payloads",Bi="$override_feature_flags",tl="$override_feature_flag_payloads",Cu="visibilitychange",CM="$people_distinct_id",fi="distinct_id",Ox="$device_id",wg="$device_model",tf="__alias",EM="__cmpns",Ew="$fbc",yo="$fbc_persistence",Tw="$fbp",du="$fbp_persistence",B0="__timers",Sk="$autocapture_disabled_server_side",F0="$heatmaps_enabled_server_side",I0="$exception_capture_enabled_server_side",kk="$error_tracking_suppression_rules",U0="$error_tracking_capture_extension_exceptions",H0="$web_vitals_enabled_server_side",Lx="$dead_clicks_enabled_server_side",Dx="$product_tours_enabled_server_side",jk="$logs_capture_enabled_server_side",Nk="$web_vitals_allowed_metrics",hu="$session_recording_remote_config",TM="$session_recording_enabled_server_side",MM="$replay_sample_rate",AM="$replay_override_sampling",RM="$replay_override_linked_flag",OM="$replay_override_url_trigger",LM="$replay_override_event_trigger",mo="$sesid",Ck="$session_is_sampled",DM="$session_past_minimum_duration",zM="$session_recording_url_trigger_activated_session",$M="$session_recording_event_trigger_activated_session",PM="$debug_first_full_snapshot_timestamp",BM="$sess_rec_flush_size",Ek="$groups",su="$surveys",nf="$surveys_loaded_at",Tk="$surveys_activated",Mk="$surveys_activated_session",Ak="$surveys_activated_timestamps",q0="ph_product_tours",FM="$product_tours_activated",IM="$product_tours_activated_session",UM="$conversations_widget_session_id",HM="$conversations_ticket_id",qM="$conversations_widget_state",VM="$conversations_user_traits",os="$user_state",V0="$client_session_props",GM="$capture_rate_limit",Rk="$initial_campaign_params",Ok="$initial_referrer_info",go="$initial_person_info",zx="$epp",Sg="$posthog_cookieless",Lk="$cookieless_mode",Dk="$sdk_debug_extensions_init_method",zk="$sdk_debug_extensions_init_time_ms",$x="$sdk_debug_recording_script_not_loaded",Px="$sdk_debug_replay_stale_config",$k="$sdk_debug_replay_event_trigger_status",Pk="$sdk_debug_replay_linked_flag_trigger_status",Bk="$sdk_debug_replay_matched_recording_trigger_groups",Fk="$sdk_debug_replay_pending_trigger_conditions",Ik="$sdk_debug_replay_remote_trigger_matching_config",Uk="$sdk_debug_replay_trigger_groups_count",Hk="$sdk_debug_replay_url_trigger_status",YM="$session_recording_start_reason",Bx="PostHog loadExternalDependency extension not found.",xr="anonymous",Ph="identified",qk="identified_only",sf="beforeunload",Fx="$pageview",Mw="$pageleave",Vk="$identify",Aw="$groupidentify";function xo(e,t){Ie(e)&&e.forEach(t)}function _t(e,t){if(!qe(e))if(Ie(e))e.forEach(t);else if((n=>n instanceof FormData)(e))e.forEach((n,i)=>t(n,i));else for(const n in e)Cx.call(e,n)&&t(e[n],n)}const $t=function(e,...t){for(const n of t)for(const i in n)n[i]!==void 0&&(e[i]=n[i]);return e};function Bh(e){const t=Object.keys(e);let n=t.length;const i=new Array(n);for(;n--;)i[n]=[t[n],e[t[n]]];return i}const XM=function(e){return function(...t){try{return e.apply(this,t)}catch(n){_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(n)}}},Ix=function(e){const t={};return _t(e,function(n,i){(et(n)&&n.length>0||sn(n))&&(t[i]=n)}),t};function Gk(e){const t=D({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch{}return t}const QM=["herokuapp.com","vercel.app","netlify.app"];function WM(e){const t=e==null?void 0:e.hostname;if(!et(t))return!1;const n=t.split(".").slice(-2).join(".");for(const i of QM)if(n===i)return!1;return!0}function gt(e,t,n,i){const{capture:a=!1,passive:o=!0}=i??{};e==null||e.addEventListener(t,n,{capture:a,passive:o})}function G0(e){return e.name==="ph_toolbar_internal"}const fu=e=>{if(ge){try{const t=e+"=",n=ge.cookie.split(";").filter(i=>i.length);for(let i=0;n.length>i;i++){let a=n[i];for(;a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return sn(e)&&isFinite(e)&&Math.floor(e)===e});var ZM=class Y0{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");const o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new Y0(o)}toString(){let t="";for(let n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Y0(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let n=0;16>n;n++){const i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}},KM=class{generate(){const e=this.generateOrAbort();if(!ue(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(ue(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return sn(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return ZM.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new JM}};let Yk=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};se&&!ue(se.crypto)&&crypto.getRandomValues&&(Yk=e=>crypto.getRandomValues(e));var JM=class{nextUint32(){return this.Rt.length>this.Et||(Yk(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let Rw;const mi=()=>eA().toString(),eA=()=>(Rw||(Rw=new KM)).generate();let qc="";const tA=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let no=null;const Yt={At(){if(!Xt(no))return no;if(no=!1,ge)try{const e=`__ph_cookie_support_${mi()}`;Yt.$t(e,"xyz"),no=fu(e)==='"xyz"',Yt.Pt(e)}catch{no=!1}return no},Dt(e){_e.error("cookieStore error: "+e)},Ot:fu,Lt(e){let t;try{t=JSON.parse(Yt.Ot(e))||{}}catch{}return t},$t(e,t,n,i,a){if(!ge)return!1;try{let o="",u="";const h=(function(p,g){if(g){let v=(function(b,y=ge){if(qc)return qc;if(!y||["localhost","127.0.0.1"].includes(b))return"";const _=b.split(".");let j=Math.min(_.length,8);const N="dmn_chk_"+mi();for(;!qc&&j--;){const S=_.slice(j).join("."),C=N+"=1;domain=."+S+";path=/";y.cookie=C+";max-age=3",y.cookie.includes(N)&&(y.cookie=C+";max-age=0",qc=S)}return qc})(p);if(!v){const b=(y=>{const _=y.match(tA);return _?_[0]:""})(p);b!==v&&_e.info("Warning: cookie subdomain discovery mismatch",b,v),v=b}return v?"; domain=."+v:""}return""})(ge.location.hostname,i);if(n){const p=new Date;p.setTime(p.getTime()+864e5*n),o="; expires="+p.toUTCString()}a&&(u="; secure");const f=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+h+u;return f.length>3686.4&&_e.warn("cookieStore warning: large cookie, len="+f.length),ge.cookie=f,!0}catch{return!1}},Pt(e,t){if(ge!=null&&ge.cookie&&(!t||!Xt(fu(e))))try{Yt.$t(e,"",-1,t)}catch{return}}};let kg=null;const ct={At(){if(!Xt(kg))return kg;let e=!0;if(ue(se))e=!1;else try{const t="__mplssupport__";ct.$t(t,"xyz"),ct.Ot(t)!=='"xyz"'&&(e=!1),ct.Pt(t)}catch{e=!1}return e||_e.error("localStorage unsupported; falling back to cookie store"),kg=e,e},Dt(e){_e.error("localStorage error: "+e)},Ot(e){try{return se==null?void 0:se.localStorage.getItem(e)}catch(t){ct.Dt(t)}return null},Lt(e){try{return JSON.parse(ct.Ot(e))||{}}catch{}return null},$t(e,t){try{return se==null||se.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ct.Dt(n)}return!1},Pt(e){try{se==null||se.localStorage.removeItem(e)}catch(t){ct.Dt(t)}}},jg=[ua,gr,pi,il,ha,rl,fa,Nu,da],nl=[Ox,fi,mo,Ck,zx,go,yo,os],rf=e=>e+"_cpm",nA=["__proto__","constructor","prototype"],Ng=e=>{if(!Ze(e))return{};const t={};return Object.keys(e).forEach(n=>{nA.indexOf(n)===-1&&(t[n]=e[n])}),t},Cg=(e,t=[])=>{const n={};return[...nl,...t].forEach(i=>{const a=e[i];ue(a)||Xt(a)||a===""||(n[i]=a)}),n},Xk=e=>{let t=5381,n=2166136261;for(let i=0;e.length>i;i++){const a=e.charCodeAt(i);t=33*t^a,n=Math.imul(n^a,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},Ow=(e,t)=>({p:t,f:Xk(JSON.stringify(e))}),Lw=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const n=Yt.Lt(rf(e)),i=(n==null?void 0:n.f)===Xk(t)&&Ie(n.p);return{properties:i?n.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},Eg=(e,t)=>t+"|"+(Yt.Ot(rf(e))||""),so={},X0={At:()=>!0,Dt(e){_e.error("memoryStorage error: "+e)},Ot:e=>e in so?so[e]:null,Lt:e=>e in so?so[e]:null,$t:(e,t)=>(so[e]=t,!0),Pt(e){delete so[e]}};let Xa=null;const At={At(){if(!Xt(Xa))return Xa;if(Xa=!0,ue(se))Xa=!1;else try{const e="__support__";At.$t(e,"xyz"),At.Ot(e)!=='"xyz"'&&(Xa=!1),At.Pt(e)}catch{Xa=!1}return Xa},Dt(e){_e.error("sessionStorage error: ",e)},Ot(e){try{return se==null?void 0:se.sessionStorage.getItem(e)}catch(t){At.Dt(t)}return null},Lt(e){try{return JSON.parse(At.Ot(e))||null}catch{}return null},$t(e,t){try{return se==null||se.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){At.Dt(n)}return!1},Pt(e){try{se==null||se.sessionStorage.removeItem(e)}catch(t){At.Dt(t)}}};var sA=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.No.Pt(this.qo,this.Mr.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return dg(e)?1:Fe(n6,e)?0:-1}get No(){const e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?ct:Yt,n=t.At()?t:X0;if(!this.jo||this.jo!==n){this.jo=n;const i=e==="localStorage"?Yt:ct;i.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(dg(i.Ot(this.qo))),i.Pt(this.qo,this.Mr.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Mr.respect_dnt&&[En==null?void 0:En.doNotTrack,En==null?void 0:En.msDoNotTrack,$e.doNotTrack,En==null?void 0:En.globalPrivacyControl].some(e=>dg(e))}};function Qk(e,t){var n;const i=e==null||(n=e.config)===null||n===void 0?void 0:n.get_current_url;if(!xn(i))return t;try{const a=i(t);return et(a)&&a?a:t}catch(a){return _e.error("Error in get_current_url, falling back to window.location.href",a),t}}function Dw(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function bi(e){return!!e&&e.nodeType===1}function qn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Wk(e){return!!e&&e.nodeType===3}function Ux(e){return!!e&&e.nodeType===11&&bi(e.host)}function Hx(e){return e?jo(e).split(/\s+/):[]}function zw(e,t){const n=(function(i){var a;const o=se==null||(a=se.location)===null||a===void 0?void 0:a.href;return ue(o)?void 0:Qk(i,o)})(t);return!!(n&&e&&e.some(i=>n.match(i)))}function Co(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Hx(t)}function Zk(e){return qe(e)?null:jo(e).split(/(\s+)/).filter(t=>_o(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Eu(e){let t="";return al(e)&&!Eo(e)&&e.childNodes&&e.childNodes.length&&_t(e.childNodes,function(n){var i;Wk(n)&&n.textContent&&(t+=(i=Zk(n.textContent))!==null&&i!==void 0?i:"")}),jo(t)}function pu(e){var t;return ue(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const qx=["a","button","form","input","select","textarea","label"];function Q0(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch{return!1}}function W0(e,t){if(ue(t))return!0;for(const n of e)if(t.some(i=>Q0(n,i)))return!0;return!1}function Kk(e){const t=e.parentNode;return!(!t||!bi(t))&&t}const Tg=[".ph-no-autocapture","[data-ph-no-autocapture]"],Jk=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Vx=[...Jk,"+","-","−","–"],$w=Vx.length+10,iA=["button","a","input","select","textarea","label"],rA=["button","link","tab","menuitem","option"],Pw=(e,t)=>/[a-z0-9]/i.test(t)?Fe(Vx,t)?new RegExp(`\\b${t}\\b`).test(e):e.includes(t):e===t,aA=e=>Fe(iA,e.tagName.toLowerCase())||Fe(rA,(e.getAttribute("role")||"").toLowerCase());function Mg(e){let t="",n="";const i=u=>{bi(u)&&al(u)&&!Eo(u)&&(t+=` ${Eu(u)}`,n=n||u.getAttribute("aria-label")||"",_t(u.childNodes,i))};i(e),t=jo(t.replace(/\s+/g," "));const a=(_o(t)?t:"").toLowerCase(),o=e.getAttribute("aria-label")||(a?"":n);return{safeText:a,ariaLabel:jo(o).toLowerCase()}}const Bw=[".ph-no-rageclick",".ph-no-capture"],lA=["","text","search","email","password","url","tel","number"];function ej(e,t){if(!se||Gx(e))return!1;let n,i,a;var o,u;if(cs(t)?(n=!!t&&Bw,i=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:Bw,i=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(f){return!(!f||!bi(f))&&(!!qn(f,"textarea")||(qn(f,"input")?Fe(lA,(f.getAttribute("type")||"").toLowerCase()):(function(p){var g;if(p.isContentEditable)return!0;const v=(g=p.getAttribute)===null||g===void 0?void 0:g.call(p,"contenteditable");return v==="true"||v===""})(f)))})(e))return!1;const{targetElementList:h}=tj(e,!1);return!(i&&(function(f,{safeText:p,ariaLabel:g}){let v;if(f===!0)v=Jk;else{if(!Ie(f))return!1;if(f.length>$w)return _e.error(`[PostHog] content_ignorelist array cannot exceed ${$w} items. Use css_selector_ignorelist for more complex matching.`),!1;v=f.map(b=>b.toLowerCase())}return v.some(b=>Pw(p,b)||Pw(g,b))})(i,(function(f,p){for(const g of p)if(aA(g))return Mg(g);for(const g of p){try{if((se==null?void 0:se.getComputedStyle(g).getPropertyValue("cursor"))!=="pointer")break}catch{break}const v=Mg(g);if(v.safeText||v.ariaLabel)return v}return Mg(f)})(e,h))||W0(h,n))}const Gx=e=>!e||qn(e,"html")||!bi(e),tj=(e,t)=>{if(!se||Gx(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const i=[e];let a=e;for(;a.parentNode&&!qn(a,"body");){if(Ux(a.parentNode)){i.push(a.parentNode.host),a=a.parentNode.host;continue}const o=Kk(a);if(!o)break;if(t||qx.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{const u=se.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:i}};function al(e){const t=new Set;let n=0;for(let o=e;o.parentNode&&!qn(o,"body");o=o.parentNode){if(n++>=1e3||t.has(o))return!1;t.add(o);const u=Co(o);if(Fe(u,"ph-sensitive")||Fe(u,"ph-no-capture"))return!1}if(Fe(Co(e),"ph-include"))return!0;const i=e.type||"";if(et(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const a=e.name||e.id||"";return!et(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function Eo(e){return!!(qn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||qn(e,"select")||qn(e,"textarea")||e.getAttribute("contenteditable")==="true")}const Fw=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Iw=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,oA=[16,15,14,13],cA=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Uw=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Hw=/[0-9A-Za-z_]/;function uA(e){let t=0,n=!1;for(let i=e.length-1;i>=0;i--){let a=e.charCodeAt(i)-48;n&&(a*=2,a>9&&(a-=9)),t+=a,n=!n}return t%10==0}function _o(e,t=!0){return!(qe(e)||et(e)&&(e=jo(e),(t?Fw.test((e||"").replace(/[- ]/g,"")):(function(n){let i;for(Iw.lastIndex=0;i=Iw.exec(n);){const a=i[2];if(!a)continue;const o=a.replace(/[- ]/g,"");for(let u=0;o.length>u;u++)for(const h of oA){const f=u+h;if(o.length>=f){const p=o.slice(u,f);if(Fw.test(p)&&uA(p))return!0}}}return!1})(e))||(t?cA.test(e):(function(n){let i;for(Uw.lastIndex=0;i=Uw.exec(n);){const a=i[1],o=i[3];if(!(a&&o&&Hw.test(a)&&Hw.test(o)))return!0}return!1})(e))))}function qw(e){let t=Eu(e);return t=`${t} ${nj(e)}`.trim(),_o(t)?t:""}function nj(e){let t="";return e&&e.childNodes&&e.childNodes.length&&_t(e.childNodes,function(n){var i;if(n&&((i=n.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const a=Eu(n);t=`${t} ${a}`.trim(),n.childNodes&&n.childNodes.length&&(t=`${t} ${nj(n)}`.trim())}catch(a){_e.error("[AutoCapture]",a)}}),t}function Vw(e){return e.replace(/"|\\"/g,'\\"')}function dA(e){const t=e.attr__class;if(t)return Ie(t)?t:Hx(t)}const mh=Wt("[Dead Clicks]"),hA=()=>!0,fA=e=>{var t;const n=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(Lx)),i=e.instance.config.capture_dead_clicks;return cs(i)?i:!!Ze(i)||n};var Gw=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Lx]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Ho()}):this.stop()}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this.instance,"dead-clicks-autocapture",a=>{a?mh.error("failed to load script",a):e()})}Ho(){var e;if(ge){if(!this.Bo&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=Ze(this.instance.config.capture_dead_clicks)?D({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=$e.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(ge),mh.info("starting...")}}else mh.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,mh.info("stopping..."))}};const Vc=Wt("[SegmentIntegration]");function Yw(e,t,n=!0){const i=e.config.segment;if(!i)return t();const{analytics:a,filterProperties:o}=(h=>xn(h.register))(u=i)?{analytics:u}:u;var u;(function(h,f,p,g){const v=y=>{const _=()=>y.anonymousId()||mi();h.config.get_device_id=_,g&&y.id()&&(h.register({distinct_id:y.id(),$device_id:_()}),h.persistence.set_property(os,Ph)),p(g?void 0:y.anonymousId()||void 0)},b=f.user();"then"in b&&xn(b.then)?b.then(v):v(b)})(e,a,h=>{a.register(((f,p,{filterProperties:g}={})=>{typeof Promise<"u"&&Promise.resolve||Vc.warn("This browser does not have Promise support, and can not use the segment integration");const v=(b,y)=>{if(!y)return b;const _=!!p&&b.event.anonymousId===p&&!b.event.userId;_||b.event.userId||b.event.anonymousId===f.get_distinct_id()||(Vc.info("No userId set, resetting PostHog"),f.reset()),_||(p=void 0),b.event.userId&&b.event.userId!==f.get_distinct_id()&&(Vc.info("UserId set, identifying with PostHog"),f.identify(b.event.userId));let j=f.calculateEventProperties(y,b.event.properties);if(!qe(g)){const N=b.event.properties||{},S={};for(const E of Object.keys(j))Cx.call(N,E)||(S[E]=j[E]);const C=((E,R)=>{const A=Ie(E)?E:[E];let O=D({},R);for(const P of A)try{if(O=P(O),qe(O))return null}catch(z){return Vc.error("Error in Segment filterProperties:",z),null}return O})(g,S);if(qe(C))return b;j=C}return b.event.properties=Object.assign({},j,b.event.properties),b};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(b){return v(b,b.event.event)},page(b){return v(b,Fx)},identify(b){return v(b,Vk)},screen(b){return v(b,"$screen")}}})(e,h,{filterProperties:o})).then(()=>{t()},f=>{Vc.error("Failed to register the Segment integration",f),t()})},n)}const sj="posthog-js";function ij(e,{organization:t,projectId:n,prefix:i,severityAllowList:a=["error"],sendExceptionsToPostHog:o=!0}={}){return u=>{var h,f,p,g,v;if(a!=="*"&&!a.includes(u.level)||!e.__loaded)return u;u.tags||(u.tags={});const b=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);u.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const y=((h=u.exception)===null||h===void 0?void 0:h.values)||[],_=y.map(S=>D(D({},S),{},{stacktrace:S.stacktrace?D(D({},S.stacktrace),{},{type:"raw",frames:(S.stacktrace.frames||[]).map(C=>D(D({},C),{},{platform:"web:javascript"}))}):void 0})),j={$exception_message:((f=y[0])===null||f===void 0?void 0:f.value)||u.message,$exception_type:(p=y[0])===null||p===void 0?void 0:p.type,$exception_level:u.level,$exception_list:_,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((g=y[0])===null||g===void 0?void 0:g.value)||u.message,$sentry_exception_type:(v=y[0])===null||v===void 0?void 0:v.type,$sentry_tags:u.tags};var N;return t&&n&&(j.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+u.event_id),o&&((N=e.exceptions)===null||N===void 0||N.sendExceptionEvent(j)),u}}var pA=class{constructor(e,t,n,i,a,o){this.name=sj,this.setupOnce=function(u){u(ij(e,{organization:t,projectId:n,prefix:i,severityAllowList:a,sendExceptionsToPostHog:o==null||o}))}}},Xw=class{constructor(e){this.Uo=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(_e.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,t){var n;const i=this.Qo(e,t);return this.Wo={pathname:(n=se==null?void 0:se.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Qo(e,(t=this.Wo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,t){const n=this.Wo;if(!n)return{$pageview_id:t};let i={$pageview_id:t,$prev_pageview_id:n.pageViewId};const a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:o,lastScrollY:u,maxScrollY:h,maxContentHeight:f,lastContentY:p,maxContentY:g}=a;if(!(ue(o)||ue(u)||ue(h)||ue(f)||ue(p)||ue(g))){o=Math.ceil(o),u=Math.ceil(u),h=Math.ceil(h),f=Math.ceil(f),p=Math.ceil(p),g=Math.ceil(g);const v=o>1?Ui(u/o,0,1,_e):1,b=o>1?Ui(h/o,0,1,_e):1,y=f>1?Ui(p/f,0,1,_e):1,_=f>1?Ui(g/f,0,1,_e):1;i=$t(i,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:p,$prev_pageview_last_content_percentage:y,$prev_pageview_max_content:g,$prev_pageview_max_content_percentage:_})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};const Gc=["flags","surveys"],mA={[CM]:{exposure:"hidden"},[tf]:{exposure:"hidden"},[EM]:{exposure:"hidden"},[B0]:{exposure:"hidden"},[yo]:{exposure:"hidden"},[du]:{exposure:"hidden"},[Sk]:{exposure:"event"},[F0]:{exposure:"hidden"},[jk]:{exposure:"hidden"},[I0]:{exposure:"event"},[kk]:{exposure:"hidden"},[U0]:{exposure:"event"},[H0]:{exposure:"event"},[Lx]:{exposure:"event"},[Dx]:{exposure:"hidden"},[Nk]:{exposure:"event"},[hu]:{exposure:"hidden"},[TM]:{exposure:"hidden"},[mo]:{exposure:"hidden"},[Ck]:{exposure:"event"},[MM]:{exposure:"event",shouldSkipFromEventProperties:e=>Xt(e)},[DM]:{exposure:"event"},[zM]:{exposure:"event"},[$M]:{exposure:"event"},[PM]:{exposure:"event"},[BM]:{exposure:"hidden"},[pi]:{exposure:"hidden",storageGroup:"flags"},[gr]:{exposure:"hidden",storageGroup:"flags"},[P0]:{exposure:"hidden"},[il]:{exposure:"hidden",storageGroup:"flags"},[ha]:{exposure:"hidden",storageGroup:"flags"},[rl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[uu]:{exposure:"hidden",storageGroup:"flags"},[Bi]:{exposure:"hidden"},[tl]:{exposure:"hidden"},[ua]:{exposure:"hidden"},[ca]:{exposure:"hidden"},[su]:{exposure:"hidden",storageGroup:"surveys"},[nf]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Tk]:{exposure:"event"},[Mk]:{exposure:"hidden"},[Ak]:{exposure:"hidden"},[q0]:{exposure:"hidden"},[FM]:{exposure:"hidden"},[IM]:{exposure:"hidden"},[UM]:{exposure:"event"},[HM]:{exposure:"event"},[qM]:{exposure:"event"},[VM]:{exposure:"event"},[da]:{exposure:"hidden"},[nu]:{exposure:"hidden"},[Ek]:{exposure:"event"},[Nu]:{exposure:"hidden"},[fa]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[os]:{exposure:"hidden"},[V0]:{exposure:"hidden"},[GM]:{exposure:"hidden"},[Rk]:{exposure:"hidden"},[Ok]:{exposure:"hidden"},[go]:{exposure:"hidden"},[zx]:{exposure:"hidden"},[AM]:{exposure:"event"},[RM]:{exposure:"event"},[OM]:{exposure:"event"},[LM]:{exposure:"event"},[Dk]:{exposure:"event"},[zk]:{exposure:"event"},[$x]:{exposure:"hidden"},[Px]:{exposure:"hidden"},[$k]:{exposure:"hidden"},[Pk]:{exposure:"hidden"},[Bk]:{exposure:"hidden"},[Fk]:{exposure:"hidden"},[Ik]:{exposure:"hidden"},[Uk]:{exposure:"hidden"},[Hk]:{exposure:"hidden"},[YM]:{exposure:"event"}},gA=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],On=e=>{const t=mA[e];if(t)return t;for(const[n,i]of gA)if(e.indexOf(n)===0)return i};function rj(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const aj=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},lj=(e,t)=>e>=t&&aj(),oj=(e,t,n,i)=>{if(e===0){if(aj()){const a=t+1;return a===n&&i(),a}return t}return 0},vo=(e,t)=>{try{let n;return JSON.stringify(e,(i,a)=>{var o;return zo(a)?((o=n)!==null&&o!==void 0||(n=new WeakMap),n.has(a)||n.set(a,Gk(a)),n.get(a)):typeof a=="bigint"?a.toString():a},t)}catch{return yS(e)}},_r=e=>{const t=ge==null?void 0:ge.createElement("a");return ue(t)?null:(t.href=e,t)},To=function(e,t){const n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let a=0;n.length>a;a++){const o=n[a].split("=");if(o[0]===t){i=o;break}}if(!Ie(i)||2>i.length)return"";{let a=i[1];try{a=decodeURIComponent(a)}catch{_e.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")}},Tu=function(e,t,n){if(!e||!t||!t.length)return e;const i=e.split("#"),a=i[1],o=(i[0]||"").split("?"),u=o[1],h=o[0],f=(u||"").split("&"),p=[];for(let v=0;f.length>v;v++){const b=f[v].split("=");Ie(b)&&(t.includes(b[0])?p.push(b[0]+"="+n):p.push(f[v]))}let g=h;return u!=null&&(g+="?"+p.join("&")),a!=null&&(g+="#"+a),g},af=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Mo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],xA=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Mo],Mu="<masked>",vA=["li_fat_id"];function cj(e,t,n){if(!ge)return{};const i=t?[...Mo,...n||[]]:[],a=uj(Tu(ge.URL,i,Mu),e),o=(function(){const u={};return _t(vA,function(h){const f=fu(h);u[h]=f||null}),u})();return $t(o,a)}function uj(e,t){const n=xA.concat(t||[]),i={};return _t(n,function(a){const o=To(e,a);i[a]=o||null}),i}function dj(e){const t=(function(a){return a?a.search("https?://(.*)google.([^/?]*)")===0?"google":a.search("https?://(.*)bing.com")===0?"bing":a.search("https?://(.*)yahoo.com")===0?"yahoo":a.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!Xt(t)){i.$search_engine=t;const a=ge?To(ge.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function hj(){return navigator.language||navigator.userLanguage}function bA(){const e=hj();return typeof e=="string"?e.split("-")[0]:void 0}const lf="$direct";function fj(){return(ge==null?void 0:ge.referrer)||lf}function pj(e,t,n=!1){const i=e?[...Mo,...t||[]]:[],a=n?ma(zt==null?void 0:zt.href):zt==null?void 0:zt.href,o=a==null?void 0:a.substring(0,1e3);return{r:fj().substring(0,1e3),u:o?Tu(o,i,Mu):void 0}}function mj(e,t=!1){var n;const{r:i,u:a}=e,o=t?ma(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==lf?lf:(n=_r(i))===null||n===void 0?void 0:n.host};if(o){u.$current_url=o;const h=_r(o);u.$host=h==null?void 0:h.host,u.$pathname=h==null?void 0:h.pathname;const f=uj(o);$t(u,f)}if(i){const h=dj(i);$t(u,h)}return u}function yA(){try{return new Date().getTimezoneOffset()}catch{return}}const _A={flags:fa,surveys:nf},wA=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gh=e=>`${e}_cookie_identity_change_pending`,xh=e=>{let t="",n=0;for(const i of e){const a=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(n+a>1e3)break;t+=i,n+=a}return t},Sn="main",mr=[pi,gr,il,ha,rl,fa,uu,ua],Ag=e=>mr.indexOf(e)!==-1,gj=[yo,du],Qw=e=>gj.indexOf(e)!==-1,sa=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},io=e=>{if(!e)return{};const t=JSON.parse(e);return Ze(t)?t:{}},Ww=(e,t)=>{_t(e,(n,i)=>{const a=On(i);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var Rg=class{constructor(e,t,n=!0,i=!e.cookieless_mode){if(this.Zo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Mr=e,this.aa=n,this.props={},this.la=void 0,this.ua=(a=>{let o="";return a.token&&(o=a.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),a.persistence_name?"ph_"+a.persistence_name:"ph_"+o+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.No=this.ca(e),this.Xo=this.ha(e),this.load(i),this.da(),e.debug&&_e.info("Persistence loaded",e.persistence,D({},this.props)),this.update_config(e,e,t),this.save(),se){const a=()=>this.flush();gt(se,"beforeunload",a,{capture:!1}),gt(se,"pagehide",a,{capture:!1}),this.va=o=>{if(this.Jo&&(!o.storageArea||o.storageArea===(se==null?void 0:se.localStorage))&&o.key)if(o.key!==this.ua){if(this.Xo){const u=Gc.find(h=>o.key===this.fa(h));u&&this.pa(o.key,u)}}else this.pa(o.key,Sn)},gt(se,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,n])=>{const i=this.ea.get(t);if(!Ag(t)||i===!0)return;if(n===!0)return void this.ga(t,!0);const a=new Set(i||[]);n.forEach(o=>a.add(o)),a.size&&this.ga(t,a)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&se&&(se.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,t,n=!0){if(this.hi)return!1;let i,a;try{if(a=ct.Ot(e),Xt(a)){const h=this.ma(t);return h.storageValue=null,t!==Sn&&(h.persisted=!1),!1}i=io(a)}catch{return!1}const o=t===Sn?i:ct.Lt(this.ua);if(o&&this.ya(o))return!1;const u=this.ba(i,t,n);return t===Sn&&this.Xo&&!sa(this._a().main,i)||this.wa(i,t,!0,a),u}ya(e){const t=this.props[fi],n=e[fi];return!ue(t)&&!ue(n)&&t!==n}wa(e,t,n,i){const a=this.ma(t);a.storageValue=i,t!==Sn&&(a.persisted=n);try{a.fingerprint=this.ka(e,t)}catch{a.fingerprint=void 0}}ba(e,t,n){let i=!1;return mr.forEach(a=>{var o;const u=(o=On(a))===null||o===void 0?void 0:o.storageGroup;if(t===Sn&&this.Xo&&u||t!==Sn&&u!==t)return;const h=a in e,f=this.Sa(a,h?e[a]:void 0),p=this.ea.has(a)?a in this.props:h;p===a in this.props&&sa(f,this.props[a])||(p?this.xa(a,f,!1):this.$a(a,!1),i=!0)}),i&&n&&this.oa.forEach(a=>a()),i}Ca(){if(!this.Jo)return!1;try{this.sa=!1;const e=ct.Ot(this.ua),t=this.ma(Sn);let n,i=!1,a=!1;if(e!==t.storageValue)if(Xt(e))t.storageValue=null;else{if(n=io(e),this.sa=!this.na&&this.ya(n),this.sa)return!1;a=this.ba(n,Sn,!1),!this.Xo||sa(this._a().main,n)?this.wa(n,Sn,!0,e):t.storageValue=e,i=!0}return this.Xo&&Gc.forEach(o=>{const u=ct.Ot(this.fa(o)),h=this.ma(o),f=n||{},p=i&&mr.some(v=>{var b;return((b=On(v))===null||b===void 0?void 0:b.storageGroup)===o&&v in f});if(u===h.storageValue&&!p)return;if(Xt(u))return h.storageValue=null,h.persisted=!1,void(p&&(a=this.ba(f,o,!1)||a));const g=io(u);a=this.ba(g,o,!1)||a,this.wa(g,o,!0,u)}),a}catch{return!1}}ga(e,t){this.ea.set(e,t);const n=On(e);n!=null&&n.volatile||(this.ma((this.Xo?n==null?void 0:n.storageGroup:void 0)||Sn).fingerprint=void 0,this.Ta(e))}Ia(){mr.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=ct.Ot(this.ua),t=io(e);this.ma(Sn).storageValue=e,mr.forEach(n=>{var i;const a=this.Xo?(i=On(n))===null||i===void 0?void 0:i.storageGroup:void 0,o=a?ct.Ot(this.fa(a)):null;if(a){const h=this.ma(a);h.storageValue=o,h.persisted=!Xt(o)}const u=a&&!Xt(o)?io(o):t;n in this.props?this.Ma(n,u[n],this.props[n]):n in u&&this.ga(n,!0)})}catch{}}Sa(e,t){const n=this.ea.get(e);if(!n)return t;if(n===!0)return this.props[e];if(e==="$active_feature_flags"){const o=new Set(Ie(t)?t:[]),u=new Set(Ie(this.props[e])?this.props[e]:[]);return n.forEach(h=>u.has(h)?o.add(h):o.delete(h)),Array.from(o)}const i=Ze(t)?D({},t):{},a=Ze(this.props[e])?this.props[e]:{};return n.forEach(o=>{o in a?i[o]=a[o]:delete i[o]}),i}Ma(e,t,n){if(!Ag(e))return;const i=this.ea.get(e);if(i===!0)return;let a=t;if(this.Jo)try{var o;const h=this.Xo?(o=On(e))===null||o===void 0?void 0:o.storageGroup:void 0,f=h?this.fa(h):this.ua;a=io(ct.Ot(f))[e]}catch{}const u=new Set(i||[]);if(e==="$active_feature_flags"){if(!ue(t)&&!Ie(t)||!ue(a)&&!Ie(a)||!Ie(n))return void this.ga(e,!0);const h=new Set(t||[]),f=new Set(a||[]),p=new Set(n);new Set([...h,...p]).forEach(g=>{h.has(g)!==p.has(g)&&u.add(g)}),u.forEach(g=>{f.has(g)===p.has(g)&&u.delete(g)})}else{if(!Ze(n))return void(sa(a,n)?this.ea.delete(e):this.ga(e,!0));{if(!ue(t)&&!Ze(t)||ue(t)&&_s(n)&&ue(a))return void this.ga(e,!0);const h=Ze(t)?t:{},f=Ze(a)?a:{};new Set([...Object.keys(h),...Object.keys(n)]).forEach(p=>{p in h==p in n&&sa(h[p],n[p])||u.add(p)}),u.forEach(p=>{p in f==p in n&&sa(f[p],n[p])&&u.delete(p)})}}u.size?this.ga(e,u):this.ea.delete(e)}Ea(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return sn(t)&&t>0?t:0}Pa(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Cg(e,this.Mr.cookie_persisted_properties||[]),n=Ow(t,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(n),a=Yt.Ot(this.ua)||void 0;a&&Eg(this.ua,a)===i&&(this.Ra=i,this.Aa=a)}catch{}else try{const t=Yt.Ot(this.ua)||void 0;this.Ra=t?Eg(this.ua,t):void 0,this.Aa=t}catch{}}syncCookieProperties(){return this.Fa(this.Mr)}Fa(e,t=!1){if(this.hi&&!t||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let n;try{n=Yt.Ot(this.ua)||void 0}catch{}if(!n||n===this.Aa)return!1;const i=Eg(this.ua,n);let a;try{a=Ng(JSON.parse(n))}catch{return!1}if((Yt.Ot(this.ua)||void 0)!==n)return!1;this.Ra=i,this.Aa=n;const o=Lw(this.ua,n),u=[...nl,...o.properties],h={};if(Object.keys(a).forEach(j=>{const N=a[j];(ue(N)||Xt(N)||N===""||j==="$user_state"&&N!=="anonymous"&&N!=="identified")&&(h[j]=!0,delete a[j])}),_s(a))return!1;const f="distinct_id"in a||a.$user_state==="anonymous"||a.$user_state==="identified",p=this.props,g=p[fi],v=p[os],b=$t({},p);[...nl,...e.cookie_persisted_properties||[]].forEach(j=>{if(u.indexOf(j)!==-1&&!(j in a)&&!h[j]&&(f||j!=="distinct_id"&&j!=="$user_state")){const N=b[j];(o.isValid||nl.indexOf(j)===-1||N!==!1&&N!==0)&&delete b[j]}}),this.props=$t(b,a),mr.forEach(j=>{const N=j in this.props;j in p===N&&sa(p[j],this.props[j])||(N?this.Ma(j,p[j],this.props[j]):this.ga(j,!0))}),!f||"$user_state"in a||"$user_state"in this.props||this.xa(os,xr);const y=this.props[fi],_=this.props[os];return!f||y===g&&_===v||(this.na=!0,this.Yo=!0,At.$t(gh(this.ua),!0),this.$a(ua),this.$a(gr),this.$a(pi),this.$a(il),this.$a(ha),this.$a(rl),this.$a(fa),this.$a(Nu),this.$a(da),_!=="anonymous"||v!=="identified"&&a.$user_state!=="anonymous"&&(ue(g)||y===g)||(Ww(this.props,a),this.$a(ca)),_==="identified"?this.props.$user_id=y:delete this.props.$user_id,this.$a(tf)),!0}consumeCookieIdentityChange(){const e=gh(this.ua),t=this.Yo||!!At.Ot(e);return this.Yo=!1,t&&At.Pt(e),t}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(ue(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Zo[Sn],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():ue(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ca(e){wA.indexOf(e.persistence.toLowerCase())===-1&&(_e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((u=[],h=!1,f=()=>!1)=>{const p=[...nl,...u];return D(D({},ct),{},{Lt(g){try{let b,y={};try{b=Yt.Ot(g)||void 0,y=b?Ng(JSON.parse(b)):{}}catch{}const _=JSON.parse(ct.Ot(g)||"{}");let j;if(h){const N=Lw(g,b),S=[...nl,...N.properties],C={};Object.keys(y).forEach(R=>{const A=y[R];Xt(A)||A===""||R==="$user_state"&&A!=="anonymous"&&A!=="identified"||(C[R]=A)});const E="distinct_id"in C||C.$user_state==="anonymous"||C.$user_state==="identified";if(Object.keys(C).length>0){var v;const R=_[fi],A=(v=_.$user_state)!==null&&v!==void 0?v:xr;p.forEach(O=>{if(S.indexOf(O)!==-1&&!(O in y)&&(E||O!=="distinct_id"&&O!=="$user_state")){const P=_[O];(N.isValid||nl.indexOf(O)===-1||P!==!1&&P!==0)&&delete _[O]}}),!E||"$user_state"in y||"$user_state"in _||(_[os]=xr),!E||("distinct_id"in C?C[fi]:_[fi])===R&&("$user_state"in C?C[os]:_[os])===A||(jg.forEach(O=>delete _[O]),C.$user_state==="identified"&&"distinct_id"in C?_.$user_id=C[fi]:delete _.$user_id,C.$user_state!=="identified"&&(delete _[Ek],delete _[ca]),delete _.__alias)}j=$t(_,C)}else j=$t(y,_);return f()||ct.$t(g,j),j}catch{}return null},$t(g,v,b,y,_,j){const N=ct.$t(g,v,void 0,void 0,j);try{const S=Cg(v,u);if(Object.keys(S).length){if(h){const C=rf(g),E=Ow(S,u);if(Yt.$t(C,E,b,y,_,j),Yt.Ot(C)!==JSON.stringify(E)){Yt.Pt(C,y);const R=Cg(v);return Yt.$t(g,R,b,y,_,j),N}}Yt.$t(g,S,b,y,_,j)}}catch(S){ct.Dt(S)}return N},Pt(g,v){try{se==null||se.localStorage.removeItem(g),Yt.Pt(g,v),Yt.Pt(rf(g),v)}catch(b){ct.Dt(b)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi);let n,i=!1,a=!1;const o=e.persistence.toLowerCase();return o==="localstorage"&&ct.At()?(n=ct,a=!0):o==="localstorage+cookie"&&t.At()?(n=t,a=!0,i=!0):o==="sessionstorage"&&At.At()?n=At:o==="memory"?n=X0:o==="cookie"&&Yt.At()?(n=Yt,i=!0):t.At()?(n=t,a=!0,i=!0):Yt.At()?(n=Yt,i=!0):n=X0,this.Jo=a,this.Ko=i,n}fa(e){return`${this.ua}__${e}`}ha(e){return this.Jo&&!!e.split_storage}properties(){const e={};return _t(this.props,(t,n)=>{const i=On(n);if(!i||i.exposure==="event"){var a;if(!(i==null||(a=i.shouldSkipFromEventProperties)===null||a===void 0)&&a.call(i,t))return;e[n]=t}}),e}load(e=!1){if(this.hi&&!e)return;const t=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",n=t?ct.Lt(this.ua):null;let i={};if(t)try{i=Ng(Yt.Lt(this.ua)),_t(i,(h,f)=>{(ue(h)||Xt(h)||h==="")&&delete i[f]})}catch{}const a=this.No.Lt(this.ua);if(a&&(this.props=$t({},a)),this.Xo&&this.ja(),t&&a){var o,u;const h=n==null?void 0:n[fi],f=(o=n==null?void 0:n.$user_state)!==null&&o!==void 0?o:xr,p=a[fi],g=(u=a.$user_state)!==null&&u!==void 0?u:xr;if(p!==h||g!==f){this.Yo=!0,this.hi||At.$t(gh(this.ua),!0);const v=$t({},this.props);jg.forEach(y=>delete v[y]),g!=="anonymous"||f!=="identified"&&i.$user_state!=="anonymous"&&(ue(h)||p===h)||(Ww(v,i),delete v[ca]),this.props=v;const b=new Set;jg.forEach(y=>{var _;const j=(_=On(y))===null||_===void 0?void 0:_.storageGroup;j&&b.add(j)}),b.forEach(y=>{if(this.hi)return;const _={};_t(this.props,(j,N)=>{var S;((S=On(N))===null||S===void 0?void 0:S.storageGroup)===y&&(_[N]=j)}),_s(_)?(ct.Pt(this.fa(y)),this.Zo[y]={}):ct.$t(this.fa(y),_)&&(this.Zo[y]={persisted:!0,fingerprint:this.ka(_,y)})})}}At.Ot(gh(this.ua))&&(this.Yo=!0)}ja(){for(const e of Gc){const t=ct.Lt(this.fa(e));if(t&&!_s(t)){const n=this.ma(e);n.persisted=!0,this.Ba(e)||(n.fingerprint=this.ka(t,e)),this.za(e,t)||$t(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var n;return((n=On(t))===null||n===void 0?void 0:n.storageGroup)===e})}za(e,t){const n=_A[e];if(!n)return!1;const i=t[n],a=this.props[n];return sn(i)&&sn(a)&&a>i}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;const n=this.Xo?(t=On(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=n?ct.Lt(this.fa(n)):this.No.Lt(this.ua);if(i&&e in i)this.xa(e,i[e],!1);else{if(n){const a=this.No.Lt(this.ua);if(a&&e in a)return void this.xa(e,a[e],!1)}this.$a(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?ue(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){ue(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||gj.forEach(a=>this.refreshKey(a)));const t=!e&&!this.ia;t||(this.sa=!1);const n=!!t&&this.Ca();if(this.sa)return void(this.Mr.debug&&_e.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.Ha(),void(n&&this.oa.forEach(a=>a()));const i=this.Ua(this.No,this.ua,this.props,Sn);i==="written"&&this.Pa(this.props),i!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),n&&this.oa.forEach(a=>a())}Ha(){const{main:e,groups:t}=this._a(),n=this.Ua(this.No,this.ua,e,Sn);n==="written"&&this.Pa(e),n!=="failed"&&(this.na=!1,this.ra.clear(),mr.forEach(a=>{var o;!((o=On(a))===null||o===void 0)&&o.storageGroup||this.ea.delete(a)}));for(const a of Gc){var i;const o=t[a];if(_s(o)&&!(!((i=this.Zo[a])===null||i===void 0)&&i.persisted)){mr.forEach(h=>{var f;((f=On(h))===null||f===void 0?void 0:f.storageGroup)===a&&this.ea.delete(h)});continue}const u=this.Ua(ct,this.fa(a),o,a);u!=="failed"&&mr.forEach(h=>{const f=On(h);(f==null?void 0:f.storageGroup)!==a||u!=="written"&&f.volatile||this.ea.delete(h)})}}_a(){const e={},t={flags:{},surveys:{}};return _t(this.props,(n,i)=>{var a;const o=(a=On(i))===null||a===void 0?void 0:a.storageGroup;o?t[o][i]=n:e[i]=n}),{main:e,groups:t}}ka(e,t){if(t===Sn)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const n={};return _t(e,(i,a)=>{var o;n[a]=!((o=On(a))===null||o===void 0)&&o.volatile?"__volatile__":i}),JSON.stringify(n)}Ua(e,t,n,i){const a=this.ma(i);if(i!==Sn&&!a.dirty&&!ue(a.fingerprint))return"skipped";let o;try{if(o=this.ka(n,i),o===a.fingerprint)return a.dirty=!1,"skipped"}catch{o=void 0}return e.$t(t,n,this.Wa,this.Va,this.Ga,this.Mr.debug)?(a.dirty=!1,i!==Sn&&(a.persisted=!0),ue(o)||(a.fingerprint=o),this.Jo&&(a.storageValue=ct.Ot(t)),"written"):(this.Mr.debug&&_e.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),ue(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Pt(this.ua,!1),this.No.Pt(this.ua,!0),!e&&this.aa)for(const t of Gc)ct.Pt(this.fa(t));e?delete this.Zo[Sn]:this.Zo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(Ze(e)){this.syncCookieProperties(),ue(t)&&(t="None"),this.Wa=ue(n)?this.Qa:n;let i=!1;if(_t(e,(a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.xa(o,a),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(Ze(e)){this.syncCookieProperties(),this.Wa=ue(t)?this.Qa:t;let n=!1;if(_t(e,(i,a)=>{e.hasOwnProperty(a)&&(this.props[a]!==i||Ze(i)||Ie(i))&&(this.xa(a,i),n=!0)}),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let n=!1;for(const i of t)i in this.props&&(this.$a(i),n=!0);n&&this.save()}update_campaign_params(){const e=ge==null?void 0:ge.URL;if(e===this.la)return;const t=cj(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),n=!_s(Ix(t));return n&&this.register(t),this.la=e,n?t:void 0}update_search_keyword(){this.register((function(){const e=ge==null?void 0:ge.referrer;return e?dj(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:fj(),$referring_domain:(ge==null?void 0:ge.referrer)&&((e=_r(ge.referrer))===null||e===void 0?void 0:e.host)||lf},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=pj(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[go]:this.Ko?{r:xh(e.r),u:e.u?xh(e.u):void 0}:e},void 0)}get_initial_props(){const e={};_t([Ok,Rk],n=>{const i=this.props[n];i&&_t(i,function(a,o){e["$initial_"+T0(o)]=a})});const t=this.props[go];if(t){const n=(function(i,a=!1){const o=mj(i,a),u={};return _t(o,function(h,f){u[`$initial_${T0(f)}`]=h}),u})(t,this.Mr.disable_capture_url_hashes);$t(e,n)}return e}safe_merge(e){return _t(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){const i=e.persistence!==t.persistence,a=!((y,_)=>{if(y.length!==_.length)return!1;const j=[...y].sort(),N=[..._].sort();return j.every((S,C)=>S===N[C])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=i||a,u=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,h=e.disable_persistence||!!n,f=!!this.hi&&!h;h||this.Fa(t,f),this.Mr=e,!h&&(i||a||u)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(D(D({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),f));const p=o||u?this.ca(e):this.No;this.Za();const g=this.ha(e),v=o||g!==this.Xo,b=!h&&(v||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(f);this.ia=v;try{if(this.Qa=this.Wa=e.cookie_expiration,this.set_disabled(h),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),v){const y=this.props;this.clear(),this.No=p,this.Xo=g,this.props=y,this.save()}else u&&(this.No=p,h||(delete this.Zo[Sn],this.Na()))}finally{this.ia=!1,b&&this.qa()}}Za(){const e=this.props[go];if(!this.Ko||!Ze(e)||typeof e.r!="string")return;const t=xh(e.r),n=typeof e.u=="string"?xh(e.u):e.u;t===e.r&&n===e.u||this.xa(go,D(D({},e),{},{r:t,u:n}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const n=this.props.__timers||{};n[e]=t,this.xa(B0,n),this.save()}remove_event_timer(e){const t=this.props.__timers||{},n=t[e];return ue(n)||(delete t[e],this.xa(B0,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.xa(e,t),this.save()}xa(e,t,n=!0){var i;const a=this.props[e];this.props[e]=t,n&&(e!=="distinct_id"&&e!=="$user_state"||a===t||(this.na=!0),Qw(e)&&!sa(a,t)&&this.ra.add(e),this.Ma(e,a,t),!((i=On(e))===null||i===void 0)&&i.volatile||this.Ta(e))}$a(e,t=!0){delete this.props[e],t&&(Ag(e)&&this.ga(e,!0),Qw(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;const n=(t=On(e))===null||t===void 0?void 0:t.storageGroup;n&&(this.ma(n).dirty=!0)}ma(e){return this.Zo[e]||(this.Zo[e]={})}};const Bs={GZipJS:"gzip-js",Base64:"base64"},Yc={Activation:"events",Cancellation:"cancelEvents"},Og={Popover:"popover",API:"api",Widget:"widget"},Ps={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Lg={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Z0={Popover:"popover",Inline:"inline"};function vh(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&xn(n.then)&&n.then(void 0,()=>{})}}}}const SA={SHOWN:"product tour shown"},Zw={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Kw=Wt("[RateLimiter]");var kA=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach(i=>{Kw.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void Kw.warn(`could not rate limit - continuing. Error: "${i==null?void 0:i.message}"`,{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,n,i;const{captureEventsBurstLimit:a,captureEventsPerSecond:o}=this,u=new Date().getTime(),h=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:a,last:u};h.tokens+=(u-h.last)/1e3*o,h.last=u,h.tokens>a&&(h.tokens=a);const f=1>h.tokens;if(f||e||(h.tokens=Math.max(0,h.tokens-1)),f&&!e){const p=(sn(h.dropped)?h.dropped:0)+1;h.dropped=p,!this.lastEventRateLimited&&this.Ja(p)&&(h.dropped=0)}return this.lastEventRateLimited=f,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",h),{isRateLimited:f,remainingTokens:h.tokens}}Ka(e){const t=this.instance.config.property_denylist;return!Ie(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&(zt!=null&&zt.pathname))return`${(e=zt.origin)!==null&&e!==void 0?e:""}${zt.pathname}`}Ja(e){var t,n;const{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,o=this.Xa(),u=this.Ka("$session_id")?(t=(n=this.instance).get_session_id)===null||t===void 0?void 0:t.call(n):void 0,h=[`${e} event(s) dropped since the last warning`,o?`triggered on ${o}`:void 0,u?`session ${u}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${h}. Config is set to ${a} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const ia=Wt("[RemoteConfig]");var xj=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$e._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return ia.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void ia.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return ia.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(e)})}catch(e){ia.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(t.statusCode===0?t.error||ia.warn("Failed to fetch remote config from PostHog."):ia.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(i){ia.error("Error applying remote config",i)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)===null||n===void 0||n.ensureFlagsLoaded()}catch(i){ia.error("Error loading feature flags",i)}}},ei=Uint8Array,ws=Uint16Array,Ao=Uint32Array,Yx=new ei([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]),Xx=new ei([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]),Jw=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vj=function(e,t){for(var n=new ws(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new Ao(n[30]);for(i=1;30>i;++i)for(var o=n[i];n[i+1]>o;++o)a[o]=o-n[i]<<5|i;return[n,a]},bj=vj(Yx,2),K0=bj[1];bj[0][28]=258,K0[258]=28;for(var e5=vj(Xx,0)[1],yj=new ws(32768),Qt=0;32768>Qt;++Qt){var ro=(43690&Qt)>>>1|(21845&Qt)<<1;yj[Qt]=((65280&(ro=(61680&(ro=(52428&ro)>>>2|(13107&ro)<<2))>>>4|(3855&ro)<<4))>>>8|(255&ro)<<8)>>>1}var mu=function(e,t,n){for(var i=e.length,a=0,o=new ws(t);i>a;++a)++o[e[a]-1];var u,h=new ws(t);for(a=0;t>a;++a)h[a]=h[a-1]+o[a-1]<<1;for(u=new ws(i),a=0;i>a;++a)u[a]=yj[h[e[a]-1]++]>>>15-e[a];return u},cl=new ei(288);for(Qt=0;144>Qt;++Qt)cl[Qt]=8;for(Qt=144;256>Qt;++Qt)cl[Qt]=9;for(Qt=256;280>Qt;++Qt)cl[Qt]=7;for(Qt=280;288>Qt;++Qt)cl[Qt]=8;var of=new ei(32);for(Qt=0;32>Qt;++Qt)of[Qt]=5;var jA=mu(cl,9),NA=mu(of,5),_j=function(e){return(e/8|0)+(7&e&&1)},wj=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof ws?ws:e instanceof Ao?Ao:ei)(n-t);return i.set(e.subarray(t,n)),i},ur=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Xc=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Dg=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var a=n.length,o=n.slice();if(!a)return[new ei(0),0];if(a==1){var u=new ei(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort(function(A,O){return A.f-O.f}),n.push({s:-1,f:25001});var h=n[0],f=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:h.f+f.f,l:h,r:f};g!=a-1;)h=n[n[v].f>n[p].f?p++:v++],f=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:h.f+f.f,l:h,r:f};var b=o[0].s;for(i=1;a>i;++i)o[i].s>b&&(b=o[i].s);var y=new ws(b+1),_=J0(n[g-1],y,0);if(_>t){i=0;var j=0,N=_-t,S=1<<N;for(o.sort(function(A,O){return y[O.s]-y[A.s]||A.f-O.f});a>i;++i){var C=o[i].s;if(t>=y[C])break;j+=S-(1<<_-y[C]),y[C]=t}for(j>>>=N;j>0;){var E=o[i].s;t>y[E]?j-=1<<t-y[E]++-1:++i}for(;i>=0&&j;--i){var R=o[i].s;y[R]==t&&(--y[R],++j)}_=t}return[new ei(y),_]},J0=function(e,t,n){return e.s==-1?Math.max(J0(e.l,t,n+1),J0(e.r,t,n+1)):t[e.s]=n},t5=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ws(++t),i=0,a=e[0],o=1,u=function(f){n[i++]=f},h=1;t>=h;++h)if(e[h]==a&&h!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[h]}return[n.subarray(0,i),t]},Qc=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},ex=function(e,t,n){var i=n.length,a=_j(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;i>o;++o)e[a+o+4]=n[o];return 8*(a+4+i)},n5=function(e,t,n,i,a,o,u,h,f,p,g){ur(t,g++,n),++a[256];for(var v=Dg(a,15),b=v[0],y=v[1],_=Dg(o,15),j=_[0],N=_[1],S=t5(b),C=S[0],E=S[1],R=t5(j),A=R[0],O=R[1],P=new ws(19),z=0;C.length>z;++z)P[31&C[z]]++;for(z=0;A.length>z;++z)P[31&A[z]]++;for(var Z=Dg(P,7),I=Z[0],q=Z[1],L=19;L>4&&!I[Jw[L-1]];--L);var de,Q,V,G,H=p+5<<3,ae=Qc(a,cl)+Qc(o,of)+u,ye=Qc(a,b)+Qc(o,j)+u+14+3*L+Qc(P,I)+(2*P[16]+3*P[17]+7*P[18]);if(ae>=H&&ye>=H)return ex(t,g,e.subarray(f,f+p));if(ur(t,g,1+(ae>ye)),g+=2,ae>ye){de=mu(b,y),Q=b,V=mu(j,N),G=j;var T=mu(I,q);for(ur(t,g,E-257),ur(t,g+5,O-1),ur(t,g+10,L-4),g+=14,z=0;L>z;++z)ur(t,g+3*z,I[Jw[z]]);g+=3*L;for(var Ne=[C,A],Ce=0;2>Ce;++Ce){var $=Ne[Ce];for(z=0;$.length>z;++z)ur(t,g,T[B=31&$[z]]),g+=I[B],B>15&&(ur(t,g,$[z]>>>5&127),g+=$[z]>>>12)}}else de=jA,Q=cl,V=NA,G=of;for(z=0;h>z;++z)if(i[z]>255){var B;Xc(t,g,de[257+(B=i[z]>>>18&31)]),g+=Q[B+257],B>7&&(ur(t,g,i[z]>>>23&31),g+=Yx[B]);var oe=31&i[z];Xc(t,g,V[oe]),g+=G[oe],oe>3&&(Xc(t,g,i[z]>>>5&8191),g+=Xx[oe])}else Xc(t,g,de[i[z]]),g+=Q[i[z]];return Xc(t,g,de[256]),g+Q[256]},CA=new Ao([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),EA=(function(){for(var e=new Ao(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),zg=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function TA(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(b){for(var y=v,_=0;b.length>_;++_)y=EA[255&y^b[_]]^y>>>8;v=y},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var a,o,u,h,f,p=(h=10+((a=t).filename&&a.filename.length+1||0),f=8,(function(v,b,y,_,j,N){var S=v.length,C=new ei(_+S+5*(1+Math.floor(S/7e3))+j),E=C.subarray(_,C.length-j),R=0;if(!b||8>S)for(var A=0;S>=A;A+=65535){var O=A+65535;S>O?R=ex(E,R,v.subarray(A,O)):(E[A]=N,R=ex(E,R,v.subarray(A,S)))}else{for(var P=CA[b-1],z=P>>>13,Z=8191&P,I=(1<<y)-1,q=new ws(32768),L=new ws(I+1),de=Math.ceil(y/3),Q=2*de,V=function(Qe){return(v[Qe]^v[Qe+1]<<de^v[Qe+2]<<Q)&I},G=new Ao(25e3),H=new ws(288),ae=new ws(32),ye=0,T=0,Ne=(A=0,0),Ce=0,$=0;S>A;++A){var B=V(A),oe=32767&A,be=L[B];if(q[oe]=be,L[B]=oe,A>=Ce){var je=S-A;if((ye>7e3||Ne>24576)&&je>423){R=n5(v,E,0,G,H,ae,T,Ne,$,A-$,R),Ne=ye=T=0,$=A;for(var Ee=0;286>Ee;++Ee)H[Ee]=0;for(Ee=0;30>Ee;++Ee)ae[Ee]=0}var Be=2,Oe=0,Te=Z,Re=oe-be&32767;if(je>2&&B==V(A-Re))for(var Ft=Math.min(z,je)-1,vn=Math.min(32767,A),Vt=Math.min(258,je);vn>=Re&&--Te&&oe!=be;){if(v[A+Be]==v[A+Be-Re]){for(var St=0;Vt>St&&v[A+St]==v[A+St-Re];++St);if(St>Be){if(Be=St,Oe=Re,St>Ft)break;var wt=Math.min(Re,St-2),We=0;for(Ee=0;wt>Ee;++Ee){var xt=A-Re+Ee+32768&32767,Zt=xt-q[xt]+32768&32767;Zt>We&&(We=Zt,be=xt)}}}Re+=(oe=be)-(be=q[oe])+32768&32767}if(Oe){G[Ne++]=268435456|K0[Be]<<18|e5[Oe];var ie=31&K0[Be],ke=31&e5[Oe];T+=Yx[ie]+Xx[ke],++H[257+ie],++ae[ke],Ce=A+Be,++ye}else G[Ne++]=v[A],++H[v[A]]}}R=n5(v,E,N,G,H,ae,T,Ne,$,A-$,R)}return wj(C,0,_+_j(R)+j)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,h,f,!0)),g=p.length;return(function(v,b){var y=b.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>b.level?4:b.level==9?2:0,v[9]=3,b.mtime!=0&&zg(v,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){v[3]=8;for(var _=0;y.length>=_;++_)v[_+10]=y.charCodeAt(_)}})(p,t),zg(p,g-8,n.d()),zg(p,g-4,i),p}const MA=!!Nx||!!ku,Sj=new WeakMap,kj="text/plain";let $g=0,Fh=!1;const jj=(e,t)=>{const[n,i]=e.split("#"),[a,o]=n.split("?");if(!o)return e;const u=o.split("&").filter(h=>h.split("=")[0]!==t).join("&");return`${a}${u?`?${u}`:""}${i?`#${i}`:""}`},Du=(e,t,n=!0)=>{var i;const[a,o]=e.split("?"),u=D({},t),h=(i=o==null?void 0:o.split("&").map(p=>{var g;const[v,b]=p.split("="),y=n&&(g=u[v])!==null&&g!==void 0?g:b;return delete u[v],`${v}=${y}`}))!==null&&i!==void 0?i:[],f=(function(p,g="&"){let v,b;const y=[];return _t(p,function(_,j){ue(_)||ue(j)||j==="undefined"||(v=encodeURIComponent((N=>N instanceof File)(_)?_.name:_.toString()),b=encodeURIComponent(j),y[y.length]=b+"="+v)}),y.join(g)})(u);return f&&h.push(f),h.length>0?`${a}?${h.join("&")}`:a},Pg=e=>{if(e.nl)return e.nl;const{data:t,compression:n}=e;if(!t)return;if(n===Bs.GZipJS){const a=TA((function(o){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var h=new ei(o.length+(o.length>>>1)),f=0,p=function(y){h[f++]=y},g=0;u>g;++g){if(f+5>h.length){var v=new ei(f+8+(u-g<<1));v.set(h),h=v}var b=o.charCodeAt(g);128>b?p(b):2048>b?(p(192|b>>>6),p(128|63&b)):b>55295&&57344>b?(p(240|(b=65536+(1047552&b)|1023&o.charCodeAt(++g))>>>18),p(128|b>>>12&63),p(128|b>>>6&63),p(128|63&b)):(p(224|b>>>12),p(128|b>>>6&63),p(128|63&b))}return wj(h,0,f)})(vo(t)),{mtime:0});return{contentType:kj,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===Bs.Base64){const a=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,(h,f)=>String.fromCharCode(parseInt(f,16))))})(vo(t)),o=(u=>"data="+encodeURIComponent(typeof u=="string"?u:vo(u)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}const i=vo(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},Nj=e=>{const t=()=>e.transport==="sendBeacon"?{url:Du(e.url,{compression:Bs.Base64}),encodedBody:Pg(D(D({},e),{},{compression:Bs.Base64,nl:void 0}))}:{url:jj(e.url,"compression"),encodedBody:Pg(D(D({},e),{},{compression:void 0,nl:void 0}))};let n;try{n=Pg(e)}catch(a){if(bw(e.compression,To(e.url,"compression")))return _e.error("Failed to gzip request body, sending uncompressed payload",a),t();throw a}return n&&bw(e.compression,To(e.url,"compression"))&&!((i=n.body)instanceof ArrayBuffer?D0(new Uint8Array(i)):ArrayBuffer.isView(i)&&D0(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Fh=!0,t()):{url:e.url,encodedBody:n};var i},Cj=e=>{try{return Nj(e)}catch(n){var t;return _e.error(n),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:n}))}},AA=(function(){var e=Pt(function*(t){const n=yield(function(a){return z0.apply(this,arguments)})(vo(t.data),jn.DEBUG,{rethrow:!0});if(!n)return t;const i=yield n.arrayBuffer();return D(D({},t),{},{nl:{contentType:kj,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),RA=/Failed to fetch|NetworkError|Load failed/i,Ej=e=>(e==null?void 0:e.name)==="TypeError"&&RA.test((e==null?void 0:e.message)||""),Tj=e=>{try{const t=(function(n,i=Date.now()){if(typeof n!="string"||!n)return;const a=n.trim(),o=/^\d+\s*,/.test(a)?a.slice(0,a.indexOf(",")).trim():a;if(/^\d+$/.test(o)){const f=1e3*Math.min(Number(o),300);return f>0?f:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(o))return;const u=/^\w{3} \w{3} /.test(o)?o+" GMT":o,h=Date.parse(u)-i;return Number.isFinite(h)&&h>0?Math.min(h,$h):void 0})(e());return ue(t)?void 0:Math.min(t,3e4)}catch{return}},Mj=e=>{const t=Cj(e);if(!t)return;const n=new Nx;Sj.set(n,!0);const{url:i,encodedBody:a}=t;n.open(e.method||"GET",i,!0);const{contentType:o,body:u}=a??{};_t(e.headers,function(h,f){n.setRequestHeader(f,h)}),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var h;const f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}(h=e.callback)===null||h===void 0||h.call(e,f,Tj(()=>n.getResponseHeader("Retry-After")))}},n.send(u)},Aj=e=>{const t=Cj(e);if(!t)return;const{url:n,encodedBody:i}=t,{contentType:a,body:o,estimatedSize:u}=i??{},h=new Headers;_t(e.headers,function(_,j){h.append(j,_)}),a&&h.append("Content-Type",a);let f=null,p=!1;if(iw){const _=new iw;f={signal:_.signal,timeout:setTimeout(()=>{p=!0;try{_.abort(ek("AbortError","PostHog request timed out"+((j=e.timeout)?` after ${j}ms`:"")))}catch(N){v(N)}var j},e.timeout)}}let g=!1;const v=_=>{var j;g||(g=!0,p&&(_==null?void 0:_.name)==="AbortError"||Ej(_)?_e.warn(_):_e.error(_),(j=e.callback)===null||j===void 0||j.call(e,{statusCode:0,error:_}))};let b=0;const y=()=>{$g-=b,b=0,f&&clearTimeout(f.timeout)};try{const _=D({method:(e==null?void 0:e.method)||"GET",headers:h,referrerPolicy:"strict-origin",body:o,signal:f==null?void 0:f.signal},e.fetchOptions),j=u??(ue(o)?0:void 0);_.keepalive=_.method==="POST"&&!e.sl&&_.keepalive!==!1&&_.body===o&&!ue(j)&&j>=0&&52428.8>$g+j,_.keepalive&&(b=j,$g+=b),ku(n,_).then(N=>N.text().then(S=>{var C;if(g)return;const E={statusCode:N.status,text:S};if(N.status===200)try{E.json=JSON.parse(S)}catch(R){_e.error(R)}g=!0,y(),(C=e.callback)===null||C===void 0||C.call(e,E,Tj(()=>N.headers.get("Retry-After")))})).catch(N=>{y(),v(N)}).finally(y)}catch(_){y(),v(_)}},tx=e=>{try{var t;const{url:n,encodedBody:i}=Nj(e),{contentType:a,body:o,estimatedSize:u}=i??{};if(!o)return;const h=o instanceof Blob?o:new Blob([o],{type:a});if(En.sendBeacon(n,h))return;const f=Ie(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Ie(f)&&f.length>1&&(u??0)>16384){const p=Math.ceil(f.length/2),g=v=>Ie(e.data)?v:D(D({},e.data),{},{batch:v});return tx(D(D({},e),{},{data:g(f.slice(0,p))})),void tx(D(D({},e),{},{data:g(f.slice(p))}))}_e.warn(`Beacon of ~${u??0} bytes was rejected by the browser, falling back to ${ku?"fetch":"XHR"}`),ku?Aj(D(D({},e),{},{sl:!0})):Mj(e)}catch(n){_e.warn("Beacon send failed",n)}},s5=(e,t,n,i)=>{const a=i==="query"?t==="POST"?"sent_at":"_":void 0;return Du(n===Bs.GZipJS?jj(e,"compression"):e,D(D({},a?{[a]:Date.now().toString()}:{}),n===Bs.GZipJS?{}:{compression:n}))},OA=(()=>{const e=[];return ku&&e.push({transport:"fetch",method:Aj}),Nx&&e.push({transport:"XHR",method:Mj}),En!=null&&En.sendBeacon&&e.push({transport:"sendBeacon",method:tx}),e})();let Rj=!MA&&(ls==null?void 0:ls.indexOf("MSIE"))===-1&&(ls==null?void 0:ls.indexOf("Mozilla"))===-1;function Oj(e,t,n){var i,a,o;n&&(t=D(D({},t),{},{callback:u=>n(u)})),e.__loaded?Rj?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((a=t.callback)===null||a===void 0||a.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=D(D({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(i=e.compression)!==null&&i!==void 0?i:t.compressionFallback:t.compression,(ue(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((u,h)=>{var f,p,g;const v=D(D({},u),{},{callback:h??(N=>{var S;return(S=u.callback)===null||S===void 0?void 0:S.call(u,N)})});v.timeout=v.timeout||6e4;const b=(f=v.transport)!==null&&f!==void 0?f:"fetch";b==="sendBeacon"&&ue(v.compression)&&v.data&&(v.compression=Bs.Base64),v.method==="POST"&&v.data&&(v.timestampMode==="capture-body"?v.data=(N=>{var S,C;const E=(Ie(N)?N:[N]).map(A=>D(D({},A),A.timestamp instanceof Date&&!isNaN(A.timestamp.getTime())?{timestamp:A.timestamp.toISOString()}:{})),R=E[0];return{api_key:(S=R==null||(C=R.properties)===null||C===void 0?void 0:C.token)!==null&&S!==void 0?S:R==null?void 0:R.token,batch:E,sent_at:new Date().toISOString()}})(v.data):v.timestampMode==="body"&&(v.data=((N,S=new Date().toISOString())=>Ie(N)?N.map(C=>D(D({},C),{},{sent_at:S})):D(D({},N),{},{sent_at:S}))(v.data))),v.url=s5(v.url,v.method,v.compression,v.timestampMode);const y=OA.filter(N=>!v.disableTransport||!N.transport||!v.disableTransport.includes(N.transport)),_=(p=(g=(function(N,S){for(let C=0;N.length>C;C++)if(S(N[C]))return N[C]})(y,N=>N.transport===b))===null||g===void 0?void 0:g.method)!==null&&p!==void 0?p:y[0].method;if(!_)throw new Error("No available transport method");const j=N=>{try{_(N)}catch(C){var S;Ej(C)?_e.warn(C):_e.error(C),(S=v.callback)===null||S===void 0||S.call(v,{statusCode:0,error:C})}};b!=="sendBeacon"&&!v.preferSyncCompression&&v.data&&v.compression===Bs.GZipJS&&QT&&typeof Promise<"u"&&!Fh?AA(v).then(N=>{j(N)}).catch(N=>{if(yw(N))return Fh=!0,void j(D(D({},v),{},{compression:void 0,url:s5(u.url,u.method,void 0,u.timestampMode)}));(S=>{if(!S||typeof S!="object")return!1;const C="name"in S?String(S.name):"";return yw(S)||C===lk})(N)&&(Fh=!0),j(v)}):j(v)})(t,(u,h)=>{var f,p,g;e.rateLimiter.checkForLimiting(u),400>u.statusCode||(f=(p=e.config).on_request_error)===null||f===void 0||f.call(p,u),n?n(u,h):(g=t.callback)===null||g===void 0||g.call(t,u)})):t.fireCallbackOnDrop&&((o=t.callback)===null||o===void 0||o.call(t,{statusCode:0}))}var LA=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=Ui((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,_e.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.cl()}unload(){this.hl();const e=this.ol.length>0?this.dl():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.vl(D(D({},n),{},{callback:void 0}),"sendBeacon")})}enable(){this.rl=!1,this.cl()}cl(){this.rl||(this.ul=setTimeout(()=>{this.hl(),this.fl()},this.al))}fl(){if(this.ol.length>0){const e=this.dl();for(const t in e)this.vl(e[t])}}vl(e,t){try{this.ll(e,t)}catch(n){_e.error(n)}}hl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={},t={};_t(this.ol,n=>{var i;const a=n,o=((a?a.batchKey:null)||a.url)+(a.batchGroup?`:${a.batchGroup}`:"");ue(e[o])&&(e[o]=D(D({},a),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[o]=[]),(i=e[o].data)===null||i===void 0||i.push(a.data),a.callback&&t[o].push(a.callback)});for(const n in t){const i=t[n];i.length&&(e[n].callback=a=>{for(const o of i)o(a)})}return this.ol=[],e}};const DA=["retriesPerformedSoFar"];var zA=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.ol=[],this.ol=[],this.ml=!0,this.resume()}resume(){if(!ue(se)&&"onLine"in se.navigator){if(this.ml=se.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.fl()},this.bl=()=>{this.ml=!1},gt(se,"online",this.yl),gt(se,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,i=ok(e,DA);pr(n)&&(i.url=Du(i.url,{retry_count:n})),Oj(this._instance,t?D(D({},i),{},{transport:t}):i,(a,o)=>{var u;if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.Ls(D({retriesPerformedSoFar:n},i),o);a.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.`)}(u=i.callback)===null||u===void 0||u.call(i,a)})}Ls(e,t){const n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;const i=Math.max((function(u){const h=3e3*Math.pow(2,u),f=h/2,p=Math.min(18e5,h),g=(Math.random()-.5)*(p-f);return Math.ceil(p+g)})(n),t??0),a=Date.now()+i;this.ol.push({retryAt:a,requestOptions:e});let o=`Enqueued failed request for retry in ${i}`;navigator.onLine||(o+=" (Browser is offline)"),_e.warn(o),this.pl||(this.pl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.pl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.ml&&this.ol.length>0&&this.fl(),this._l()},this.gl)}fl(){const e=Date.now(),t=[],n=this.ol.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ol=t,n.length>0)for(const{requestOptions:i}of n)this.retriableRequest(i)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.pl=!1,ue(se)||(this.yl&&(se.removeEventListener("online",this.yl),this.yl=void 0),this.bl&&(se.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(D(D({},e),{},{callback:Ie(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(t){_e.error(t)}this.ol=[]}},$A=class{constructor(e){this._instance=e,this.kl=()=>{var t,n,i,a;this.Sl||(this.Sl={});const o=this.scrollElement(),u=this.scrollY(),h=o?Math.max(0,o.scrollHeight-o.clientHeight):0,f=u+((o==null?void 0:o.clientHeight)||0),p=(o==null?void 0:o.scrollHeight)||0;this.Sl.lastScrollY=Math.ceil(u),this.Sl.maxScrollY=Math.max(u,(t=this.Sl.maxScrollY)!==null&&t!==void 0?t:0),this.Sl.maxScrollHeight=Math.max(h,(n=this.Sl.maxScrollHeight)!==null&&n!==void 0?n:0),this.Sl.lastContentY=f,this.Sl.maxContentY=Math.max(f,(i=this.Sl.maxContentY)!==null&&i!==void 0?i:0),this.Sl.maxContentHeight=Math.max(p,(a=this.Sl.maxContentHeight)!==null&&a!==void 0?a:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){gt(se,"scroll",this.kl,{capture:!0}),gt(se,"scrollend",this.kl,{capture:!0}),gt(se,"resize",this.kl)}scrollElement(){if(this.xl){const n=Ie(this.xl)?this.xl:[this.xl];for(const i of n){var e;const a=se==null||(e=se.document)===null||e===void 0?void 0:e.querySelector(i);if(a)return a}return}var t;return se==null||(t=se.document)===null||t===void 0?void 0:t.documentElement}$l(e){var t,n;const i=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const a=this.scrollElement();return a&&a[i]||0}return se?e==="y"?se.scrollY||se.pageYOffset||((t=se.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:se.scrollX||se.pageXOffset||((n=se.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const PA=e=>pj(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);var i5=class{constructor(e,t,n,i){this.qe=a=>{const o=this.Cl();if(o&&o.sessionId===a)return;const u={sessionId:a,props:this.Tl(this._instance)};this.Il.register({[V0]:u})},this._instance=e,this.Ml=t,this.Il=n,this.Tl=i||PA,this.Ml.onSessionId(this.qe)}Cl(){return this.Il.props[V0]}getSetOnceProps(){var e;const t=(e=this.Cl())===null||e===void 0?void 0:e.props;return t?"r"in t?mj(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return _t(Ix(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e[`$session_entry_${T0(n)}`]=t}),e}},cf=class{on(e,t){return this.El[e]||(this.El[e]=[]),this.El[e].push(t),()=>{this.El[e]=this.El[e].filter(n=>n!==t)}}emit(e,t){for(const n of this.El[e]||[])n(t);for(const n of this.El["*"]||[])n(e,t)}constructor(){this.El={}}};const ao=Wt("[SessionId]"),r5=864e5;var a5=class{on(e,t){return this.Pl.on(e,t)}constructor(e,t,n){var i;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new cf,this.Ll=(o,u)=>!(!pr(o)||!pr(u))&&Math.abs(o-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=t||mi,this.jl=n||mi;const a=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ui(this.Mr.session_idle_timeout_seconds||1800,60,36e3,ao.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.zl="ph_"+a+"_window_id",this.Hl="ph_"+a+"_primary_window_exists",this.Ul()){const o=At.Lt(this.zl),u=At.Lt(this.Hl);o&&!u?this.je=o:At.Pt(this.zl),At.$t(this.Hl,!0)}!((i=this.Mr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ue(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(t=>t!==e)}}Ul(){return this.Mr.persistence!=="memory"&&!this.Il.hi&&At.At()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&At.$t(this.zl,e))}Gl(){return this.je?this.je:this.Ul()?At.Lt(this.zl):null}Ql(e){const t=this.Rl;return!Xt(t)&&!Xt(e)&&5e3>Math.abs(e-t)}Zl(e,t,n){const i=t!==this._sessionActivityTimestamp,a=!(e!==this.Xt||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Xt=e,a&&!i||a&&this.Ql(t)||(this.Rl=t,this.Il.register({[mo]:[t,e,n]}))}Jl(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return pr(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey(mo):(this.Il.flush(),this.Il.load())}Xl(){var e;if(Xt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,t,n]=this.Yl();t===this.Xt&&n===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[mo]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),t=pr(e)?e:0,n=pr(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[mo];return Ie(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Zl(null,null,null)}setBootstrapSessionId(e,t=!1){const n=((i,a=new Date().getTime())=>{try{const o=(u=>{const h=u.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)})(i);return o>a+6e4?void ao.error("Bootstrap sessionID cannot be in the future"):o}catch(o){return void ao.error("Invalid sessionID in bootstrap",o)}})(e);return!ue(n)&&(t?this.Nl={sessionId:e,sessionStartTimestamp:n}:this.Zl(e,new Date().getTime(),n),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&se&&(se.removeEventListener(sf,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&At.Pt(this.Hl)},gt(se,sf,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,n=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=t||new Date().getTime(),a=this.Xt;if(n)this.Al=i;else if(Xt(this.Al)||this.Al>i||i-this.Al>=1e3){var o,u;(o=(u=this.Il).syncCookieProperties)===null||o===void 0||o.call(u),this.Al=i}let[,h,f]=this.Yl();const p=!ue(a)&&h!==a,g=this.tu();let v=this.Gl();const b=this.Nl,y=!!b&&(b.sessionStartTimestamp>i+6e4||i-b.sessionStartTimestamp>r5),_=b?y:pr(f)&&Math.abs(i-f)>r5;let j=!1,N=p,S=!h||!!b;const C=h;let E=!S&&!e&&this.Ll(i,g);if(E&&(E=this.eu(i),E||ao.info("cross-tab refresh kept the session alive",{sessionId:h}),[,h,f]=this.Yl(),E||(S=!h||!!b)),S||E||_){N=!1;const P=b&&!y;h=P?b.sessionId:this.ql(),v=this.jl(),ao.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!P,changeReason:{noSessionId:S,activityTimeout:E,sessionPastMaximumLength:_}}),f=P?b.sessionStartTimestamp:i,this.Nl=void 0,j=!0}else v||(v=this.jl(),j=!0),N=N||h!==C,N&&(ao.info("adopted cross-tab session id",{sessionId:h,windowId:v}),j=!0);const R=pr(g)&&e&&!_?g:i,A=pr(f)?f:new Date().getTime();this.Vl(v),this.Zl(h,R,A),e||this.Bl();const O={noSessionId:S,activityTimeout:E,sessionPastMaximumLength:_,crossTabAdoption:N};return j&&this.Fl.forEach(P=>P(h,v,O)),{sessionId:h,windowId:v,sessionStartTimestamp:A,changeReason:j?O:void 0,lastActivityTimestamp:g}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const Lj=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&aw(n,t))return!0;try{const i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some(a=>aw(a==null?void 0:a.brand,t)))return!0}catch{}return!!e.webdriver};function Dj(){return(Dj=Pt(function*(){const e=En==null?void 0:En.userAgentData;if(e!=null&&e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return et(n)&&n.length>0?n:void 0}catch(t){return void _e.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function BA(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function zj(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}const uf=(e,t)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},bh=e=>e.toLowerCase(),$j={exact:(e,t)=>t.some(n=>e.some(i=>n===i)),is_not:(e,t)=>t.every(n=>e.every(i=>n!==i)),regex:(e,t)=>t.some(n=>e.some(i=>uf(n,i))),not_regex:(e,t)=>t.every(n=>e.every(i=>!uf(n,i))),icontains:(e,t)=>t.map(bh).some(n=>e.map(bh).some(i=>n.includes(i))),not_icontains:(e,t)=>t.map(bh).every(n=>e.map(bh).every(i=>!n.includes(i))),gt:(e,t)=>t.some(n=>{const i=parseFloat(n);return!isNaN(i)&&e.some(a=>i>parseFloat(a))}),lt:(e,t)=>t.some(n=>{const i=parseFloat(n);return!isNaN(i)&&e.some(a=>i<parseFloat(a))})};function Pj(e,t){return!e||Object.entries(e).every(([n,i])=>{const a=t==null?void 0:t[n];if(a==null)return!1;const o=$j[i.operator];return!!o&&o(i.values.map(String),[String(a)])})}function Bg(e,t,n){return vo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const nx="custom",l5="i.posthog.com",FA=/^\/static\//,IA=["/s/","/e/","/i/"];var UA=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${l5}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.nu[this.apiHost]||(this.nu[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":nx),this.nu[this.apiHost]}su(e){if(!FA.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ru(e){const t=_r(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}ou(e,t,n){if(e==="ui")return n;let i=n;const a=this.instance.config.rewriteRequestPath;if(a){var o;const u=((o=_r(n))===null||o===void 0?void 0:o.href)||n;i=a(new URL(u)).toString()}if(a&&e==="api"&&IA.some(u=>t.indexOf(u)===0)){const u=this.ru(i);if(u){const h=this.apiHost;let f=this.au;(f==null?void 0:f.apiHost)===h&&f.rewriteRequestPath===a||(f={apiHost:h,rewriteRequestPath:a,urls:new Set},this.au=f),f.urls.add(u)}}return i}isIngestionEndpoint(e){const t=this.au,n=this.ru(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.ou(e,t,this.uiHost+t);if(e==="flags")return this.ou(e,t,this.flagsApiHost+t);if(e==="assets"){const i=this.su(t);if(i)return this.ou(e,t,`${i}${t}`)}if(this.region===nx)return this.ou(e,t,this.apiHost+t);const n=l5+t;switch(e){case"assets":return this.ou(e,t,`https://${this.region}-assets.${n}`);case"api":return this.ou(e,t,`https://${this.region}.${n}`)}}};const yt=Wt("[Surveys]"),Bj=e=>{try{const t=(n=>((i,a)=>`seenSurvey_${(function(o){return o.current_iteration&&o.current_iteration>0?`${o.id}_${o.current_iteration}`:o.id})(a)}`)(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){yt.error("Failed to persist survey seen state",t)}},HA=[Og.Popover,Og.Widget,Og.API],qA={ignoreConditions:!1,ignoreDelay:!1,displayType:Z0.Popover},VA=Wt("[PostHog ExternalIntegrations]"),GA={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var YA=class{constructor(e){this._instance=e}zo(e,t){var n,i;(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,e,a=>{if(a)return VA.error("failed to load script",a);t()})}startIfEnabledOrStop(){var e;for(const[a,o]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,n,i;o&&!(!((t=$e.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[a])&&this.zo(GA[a],()=>{var u;(u=$e.__PosthogExtensions__)===null||u===void 0||(u=u.integrations)===null||u===void 0||(u=u[a])===null||u===void 0||u.start(this._instance)}),!o&&(!((n=$e.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[a])&&((i=$e.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[a])===null||i===void 0||i.stop())}}},XA=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return Pt(function*(){if(t.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.lu.set(e.name,e);try{const n=e.setup(t.bo);n&&(yield n)}catch(n){const i=t.lu.get(e.name)===e;i&&t.lu.delete(e.name),t.A.error(`Failed to set up browser extension "${e.name}"`,n),i&&t.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const t of e)this.uu(t)}uu(e){try{var t;const n=(t=e.dispose)===null||t===void 0?void 0:t.call(e);n&&xn(n.then)&&n.then(void 0,i=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(n){this.A.error(`Failed to dispose browser extension "${e.name}"`,n)}}},QA=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);const n={};for(const i of e){const a=t==null?void 0:t.get_property(i);ue(a)||(n[i]=a)}return n}set(e,t){var n;(n=this._instance.persistence)===null||n===void 0||n.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}};const o5="extensionsRemoteConfig";var WA=class{constructor(e){this.instance=e,this.To=!1,this.A=_e,this.cu=e.hu,this.kv=new QA(e),this.onEvent=t=>vh(this.instance.on("eventCaptured",n=>{try{t({event:n.event,properties:n.properties})}catch(i){this.A.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=t=>{if(this.To)return vh(()=>{});const n=a=>{try{t(a)}catch(o){this.A.error("Browser extension remote config listener failed",o)}},i=this.instance.du.on(o5,n);return this.cu&&n(this.cu),vh(i)},this.vu=new XA(_e.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(Ox);return typeof e=="string"?e:void 0}get library(){return{name:jn.LIB_NAME,version:jn.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,n,i;const a=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=a==null?void 0:a.sessionId)!==null&&t!==void 0?t:"",windowId:(n=a==null?void 0:a.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(i=a==null?void 0:a.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,t,n){n?this.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return vh(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.cu=e,this.instance.du.emit(o5,e))}sendRequest(e){var t=this;return Pt(function*(n,i={}){var a;const o=t.instance.requestRouter.endpointFor((a=i.target)!==null&&a!==void 0?a:"api",n),u={method:i.method,url:i.query?Du(o,i.query):o,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?E0.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(t.instance._send_request(u),{statusCode:202}):new Promise(h=>{u.callback=h,t.instance._send_request(u)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}};const gu={};let Fg=0;const xu=()=>{},c5='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',lo="Surveys module not available",u5="sanitize_properties is deprecated. Use before_send instead",Fj="Invalid value for property_denylist config: ",ZA=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],KA=["$feature_flag_called","$$heatmap","$snapshot"],d5=e=>e.charAt(0)==="$"&&!Fe(KA,e),JA=/^[A-Za-z0-9_-]{1,400}$/,h5=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,f5=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,e8=["token","distinct_id",Lk],iu="posthog",t8=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Ig=e=>{var t;return D({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:WM(ge==null?void 0:ge.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:xu,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:zt&&et(zt==null?void 0:zt.search)&&zt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(se==null||(t=se.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(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:qk,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:xu},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:Vx,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:t8(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(e))},n8=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],p5=e=>{const t={};for(const[a,o]of n8)ue(e[a])||(t[o]=e[a]);const n=$t({},t,e),i=e.__preview_external_dependency_versioned_paths;return ue(i)||(ue(e.strict_script_versioning)&&(n.strict_script_versioning=!!i),et(i)&&ue(e.asset_host)&&(n.asset_host=i)),Ie(e.property_blacklist)&&(ue(e.property_denylist)?n.property_denylist=e.property_blacklist:Ie(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:_e.error(Fj+e.property_denylist)),n};var s8=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){_e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},vu=class oa{gu(t){if(!t)return;const n=this.lu.indexOf(t);n!==-1&&this.lu.splice(n,1)}mu(t,n){var i;return this.gu(t),this.lu.push(n),(i=n.initialize)===null||i===void 0||i.call(n),n}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.wu)return;let n,i,a;t?(n=`persistence is set to '${this.config.persistence}'`,i=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",a="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",i="on every page load",a="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${a}`)}ku(){const t=this.persistence;if(!t||this.Su)return;if(this.yu())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.xu(),this.$u()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.Cu()||t.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const i=this.config.get_device_id(mi());this.register({distinct_id:i,$device_id:i}),t.set_property(os,xr)}this.xu()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.Tu=!1,this.Iu=!1,this.webPerformance=new s8,this.Mu=!1,this.version=jn.LIB_VERSION,this.Eu=new Set,this.Pu="",this.du=new cf,this.lu=[],this.Ru=[],this.Au=!1,this.wu=!1,this._u=!1,this.Su=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ig(),this.SentryIntegration=pA,this.sentryIntegration=i=>(function(a,o){const u=ij(a,o);return{name:sj,processEvent:h=>u(h)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fu=!1,this.Ou=null,this.Du=null,this.Lu=null,this.scrollManager=new $A(this),this.pageViewManager=new Xw(this),this.rateLimiter=new kA(this),this.requestRouter=new UA(this),this.consent=new sA(this),this.externalIntegrations=new YA(this);const n=(t=oa.__defaultExtensionClasses)!==null&&t!==void 0?t:{};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:(i,a,o)=>{const u=et(i)?{[i]:a}:i;this.setPersonProperties(u),o==null||o({})},set_once:(i,a,o)=>{const u=et(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",i=>_e.info(`send "${i==null?void 0:i.event}"`,i))}init(t,n,i){if(i&&i!==iu){var a;const o=(a=gu[i])!==null&&a!==void 0?a:new oa;return o._init(t,n,i),gu[i]=o,gu[iu][i]=o,o}return this._init(t,n,i)}_init(t,n={},i){var a,o,u;const h=et(t)?t.trim():"";if(!h)return _e.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var f;if(this.__loaded)return h!==((f=this.config)===null||f===void 0?void 0:f.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${h}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ig(n.defaults),n.debug=this.Nu(n.debug),this.qu=n,this.ju=[],n.person_profiles?this.Du=n.person_profiles:n.process_person&&(this.Du=n.process_person);const p=Ig(n.defaults),g=p5(n),v=$t({},p,g,{name:i,token:h});Ze(p.rageclick)&&Ze(g.rageclick)&&(v.rageclick=$t({},p.rageclick,g.rageclick)),Ze(p.session_recording)&&Ze(g.session_recording)&&(v.session_recording=$t({},p.session_recording,g.session_recording)),this.set_config(v),this.config.on_xhr_error&&_e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Bs.GZipJS;const b=this.Cu(),y=!this.yu();if(this.persistence=new Rg(this.config,b,!0,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Rg(D(D({},this.config),{},{persistence:"sessionStorage"}),b,!1,y),this.Pu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!b&&At.At()){const C=At.Lt(this.Pu);Ie(C)&&C.forEach(E=>{et(E)&&this.Eu.add(E)})}else At.Pt(this.Pu);const _=D({},this.persistence.props),j=D({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Bu=new LA((C,E)=>this.zu(C,E),this.config.request_queue_config),this.Hu=new zA(this),this.__request_queue=[];const N=this.yu();N||(this.sessionManager=new a5(this),this.sessionPropsManager=new i5(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((C,E,R)=>{(R!=null&&R.activityTimeout||R!=null&&R.sessionPastMaximumLength||R!=null&&R.crossTabAdoption)&&this.Uu()})),this.Wu(),this.config.__preview_deferred_init_extensions?(_e.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vu(N)},0)):(_e.info("Initializing extensions synchronously"),this.Vu(N)),jn.DEBUG=jn.DEBUG||this.config.debug,jn.DEBUG&&_e.info("Starting in debug mode",{this:this,config:n,thisC:D({},this.config),p:_,s:j}),this.config.identity_distinct_id&&!(!((a=n.bootstrap)===null||a===void 0)&&a.distinctID)&&(n.bootstrap=D(D({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const S=(o=n.bootstrap)===null||o===void 0?void 0:o.distinctID;if(this.wu=!!S&&!ou(S),(u=n.bootstrap)===null||u===void 0?void 0:u.distinctID){const C=n.bootstrap.distinctID,E=this.get_distinct_id(),R=this.persistence.get_property(os);if(n.bootstrap.isIdentifiedID&&E!=null&&E!==C&&R==="anonymous")this.identify(C);else if(n.bootstrap.isIdentifiedID&&E!=null&&E!==C&&R==="identified")_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{const A=this.config.get_device_id(mi()),O=n.bootstrap.isIdentifiedID?A:C;this.persistence.set_property(os,n.bootstrap.isIdentifiedID?Ph:xr),this.register({distinct_id:C,$device_id:O})}}if(N)this.register_once({distinct_id:Sg,$device_id:null},"");else if(!this.get_distinct_id()){const C=this.config.get_device_id(mi());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(os,xr)}return gt(se,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),gt(se,"pageshow",()=>{var C;this.Tu=!1,this.Iu||(C=this.Hu)===null||C===void 0||C.resume()}),n.segment?Yw(this,()=>this.Gu()):this.Gu(),xn(this.config._onCapture)&&this.config._onCapture!==xu&&(_e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",C=>this.config._onCapture(C.event,C))),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 Dj.apply(this,arguments)})().then(C=>{C&&this.register({[wg]:C})}).catch(xu),this}Qu(t){const n=t;return et(n.name)&&xn(n.setup)}Zu(t,n){this.Qu(t)?n.push(()=>{this.Ju().add(t).catch(()=>{var i;return(i=t.dispose)===null||i===void 0?void 0:i.call(t)}).catch(i=>{_e.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.lu.push(t)}Wu(){var t,n,i;const a=(t=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&t!==void 0?t:(i=oa.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var o,u,h;a&&(this.featureFlags&&this.featureFlags instanceof a||((o=this.Ku)===null||o===void 0||o.call(this),this.Ku=void 0,this.featureFlags=new a(this)),xn(this.featureFlags.onReloading)&&xn(this.featureFlags.setup)?this.Ku||(this.Ku=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Ju().add(this.featureFlags)):(u=(h=this.featureFlags).initialize)===null||u===void 0||u.call(h))}Vu(t){const n=performance.now(),i=D(D({},oa.__defaultExtensionClasses),this.config.__extensionClasses),a=[];var o,u,h,f,p,g,v,b;i.exceptions&&this.lu.push(this.exceptions=(o=this.exceptions)!==null&&o!==void 0?o:new i.exceptions(this)),i.historyAutocapture&&this.lu.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.lu.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.lu.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.lu.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||a.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.Zu(this.autocapture=new i.autocapture(this),a),i.surveys&&this.Zu(this.surveys=(u=this.surveys)!==null&&u!==void 0?u:new i.surveys(this),a),i.logs&&this.Zu(this.logs=(h=this.logs)!==null&&h!==void 0?h:new i.logs(this),a),i.metrics&&this.lu.push(this.metrics=(f=this.metrics)!==null&&f!==void 0?f:new i.metrics(this)),i.conversations&&this.lu.push(this.conversations=(p=this.conversations)!==null&&p!==void 0?p:new i.conversations(this)),i.productTours&&this.lu.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.lu.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.lu.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,fA)),i.toolbar&&this.lu.push(this.toolbar=(g=this.toolbar)!==null&&g!==void 0?g:new i.toolbar(this)),i.experiments&&this.lu.push(this.experiments=(v=this.experiments)!==null&&v!==void 0?v:new i.experiments(this)),i.webMCP&&this.lu.push(this.webMCP=(b=this.webMCP)!==null&&b!==void 0?b:new i.webMCP(this)),this.lu.forEach(y=>{y.initialize&&a.push(()=>{var _;(_=y.initialize)===null||_===void 0||_.call(y)})}),a.push(()=>{if(this.Xu){const y=this.Xu;this.Xu=void 0,this.lu.forEach(_=>{var j;return(j=_.onRemoteConfig)===null||j===void 0?void 0:j.call(_,y)})}}),this.Yu(a,n)}Yu(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout(()=>{this.Yu(t,n)},0);const a=t.shift();if(a)try{a()}catch(o){_e.error("Error initializing extension:",o)}}const i=Math.round(performance.now()-n);this.register_for_session({[Dk]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[zk]:i}),this.config.__preview_deferred_init_extensions&&_e.info(`PostHog extensions initialized (${i}ms)`)}el(t){var n;if(!ge||!ge.body)return _e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Xu=t),this.hu=t,this.compression=void 0,t.ok){var i;const a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=Fe(a.supportedCompression,Bs.GZipJS)?Bs.GZipJS:Fe(a.supportedCompression,Bs.Base64)?Bs.Base64:void 0),!((i=a.analytics)===null||i===void 0)&&i.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Du?this.Du:qk}),(n=this.tc)===null||n===void 0||n.handleRemoteConfig(t),this.lu.forEach(a=>{var o;return(o=a.onRemoteConfig)===null||o===void 0?void 0:o.call(a,t)})}Gu(){try{this.config.loaded(this)}catch(t){_e.critical("`loaded` function failed",t)}if(this.ec(),this.config.internal_or_test_user_hostname&&(zt==null?void 0:zt.hostname)){const t=zt.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.nc()},1),this.sc=new xj(this),this.sc.load()}ec(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Bu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&xo(this.__request_queue,t=>this.zu(t)),this.__request_queue=[],this.ec()}_handle_unload(){var t,n,i,a,o,u;this.Tu=!0,(t=this.surveys)===null||t===void 0||(n=t.handlePageUnload)===null||n===void 0||n.call(t),(i=this.metrics)===null||i===void 0||i.flush("sendBeacon"),this.config.request_batching?(this.rc()&&this.capture(Mw),(a=this.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(o=this.Bu)===null||o===void 0||o.unload(),(u=this.Hu)===null||u===void 0||u.unload()):this.rc()&&this.capture(Mw,null,{transport:"sendBeacon"})}_send_request(t){Oj(this,t)}zu(t,n){this.Hu?this.Hu.retriableRequest(t,n):this._send_request(n?D(D({},t),{},{transport:n}):t)}_execute_array(t){Fg++;try{let n;const i=[],a=[],o=[];xo(t,h=>{if(h)if(n=h[0],Ie(n))o.push(h);else if(xn(h))try{h.call(this)}catch(f){_e.error("Error executing queued PostHog call",h,f)}else Ie(h)&&n==="alias"?i.push(h):Ie(h)&&n.indexOf("capture")!==-1&&xn(this[n])?o.push(h):a.push(h)});const u=function(h,f){xo(h,function(p){try{if(Ie(p[0])){let g=f;_t(p,function(v){g=g[v[0]].apply(g,v.slice(1))})}else f[p[0]].apply(f,p.slice(1))}catch(g){_e.error("Error executing queued PostHog call",p,g)}})};u(i,this),u(a,this),u(o,this)}finally{Fg--}}push(t){if(Fg>0&&Ie(t)&&et(t[0])){const n=oa.prototype[t[0]];return void(xn(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}get oc(){return{property:Ew,persistenceKey:yo,cookieName:"_fbc",pattern:h5,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[yo]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(yo)}}}get ac(){return{property:Tw,persistenceKey:du,cookieName:"_fbp",pattern:f5,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[du]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(du)}}}lc(t){var n;const i=(n=this.persistence)===null||n===void 0?void 0:n.get_property(t.persistenceKey);return et(i)&&t.pattern.test(i)?{value:i,delivered:!1}:Ze(i)&&et(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:i.delivered===!0}:void 0}uc(t,n,i){return n===(i==null?void 0:i.value)?{value:n,pending:!i.delivered}:(t.register(n,!1),{value:n,pending:!0})}cc(t){if(!this.config.save_campaign_params||this.yu())return;const n=fu(t.cookieName);return et(n)&&t.pattern.test(n)?n:void 0}hc(t,n,i,a){if(!this.persistence)return;const o=this.oc;this.persistence.refreshKey(o.persistenceKey);const u=this.lc(o);if(a)return void o.unregister();if(i)return et(n)&&h5.test(n)?this.uc(o,n,u):void o.unregister();const h=et(t)&&JA.test(t)?t:void 0,f=this.cc(o);return f&&((p,g,v)=>{const b=p.split(".");if(g)return b[3]===g;if(!v)return!0;const y=v.value.split(".");return b[3]===y[3]||Number(b[2])>Number(y[2])})(f,h,u)?this.uc(o,f,u):h?(u==null?void 0:u.value.split(".")[3])===h?{value:u.value,pending:!u.delivered}:this.uc(o,`fb.1.${Date.now()}.${h}`,u):u?{value:u.value,pending:!u.delivered}:void 0}dc(t,n,i){if(!this.persistence)return;const a=this.ac;this.persistence.refreshKey(a.persistenceKey);const o=this.lc(a);if(i)return void a.unregister();if(n)return et(t)&&f5.test(t)?this.uc(a,t,o):void a.unregister();const u=this.cc(a);return u?this.uc(a,u,o):o?{value:o.value,pending:!o.delivered}:void 0}vc(t,n){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.lc(t);(i==null?void 0:i.value)!==n||i.delivered||t.register(n,!0)}capture(t,n,i){var a,o;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Bu))return void _e.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(ue(t)||!et(t))return void _e.error("No event name provided to posthog.capture");if(this.ku(),t==="$snapshot"&&this.yu())return;const u=!this.config.opt_out_useragent_filter&&this._is_bot();if(u&&!this.config.__preview_capture_bot_pageviews)return;const h=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h!=null&&h.isRateLimited)return void _e.critical("This capture call is ignored due to client rate limiting.");let f;n!=null&&n.$current_url&&!et(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),t!=="$exception"||i!=null&&i.fc||_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&&(f=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const p=new Date,g=(i==null?void 0:i.timestamp)||p,v=uw(i==null?void 0:i.uuid,mi);let b={uuid:v,event:t,properties:this.calculateEventProperties(t,n||{},g,v)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&u&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),h&&(b.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);const y=t==="$feature_flag_called"&&b.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i!=null&&i.$set&&!y&&(b.$set=i==null?void 0:i.$set);const _=Ze(n==null?void 0:n.$set)?n.$set:void 0,j=Ie(n==null?void 0:n.$unset)?n.$unset:[],N=(i==null?void 0:i.$unset)||[],S=Q=>{var V;const G=!!(i!=null&&i.$set)&&Q in i.$set;return{hasProvided:G||!!_&&Q in _,provided:G?i==null||(V=i.$set)===null||V===void 0?void 0:V[Q]:_==null?void 0:_[Q],unset:j.indexOf(Q)!==-1||N.indexOf(Q)!==-1}},C=S(Ew),E=S(Tw),R=[{channel:this.oc,hasProvided:C.hasProvided,update:this.hc(f==null?void 0:f.fbclid,C.provided,C.hasProvided,C.unset)},{channel:this.ac,hasProvided:E.hasProvided,update:this.dc(E.provided,E.hasProvided,E.unset)}];for(const{channel:Q,hasProvided:V,update:G}of R)G&&b.properties.$process_person_profile===!0&&G.pending&&!V&&!y&&(b.$set=D({[Q.property]:G.value},b.$set));const A=i==null?void 0:i.$unset;A&&(b.$unset=A);const O=y?void 0:this.gc(i==null?void 0:i.$set_once,t!==Aw,t===Vk);if(O&&(b.$set_once=O),i!=null&&i._noTruncate||(P=this.config.properties_string_max_length,b=(function(Q,V){const G=new Set;return(function H(ae,ye){if(ae!==Object(ae))return V?V(ae):ae;if(G.has(ae))return;let T;if(G.add(ae),Ie(ae))T=[],xo(ae,Ne=>{T.push(H(Ne))});else{const Ne={};_t(zo(ae)?Gk(ae):ae,(Ce,$)=>{G.has(Ce)||(Ne[$]=H(Ce))}),T=Ne}return T})(Q)})(b,Q=>et(Q)?Q.slice(0,P):Q)),b.timestamp=g,ue(i==null?void 0:i.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=p),y&&(b.properties=((Q,V=[])=>{const G={},H=ae=>{Q[ae]!==void 0&&(G[ae]=Q[ae])};return q6.forEach(H),V.forEach(H),G})(b.properties,e8)),t===Ps.DISMISSED||t===Ps.SENT){const Q=n==null?void 0:n[Lg.SURVEY_ID],V=n==null?void 0:n[Lg.SURVEY_ITERATION];Bj({id:Q,current_iteration:V}),b.$set=D(D({},b.$set),{},{[BA({id:Q,current_iteration:V},t===Ps.SENT?"responded":"dismissed")]:!0})}else t===Ps.SHOWN&&(b.$set=D(D({},b.$set),{},{[Lg.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var P;if(t===SA.SHOWN){const Q=n==null?void 0:n[Zw.TOUR_TYPE];Q&&(b.$set=D(D({},b.$set),{},{[`${Zw.TOUR_LAST_SEEN_DATE}/${Q}`]:new Date().toISOString()}))}const z=D(D({},b.properties.$set),b.$set);if(_s(z)||this.setPersonPropertiesForFlags(z),!qe(this.config.before_send)){const Q=this.Os(b);if(!Q)return;b=Q,b.uuid=uw(b.uuid,mi)}this.sessionRecording&&!this.Au&&d5(t)&&(this.Au=!0,setTimeout(()=>this.Au=!1,3e4));const Z=R.filter(({channel:Q,update:V})=>{var G,H,ae;const ye=(G=(H=b.$set)===null||H===void 0?void 0:H[Q.property])!==null&&G!==void 0?G:Ze((ae=b.properties)===null||ae===void 0?void 0:ae.$set)?b.properties.$set[Q.property]:void 0;return(V==null?void 0:V.pending)&&ye===V.value});this.du.emit("eventCaptured",b);const I=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),q=(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(I),L=D(D(D({method:"POST",url:I,data:b,compression:"best-available",preferSyncCompression:i==null?void 0:i.send_instantly,timestampMode:q?"body":"capture-body",batchKey:i==null?void 0:i._batchKey},q&&(!((o=b.properties)===null||o===void 0)&&o.$session_id)?{batchGroup:b.properties.$session_id+(b.properties.$window_id?`-${b.properties.$window_id}`:"")}:{}),i!=null&&i.transport?{transport:i.transport}:{}),Z.length?{fireCallbackOnDrop:!0,callback:Q=>{if(Q.statusCode>=200&&300>Q.statusCode)for(const{channel:V,update:G}of Z)this.vc(V,G.value)}}:{});if(!this.config.request_batching||i&&!(i!=null&&i._batchKey)||i!=null&&i.send_instantly){var de;let Q;!L.transport&&!L.callback&&_s((de=this.config.request_headers)!==null&&de!==void 0?de:{})&&this.Tu&&(Q="sendBeacon"),this.zu(L,Q)}else this.Bu.enqueue(L);return b}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}getExtension(t){var n;return(n=this.tc)===null||n===void 0?void 0:n.getExtension(t)}Ju(){var t;return(t=this.tc)!==null&&t!==void 0?t:this.tc=new WA(this)}fu(t){this.Ru.push(t);let n=!0;return()=>{if(!n)return;n=!1;const i=this.Ru.indexOf(t);i!==-1&&this.Ru.splice(i,1)}}mc(t=!0){var n,i,a;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Lu=null,this.persistence.get_property("$user_state")==="anonymous"&&((a=this.sessionPersistence)===null||a===void 0||a.clear(),this.Eu.clear(),this.yc()),(i=this.featureFlags)===null||i===void 0||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,i,a,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;this.ku(),this.persistence.syncCookieProperties(),this.mc();const u=o?void 0:this.persistence.remove_event_timer(t);let h=D({},n);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.yu()&&(h[Lk]=!0),t==="$snapshot"){const C=D(D({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=C.distinct_id,(!et(h.distinct_id)&&!sn(h.distinct_id)||ou(h.distinct_id))&&_e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const f=(function(C,E,R,A=!1){var O,P,z,Z;if(!ls)return{};const I=C?[...Mo,...E||[]]:[],[q,L]=WS(ls),[de,Q]=(function(B){for(let oe=0;cw.length>oe;oe++){const[be,je,Ee]=cw[oe],Be=B.match(be);if(Be){const Oe=Ee&&B.match(Ee)||Be;return[je,(Oe==null?void 0:Oe[1])||""]}}return["",""]})(ls),V=(function(){const B="u">typeof navigator?navigator:void 0;return B!=null&&B.brave?{brave:!0}:{}})(),G={};ue(R)||(G.detectGoogleSearchApp=R);const H={},ae=(O=navigator)===null||O===void 0||(O=O.userAgentData)===null||O===void 0?void 0:O.platform,ye=(P=navigator)===null||P===void 0?void 0:P.maxTouchPoints,T=se==null||(z=se.screen)===null||z===void 0?void 0:z.width,Ne=se==null||(Z=se.screen)===null||Z===void 0?void 0:Z.height,Ce=se==null?void 0:se.devicePixelRatio;ue(ae)||(H.userAgentDataPlatform=ae),ue(ye)||(H.maxTouchPoints=ye),ue(T)||(H.screenWidth=T),ue(Ne)||(H.screenHeight=Ne),ue(Ce)||(H.devicePixelRatio=Ce);const $=$t(Ix({$os:q,$os_version:L,$browser:QS(ls,navigator.vendor,V,G),$webview_app:de,$webview_app_version:Q,$device:ZS(ls),$device_type:h6(ls,H),$timezone:rj(),$timezone_offset:yA()}),{$current_url:Tu(A?ma(zt==null?void 0:zt.href):zt==null?void 0:zt.href,I,Mu),$host:zt==null?void 0:zt.host,$pathname:zt==null?void 0:zt.pathname,$raw_user_agent:ls.length>1e3?ls.substring(0,997)+"...":ls,$browser_version:d6(ls,navigator.vendor,V,G),$browser_language:hj(),$browser_language_prefix:bA(),$screen_height:se==null?void 0:se.screen.height,$screen_width:se==null?void 0:se.screen.width,$viewport_height:se==null?void 0:se.innerHeight,$viewport_width:se==null?void 0:se.innerWidth,$lib:vr.LIB_NAME,$lib_version:vr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return vr.SDK_DIST_CHANNEL&&($.$sdk_dist_channel=vr.SDK_DIST_CHANNEL),$})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:C,windowId:E}=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime(),!0);h.$session_id=C,h.$window_id=E}this.sessionPropsManager&&$t(h,this.sessionPropsManager.getSessionProps());try{var p;if(this.sessionRecording){const C=this.sessionRecording.sdkDebugProperties,E=!this.Au&&d5(t);for(const R in C)(E||Fe(ZA,R))&&(h[R]=C[R])}h.$sdk_debug_retry_queue_size=(p=this.Hu)===null||p===void 0?void 0:p.length}catch(C){h.$sdk_debug_error_capturing_properties=String(C)}let g;if(this.requestRouter.region===nx&&(h.$lib_custom_api_host=this.config.api_host),g=t!=="$pageview"||o?t!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),h=$t(h,g),t==="$pageview"&&ge&&(h.title=ge.title),!ue(u)){const C=i.getTime()-u;h.$duration=parseFloat((C/1e3).toFixed(3))}ls&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const v=this.persistence.properties(),b=this.sessionPersistence.properties(),y=h.$groups,_=v.$groups;Ze(y)&&!_s(y)&&(h.$groups=D(D({},Ze(_)?_:{}),y)),_t(["$referrer","$referring_domain"],C=>{C in v&&delete b[C]});const j={};if(this.Ru.length>0)for(const C of this.Ru.slice())try{$t(j,C())}catch(E){_e.error("Failed to produce browser extension event properties",E)}h=$t({},f,v,b,D(D({},j),h)),h.$is_identified=this._isIdentified(),Ie(this.config.property_denylist)?_t(this.config.property_denylist,function(C){delete h[C]}):_e.error(Fj+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const N=this.config.sanitize_properties;N&&(_e.error(u5),h=N(h,t));const S=this.bc();return h.$process_person_profile=S,S&&!o&&this._c("_calculate_event_properties"),h}gc(t,n=!0,i=!1){var a;if(!this.persistence||!this.bc()||this.Mu&&!i)return t;const o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)===null||a===void 0?void 0:a.getSetOnceProps();let h=$t({},o,u||{},t||{});const f=this.config.sanitize_properties;return f&&(_e.error(u5),h=f(h,"$set_once")),n&&(this.Mu=!0),_s(h)?void 0:h}register(t,n){var i;(i=this.persistence)===null||i===void 0||i.register(t,n)}register_once(t,n,i){var a;(a=this.persistence)===null||a===void 0||a.register_once(t,n,i)}register_for_session(t){var n,i;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.mc(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(a=>this.Eu.add(a)),this.yc()}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t),this.Eu.delete(t),this.yc()}wc(t,n){this.register({[t]:n})}Uu(){this.Eu.forEach(t=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}),this.Eu.clear(),this.yc()}yc(){var t;if(!this.Pu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!At.At())return void At.Pt(this.Pu);const n=[];this.Eu.forEach(i=>n.push(i)),n.length>0?At.$t(this.Pu,n):At.Pt(this.Pu)}getFeatureFlag(t,n){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var i,a;return(i=(a=this.featureFlags)===null||a===void 0?void 0:a.isFeatureEnabled(t,n))!==null&&i!==void 0?i:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,n,i){var a;(a=this.featureFlags)===null||a===void 0||a.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var a;(a=this.featureFlags)===null||a===void 0||a.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n=!1,i){var a;return(a=this.featureFlags)===null||a===void 0?void 0:a.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.du.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:lo}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n=!1){this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:lo})}getActiveMatchingSurveys(t,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:lo})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:lo}),()=>{})}renderSurvey(t,n){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,n)}displaySurvey(t,n=qA){var i;(i=this.surveys)===null||i===void 0||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:lo}}canRenderSurveyAsync(t,n=!1){var i,a;return(i=(a=this.surveys)===null||a===void 0?void 0:a.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:lo})}kc(t){return!t||ou(t)?(_e.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(_e.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(_e.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return _e.uninitializedWarning("posthog.identify");if(sn(t)&&(t=t.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.kc(t)||!this._c("posthog.identify"))return;this.ku();const a=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.mc(!1),h=this.persistence.Oa();let f=!1;try{const g=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:g},""),t!==g&&t!==this.get_property("__alias")&&(this.unregister(tf),this.register({distinct_id:t}));const v=(this.persistence.get_property("$user_state")||"anonymous")===xr,b=t!==g,y=!b&&v;if(b&&v){var p;const _=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:g};this.persistence.set_property(os,Ph),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",_,{$set:n||{},$set_once:i||{}})&&(this.Lu=Bg(t,n,i)),(p=this.featureFlags)===null||p===void 0||p.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:g)}else if(y){this.persistence.set_property(os,Ph);const _=n||{},j=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:j},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:_,$set_once:j})&&(this.Lu=Bg(t,n,i))}else(n||i)&&this.setPersonProperties(n,i);b||o||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(da)):y&&(n||i)&&this.reloadFeatureFlags(),f=!0}finally{h&&this.persistence.qa(f)}}setPersonProperties(t,n){if(!t&&!n||!this._c("posthog.setPersonProperties"))return;const i=Bg(this.get_distinct_id(),t,n);this.Lu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}})&&(this.Lu=i)):_e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var n;const i=(Ie(t)?t:[t]).filter(a=>et(a)&&a.length>0);i.length!==0&&this._c("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Lu=null)}group(t,n,i){var a;if(!t||!n)return void _e.error("posthog.group requires a group type and group key");(a=this.persistence)===null||a===void 0||a.syncCookieProperties(),this.mc();const o=this.getGroups(),u=o[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:D(D({},o),{},{[t]:n})}),(u||i)&&this.bc()){const h={$group_type:t,$group_key:n};i&&(h.$group_set=i),this.capture(Aw,h)}i&&this.setGroupPropertiesForFlags({[t]:i}),u&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n=!0){var i;(i=this.featureFlags)===null||i===void 0||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n=!0){var i;this._c("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)===null||i===void 0||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(t)}reset(t){const n=cs(t)?t:t==null?void 0:t.resetDeviceID,i=cs(t)||t==null?void 0:t.bootstrap;this.Sc(n,!1,i)}Sc(t,n=!1,i){var a,o,u,h,f,p;if(_e.info("reset"),!this.__loaded)return _e.uninitializedWarning("posthog.reset");const g=i==null?void 0:i.sessionID;this.config.bootstrap=i||((a=this.qu)===null||a===void 0?void 0:a.bootstrap)||{},(o=this.featureFlags)===null||o===void 0||(u=o.updateConfig)===null||u===void 0||u.call(o,this.config,this.il());const v=this.get_property(Ox),b=this.get_property(wg),y=this.get_property(hu);(h=this.sessionRecording)===null||h===void 0||h.flushBeforeIdentityReset();const _=this.is_capturing();n||this.consent.reset(),n||!_||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const j=(f=this.persistence)===null||f===void 0||(p=f.Oa)===null||p===void 0?void 0:p.call(f),N=this.Su;this.Su=N||n;let S=!1;try{var C,E,R,A,O,P,z,Z,I,q,L,de,Q;if((C=this.persistence)===null||C===void 0||C.clear(),(E=this.sessionPersistence)===null||E===void 0||E.clear(),this.Eu.clear(),this.yc(),ue(y)||(q=this.persistence)===null||q===void 0||q.register({$session_recording_remote_config:y}),(R=this.surveys)===null||R===void 0||R.reset(),(A=this.featureFlags)===null||A===void 0||A.reset(),(O=this.conversations)===null||O===void 0||O.reset(),(P=this.logs)===null||P===void 0||P.reset(),(z=this.metrics)===null||z===void 0||z.reset(),(Z=this.persistence)===null||Z===void 0||Z.set_property("$user_state","anonymous"),(I=this.sessionManager)===null||I===void 0||I.resetSessionId(),this.Lu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Sg,$device_id:null},"");else{const H=this.config.get_device_id(mi());this.register_once({distinct_id:H,$device_id:t?H:v},""),t||ue(b)||this.register({[wg]:b})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.yu()&&((Q=this.persistence)===null||Q===void 0||Q.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(L=this.featureFlags)===null||L===void 0||L.initialize(),!qe(g)&&!(!((de=this.sessionManager)===null||de===void 0)&&de.setBootstrapSessionId(g,!0)))){const H=D({},i);delete H.sessionID,this.config.bootstrap=H}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,S=!0}finally{var V,G;this.Su=N,j&&((V=this.persistence)===null||V===void 0||(G=V.qa)===null||G===void 0||G.call(V,S))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Pt(function*(){var i,a,o,u,h,f,p,g;if(n.__loaded){n.Iu=!0,n.Ju().dispose(),(i=n.sessionRecording)===null||i===void 0||i.dispose(),(a=n.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(o=n.metrics)===null||o===void 0||o.flush("sendBeacon"),(u=n.metrics)===null||u===void 0||u.dispose(),(h=n.Bu)===null||h===void 0||h.unload(),(f=n.Hu)===null||f===void 0||f.unload();try{var v;(v=n.featureFlags)===null||v===void 0||v.destroy()}catch(b){_e.error("Error while destroying feature flags",b)}(p=n.persistence)===null||p===void 0||p.destroy(),(g=n.sessionPersistence)===null||g===void 0||g.destroy()}else _e.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,n){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)===null||i===void 0||i.xc()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.$c()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let a=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(t!=null&&t.withTimestamp&&i){var o;const u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return a;a+=`?t=${Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}`}return a}alias(t,n){return t===this.get_property("$people_distinct_id")?(_e.critical("Attempting to create alias for existing People user - aborting."),-2):this._c("posthog.alias")?(ue(n)&&(n=this.get_distinct_id()),t!==n?(this.wc(tf,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(_e.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const n=D({},this.config);if(Ze(t)){var i,a,o,u,h,f,p,g,v,b,y,_,j,N;$t(this.config,p5(t));const A=this.Cu();if(this.persistence){const P=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var S,C;if(P&&this.sessionPersistence!==this.persistence&&((S=this.sessionPersistence)===null||S===void 0||S.remove(),(C=this.sessionPersistence)===null||C===void 0||C.destroy()),this.persistence.update_config(this.config,n,A),P)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Rg(D(D({},this.config),{},{persistence:"sessionStorage"}),A,!1);else{var E;(E=this.sessionPersistence)===null||E===void 0||E.update_config(D(D({},this.config),{},{persistence:"sessionStorage"}),D(D({},n),{},{persistence:"sessionStorage"}),A)}}const O=this.Nu(this.config.debug);var R;cs(O)&&(this.config.debug=O),cs(this.config.debug)&&(this.config.debug?(jn.DEBUG=!0,ct.At()&&ct.$t("ph_debug",!0),_e.info("set_config",{config:t,oldConfig:n,newConfig:D({},this.config)})):(jn.DEBUG=!1,ct.At()&&ct.Pt("ph_debug"))),(i=this.featureFlags)===null||i===void 0||(a=i.updateConfig)===null||a===void 0||a.call(i,this.config,this.il()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(u=this.exceptions)===null||u===void 0||u.onConfigChange(),(h=this.metrics)===null||h===void 0||h.onConfigChange(),(f=this.webMCP)===null||f===void 0||f.startIfEnabled(),(p=this.sessionRecording)===null||p===void 0||p.startIfEnabledOrStop(),(g=this.tracingHeaders)===null||g===void 0||g.startIfEnabledOrStop(),(v=this.autocapture)===null||v===void 0||v.startIfEnabled(),(b=this.heatmaps)===null||b===void 0||b.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((R=this.historyAutocapture)===null||R===void 0||R.startIfEnabledOrStop()),(y=this.exceptionObserver)===null||y===void 0||y.startIfEnabledOrStop(),(_=this.deadClicksAutocapture)===null||_===void 0||_.startIfEnabledOrStop(),(j=this.surveys)===null||j===void 0||j.loadIfEnabled(),this.xu(),(N=this.externalIntegrations)===null||N===void 0||N.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Yw(this,xu,!1)}}_overrideSDKInfo(t,n){jn.LIB_NAME=t,jn.LIB_VERSION=n}startSessionRecording(t){const n=t===!0,i={sampling:n||!!(t!=null&&t.sampling),linked_flag:n||!!(t!=null&&t.linked_flag),url_trigger:n||!!(t!=null&&t.url_trigger),event_trigger:n||!!(t!=null&&t.event_trigger)};var a,o,u,h,f;Object.values(i).some(Boolean)&&((a=this.sessionManager)===null||a===void 0||a.checkAndGetSessionAndWindowId(),i.sampling&&((o=this.sessionRecording)===null||o===void 0||o.overrideSampling()),i.linked_flag&&((u=this.sessionRecording)===null||u===void 0||u.overrideLinkedFlag()),i.url_trigger&&((h=this.sessionRecording)===null||h===void 0||h.overrideTrigger("url")),i.event_trigger&&((f=this.sessionRecording)===null||f===void 0||f.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,n){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(D(D({},i),n))}catch{return}}addExceptionStep(t,n){var i;(i=this.exceptions)===null||i===void 0||i.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)===null||n===void 0||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&t!==void 0?t:oa.Cc}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)===null||i===void 0?void 0:i.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t;let n=(t=this.config.name)!==null&&t!==void 0?t:iu;return n!==iu&&(n="posthog."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}bc(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&_s(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}rc(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.bc()||this._c("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._c("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_c(t){return this.config.person_profiles==="never"?(_e.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this.wc(zx,!0),!0)}Cu(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var t,n;const i=this.Cu();var a,o,u;return this.is_capturing()||(a=this.logs)===null||a===void 0||a.Tc(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==i&&((o=this.persistence)===null||o===void 0||o.set_disabled(i)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.hi)!==i&&((u=this.sessionPersistence)===null||u===void 0||u.set_disabled(i)),this.yc(),i}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){if(this.yu()){var i,a,o,u,h,f;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.Sc(!0,!0),(a=this.sessionManager)===null||a===void 0||a.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=new a5(this),this.pageViewManager=new Xw(this),this.persistence&&(this.sessionPropsManager=new i5(this,this.sessionManager,this.persistence));const y=(u=(h=this.config.__extensionClasses)===null||h===void 0?void 0:h.sessionRecording)!==null&&u!==void 0?u:(f=oa.__defaultExtensionClasses)===null||f===void 0?void 0:f.sessionRecording;var p,g;y&&(this.sessionRecording=this.mu(this.sessionRecording,new y(this)),this.hu&&((p=this.sessionRecording)===null||p===void 0||(g=p.onRemoteConfig)===null||g===void 0||g.call(p,this.hu)))}var v,b;this.consent.optInOut(!0),this.xu(),this.ec(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((v=this.surveys)===null||v===void 0||v.loadIfEnabled()),(ue(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((b=t==null?void 0:t.captureEventName)!==null&&b!==void 0?b:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.nc()}else _e.warn(c5)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&this.$u()):_e.warn(c5)}$u(){var t,n;const i=this.sessionRecording;i==null||i.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.Sc(!0,!0),this.register({distinct_id:Sg,$device_id:null}),this.gu(i),this.sessionRecording=void 0,(t=this.sessionManager)===null||t===void 0||t.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.nc(),this.ec()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return!this.Su&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return En?Lj(En,this.config.custom_blocked_useragents):void 0}nc(){ge&&(ge.visibilityState==="visible"?this.Fu||(this.Fu=!0,this.capture(Fx,{title:ge.title},{send_instantly:!0}),this.Ou&&(ge.removeEventListener(Cu,this.Ou),this.Ou=null)):this.Ou||(this.Ou=this.nc.bind(this),gt(ge,Cu,this.Ou)))}debug(t){t===!1?(se==null||se.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(se==null||se.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}))}il(){const t=this.qu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(_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):(function(n,i,a,o,u){const h=i in n&&!qe(n[i]),f=a in n&&!qe(n[a]);return h?n[i]:!!f&&(u&&u.warn(`Config field '${a}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,_e)}Os(t){var n;if(qe(this.config.before_send))return t;const i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(e6),a=Ie(this.config.before_send)?this.config.before_send:[this.config.before_send];let o=t;for(const u of a)try{if(o=u(o),qe(o)){const h=`Event '${t.event}' was rejected in beforeSend function`;return JT(t.event)?_e.warn(`${h}. This can cause unexpected behavior.`):_e.info(h),null}o.properties&&!_s(o.properties)||_e.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(h){return _e.error(`Error in beforeSend function for event '${t.event}':`,h),null}for(const u of i)if(o.properties&&qe(o.properties[u]))return _e.warn(`Event '${t.event}' had its '${u}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return o}getPageViewId(){var t;return(t=this.pageViewManager.Wo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}Nu(t){const n=cs(t)&&!t,i=ct.At()&&ct.Ot("ph_debug")==="true";return!n&&(!!i||t)}};vu.__defaultExtensionClasses={},vu.Cc=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let n=0;t.length>n;n++)e.prototype[t[n]]=XM(e.prototype[t[n]])})(vu,["identify"]);var Ij=class{constructor(e){this.disabled=e===!1;const t=Ze(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}};const Ug="$copy_autocapture",Hg=Wt("[AutoCapture]");function qg(e,t){return t.length>e?t.slice(0,e)+"...":t}function i8(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!bi(t));return t}function r8(e,{e:t,maskAllElementAttributes:n,maskAllText:i,elementAttributeIgnoreList:a,elementsChainAsString:o,disableCaptureUrlHashes:u}){var h,f;if(!bi(e))return{props:{}};const p=[e],g=new Set([e]);let v=e;for(;v.parentNode&&!qn(v,"body")&&1e3>p.length;){if(Ux(v.parentNode)){const O=v.parentNode.host;if(g.has(O))break;g.add(O),p.push(O),v=O;continue}if(!bi(v.parentNode)||g.has(v.parentNode))break;g.add(v.parentNode),p.push(v.parentNode),v=v.parentNode}const b=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?p.findIndex(O=>qn(O,"button")||qn(O,"a")):-1;b>0&&(i=i||p.slice(0,b+1).some(O=>!al(O)||Eo(O)));const y=[],_={};let j,N=!1,S=!1;if(_t(p,O=>{const P=al(O);if(qn(O,"a")&&!n&&!(a!=null&&a.includes("href"))){const z=O.getAttribute("href");N=!!(P&&z&&_o(z))&&(u?ma(z):z)}Fe(Co(O),"ph-no-capture")&&(S=!0),y.push((function(z,Z,I,q,L=!1){const de=z.tagName.toLowerCase(),Q={tag_name:de};qx.indexOf(de)>-1&&!I&&(Q.$el_text=de.toLowerCase()==="a"||de.toLowerCase()==="button"?qg(1024,qw(z)):qg(1024,Eu(z)));const V=Co(z);Z||q!=null&&q.includes("class")||0>=V.length||(Q.classes=V.filter(function(ye){return ye!==""})),_t(z.attributes,function(ye){var T;if((!Eo(z)||["name","id","class","aria-label"].indexOf(ye.name)!==-1)&&!(q!=null&&q.includes(ye.name))&&!Z&&_o(ye.value)&&(!et(T=ye.name)||T.substring(0,10)!=="_ngcontent"&&T.substring(0,7)!=="_nghost")){let Ne=ye.value;ye.name==="class"&&(Ne=Hx(Ne).join(" ")),Q["attr__"+ye.name]=qg(1024,ye.name==="href"&&L?ma(Ne):Ne)}});let G=1,H=1,ae=z;for(;ae=i8(ae);)G++,ae.tagName===z.tagName&&H++;return Q.nth_child=G,Q.nth_of_type=H,Q})(O,n,i,a,u)),_t((function(z){if(!al(z))return{};const Z={};return _t(z.attributes,function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){const q=I.name.replace("data-ph-capture-attribute-",""),L=I.value;q&&L&&_o(L)&&(Z[q]=L)}}),Z})(O),(z,Z)=>{({}).hasOwnProperty.call(_,Z)||(_[Z]=z)})}),S)return{props:{},explicitNoCapture:S};if(b>0&&(e=p[b],y.splice(0,b)),i||(y[0].$el_text=qn(e,"a")||qn(e,"button")?qw(e):Eu(e)),N){var C,E;y[0].attr__href=N;const O=(C=_r(N))===null||C===void 0?void 0:C.host,P=se==null||(E=se.location)===null||E===void 0?void 0:E.host;O&&P&&O!==P&&(j=N)}return{props:$t((A=t.type,{$event_type:A,$ce_version:1}),o?{}:{$elements:y},{$elements_chain:(R=y,Ie(R)?(function(O){return O.map(P=>{var z,Z;let I="";if(P.tag_name&&(I+=P.tag_name),P.attr_class){P.attr_class.sort();for(const de of P.attr_class)I+=`.${de.replace(/"/g,"")}`}const q=D(D(D(D({},P.text?{text:P.text}:{}),{},{"nth-child":(z=P.nth_child)!==null&&z!==void 0?z:0,"nth-of-type":(Z=P.nth_of_type)!==null&&Z!==void 0?Z:0},P.href?{href:P.href}:{}),P.attr_id?{attr_id:P.attr_id}:{}),P.attributes),L={};return Bh(q).sort(([de],[Q])=>(function(V,G){return G>V?-1:V>G?1:0})(de,Q)).forEach(([de,Q])=>L[Vw(de.toString())]=Vw(Q.toString())),I+=":",I+=Bh(L).map(([de,Q])=>`${de}="${Q}"`).join(""),I}).join(";")})((function(O){return O.map(P=>{var z,Z;const I={text:(z=P.$el_text)===null||z===void 0?void 0:z.slice(0,400),tag_name:P.tag_name,href:(Z=P.attr__href)===null||Z===void 0?void 0:Z.slice(0,2048),attr_class:dA(P),attr_id:P.attr__id,nth_child:P.nth_child,nth_of_type:P.nth_of_type,attributes:{}};return Bh(P).filter(([q])=>q.indexOf("attr__")===0).forEach(([q,L])=>I.attributes[q]=L),I})})(R)):"")},!((h=y[0])===null||h===void 0)&&h.$el_text?{$el_text:(f=y[0])===null||f===void 0?void 0:f.$el_text}:{},j&&t.type==="click"?{$external_click_url:j}:{},_),target:e};var R,A}var a8=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!al(e))return!0;const n=(t=this.mo().css_selector_ignorelist)!==null&&t!==void 0?t:Tg,i=new Set;let a=e;for(;a;){if(i.size>=1e3||i.has(a))return!0;i.add(a);const o=a,u=Co(o);if(Fe(u,"ph-no-capture")||Fe(u,"ph-sensitive")||Eo(o)||n.some(f=>Q0(o,f)))return!0;const h=a.parentNode;a=Ux(h)?h.host:h&&bi(h)?h:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const i=pu(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&bi(i)&&(this.vo={target:i,excluded:this.po(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.bo)===null||t===void 0?void 0:t.distinctId}))}const n=this.vo;n&&(e.pointerId!==n.id||Math.abs(e.clientX-n.x)>5||Math.abs(e.clientY-n.y)>5?this.do():e.type==="pointerup"&&(n.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var t;const n=this.vo;this.do();const i=pu(e);if(n!=null&&n.released&&n.target.isConnected&&n.distinctId===((t=this.bo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===n.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-n.x)&&5>=Math.abs(e.clientY-n.y)&&i&&(qn(i,"html")||qn(i,"body"))){var a;if(n.excluded)return null;const o=(a=this.mo().css_selector_ignorelist)!==null&&a!==void 0?a:Tg;return[i,ge==null?void 0:ge.documentElement,ge==null?void 0:ge.body].some(u=>{if(!u)return!1;const h=Co(u);return Fe(h,"ph-no-capture")||Fe(h,"ph-sensitive")||!al(u)||Eo(u)||o.some(f=>Q0(u,f))})?null:n.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.$o=new Map,this.Co=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Mr),this.rageclicks=new Ij(this.Mr.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?t.dispose():(this.Eo=t,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.$o.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Mr),this.Mr}Mo(){var e,t;return this.mo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),this.Mr.url_ignorelist=(t=this.Mr.url_ignorelist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),this.Mr}Ro(){if(!this.isBrowserSupported())return void Hg.info("Disabling Automatic Event Collection because this browser is not supported");if(!se||!ge)return;const e=this.Ao=t=>{t=t||(se==null?void 0:se.event);try{if(t.type==="blur")return void this.do();if(t.type.indexOf("pointer")===0)return void this.yo(t);const n=t.type==="click"?this._o(t):void 0;if(Xt(n))return;this.Fo(t,"$autocapture",n)}catch(n){Hg.error("Failed to capture event",n)}};if(gt(se,"blur",e),gt(ge,"submit",e,{capture:!0}),gt(ge,"change",e,{capture:!0}),gt(ge,"click",e,{capture:!0}),_t(["pointerdown","pointermove","pointerup","pointercancel"],t=>{gt(ge,t,e,{capture:!0})}),this.mo().capture_copied_text){const t=this.Oo=n=>{n=n||(se==null?void 0:se.event);try{this.Fo(n,Ug)}catch(i){Hg.error("Failed to capture clipboard event",i)}};gt(ge,"copy",t,{capture:!0}),gt(ge,"cut",t,{capture:!0}),gt(ge,"paste",t,{capture:!0})}}Po(){this.do(),this.Ao&&(se==null||se.removeEventListener("blur",this.Ao),_t(["pointerdown","pointermove","pointerup","pointercancel"],e=>{ge==null||ge.removeEventListener(e,this.Ao,!0)}),ge==null||ge.removeEventListener("submit",this.Ao,!0),ge==null||ge.removeEventListener("change",this.Ao,!0),ge==null||ge.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(ge==null||ge.removeEventListener("copy",this.Oo,!0),ge==null||ge.removeEventListener("cut",this.Oo,!0),ge==null||ge.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.Co=t.elementsChainAsString);const n=t.autocapture_opt_out;var i;cs(n)&&((i=this.bo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",n),this.So=n),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.To)return;e.size?this.$o.set(t,new Set(e)):this.$o.delete(t);const n=new Set;this.$o.forEach(i=>{i.forEach(a=>n.add(a))}),this.Io=n}getElementSelectors(e,t){var n;const i=[];return(n=this.Io)===null||n===void 0||n.forEach(a=>{const o=ge==null?void 0:ge.querySelectorAll(a);o==null||o.forEach(u=>{e!==u&&t!==u||Fe(i,a)||i.push(a)})}),i}get isEnabled(){var e,t;if(this.To)return!1;const n=(e=this.bo)===null||e===void 0?void 0:e.kv.get(Sk),i=this.So,a=this.mo();if(!a.remoteRequestsDisabled&&!this.xo)return!1;const o=a.remoteRequestsDisabled&&!this.xo;if(Xt(i)&&!cs(n)&&!o)return!1;const u=(t=this.So)!==null&&t!==void 0?t:!!n;return!!a.enabled&&!u}Fo(e,t="$autocapture",n){if(!this.isEnabled)return void this.do();let i=n||pu(e);Wk(i)&&(i=i.parentNode||null);const a=this.Mo();var o;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&a.rageclick&&(!((o=this.rageclicks)===null||o===void 0)&&o.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&ej(i,a.rageclick)&&this.Fo(e,"$rageclick",n);const u=t===Ug,h=u?D(D({},a),{},{dom_event_allowlist:void 0}):a;if(i&&(function(v,b,y,_,j,N){var S;if(!se||Gx(v)||y!=null&&y.url_allowlist&&!zw(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&zw(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){const A=y.dom_event_allowlist;if(A&&!A.some(O=>b.type===O))return!1}const{parentIsUsefulElement:C,targetElementList:E}=tj(v,_);if(!(function(A,O){const P=O==null?void 0:O.element_allowlist;if(ue(P))return!0;for(const z of A)if(P.some(Z=>z.tagName.toLowerCase()===Z))return!0;return!1})(E,y)||!W0(E,y==null?void 0:y.css_selector_allowlist)||W0(E,(S=y==null?void 0:y.css_selector_ignorelist)!==null&&S!==void 0?S:Tg))return!1;try{const A=se.getComputedStyle(v);if(A&&A.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}const R=v.tagName.toLowerCase();switch(R){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return C?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(qx.indexOf(R)>-1||v.getAttribute("contenteditable")==="true")}})(i,e,h,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var f;const{props:v,explicitNoCapture:b,target:y}=r8(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.Co,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(b)return!1;const _=this.getElementSelectors(i,y);if(_&&_.length>0&&(v.$element_selectors=_),t===Ug){const j=e.type||"clipboard";if(j!=="paste"){var p,g;const N=se==null||(p=se.getSelection())===null||p===void 0?void 0:p.toString(),S=Zk(N);if(!S)return!1;v.$selected_content=S,v.$clipboard_text_length=(g=N==null?void 0:N.length)!==null&&g!==void 0?g:0}v.$copy_type=j}return(f=this.bo)===null||f===void 0||f.capture(t,v),!0}}isBrowserSupported(){return xn(ge==null?void 0:ge.querySelectorAll)}},l8=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,n=Ze(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=n==null?void 0:n.url_allowlist,e.url_ignorelist=n==null?void 0:n.url_ignorelist,e.dom_event_allowlist=n==null?void 0:n.dom_event_allowlist,e.element_allowlist=n==null?void 0:n.element_allowlist,e.css_selector_allowlist=n==null?void 0:n.css_selector_allowlist,e.css_selector_ignorelist=n==null?void 0:n.css_selector_ignorelist,e.element_attribute_ignorelist=n==null?void 0:n.element_attribute_ignorelist,e.capture_copied_text=n==null?void 0:n.capture_copied_text}};const Wc=Wt("[ExceptionAutocapture]"),m5=()=>{},g5=e=>{var t;if(xn(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function Ro(e,t,n){try{if(!(t in e))return m5;const i={next:e[t]},a=n(function(...o){return i.next.apply(this,o)});return xn(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=a,()=>{if(e[t]===a)return void(e[t]=i.next);let o=e[t],u=g5(o);for(;u;){if(u.next===a)return void(u.next=i.next);o=u.next,u=g5(o)}}}catch{return m5}}const o8=Wt("[TracingHeaders]"),Qa=Wt("[Web Vitals]"),x5=9e5,v5=["CLS","FCP","INP","LCP"],c8=["INP","LCP"],u8=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Vg="disabled",b5="lazy_loading",dr=Wt("[SessionRecording]"),d8=[$x,Px,$k,Pk,Bk,Fk,Ik,Uk,Hk],h8=Wt("[Heatmaps]");function Gg(e){return Ze(e)&&"clientX"in e&&"clientY"in e&&sn(e.clientX)&&sn(e.clientY)}const yh=Wt("[Product Tours]"),Yg=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Dx))},f8=["$set_once","$set"],$i=Wt("[SiteApps]"),y5="Error while initializing PostHog app with config id ",Uj=(e,t)=>e!=null&&e.then?e.then(t):t(e),oo="SDK is not enabled or survey functionality is not yet loaded",_5="Disabled. Not loading surveys.";var p8=class{constructor(e,t){this.wo=e,this.Ic=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Mc=!1,this.Ec=!1,this.Pc=[],this.Rc=[],this.Ac=null,this.Fc=null,this.To=!1,this.Oc=new Set,this.onRemoteConfig=n=>{if(this.To||this.Mr.disableSurveys)return;if(!n.ok)return this.Ec=!0,this.Dc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),yt.warn("Remote config unavailable. Not loading surveys.");const i=n.config.surveys;if(qe(i))return yt.warn("Flags not loaded yet. Not loading surveys.");this.Lc=cs(i)?i:i.length>0,yt.info(`flags response received, isSurveysEnabled: ${this.Lc}`),this.loadIfEnabled()},this.Dc=n=>{this.Rc.slice().forEach(i=>this.Nc(i,n))}}setup(e){if(!this.To)return this.qc=e,Uj(e.kv.initialize(),()=>{if(this.qc!==e||this.To)return;this.qc=void 0,this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.To?t.dispose():(this.Eo=t,this.loadIfEnabled())})}dispose(){var e,t,n,i,a;this.To||(this.To=!0,this.qc=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(n=this._surveyManager)===null||n===void 0||(i=n.dispose)===null||i===void 0||i.call(n),this._surveyManager=null,this.Pc=[],this.Rc.forEach(o=>{o.active=!1}),this.Rc=[],(a=this.jc)===null||a===void 0||a.call(this),this.jc=void 0,this.Ac=null,this.Oc.forEach(o=>clearTimeout(o)),this.Oc.clear())}get Mr(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var n;(n=this._surveyEventReceiver)===null||n===void 0||n.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let a=0;a<localStorage.length;a++){const o=localStorage.key(a);(o!=null&&o.startsWith("seenSurvey_")||o!=null&&o.startsWith("inProgressSurvey_"))&&i.push(o)}i.forEach(a=>localStorage.removeItem(a))}catch{}this.Dc()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Mr;if(this._surveyManager)return;if(this.Mc)return void yt.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void yt.info(_5);if(e.cookielessMode&&this.wo.isOptedOut())return void yt.info("Not loading surveys in cookieless mode without consent.");const t=this.wo.getExtensions();if(!t)return void this.Bc("PostHog Extensions not found.");if(ue(this.Lc)&&!e.advancedEnableSurveys)return;const n=this.Lc||e.advancedEnableSurveys;this.Mc=!0,this.Ec=!1;try{const i=t.generateSurveys;if(i)return this.zc(i,n),void(this.Mc=!1);const a=t.loadExternalDependency;if(!a)return this.Bc(Bx),void(this.Mc=!1);a(o=>{try{if(this.To)return;const u=this.wo.getExtensions();o||!(u!=null&&u.generateSurveys)?this.Bc("Could not load surveys script",o):this.zc(u.generateSurveys,n)}finally{this.Mc=!1}})}catch(i){throw this.Mc=!1,this.Bc("Error initializing surveys",i),i}}zc(e,t){var n,i;if(this.To)return;this._surveyManager=e(t),this._surveyEventReceiver=this.wo.createEventReceiver(this.Dc);const a=(n=(i=this.bo)!==null&&i!==void 0?i:this.Ic)===null||n===void 0?void 0:n.kv.get(su);a&&this.Hc(a),yt.info("Surveys loaded successfully"),this.Uc(),this.Dc(),this.Wc({isLoaded:!0})}Bc(e,t){this.Ec=!0,yt.error(e,t),this.Dc({isLoaded:!1,error:e}),this.Wc({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Pc.push(e),this._surveyManager&&this.Wc({isLoaded:!0}),()=>{this.Pc=this.Pc.filter(t=>t!==e)}}getSurveys(e,t=!1){var n;const i=(n=this.bo)!==null&&n!==void 0?n:this.Ic;if(!i||this.To)return;if(this.Mr.disableSurveys)return yt.info(_5),e([]);const a=i.kv.get(su);if(a&&!t)return e(a,{isLoaded:!0}),void(this.Vc()&&this.getSurveys(()=>{},!0));if(this.Ac)return void this.Ac.then(({surveys:h,context:f})=>{this.To||e(h,f)}).catch(h=>yt.error("Error in survey callback",h));const o=this.Gc("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(h=>{try{return this.Qc(i,h)}catch(f){return yt.error("Error processing surveys response",f),this.Qc(i,{statusCode:0,error:f})}},h=>this.Qc(i,{statusCode:0,error:h}));this.Ac=o;const u=()=>{this.Ac===o&&(this.Ac=null)};o.then(h=>{u(),this.To||(this.Dc(h.context),e(h.surveys,h.context))},u).catch(h=>yt.error("Error in survey callback",h))}Gc(e,t){const n=this.bo;return n?n.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(oo)}))}Qc(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:oo}};const n=t.statusCode;if(n!==200||!t.json){const a=`Surveys API could not be loaded, status: ${n}`;return n!==0?yt.error(a):t.error||yt.warn(a),this.Fc=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Fc=null;const i=t.json.surveys||[];return e.kv.set({[su]:i,[nf]:Date.now()}),this.Hc(i),{surveys:i,context:{isLoaded:!0}}}Hc(e){var t;const n=e.filter(i=>(function(a){return!(!a.start_date||a.end_date)})(i)&&(zj(i)||(function(a){var o;return!!(!((o=a.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0)&&o.length)})(i)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(n)}Vc(){return this.Zc()&&!this.Ac&&!this.Jc()}Zc(){var e,t;const n=(e=(t=this.bo)!==null&&t!==void 0?t:this.Ic)===null||e===void 0?void 0:e.kv.get(nf);return sn(n)&&Date.now()-n>3e5}Jc(){return sn(this.Fc)&&3e5>Date.now()-this.Fc}markSurveyAsSeen(e,t){var n;const i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};Bj(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Dc()}Wc(e){for(const t of this.Pc)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){yt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t=!1){if(!qe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);yt.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,n;if(this.To)return()=>{};const i={callback:e,active:!0,revision:0};this.Rc.push(i),this.Uc();const a=(t=(n=this.bo)!==null&&n!==void 0?n:this.Ic)===null||t===void 0?void 0:t.kv.get(su);return this.Mr.disableSurveys||!this._surveyManager&&this.Ec&&!this.Mc||!a&&!qe(this.Fc)&&!this.Ac?this.Nc(i,{isLoaded:!1}):this._surveyManager&&this.Nc(i),()=>{var o;i.active=!1,this.Rc=this.Rc.filter(u=>u!==i),this.Rc.length===0&&((o=this.jc)===null||o===void 0||o.call(this),this.jc=void 0)}}Uc(){var e,t,n;this._surveyManager&&this.Rc.length>0&&((e=this.jc)!==null&&e!==void 0||(this.jc=(t=(n=this.wo).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(n,this.Dc)))}Nc(e,t){if(this.To||!e.active)return;const n=++e.revision,i=a=>{if(!this.To&&e.active&&n===e.revision)try{const o=t??{isLoaded:!0},u=JSON.stringify([a,o]);if(u===e.lastResult)return;e.lastResult=u,e.callback(a,o)}catch(o){yt.error("Error in active matching surveys callback",o)}};try{t&&!t.isLoaded?i([]):this.getActiveMatchingSurveys(i)}catch(a){yt.error("Error in active matching surveys callback",a)}}Kc(e){let t=null;return this.getSurveys(n=>{var i;t=(i=n.find(a=>a.id===e))!==null&&i!==void 0?i:null}),t}Xc(e){if(qe(this._surveyManager))return{eligible:!1,reason:oo};const t=typeof e=="string"?this.Kc(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Yc(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(qe(this._surveyManager))return{eligible:!1,reason:oo};const t=typeof e=="string"?this.Kc(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(qe(this._surveyManager))return yt.warn("init was not called"),{visible:!1,disabledReason:oo};const t=this.Yc(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return qe(this._surveyManager)?(yt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:oo})):new Promise(n=>{this.getSurveys(i=>{var a;const o=(a=i.find(u=>u.id===e))!==null&&a!==void 0?a:null;if(o){const u=this.Yc(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var i;if(!this.wo.isCapturing())return;if(qe(this._surveyManager))return void yt.warn("init was not called");const a=typeof e=="string"?this.Kc(e):e;if(!(a!=null&&a.id))return void yt.warn("Survey not found");if(!HA.includes(a.type))return void yt.warn(`Surveys of type ${a.type} cannot be rendered in the app`);const o=ge==null?void 0:ge.querySelector(t);if(o){if(!((i=a.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){yt.info(`Rendering survey ${a.id} with delay of ${a.appearance.surveyPopupDelaySeconds} seconds`);const u=setTimeout(()=>{var h,f;this.Oc.delete(u),!this.To&&this.wo.isCapturing()&&(yt.info(`Rendering survey ${a.id} with delay of ${(h=a.appearance)===null||h===void 0?void 0:h.surveyPopupDelaySeconds} seconds`),(f=this._surveyManager)===null||f===void 0||f.renderSurvey(a,o,n),yt.info(`Survey ${a.id} rendered`))},1e3*a.appearance.surveyPopupDelaySeconds);return void this.Oc.add(u)}this._surveyManager.renderSurvey(a,o,n)}else yt.warn("Survey element not found")}displaySurvey(e,t){var n;if(!this.wo.isCapturing())return;if(qe(this._surveyManager))return void yt.warn("init was not called");const i=this.Kc(e);if(!i)return void yt.warn("Survey not found");let a=i;if(!((n=i.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=D(D({},i),{},{appearance:D(D({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==Z0.Popover&&t.initialResponses&&yt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const o=this.Xc(i);if(!o.eligible)return void yt.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==Z0.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}cancelPendingSurvey(e){qe(this._surveyManager)?yt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function co(e,t,n){if(qe(e))return!1;switch(n){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var m8=class{constructor(e){this._instance=e,this.th=new Set,this.eh=new Set,this.ih=new cf,this.nh=(t,n)=>this.sh(t,n)&&this.rh(t,n)&&this.oh(t,n)&&this.ah(t,n),this.sh=(t,n)=>!(n!=null&&n.event)||(t==null?void 0:t.event)===(n==null?void 0:n.event)}init(){var e,t;ue((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.uh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((n,i)=>{this.on(n,i)}))}dispose(){var e,t;(e=this.uh)===null||e===void 0||e.call(this),this.uh=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.ih=new cf}register(e){var t,n;if(!ue((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var a;this.th.add(i),(a=i.steps)===null||a===void 0||a.forEach(o=>{this.eh.add((o==null?void 0:o.event)||"")})}),(n=this._instance)===null||n===void 0?void 0:n.autocapture)){const i=new Set;this.th.forEach(a=>{var o;(o=a.steps)===null||o===void 0||o.forEach(u=>{u!=null&&u.selector&&i.add(u.selector)})}),this._instance.autocapture.setElementSelectors(i,this)}}replace(e){this.th.clear(),this.eh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.eh.has(e)||this.eh.has(t.event))&&this.th.forEach(n=>{this.hh(t,n)&&this.ih.emit("actionCaptured",n.name)})}dh(e){this.onAction("actionCaptured",t=>e(t))}hh(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const n of t.steps)if(this.nh(e,n))return!0;return!1}onAction(e,t){return this.ih.on(e,t)}rh(e,t){if(t!=null&&t.url){var n;const i=e==null||(n=e.properties)===null||n===void 0?void 0:n.$current_url;if(!i||typeof i!="string"||!co(i,t.url,t.url_matching||"contains"))return!1}return!0}oh(e,t){return!!this.fh(e,t)&&!!this.ph(e,t)&&!!this.gh(e,t)}fh(e,t){var n;if(!(t!=null&&t.href))return!0;const i=this.mh(e);if(i.length>0)return i.some(o=>co(o.href,t.href,t.href_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&co((function(o){const u=o.match(/(?::|")href="(.*?)"/);return u?u[1]:""})(a),t.href,t.href_matching||"exact")}ph(e,t){var n;if(!(t!=null&&t.text))return!0;const i=this.mh(e);if(i.length>0)return i.some(f=>co(f.text,t.text,t.text_matching||"exact")||co(f.$el_text,t.text,t.text_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&(o=(function(f){const p=[],g=/(?::|")text="(.*?)"/g;let v;for(;!qe(v=g.exec(f));)p.includes(v[1])||p.push(v[1]);return p})(a),u=t.text,h=t.text_matching||"exact",o.some(f=>co(f,u,h)));var o,u,h}gh(e,t){var n,i;if(!(t!=null&&t.selector))return!0;const a=e==null||(n=e.properties)===null||n===void 0?void 0:n.$element_selectors;if(a!=null&&a.includes(t.selector))return!0;const o=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}mh(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}ah(e,t){return!(t!=null&&t.properties)||t.properties.length===0||Pj(t.properties.reduce((n,i)=>{const a=Ie(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:a,operator:i.operator||"exact"},n},{}),e==null?void 0:e.properties)}},g8=class{constructor(e,t){var n,i;this.yh=[],this._instance=e,this.bh=t,this._h=new Map,this.wh=new Map,this.kh=new Map,this.Sh=(n=this._instance)===null||n===void 0||(i=n.onSessionId)===null||i===void 0?void 0:i.call(n,a=>this.xh(a))}$h(e){return!1}Ch(){return null}Th(e){}Ih(){}Mh(e,t){return!!e&&Pj(e.propertyFilters,t==null?void 0:t.properties)}Eh(e,t){const n=new Map;return e.forEach(i=>{var a;(a=i.conditions)===null||a===void 0||(a=a[t])===null||a===void 0||(a=a.values)===null||a===void 0||a.forEach(o=>{if(o!=null&&o.name){const u=n.get(o.name)||[];u.push(i.id),n.set(o.name,u)}})}),n}Ph(e,t,n){const i=(n===Yc.Activation?this._h:this.wh).get(e);let a=[];return this.Rh(o=>{a=o.filter(u=>i==null?void 0:i.includes(u.id))}),a.filter(o=>{var u;const h=(u=o.conditions)===null||u===void 0||(u=u[n])===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.find(f=>f.name===e);return this.Mh(h,t)})}register(e){this.Ah(e,!1)}replace(e){this.Ah(e,!0)}Ah(e,t){var n;ue((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.Fh(e,t),this.Oh(e,t))}Oh(e,t){const n=e.filter(o=>{var u;return(u=o.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length});var i;if(t&&this.kh.clear(),n.length===0)return void(t&&((i=this.Dh)===null||i===void 0||i.replace([])));this.Dh||(this.Dh=new m8(this._instance),this.Dh.init(),this.Dh.dh(o=>this.onAction(o)));const a=[];n.forEach(o=>{var u;(u=o.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||u.values.forEach(h=>{if(a.push(h),h.name){var f;const p=(f=this.kh.get(h.name))!==null&&f!==void 0?f:[];p.includes(o.id)||p.push(o.id),this.kh.set(h.name,p)}})}),t?this.Dh.replace(a):this.Dh.register(a)}Lh(e,t){t.forEach((n,i)=>{var a;const o=(a=e.get(i))!==null&&a!==void 0?a:[];n.forEach(u=>{o.includes(u)||o.push(u)}),e.set(i,o)})}Fh(e,t){var n,i;const a=e.filter(f=>{var p,g;return((p=f.conditions)===null||p===void 0?void 0:p.events)&&((g=f.conditions)===null||g===void 0||(g=g.events)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),o=e.filter(f=>{var p,g;return((p=f.conditions)===null||p===void 0?void 0:p.cancelEvents)&&((g=f.conditions)===null||g===void 0||(g=g.cancelEvents)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),u=this.Eh(e,Yc.Activation),h=this.Eh(e,Yc.Cancellation);t?(this._h=u,this.wh=h):(this.Lh(this._h,u),this.Lh(this.wh,h)),(a.length!==0||o.length!==0||e.some(f=>{var p;return(p=f.conditions)===null||p===void 0||(p=p.actions)===null||p===void 0||(p=p.values)===null||p===void 0?void 0:p.length}))&&((n=this.uh)!==null&&n!==void 0||(this.uh=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((f,p)=>{this.onEvent(f,p)})))}onEvent(e,t){var n,i;const a=this.Nh(),o=(t==null||(n=t.properties)===null||n===void 0?void 0:n.$survey_id)||(t==null||(i=t.properties)===null||i===void 0?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){const h=this.qh(e,o,t);if(h==="consume")return a.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.jh([o]);if(h==="persist")return a.info("shown item promoted to persisted activation",{event:e,itemId:o}),this.Bh(o),void this.zh([o])}if(this.wh.has(e)){const h=this.Ph(e,t,Yc.Cancellation);h.length>0&&(a.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(f=>f.id)}),this.jh(h.map(f=>f.id)),h.forEach(f=>this.Hh(f.id)))}if(!this._h.has(e))return;a.info("event name matched",{event:e,eventPayload:t,items:this._h.get(e)});const u=this.Ph(e,t,Yc.Activation);this.Uh(u.map(h=>h.id))}onAction(e){this.kh.has(e)&&this.Uh(this.kh.get(e)||[])}Uh(e){var t,n;if(e.length===0)return;const i=!!(!((t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0)&&n.call(t)),a=[];for(const o of e)i&&this.$h(o)?this.Bh(o)&&this.Wh(o):a.push(o);a.length>0&&(this.yh=[...new Set([...this.yh,...a])]),this.Nh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Vh()}Bh(e){this.yh=this.yh.filter(n=>n!==e);const t=this.Gh();return!t.includes(e)&&(this.Qh([...t,e]),this.Zh(),!0)}jh(e){const t=new Set(e);this.yh=this.yh.filter(a=>!t.has(a));const n=this.Jh(),i=n.filter(a=>!t.has(a));i.length!==n.length&&(this.Qh(i),i.length===0&&this.Kh()),this.zh(e),this.Vh()}Vh(){try{var e;(e=this.bh)===null||e===void 0||e.call(this)}catch(t){this.Nh().error("Error while handling activated items change",t)}}Xh(){var e;const t=this.Ch();if(!t)return{};const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return n&&typeof n=="object"?n:{}}Wh(e){if(!this.Ch())return;const t=this.Xh();this.Th(D(D({},t),{},{[e]:Date.now()}))}zh(e){if(!this.Ch())return;const t=this.Xh(),n={};let i=!1;for(const[a,o]of Object.entries(t))e.includes(a)?i=!0:n[a]=o;i&&(_s(n)?this.Ih():this.Th(n))}Yh(){this.Ch()&&this.Ih()}getActivationTimestamp(e){if(!this.Gh().includes(e))return;const t=this.Xh()[e];return sn(t)?t:void 0}Jh(){var e;const t=this.td();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Gh(){var e,t,n;const i=this.Jh();if(i.length===0)return[];const a=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.ed()],o=(t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0?void 0:n.call(t);return o&&a===o?i:[]}Zh(){var e,t;const n=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);n&&this.nd(n)}Kh(){this.sd()}xh(e){var t;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.ed()];if(n&&n!==e){const i=this.Jh(),a=this.Xh();i.length>0&&(this.Qh([]),i.filter(o=>sn(a[o])).forEach(o=>this.Hh(o))),this.Kh(),this.Yh(),i.length>0&&this.Vh()}}getActivatedIds(){return[...new Set([...this.Gh(),...this.yh])].filter(e=>!this.rd(e))}dispose(){var e,t,n;(e=this.Sh)===null||e===void 0||e.call(this),this.Sh=void 0,(t=this.uh)===null||t===void 0||t.call(this),this.uh=void 0,(n=this.Dh)===null||n===void 0||n.dispose(),this.Dh=void 0}reset(){this.yh=[],this.Jh().length>0&&this.Qh([]),this.Kh(),this.Yh(),this.Vh()}getEventToItemsMap(){return this._h}od(){return this.Dh}},x8=class extends g8{constructor(e,t){super(e,t)}td(){return Tk}ed(){return Mk}Ch(){return Ak}Th(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}Ih(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}$h(e){var t;let n;this.Rh(a=>{n=a.find(o=>o.id===e)});const i=n==null||(t=n.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return sn(i)&&i>0}ad(){return Ps.SHOWN}Rh(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Hh(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Nh(){return yt}Qh(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}nd(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}sd(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}rd(){return!1}qh(e,t,n){var i;if(e===Ps.SENT&&(n==null||(i=n.properties)===null||i===void 0?void 0:i.$survey_completed)===!1)return"ignore";let a;return this.Rh(o=>{a=o.find(u=>u.id===t)}),!a||(function(o){var u;return zj(o)&&!!(!((u=o.conditions)===null||u===void 0||(u=u.events)===null||u===void 0)&&u.repeatedActivation)||o.schedule==="always"})(a)?e===Ps.SHOWN?"consume":"ignore":e===Ps.SHOWN?"persist":e===Ps.DISMISSED||e===Ps.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},v8=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const n of e){const i=this._instance.get_property(n);ue(i)||(t[n]=i)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},b8=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=$e==null?void 0:$e.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:n}=e;return{generateSurveys:t?i=>t(this._instance,i):void 0,loadExternalDependency:n?i=>n(this._instance,"surveys",i):void 0}}createEventReceiver(e){return new x8(this._instance,e)}onMatchingConditionsChanged(e){const t=this._instance._addCaptureHook(o=>{o!=="$pageview"&&o!==Ps.SHOWN&&o!==Ps.DISMISSED&&o!==Ps.SENT||e()}),n=()=>e();gt(se,"PHSurveyShown",n);let i=!1;const a=this._instance.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,t(),a(),se==null||se.removeEventListener("PHSurveyShown",n)}}};const y8=se!=null&&se.location?af(se.location.hash,"__posthog")||af(location.hash,"state"):null,w5="_postHogToolbarParams",S5=Wt("[Toolbar]"),k5=Wt("[FeatureFlags]"),Wa=Wt("[FeatureFlags]",{debugEnabled:!0}),Xg=`" failed. Feature flags didn't load in time.`,_8=[502,504],j5=["click","keydown","wheel","touchstart","pointerdown"],N5="connection_error",C5=e=>{const t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},E5=e=>{const t={};for(const[n,i]of Bh(e||{}))i&&(t[n]=i);return t};var w8=class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=k5,this.ud={},this.hd={},this.dd=[],this.vd=new Set,this.fd=new Set,this.pd=!1,this.gd=!1,this.md=0,this.yd=!1,this.bd=!1,this._d=!1,this.wd=!1,this.kd=0,this.Sd=!1,this.rn=()=>{const t=this.xd();this.kd=0,t&&this.reloadFeatureFlags()},this.$d=()=>{var t,n;const i=this.Cd,a=(t=this.Td)!==null&&t!==void 0?t:i;ue(i)||ue(a)||this.Mr.remoteRequestsDisabled||!this.Id||this.Id.visibilityState==="hidden"||Date.now()-((n=this.Md)!==null&&n!==void 0?n:0)<a||(this.Td=this.Sd||!this.Mr.idleRefreshBackoff?i:Math.min(2*a,36e5),this.Sd=!1,this.reloadFeatureFlags(),this.Ed())},this.Pd=()=>{this.Sd&&this.Td===this.Cd||this.Rd()},this.sn=()=>{var t;((t=this.Id)===null||t===void 0?void 0:t.visibilityState)==="visible"&&this.Rd()},this.wo=e}get Ad(){}Fd(){this.bo&&this.Od()}setup(e){try{this.Dd=typeof window>"u"?void 0:window,this.Id=typeof document>"u"?void 0:document}catch{this.Dd=void 0,this.Id=void 0}return this.qc=e,this.A=e.logger.createLogger("[FeatureFlags]"),Uj(e.kv.initialize(),()=>{this.qc===e&&(this.qc=void 0,this.bo=e,this.Ld(e))})}Ld(e){var t;if(this.bo===e)return this.Dd&>(this.Dd,"online",this.rn),this.Od(),this.Nd=e.registerDynamicEventProperties(()=>this.qd()?this.ud:this.hd),this.jd=(t=this.Ad)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Bd(),this.zd(),this.Hd()}),this.zd(),this.initialize()}Rd(){this.Sd=!0,this.Td=this.Cd,this.$d()}Od(){var e;const t=this.Mr.refreshIntervalMs,n=!this.Mr.remoteRequestsDisabled&&this.Id&&!ue(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.Td=n),n!==this.Cd&&(this.Ud(),ue(n)||(this.Cd=n,this.Td=n,this.Ed(),!((e=this.Id)===null||e===void 0)&&e.addEventListener&&(gt(this.Id,Cu,this.sn),xo(j5,i=>{gt(this.Id,i,this.Pd,{capture:!0})}))))}Ed(){ue(this.Cd)||(ue(this.Wd)||clearInterval(this.Wd),this.Md=Date.now(),this.Wd=setInterval(this.$d,this.Cd))}Ud(){var e,t;ue(this.Wd)||(clearInterval(this.Wd),this.Wd=void 0,(e=this.Id)===null||e===void 0||(t=e.removeEventListener)===null||t===void 0||t.call(e,"visibilitychange",this.sn),xo(j5,n=>{var i,a;(i=this.Id)===null||i===void 0||(a=i.removeEventListener)===null||a===void 0||a.call(i,n,this.Pd,{capture:!0})})),this.Cd=void 0,this.Td=void 0,this.Sd=!1,this.Md=void 0}destroy(){this.Vd()}dispose(){this.Vd()}Vd(){var e,t,n;this.Ud(),this.md++,this.bd=!1,this.qc=void 0,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bo&&(this.Qd(),(e=this.Nd)===null||e===void 0||e.dispose(),this.Nd=void 0,(t=this.jd)===null||t===void 0||t.call(this),this.jd=void 0,this.dd=[],(n=this.Dd)===null||n===void 0||n.removeEventListener("online",this.rn),this.bo=void 0)}get Mr(){return this.wo.get()}Zd(e){var t;return this.Jd&&e in this.Jd?this.Jd[e]:(t=this.bo)===null||t===void 0?void 0:t.kv.get(e)}Bd(){return!!this.Jd&&(this.Jd=void 0,!0)}Kd(){var e;return!ue((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Bd()}$t(e){this.Xd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.set(e)})}Yd(e,t,n){if(!this.Ad||!e.$enabled_feature_flags)return;const i=this.Zd("$enabled_feature_flags")||{},a=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,u=t.flags?Object.entries(t.flags).filter(([,N])=>!(N!=null&&N.failed)).map(([N])=>N):[],h=!!t.errorsWhileComputingFlags&&!!t.flags,f=h?u:n&&!Ie(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(i),...Object.keys(a)])),p=this.Zd("$feature_flag_payloads")||{},g=e.$feature_flag_payloads||{},v=h||n?f:Array.from(new Set([...Object.keys(p),...Object.keys(g)])),b=!h&&!n,y=!!b||f,_=!!b||v,j={[gr]:y,[pi]:y,[ha]:_};e.$feature_flag_details&&(j[il]=y);for(const N of[rl,fa,uu])ue(e[N])||(j[N]=!0);this.Ad.markCrossTabFeatureFlagChanges(j)}Pt(e){this.Xd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.remove(e)})}Xd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}zd(){const e={};for(const i of[gr,ha,rl,Bi]){const a=this.Zd(i);ue(a)||(e[i]=a)}this.ud=e;const t=D({},e),n=this.Zd(pi);if(n)for(const[i,a]of Object.entries(n))t[`$feature/${i}`]=a;this.hd=t}qd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Zd(fa);return typeof t!="number"||Date.now()-t>e}tv(){return!!this.qd()&&(this.wd||this.gd||(this.wd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ev(){const e=this.Mr.evaluationContexts;return e!=null&&e.length?e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}iv(){const e=this.Mr.flagKeys;if(!ue(e))return e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),n})}initialize(){var e,t;const n=this.Mr,i=(e=(t=n.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var a,o;const u=(a=(o=n.bootstrap)===null||o===void 0?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},h=Object.keys(i).filter(p=>!ue(i[p])).reduce((p,g)=>(p[g]=i[g],p),{}),f=Object.keys(u).filter(p=>h[p]).reduce((p,g)=>(p[g]=u[g],p),{});return this.nv({featureFlags:h,featureFlagPayloads:f},void 0,{persist:!1})}}updateFlags(e,t,n){var i,a;const o=n!=null&&n.merge&&(i=this.Zd("$enabled_feature_flags"))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.Zd("$feature_flag_payloads"))!==null&&a!==void 0?a:{},h=D(D({},o),e),f=D(D({},u),t),p={};for(const[g,v]of Object.entries(h))p[g]={key:g,enabled:xw(v),variant:vw(v),reason:void 0,metadata:ue(f==null?void 0:f[g])?void 0:{id:0,version:void 0,description:void 0,payload:f[g]}};this.nv({flags:p})}get hasLoadedFlags(){return this.pd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Zd(il),t=this.Zd(Bi),n=this.Zd(tl);if(!n&&!t)return e||{};const i=$t({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(const h of a){var o,u;const f=i[h],p=t==null?void 0:t[h],g=ue(p)?(o=f==null?void 0:f.enabled)!==null&&o!==void 0&&o:!!p,v=ue(p)?f==null?void 0:f.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[h],y=D(D({},f),{},{enabled:g,variant:g?v??(f==null?void 0:f.variant):void 0});g!==(f==null?void 0:f.enabled)&&(y.original_enabled=f==null?void 0:f.enabled),v!==(f==null?void 0:f.variant)&&(y.original_variant=f==null?void 0:f.variant),b&&(y.metadata=D(D({},f==null?void 0:f.metadata),{},{payload:b,original_payload:f==null||(u=f.metadata)===null||u===void 0?void 0:u.payload})),i[h]=y}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.ld=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{const i=e[n];return{key:n,enabled:xw(i),variant:vw(i),payload:gw(t[n])}})}getFlagVariants(){const e=this.Zd(pi),t=this.Zd(Bi);if(!t)return e||{};const n=$t({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ld=!0),n}getFlagPayloads(){const e=this.Zd(ha),t=this.Zd(tl);if(!t)return e||{};const n=$t({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ld=!0),n}reloadFeatureFlags(){this.yd||this.Mr.featureFlagsDisabled||this.xd()||(this.gd&&(this.bd=!0),this.sv||(this.dd.slice().forEach(e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.sv=setTimeout(()=>{this.rv()},5)))}reloadFeatureFlagsAsync(){return!this.bo||this.yd||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.xd()?Promise.resolve({status:"skipped"}):new Promise(e=>{this.vd.add(e),this.reloadFeatureFlags()})}Gd(e,t){e.forEach(n=>n({status:t})),e.clear()}Qd(){clearTimeout(this.sv),this.sv=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.pd||this.gd||this.sv||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.yd=e}resetFlagCallReported(){this.Pt(da)}rv(e){var t;this.Qd();const n=this.bo;if(!n||this.Mr.remoteRequestsDisabled||this.xd())return void this.Gd(this.vd,"skipped");if(this.gd)return void(this.bd=!0);const i={token:n.projectToken,distinct_id:n.distinctId,groups:n.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:D(D(D({},n.initialPersonProperties),this.Zd("$stored_person_properties")||{}),{},{$lib:n.library.name,$lib_version:n.library.version}),group_properties:this.Zd(ca),timezone:rj()};ue(n.deviceId)||(i.$device_id=n.deviceId),(e!=null&&e.disableFlags||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const a=this.ev();a.length&&(i.evaluation_contexts=a);const o=this.iv();ue(o)||(i.flag_keys=o);const u=this.Mr.onlyEvaluateSurveyFeatureFlags,h="/flags/?v=2"+(u?"&only_evaluate_survey_feature_flags=true":""),f=this.md,p=this.vd;this.vd=new Set,this.fd=p,this.gd=!0;const g=()=>{this.bd&&(this.bd=!1,this.rv())},v=N=>{var S,C;const E=(S=N.json)!==null&&S!==void 0?S:{},R=N.statusCode!==200;if(this.gd=!1,f!==this.md)return void g();if(this.ov(N.statusCode),R||this.bd||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.bd)return void this.Gd(p,"skipped");this._d=!R;const A=[];N.error?A.push(N.error instanceof Error&&N.error.name==="AbortError"?"timeout":N.error instanceof Error?N5:"unknown_error"):N.statusCode!==200&&A.push(`api_error_${N.statusCode}`),E.errorsWhileComputingFlags&&A.push("errors_while_computing_flags");const O=!!(!((C=E.quotaLimited)===null||C===void 0)&&C.includes("feature_flags"));O&&A.push("quota_limited"),this.$t({[Nu]:A}),O?this.A.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."):i.disable_flags||this.nv(E,R,{partialResponse:u}),this.Gd(p,i.disable_flags?"skipped":A.length||!E.flags&&!E.featureFlags?"error":"loaded"),g()},b=N=>{this.gd=!1,f===this.md&&(this.$t({[Nu]:[N5]}),this.A.error("Feature flag request failed",N),this.Kd()&&this.Hd(!0),this.Gd(p,"error")),g()};let y=(t=this.Mr.requestMaxRetries)!==null&&t!==void 0?t:1;const _=()=>y>0&&f===this.md,j=()=>{if(f!==this.md||!this.bo||this.Mr.remoteRequestsDisabled)return this.gd=!1,this.Gd(p,"skipped"),void g();try{n.sendRequest(h,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(N=>{if((S=>_8.includes(S.statusCode)||(C=>C.statusCode===0&&C.error instanceof Error&&C.error.name==="AbortError")(S))(N)&&_())return y--,void setTimeout(j,500);v(N)}).catch(b)}catch(N){b(N)}};j()}xd(){return lj(this.kd,3)}ov(e){this.kd=oj(e,this.kd,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var n;if(t.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+Xg);if(this.tv())return;const i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+Xg);if(this.tv())return;const n=this.getFlagVariants(),i=e in n,a=n[e],o=this.getFlagPayloads()[e],u=String(a),h=this.Zd("$feature_flag_request_id")||void 0,f=this.Zd("$feature_flag_evaluated_at")||void 0;let p,g=this.Zd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var v;const Z=(v=this.bo)===null||v===void 0?void 0:v.session.sessionId,I=this.Zd(nu);Z&&Z!==I&&(g={},p=Z)}if(!t.send_event&&"send_event"in t)p&&this.$t({[da]:g,[nu]:p});else if(e in g&&g[e].includes(u))p&&this.$t({[da]:g,[nu]:p});else{var b,y,_,j,N,S,C,E,R,A,O,P,z;Ie(g[e])?g[e].push(u):g[e]=[u],this.$t(D({[da]:g},p?{[nu]:p}:{}));const Z=this.getFeatureFlagDetails(e),I=[...(b=this.Zd("$feature_flag_errors"))!==null&&b!==void 0?b:[]];ue(a)&&I.push("flag_missing");const q={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o??null,$feature_flag_request_id:h,$feature_flag_evaluated_at:f,$feature_flag_bootstrapped_response:(y=(_=this.Mr.bootstrap)===null||_===void 0||(_=_.featureFlags)===null||_===void 0?void 0:_[e])!==null&&y!==void 0?y:null,$feature_flag_bootstrapped_payload:(j=(N=this.Mr.bootstrap)===null||N===void 0||(N=N.featureFlagPayloads)===null||N===void 0?void 0:N[e])!==null&&j!==void 0?j:null,$used_bootstrap_value:!this._d};ue(Z==null||(S=Z.metadata)===null||S===void 0?void 0:S.has_experiment)||(q.$feature_flag_has_experiment=Z.metadata.has_experiment),ue(Z==null||(C=Z.metadata)===null||C===void 0?void 0:C.version)||(q.$feature_flag_version=Z.metadata.version);const L=(E=Z==null||(R=Z.reason)===null||R===void 0?void 0:R.description)!==null&&E!==void 0?E:Z==null||(A=Z.reason)===null||A===void 0?void 0:A.code;L&&(q.$feature_flag_reason=L),!(Z==null||(O=Z.metadata)===null||O===void 0)&&O.id&&(q.$feature_flag_id=Z.metadata.id),ue(Z==null?void 0:Z.original_variant)&&ue(Z==null?void 0:Z.original_enabled)||(q.$feature_flag_original_response=ue(Z.original_variant)?Z.original_enabled:Z.original_variant),!(Z==null||(P=Z.metadata)===null||P===void 0)&&P.original_payload&&(q.$feature_flag_original_payload=Z==null||(z=Z.metadata)===null||z===void 0?void 0:z.original_payload),I.length&&(q.$feature_flag_error=I.join(",")),this.av(q)}return i?{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:gw(o)}:void 0}av(e){try{var t;(t=this.bo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.lv(e,t)}lv(e,t){var n=this;return Pt(function*(){const i=n.bo;if(!i)return;const a={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},o=n.ev();o.length&&(a.evaluation_contexts=o);const u=n.iv();let h;ue(u)||(a.flag_keys=u);try{var f;const p=(f=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.Mr.compression,sentAt:"body",timeoutMs:n.Mr.requestTimeoutMs})).json)===null||f===void 0?void 0:f.featureFlagPayloads;h=(p==null?void 0:p[e])||void 0}catch(p){return void n.A.error("Remote config feature flag request failed",p)}try{t(h)}catch(p){n.A.error("Remote config feature flag callback failed",p)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._d)return t.defaultValue;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+Xg),t.defaultValue;const n=this.getFeatureFlag(e,t);return ue(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){this.nv(e,t,n)}nv(e,t,n){if(!this.bo)return;this.pd=!0;const i=((a,o={},u={},h={},f,p=k5)=>{const g=((E,R)=>{const A=E.flags;if(A){const O=Object.fromEntries(Object.keys(A).map(z=>{var Z;return[z,(Z=A[z].variant)!==null&&Z!==void 0?Z:A[z].enabled]})),P=Object.fromEntries(Object.keys(A).filter(z=>A[z].enabled).filter(z=>{var Z;return!ue((Z=A[z].metadata)===null||Z===void 0?void 0:Z.payload)}).map(z=>{var Z;return[z,(Z=A[z].metadata)===null||Z===void 0?void 0:Z.payload]}));return D(D({},E),{},{featureFlags:O,featureFlagPayloads:P})}return E.featureFlags&&R.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),E})(a,p),v=g.flags,b=g.featureFlags,y=g.featureFlagPayloads;if(!b)return;const _=a.requestId,j=a.evaluatedAt;if(Ie(b)){p.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const E={};if(b)for(let R=0;b.length>R;R++)E[b[R]]=!0;return{[gr]:b,[pi]:E,[uu]:!1}}let N=b,S=y,C=v;if(f!=null&&f.partialResponse){const E=Object.keys(N),R=S||{};N=D(D({},o),N),S=D(D({},u),R),E.forEach(A=>{A in R||S==null||delete S[A]}),C=D(D({},h),C)}else if(a.errorsWhileComputingFlags)if(v){const E=new Set(Object.keys(v).filter(A=>{var O;return!(!((O=v[A])===null||O===void 0)&&O.failed)}));N=D(D({},o),Object.fromEntries(Object.entries(N).filter(([A])=>E.has(A))));const R=Object.fromEntries(Object.entries(S||{}).filter(([A])=>E.has(A)));S=D(D({},u),R),E.forEach(A=>{A in R||S==null||delete S[A]}),C=D(D({},h),Object.fromEntries(Object.entries(C||{}).filter(([A])=>E.has(A))))}else N=D(D({},o),N),S=D(D({},u),S),C=D(D({},h),C);return D(D({[gr]:Object.keys(E5(N)),[pi]:N||{},[ha]:S||{},[il]:C||{},[uu]:a.minimalFlagCalledEvents===!0},_?{[rl]:_}:{}),j?{[fa]:j}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);if(i)if((n==null?void 0:n.persist)===!1){const a=!ue(this.bo.kv.get(pi));this.Jd=i,a||this.$t(i)}else this.Bd(),this.Yd(i,e,!!(n!=null&&n.partialResponse)),this.$t(i);else t&&this.Kd();t||(this.wd=!1),this.Hd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.uv(e)}uv(e){if(this.bo){if(e===!1)return this.Pt([Bi,tl]),this.Hd(),void Wa.info("All overrides cleared");if(Ie(e))return this.$t({[Bi]:C5(e)}),this.Hd(),void Wa.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const n=e;this.ld=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);const i={},a=n.flags,o=n.payloads;return a&&(i[Bi]=Ie(a)?C5(a):a),o&&(i[tl]=o),Object.keys(i).length&&this.$t(i),a===!1&&o===!1?this.Pt([Bi,tl]):a===!1?this.Pt(Bi):o===!1&&this.Pt(tl),this.Hd(),a===!1?Wa.info("Flag overrides cleared"):a&&Wa.info("Flag overrides set",{flags:a}),void(o===!1?Wa.info("Payload overrides cleared"):o&&Wa.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.$t({[Bi]:e}),this.Hd(),void Wa.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.pd){const{flags:t,flagVariants:n}=this.hv();try{e(t,n)}catch(i){this.A.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i;const a=(this.Zd("$early_access_features")||[]).find(p=>p.flagKey===e),o={[`$feature_enrollment/${e}`]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);const h=D(D({},this.getFlagVariants()),{},{[e]:t});(i=this.Ad)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(o)}),this.$t({[gr]:Object.keys(E5(h)),[pi]:h,[ua]:D(D({},this.Zd("$stored_person_properties")||{}),o)}),this.Hd();try{var f;(f=this.bo)===null||f===void 0||f.capture("$feature_enrollment_update",u)}catch(p){this.A.error("Failed to capture early access feature enrollment",p)}}getEarlyAccessFeatures(e,t=!1,n){const i=this.Zd(P0);!i||t?this.dv(e,n):e(i)}dv(e,t){var n=this;return Pt(function*(){const i=n.bo;if(!i)return;const a=t?`&${t.map(u=>`stage=${u}`).join("&")}`:"";let o;try{const u=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${a}`,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;o=u.json.earlyAccessFeatures,n.$t({[P0]:o})}catch(u){return void n.A.error("Early access feature request failed",u)}try{e(o)}catch(u){n.A.error("Early access feature callback failed",u)}})()}hv(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,i)=>(n[i]=t[i],n),{})}}Hd(e){this.zd();const{flags:t,flagVariants:n}=this.hv();this.featureFlagEventHandlers.forEach(i=>{try{i(t,n,{errorsLoading:e})}catch(a){this.A.error("Error while running feature flags callback",a)}})}setPersonPropertiesForFlags(e,t=!0){this.vv(e,t)}vv(e,t=!0){const n=this.Zd("$stored_person_properties")||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(const u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this.$t({[ua]:D(D(D({},n),o),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const n=D({},this.Zd("$stored_person_properties")||{});e.forEach(i=>{delete n[i]}),this.$t({[ua]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Pt(ua),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const n=this.Zd("$stored_group_properties")||{},i=D({},n);for(const a of Object.keys(e))i[a]=D(D({},n[a]),e[a]);this.$t({[ca]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Zd("$stored_group_properties")||{};this.$t({[ca]:D(D({},t),{},{[e]:{}})})}else this.Pt(ca)}reset(){this.md++,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bd=!1,this.ud={},this.hd={},this.Jd=void 0,this.pd=!1,this.yd=!1,this._d=!1,this.$anon_distinct_id=void 0,this.Qd(),this.ld=!1,this.kd=0}};const T5=Wt("[FeatureFlags]");var S8=class{constructor(e,t=!1){this.fv=!1,this.update(e,t)}update(e,t){this.pv=((n,i)=>{var a,o,u,h,f,p,g,v;return{bootstrap:{featureFlags:(a=(o=n.bootstrap)===null||o===void 0?void 0:o.featureFlags)!==null&&a!==void 0?a:void 0,featureFlagPayloads:(u=(h=n.bootstrap)===null||h===void 0?void 0:h.featureFlagPayloads)!==null&&u!==void 0?u:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!n.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!n.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!n.advanced_feature_flags_dedup_per_session,cacheTtlMs:n.feature_flag_cache_ttl_ms,refreshIntervalMs:(f=n.remote_config_refresh_interval_ms)!==null&&f!==void 0?f:3e5,idleRefreshBackoff:ue(n.remote_config_refresh_interval_ms),requestTimeoutMs:n.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(p=n.feature_flag_request_max_retries)!==null&&p!==void 0?p:1),compression:n.disable_compression?void 0:"best-available",evaluationContexts:(g=(v=n.evaluation_contexts)!==null&&v!==void 0?v:n.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:Ie(n.flag_keys)?n.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.fv||(T5.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fv=!0),ue(e.flag_keys)||Ie(e.flag_keys)||T5.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.pv}};const M5=e=>zo(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),hi=Wt("[Error tracking]"),sx="webkit-masked-url:",k8=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],j8=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",sx],N8=["__firefox__","__gCrWeb"],A5="Refusing to render web experiment since the viewer is a likely bot",C8={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>uf(t,e),not_regex:(e,t)=>!uf(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Ws=Wt("[Conversations]"),Za="Conversations not available yet.";function R5(e,t){var n,i,a,o,u,h,f;const p=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,g=(i=e==null?void 0:e.maxBufferSize)!==null&&i!==void 0?i:100,v=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,b=ue(v)?Math.max(g,2048):Math.max(g,v),y=D(D({},(function(){let _="",j="";try{const N=En==null?void 0:En.userAgent;N&&([_,j]=WS(N))}catch{}return(function(N,S){const C=(function(E){if(E)return{}.hasOwnProperty.call(kw,E)?kw[E]:E})(N);return D(D({},C?{"os.name":C}:{}),S?{"os.version":S}:{})})(_,j)})()),e==null?void 0:e.resourceAttributes);return{serviceName:(o=(u=y==null?void 0:y["service.name"])!==null&&u!==void 0?u:e==null?void 0:e.serviceName)!==null&&o!==void 0?o:t==null?void 0:t.serviceNameDefault,serviceVersion:(h=y==null?void 0:y["service.version"])!==null&&h!==void 0?h:e==null?void 0:e.serviceVersion,environment:(f=y==null?void 0:y["deployment.environment"])!==null&&f!==void 0?f:e==null?void 0:e.environment,resourceAttributes:y,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:p,maxBufferSize:g,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const E8=["debug","log","warn","error","info"],T8=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},O5="console",Hj="__posthogHandledLogsRequestError",Qg=(e,t)=>{const n=e instanceof Error?e:new Error(t);return n[Hj]=!0,n},L5=e=>!!e&&typeof e=="object"&&e[Hj]===!0,df=Wt("[NetworkMetrics]"),Qx=()=>{var e;return!(se==null||(e=se.performance)===null||e===void 0)&&e.now?se.performance.now():Date.now()},M8={"http:":80,"https:":443},A8=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),qj=(e,t)=>{var n;const i=String(t);return{method:String(e).toUpperCase(),url:((n=_r(i))===null||n===void 0?void 0:n.href)||i}},ix=(e,t,n,i,a,o,u=!1)=>{try{var h,f;const p=a();if(!p)return;const g=n||void 0,v=Qx()-i,b=_r(t.url);if(b&&b.protocol!=="http:"&&b.protocol!=="https:")return;const y={url:(b==null?void 0:b.href)||t.url,method:t.method},_=xn(p.name)?p.name(y):et(p.name)?p.name:"http.client.request.duration";if(!_)return;const j=u&&!g?void 0:((S,C)=>S?400>S?void 0:String(S):(C==null?void 0:C.name)||"_OTHER")(g,o),N=D(D(D(D(D({},(S=>{const C=A8.has(S)?S:"_OTHER";return D({"http.request.method":C},C==="_OTHER"&&S!==C?{"http.request.method_original":S}:{})})(y.method)),b?(S=>{return{"server.address":S.hostname.startsWith("[")&&S.hostname.endsWith("]")?S.hostname.slice(1,-1):S.hostname,"server.port":Number(S.port)||M8[S.protocol],"url.scheme":S.protocol.slice(0,-1),"url.template":(C=S.pathname,C.split("/").map(E=>(R=>/^\d+$/.test(R)||R.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(R))(E)?":id":E).join("/"))};var C})(b):{}),g?{"http.response.status_code":g}:{}),j?{"error.type":j}:{}),(h=p.attributes)===null||h===void 0?void 0:h.call(p,y,{status:g,durationMs:v}));(f=e.metrics)===null||f===void 0||f.histogram(_,v,{unit:"ms",attributes:N})}catch(p){df.error("Failed to record network metric",p)}},Vj=()=>{},R8=(e,t)=>xn(se==null?void 0:se.fetch)?Ro(se,"fetch",n=>function(...i){const a=Qx(),o=n.apply(this,i);if(!t())return o;try{var u,h,f;const[p,g]=i,v=qj((u=(h=g==null?void 0:g.method)!==null&&h!==void 0?h:p==null?void 0:p.method)!==null&&u!==void 0?u:"GET",(f=p==null?void 0:p.url)!==null&&f!==void 0?f:p);return o.then(b=>(ix(e,v,b==null?void 0:b.status,a,t,void 0,!0),b),b=>{throw ix(e,v,void 0,a,t,b),b})}catch(p){return df.error("Failed to observe fetch",p),o}}):Vj,O8=(e,t)=>{var n;const i=se==null||(n=se.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!i)return Vj;const a=new WeakMap,o=Ro(i,"open",h=>function(...f){try{Sj.has(this)||a.set(this,qj(f[0],f[1]))}catch(p){df.error("Failed to observe XHR open",p)}return h.apply(this,f)}),u=Ro(i,"send",h=>function(...f){let p;try{const g=a.get(this);if(g&&t()){const v=Qx();p=()=>{this.removeEventListener("loadend",p),ix(e,g,this.status,v,t)},gt(this,"loadend",p)}}catch(g){df.error("Failed to observe XHR send",g)}try{return h.apply(this,f)}catch(g){throw p&&this.removeEventListener("loadend",p),g}});return()=>{o(),u()}},D5=new WeakMap,L8={maxStringLength:2048,truncationSuffix:"..."};function z5(e){if(e)return e===!0?{intent:!0,model:!0}:{intent:e.intent!==!1,model:e.model!==!1}}function ra(e,t){return{}.hasOwnProperty.call(e,t)}function Wg(e,t){const n=Object.create(e);return t&&Object.defineProperty(n,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:t}),n}function $5(e,t,n=!1){if(!et(e))return;const i=e.trim();return i?(n?mM(i,L8):i).slice(0,t):void 0}function P5(e){try{return Ze(e)&&e.isError===!0}catch{return!1}}const jf={featureFlags:class extends w8{constructor(e){const t=new S8(e.config,e.il());super(t),this.name="featureFlags",this._instance=e,this.gv=t}get Ad(){return this._instance.persistence}updateConfig(e,t){this.gv.update(e,t),this.Fd()}}},D8={sessionRecording:class{get Mr(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var e;return!!(!((e=this.mv)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.yv==="awaiting_config"||this.yv==="missing_config"?this.yv:(e=(t=this.mv)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.yv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.yv=Vg,this.bv=void 0,this._v=!1,this.Je=(()=>{var t,n;if(!(ge!=null&&ge.visibilityState)||ge.visibilityState==="visible")return!0;const i=se==null||(t=se.performance)===null||t===void 0||(n=t.getEntriesByType)===null||n===void 0?void 0:n.call(t,"visibility-state");return!(i!=null&&i.length)||i.some(a=>a.name==="visible")})(),this.sn=()=>{var t,n;(ge==null?void 0:ge.visibilityState)==="visible"&&(this.Je=!0,(t=this.mv)===null||t===void 0||(n=t.setDocumentWasEverVisible)===null||n===void 0||n.call(t,!0))},!this._instance.sessionManager)throw dr.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');ge!=null&&ge.addEventListener&>(ge,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._v=!0,ge==null||(t=ge.removeEventListener)===null||t===void 0||t.call(ge,"visibilitychange",this.sn),e?this.wv(!0):this.stopRecording()}get Sv(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),n=!this.Mr.disable_session_recording,i=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return se&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(this._v||this.Sv&&(!((t=this.mv)===null||t===void 0)&&t.isStarted))return;const n=!ue(Object.assign)&&!ue(Array.from);this.Sv&&n?(this.xv(e),dr.info("starting")):(this.yv=Vg,this.stopRecording())}xv(e){var t,n;if(this.Sv)if(this.yv!=="awaiting_config"&&this.yv!=="missing_config"&&(this.yv=b5),($e==null||(t=$e.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((n=$e.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.$v(e);else{var i,a;const o=this._instance.sessionManager;(i=$e.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this._instance,this.Cv,u=>{if(!this._v&&this.Sv&&this._instance.sessionManager===o)return u?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),dr.error("could not load recorder",u)):void this.$v(e);this.yv="disabled"})}}stopRecording(){var e,t;(e=this.bv)===null||e===void 0||e.call(this),this.bv=void 0,(t=this.mv)===null||t===void 0||t.stop()}wv(e=!1){var t,n;(t=this.bv)===null||t===void 0||t.call(this),this.bv=void 0,(n=this.mv)===null||n===void 0||n.discard({discardProducerEvents:e})}Tv(){var e,t;(e=this.Il)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Il)===null||t===void 0||t.unregister("$replay_sample_rate")}Iv(e,t){if(qe(e))return null;const n=sn(e)?e:parseFloat(e);return typeof(i=n)!="number"||!Number.isFinite(i)||0>i||i>1?(dr.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var i}Mv(e){if(this.Il){var t,n;const i=this.Il,a=()=>{var o;const u=e.sessionRecording===!1?void 0:e.sessionRecording,h=this.Iv((o=this.Mr.session_recording)===null||o===void 0?void 0:o.sampleRate,"session_recording.sampleRate"),f=this.Iv(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=h??f;qe(p)&&this.Tv();const g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[hu]:D(D({cache_timestamp:Date.now(),enabled:!!u},u),{},{networkPayloadCapture:D({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:ue(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};a(),(t=this.bv)===null||t===void 0||t.call(this),this.bv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(a)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Mv(t),void this.wv()):(this.Mv(t),void this.startIfEnabledOrStop()):(this.yv==="awaiting_config"&&(this.yv="missing_config",this._instance.register_for_session({[Px]:!0}),dr.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var n;!((n=this.mv)===null||n===void 0)&&n.log?this.mv.log(e,t):dr.warn("log called before recorder was ready")}get Cv(){var e,t;const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(hu);return(n==null||(t=n.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}Ev(){const e=this._instance.get_property(hu);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return dr.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!qe(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}$v(e){var t,n,i;if(!this._v&&this.Sv&&this._instance.sessionManager){if(!(!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return dr.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[$x]:!0});var a;if(this.mv||(this.mv=(a=$e.__PosthogExtensions__)===null||a===void 0?void 0:a.initSessionRecording(this._instance,this.Je),this.mv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ev())return this.yv==="missing_config"||this.yv==="awaiting_config"?void 0:(this.yv="awaiting_config",dr.info("persisted remote config is stale, requesting fresh config before starting"),void new xj(this._instance).load());this.yv=b5,(n=(i=this.mv).setDocumentWasEverVisible)===null||n===void 0||n.call(i,this.Je),this.mv.start(e)}else this.yv=Vg}onRRwebEmit(e){var t,n;(t=this.mv)===null||t===void 0||(n=t.onRRwebEmit)===null||n===void 0||n.call(t,e)}overrideLinkedFlag(){var e,t;this.mv||(t=this.Il)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.mv)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.mv||(t=this.Il)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.mv)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,n;this.mv||(n=this.Il)===null||n===void 0||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.mv)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const i of d8){var n;const a=(n=this._instance.sessionPersistence)===null||n===void 0?void 0:n.get_property(i);ue(a)||(t[i]=a)}return D(D({},t),((e=this.mv)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var n;return!!(!((n=this.mv)===null||n===void 0)&&n.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.mv)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},z8={autocapture:class extends a8{constructor(e){super(new l8(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.Pv=!1,this._instance=e,this.Rv=this.Av()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.Fv();return!!(e.path||e.search||this.Ov(e))}startIfEnabled(){this.isEnabled&&(_e.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Rv=this.Av(),this.startIfEnabled()}stop(){this.Dv&&this.Dv(),this.Dv=void 0,this.Lv&&this.Lv(),this.Lv=void 0,_e.info("History API monitoring stopped")}monitorHistoryChanges(){se&&se.history&&(this.Nv("pushState"),this.Nv("replaceState"),this.qv(),this.Ov()&&this.jv())}Nv(e){var t;if(!se||!((t=se.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const n=this;Ro(se.history,e,i=>function(a,o,u){var h;n.Bv(u)&&n.zv(),i.call(this,a,o,u),n.Hv(e,!n.Pv&&(se==null||(h=se.event)===null||h===void 0?void 0:h.type)!=="popstate")})}Av(){const e=se==null?void 0:se.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Fv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:Ze(e)?e:{}}Ov(e=this.Fv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Uv(e){const t=this.Fv(),n=this.Rv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.Ov(t)&&e.hash!==n.hash))}Hv(e,t=!1){try{t||this.zv();const n=this.Av();if(!n)return;if(this.Uv(n)){const i=()=>this._instance.capture(Fx,{navigation_type:e});t?(this.Wv=i,Promise.resolve().then(()=>this.zv())):i()}this.Rv=n}catch(n){_e.error(`Error capturing ${e} pageview`,n)}}Bv(e){var t,n;return!(qe(e)||!se)&&((t=_r(String(e)))===null||t===void 0?void 0:t.href)!==((n=se.location)===null||n===void 0?void 0:n.href)}zv(){const e=this.Wv;if(e){this.Wv=void 0,this.Pv=!0;try{e()}catch(t){_e.error("Error capturing deferred pageview",t)}finally{this.Pv=!1}this.Rv=this.Av()}}qv(){if(this.Dv)return;const e=()=>{this.Hv("popstate")};gt(se,"popstate",e),this.Dv=()=>{se&&se.removeEventListener("popstate",e)}}jv(){if(this.Lv)return;const e=()=>{this.Hv("hashchange")};gt(se,"hashchange",e),this.Lv=()=>{se&&se.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.Vv=!1,this.ko=!1,this.Gv=null,this.instance=e,this.Vv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[F0]),this.rageclicks=new Ij(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return Ze(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return qe(this.Mr.capture_heatmaps)?qe(this.Mr.enable_heatmaps)?this.Vv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;h8.info("starting..."),this.Qv(),this.sn()}else{var e;clearInterval((e=this.Gv)!==null&&e!==void 0?e:void 0),this.Zv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[F0]:n}),this.Vv=n,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Jv(e){Gg(e.originalEvent)&&this.Ir(e.originalEvent,"deadclick")}sn(){this.Gv&&clearInterval(this.Gv),this.Gv=(ge==null?void 0:ge.visibilityState)==="visible"?setInterval(this.fl.bind(this),this.flushIntervalMilliseconds):null}Qv(){se&&ge&&(this.Kv=this.fl.bind(this),gt(se,sf,this.Kv),this.Xv=e=>this.Ir(e||(se==null?void 0:se.event)),gt(ge,"click",this.Xv,{capture:!0}),this.Yv=e=>this.tf(e||(se==null?void 0:se.event)),gt(ge,"mousemove",this.Yv,{capture:!0}),this.ef=new Gw(this.instance,hA,this.Jv.bind(this)),this.ef.startIfEnabledOrStop(),this.if=this.sn.bind(this),gt(ge,Cu,this.if),this.ko=!0)}Zv(){var e;se&&ge&&(this.Kv&&se.removeEventListener(sf,this.Kv),this.Xv&&ge.removeEventListener("click",this.Xv,{capture:!0}),this.Yv&&ge.removeEventListener("mousemove",this.Yv,{capture:!0}),this.if&&ge.removeEventListener(Cu,this.if),clearTimeout(this.nf),(e=this.ef)===null||e===void 0||e.stop(),this.ko=!1)}sf(e,t){const n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,h,f){let p=u;for(;p&&bi(p)&&!qn(p,"body");){if(p===f)return!1;let y;try{var g,v,b;y=(g=(v=(b=p.ownerDocument)===null||b===void 0?void 0:b.defaultView)!==null&&v!==void 0?v:se)===null||g===void 0?void 0:g.getComputedStyle(p).position}catch{return!1}if(Fe(h,y))return!0;p=Kk(p)}return!1})(pu(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Ir(e,t="click"){var n;if(Dw(e.target)||!Gg(e))return;const i=this.sf(e,t);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ej(pu(e),this.instance.config.rageclick)&&this.Qs(D(D({},i),{},{type:"rageclick"})),this.Qs(i)}tf(e){!Dw(e.target)&&Gg(e)&&(clearTimeout(this.nf),this.nf=setTimeout(()=>{this.Qs(this.sf(e,"mousemove"))},500))}Qs(e){if(!se)return;const t=this.Mr.disable_capture_url_hashes?ma(se.location.href):se.location.href,n=this.Mr.custom_personal_data_properties,i=this.Mr.mask_personal_data_properties?[...Mo,...n||[]]:[],a=Tu(t,i,Mu);this.Rt=this.Rt||{},this.Rt[a]||(this.Rt[a]=[]),this.Rt[a].push(e)}fl(){this.Rt&&!_s(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Gw,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Vv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rf=()=>{clearTimeout(this.af),this.af=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",D({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,i)=>D(D({},n),{},{[`$web_vitals_${i.name}_event`]:D({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.lf=n=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},qe(n==null?void 0:n.name)||qe(n==null?void 0:n.value))return void Qa.error("Invalid metric received",n);const a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.uf(a);if(ue(o))return;const u=sn(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${o}`;if(this.cf&&n.value>=this.cf)return void Qa.error("Ignoring metric with value >= "+this.cf,n);this.Rt.navigationKey!==u&&(this.rf(),this.af=setTimeout(this.rf,this.flushToCaptureTimeoutMs)),ue(this.Rt.navigationKey)&&(this.Rt.navigationKey=u,this.Rt.url=o),this.Rt.firstMetricTimestamp=ue(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const h=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),f=D(D(D({},n),a?{navigationURL:o}:{}),{},{$current_url:o,timestamp:Date.now()});if(delete f.entries,Ze(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const p={};for(const g of u8){const v=g==="url"&&typeof n.attribution[g]=="string"?this.uf(n.attribution[g]):n.attribution[g];ue(v)||(p[g]=v)}f.attribution=p}else delete f.attribution;ue(h)||(f.$session_id=h.sessionId,f.$window_id=h.windowId),this.Rt.metrics.push(f),this.Rt.metrics.length===this.allowedMetrics.length&&this.rf()},this.hf=()=>{if(this.ko)return;let n,i,a,o,u=!1;const h=$e.__PosthogExtensions__,f=h==null?void 0:h.postHogWebVitalsCallbacksByFlavor,p=(f==null?void 0:f[this.df])||(this.df==="web-vitals"&&ue(f)?h==null?void 0:h.postHogWebVitalsCallbacks:void 0);if(!ue(p)){const b=p.withoutAttribution,y=this.attributionMetrics;u=!ue(b),n=y.indexOf("LCP")>-1?p.onLCP:(b==null?void 0:b.onLCP)||p.onLCP,i=y.indexOf("CLS")>-1?p.onCLS:(b==null?void 0:b.onCLS)||p.onCLS,a=y.indexOf("FCP")>-1?p.onFCP:(b==null?void 0:b.onFCP)||p.onFCP,o=y.indexOf("INP")>-1?p.onINP:(b==null?void 0:b.onINP)||p.onINP}if(!(n&&i&&a&&o))return void Qa.error("web vitals callbacks not loaded - not starting");const g={reportSoftNavs:this.useSoftNavs},v=u&&this.attributionMetrics.indexOf("INP")>-1?D(D({},g),{},{includeProcessedEventEntries:!1}):g;this.allowedMetrics.indexOf("LCP")>-1&&n(this.lf.bind(this),g),this.allowedMetrics.indexOf("CLS")>-1&&i(this.lf.bind(this),g),this.allowedMetrics.indexOf("FCP")>-1&&a(this.lf.bind(this),g),this.allowedMetrics.indexOf("INP")>-1&&o(this.lf.bind(this),v),this.ko=!0},this.Vv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[H0]),this.startIfEnabled()}get vf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const n=Ze(this.vf)?(e=this.vf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return qe(n)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||v5:n}get flushToCaptureTimeoutMs(){return(Ze(this.vf)?this.vf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=Ze(this.vf)?this.vf.web_vitals_attribution:void 0;return cs(e)?e?v5:[]:Ie(e)?e:c8}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=Ze(this.vf)?this.vf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get cf(){const e=Ze(this.vf)&&sn(this.vf.__web_vitals_max_value)?this.vf.__web_vitals_max_value:x5;return e>0&&6e4>=e?x5:e}get isEnabled(){const e=zt==null?void 0:zt.protocol;if(e!=="http:"&&e!=="https:")return Qa.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=Ze(this.vf)?this.vf.web_vitals:cs(this.vf)?this.vf:void 0;return cs(t)?t:this.Vv}startIfEnabled(){this.isEnabled&&!this.ko&&(Qa.info("enabled, starting..."),this.zo(this.hf))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const n=Ze(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Ze(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[H0]:n}),this._instance.persistence.register({[Nk]:i})),this.Vv=n,this.startIfEnabled()}get df(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(e){var t;const n=$e.__PosthogExtensions__,i=this.df,a=n==null?void 0:n.postHogWebVitalsCallbacksByFlavor;a!=null&&a[i]||i==="web-vitals"&&ue(a)&&(n!=null&&n.postHogWebVitalsCallbacks)?e():n==null||(t=n.loadExternalDependency)===null||t===void 0||t.call(n,this._instance,i,o=>{o?Qa.error("failed to load script",o):e()})}uf(e){const t=e||(se==null?void 0:se.location.href);if(!t)return void Qa.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?ma(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...Mo,...i||[]]:[];return Tu(n,a,Mu)}}},$8={exceptionObserver:class{constructor(e){var t;this.hf=()=>{var n;if(!se||!this.isEnabled||!(!((n=$e.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const i=$e.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$e.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=$e.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ff&&this.Mr.capture_unhandled_errors&&(this.ff=i(this.captureException.bind(this))),!this.pf&&this.Mr.capture_unhandled_rejections&&(this.pf=a(this.captureException.bind(this))),!this.gf&&this.Mr.capture_console_errors&&(this.gf=o(this.captureException.bind(this)))}catch(u){Wc.error("failed to start",u),this.mf()}},this._instance=e,this.yf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[I0]),this.wt=new i6(D(D({},(function(n={}){var i,a,o,u;return{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Wc})),this.Mr=this.bf(),this.startIfEnabledOrStop()}bf(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ze(e)?t=D(D({},t),e):(ue(e)?this.yf:e)&&(t=D(D({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Wc.info("enabled"),this.mf(),this.zo(this.hf)):this.mf()}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"exception-autocapture",a=>{if(a)return Wc.error("failed to load script",a);e()})}mf(){var e,t,n;(e=this.ff)===null||e===void 0||e.call(this),this.ff=void 0,(t=this.pf)===null||t===void 0||t.call(this),this.pf=void 0,(n=this.gf)===null||n===void 0||n.call(this),this.gf=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.yf=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[I0]:this.yf}),this.Mr=this.bf(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.bf()}captureException(e){try{var t,n,i;const a=(t=e==null||(n=e.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(a))return void Wc.info("Skipping exception capture because of client rate limiting.",{exception:a});(i=this._instance.exceptions)===null||i===void 0||i.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,n;this._f=[],this.wf=new g6([new A6,new F6,new O6,new R6,new P6,new $6,new D6,new B6],(function(i,...a){return(o,u=0)=>{const h=[],f=o.split(`
|
|
68
|
+
`),p=Math.min(f.length,u+1e3),g=[];for(let y=u;p>y;y++){const _=f[y];if(_.length>1024)continue;const j=mw.test(_)?_.replace(mw,"$1"):_;if(!j.match(/\S*Error: /)){for(const N of a){const S=N(j,i);if(S){h.push(S);const C=C6(h);if(C){for(let E=g.length-1;E>=0;E--){const R=g[E];if(C.start>=R.start+R.length)break;g.pop()}g.push(C)}break}}if(T6(h,g)>=50)break}}const v=[...g].sort((y,_)=>_.start-y.start),b=v[v.length-1];if(b){const y=ik(h,b);h.splice(b.start-y,y);for(const _ of v)_.start-=y}for(const y of v)E6(h,y);return g.some(y=>y.start===0&&h.length===y.length)&&(function(y){const _=y.map(N=>`${N.function}|${N.filename}|${N.lineno}|${N.colno}|${N.module}`);let j=0;for(let N=1;_.length>N;N++)M6(_,N,j)&&(j=N);y.push(...y.splice(0,j))})(h),(function(y){if(!y.length)return[];const _=Array.from(y);return _.reverse(),_.slice(0,50).map(j=>{return D(D({},j),{},{filename:j.filename||(N=_,N[N.length-1]||{}).filename,function:j.function||"?"});var N})})(h)}})("web:javascript",S6,N6)),this._instance=e,this._f=(t=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.kf=Kh(this.Sf()),this.xf=new U6(this.kf)}onConfigChange(){this.kf=Kh(this.Sf()),this.xf.setConfig(this.kf)}onRemoteConfig(e){var t,n,i;if(!e.ok)return;const a=e.config;if(!("errorTracking"in a))return;const o=(t=(n=a.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)===null||i===void 0?void 0:i.captureExtensionExceptions;this._f=o,this._instance.persistence&&this._instance.persistence.register({[kk]:this._f,[U0]:u})}get $f(){var e;const t=!!this._instance.get_property(U0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.wf.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.kf.enabled)try{if(!et(e)||e.trim().length===0)return void hi.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:n,droppedKeys:i}=(function(a){if(!a)return{sanitizedProperties:{},droppedKeys:[]};const o=[];return{sanitizedProperties:Object.keys(a).reduce((u,h)=>I6.has(h)?(o.push(h),u):(u[h]=a[h],u),{}),droppedKeys:o}})(this.Cf(t));i.length>0&&hi.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.xf.add(D({[Wh]:e,[Zh]:new Date().toISOString()},n))}catch(n){hi.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.Tf(t)){if(this.If(t))return this.Mf("Exception dropped: matched a suppression rule"),void hi.info("Skipping exception capture because a suppression rule matched");if(!this.$f&&this.Ef(t))return this.Mf("Exception dropped: thrown by a browser extension"),void hi.info("Skipping exception capture because it was thrown by an extension");if(!this.$f&&this.Pf(t))return this.Mf("Exception dropped: thrown by an injected browser script"),void hi.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Rf(t))return this.Mf("Exception dropped: thrown by the PostHog SDK"),void hi.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.kf.enabled&&qe(e.$exception_steps)?this.Af(e):e,i=(function(){const a=globalThis._posthogReleaseId;return typeof a=="string"&&a.length>0?a:void 0})();i&&(n.$release_id=i);try{const a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fc:!0});return a&&this.xf.clear(),a}catch(a){return M5(a)||hi.error("Failed to capture exception event. Dropping this exception.",a),void this.xf.clear()}}catch(t){return void(M5(t)||hi.error("Failed to process exception event. Ignoring this exception.",t))}}Af(e){try{const t=this.xf.getAttachable();return t.length===0?e:D(D({},e),{},{$exception_steps:t})}catch(t){return hi.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Mf(e){this.kf.enabled&&this.xf.add({[Wh]:e,[Zh]:new Date().toISOString()})}Cf(e){return Ze(e)?D({},e):{}}Sf(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}If(e){if(e.length===0)return!1;try{const t=e.reduce((n,{type:i,value:a})=>(et(i)&&i.length>0&&n.$exception_types.push(i),et(a)&&a.length>0&&n.$exception_values.push(a),n),{$exception_types:[],$exception_values:[]});return this._f.some(n=>{const i=n.values.map(a=>{const o=$j[a.operator],u=t[a.key];if(!o||!u)return!1;const h=Ie(a.value)?a.value:[a.value];return h.length>0&&o(h,u)});return n.type==="OR"?i.some(Boolean):i.every(Boolean)})}catch(t){return hi.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Ef(e){const t=e.flatMap(i=>{var a,o;return(a=(o=i.stacktrace)===null||o===void 0?void 0:o.frames)!==null&&a!==void 0?a:[]}),n=t.filter(({filename:i})=>!!i&&j8.some(a=>i.startsWith(a)));return n.length!==0&&(!n.every(({filename:i})=>!!i&&i.startsWith(sx))||e.some(({type:i,value:a})=>i==="NoResponse"||et(a)&&k8.some(({value:o,exact:u})=>u?a===o:a.includes(o)))&&!t.some(({in_app:i,filename:a})=>i&&!(a!=null&&a.startsWith(sx))))}Pf(e){return e.some(({value:t})=>et(t)&&N8.some(n=>t.includes(n)))}Rf(e){if(e.length>0){var t,n,i,a;const o=(t=(n=e[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(i=u==null||(a=u.filename)===null||a===void 0?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Tf(e){return!qe(e)&&Ie(e)}}},P8=D({productTours:class{get Il(){return this._instance.persistence}constructor(e){this.Ff=null,this.Of=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var n,i;if(this.Il&&this.Il.register({[Dx]:!!t.productTours}),!Yg(this._instance))return!this.Ff&&qe((n=this.Il)===null||n===void 0?void 0:n.props.ph_product_tours)||yh.info("product tours disabled; stopping and clearing cached tours"),(i=this.Ff)===null||i===void 0||i.stop(),this.Ff=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ff&&Yg(this._instance)&&this.zo(()=>this.Df())}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"product-tours",a=>{a?yh.error("Could not load product tours script",a):e()})}Df(){var e;!this.Ff&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.Ff=$e.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Ie(this.Of)&&!t)return void e(this.Of,{isLoaded:!0});const n=this.Il;if(n){const i=n.props[q0];if(Ie(i)&&!t)return this.Of=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!Yg(this._instance))return void e([],{isLoaded:!0});const a=i.statusCode;if(a!==200||!i.json){const u=`Product Tours API could not be loaded, status: ${a}`;return a===0?i.error||yh.warn(u):yh.error(u),void e([],{isLoaded:!1,error:u})}const o=Ie(i.json.product_tours)?i.json.product_tours:[];this.Of=o,n&&n.register({[q0]:o}),e(o,{isLoaded:!0})}})}getActiveProductTours(e){qe(this.Ff)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ff.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ff)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Ff?this.Ff.previewTour(e):this.zo(()=>{var t;this.Df(),(t=this.Ff)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Ff)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ff)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Ff)===null||e===void 0||e.previousStep()}clearCache(){var e;this.Of=null,(e=this.Il)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Ff)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Ff)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ff)===null||t===void 0||t.cancelPendingTour(e)}}},jf),B8={siteApps:class{constructor(e){this._instance=e,this.Lf=0,this.Nf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qf(e,t){if(!t)return;const n=this.globalsForEvent(t);this.Nf.push(n),this.Nf.length>1e3&&(this.Nf=this.Nf.slice(10))}get siteAppLoaders(){var e;return(e=$e._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.qf.bind(this));this.jf=()=>{e(),this.Nf=[],this.jf=void 0}}}globalsForEvent(e){var t,n,i,a,o,u,h;if(!e)throw new Error("Event payload is required");const f={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(const[y,_]of Object.entries(g))f[y]={id:p[y],type:y,properties:_};const{$set_once:v,$set:b}=e;return{event:D(D({},ok(e,f8)),{},{properties:D(D(D({},e.properties),b?{$set:D(D({},(t=(n=e.properties)===null||n===void 0?void 0:n.$set)!==null&&t!==void 0?t:{}),b)}:{}),v?{$set_once:D(D({},(i=(a=e.properties)===null||a===void 0?void 0:a.$set_once)!==null&&i!==void 0?i:{}),v)}:{}),elements_chain:(o=(u=e.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(h=e.properties)===null||h===void 0?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:f}}Bf(e){var t;const n=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||($i.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||($i.error("prepare_external_dependency_script returned null"),null):e}zf(){var e,t,n,i,a,o,u,h;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const f=ge==null?void 0:ge.defaultView,p=f==null||(e=f.Node)===null||e===void 0?void 0:e.prototype;if(!f||!p)return()=>{};if(this.Lf++,this.Hf)return this.Uf();const g=[],v=this,b=new WeakSet,y=(N,S,C)=>{if(!(N!=null&&N[S]))return;const E=N[S];N[S]=C(E),g.push(()=>{N[S]=E})},_=N=>{if(b.has(N))return N;const S=v.Bf(N);return S&&b.add(S),S},j=N=>N.map(S=>typeof S=="string"?S:_(S)).filter(S=>!Xt(S));return y(p,"appendChild",N=>function(S){const C=_(S);return C?N.call(this,C):S}),y(p,"insertBefore",N=>function(S,C){const E=_(S);return E?N.call(this,E,C):S}),y(p,"replaceChild",N=>function(S,C){const E=_(S);return E?N.call(this,E,C):C}),[(t=f.Element)===null||t===void 0?void 0:t.prototype,(n=f.Document)===null||n===void 0?void 0:n.prototype,(i=f.DocumentFragment)===null||i===void 0?void 0:i.prototype].forEach(N=>{y(N,"append",S=>function(...C){return S.apply(this,j(C))}),y(N,"prepend",S=>function(...C){return S.apply(this,j(C))})}),[(a=f.Element)===null||a===void 0?void 0:a.prototype,(o=f.CharacterData)===null||o===void 0?void 0:o.prototype,(u=f.DocumentType)===null||u===void 0?void 0:u.prototype].forEach(N=>{y(N,"before",S=>function(...C){return S.apply(this,j(C))}),y(N,"after",S=>function(...C){return S.apply(this,j(C))}),y(N,"replaceWith",S=>function(...C){const E=j(C);return C.length&&!E.length?void 0:S.apply(this,E)})}),y((h=f.Element)===null||h===void 0?void 0:h.prototype,"insertAdjacentElement",N=>function(S,C){const E=_(C);return E?N.call(this,S,E):null}),this.Hf=()=>{g.forEach(N=>N()),this.Hf=void 0},this.Uf()}Uf(){let e=!1;return()=>{var t;e||(e=!0,this.Lf--,this.Lf===0&&((t=this.Hf)===null||t===void 0||t.call(this)))}}Wf(e,t=!0){const n=this.zf();try{const i=e(n);return t&&n(),i}catch(i){throw n(),i}}setupSiteApp(e){const t=this.apps[e.id],n=()=>{var o;!t.errored&&this.Nf.length&&($i.info(`Processing ${this.Nf.length} events for site app with id ${e.id}`),this.Nf.forEach(u=>this.Wf(()=>{var h;return(h=t.processEvent)===null||h===void 0?void 0:h.call(t,u)})),t.processedBuffer=!0),Object.values(this.apps).every(u=>u.processedBuffer||u.errored)&&((o=this.jf)===null||o===void 0||o.call(this))};let i=!1;const a=o=>{t.errored=!o,t.loaded=!0,$i.info(`Site app with id ${e.id} ${o?"loaded":"errored"}`),i&&n()};try{const{processEvent:o}=this.Wf(u=>e.init({posthog:this._instance,callback(h){u(),a(h)}}),!1);o&&(t.processEvent=o),i=!0}catch(o){$i.error(y5+e.id,o),a(!1)}if(i&&t.loaded)try{n()}catch(o){$i.error(`Error while processing buffered events PostHog app with config id ${e.id}`,o),t.errored=!0}}Vf(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}Gf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const n of Object.values(this.apps))try{this.Wf(()=>{var i;return(i=n.processEvent)===null||i===void 0?void 0:i.call(n,t)})}catch(i){$i.error(`Error while processing event ${e.event} for site app ${n.id}`,i)}}onRemoteConfig(e){var t,n,i;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Vf(),void this._instance.on("eventCaptured",h=>this.Gf(h))):void $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.jf)===null||n===void 0||n.call(this),!e.ok)return;const a=e.config;if(!((i=a.siteApps)===null||i===void 0)&&i.length)if(this.isEnabled)for(const{id:h,url:f}of a.siteApps){var o,u;$e[`__$$ph_site_app_${h}`]=this._instance,(o=$e.__PosthogExtensions__)===null||o===void 0||(u=o.loadSiteApp)===null||u===void 0||u.call(o,this._instance,f,p=>{if(p)return $i.error(y5+h,p)})}else $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},F8={tracingHeaders:class{constructor(e){this._instance=e,this.Qf=void 0,this.Zf=void 0,this.Jf=void 0,this.hf=()=>{const t=this.Kf();var n,i;t?(ue(this.Qf)&&(this.Qf=(n=$e.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),ue(this.Zf)&&(this.Zf=(i=$e.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.mf()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"tracing-headers",a=>{if(a)return o8.error("failed to load script",a);e()})}Xf(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Kf(){const e=this.Xf();return Ie(e)?(Ie(this.Jf)?this.Jf.splice(0,this.Jf.length,...e):this.Jf=[...e],e.length>0?this.Jf:void 0):(Ie(this.Jf)&&this.Jf.splice(0),this.Jf=e||void 0,this.Jf)}mf(){var e,t;(e=this.Qf)===null||e===void 0||e.call(this),(t=this.Zf)===null||t===void 0||t.call(this),this.Qf=void 0,this.Zf=void 0}startIfEnabledOrStop(){this.Kf()?this.zo(this.hf):this.mf()}}},I8=D({surveys:class extends p8{constructor(e){var t;super(new b8(e),(t=e,{get projectToken(){return t.config.token},kv:new v8(t)})),this._instance=e}Gc(e,t){const n=t.query?Du(e,t.query):e;return new Promise(i=>{var a;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((a=t.target)!==null&&a!==void 0?a:"api",n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:i})})}}},jf),U8={toolbar:class{constructor(e){this.instance=e}Yf(e){$e.ph_toolbar_state=e}tp(){var e;return(e=$e.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,n=void 0){var i,a;if(G0(this.instance.config)||!se||!ge)return!1;e=(i=e)!==null&&i!==void 0?i:se.location,n=(a=n)!==null&&a!==void 0?a:se.history;try{if(!t){try{se.localStorage.setItem("test","test"),se.localStorage.removeItem("test")}catch{return!1}t=se==null?void 0:se.localStorage}const o=y8||af(e.hash,"__posthog")||af(e.hash,"state");let u;const h=o?dw(()=>JSON.parse(atob(decodeURIComponent(o))))||dw(()=>JSON.parse(decodeURIComponent(o))):null;return h&&h.action==="ph_authorize"?(u=h,u.source="url",u&&Object.keys(u).length>0&&(h.desiredHash?e.hash=h.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):(u=JSON.parse(t.getItem(w5)||"{}"),u.source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token||(this.loadToolbar(u),0))}catch{return!1}}ep(e){const t=$e.ph_load_toolbar||$e.ph_load_editor;!qe(t)&&xn(t)?t(e,this.instance):S5.warn("No toolbar load function found")}loadToolbar(e){const t=!!(ge!=null&&ge.getElementById("__POSTHOG_TOOLBAR__"));if(!se||t)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=D(D({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(se.localStorage.setItem(w5,JSON.stringify(D(D({},i),{},{source:void 0}))),this.tp()===2)this.ep(i);else if(this.tp()===0){var a,o;this.Yf(1),(a=$e.__PosthogExtensions__)===null||a===void 0||(o=a.loadExternalDependency)===null||o===void 0||o.call(a,this.instance,"toolbar",u=>{if(u)return S5.error("[Toolbar] Failed to load",u),void this.Yf(0);this.Yf(2),this.ep(i)}),gt(se,"turbolinks:load",()=>{this.Yf(0),this.loadToolbar(i)})}return!0}np(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},H8=D({experiments:class as{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(i=>{as.sp("retrieved web experiments from the server"),this.rp=new Map,i.forEach(a=>{if(a.feature_flag_key){var o;this.rp&&(as.sp("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=this.rp)===null||o===void 0||o.set(a.feature_flag_key,a));const u=this._instance.getFeatureFlag(a.feature_flag_key);et(u)&&a.variants[u]&&this.op(a.name,u,a.variants[u].transforms)}else if(a.variants)for(const u in a.variants){const h=a.variants[u];as.ap(h,this._instance)&&this.op(a.name,u,h.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(t){if(this._is_bot())as.sp(A5);else if(!this.Mr.disable_web_experiments){if(qe(this.rp))return this.rp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();as.sp("applying feature flags",t),t.forEach(n=>{var i;if(this.rp&&(!((i=this.rp)===null||i===void 0)&&i.has(n))){var a;const o=this._instance.getFeatureFlag(n),u=(a=this.rp)===null||a===void 0?void 0:a.get(n);o&&(u!=null&&u.variants[o])&&this.op(u.name,o,u.variants[o].transforms)}})}}previewWebExperiment(){const t=as.getWindowLocation();if(t!=null&&t.search){const n=To(t==null?void 0:t.search,"__experiment_id"),i=To(t==null?void 0:t.search,"__experiment_variant");n&&i&&(as.sp(`previewing web experiments ${n} && ${i}`),this.getWebExperiments(a=>{this.lp(parseInt(n),i,a)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}lp(t,n,i){const a=i.filter(o=>o.id===t);a&&a.length>0&&(as.sp(`Previewing web experiment [${a[0].name}] with variant [${n}]`),this.op(a[0].name,n,a[0].variants[n].transforms))}static ap(t,n){return!qe(t.conditions)&&as.up(t,n)&&as.cp(t)}static up(t,n){var i;if(qe(t.conditions)||qe((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const a=as.getWindowLocation();if(a){var o,u,h;const f=Qk(n,a.href);return!(!((o=t.conditions)===null||o===void 0)&&o.url)||C8[(u=(h=t.conditions)===null||h===void 0?void 0:h.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,f)}return!1}static getWindowLocation(){return se==null?void 0:se.location}static cp(t){var n;if(qe(t.conditions)||qe((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;const i=cj();if(i.utm_source){var a,o,u,h,f,p,g,v;const b=!(!((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0)&&a.utm_campaign)||((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0?void 0:o.utm_campaign)==i.utm_campaign,y=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_source)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_source)==i.utm_source,_=!(!((f=t.conditions)===null||f===void 0||(f=f.utm)===null||f===void 0)&&f.utm_medium)||((p=t.conditions)===null||p===void 0||(p=p.utm)===null||p===void 0?void 0:p.utm_medium)==i.utm_medium,j=!(!((g=t.conditions)===null||g===void 0||(g=g.utm)===null||g===void 0)&&g.utm_term)||((v=t.conditions)===null||v===void 0||(v=v.utm)===null||v===void 0?void 0:v.utm_term)==i.utm_term;return b&&_&&j&&y}return!1}static sp(t,...n){_e.info(`[WebExperiments] ${t}`,n)}op(t,n,i){this._is_bot()?as.sp(A5):n!=="control"?i.forEach(a=>{if(a.selector){var o;as.sp(`applying transform of variant ${n} for experiment ${t} `,a);const u=(o=document)===null||o===void 0?void 0:o.querySelectorAll(a.selector);u==null||u.forEach(h=>{const f=h;a.html&&(f.innerHTML=a.html),a.css&&f.setAttribute("style",a.css)})}}):as.sp("Control variants leave the page unmodified.")}_is_bot(){return En&&this._instance?Lj(En,this.Mr.custom_blocked_useragents):void 0}}},jf),q8={conversations:class{constructor(e){this._instance=e,this.hp=void 0,this._conversationsManager=null,this.dp=!1,this.ne=null,this.vp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.fp=e.ok,!e.ok))return;const t=e.config.conversations;qe(t)||(cs(t)?this.hp=t:(this.hp=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.hp=void 0,this.ne=null,this.fp=void 0,this.vp=!1}loadIfEnabled(){if(this._conversationsManager||this.dp||this._instance.config.disable_conversations||G0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(e&&!ue(this.hp)&&this.hp)if(this.ne&&this.ne.token){this.dp=!0;try{const t=e.initConversations;if(t)return this.pp(t),void(this.dp=!1);const n=e.loadExternalDependency;if(!n)return void this.gp(Bx);n(this._instance,"conversations",i=>{i||!e.initConversations?this.gp("Could not load conversations script",i):this.pp(e.initConversations),this.dp=!1})}catch(t){this.gp("Error initializing conversations",t),this.dp=!1}}else Ws.error("Conversations enabled but missing token in remote config.")}pp(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.vp=!1,Ws.info("Conversations loaded successfully")}catch(t){this.gp("Error completing conversations initialization",t)}else Ws.error("Cannot complete initialization: remote config is null")}gp(e,t){Ws.error(e,t),this._conversationsManager=null,this.dp=!1,this.vp=!0}show(){this._conversationsManager?this._conversationsManager.show():Ws.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.hp===!0&&!Xt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":G0(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.fp===!1?"remote_config_failed":ue(this.hp)?this.fp?"disabled_in_project":"remote_config_pending":this.hp?qe(this.ne)||!this.ne.token?"missing_token":$e!=null&&$e.__PosthogExtensions__?this.dp?"initializing":this.vp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return Pt(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Ws.warn(Za),null)})()}getMessages(e,t){var n=this;return Pt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Ws.warn(Za),null)})()}markAsRead(e){var t=this;return Pt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ws.warn(Za),null)})()}getTickets(e){var t=this;return Pt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ws.warn(Za),null)})()}requestRestoreLink(e){var t=this;return Pt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ws.warn(Za),null)})()}restoreFromToken(e){var t=this;return Pt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ws.warn(Za),null)})()}restoreFromUrlToken(){var e=this;return Pt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ws.warn(Za),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}xc(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}$c(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},V8={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.mp=!1,this.yp=!1,this.bp=!1,this.A=Wt("[logs]"),this._p=D(D({},this.A),{},{error:(...n)=>{n.some(L5)||this.A.error(...n)}}),this.ol=[],this.wp=[],this.kd=0,this.To=!1,this.kp=[],this.Sp=[],this.xp=!1,this.$p=!1,this.Cp=()=>{var n,i;this.To||(this.kd=0,(n=this.Tp)===null||n===void 0||n.onReconnect(),(i=this.Ip)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.mp=!0),se&>(se,"online",this.Cp)}Mp(e,t,n,i){var a;const o=R5((a=this._instance)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.logs,n);return[new kM(this.Ep(e,t),o,this._p,()=>this.Pp(),u=>u(),void 0,i),o]}Rp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.Tp&&this.Ap===t||((n=this.Tp)===null||n===void 0||n.reset(),this.Ap=t,[this.Tp,this.Fp]=this.Mp(()=>this.ol,i=>{this.ol=i})),this.Tp}Op(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.Ip&&this.Dp===t||((n=this.Ip)===null||n===void 0||n.reset(),this.Dp=t,[this.Ip,this.Lp]=this.Mp(()=>this.wp,i=>{this.wp=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},O5)),this.Ip}setup(e){var t;if(this.To)return;this.bo=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.mp=!0),(this.mp||this.Np()&&this.qp())&&this.jp();let n=!1;const i=e.onRemoteConfig(a=>{var o;n=a.ok&&((o=a.config.logs)===null||o===void 0?void 0:o.captureConsoleLogs)===!0,this.onRemoteConfig(a)});this.To?i.dispose():(this.Eo=i,n||this.loadIfEnabled())}dispose(){var e,t,n,i;this.To||(this.To=!0,this.Bp(),(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.bo=void 0,this.bp=!1,se==null||se.removeEventListener("online",this.Cp),(t=this.zp)===null||t===void 0||t.call(this),this.zp=void 0,(n=this.Tp)===null||n===void 0||n.reset(),(i=this.Ip)===null||i===void 0||i.reset())}onRemoteConfig(e){var t,n;if(this.To)return;const i=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;qe(i)?this.Hp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!i}),i?(this.mp=!0,this.yp||this.jp(),this.loadIfEnabled()):this.Hp())}reset(){var e,t,n,i;this.Bp(),(e=this.Tp)===null||e===void 0||e.clearQueue(),this.ol=[],(t=this.Tp)===null||t===void 0||t.reset(),(n=this.Ip)===null||n===void 0||n.clearQueue(),this.wp=[],(i=this.Ip)===null||i===void 0||i.reset(),this.kd=0}captureLog(e){this.To||this.Rp().captureLog(e)}captureConsoleLog(e){this.To||this.Op().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.To||this.Op().captureLog(e,{context:t,occurredAtMs:n})}qp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[jk])}Np(){var e,t,n;return!(!((e=this._instance)===null||e===void 0||(t=e.il)===null||t===void 0)&&t.call(e))||!!(!((n=$e._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}Tc(){var e;this.Bp(),(e=this.Ip)===null||e===void 0||e.clearQueue(),this.wp=[]}Hp(){this.mp||this.Bp()}jp(){var e;if(this.xp||!($e!=null&&$e.console))return;const t=R5((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let n=!0;this.Sp.push(()=>{n=!1});for(const i of E8){let a;try{a=T8($e.console[i])}catch{continue}a&&this.Sp.push(Ro($e.console,i,o=>{const u=(...h)=>{try{n&&this.Up(i,h,t)}catch{}return o.apply($e.console,h)};return u.__rrweb_original__=a,u}))}this.xp=!0,this.Wp=setTimeout(()=>{this.Bp()},3e4)}Up(e,t,n){var i;if(this.xp&&!this.$p&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(n>this.kp.length){this.$p=!0;try{this.kp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Pp()})}finally{this.$p=!1}}}else this.Bp()}Bp(){if(this.kp=[],this.xp){this.xp=!1,this.Wp&&(clearTimeout(this.Wp),this.Wp=void 0);for(const e of this.Sp)e();this.Sp=[]}}Vp(){const e=this.kp;return this.Bp(),e}get logger(){return this.Gp||(this.Gp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Gp}flushLogs(e){e?this.Qp(e):(this.Tp&&this.Tp.flush().catch(t=>this.Zp(t)),this.Ip&&this.Ip.flush().catch(t=>this.Zp(t)))}Zp(e){L5(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.mp||this.yp||this.bp)return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Bp();const t=e.loadExternalDependency;if(!t)return this.A.error(Bx),void this.Bp();this.bp=!0;try{t(this._instance,"logs",n=>{if(this.bp=!1,this.To||!this.mp)return;const i=e.logs;if(n||!(i!=null&&i.initializeLogs))this.A.error("Could not load logs script",n),this.Bp();else{var a;const h=this.Vp();var o,u;this.zp=i.initializeLogs((a=this.bo)!==null&&a!==void 0?a:this._instance),this.yp=!0,h.length>0&&((o=i.replayConsoleBuffer)===null||o===void 0||o.call(i,(u=this.bo)!==null&&u!==void 0?u:this._instance,h))}})}catch(n){throw this.bp=!1,n}}Ep(e,t){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Fi.LogsQueue?e():void 0,setPersistedProperty(i,a){var o;i===Fi.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},js:i=>this.js(i),getLibraryId:()=>jn.LIB_NAME,getLibraryVersion:()=>jn.LIB_VERSION}}js(e){return new Promise(t=>{if(lj(this.kd,3))return void t({kind:"fatal",error:Qg(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const i=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Qg(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Jp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{const u=o.statusCode;if(this.Kp(u),u>=200&&300>u)i({kind:"ok"});else if(u===413)i({kind:"too-large"});else if(u!==0&&u!==408&&u!==429&&500>u)i({kind:"fatal",error:new Error(`logs request failed with status ${u}`)});else{var h;u===0?(o.error||this.A.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Qg(o.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(h=o.error)!==null&&h!==void 0?h:new Error(`logs request failed with status ${u}`)})}}})})}Kp(e){(e!==0||this._instance.__loaded)&&(this.kd=oj(e,this.kd,3,()=>this.A.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.")))}Qp(e){this.ol.length>0&&this.Xp(e,this.ol,this.Fp,jn.LIB_NAME,t=>{this.ol=t}),this.wp.length>0&&this.Xp(e,this.wp,this.Lp,O5,t=>{this.wp=t})}Xp(e,t,n,i,a){if(t.length===0)return;const o=t.map(h=>h.record);a([]);const u=vk(o,xk(n,jn.LIB_NAME,jn.LIB_VERSION),i,jn.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Jp(),data:u,compression:"best-available",batchKey:"logs",transport:e})}Jp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Pp(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:i,sessionStartTimestamp:a,lastActivityTimestamp:o}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n,t.windowId=i,qe(a)||(t.sessionStartTimestamp=a),qe(o)||(t.lastActivityTimestamp=o)}if(!($e==null||(e=$e.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ma($e.location.href):$e.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(t.activeFeatureFlags=n)}return t}}},G8={metrics:class{constructor(e){this._instance=e,this.A=Wt("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.To)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Yp?this.Yp=(n=>{let i=!0;const a=()=>i?(h=>{var f;const p=(f=h.config.metrics)===null||f===void 0?void 0:f.network;return p===!0?{}:p||void 0})(n):void 0,o=R8(n,a),u=O8(n,a);return()=>{i=!1,o(),u()}})(this._instance):!t&&this.Yp&&(this.Yp(),this.Yp=void 0)}Rp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var n;return this.Tp&&this.Ap===t||((n=this.Tp)===null||n===void 0||n.reset(),this.Ap=t,this.Tp=new jM(this.Ep(),(function(i){var a,o,u,h,f;const p=i==null?void 0:i.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:i==null?void 0:i.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:p,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(h=i==null?void 0:i.flushIntervalMs)!==null&&h!==void 0?h:1e4,maxSeriesPerFlush:(f=i==null?void 0:i.maxSeriesPerFlush)!==null&&f!==void 0?f:1e3}})(t),this.A)),this.Tp}count(e,t=1,n){this.Rp().count(e,t,n)}gauge(e,t,n){this.Rp().gauge(e,t,n)}histogram(e,t,n){this.Rp().histogram(e,t,n)}flush(e){if(!this.Tp)return Promise.resolve();if(e){const t=this.Tp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.Tp.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Tp)===null||e===void 0||e.reset()}dispose(){var e,t;this.To=!0,(e=this.Yp)===null||e===void 0||e.call(this),this.Yp=void 0,(t=this.Tp)===null||t===void 0||t.reset()}Ep(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:n=>t.Ys(n),getLibraryId:()=>jn.LIB_NAME,getLibraryVersion:()=>jn.LIB_VERSION}}Ys(e,t){return new Promise(n=>{let i=!1;const a=u=>{i||(i=!0,clearTimeout(o),n(u))},o=setTimeout(()=>a({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(D(D({method:"POST",url:this.tg(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(u){const h=u.statusCode;if(h>=200&&300>h)a({kind:"ok"});else if(h===413)a({kind:"too-large"});else if(h!==0&&h!==408&&h!==429&&500>h)a({kind:"fatal",error:new Error(`metrics request failed with status ${h}`)});else{var f;a({kind:"retry-later",error:(f=u.error)!==null&&f!==void 0?f:new Error(`metrics request failed with status ${h}`)})}}}))})}tg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Y8={webMCP:class{constructor(e){this._instance=e,this.eg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.eg)return;const e=ge==null?void 0:ge.modelContext;if(!e||!xn(e.registerTool))return;const t=D5.get(e);if(t)return t.instances.add(this._instance),void(this.eg=!0);const n={instances:new Set([this._instance])},i=e.registerTool,a=this;Ro(e,"registerTool",o=>{const u=o;return function(h,...f){let p=h;try{p=a.ig(h,n)}catch{return u.call(this,h,...f)}return u.call(this,p,...f)}}),e.registerTool!==i&&(D5.set(e,n),this.eg=!0)}ig(e,t){if(!e||!xn(e.execute))return e;const n=e.execute,i=this,{tool:a,injected:o}=(function(u,h){const f={intent:!1,model:!1},p=u.inputSchema;if(p&&(ra(p,"$ref")||ra(p,"oneOf")||ra(p,"anyOf")||ra(p,"allOf")||p.additionalProperties===!0||Ze(p.additionalProperties)||p.type&&p.type!=="object"||p.properties&&!Ze(p.properties)||p.required&&!Ie(p.required))||!ue(p)&&!Ze(p))return{tool:Wg(u),injected:f};const g=(p==null?void 0:p.properties)||{};if(f.intent=h.intent&&!ra(g,"context"),f.model=h.model&&!ra(g,"llm_model"),!f.intent&&!f.model)return{tool:Wg(u),injected:f};const v=D({},g),b=Ie(p==null?void 0:p.required)?[...p.required]:[];return f.intent&&(v.context={type:"string",description:`Explain why this tool is called and how it supports the user's goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".`},b.includes("context")||b.push("context")),f.model&&(v.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},b.includes("llm_model")||b.push("llm_model")),{tool:Wg(u,D(D({},p),{},{type:(p==null?void 0:p.type)||"object",properties:v,required:b})),injected:f}})(e,(function(u){const h={intent:!1,model:!1};for(const f of u.instances){const p=z5(f.config.capture_webmcp);h.intent||(h.intent=(p==null?void 0:p.intent)===!0),h.model||(h.model=(p==null?void 0:p.model)===!0)}return h})(t));return Object.defineProperty(a,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...u){const h=new Date,f=(function(b,y){if(!Ze(b))return{};try{const _=y.intent?$5(b.context,2048,!0):void 0,j=y.model?$5(b.llm_model,256):void 0;return D(D({},_&&_!=="{}"?{intent:_}:{}),j&&j.toLowerCase()!=="unknown"?{model:j}:{})}catch{return{}}})(u[0],o),p=(function(b,y){const _=b[0];if(!Ze(_))return b;try{const j=y.intent&&ra(_,"context"),N=y.model&&ra(_,"llm_model");if(!j&&!N)return b;const S=D({},_);return j&&delete S.context,N&&delete S.llm_model,[S,...b.slice(1)]}catch{return b}})(u,o);let g;try{g=n.apply(this===a?e:this,p)}catch(b){throw i.ng(t,a,h,!0,f),b}return(v=g)&&typeof v.then=="function"?Promise.resolve(g).then(b=>(i.ng(t,a,h,P5(b),f),b),b=>{throw i.ng(t,a,h,!0,f),b}):(i.ng(t,a,h,P5(g),f),g);var v}}),a}ng(e,t,n,i,a){const o=Date.now()-n.getTime();for(const u of e.instances){const h=z5(u.config.capture_webmcp);if(h)try{u.capture("$mcp_tool_call",D(D({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:zt==null?void 0:zt.hostname,$mcp_duration_ms:o,$mcp_is_error:i},h.intent&&a.intent?{$mcp_intent:a.intent,$mcp_intent_source:"context_parameter"}:{}),h.model&&a.model?{$mcp_llm_model:a.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:n})}catch{continue}}}}};vu.__defaultExtensionClasses=D({},D(D(D(D(D(D(D(D(D(D(D(D(D(D({},jf),D8),z8),$8),P8),B8),I8),F8),U8),H8),q8),V8),G8),Y8));const X8=(function(){jn.SDK_DIST_CHANNEL="npm";const e=gu[iu]=new vu;return(function(){function t(){t.done||(t.done=!0,Rj=!1,_t(gu,function(n){n._dom_loaded()}))}ge!=null&&ge.addEventListener?ge.readyState==="complete"?t():gt(ge,"DOMContentLoaded",t,{capture:!1}):se&&_e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var Au=X8;const Q8="https://us.i.posthog.com",Gj="cc-telemetry-enabled";let rx=!1,Ru=!1;function W8(){return Q8}function Z8(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(Gj);return e===null?!0:e==="true"}function Yj(e){rx&&(e?(Au.opt_in_capturing({captureEventName:null}),Ru=!0):(Au.opt_out_capturing(),Ru=!1))}function uF(e){typeof localStorage<"u"&&localStorage.setItem(Gj,String(e)),Yj(e)}function K8(){const e=void 0;return e?(Au.init(e,{api_host:W8(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),rx=!0,Yj(Z8()),!0):(rx=!1,Ru=!1,!1)}function Wx(e,t){Ru&&Au.capture(e,t)}function ga(e,t){Ru&&Au.captureException(e,t)}function J8(e){Wx("$pageview",{$current_url:e})}const qi="/api",Xj="companion_auth_token";function xa(){if(typeof window>"u")return{};const e=localStorage.getItem(Xj);return e?{Authorization:`Bearer ${e}`}:{}}function ul(e){e===401&&typeof window<"u"&&(localStorage.removeItem(Xj),Zn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>I4);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function Nn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function zu(e,t,n,i){Wx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function Vi(e,t,n,i,a){Wx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),ga(i,{method:e,path:t,status:a})}async function Ue(e,t){const n=Nn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...xa()},body:t?JSON.stringify(t):void 0});if(!a.ok){ul(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("POST",e,Nn()-n,u,a.status),i=!0,u}return zu("POST",e,Nn()-n,a.status),a.json()}catch(a){throw i||Vi("POST",e,Nn()-n,a),a}}async function De(e){const t=Nn();let n=!1;try{const i=await fetch(`${qi}${e}`,{headers:{...xa()}});if(!i.ok){ul(i.status);const a=await i.json().catch(()=>({error:i.statusText})),o=new Error(a.error||i.statusText);throw Vi("GET",e,Nn()-t,o,i.status),n=!0,o}return zu("GET",e,Nn()-t,i.status),i.json()}catch(i){throw n||Vi("GET",e,Nn()-t,i),i}}async function Zs(e,t){const n=Nn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...xa()},body:t?JSON.stringify(t):void 0});if(!a.ok){ul(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("PUT",e,Nn()-n,u,a.status),i=!0,u}return zu("PUT",e,Nn()-n,a.status),a.json()}catch(a){throw i||Vi("PUT",e,Nn()-n,a),a}}async function eR(e,t){const n=Nn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...xa()},body:t?JSON.stringify(t):void 0});if(!a.ok){ul(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("PATCH",e,Nn()-n,u,a.status),i=!0,u}return zu("PATCH",e,Nn()-n,a.status),a.json()}catch(a){throw i||Vi("PATCH",e,Nn()-n,a),a}}async function Ks(e,t){const n=Nn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...xa()},body:t?JSON.stringify(t):void 0});if(!a.ok){ul(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("DELETE",e,Nn()-n,u,a.status),i=!0,u}return zu("DELETE",e,Nn()-n,a.status),a.json()}catch(a){throw i||Vi("DELETE",e,Nn()-n,a),a}}async function tR(e,t){const n=await fetch(`${qi}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...xa()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const h=await n.json().catch(()=>({error:n.statusText}));throw new Error(h.error||n.statusText)}const i=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:h,value:f}=await i.read();if(h)break;o+=a.decode(f,{stream:!0});const p=o.split(`
|
|
69
|
+
|
|
70
|
+
`);o=p.pop()||"";for(const g of p){if(!g.trim())continue;let v="",b="";for(const _ of g.split(`
|
|
71
|
+
`))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(v==="progress")t(y);else if(v==="done")u=y;else if(v==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function nR(){try{const e=await fetch(`${qi}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function B5(e){try{const t=await fetch(`${qi}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const we={getAuthQr:()=>De("/auth/qr"),getAuthToken:()=>De("/auth/token"),regenerateAuthToken:()=>Ue("/auth/regenerate"),createSession:e=>Ue("/sessions/create",e),listSessions:()=>De("/sessions"),discoverClaudeSessions:(e=200)=>De(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),i=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return De(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>Ue(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Ks(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Ue(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${qi}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...xa()}});if(!n.ok)throw ul(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>De(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Ue(`/sessions/${encodeURIComponent(e)}/unarchive`),setSessionPinned:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/pin`,{pinned:t}),renameSession:(e,t)=>eR(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>De(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>De("/fs/home"),listEnvs:()=>De("/envs"),getEnv:e=>De(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Ue("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Zs(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Ks(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>De("/sandboxes"),getSandbox:e=>De(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Ue("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Zs(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Ks(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Ue(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Ue("/docker/build-base"),getBaseImageStatus:()=>De("/docker/base-image"),getSettings:()=>De("/settings"),updateSettings:e=>Zs("/settings",e),verifyAnthropicKey:e=>Ue("/settings/anthropic/verify",{apiKey:e}),getCodexAccount:()=>De("/codex/auth/account"),getCodexLoginStatus:()=>De("/codex/auth/login"),startCodexLogin:()=>Ue("/codex/auth/login"),cancelCodexLogin:()=>Ue("/codex/auth/login/cancel"),codexLogout:()=>Ue("/codex/auth/logout"),getClaudeAccount:()=>De("/claude/auth/account"),getClaudeLoginStatus:()=>De("/claude/auth/login"),startClaudeLogin:()=>Ue("/claude/auth/login"),submitClaudeLoginCode:e=>Ue("/claude/auth/login/code",{code:e}),cancelClaudeLogin:()=>Ue("/claude/auth/login/cancel"),claudeLogout:()=>Ue("/claude/auth/logout"),getDashboard:()=>De("/dashboard"),runDashboardUpdate:()=>Ue("/dashboard/run"),getDashboardRunStatus:()=>De("/dashboard/run/status"),getTailscaleStatus:()=>De("/tailscale/status"),startTailscaleFunnel:()=>Ue("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Ue("/tailscale/funnel/stop"),listLinearConnections:()=>De("/linear/connections"),createLinearConnection:e=>Ue("/linear/connections",e),updateLinearConnection:(e,t)=>Zs(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Ks(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Ue(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>De(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>De(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>De(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Ue(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>De(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>De(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>De(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Zs("/linear/project-mappings",e),removeLinearProjectMapping:e=>Ks("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Zs(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Ks(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>De(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Ue("/linear/issues",e),addLinearComment:(e,t,n)=>Ue(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>De(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>De(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Ue("/git/fetch",{repoRoot:e}),gitPull:e=>Ue("/git/pull",{cwd:e}),listWorktrees:e=>De(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Ue("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Ks("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>De(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>De("/backends"),getBackendModels:e=>De(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>De("/containers/status"),getContainerImages:()=>De("/containers/images"),getImageStatus:e=>De(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Ue(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>De(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Ue(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>De(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>De(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${qi}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...xa()}});if(!t.ok){ul(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Zs("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>De(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>De(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>De(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Zs("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>De(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>De("/usage-limits"),getSessionUsageLimits:e=>De(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>De("/system/memory"),getSystemDisk:()=>De("/system/disk"),spawnTerminal:(e,t,n,i)=>Ue("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Ue("/terminal/kill",{terminalId:e}),getTerminal:e=>De(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>De("/update-check"),forceCheckForUpdate:()=>Ue("/update-check"),triggerUpdate:()=>Ue("/update"),getClaudeCompat:()=>De("/claude-compat"),refreshClaudeCompat:()=>Ue("/claude-compat/refresh"),pinClaudeVersion:e=>Ue("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>Ue("/claude-compat/patch"),unpatchClaudeBinary:()=>Ue("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>Ue("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>De("/cron/jobs"),getCronJob:e=>De(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Ue("/cron/jobs",e),updateCronJob:(e,t)=>Zs(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Ks(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Ue(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Ue(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>De(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>De(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>De("/agents"),getAgent:e=>De(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Ue("/agents",e),updateAgent:(e,t)=>Zs(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Ks(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Ue(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Ue(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>De(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Ue("/agents/import",e),exportAgent:e=>De(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Ue(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return De(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return De(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const i=n.toString();return De(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Ue("/linear/oauth/disconnect"),createLinearStaging:e=>Ue("/linear/oauth/staging",e),getLinearStagingStatus:e=>De(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Ks(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>De("/linear/oauth-connections"),createLinearOAuthConnection:e=>Ue("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Zs(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Ks(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>De(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>De("/skills"),sendSessionMessage:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return De(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Ue("/prompts",e),updatePrompt:(e,t)=>Zs(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Ks(`/prompts/${encodeURIComponent(e)}`)};let F5=!1;function I5(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const a=document.execCommand("copy");if(document.body.removeChild(i),!a){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function U5(){return new Promise(()=>{})}function sR(){if(F5||typeof window>"u")return;F5=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await I5(i)}catch{return U5()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await I5(n)}catch{return U5()}}}})}catch{}}const H5="#/session/",q5="#/agents/";let V5=!1;function Zx(){V5||(sR(),V5=!0)}function Kx(e){if(Zx(),e==="#/dashboard")return{page:"dashboard"};if(e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(q5)){const n=e.slice(q5.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(H5)){const n=e.slice(H5.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function iR(e){return`#/session/${e}`}function Jx(e,t=!1){Zx();const n=iR(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Zg(e=!1){Zx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function rR(){const[e,t]=k.useState(""),[n,i]=k.useState(null),[a,o]=k.useState(!1),u=W(g=>g.setAuthToken),h=k.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}o(!0),i(null),await B5(v)?u(v):i("Invalid token"),o(!1)},[e,u]);k.useEffect(()=>{nR().then(g=>{if(g){u(g);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),B5(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),o(!1)}))})},[u]);const[f,p]=k.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:f?"text":"password",value:e,onChange:g=>{t(g.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:f?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var $o=sS();function aR({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:h}){const[f,p]=k.useState("none");return $o.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:h,children:l.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:h,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:f==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:f==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:f==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:h,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(f,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function Qj(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function lR(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function oR(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function cR({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function G5({className:e}){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:e,"aria-hidden":!0,children:l.jsx("path",{d:"M9.828.722a.5.5 0 01.354.146l4.95 4.95a.5.5 0 010 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 01.16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 01-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 010-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 011.013.16l3.134-3.133a2.772 2.772 0 01-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 01.353-.146z"})})}function uR({type:e}){return e==="codex"?l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function _h({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:h,onArchive:f,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:S,onFilterProject:C,activeProjectKey:E,isPinned:R=!1,onTogglePin:A}){const O=e.id.slice(0,8),P=i||e.model||O,z=b===e.id,[Z,I]=k.useState(!1),q=k.useRef(null),L=k.useRef(null),de=n?"exited":oR(e,a),Q=e.cwd||e.repoRoot?Qj(e.cwd,e.repoRoot||void 0,e.isContainerized):"",V=Q?lR(Q):"",G=Q&&e.cwd.startsWith(Q+"/")?e.cwd.slice(Q.length+1):"",H=!!Q&&E===Q;k.useEffect(()=>{if(!Z)return;function T(Ce){var $;q.current&&!q.current.contains(Ce.target)&&L.current&&!L.current.contains(Ce.target)&&(I(!1),($=L.current)==null||$.focus())}function Ne(Ce){var $,B,oe;if(Ce.key==="Escape"){I(!1),($=L.current)==null||$.focus();return}if(Ce.key==="Tab"){I(!1);return}if((Ce.key==="ArrowDown"||Ce.key==="ArrowUp")&&((B=q.current)!=null&&B.contains(document.activeElement)||L.current===document.activeElement)){Ce.preventDefault();const be=(oe=q.current)==null?void 0:oe.querySelectorAll("[role='menuitem']");if(!be||be.length===0)return;const je=document.activeElement,Ee=Array.from(be).indexOf(je);Ce.key==="ArrowDown"?be[Ee<be.length-1?Ee+1:0].focus():be[Ee>0?Ee-1:be.length-1].focus()}}return document.addEventListener("mousedown",T),document.addEventListener("touchstart",T),document.addEventListener("keydown",Ne),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("touchstart",T),document.removeEventListener("keydown",Ne)}},[Z]),k.useEffect(()=>{Z&&requestAnimationFrame(()=>{var T,Ne;(Ne=(T=q.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||Ne.focus()})},[Z]);const ae=k.useCallback(T=>{I(!1),T()},[]),ye=l.jsxs("span",{className:"flex items-center gap-1 shrink-0 ml-auto pl-1",children:[l.jsx(uR,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]});return l.jsxs("div",{className:`relative group min-h-[44px] rounded-lg transition-all duration-100 ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:T=>{T.preventDefault(),h(e.id,P)},onKeyDown:T=>{T.key==="F2"&&!z&&(T.preventDefault(),h(e.id,P))},title:P,className:`w-full flex items-center gap-2 pt-1.5 pl-2.5 pr-8 sm:pr-2 sm:group-hover:pr-12 text-left rounded-lg cursor-pointer ${z?"pb-1.5":"pb-0.5"}`,children:[!z&&l.jsx(cR,{status:de}),z?l.jsx("input",{ref:S,value:y,onChange:T=>_(T.target.value),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),j()):T.key==="Escape"&&(T.preventDefault(),N()),T.stopPropagation()},onBlur:j,onClick:T=>T.stopPropagation(),onDoubleClick:T=>T.stopPropagation(),className:"text-[12px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`flex-1 min-w-0 text-[12px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:P}),R&&l.jsx("span",{className:"shrink-0 text-cc-primary",title:"Pinned","aria-label":"Pinned",children:l.jsx(G5,{className:"w-3 h-3"})})]})]}),!z&&l.jsxs("div",{onClick:()=>u(e.id),onDoubleClick:()=>h(e.id,P),className:"flex items-center gap-1 min-w-0 pl-[26px] pr-8 sm:pr-2 sm:group-hover:pr-12 pb-1.5 leading-none cursor-pointer",children:[V&&(C?l.jsx("button",{onClick:T=>{T.stopPropagation(),C(Q,V)},onDoubleClick:T=>T.stopPropagation(),title:`${H?"Clear filter":"Show only sessions in"} ${Q}`,"aria-label":`${H?"Clear project filter":"Filter by project"} ${V}`,"aria-pressed":H,className:`shrink min-w-0 max-w-[65%] truncate text-[10px] leading-tight px-1 py-px rounded transition-colors cursor-pointer ${H?"bg-cc-primary/15 text-cc-primary":"bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border"}`,children:V}):l.jsx("span",{className:"shrink min-w-0 max-w-[65%] truncate text-[10px] leading-tight text-cc-muted/80",title:Q,children:V})),G&&l.jsxs("span",{className:"truncate min-w-0 flex-1 text-[10px] leading-tight text-cc-muted/60",title:e.cwd,children:["/",G]}),ye]}),!n&&!z&&!Z&&l.jsx("button",{onClick:T=>{T.stopPropagation(),f(T,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:L,onClick:T=>{T.stopPropagation(),I(!Z)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":Z,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),Z&&l.jsxs("div",{ref:q,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>ae(()=>h(e.id,P)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),!n&&A&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>ae(()=>A(e.id,!R)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx(G5,{className:"w-3 h-3 text-cc-muted"}),R?"Unpin":"Pin to top"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>ae(()=>p(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>ae(()=>g(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>ae(()=>f(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function dR(e){return Qj(e.cwd,e.repoRoot||void 0,e.isContainerized)}function hR(e,t){return[t,e.id,e.cwd,e.repoRoot,e.gitBranch,e.model,e.cronJobName,e.agentName,e.userName].filter(Boolean).join(`
|
|
72
|
+
`).toLowerCase()}function fR(e,t,n,i){const a=t.toLowerCase().split(/\s+/).filter(Boolean);return a.length===0&&!n?e:e.filter(o=>{if(n&&dR(o)!==n)return!1;if(a.length===0)return!0;const u=hR(o,i.get(o.id));return a.every(h=>u.includes(h))})}const pR=[{label:"Documentation",url:"https://docs.thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 000 2.5v11a.5.5 0 00.707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 00.78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0016 13.5v-11a.5.5 0 00-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z"},{label:"GitHub",url:"https://github.com/The-Vibe-Company/companion",viewBox:"0 0 16 16",iconPath:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"},{label:"Website",url:"https://thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A7.025 7.025 0 002.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.255a7.024 7.024 0 003.072 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0013.745 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 01-.312 2.5zm2.802-3.5a6.959 6.959 0 00-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 00-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 00-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"}],mR=[{id:"dashboard",label:"Dashboard",hash:"#/dashboard",activePages:["dashboard"],viewBox:"0 0 16 16",iconPath:"M1 2.5A1.5 1.5 0 012.5 1h3A1.5 1.5 0 017 2.5v3A1.5 1.5 0 015.5 7h-3A1.5 1.5 0 011 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 2.5A1.5 1.5 0 0110.5 1h3A1.5 1.5 0 0115 2.5v3A1.5 1.5 0 0113.5 7h-3A1.5 1.5 0 019 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM1 10.5A1.5 1.5 0 012.5 9h3A1.5 1.5 0 017 10.5v3A1.5 1.5 0 015.5 15h-3A1.5 1.5 0 011 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 10.5A1.5 1.5 0 0110.5 9h3a1.5 1.5 0 011.5 1.5v3a1.5 1.5 0 01-1.5 1.5h-3A1.5 1.5 0 019 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3z"},{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],gR=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],xR=new Map(mR.map(e=>[e.id,e]));function vR(){var fn,Vn,tn;const[e,t]=k.useState(null),[n,i]=k.useState(""),[a,o]=k.useState(!1),[u,h]=k.useState(null),[f,p]=k.useState(null),[g,v]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,S]=k.useState(!1),[C,E]=k.useState(()=>typeof window<"u"?window.location.hash:""),R=k.useRef(null),A=k.useRef(null),O=W(te=>te.sessions),P=W(te=>te.sdkSessions),z=W(te=>te.currentSessionId),Z=W(te=>te.cliConnected),I=W(te=>te.cliReconnecting),q=W(te=>te.sessionStatus),L=W(te=>te.removeSession),de=W(te=>te.sessionNames),Q=W(te=>te.recentlyRenamed),V=W(te=>te.clearRecentlyRenamed),G=W(te=>te.pendingPermissions),H=W(te=>te.linkedLinearIssues),ae=Kx(C);k.useEffect(()=>{let te=!0;async function ve(){try{const Ge=await we.listSessions();if(te){const jt=W.getState();jt.setSdkSessions(Ge);const pn=W.getState(),Dn=new Set(Ge.map(Ot=>Ot.sessionId));for(const Ot of pn.sessions.keys())!Dn.has(Ot)&&pn.connectionStatus.get(Ot)!=="connected"&&pn.removeSession(Ot);qT(Ge);for(const Ot of Ge)if(Ot.name&&(!jt.sessionNames.has(Ot.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(jt.sessionNames.get(Ot.sessionId)))){const zn=jt.sessionNames.get(Ot.sessionId),ti=!!zn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(zn);zn!==Ot.name&&(jt.setSessionName(Ot.sessionId,Ot.name),ti&&jt.markRecentlyRenamed(Ot.sessionId))}}}catch{}}ve();const me=setInterval(ve,5e3);return()=>{te=!1,clearInterval(me)}},[]),k.useEffect(()=>{const te=()=>E(window.location.hash);return window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[]);function ye(te){Jx(te),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}function T(){Zg(),W.getState().newSession(),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&R.current&&(R.current.focus(),R.current.select())},[e]);function Ne(){e&&n.trim()&&(W.getState().setSessionName(e,n.trim()),we.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function Ce(){t(null),i("")}function $(te,ve){t(te),i(ve)}const B=k.useCallback((te,ve)=>{te.stopPropagation(),j(ve)},[]),oe=k.useCallback(async te=>{try{C0(te),await we.deleteSession(te)}catch{}W.getState().currentSessionId===te&&Zg(),L(te)},[L]),be=k.useCallback(()=>{_&&(oe(_),j(null))},[_,oe]),je=k.useCallback(()=>{j(null)},[]),Ee=k.useCallback(()=>{S(!0)},[]),Be=k.useCallback(async()=>{S(!1);const te=W.getState(),ve=new Set;for(const Ge of te.sessions.keys())ve.add(Ge);for(const Ge of te.sdkSessions)ve.add(Ge.sessionId);const me=Array.from(ve).filter(Ge=>{const jt=te.sdkSessions.find(pn=>pn.sessionId===Ge);return(jt==null?void 0:jt.archived)??!1});for(const Ge of me)await oe(Ge)},[oe]),Oe=k.useCallback(()=>{S(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var ve,me;(me=(ve=A.current)==null?void 0:ve.querySelector("button"))==null||me.focus()});function te(ve){var pn;if(ve.key==="Escape"){N?Oe():je();return}if(ve.key!=="Tab")return;const me=(pn=A.current)==null?void 0:pn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!me||me.length===0)return;const Ge=me[0],jt=me[me.length-1];ve.shiftKey&&document.activeElement===Ge?(ve.preventDefault(),jt.focus()):!ve.shiftKey&&document.activeElement===jt&&(ve.preventDefault(),Ge.focus())}return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[_,N,je,Oe]);const Te=k.useCallback(async(te,ve)=>{te.stopPropagation();const me=P.find(zn=>zn.sessionId===ve),Ge=O.get(ve),jt=(Ge==null?void 0:Ge.is_containerized)||!!(me!=null&&me.containerId)||!1,pn=H.get(ve),Dn=((pn==null?void 0:pn.stateType)||"").toLowerCase();if(pn&&!(Dn==="completed"||Dn==="canceled"||Dn==="cancelled"))try{const zn=await we.getArchiveInfo(ve);if(zn.issueNotDone){p(ve),v(zn),y(jt);return}}catch{}if(jt){h(ve);return}Re(ve)},[P,O,H]),Re=k.useCallback(async(te,ve,me)=>{try{C0(te);const Ge={};ve&&(Ge.force=!0),me&&me!=="none"&&(Ge.linearTransition=me),await we.archiveSession(te,Object.keys(Ge).length>0?Ge:void 0)}catch{}W.getState().currentSessionId===te&&(Zg(),W.getState().newSession());try{const Ge=await we.listSessions();W.getState().setSdkSessions(Ge)}catch{}},[]),Ft=k.useCallback(()=>{u&&(Re(u,!0),h(null))},[u,Re]),vn=k.useCallback(()=>{h(null)},[]),Vt=k.useCallback((te,ve)=>{f&&(Re(f,ve,te),p(null),v(null))},[f,Re]),St=k.useCallback(()=>{p(null),v(null)},[]),wt=k.useCallback(async(te,ve)=>{const me=W.getState();me.setSdkSessions(me.sdkSessions.map(Ge=>Ge.sessionId===te?{...Ge,pinned:ve}:Ge));try{await we.setSessionPinned(te,ve)}catch{}try{const Ge=await we.listSessions();W.getState().setSdkSessions(Ge)}catch{}},[]),We=k.useCallback(async(te,ve)=>{te.stopPropagation();try{await we.unarchiveSession(ve)}catch{}try{const me=await we.listSessions();W.getState().setSdkSessions(me)}catch{}},[]),xt=new Set;for(const te of O.keys())xt.add(te);for(const te of P)xt.add(te.sessionId);const Zt=Array.from(xt).map(te=>{var Ge;const ve=O.get(te),me=P.find(jt=>jt.sessionId===te);return{id:te,model:(ve==null?void 0:ve.model)||(me==null?void 0:me.model)||"",cwd:(ve==null?void 0:ve.cwd)||(me==null?void 0:me.cwd)||"",gitBranch:(ve==null?void 0:ve.git_branch)||(me==null?void 0:me.gitBranch)||"",isContainerized:(ve==null?void 0:ve.is_containerized)||!!(me!=null&&me.containerId)||!1,gitAhead:(ve==null?void 0:ve.git_ahead)||(me==null?void 0:me.gitAhead)||0,gitBehind:(ve==null?void 0:ve.git_behind)||(me==null?void 0:me.gitBehind)||0,linesAdded:(ve==null?void 0:ve.total_lines_added)||(me==null?void 0:me.totalLinesAdded)||0,linesRemoved:(ve==null?void 0:ve.total_lines_removed)||(me==null?void 0:me.totalLinesRemoved)||0,isConnected:Z.get(te)??!1,isReconnecting:I.get(te)??!1,status:q.get(te)??null,sdkState:(me==null?void 0:me.state)??null,createdAt:(me==null?void 0:me.createdAt)??0,archived:(me==null?void 0:me.archived)??!1,backendType:(ve==null?void 0:ve.backend_type)||(me==null?void 0:me.backendType)||"claude",repoRoot:(ve==null?void 0:ve.repo_root)||"",permCount:((Ge=G.get(te))==null?void 0:Ge.size)??0,cronJobId:(ve==null?void 0:ve.cronJobId)||(me==null?void 0:me.cronJobId),cronJobName:(ve==null?void 0:ve.cronJobName)||(me==null?void 0:me.cronJobName),agentId:(ve==null?void 0:ve.agentId)||(me==null?void 0:me.agentId),agentName:(ve==null?void 0:ve.agentName)||(me==null?void 0:me.agentName),userName:me==null?void 0:me.userName,pinned:(me==null?void 0:me.pinned)??!1}}).sort((te,ve)=>ve.createdAt-te.createdAt),ie=typeof localStorage<"u"&&((fn=localStorage.getItem("cc-user-name"))==null?void 0:fn.trim())||"",ke=te=>!!ie&&te.userName===ie,Qe=te=>!!te.pinned&&ke(te),nt=k.useMemo(()=>Array.from(new Set(Zt.map(te=>te.userName).filter(te=>!!te))).sort(),[Zt]),[Kt,It]=k.useState("__all__"),ce=te=>Kt==="__all__"?!0:Kt==="__none__"?!te.userName:te.userName===Kt,U=Zt.some(te=>!te.userName),fe=Zt.filter(ce),[Ae,tt]=k.useState(""),[ze,st]=k.useState(null),rn=k.useRef(null),Jn=Ae.trim()!==""||ze!==null,ln=fR(fe.filter(te=>!te.archived),Ae,(ze==null?void 0:ze.key)??null,de),Fs=k.useCallback((te,ve)=>{st(me=>(me==null?void 0:me.key)===te?null:{key:te,label:ve})},[]),ks=ln.filter(te=>!te.cronJobId&&!te.agentId).sort((te,ve)=>Number(Qe(ve))-Number(Qe(te))),Ut=ln.filter(te=>!!te.cronJobId),Jt=ln.filter(te=>!!te.agentId),hn=Jn?[]:fe.filter(te=>te.archived),en=z?Zt.find(te=>te.id===z):null,yi=(en==null?void 0:en.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[_i,kr]=k.useState(!0),[wi,ya]=k.useState(!0),Ln={onSelect:ye,onStartRename:$,onArchive:Te,onUnarchive:We,onDelete:B,onClearRecentlyRenamed:V,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:Ne,onCancelRename:Ce,editInputRef:R,onFilterProject:Fs,activeProjectKey:(ze==null?void 0:ze.key)??null};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:yi,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),l.jsx("button",{onClick:T,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>W.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),nt.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:Kt,onChange:te=>It(te.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),nt.map(te=>l.jsx("option",{value:te,children:te},te)),U&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-cc-muted/70 pointer-events-none",children:l.jsx("path",{d:"M11.742 10.344a6.5 6.5 0 10-1.397 1.398h-.001l3.85 3.85a1 1 0 001.415-1.414l-3.85-3.85zM12 6.5a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z"})}),l.jsx("input",{ref:rn,type:"search",value:Ae,onChange:te=>tt(te.target.value),onKeyDown:te=>{te.key==="Escape"&&Ae&&(te.preventDefault(),tt(""))},placeholder:"Search sessions…","aria-label":"Search sessions",className:"w-full pl-7 pr-7 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:border-cc-primary [&::-webkit-search-cancel-button]:hidden"}),Ae&&l.jsx("button",{onClick:()=>{var te;tt(""),(te=rn.current)==null||te.focus()},"aria-label":"Clear search",title:"Clear search",className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]}),ze&&l.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Project:"}),l.jsxs("button",{onClick:()=>st(null),title:`${ze.key} — click to clear`,"aria-label":`Clear project filter ${ze.label}`,className:"min-w-0 flex items-center gap-1 px-1.5 py-0.5 rounded bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 cursor-pointer",children:[l.jsx("span",{className:"truncate",children:ze.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 shrink-0",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})]})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:vn,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:Ft,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:ks.length===0&&Ut.length===0&&Jt.length===0&&hn.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:Jn?"No matching sessions.":"No sessions yet."}):l.jsxs(l.Fragment,{children:[ks.length>0&&l.jsx("div",{children:ks.map((te,ve)=>{var jt;const me=Qe(te),Ge=me&&ve<ks.length-1&&!Qe(ks[ve+1]);return l.jsx("div",{className:Ge?"pb-1 mb-1 border-b border-cc-separator":"",children:l.jsx(_h,{session:te,isActive:z===te.id,sessionName:de.get(te.id),permCount:((jt=G.get(te.id))==null?void 0:jt.size)??0,isRecentlyRenamed:Q.has(te.id),isPinned:me,onTogglePin:ke(te)?wt:void 0,...Ln})},te.id)})}),Ut.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>kr(!_i),"aria-expanded":_i,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${_i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",Ut.length,")"]}),_i&&l.jsx("div",{className:"mt-0.5",children:Ut.map(te=>{var ve;return l.jsx(_h,{session:te,isActive:z===te.id,sessionName:de.get(te.id),permCount:((ve=G.get(te.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Q.has(te.id),...Ln},te.id)})})]}),Jt.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>ya(!wi),"aria-expanded":wi,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${wi?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Jt.length,")"]}),wi&&l.jsx("div",{className:"mt-0.5",children:Jt.map(te=>{var ve;return l.jsx(_h,{session:te,isActive:z===te.id,sessionName:de.get(te.id),permCount:((ve=G.get(te.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Q.has(te.id),...Ln},te.id)})})]}),hn.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>o(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",hn.length,")"]}),a&&hn.length>1&&l.jsx("button",{onClick:Ee,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),a&&l.jsx("div",{className:"mt-0.5",children:hn.map(te=>{var ve;return l.jsx(_h,{session:te,isActive:z===te.id,isArchived:!0,sessionName:de.get(te.id),permCount:((ve=G.get(te.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Q.has(te.id),...Ln},te.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:T,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:gR.map(te=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:te.label}),l.jsx("div",{className:"flex flex-col",children:te.itemIds.map(ve=>{const me=xR.get(ve);if(!me)return null;const Ge=me.activePages?me.activePages.some(jt=>ae.page===jt):ae.page===me.id;return l.jsxs("button",{onClick:()=>{window.location.hash=me.hash,window.innerWidth<768&&W.getState().setSidebarOpen(!1)},title:me.label,"aria-current":Ge?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${Ge?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Ge?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:me.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:me.iconPath,fillRule:me.fillRule,clipRule:me.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:me.label})]},me.id)})})]},te.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:pR.map(te=>l.jsx("a",{href:te.url,target:"_blank",rel:"noopener noreferrer",title:te.label,"aria-label":`Open ${te.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:l.jsx("svg",{viewBox:te.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:te.iconPath})})},te.label))})]})})]}),(_||N)&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:N?Oe:je,children:l.jsxs("div",{ref:A,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:te=>te.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${hn.length} archived session${hn.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:N?Oe:je,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:N?Be:be,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:N?"Delete all":"Delete"})]})]})}),f&&g&&l.jsx(aR,{issueIdentifier:((Vn=g.issue)==null?void 0:Vn.identifier)||"",issueStateName:((tn=g.issue)==null?void 0:tn.stateName)||"",isContainerized:b,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:Vt,onCancel:St})]})}function bR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const yR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_R=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wR={};function Y5(e,t){return(wR.jsx?_R:yR).test(e)}const SR=/[ \t\n\f\r]/g;function kR(e){return typeof e=="object"?e.type==="text"?X5(e.value):!1:X5(e)}function X5(e){return e.replace(SR,"")===""}class $u{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}$u.prototype.normal={};$u.prototype.property={};$u.prototype.space=void 0;function Wj(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new $u(n,i,t)}function ax(e){return e.toLowerCase()}class Ss{constructor(t,n){this.attribute=n,this.property=t}}Ss.prototype.attribute="";Ss.prototype.booleanish=!1;Ss.prototype.boolean=!1;Ss.prototype.commaOrSpaceSeparated=!1;Ss.prototype.commaSeparated=!1;Ss.prototype.defined=!1;Ss.prototype.mustUseProperty=!1;Ss.prototype.number=!1;Ss.prototype.overloadedBoolean=!1;Ss.prototype.property="";Ss.prototype.spaceSeparated=!1;Ss.prototype.space=void 0;let jR=0;const Je=hl(),kn=hl(),lx=hl(),Se=hl(),Dt=hl(),ll=hl(),$s=hl();function hl(){return 2**++jR}const ox=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:kn,commaOrSpaceSeparated:$s,commaSeparated:ll,number:Se,overloadedBoolean:lx,spaceSeparated:Dt},Symbol.toStringTag,{value:"Module"})),Kg=Object.keys(ox);class ev extends Ss{constructor(t,n,i,a){let o=-1;if(super(t,n),Q5(this,"space",a),typeof i=="number")for(;++o<Kg.length;){const u=Kg[o];Q5(this,Kg[o],(i&ox[u])===ox[u])}}}ev.prototype.defined=!0;function Q5(e,t,n){n&&(e[t]=n)}function Po(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const o=new ev(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[ax(i)]=i,n[ax(o.attribute)]=i}return new $u(t,n,e.space)}const Zj=Po({properties:{ariaActiveDescendant:null,ariaAtomic:kn,ariaAutoComplete:null,ariaBusy:kn,ariaChecked:kn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Dt,ariaCurrent:null,ariaDescribedBy:Dt,ariaDetails:null,ariaDisabled:kn,ariaDropEffect:Dt,ariaErrorMessage:null,ariaExpanded:kn,ariaFlowTo:Dt,ariaGrabbed:kn,ariaHasPopup:null,ariaHidden:kn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dt,ariaLevel:Se,ariaLive:null,ariaModal:kn,ariaMultiLine:kn,ariaMultiSelectable:kn,ariaOrientation:null,ariaOwns:Dt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:kn,ariaReadOnly:kn,ariaRelevant:null,ariaRequired:kn,ariaRoleDescription:Dt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:kn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Kj(e,t){return t in e?e[t]:t}function Jj(e,t){return Kj(e,t.toLowerCase())}const NR=Po({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ll,acceptCharset:Dt,accessKey:Dt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alpha:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Dt,autoFocus:Je,autoPlay:Je,blocking:Dt,capture:null,charSet:null,checked:Je,cite:null,className:Dt,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:kn,controls:Je,controlsList:Dt,coords:Se|ll,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:lx,draggable:kn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Dt,height:Se,hidden:lx,high:Se,href:null,hrefLang:null,htmlFor:Dt,httpEquiv:Dt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Dt,itemRef:Dt,itemScope:Je,itemType:Dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Je,muted:Je,name:null,nonce:null,noModule:Je,noValidate:Je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Je,optimum:Se,pattern:null,ping:Dt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Dt,required:Je,reversed:Je,rows:Se,rowSpan:Se,sandbox:Dt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootCustomElementRegistry:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shadowRootSerializable:Je,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:kn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:kn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Je,declare:Je,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:kn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Je,disablePictureInPicture:Je,disableRemotePlayback:Je,exportParts:ll,part:Dt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Jj}),CR=Po({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:$s,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Dt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ll,g2:ll,glyphName:ll,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:$s,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$s,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$s,rev:$s,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$s,requiredFeatures:$s,requiredFonts:$s,requiredFormats:$s,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:$s,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$s,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$s,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Kj}),eN=Po({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),tN=Po({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jj}),nN=Po({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ER={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},TR=/[A-Z]/g,W5=/-[a-z]/g,MR=/^data[-\w.:]+$/i;function AR(e,t){const n=ax(t);let i=t,a=Ss;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&MR.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(W5,OR);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!W5.test(o)){let u=o.replace(TR,RR);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=ev}return new a(i,t)}function RR(e){return"-"+e.toLowerCase()}function OR(e){return e.charAt(1).toUpperCase()}const LR=Wj([Zj,NR,eN,tN,nN],"html"),tv=Wj([Zj,CR,eN,tN,nN],"svg");function DR(e){return e.join(" ").trim()}var uo={},Jg,Z5;function zR(){if(Z5)return Jg;Z5=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,f=`
|
|
73
|
+
`,p="/",g="*",v="",b="comment",y="declaration";function _(N,S){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];S=S||{};var C=1,E=1;function R(Q){var V=Q.match(t);V&&(C+=V.length);var G=Q.lastIndexOf(f);E=~G?Q.length-G:E+Q.length}function A(){var Q={line:C,column:E};return function(V){return V.position=new O(Q),Z(),V}}function O(Q){this.start=Q,this.end={line:C,column:E},this.source=S.source}O.prototype.content=N;function P(Q){var V=new Error(S.source+":"+C+":"+E+": "+Q);if(V.reason=Q,V.filename=S.source,V.line=C,V.column=E,V.source=N,!S.silent)throw V}function z(Q){var V=Q.exec(N);if(V){var G=V[0];return R(G),N=N.slice(G.length),V}}function Z(){z(n)}function I(Q){var V;for(Q=Q||[];V=q();)V!==!1&&Q.push(V);return Q}function q(){var Q=A();if(!(p!=N.charAt(0)||g!=N.charAt(1))){for(var V=2;v!=N.charAt(V)&&(g!=N.charAt(V)||p!=N.charAt(V+1));)++V;if(V+=2,v===N.charAt(V-1))return P("End of comment missing");var G=N.slice(2,V-2);return E+=2,R(G),N=N.slice(V),E+=2,Q({type:b,comment:G})}}function L(){var Q=A(),V=z(i);if(V){if(q(),!z(a))return P("property missing ':'");var G=z(o),H=Q({type:y,property:j(V[0].replace(e,v)),value:G?j(G[0].replace(e,v)):v});return z(u),H}}function de(){var Q=[];I(Q);for(var V;V=L();)V!==!1&&(Q.push(V),I(Q));return Q}return Z(),de()}function j(N){return N?N.replace(h,v):v}return Jg=_,Jg}var K5;function $R(){if(K5)return uo;K5=1;var e=uo&&uo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(uo,"__esModule",{value:!0}),uo.default=n;const t=e(zR());function n(i,a){let o=null;if(!i||typeof i!="string")return o;const u=(0,t.default)(i),h=typeof a=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:g}=f;h?a(p,g,f):g&&(o=o||{},o[p]=g)}),o}return uo}var Zc={},J5;function PR(){if(J5)return Zc;J5=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(p){return!p||n.test(p)||e.test(p)},u=function(p,g){return g.toUpperCase()},h=function(p,g){return"".concat(g,"-")},f=function(p,g){return g===void 0&&(g={}),o(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(a,h):p=p.replace(i,h),p.replace(t,u))};return Zc.camelCase=f,Zc}var Kc,e2;function BR(){if(e2)return Kc;e2=1;var e=Kc&&Kc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e($R()),n=PR();function i(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(h,f){h&&f&&(u[(0,n.camelCase)(h,o)]=f)}),u}return i.default=i,Kc=i,Kc}var FR=BR();const IR=wx(FR),sN=iN("end"),nv=iN("start");function iN(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function UR(e){const t=nv(e),n=sN(e);if(t&&n)return{start:t,end:n}}function bu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?t2(e.position):"start"in e||"end"in e?t2(e):"line"in e||"column"in e?cx(e):""}function cx(e){return n2(e&&e.line)+":"+n2(e&&e.column)}function t2(e){return cx(e&&e.start)+"-"+cx(e&&e.end)}function n2(e){return e&&typeof e=="number"?e:1}class Kn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?o.ruleId=i:(o.source=i.slice(0,f),o.ruleId=i.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const h=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=h?h.line:void 0,this.name=bu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Kn.prototype.file="";Kn.prototype.name="";Kn.prototype.reason="";Kn.prototype.message="";Kn.prototype.stack="";Kn.prototype.column=void 0;Kn.prototype.line=void 0;Kn.prototype.ancestors=void 0;Kn.prototype.cause=void 0;Kn.prototype.fatal=void 0;Kn.prototype.place=void 0;Kn.prototype.ruleId=void 0;Kn.prototype.source=void 0;const sv={}.hasOwnProperty,HR=new Map,qR=/[A-Z]/g,VR=new Set(["table","tbody","thead","tfoot","tr"]),GR=new Set(["td","th"]),rN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function YR(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=t7(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=e7(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?tv:LR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=aN(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function aN(e,t,n){if(t.type==="element")return XR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return QR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ZR(e,t,n);if(t.type==="mdxjsEsm")return WR(e,t);if(t.type==="root")return KR(e,t,n);if(t.type==="text")return JR(e,t)}function XR(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=tv,e.schema=a),e.ancestors.push(t);const o=oN(e,t.tagName,!1),u=n7(e,t);let h=rv(e,t);return VR.has(t.tagName)&&(h=h.filter(function(f){return typeof f=="string"?!kR(f):!0})),lN(e,u,o,t),iv(u,h),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function QR(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Ou(e,t.position)}function WR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ou(e,t.position)}function ZR(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=tv,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:oN(e,t.name,!0),u=s7(e,t),h=rv(e,t);return lN(e,u,o,t),iv(u,h),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function KR(e,t,n){const i={};return iv(i,rv(e,t)),e.create(t,e.Fragment,i,n)}function JR(e,t){return t.value}function lN(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function iv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function e7(e,t,n){return i;function i(a,o,u,h){const p=Array.isArray(u.children)?n:t;return h?p(o,u,h):p(o,u)}}function t7(e,t){return n;function n(i,a,o,u){const h=Array.isArray(o.children),f=nv(i);return t(a,o,u,h,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function n7(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&sv.call(t.properties,a)){const o=i7(e,a,t.properties[a]);if(o){const[u,h]=o;e.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&GR.has(t.tagName)?i=h:n[u]=h}}if(i){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function s7(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const u=o.expression;u.type;const h=u.properties[0];h.type,Object.assign(n,e.evaluater.evaluateExpression(h.argument))}else Ou(e,t.position);else{const a=i.name;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const h=i.value.data.estree.body[0];h.type,o=e.evaluater.evaluateExpression(h.expression)}else Ou(e,t.position);else o=i.value===null?!0:i.value;n[a]=o}return n}function rv(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:HR;for(;++i<t.children.length;){const o=t.children[i];let u;if(e.passKeys){const f=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(f){const p=a.get(f)||0;u=f+"-"+p,a.set(f,p+1)}}const h=aN(e,o,u);h!==void 0&&n.push(h)}return n}function i7(e,t,n){const i=AR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?bR(n):DR(n)),i.property==="style"){let a=typeof n=="object"?n:r7(e,String(n));return e.stylePropertyNameCase==="css"&&(a=a7(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?ER[i.property]||i.property:i.attribute,n]}}function r7(e,t){try{return IR(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Kn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=rN+"#cannot-parse-style-attribute",a}}function oN(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const h=Y5(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(o&&h.type==="Literal"),optional:!1}:h}i=u}else i=Y5(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return sv.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Ou(e)}function Ou(e,t){const n=new Kn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=rN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function a7(e){const t={};let n;for(n in e)sv.call(e,n)&&(t[l7(n)]=e[n]);return t}function l7(e){let t=e.replace(qR,o7);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function o7(e){return"-"+e.toLowerCase()}const e0={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},c7={};function av(e,t){const n=c7,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return cN(e,i,a)}function cN(e,t,n){if(u7(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return s2(e.children,t,n)}return Array.isArray(e)?s2(e,t,n):""}function s2(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=cN(e[a],t,n);return i.join("")}function u7(e){return!!(e&&typeof e=="object")}const i2=document.createElement("i");function lv(e){const t="&"+e+";";i2.innerHTML=t;const n=i2.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xi(e,t,n,i){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<i.length;)u=i.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Js(e,t){return e.length>0?(xi(e,e.length,0,t),e):t}const r2={}.hasOwnProperty;function uN(e){const t={};let n=-1;for(;++n<e.length;)d7(t,e[n]);return t}function d7(e,t){let n;for(n in t){const a=(r2.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){r2.call(a,u)||(a[u]=[]);const h=o[u];h7(a[u],Array.isArray(h)?h:h?[h]:[])}}}function h7(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);xi(e,0,0,i)}function dN(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function vi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const us=ba(/[A-Za-z]/),Wn=ba(/[\dA-Za-z]/),f7=ba(/[#-'*+\--9=?A-Z^-~]/);function hf(e){return e!==null&&(e<32||e===127)}const ux=ba(/\d/),p7=ba(/[\dA-Fa-f]/),m7=ba(/[!-/:-@[-`{-~]/);function Ve(e){return e!==null&&e<-2}function Bt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const Nf=ba(new RegExp("\\p{P}|\\p{S}","u")),dl=ba(/\s/);function ba(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Bo(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Wn(e.charCodeAt(n+1))&&Wn(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const h=e.charCodeAt(n+1);o<56320&&h>56319&&h<57344?(u=String.fromCharCode(o,h),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function kt(e,t,n,i){const a=i?i-1:1/0;let o=0;return u;function u(f){return ot(f)?(e.enter(n),h(f)):t(f)}function h(f){return ot(f)&&o++<a?(e.consume(f),h):(e.exit(n),t(f))}}function hN(e,t,n,i,a,o){let u=0;return h;function h(g){return ot(g)?(e.enter(i),f(g)):p(g)}function f(g){return ot(g)&&u<o?(e.consume(g),u++,f):(e.exit(i),p(g))}function p(g){return u>=a?t(g):n(g)}}const g7={tokenize:x7};function x7(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),kt(e,t,"linePrefix")}function a(h){return e.enter("paragraph"),o(h)}function o(h){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(h)}function u(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ve(h)?(e.consume(h),e.exit("chunkText"),o):(e.consume(h),u)}}let ff=class{constructor(){this.index=new Map,this.map=[]}add(t,n,i){a2(this,t,n,i,!1)}addBefore(t,n,i){a2(this,t,n,i,!0)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0,this.index.clear()}};function a2(e,t,n,i,a){if(n===0&&i.length===0)return;const o=e.index.get(t);if(o){o[1]+=n,a?(i.push(...o[2]),o[2]=i):o[2].push(...i);return}const u=[t,n,i];e.map.push(u),e.index.set(t,u)}const v7={tokenize:b7},l2={tokenize:y7};function b7(e){const t=this,n=[];let i=0,a,o,u;return h;function h(E){if(i<n.length){const R=n[i];return t.containerState=R[1],e.attempt(R[0].continuation,f,p)(E)}return p(E)}function f(E){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const R=t.events.length;let A=R,O;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){O=t.events[A][1].end;break}S(i);let P=R;for(;P<t.events.length;)t.events[P][1].end={...O},P++;const z=new ff;return z.add(A+1,0,t.events.slice(R)),z.add(R,P-R,[]),z.consume(t.events),p(E)}return h(E)}function p(E){if(i===n.length){if(!a)return b(E);if(a.currentConstruct&&a.currentConstruct.concrete)return _(E);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(l2,g,v)(E)}function g(E){return a&&C(),S(i),b(E)}function v(E){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(E)}function b(E){return t.containerState={},e.attempt(l2,y,_)(E)}function y(E){return i++,n.push([t.currentConstruct,t.containerState]),b(E)}function _(E){if(E===null){a&&C(),S(0),e.consume(E);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),j(E)}function j(E){if(E===null){N(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return Ve(E)?(e.consume(E),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,h):(e.consume(E),j)}function N(E,R){const A=t.sliceStream(E);if(R&&A.push(null),E.previous=o,o&&(o.next=E),o=E,a.defineSkip(E.start),a.write(A),t.parser.lazy[E.start.line]){let O=a.events.length;for(;O--;)if(a.events[O][1].start.offset<u&&(!a.events[O][1].end||a.events[O][1].end.offset>u))return;const P=t.events.length;let z=P,Z,I;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(Z){I=t.events[z][1].end;break}Z=!0}for(S(i),O=P;O<t.events.length;)t.events[O][1].end={...I},O++;const q=new ff;q.add(z+1,0,t.events.slice(P)),q.add(P,O-P,[]),q.consume(t.events)}}function S(E){let R=n.length;for(;R-- >E;){const A=n[R];t.containerState=A[1],A[0].exit.call(t,e)}n.length=E}function C(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function y7(e,t,n){return kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function pf(e){if(e===null||Bt(e)||dl(e))return 1;if(Nf(e))return 2}function Cf(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!i.includes(o)&&(t=o(t,n),i.push(o))}return t}const dx={name:"attention",resolveAll:_7,tokenize:w7};function _7(e,t){let n=-1,i;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let a=n;for(;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const o=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,u={...e[a][1].end},h={...e[n][1].start};o2(u,-o),o2(h,o);const f={type:o>1?"strongSequence":"emphasisSequence",start:u,end:{...e[a][1].end}},p={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},g={type:o>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},v={type:o>1?"strong":"emphasis",start:{...f.start},end:{...p.end}};e[a][1].end={...f.start},e[n][1].start={...p.end},i=[],e[a][1].end.offset-e[a][1].start.offset&&(i=Js(i,[["enter",e[a][1],t],["exit",e[a][1],t]])),i=Js(i,[["enter",v,t],["enter",f,t],["exit",f,t],["enter",g,t]]),i=Js(i,Cf(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),i=Js(i,[["exit",g,t],["enter",p,t],["exit",p,t],["exit",v,t]]);let b=0;e[n][1].end.offset-e[n][1].start.offset&&(b=2,i=Js(i,[["enter",e[n][1],t],["exit",e[n][1],t]])),xi(e,a-1,n-a+3,i),n=a+i.length-b-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function w7(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=pf(i);let o;return u;function u(f){return o=f,e.enter("attentionSequence"),h(f)}function h(f){if(f===o)return e.consume(f),h;const p=e.exit("attentionSequence"),g=pf(f),v=!g||g===2&&a||n.includes(f)&&f!==42&&f!==95,b=!a||a===2&&g||n.includes(i)&&i!==42&&i!==95;return p._open=!!(o===42?v:v&&(a||!b)),p._close=!!(o===42?b:b&&(g||!v)),t(f)}}function o2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const S7={name:"autolink",tokenize:k7};function k7(e,t,n){let i=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return us(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||Wn(y)?(i=1,h(y)):p(y)}function h(y){return y===58?(e.consume(y),i=0,f):(y===43||y===45||y===46||Wn(y))&&i++<32?(e.consume(y),h):(i=0,p(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||hf(y)?n(y):(e.consume(y),f)}function p(y){return y===64?(e.consume(y),g):f7(y)?(e.consume(y),p):n(y)}function g(y){return Wn(y)?v(y):n(y)}function v(y){return y===46?(e.consume(y),i=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Wn(y))&&i++<63){const _=y===45?b:v;return e.consume(y),_}return n(y)}}const Pu={partial:!0,tokenize:j7};function j7(e,t,n){return i;function i(o){return ot(o)?kt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Ve(o)?t(o):n(o)}}const fN={continuation:{tokenize:C7},exit:E7,name:"blockQuote",tokenize:N7};function N7(e,t,n){const i=this;return a;function a(u){if(u===62){const h=i.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function C7(e,t,n){const i=this;return a;function a(u){return ot(u)?kt(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(fN,t,n)(u)}}function E7(e){e.exit("blockQuote")}const pN={name:"characterEscape",tokenize:T7};function T7(e,t,n){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return m7(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const mN={name:"characterReference",tokenize:M7};function M7(e,t,n){const i=this;let a=0,o,u;return h;function h(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),f}function f(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Wn,g(v))}function p(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=p7,g):(e.enter("characterReferenceValue"),o=7,u=ux,g(v))}function g(v){if(v===59&&a){const b=e.exit("characterReferenceValue");return u===Wn&&!lv(i.sliceSerialize(b))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<o?(e.consume(v),g):n(v)}}const hx={partial:!0,tokenize:A7};function A7(e,t,n){const i=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const c2={concrete:!0,name:"codeFenced",tokenize:R7};function R7(e,t,n){const i=this,a={partial:!0,tokenize:A};let o=0,u=0,h;return f;function f(O){return p(O)}function p(O){const P=i.events[i.events.length-1];return o=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,h=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(O)}function g(O){return O===h?(u++,e.consume(O),g):u<3?n(O):(e.exit("codeFencedFenceSequence"),ot(O)?kt(e,v,"whitespace")(O):v(O))}function v(O){return O===null||Ve(O)?(e.exit("codeFencedFence"),i.interrupt?t(O):e.check(hx,j,R)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ve(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(O)):ot(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),kt(e,y,"whitespace")(O)):O===96&&O===h?n(O):(e.consume(O),b)}function y(O){return O===null||Ve(O)?v(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(O))}function _(O){return O===null||Ve(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(O)):O===96&&O===h?n(O):(e.consume(O),_)}function j(O){return e.attempt(a,R,N)(O)}function N(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),S}function S(O){return o>0&&ot(O)?kt(e,C,"linePrefix",o+1)(O):C(O)}function C(O){return O===null||Ve(O)?e.check(hx,j,R)(O):(e.enter("codeFlowValue"),E(O))}function E(O){return O===null||Ve(O)?(e.exit("codeFlowValue"),C(O)):(e.consume(O),E)}function R(O){return e.exit("codeFenced"),t(O)}function A(O,P,z){let Z=0;return I;function I(V){return O.enter("lineEnding"),O.consume(V),O.exit("lineEnding"),q}function q(V){return O.enter("codeFencedFence"),ot(V)?kt(O,L,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):L(V)}function L(V){return V===h?(O.enter("codeFencedFenceSequence"),de(V)):z(V)}function de(V){return V===h?(Z++,O.consume(V),de):Z>=u?(O.exit("codeFencedFenceSequence"),ot(V)?kt(O,Q,"whitespace")(V):Q(V)):z(V)}function Q(V){return V===null||Ve(V)?(O.exit("codeFencedFence"),P(V)):z(V)}}}const t0={name:"codeIndented",tokenize:L7},O7={partial:!0,tokenize:D7};function L7(e,t,n){return i;function i(h){return e.enter("codeIndented"),hN(e,a,n,"linePrefix",4,4)(h)}function a(h){return h===null?u(h):Ve(h)?e.attempt(O7,a,u)(h):(e.enter("codeFlowValue"),o(h))}function o(h){return h===null||Ve(h)?(e.exit("codeFlowValue"),a(h)):(e.consume(h),o)}function u(h){return e.exit("codeIndented"),t(h)}}function D7(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):Ve(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):hN(e,t,o,"linePrefix",4,4)(u)}function o(u){return Ve(u)?a(u):n(u)}}const z7={name:"codeText",previous:P7,resolve:$7,tokenize:B7};function $7(e){let t=e.length-4,n=3,i,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function P7(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function B7(e,t,n){let i=0,a,o;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),h(v)}function h(v){return v===96?(e.consume(v),i++,h):(e.exit("codeTextSequence"),f(v))}function f(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),f):v===96?(o=e.enter("codeTextSequence"),a=0,g(v)):Ve(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(v))}function p(v){return v===null||v===32||v===96||Ve(v)?(e.exit("codeTextData"),f(v)):(e.consume(v),p)}function g(v){return v===96?(e.consume(v),a++,g):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(o.type="codeTextData",p(v))}}class F7{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&Jc(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Jc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Jc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jc(this.left,n.reverse())}}}function Jc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gN(e){const t={};let n=-1,i,a,o,u,h,f,p;const g=new F7(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,o=0,o<f.length&&f[o][1].type==="lineEndingBlank"&&(o+=2),o<f.length&&f[o][1].type==="content"))for(;++o<f.length&&f[o][1].type!=="content";)f[o][1].type==="chunkText"&&(f[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,I7(g,n)),n=t[n],p=!0);else if(i[1]._container){for(o=n,a=void 0;o--;)if(u=g.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...g.get(a)[1].start},h=g.slice(a,n),h.unshift(i),g.splice(a,n-a+1,h))}}return xi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function I7(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,f=[],p={};let g,v,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(g=i.sliceStream(y),y.next||g.push(null),v&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=y,y=y.next}for(y=n;++b<h.length;)h[b][0]==="exit"&&h[b-1][0]==="enter"&&h[b][1].type===h[b-1][1].type&&h[b][1].start.line!==h[b][1].end.line&&(j=b+1,N.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):N.pop(),b=N.length;b--;){const S=h.slice(N[b],N[b+1]),C=o.pop();f.push([C,C+S.length-1]),e.splice(C,2,S)}for(f.reverse(),b=-1;++b<f.length;)p[_+f[b][0]]=_+f[b][1],_+=f[b][1]-f[b][0]-1;return p}const U7={resolve:q7,tokenize:V7},H7={partial:!0,tokenize:G7};function q7(e){return gN(e),e}function V7(e,t){let n;return i;function i(h){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(h)}function a(h){return h===null?o(h):Ve(h)?e.check(H7,u,o)(h):(e.consume(h),a)}function o(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function u(h){return e.consume(h),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function G7(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),kt(e,o,"linePrefix")}function o(u){if(u===null||Ve(u))return n(u);const h=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function xN(e,t,n,i,a,o,u,h,f){const p=f||Number.POSITIVE_INFINITY;let g=0;return v;function v(S){return S===60?(e.enter(i),e.enter(a),e.enter(o),e.consume(S),e.exit(o),b):S===null||S===32||S===41||hf(S)?n(S):(e.enter(i),e.enter(u),e.enter(h),e.enter("chunkString",{contentType:"string"}),j(S))}function b(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(a),e.exit(i),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===62?(e.exit("chunkString"),e.exit(h),b(S)):S===null||S===60||Ve(S)?n(S):(e.consume(S),S===92?_:y)}function _(S){return S===60||S===62||S===92?(e.consume(S),y):y(S)}function j(S){return!g&&(S===null||S===41||Bt(S))?(e.exit("chunkString"),e.exit(h),e.exit(u),e.exit(i),t(S)):g<p&&S===40?(e.consume(S),g++,j):S===41?(e.consume(S),g--,j):S===null||S===32||S===40||hf(S)?n(S):(e.consume(S),S===92?N:j)}function N(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function vN(e,t,n,i,a,o){const u=this;let h=0,f;return p;function p(y){return e.enter(i),e.enter(a),e.consume(y),e.exit(a),e.enter(o),g}function g(y){return h>999||y===null||y===91||y===93&&!f||y===94&&!h&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):Ve(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===null||y===91||y===93||Ve(y)||h++>999?(e.exit("chunkString"),g(y)):(e.consume(y),f||(f=!ot(y)),y===92?b:v)}function b(y){return y===91||y===92||y===93?(e.consume(y),h++,v):v(y)}}function bN(e,t,n,i,a,o){let u;return h;function h(b){return b===34||b===39||b===40?(e.enter(i),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,f):n(b)}function f(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):(e.enter(o),p(b))}function p(b){return b===u?(e.exit(o),f(u)):b===null?n(b):Ve(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),kt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===u||b===null||Ve(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?v:g)}function v(b){return b===u||b===92?(e.consume(b),g):g(b)}}function yu(e,t){let n;return i;function i(a){return Ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):ot(a)?kt(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const Y7={name:"definition",tokenize:Q7},X7={partial:!0,tokenize:W7};function Q7(e,t,n){const i=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return vN.call(i,e,h,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return a=vi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return Bt(y)?yu(e,p)(y):p(y)}function p(y){return xN(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(X7,v,v)(y)}function v(y){return ot(y)?kt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Ve(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):n(y)}}function W7(e,t,n){return i;function i(h){return Bt(h)?yu(e,a)(h):n(h)}function a(h){return bN(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function o(h){return ot(h)?kt(e,u,"whitespace")(h):u(h)}function u(h){return h===null||Ve(h)?t(h):n(h)}}const Z7={name:"hardBreakEscape",tokenize:K7};function K7(e,t,n){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Ve(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const J7={name:"headingAtx",resolve:eO,tokenize:tO};function eO(e,t){let n=e.length-2,i=3;if(e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i){const a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},o={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"};xi(e,i,n-i+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])}return e}function tO(e,t,n){let i=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Bt(g)?(e.exit("atxHeadingSequence"),h(g)):n(g)}function h(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Ve(g)?(e.exit("atxHeading"),t(g)):ot(g)?kt(e,h,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),h(g))}function p(g){return g===null||g===35||Bt(g)?(e.exit("atxHeadingText"),h(g)):(e.consume(g),p)}}const nO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],u2=["pre","script","style","textarea"],sO={concrete:!0,name:"htmlFlow",resolveTo:rO,tokenize:aO},iO={partial:!0,tokenize:lO};function rO(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function aO(e,t,n){const i=this;let a,o,u,h,f;return p;function p($){return g($)}function g($){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume($),v}function v($){return $===33?(e.consume($),b):$===47?(e.consume($),o=!0,j):$===63?(e.consume($),a=3,i.interrupt?t:T):us($)?(e.consume($),u=String.fromCharCode($),N):n($)}function b($){return $===45?(e.consume($),a=2,y):$===91?(e.consume($),a=5,h=0,_):us($)?(e.consume($),a=4,i.interrupt?t:T):n($)}function y($){return $===45?(e.consume($),i.interrupt?t:T):n($)}function _($){const B="CDATA[";return $===B.charCodeAt(h++)?(e.consume($),h===B.length?i.interrupt?t:L:_):n($)}function j($){return us($)?(e.consume($),u=String.fromCharCode($),N):n($)}function N($){if($===null||$===47||$===62||Bt($)){const B=$===47,oe=u.toLowerCase();return!B&&!o&&u2.includes(oe)?(a=1,i.interrupt?t($):L($)):nO.includes(u.toLowerCase())?(a=6,B?(e.consume($),S):i.interrupt?t($):L($)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n($):o?C($):E($))}return $===45||Wn($)?(e.consume($),u+=String.fromCharCode($),N):n($)}function S($){return $===62?(e.consume($),i.interrupt?t:L):n($)}function C($){return ot($)?(e.consume($),C):I($)}function E($){return $===47?(e.consume($),I):$===58||$===95||us($)?(e.consume($),R):ot($)?(e.consume($),E):I($)}function R($){return $===45||$===46||$===58||$===95||Wn($)?(e.consume($),R):A($)}function A($){return $===61?(e.consume($),O):ot($)?(e.consume($),A):E($)}function O($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),f=$,P):ot($)?(e.consume($),O):z($)}function P($){return $===f?(e.consume($),f=null,Z):$===null||Ve($)?n($):(e.consume($),P)}function z($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||Bt($)?A($):(e.consume($),z)}function Z($){return $===47||$===62||ot($)?E($):n($)}function I($){return $===62?(e.consume($),q):n($)}function q($){return $===null||Ve($)?L($):ot($)?(e.consume($),q):n($)}function L($){return $===45&&a===2?(e.consume($),G):$===60&&a===1?(e.consume($),H):$===62&&a===4?(e.consume($),Ne):$===63&&a===3?(e.consume($),T):$===93&&a===5?(e.consume($),ye):Ve($)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(iO,Ce,de)($)):$===null||Ve($)?(e.exit("htmlFlowData"),de($)):(e.consume($),L)}function de($){return e.check(hx,Q,Ce)($)}function Q($){return e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),V}function V($){return $===null||Ve($)?de($):(e.enter("htmlFlowData"),L($))}function G($){return $===45?(e.consume($),T):L($)}function H($){return $===47?(e.consume($),u="",ae):L($)}function ae($){if($===62){const B=u.toLowerCase();return u2.includes(B)?(e.consume($),Ne):L($)}return us($)&&u.length<8?(e.consume($),u+=String.fromCharCode($),ae):L($)}function ye($){return $===93?(e.consume($),T):L($)}function T($){return $===62?(e.consume($),Ne):$===45&&a===2?(e.consume($),T):L($)}function Ne($){return $===null||Ve($)?(e.exit("htmlFlowData"),Ce($)):(e.consume($),Ne)}function Ce($){return e.exit("htmlFlow"),t($)}}function lO(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Pu,t,n)}}const oO={name:"htmlText",tokenize:cO};function cO(e,t,n){const i=this;let a,o,u;return h;function h(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),f}function f(T){return T===33?(e.consume(T),p):T===47?(e.consume(T),A):T===63?(e.consume(T),E):us(T)?(e.consume(T),z):n(T)}function p(T){return T===45?(e.consume(T),g):T===91?(e.consume(T),o=0,_):us(T)?(e.consume(T),C):n(T)}function g(T){return T===45?(e.consume(T),y):n(T)}function v(T){return T===null?n(T):T===45?(e.consume(T),b):Ve(T)?(u=v,H(T)):(e.consume(T),v)}function b(T){return T===45?(e.consume(T),y):v(T)}function y(T){return T===62?G(T):T===45?b(T):v(T)}function _(T){const Ne="CDATA[";return T===Ne.charCodeAt(o++)?(e.consume(T),o===Ne.length?j:_):n(T)}function j(T){return T===null?n(T):T===93?(e.consume(T),N):Ve(T)?(u=j,H(T)):(e.consume(T),j)}function N(T){return T===93?(e.consume(T),S):j(T)}function S(T){return T===62?G(T):T===93?(e.consume(T),S):j(T)}function C(T){return T===null||T===62?G(T):Ve(T)?(u=C,H(T)):(e.consume(T),C)}function E(T){return T===null?n(T):T===63?(e.consume(T),R):Ve(T)?(u=E,H(T)):(e.consume(T),E)}function R(T){return T===62?G(T):E(T)}function A(T){return us(T)?(e.consume(T),O):n(T)}function O(T){return T===45||Wn(T)?(e.consume(T),O):P(T)}function P(T){return Ve(T)?(u=P,H(T)):ot(T)?(e.consume(T),P):G(T)}function z(T){return T===45||Wn(T)?(e.consume(T),z):T===47||T===62||Bt(T)?Z(T):n(T)}function Z(T){return T===47?(e.consume(T),G):T===58||T===95||us(T)?(e.consume(T),I):Ve(T)?(u=Z,H(T)):ot(T)?(e.consume(T),Z):G(T)}function I(T){return T===45||T===46||T===58||T===95||Wn(T)?(e.consume(T),I):q(T)}function q(T){return T===61?(e.consume(T),L):Ve(T)?(u=q,H(T)):ot(T)?(e.consume(T),q):Z(T)}function L(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),a=T,de):Ve(T)?(u=L,H(T)):ot(T)?(e.consume(T),L):(e.consume(T),Q)}function de(T){return T===a?(e.consume(T),a=void 0,V):T===null?n(T):Ve(T)?(u=de,H(T)):(e.consume(T),de)}function Q(T){return T===null||T===34||T===39||T===60||T===61||T===96?n(T):T===47||T===62||Bt(T)?Z(T):(e.consume(T),Q)}function V(T){return T===47||T===62||Bt(T)?Z(T):n(T)}function G(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):n(T)}function H(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),ae}function ae(T){return ot(T)?kt(e,ye,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):ye(T)}function ye(T){return e.enter("htmlTextData"),u(T)}}const ov={name:"labelEnd",resolveAll:fO,resolveTo:pO,tokenize:mO},uO={tokenize:gO},dO={tokenize:xO},hO={tokenize:vO};function fO(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&xi(e,0,e.length,n),e}function pO(e,t){let n=e.length,i=0,a,o,u;for(;n--;){const g=e[n][1];if(a){if(g.type==="link"||g.type==="labelLink"&&g._inactive)break;e[n][0]==="enter"&&g.type==="labelLink"&&(g._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(g.type==="labelImage"||g.type==="labelLink")&&!g._balanced&&(a=n,g.type!=="labelLink")){i=2;break}}else g.type==="labelEnd"&&(o=n)}const h={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},p={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[o-2][1].start}};return u=[["enter",h,t],["enter",f,t]],u=Js(u,e.slice(a+1,a+i+3)),u=Js(u,[["enter",p,t]]),u=Js(u,Cf(t.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),t)),u=Js(u,[["exit",p,t],e[o-2],e[o-1],["exit",f,t]]),u=Js(u,e.slice(o+1)),u=Js(u,[["exit",h,t]]),xi(e,a,e.length,u),e}function mO(e,t,n){const i=this,a=i._labelStarts;let o,u;if(a){for(;a.length>0&&a[a.length-1]._balanced;)a.pop();o=a[a.length-1]}return h;function h(b){return o?o._inactive?v(b):(u=i.parser.defined.includes(vi(i.sliceSerialize({start:o.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),f):n(b)}function f(b){return b===40?e.attempt(uO,g,u?g:v)(b):b===91?e.attempt(dO,g,u?p:v)(b):u?g(b):v(b)}function p(b){return e.attempt(hO,g,v)(b)}function g(b){return a.pop(),t(b)}function v(b){return o._balanced=!0,n(b)}}function gO(e,t,n){return i;function i(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return Bt(v)?yu(e,o)(v):o(v)}function o(v){return v===41?g(v):xN(e,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Bt(v)?yu(e,f)(v):g(v)}function h(v){return n(v)}function f(v){return v===34||v===39||v===40?bN(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function p(v){return Bt(v)?yu(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function xO(e,t,n){const i=this;return a;function a(h){return vN.call(i,e,o,u,"reference","referenceMarker","referenceString")(h)}function o(h){return i.parser.defined.includes(vi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(h):n(h)}function u(h){return n(h)}}function vO(e,t,n){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const bO={name:"labelStartImage",resolveAll:ov.resolveAll,tokenize:yO};function yO(e,t,n){const i=this;let a;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),a=e.exit("labelImage"),h):n(f)}function h(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(a),t(f))}}const _O={name:"labelStartLink",resolveAll:ov.resolveAll,tokenize:wO};function wO(e,t,n){const i=this;let a;return o;function o(h){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),a=e.exit("labelLink"),u}function u(h){return h===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(a),t(h))}}const n0={name:"lineEnding",tokenize:SO};function SO(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),kt(e,t,"linePrefix")}}const Ih={name:"thematicBreak",tokenize:kO};function kO(e,t,n){let i=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,h(p)}function h(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):i>=3&&(p===null||Ve(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),i++,f):(e.exit("thematicBreakSequence"),ot(p)?kt(e,h,"whitespace")(p):h(p))}}const ys={continuation:{tokenize:EO},exit:MO,name:"list",tokenize:CO},jO={partial:!0,tokenize:AO},NO={partial:!0,tokenize:TO};function CO(e,t,n){const i=this,a=i.events[i.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return h;function h(y){const _=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:ux(y)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Ih,n,p)(y):p(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return ux(y)&&++u<10?(e.consume(y),f):(!i.interrupt||u<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):n(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(Pu,i.interrupt?n:g,e.attempt(jO,b,v))}function g(y){return i.containerState.initialBlankLine=!0,o++,b(y)}function v(y){return ot(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function EO(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Pu,a,o);function a(h){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,kt(e,t,"listItemIndent",i.containerState.size+1)(h)}function o(h){return i.containerState.furtherBlankLines||!ot(h)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(h)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(NO,t,u)(h))}function u(h){return i.containerState._closeFlow=!0,i.interrupt=void 0,kt(e,e.attempt(ys,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function TO(e,t,n){const i=this;return kt(e,a,"listItemIndent",i.containerState.size+1);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(o):n(o)}}function MO(e){e.exit(this.containerState.type)}function AO(e,t,n){const i=this;return kt(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=i.events[i.events.length-1];return!ot(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const d2={name:"setextUnderline",resolveTo:RO,tokenize:OO};function RO(e,t){const n=new ff;let i=e.length,a,o,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){a=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&n.add(i,1,[]),!u&&e[i][1].type==="definition"&&(u=i);const h={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(n.add(o,0,[["enter",h,t]]),n.add(u+1,0,[["exit",e[a][1],t]]),e[a][1].end={...e[u][1].end}):e[a][1]=h,n.add(e.length,0,[["exit",h,t]]),n.consume(e),e}function OO(e,t,n){const i=this;let a;return o;function o(p){let g=i.events.length,v;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){v=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||v)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===a?(e.consume(p),h):(e.exit("setextHeadingLineSequence"),ot(p)?kt(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Ve(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const LO={tokenize:DO};function DO(e){const t=this,n=e.attempt(Pu,i,e.attempt(this.parser.constructs.flowInitial,a,kt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(U7,a)),"linePrefix")));return n;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const zO={resolveAll:_N()},$O=yN("string"),PO=yN("text");function yN(e){return{resolveAll:_N(e==="text"?BO:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],o=n.attempt(a,u,h);return u;function u(g){return p(g)?o(g):h(g)}function h(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return p(g)?(n.exit("data"),o(g)):(n.consume(g),f)}function p(g){if(g===null)return!0;const v=a[g];let b=-1;if(v)for(;++b<v.length;){const y=v[b];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function _N(e){return t;function t(n,i){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,i):n}}function BO(e,t){const n=new ff;let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const a=e[i-1][1],o=t.sliceStream(a);let u=o.length,h=-1,f=0,p;for(;u--;){const g=o[u];if(typeof g=="string"){for(h=g.length;g.charCodeAt(h-1)===32;)f++,h--;if(h)break;h=-1}else if(g===-2)p=!0,f++;else if(g!==-1){u++;break}}if(t._contentTypeTextTrailing&&i===e.length&&(f=0),f){const g={type:i===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?h:a.start._bufferIndex+h,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...g.start},a.start.offset===a.end.offset?Object.assign(a,g):n.add(i,0,[["enter",g,t],["exit",g,t]])}i++}return n.consume(e),e}const FO={42:ys,43:ys,45:ys,48:ys,49:ys,50:ys,51:ys,52:ys,53:ys,54:ys,55:ys,56:ys,57:ys,62:fN},IO={91:Y7},UO={[-2]:t0,[-1]:t0,32:t0},HO={35:J7,42:Ih,45:[d2,Ih],60:sO,61:d2,95:Ih,96:c2,126:c2},qO={38:mN,92:pN},VO={[-5]:n0,[-4]:n0,[-3]:n0,33:bO,38:mN,42:dx,60:[S7,oO],91:_O,92:[Z7,pN],93:ov,95:dx,96:z7},GO={null:[dx,zO]},YO={null:[42,95]},XO={null:[]},QO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YO,contentInitial:IO,disable:XO,document:FO,flow:HO,flowInitial:UO,insideSpan:GO,string:qO,text:VO},Symbol.toStringTag,{value:"Module"}));function WO(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],h=[];const f={attempt:P(A),check:P(O),consume:C,enter:E,exit:R,interrupt:P(O,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:v};let g=t.tokenize.call(p,f);return t.resolveAll&&o.push(t),p;function v(q){return u=Js(u,q),N(),u[u.length-1]!==null?[]:(z(t,0),p.events=Cf(o,p.events,p),p.events)}function b(q,L){return KO(y(q),L)}function y(q){return ZO(u,q)}function _(){const{_bufferIndex:q,_index:L,line:de,column:Q,offset:V}=i;return{_bufferIndex:q,_index:L,line:de,column:Q,offset:V}}function j(q){a[q.line]=q.column,I()}function N(){for(;i._index<u.length;){const q=u[i._index];if(typeof q=="string"){const L=i._index;for(i._bufferIndex<0&&(i._bufferIndex=0);i._index===L&&i._bufferIndex<q.length;)S(q.charCodeAt(i._bufferIndex))}else S(q)}}function S(q){g=g(q)}function C(q){Ve(q)?(i.line++,i.column=1,i.offset+=q===-3?2:1,I()):q!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=q}function E(q,L){const de=L||{};return de.type=q,de.start=_(),p.events.push(["enter",de,p]),h.push(de),de}function R(q){const L=h.pop();return L.end=_(),p.events.push(["exit",L,p]),L}function A(q,L){z(q,L.from)}function O(q,L){L.restore()}function P(q,L){return de;function de(Q,V,G){let H,ae,ye,T;return Array.isArray(Q)?Ce(Q):"tokenize"in Q?Ce([Q]):Ne(Q);function Ne(be){return je;function je(Ee){const Be=Ee!==null&&be[Ee],Oe=Ee!==null&&be.null,Te=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(Oe)?Oe:Oe?[Oe]:[]];return Ce(Te)(Ee)}}function Ce(be){return H=be,ae=0,be.length===0?G:$(be[ae])}function $(be){return je;function je(Ee){return T=Z(),ye=be,be.partial||(p.currentConstruct=be),be.name&&p.parser.constructs.disable.null.includes(be.name)?oe():be.tokenize.call(L?Object.assign(Object.create(p),L):p,f,B,oe)(Ee)}}function B(be){return q(ye,T),V}function oe(be){return T.restore(),++ae<H.length?$(H[ae]):G}}}function z(q,L){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&xi(p.events,L,p.events.length-L,q.resolve(p.events.slice(L),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function Z(){const q=_(),L=p.previous,de=p.currentConstruct,Q=p.events.length,V=Array.from(h);return{from:Q,restore:G};function G(){i=q,p.previous=L,p.currentConstruct=de,p.events.length=Q,h=V,I()}}function I(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function ZO(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,o)];else{if(u=e.slice(n,a),i>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(i):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function KO(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
|
|
74
|
+
`;break}case-3:{u=`\r
|
|
75
|
+
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(o)}a=o===-2,i.push(u)}return i.join("")}function JO(e){const i={constructs:uN([QO,...(e||{}).extensions||[]]),content:a(g7),defined:[],document:a(v7),flow:a(LO),lazy:{},string:a($O),text:a(PO)};return i;function a(o){return u;function u(h){return WO(i,o,h)}}}function eL(e){for(;!gN(e););return e}const h2=/[\0\t\n\r]/g;function tL(){let e=1,t="",n=!0,i;return a;function a(o,u,h){o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o));const f=[];let p=0;for(t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){h2.lastIndex=p;const g=h2.exec(o),v=g&&g.index!==void 0?g.index:o.length,b=o.charCodeAt(v);if(!g){t=o.slice(p);break}if(b===10&&p===v&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),p<v&&(f.push(o.slice(p,v)),e+=v-p),b){case 0:{f.push(65533),e++;break}case 9:{const y=Math.ceil(e/4)*4;for(f.push(-2);e++<y;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}p=v+1}return h&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const nL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sL(e){return e.replace(nL,iL)}function iL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return dN(n.slice(o?2:1),o?16:10)}return lv(n)||e}const wN={}.hasOwnProperty;function rL(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),aL(n)(eL(JO(n).document().write(tL()(e,t,!0))))}function aL(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Zt),autolinkProtocol:I,autolinkEmail:I,atxHeading:u(St),blockQuote:u(Te),characterEscape:I,characterReference:I,codeFenced:u(Re),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:u(Re,h),codeText:u(Ft,h),codeTextData:I,data:I,codeFlowValue:I,definition:u(vn),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:u(Vt),hardBreakEscape:u(wt),hardBreakTrailing:u(wt),htmlFlow:u(We,h),htmlFlowData:I,htmlText:u(We,h),htmlTextData:I,image:u(xt),label:h,link:u(Zt),listItem:u(ke),listItemValue:y,listOrdered:u(ie,b),listUnordered:u(ie),paragraph:u(Qe),reference:B,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:u(St),strong:u(nt),thematicBreak:u(It)},exit:{atxHeading:p(),atxHeadingSequence:O,autolink:p(),autolinkEmail:Oe,autolinkProtocol:Be,blockQuote:p(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:je,characterReference:Ee,codeFenced:p(S),codeFencedFence:N,codeFencedFenceInfo:_,codeFencedFenceMeta:j,codeFlowValue:q,codeIndented:p(C),codeText:p(G),codeTextData:q,data:q,definition:p(),definitionDestinationString:A,definitionLabelString:E,definitionTitleString:R,emphasis:p(),hardBreakEscape:p(de),hardBreakTrailing:p(de),htmlFlow:p(Q),htmlFlowData:q,htmlText:p(V),htmlTextData:q,image:p(ae),label:T,labelText:ye,lineEnding:L,link:p(H),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:oe,resourceDestinationString:Ne,resourceTitleString:Ce,resource:$,setextHeading:p(Z),setextHeadingLineSequence:z,setextHeadingText:P,strong:p(),thematicBreak:p()}};SN(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ce){let U={type:"root",children:[],position:void 0};const fe={stack:[U],tokenStack:[],config:t,enter:f,exit:g,buffer:h,resume:v,data:n},Ae=[],tt=[];let ze=-1;for(;++ze<ce.length;)if(tt.push(ce[ze]),ce[ze][1].type==="listOrdered"||ce[ze][1].type==="listUnordered")if(ce[ze][0]==="enter")Ae.push(tt.length-1);else{const st=Ae.pop();o(tt,st)}for(ce=tt,ze=-1;++ze<ce.length;){const st=t[ce[ze][0]];ce[ze][0]==="enter"&&t.beforeEnter.length>0&&a(t.beforeEnter,{...fe,sliceSerialize:ce[ze][2].sliceSerialize},ce[ze][1]),wN.call(st,ce[ze][1].type)&&st[ce[ze][1].type].call({...fe,sliceSerialize:ce[ze][2].sliceSerialize},ce[ze][1]),ce[ze][0]==="exit"&&t.afterExit.length>0&&a(t.afterExit,{...fe,sliceSerialize:ce[ze][2].sliceSerialize},ce[ze][1])}if(fe.tokenStack.length>0){const st=fe.tokenStack[fe.tokenStack.length-1];(st[1]||f2).call(fe,void 0,st[0])}for(U.position={start:aa(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:aa(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},ze=-1;++ze<t.transforms.length;)U=t.transforms[ze](U)||U;return U}function a(ce,U,fe){let Ae=-1;for(;++Ae<ce.length;)ce[Ae].call(U,fe)}function o(ce,U){const fe=ce.length-1;let Ae=U-1,tt=-1,ze=!1,st,rn,Jn,ln;const Fs=[];for(;++Ae<=fe;){const Jt=ce[Ae];switch(Jt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Jt[0]==="enter"?tt++:tt--,ln=void 0;break}case"lineEndingBlank":{Jt[0]==="enter"&&(st&&!ln&&!tt&&!Jn&&(Jn=Ae),ln=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ln=void 0}if(!tt&&Jt[0]==="enter"&&Jt[1].type==="listItemPrefix"||tt===-1&&Jt[0]==="exit"&&(Jt[1].type==="listUnordered"||Jt[1].type==="listOrdered")){if(st){let hn=Ae;for(rn=void 0;hn--;){const en=ce[hn];if(en[1].type==="lineEnding"||en[1].type==="lineEndingBlank"){if(en[0]==="exit")continue;rn&&(ce[rn][1].type="lineEndingBlank",ze=!0),en[1].type="lineEnding",rn=hn}else if(!(en[1].type==="linePrefix"||en[1].type==="blockQuotePrefix"||en[1].type==="blockQuotePrefixWhitespace"||en[1].type==="blockQuoteMarker"||en[1].type==="listItemIndent"))break}Jn&&(!rn||Jn<rn)&&(st._spread=!0),st.end=Object.assign({},rn?ce[rn][1].start:Jt[1].end),Fs.push({at:rn||Ae,event:["exit",st,Jt[2]]})}if(Jt[1].type==="listItemPrefix"){const hn={type:"listItem",_spread:!1,start:Object.assign({},Jt[1].start),end:void 0};st=hn,Fs.push({at:Ae,event:["enter",hn,Jt[2]]}),Jn=void 0,ln=!0}}}const ks=ce.splice(U);let Ut=0;for(Ae=-1;++Ae<ks.length;){for(;Ut<Fs.length&&Fs[Ut].at===U+Ae;)ce.push(Fs[Ut++].event);ce.push(ks[Ae])}ce[U][1]._spread=ze}function u(ce,U){return fe;function fe(Ae){f.call(this,ce(Ae),Ae),U&&U.call(this,Ae)}}function h(){this.stack.push({type:"fragment",children:[]})}function f(ce,U,fe){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([U,fe||void 0]),ce.position={start:aa(U.start),end:void 0}}function p(ce){return U;function U(fe){ce&&ce.call(this,fe),g.call(this,fe)}}function g(ce,U){const fe=this.stack.pop(),Ae=this.tokenStack.pop();if(!Ae)throw new Error("Cannot close `"+ce.type+"` ("+bu({start:ce.start,end:ce.end})+"): it’s not open");Ae[0].type!==ce.type&&(U?U.call(this,ce,Ae[0]):(Ae[1]||f2).call(this,ce,Ae[0])),fe.position.end=aa(ce.end)}function v(){return av(this.stack.pop())}function b(){this.data.expectingFirstListItemValue=!0}function y(ce){if(this.data.expectingFirstListItemValue){const U=this.stack[this.stack.length-2];U.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.lang=ce}function j(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.meta=ce}function N(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce.replace(/(\r?\n|\r)$/g,"")}function E(ce){const U=this.resume(),fe=this.stack[this.stack.length-1];fe.label=U,fe.identifier=vi(this.sliceSerialize(ce)).toLowerCase()}function R(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.title=ce}function A(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.url=ce}function O(ce){const U=this.stack[this.stack.length-1];if(!U.depth){const fe=this.sliceSerialize(ce).length;U.depth=fe}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function z(ce){const U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function Z(){this.data.setextHeadingSlurpLineEnding=void 0}function I(ce){const fe=this.stack[this.stack.length-1].children;let Ae=fe[fe.length-1];(!Ae||Ae.type!=="text")&&(Ae=Kt(),Ae.position={start:aa(ce.start),end:void 0},fe.push(Ae)),this.stack.push(Ae)}function q(ce){const U=this.stack.pop();U.value+=this.sliceSerialize(ce),U.position.end=aa(ce.end)}function L(ce){const U=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=U.children[U.children.length-1];fe.position.end=aa(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(U.type)&&(I.call(this,ce),q.call(this,ce))}function de(){this.data.atHardBreak=!0}function Q(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce}function V(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce}function G(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce}function H(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=U,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function ae(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=U,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function ye(ce){const U=this.sliceSerialize(ce),fe=this.stack[this.stack.length-2];fe.label=sL(U),fe.identifier=vi(U).toLowerCase()}function T(){const ce=this.stack[this.stack.length-1],U=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const Ae=ce.children;fe.children=Ae}else fe.alt=U}function Ne(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.url=ce}function Ce(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.title=ce}function $(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function oe(ce){const U=this.resume(),fe=this.stack[this.stack.length-1];fe.label=U,fe.identifier=vi(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function be(ce){this.data.characterReferenceType=ce.type}function je(ce){const U=this.sliceSerialize(ce),fe=this.data.characterReferenceType;let Ae;fe?(Ae=dN(U,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=lv(U);const tt=this.stack[this.stack.length-1];tt.value+=Ae}function Ee(ce){const U=this.stack.pop();U.position.end=aa(ce.end)}function Be(ce){q.call(this,ce);const U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(ce)}function Oe(ce){q.call(this,ce);const U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(ce)}function Te(){return{type:"blockquote",children:[],position:void 0}}function Re(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Ft(){return{type:"inlineCode",value:"",position:void 0}}function vn(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function Vt(){return{type:"emphasis",children:[],position:void 0}}function St(){return{type:"heading",depth:0,children:[],position:void 0}}function wt(){return{type:"break",position:void 0}}function We(){return{type:"html",value:"",position:void 0}}function xt(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function Zt(){return{type:"link",title:null,url:"",children:[],position:void 0}}function ie(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[],position:void 0}}function ke(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[],position:void 0}}function Qe(){return{type:"paragraph",children:[],position:void 0}}function nt(){return{type:"strong",children:[],position:void 0}}function Kt(){return{type:"text",value:"",position:void 0}}function It(){return{type:"thematicBreak",position:void 0}}}function aa(e){return{line:e.line,column:e.column,offset:e.offset}}function SN(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?SN(e,i):lL(e,i)}}function lL(e,t){let n;for(n in t)if(wN.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"afterExit":case"beforeEnter":{const i=t[n];i&&e[n].push(i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function f2(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+bu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+bu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+bu({start:t.start,end:t.end})+") is still open")}function oL(e){const t=this;t.parser=n;function n(i){return rL(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function cL(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function uL(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
76
|
+
`}]}function dL(e,t){const n=t.value?t.value+`
|
|
77
|
+
`:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function hL(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fL(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pL(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Bo(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let u,h=e.footnoteCounts.get(i);h===void 0?(h=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=o+1,h+=1,e.footnoteCounts.set(i,h);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function mL(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gL(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kN(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=i:a.push({type:"text",value:i}),a}function xL(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return kN(e,t);const a={src:Bo(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function vL(e,t){const n={src:Bo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function bL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function yL(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return kN(e,t);const a={href:Bo(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function _L(e,t){const n={href:Bo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function wL(e,t,n){const i=e.all(t),a=n?SL(n):jN(t),o={},u=[];if(typeof t.checked=="boolean"){const g=i[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},i.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let h=-1;for(;++h<i.length;){const g=i[h];(a||h!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
78
|
+
`}),g.type==="element"&&g.tagName==="p"&&!a?u.push(...g.children):u.push(g)}const f=i[i.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
|
|
79
|
+
`});const p={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,p),e.applyData(t,p)}function SL(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=jN(n[i])}return t}function jN(e){const t=e.spread;return t??e.children.length>1}function kL(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const u=i[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function jL(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function NL(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function CL(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EL(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),a.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},h=nv(t.children[1]),f=sN(t.children[t.children.length-1]);h&&f&&(u.position={start:h,end:f}),a.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function TL(e,t,n){const i=n?n.children:void 0,o=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,h=u?u.length:t.children.length;let f=-1;const p=[];for(;++f<h;){const v=t.children[f],b={},y=u?u[f]:void 0;y&&(b.align=y);let _={type:"element",tagName:o,properties:b,children:[]};v&&(_.children=e.all(v),e.patch(v,_),_=e.applyData(v,_)),p.push(_)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,g),e.applyData(t,g)}function ML(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const p2=9,m2=32;function AL(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const o=[];for(;i;)o.push(g2(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return o.push(g2(t.slice(a),a>0,!1)),o.join("")}function g2(e,t,n){let i=0,a=e.length;if(t){let o=e.codePointAt(i);for(;o===p2||o===m2;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(a-1);for(;o===p2||o===m2;)a--,o=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function RL(e,t){const n={type:"text",value:AL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function OL(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const LL={blockquote:cL,break:uL,code:dL,delete:hL,emphasis:fL,footnoteReference:pL,heading:mL,html:gL,imageReference:xL,image:vL,inlineCode:bL,linkReference:yL,link:_L,listItem:wL,list:kL,paragraph:jL,root:NL,strong:CL,table:EL,tableCell:ML,tableRow:TL,text:RL,thematicBreak:OL,toml:wh,yaml:wh,definition:wh,footnoteDefinition:wh};function wh(){}const NN=-1,Ef=0,_u=1,mf=2,cv=3,uv=4,dv=5,hv=6,CN=7,EN=8,{defineProperty:DL}=Object,TN=typeof self=="object"?self:globalThis,x2=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new TN[e](t)},zL=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),i=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case Ef:case NN:return n(u,a);case _u:{const h=n([],a);for(const f of u)h.push(i(f));return h}case mf:{const h=n({},a);for(const[f,p]of u){const g=i(f),v=i(p);g==="__proto__"?DL(h,g,{value:v,configurable:!0,enumerable:!0,writable:!0}):h[g]=v}return h}case cv:return n(new Date(u),a);case uv:{const{source:h,flags:f}=u;return n(new RegExp(h,f),a)}case dv:{const h=n(new Map,a);for(const[f,p]of u)h.set(i(f),i(p));return h}case hv:{const h=n(new Set,a);for(const f of u)h.add(i(f));return h}case CN:{const{name:h,message:f}=u;return n(typeof TN[h]=="function"?x2(h,f):new Error(f),a)}case EN:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:h}=new Uint8Array(u);return n(new DataView(h),u)}case"-0":return-0}return n(x2(o,u),a)};return i},v2=e=>zL(new Map,e)(0),sl="",{toString:$L}={},{keys:PL,is:BL}=Object,eu=e=>{const t=typeof e;if(t!=="object"||!e)return[Ef,t];const n=$L.call(e).slice(8,-1);switch(n){case"Array":return[_u,sl];case"Object":return[mf,sl];case"Date":return[cv,sl];case"RegExp":return[uv,sl];case"Map":return[dv,sl];case"Set":return[hv,sl];case"DataView":return[_u,n]}return n.includes("Array")?[_u,n]:e instanceof Error?[CN,e.name||"Error"]:[mf,n]},Sh=([e,t])=>e===Ef&&(t==="function"||t==="symbol"),FL=(e,t,n,i)=>{const a=(u,h)=>{const f=i.push(u)-1;return n.set(h,f),f},o=u=>{if(n.has(u))return n.get(u);let[h,f]=eu(u);switch(h){case Ef:{let g=u;switch(f){case"bigint":h=EN,g=u.toString();break;case"number":if(!u&&BL(u,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return a([NN],u)}return a([h,g],u)}case _u:{if(f){let b=u;return f==="DataView"?b=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(u)),a([f,[...b]],u)}const g=[],v=a([h,g],u);for(const b of u)g.push(o(b));return v}case mf:{if(f)switch(f){case"BigInt":return a([f,u.toString()],u);case"Boolean":case"Number":case"String":return a([f,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const g=[],v=a([h,g],u);for(const b of PL(u))(e||!Sh(eu(u[b])))&&g.push([o(b),o(u[b])]);return v}case cv:return a([h,isNaN(u.getTime())?sl:u.toISOString()],u);case uv:{const{source:g,flags:v}=u;return a([h,{source:g,flags:v}],u)}case dv:{const g=[],v=a([h,g],u);for(const[b,y]of u)(e||!(Sh(eu(b))||Sh(eu(y))))&&g.push([o(b),o(y)]);return v}case hv:{const g=[],v=a([h,g],u);for(const b of u)(e||!Sh(eu(b)))&&g.push(o(b));return v}}const{message:p}=u;return a([h,{name:f,message:p}],u)};return o},b2=(e,{json:t,lossy:n}={})=>{const i=[];return FL(!(t||n),!!t,new Map,i)(e),i},gf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?v2(b2(e,t)):structuredClone(e):(e,t)=>v2(b2(e,t));function IL(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function UL(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function HL(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||IL,i=e.options.footnoteBackLabel||UL,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const g=e.all(p),v=String(p.identifier).toUpperCase(),b=Bo(v.toLowerCase());let y=0;const _=[],j=e.footnoteCounts.get(v);for(;j!==void 0&&++y<=j;){_.length>0&&_.push({type:"text",value:" "});let C=typeof n=="string"?n:n(f,y);typeof C=="string"&&(C={type:"text",value:C}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,y),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const N=g[g.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const C=N.children[N.children.length-1];C&&C.type==="text"?C.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(..._)}else g.push(..._);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(p,S),h.push(S)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...gf(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
80
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
|
|
81
|
+
`}]}}const Tf=(function(e){if(e==null)return YL;if(typeof e=="function")return Mf(e);if(typeof e=="object")return Array.isArray(e)?qL(e):VL(e);if(typeof e=="string")return GL(e);throw new Error("Expected function, string, or object as test")});function qL(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Tf(e[n]);return Mf(i);function i(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function VL(e){const t=e;return Mf(n);function n(i){const a=i;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function GL(e){return Mf(t);function t(n){return n&&n.type===e}}function Mf(e){return t;function t(n,i,a){return!!(XL(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function YL(){return!0}function XL(e){return e!==null&&typeof e=="object"&&"type"in e}const MN=[],QL=!0,fx=!1,WL="skip";function AN(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const o=Tf(a),u=i?-1:1;h(e,void 0,[])();function h(f,p,g){const v=f&&typeof f=="object"?f:{};if(typeof v.type=="string"){const y=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=MN,_,j,N;if((!t||o(f,p,g[g.length-1]||void 0))&&(y=ZL(n(f,g)),y[0]===fx))return y;if("children"in f&&f.children){const S=f;if(S.children&&y[0]!==WL)for(j=(i?S.children.length:-1)+u,N=g.concat(S);j>-1&&j<S.children.length;){const C=S.children[j];if(_=h(C,j,N)(),_[0]===fx)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function ZL(e){return Array.isArray(e)?e:typeof e=="number"?[QL,e]:e==null?MN:[e]}function fv(e,t,n,i){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=i),AN(e,o,h,a);function h(f,p){const g=p[p.length-1],v=g?g.children.indexOf(f):void 0;return u(f,v,g)}}const px={}.hasOwnProperty,KL={};function JL(e,t){const n=t||KL,i=new Map,a=new Map,o=new Map,u={...LL,...n.handlers},h={all:p,applyData:tD,definitionById:i,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:f,options:n,patch:eD,wrap:sD};return fv(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const v=g.type==="definition"?i:a,b=String(g.identifier).toUpperCase();v.has(b)||v.set(b,g)}}),h;function f(g,v){const b=g.type,y=h.handlers[b];if(px.call(h.handlers,b)&&y)return y(h,g,v);if(h.options.passThrough&&h.options.passThrough.includes(b)){if("children"in g){const{children:j,...N}=g,S=gf(N);return S.children=h.all(g),S}return gf(g)}return(h.options.unknownHandler||nD)(h,g,v)}function p(g){const v=[];if("children"in g){const b=g.children;let y=-1;for(;++y<b.length;){const _=h.one(b[y],g);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=y2(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=y2(j.value))}Array.isArray(_)?v.push(..._):v.push(_)}}}return v}}function eD(e,t){e.position&&(t.position=UR(e))}function tD(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,gf(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function nD(e,t){const n=t.data||{},i="value"in t&&!(px.call(n,"hProperties")||px.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function sD(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
|
|
82
|
+
`});++i<e.length;)i&&n.push({type:"text",value:`
|
|
83
|
+
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
84
|
+
`}),n}function y2(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _2(e,t){const n=JL(e,t),i=n.one(e,void 0),a=HL(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
85
|
+
`},a),o}function iD(e,t){return e&&"run"in e?async function(n,i){const a=_2(n,{file:i,...t});await e.run(a,i)}:function(n,i){return _2(n,{file:i,...e||t})}}function w2(e){if(e)throw e}var s0,S2;function rD(){if(S2)return s0;S2=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},o=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),v=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!v)return!1;var b;for(b in p);return typeof b>"u"||e.call(p,b)},u=function(p,g){n&&g.name==="__proto__"?n(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},h=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return s0=function f(){var p,g,v,b,y,_,j=arguments[0],N=1,S=arguments.length,C=!1;for(typeof j=="boolean"&&(C=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<S;++N)if(p=arguments[N],p!=null)for(g in p)v=h(j,g),b=h(p,g),j!==b&&(C&&b&&(o(b)||(y=a(b)))?(y?(y=!1,_=v&&a(v)?v:[]):_=v&&o(v)?v:{},u(j,{name:g,newValue:f(C,_,b)})):typeof b<"u"&&u(j,{name:g,newValue:b}));return j},s0}var aD=rD();const i0=wx(aD);function mx(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function lD(){const e=[],t={run:n,use:i};return t;function n(...a){let o=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);h(null,...a);function h(f,...p){const g=e[++o];let v=-1;if(f){u(f);return}for(;++v<a.length;)(p[v]===null||p[v]===void 0)&&(p[v]=a[v]);a=p,g?oD(g,h)(...p):u(null,...p)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function oD(e,t){let n;return i;function i(...u){const h=e.length>u.length;let f;h&&u.push(a);try{f=e.apply(this,u)}catch(p){const g=p;if(h&&n)throw g;return a(g)}h||(f&&f.then&&typeof f.then=="function"?f.then(o,a):f instanceof Error?a(f):o(f))}function a(u,...h){n||(n=!0,t(u,...h))}function o(u){a(null,u)}}const Ii={basename:cD,dirname:uD,extname:dD,join:hD,sep:"/"};function cD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Bu(e);let n=0,i=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else i<0&&(o=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,h=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),h>-1&&(e.codePointAt(a)===t.codePointAt(h--)?h<0&&(i=a):(h=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function uD(e){if(Bu(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function dD(e){Bu(e);let t=e.length,n=-1,i=0,a=-1,o=0,u;for(;t--;){const h=e.codePointAt(t);if(h===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),h===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function hD(...e){let t=-1,n;for(;++t<e.length;)Bu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":fD(n)}function fD(e){Bu(e);const t=e.codePointAt(0)===47;let n=pD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function pD(e,t){let n="",i=0,a=-1,o=0,u=-1,h,f;for(;++u<=e.length;){if(u<e.length)h=e.codePointAt(u);else{if(h===47)break;h=47}if(h===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",i=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),i=u-a-1;a=u,o=0}else h===46&&o>-1?o++:o=-1}return n}function Bu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const mD={cwd:gD};function gD(){return"/"}function gx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function xD(e){if(typeof e=="string")e=new URL(e);else if(!gx(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return vD(e)}function vD(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const r0=["history","path","basename","stem","extname","dirname"];class RN{constructor(t){let n;t?gx(t)?n={path:t}:typeof t=="string"||bD(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":mD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<r0.length;){const o=r0[i];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)r0.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ii.basename(this.path):void 0}set basename(t){l0(t,"basename"),a0(t,"basename"),this.path=Ii.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ii.dirname(this.path):void 0}set dirname(t){k2(this.basename,"dirname"),this.path=Ii.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ii.extname(this.path):void 0}set extname(t){if(a0(t,"extname"),k2(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ii.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){gx(t)&&(t=xD(t)),l0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ii.basename(this.path,this.extname):void 0}set stem(t){l0(t,"stem"),a0(t,"stem"),this.path=Ii.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new Kn(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function a0(e,t){if(e&&e.includes(Ii.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ii.sep+"`")}function l0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function k2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function bD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yD=(function(e){const i=this.constructor.prototype,a=i[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,i),o}),_D={}.hasOwnProperty;class pv extends yD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=lD()}copy(){const t=new pv;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(i0(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(u0("data",this.frozen),this.namespace[t]=n,this):_D.call(this.namespace,t)&&this.namespace[t]||void 0:t?(u0("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=kh(t),i=this.parser||this.Parser;return o0("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),o0("process",this.parser||this.Parser),c0("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const h=kh(t),f=i.parse(h);i.run(f,h,function(g,v,b){if(g||!v||!b)return p(g);const y=v,_=i.stringify(y,b);kD(_)?b.value=_:b.result=_,p(g,b)});function p(g,v){g||!v?u(g):o?o(v):n(void 0,v)}}}processSync(t){let n=!1,i;return this.freeze(),o0("processSync",this.parser||this.Parser),c0("processSync",this.compiler||this.Compiler),this.process(t,a),N2("processSync","process",n),i;function a(o,u){n=!0,w2(o),i=u}}run(t,n,i){j2(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?o(void 0,i):new Promise(o);function o(u,h){const f=kh(n);a.run(t,f,p);function p(g,v,b){const y=v||t;g?h(g):u?u(y):i(void 0,y,b)}}}runSync(t,n){let i=!1,a;return this.run(t,n,o),N2("runSync","run",i),a;function o(u,h){w2(u),a=h,i=!0}}stringify(t,n){this.freeze();const i=kh(n),a=this.compiler||this.Compiler;return c0("stringify",a),j2(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(u0("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?h(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...v]=p;f(g,v)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(p.plugins),p.settings&&(a.settings=i0(!0,a.settings,p.settings))}function h(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const v=p[g];o(v)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,g){let v=-1,b=-1;for(;++v<i.length;)if(i[v][0]===p){b=v;break}if(b===-1)i.push([p,...g]);else if(g.length>0){let[y,..._]=g;const j=i[b][1];mx(j)&&mx(y)&&(y=i0(!0,j,y)),i[b]=[p,y,..._]}}}}const wD=new pv().freeze();function o0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function c0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function u0(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function j2(e){if(!mx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function N2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function kh(e){return SD(e)?e:new RN(e)}function SD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function kD(e){return typeof e=="string"||jD(e)}function jD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ND="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",C2=[],E2={allowDangerousHtml:!0},CD=/^(https?|ircs?|mailto|xmpp)$/i,ED=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function mv(e){const t=TD(e),n=MD(e);return AD(t.runSync(t.parse(n),n),e)}function TD(e){const t=e.rehypePlugins||C2,n=e.remarkPlugins||C2,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...E2}:E2;return wD().use(oL).use(n).use(iD,i).use(t)}function MD(e){const t=e.children||"",n=new RN;return typeof t=="string"&&(n.value=t),n}function AD(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,h=t.unwrapDisallowed,f=t.urlTransform||RD;for(const g of ED)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+ND+g.id,void 0);return fv(e,p),YR(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function p(g,v,b){if(g.type==="raw"&&b&&typeof v=="number")return u?b.children.splice(v,1):b.children[v]={type:"text",value:g.value},v;if(g.type==="element"){let y;for(y in e0)if(Object.hasOwn(e0,y)&&Object.hasOwn(g.properties,y)){const _=g.properties[y],j=e0[y];(j===null||j.includes(g.tagName))&&(g.properties[y]=f(String(_||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&i&&typeof v=="number"&&(y=!i(g,v,b)),y&&b&&typeof v=="number")return h&&g.children?b.children.splice(v,1,...g.children):b.children.splice(v,1),v}}}function RD(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||CD.test(e.slice(0,t))?e:""}function T2(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function OD(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function LD(e,t,n){const a=Tf((n||{}).ignore||[]),o=DD(t);let u=-1;for(;++u<o.length;)AN(e,"text",h);function h(p,g){let v=-1,b;for(;++v<g.length;){const y=g[v],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return f(p,g)}function f(p,g){const v=g[g.length-1],b=o[u][0],y=o[u][1];let _=0;const N=v.children.indexOf(p);let S=!1,C=[];b.lastIndex=0;let E=b.exec(p.value);for(;E;){const A=E.index,O={index:E.index,input:E.input,stack:[...g,p]};let P=y(...E,O);if(typeof P=="string"&&(P=P.length>0?{type:"text",value:P}:void 0),P===!1)b.lastIndex=A+1;else{if(_!==A&&R({type:"text",value:p.value.slice(_,A)}),Array.isArray(P))for(const z of P)R(z);else P&&R(P);_=A+E[0].length,S=!0}if(!b.global)break;E=b.exec(p.value)}return S?(_<p.value.length&&R({type:"text",value:p.value.slice(_)}),v.children.splice(N,1,...C)):C=[p],N+C.length;function R(A){const O=C[C.length-1];O&&O.type==="text"&&A.type==="text"?O.value+=A.value:C.push(A)}}}function DD(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([zD(a[0]),$D(a[1])])}return t}function zD(e){return typeof e=="string"?new RegExp(OD(e),"g"):e}function $D(e){return typeof e=="function"?e:function(){return e}}const d0="phrasing",h0=["autolink","link","image","label"];function PD(){return{transforms:[VD],enter:{literalAutolink:FD,literalAutolinkEmail:f0,literalAutolinkHttp:f0,literalAutolinkWww:f0},exit:{literalAutolink:qD,literalAutolinkEmail:HD,literalAutolinkHttp:ID,literalAutolinkWww:UD}}}function BD(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:d0,notInConstruct:h0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:d0,notInConstruct:h0},{character:":",before:"[ps]",after:"\\/",inConstruct:d0,notInConstruct:h0}]}}function FD(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function f0(e){this.config.enter.autolinkProtocol.call(this,e)}function ID(e){this.config.exit.autolinkProtocol.call(this,e)}function UD(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function HD(e){this.config.exit.autolinkEmail.call(this,e)}function qD(e){this.exit(e)}function VD(e){LD(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,GD],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),YD]],{ignore:["link","linkReference"]})}function GD(e,t,n,i,a){let o="";if(!ON(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!XD(n)))return!1;const u=QD(n+i);if(!u[0])return!1;const h={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function YD(e,t,n,i){return!ON(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function XD(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function QD(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const a=T2(e,"(");let o=T2(e,")");for(;i!==-1&&a>o;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),o++;return[e,n]}function ON(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||dl(n)||Nf(n))&&(!t||n!==47)}LN.peek=iz;function WD(){this.buffer()}function ZD(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function KD(){this.buffer()}function JD(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ez(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tz(e){this.exit(e)}function nz(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function sz(e){this.exit(e)}function iz(){return"["}function LN(e,t,n,i){const a=n.createTracker(i);let o=a.move("[^");const u=n.enter("footnoteReference"),h=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),h(),u(),o+=a.move("]"),o}function rz(){return{enter:{gfmFootnoteCallString:WD,gfmFootnoteCall:ZD,gfmFootnoteDefinitionLabelString:KD,gfmFootnoteDefinition:JD},exit:{gfmFootnoteCallString:ez,gfmFootnoteCall:tz,gfmFootnoteDefinitionLabelString:nz,gfmFootnoteDefinition:sz}}}function az(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:LN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,o,u){const h=o.createTracker(u);let f=h.move("[^");const p=o.enter("footnoteDefinition"),g=o.enter("label");return f+=h.move(o.safe(o.associationId(i),{before:f,after:"]"})),g(),f+=h.move("]:"),i.children&&i.children.length>0&&(h.shift(4),f+=h.move((t?`
|
|
86
|
+
`:" ")+o.indentLines(o.containerFlow(i,h.current()),t?DN:lz))),p(),f}}function lz(e,t,n){return t===0?e:DN(e,t,n)}function DN(e,t,n){return(n?"":" ")+e}const oz=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];gv.attention=fz;gv.peek=pz;function cz(){return{canContainEols:["delete"],enter:{strikethrough:dz},exit:{strikethrough:hz}}}function uz(){return{handlers:{delete:gv},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:oz}]}}function dz(e){this.enter({type:"delete",children:[],position:void 0},e)}function hz(e){this.exit(e)}function gv(e,t,n,i){const a=n.createTracker(i),o=n.stack.includes("strikethrough")?"~":"~~",u=n.enter("strikethrough");let h=a.move(o);return h+=n.containerPhrasing(e,{...a.current(),before:h,after:"~"}),h+=a.move(o),u(),h}function fz(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function pz(){return"~"}function mz(e){return e.length}function gz(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||mz,o=[],u=[],h=[],f=[];let p=0,g=-1;for(;++g<e.length;){const j=[],N=[];let S=-1;for(e[g].length>p&&(p=e[g].length);++S<e[g].length;){const C=xz(e[g][S]);if(n.alignDelimiters!==!1){const E=a(C);N[S]=E,(f[S]===void 0||E>f[S])&&(f[S]=E)}j.push(C)}u[g]=j,h[g]=N}let v=-1;if(typeof i=="object"&&"length"in i)for(;++v<p;)o[v]=M2(i[v]);else{const j=M2(i);for(;++v<p;)o[v]=j}v=-1;const b=[],y=[];for(;++v<p;){const j=o[v];let N="",S="";j===99?(N=":",S=":"):j===108?N=":":j===114&&(S=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[v]-N.length-S.length);const E=N+"-".repeat(C)+S;n.alignDelimiters!==!1&&(C=N.length+C+S.length,C>f[v]&&(f[v]=C),y[v]=C),b[v]=E}u.splice(1,0,b),h.splice(1,0,y),g=-1;const _=[];for(;++g<u.length;){const j=u[g],N=h[g];v=-1;const S=[];for(;++v<p;){const C=j[v]||"";let E="",R="";if(n.alignDelimiters!==!1){const A=f[v]-(N[v]||0),O=o[v];O===114?E=" ".repeat(A):O===99?A%2?(E=" ".repeat(A/2+.5),R=" ".repeat(A/2-.5)):(E=" ".repeat(A/2),R=E):R=" ".repeat(A)}n.delimiterStart!==!1&&!v&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||v)&&S.push(" "),n.alignDelimiters!==!1&&S.push(E),S.push(C),n.alignDelimiters!==!1&&S.push(R),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||v!==p-1)&&S.push("|")}_.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return _.join(`
|
|
87
|
+
`)}function xz(e){return e==null?"":String(e)}function M2(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const vz=Tf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function bz(e,t,n,i){const a=n.enter("blockquote"),o=n.createTracker(i);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),yz);return a(),u}function yz(e,t,n){return">"+(n?"":" ")+e}function _z(e,t){return A2(e,t.inConstruct,!0)&&!A2(e,t.notInConstruct,!1)}function A2(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function R2(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;){const o=n.unsafe[a];if(o.character===`
|
|
88
|
+
`&&!o.before&&!o.after&&_z(n.stack,o))return/[\t ]/.test(i.before)?"":" "}return`\\
|
|
89
|
+
`}function wz(e,t){const n=String(e);let i=n.indexOf(t),a=i,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++o>u&&(u=o):o=1,a=i+t.length,i=n.indexOf(t,a);return u}function Sz(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function kz(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function jz(e,t,n,i){const a=kz(n),o=e.value||"";if(Sz(e,n)){const v=n.enter("codeIndented"),b=n.indentLines(o,Nz);return v(),b}const u=n.createTracker(i),h=a.repeat(Math.max(wz(o,a)+1,3)),f=n.enter("codeFenced"),p=a==="`"?"GraveAccent":"Tilde";let g=u.move(h);if(e.lang){const v=n.enter(`codeFencedLang${p}`);g+=u.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...u.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${p}`);g+=u.move(" "),g+=u.move(n.safe(e.meta,{before:g,after:`
|
|
90
|
+
`,encode:["`"],...u.current()})),v()}return g+=u.move(`
|
|
91
|
+
`),o&&(g+=u.move(o+`
|
|
92
|
+
`)),g+=u.move(h),f(),g}function Nz(e,t,n){return(n?"":" ")+e}function xv(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Cz(e,t,n,i){const a=xv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let h=n.enter("label");const f=n.createTracker(i);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
|
|
93
|
+
`,...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),u(),p}function Ez(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}vv.attention=Tz;vv.peek=Mz;function vv(e,t,n,i){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},i);return a(),o}function Tz(e,t){return{construct:"emphasis",markers:Ez(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function Mz(e,t,n){return n.options.emphasis||"*"}function Az(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Rz(e,t){let n=!1;return fv(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,fx}),!!((!e.depth||e.depth<3)&&av(e)&&(t.options.setext||n))}function Oz(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(Rz(e,n)){const v=n.enter("headingSetext"),b=n.enter("phrasing"),y=n.containerPhrasing(e,{...o.current(),before:`
|
|
94
|
+
`,after:`
|
|
95
|
+
`});return b(),v(),y+`
|
|
96
|
+
`+(a===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
97
|
+
`))+1))}const u="#".repeat(a),h=n.enter("headingAtx"),f=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
98
|
+
`,...o.current()});const g=p.charCodeAt(0);return(g===9||g===32)&&(p=Az(g)+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),f(),h(),p}zN.peek=Lz;function zN(e){return e.value||""}function Lz(){return"<"}$N.peek=Dz;function $N(e,t,n,i){const a=xv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let h=n.enter("label");const f=n.createTracker(i);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),p+=f.move(")"),u(),p}function Dz(){return"!"}PN.peek=zz;function PN(e,t,n,i){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("![");const p=n.safe(e.alt,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const g=n.stack;n.stack=g.filter(function(b){return b!=="phrasing"}),u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=g,o(),a==="full"||!p||p!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function zz(){return"!"}BN.peek=$z;function BN(e,t,n){let i=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o<n.unsafe.length;){const u=n.unsafe[o],h=n.compilePattern(u);if(!u.atBreak)continue;let f;for(;f=h.exec(i);){let p=f.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(f.index+1)}}return a+i+a}function $z(){return"`"}function FN(e,t){const n=av(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}IN.peek=Pz;function IN(e,t,n,i){const a=xv(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);if(FN(e,n)){const g=n.stack;n.stack=g.filter(function(y){return y!=="phrasing"});const v=n.enter("autolink");let b=u.move("<");return b+=u.move(n.containerPhrasing(e,{before:b,after:">",...u.current()})),b+=u.move(">"),v(),n.stack=g,b}const h=n.enter("link");let f=n.enter("label"),p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(f=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=u.move(" "+a),p+=u.move(n.safe(e.title,{before:p,after:a,...u.current()})),p+=u.move(a),f()),p+=u.move(")"),h(),p}function Pz(e,t,n){return FN(e,n)?"<":"["}UN.peek=Bz;function UN(e,t,n,i){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const g=n.stack;n.stack=g.filter(function(b){return b!=="phrasing"}),u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=g,o(),a==="full"||!p||p!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function Bz(){return"["}function bv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Fz(e){const t=bv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Iz(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function HN(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Uz(e,t,n,i){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?Iz(n):bv(n);const h=e.ordered?u==="."?")":".":Fz(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),HN(n)===u&&g){let v=-1;for(;++v<e.children.length;){const b=e.children[v];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=h),n.bulletCurrent=u;const p=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function Hz(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function qz(e,t,n,i){const a=Hz(n);let o=n.bulletCurrent||bv(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const h=n.createTracker(i);h.move(o+" ".repeat(u-o.length)),h.shift(u);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,h.current()),g);return f(),p;function g(v,b,y){return b?(y?"":" ".repeat(u))+v:(y?o:o+" ".repeat(u-o.length))+v}}function Vz(e,t,n,i){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),a(),u}function Gz(e,t,n,i){if(!e.children.some(function(h){return vz(h)}))return n.containerFlow(e,i);const o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),u}function Yz(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}yv.attention=Xz;yv.peek=Qz;function yv(e,t,n,i){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},i);return a(),o}function Xz(e,t){return{construct:"strong",markers:Yz(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function Qz(e,t,n){return n.options.strong||"*"}function Wz(e,t,n,i){const a=t?t.children:[],o=a.indexOf(e);return n.safe(e.value,{...i,afterNode:a[o+1],beforeNode:a[o-1]})}function Zz(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Kz(e,t,n){const i=(HN(n)+(n.options.ruleSpaces?" ":"")).repeat(Zz(n));return n.options.ruleSpaces?i.slice(0,-1):i}const qN={blockquote:bz,break:R2,code:jz,definition:Cz,emphasis:vv,hardBreak:R2,heading:Oz,html:zN,image:$N,imageReference:PN,inlineCode:BN,link:IN,linkReference:UN,list:Uz,listItem:qz,paragraph:Vz,root:Gz,strong:yv,text:Wz,thematicBreak:Kz};function Jz(){return{enter:{table:e$,tableData:O2,tableHeader:O2,tableRow:n$},exit:{codeText:s$,table:t$,tableData:p0,tableHeader:p0,tableRow:p0}}}function e$(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function t$(e){this.exit(e),this.data.inTable=void 0}function n$(e){this.enter({type:"tableRow",children:[]},e)}function p0(e){this.exit(e)}function O2(e){this.enter({type:"tableCell",children:[]},e)}function s$(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,i$));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function i$(e,t){return t==="|"?t:e}function r$(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
99
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:u,tableCell:f,tableRow:h}};function u(y,_,j,N){return p(g(y,j,N),y.align)}function h(y,_,j,N){const S=v(y,j,N),C=p([S]);return C.slice(0,C.indexOf(`
|
|
100
|
+
`))}function f(y,_,j,N){const S=j.enter("tableCell"),C=j.enter("phrasing"),E=j.containerPhrasing(y,{...N,before:o,after:o});return C(),S(),E}function p(y,_){return gz(y,{align:_,alignDelimiters:i,padding:n,stringLength:a})}function g(y,_,j){const N=y.children;let S=-1;const C=[],E=_.enter("table");for(;++S<N.length;)C[S]=v(N[S],_,j);return E(),C}function v(y,_,j){const N=y.children;let S=-1;const C=[],E=_.enter("tableRow");for(;++S<N.length;)C[S]=f(N[S],y,_,j);return E(),C}function b(y,_,j){let N=qN.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function a$(){return{exit:{taskListCheckValueChecked:L2,taskListCheckValueUnchecked:L2,paragraph:o$}}}function l$(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:c$}}}function L2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function o$(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const h=a[o];if(h.type==="paragraph"){u=h;break}}u===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function c$(e,t,n,i){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",h=n.createTracker(i);o&&h.move(u);let f=qN.listItem(e,t,n,{...i,...h.current()});return o&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(g){return g+u}}function u$(){return[PD(),rz(),cz(),Jz(),a$()]}function d$(e){return{extensions:[BD(),az(e),uz(),r$(e),l$()]}}const h$={tokenize:v$,partial:!0},VN={tokenize:b$,partial:!0},GN={tokenize:y$,partial:!0},YN={tokenize:_$,partial:!0},f$={tokenize:w$,partial:!0},XN={name:"wwwAutolink",tokenize:g$,previous:WN},QN={name:"protocolAutolink",tokenize:x$,previous:ZN},Sr={name:"emailAutolink",tokenize:m$,previous:KN},Gi={};function p$(){return{text:Gi}}let Ka=48;for(;Ka<123;)Gi[Ka]=Sr,Ka++,Ka===58?Ka=65:Ka===91&&(Ka=97);Gi[43]=Sr;Gi[45]=Sr;Gi[46]=Sr;Gi[95]=Sr;Gi[72]=[Sr,QN];Gi[104]=[Sr,QN];Gi[87]=[Sr,XN];Gi[119]=[Sr,XN];function m$(e,t,n){const i=this;let a,o;return u;function u(v){return!xx(v)||!KN.call(i,i.previous)||_v(i.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(v))}function h(v){return xx(v)?(e.consume(v),h):v===64?(e.consume(v),f):n(v)}function f(v){return v===46?e.check(f$,g,p)(v):v===45||v===95||Wn(v)?(o=!0,e.consume(v),f):g(v)}function p(v){return e.consume(v),a=!0,f}function g(v){return o&&a&&us(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function g$(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!WN.call(i,i.previous)||_v(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(h$,e.attempt(VN,e.attempt(GN,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function x$(e,t,n){const i=this;let a="",o=!1;return u;function u(v){return(v===72||v===104)&&ZN.call(i,i.previous)&&!_v(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),h):n(v)}function h(v){if(us(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),h;if(v===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(v),f}return n(v)}function f(v){return v===47?(e.consume(v),o?p:(o=!0,f)):n(v)}function p(v){return v===null||hf(v)||Bt(v)||dl(v)||Nf(v)?n(v):e.attempt(VN,e.attempt(GN,g),n)(v)}function g(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function v$(e,t,n){let i=0;return a;function a(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),a):u===46&&i===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function b$(e,t,n){let i,a,o;return u;function u(p){return p===46||p===95?e.check(YN,f,h)(p):p===null||Bt(p)||dl(p)||p!==45&&Nf(p)?f(p):(o=!0,e.consume(p),u)}function h(p){return p===95?i=!0:(a=i,i=void 0),e.consume(p),u}function f(p){return a||i||!o?n(p):t(p)}}function y$(e,t){let n=0,i=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&i<n?o(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(YN,t,o)(u):u===null||Bt(u)||dl(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&i++,e.consume(u),a}}function _$(e,t,n){return i;function i(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),i):h===38?(e.consume(h),o):h===93?(e.consume(h),a):h===60||h===null||Bt(h)||dl(h)?t(h):n(h)}function a(h){return h===null||h===40||h===91||Bt(h)||dl(h)?t(h):i(h)}function o(h){return us(h)?u(h):n(h)}function u(h){return h===59?(e.consume(h),i):us(h)?(e.consume(h),u):n(h)}}function w$(e,t,n){return i;function i(o){return e.consume(o),a}function a(o){return Wn(o)?n(o):t(o)}}function WN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Bt(e)}function ZN(e){return!us(e)}function KN(e){return!(e===47||xx(e))}function xx(e){return e===43||e===45||e===46||e===95||Wn(e)}function _v(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const S$={tokenize:A$,partial:!0};function k$(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:E$,continuation:{tokenize:T$},exit:M$}},text:{91:{name:"gfmFootnoteCall",tokenize:C$},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:j$,resolveTo:N$}}}}function j$(e,t,n){const i=this;let a=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;a--;){const f=i.events[a][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return h;function h(f){if(!u||!u._balanced)return n(f);const p=vi(i.sliceSerialize({start:u.end,end:i.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function N$(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},h=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...h),e}function C$(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,u;return h;function h(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),f}function f(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(v){if(o>999||v===93&&!u||v===null||v===91||Bt(v))return n(v);if(v===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(vi(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Bt(v)||(u=!0),o++,e.consume(v),v===92?g:p}function g(v){return v===91||v===92||v===93?(e.consume(v),o++,p):p(v)}}function E$(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,u=0,h;return f;function f(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(_)}function g(_){if(u>999||_===93&&!h||_===null||_===91||Bt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=vi(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Bt(_)||(h=!0),u++,e.consume(_),_===92?v:g}function v(_){return _===91||_===92||_===93?(e.consume(_),u++,g):g(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(o)||a.push(o),kt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function T$(e,t,n){return e.check(Pu,t,e.attempt(S$,t,n))}function M$(e){e.exit("gfmFootnoteDefinition")}function A$(e,t,n){const i=this;return kt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function R$(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(u,h){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let p=f;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[f][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[f][1].end)},v={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[f][1].start)},b=[["enter",g,h],["enter",u[p][1],h],["exit",u[p][1],h],["enter",v,h]],y=h.parser.constructs.insideSpan.null;y&&xi(b,b.length,0,Cf(y,u.slice(p+1,f),h)),xi(b,b.length,0,[["exit",v,h],["enter",u[f][1],h],["exit",u[f][1],h],["exit",g,h]]),xi(u,p-1,f-p+3,b),f=p+b.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function o(u,h,f){const p=this.previous,g=this.events;let v=0;return b;function b(_){return p===126&&g[g.length-1][1].type!=="characterEscape"?f(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=pf(p);if(_===126)return v>1?f(_):(u.consume(_),v++,y);if(v<2&&!n)return f(_);const N=u.exit("strikethroughSequenceTemporary"),S=pf(_);return N._open=!S||S===2&&!!j,N._close=!j||j===2&&!!S,h(_)}}}class O${constructor(){this.map=[],this.index=new Map}add(t,n,i){L$(this,t,n,i)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0,this.index.clear()}}function L$(e,t,n,i){if(n===0&&i.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,a[2].push(...i);return}const o=[t,n,i];e.map.push(o),e.index.set(t,o)}function D$(e,t){let n=!1;const i=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=i.length-1;i[o]=i[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function z$(){return{flow:{null:{name:"table",tokenize:$$,resolveAll:P$}}}}function $$(e,t,n){const i=this;let a=0,o=0,u;return h;function h(I){let q=i.events.length-1;for(;q>-1;){const{type:Q}=i.events[q][1];if(Q==="lineEnding"||Q==="linePrefix")q--;else break}const L=q>-1?i.events[q][1].type:null,de=L==="tableHead"||L==="tableRow"?O:f;return de===O&&i.parser.lazy[i.now().line]?n(I):de(I)}function f(I){return e.enter("tableHead"),e.enter("tableRow"),p(I)}function p(I){return I===124||(u=!0,o+=1),g(I)}function g(I){return I===null?n(I):Ve(I)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),y):n(I):ot(I)?kt(e,g,"whitespace")(I):(o+=1,u&&(u=!1,a+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),v(I)))}function v(I){return I===null||I===124||Bt(I)?(e.exit("data"),g(I)):(e.consume(I),I===92?b:v)}function b(I){return I===92||I===124?(e.consume(I),v):v(I)}function y(I){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(I):(e.enter("tableDelimiterRow"),u=!1,ot(I)?kt(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):_(I))}function _(I){return I===45||I===58?N(I):I===124?(u=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),j):A(I)}function j(I){return ot(I)?kt(e,N,"whitespace")(I):N(I)}function N(I){return I===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),S):I===45?(o+=1,S(I)):I===null||Ve(I)?R(I):A(I)}function S(I){return I===45?(e.enter("tableDelimiterFiller"),C(I)):A(I)}function C(I){return I===45?(e.consume(I),C):I===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return ot(I)?kt(e,R,"whitespace")(I):R(I)}function R(I){return I===124?_(I):I===null||Ve(I)?!u||a!==o?A(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):A(I)}function A(I){return n(I)}function O(I){return e.enter("tableRow"),P(I)}function P(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),P):I===null||Ve(I)?(e.exit("tableRow"),t(I)):ot(I)?kt(e,P,"whitespace")(I):(e.enter("data"),z(I))}function z(I){return I===null||I===124||Bt(I)?(e.exit("data"),P(I)):(e.consume(I),I===92?Z:z)}function Z(I){return I===92||I===124?(e.consume(I),z):z(I)}}function P$(e,t){let n=-1,i=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],h=!1,f=0,p,g,v;const b=new O$;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(h=!1,f!==0&&(D2(b,t,f,p,g),g=void 0,f=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(i=!0,v=void 0,o=[0,0,0,0],u=[0,n+1,0,0],h&&(h=!1,g={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",g,t]])),a=_.type==="tableDelimiterRow"?2:g?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],v=jh(b,t,o,a,void 0,v),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(o[1]!==0&&(u[0]=u[1],v=jh(b,t,o,a,void 0,v)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(h=!0,f=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(f=n,o[1]!==0?(u[0]=u[1],v=jh(b,t,o,a,n,v)):u[1]!==0&&(v=jh(b,t,u,a,n,v)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&D2(b,t,f,p,g),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=D$(t.events,n))}return e}function jh(e,t,n,i,a,o){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",h="tableContent";n[0]!==0&&(o.end=Object.assign({},fo(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const f=fo(t.events,n[1]);if(o={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=fo(t.events,n[2]),g=fo(t.events,n[3]),v={type:h,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",v,t]]),i!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,j=n[3]-n[2]-1;e.add(_,j,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return a!==void 0&&(o.end=Object.assign({},fo(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function D2(e,t,n,i,a){const o=[],u=fo(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),i.end=Object.assign({},u),o.push(["exit",i,t]),e.add(n+1,0,o)}function fo(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const B$={name:"tasklistCheck",tokenize:I$};function F$(){return{text:{91:B$}}}function I$(e,t,n){const i=this;return a;function a(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),o)}function o(f){return Bt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):n(f)}function h(f){return Ve(f)?t(f):ot(f)?e.check({tokenize:U$},t,n)(f):n(f)}}function U$(e,t,n){return kt(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function H$(e){return uN([p$(),k$(),R$(e),z$(),F$()])}const q$={};function wv(e){const t=this,n=e||q$,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(H$(n)),o.push(u$()),u.push(d$(n))}const V$=1500;async function G$(e){var i;try{if(typeof navigator<"u"&&((i=navigator.clipboard)!=null&&i.writeText))return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return document.body.removeChild(t),n}function Af({text:e,label:t="Copy",className:n=""}){const[i,a]=k.useState(!1),o=k.useRef(null);k.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await G$(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),V$))},h=i?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":h,title:h,className:`inline-flex items-center justify-center w-6 h-6 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors ${n}`,children:i?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",className:"w-3.5 h-3.5","aria-hidden":"true",children:[l.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),l.jsx("path",{d:"M10.5 5V3.75A.75.75 0 009.75 3H3.75A.75.75 0 003 3.75v6a.75.75 0 00.75.75H5"})]})})}function xf(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(xf).join(""):typeof e=="object"&&e!==null&&"props"in e?xf((t=e.props)==null?void 0:t.children):""}const m0=/https?:\/\/[^\s<>"'`]+/gi,Y$=`.,;:!?]}>'"`;function X$(e){let t=e.length;for(;t>0;){const n=e[t-1];if(n===")"){const i=e.slice(0,t),a=(i.match(/\(/g)||[]).length,o=(i.match(/\)/g)||[]).length;if(a>=o)break;t--;continue}if(Y$.includes(n)){t--;continue}break}return e.slice(0,t)}function Q$(e){return/^https?:\/\/[^\s/]/i.test(e)}function W$(e){if(!e)return[];const t=[];let n=0;m0.lastIndex=0;let i;for(;(i=m0.exec(e))!==null;){const a=X$(i[0]);!a||!Q$(a)||(i.index>n&&t.push({type:"text",value:e.slice(n,i.index)}),t.push({type:"link",value:a,href:a}),n=i.index+a.length,m0.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const z2=40;function Z$(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>z2?`${t.slice(0,z2-1)}…`:t}`:"Copy"}function JN({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const i=xf(e);if(!i)return l.jsx("code",{className:`px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] font-mono-code border border-cc-border/40 ${n} ${t}`,children:e});const a=W$(i);return l.jsxs("span",{className:`inline-flex items-center align-middle max-w-full gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-cc-fg/[0.06] border border-cc-border/40 ${t}`,children:[l.jsx("code",{className:`min-w-0 break-all font-mono-code ${n}`,children:a.map((o,u)=>o.type==="link"?l.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary underline decoration-cc-primary/40 hover:decoration-cc-primary",children:o.value},u):l.jsx("span",{children:o.value},u))}),l.jsx(Af,{text:i,label:Z$(i),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const vf=25*1024*1024,bf=100*1024*1024;function eC(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const o=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function pa(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function tC(e){return e.startsWith("image/")}function nC({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let i="FILE";return t==="application/pdf"||n==="pdf"?i="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?i="ZIP":["csv","tsv"].includes(n)?i="CSV":["json","yaml","yml","toml","xml"].includes(n)?i="DATA":["md","txt","log"].includes(n)?i="TXT":["doc","docx","rtf","odt"].includes(n)?i="DOC":["xls","xlsx","ods"].includes(n)?i="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?i="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?i="VID":n&&(i=n.slice(0,4).toUpperCase()),l.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[l.jsx("path",{d:"M3 1.75h6.5L13 5.25v9A1.25 1.25 0 0 1 11.75 15.5h-7.5A1.25 1.25 0 0 1 3 14.25V1.75z"}),l.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),l.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:i})]})}function sC({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:o="w-12 h-12"}){const u=tC(t);return l.jsxs("div",{className:"relative group",title:`${e} (${pa(i)})`,children:[l.jsx("div",{className:`${o} rounded-lg overflow-hidden border border-cc-border`,children:u?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):l.jsx(nC,{name:e,mediaType:t})}),a&&l.jsx("button",{onClick:a,"aria-label":`Remove ${e}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-cc-error text-white flex items-center justify-center text-[10px] opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]})}function K$({name:e,mediaType:t,data:n,size:i}){return tC(t)?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e||"attachment",className:"max-w-[150px] sm:max-w-[200px] max-h-[120px] sm:max-h-[150px] rounded-xl object-cover border border-cc-border/30"}):l.jsxs("a",{href:`data:${t};base64,${n}`,download:e||"attachment",className:"inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-cc-border/40 bg-cc-hover/40 hover:bg-cc-hover transition-colors max-w-[260px] no-underline",children:[l.jsx("div",{className:"w-8 h-8 shrink-0 rounded-md overflow-hidden",children:l.jsx(nC,{name:e,mediaType:t})}),l.jsxs("div",{className:"min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate",children:e||"attachment"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:pa(i)})]})]})}function J$({message:e}){const t=va(),[n,i]=k.useState(!1),a=!t&&!!e.detail;return l.jsxs("div",{className:"py-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),l.jsx("span",{className:"text-[11px] text-cc-muted italic font-mono-code px-1 min-w-0 break-words text-center",children:e.content}),a&&l.jsx("button",{type:"button",onClick:()=>i(o=>!o),"aria-expanded":n,className:"shrink-0 text-[11px] text-cc-muted/60 hover:text-cc-muted underline decoration-dotted cursor-pointer",children:n?"hide report":"show report"}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}),a&&n&&l.jsx("pre",{className:"mt-1.5 mx-3 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap break-words max-h-80 overflow-auto rounded-md bg-cc-hover/40 p-2",children:e.detail})]})}function e9({message:e}){return e.role==="system"?l.jsx(J$,{message:e}):e.role==="user"?l.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] px-3.5 sm:px-4 py-2.5 rounded-[16px] rounded-br-[6px] user-bubble-gradient text-cc-fg shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:[e.attachments&&e.attachments.length>0&&l.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.attachments.map((t,n)=>l.jsx(K$,{name:t.name,mediaType:t.media_type,data:t.data,size:t.size},n))}),l.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:l.jsx(Sv,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(r9,{message:e})})}function t9(e){const t=[];for(const n of e)if(n.type==="tool_use"){const i=t[t.length-1];(i==null?void 0:i.kind)==="tool_group"&&i.name===n.name?i.items.push({id:n.id,name:n.name,input:n.input}):t.push({kind:"tool_group",name:n.name,items:[{id:n.id,name:n.name,input:n.input}]})}else t.push({kind:"content",block:n});return t}function n9(e){const t=new Map;for(const n of e)n.type==="tool_use"&&t.set(n.id,{name:n.name,input:n.input});return t}function s9(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function i9({streaming:e}){return l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 py-0.5 text-[11px] text-cc-muted/50 italic",children:[l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full bg-cc-muted/40 shrink-0 ${e?"animate-pulse":""}`}),l.jsx("span",{children:e?"Thinking…":"Thought"})]})}function r9({message:e}){var u;const t=e.contentBlocks||[],n=va(),i=k.useMemo(()=>t9(t),[t]),a=k.useMemo(()=>n9(t),[t]),o=k.useMemo(()=>n?i.filter(h=>!s9(h)):i,[i,n]);if(n&&o.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Uh,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(i9,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const h=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Uh,{}),l.jsx("div",{className:"flex-1 min-w-0",children:h?l.jsx(rC,{text:e.content}):l.jsx(Sv,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Uh,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((h,f)=>{if(h.kind==="content")return l.jsx(a9,{block:h.block,toolUseById:a},f);if(h.items.length===1){const p=h.items[0];return l.jsx(hS,{name:p.name,input:p.input,toolUseId:p.id},f)}return l.jsx(c9,{name:h.name,items:h.items},f)})})]})}function Uh(){return l.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function Sv({text:e,showCursor:t=!1}){return l.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[l.jsx(mv,{remarkPlugins:[wv],components:{p:({children:n})=>l.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>l.jsx("em",{className:"italic",children:n}),h1:({children:n})=>l.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>l.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>l.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>l.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>l.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>l.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof i=="string"&&i.includes(`
|
|
101
|
+
`)){const h=(o==null?void 0:o[1])||"",f=xf(i);return l.jsxs("div",{className:"my-2.5 rounded-xl overflow-hidden border border-cc-border shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),h&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:h}),l.jsx(Af,{text:f,label:"Copy code",className:"ml-auto -mr-1"})]}),l.jsx("pre",{className:"px-3 sm:px-4 py-2.5 sm:py-3 bg-cc-code-bg text-cc-code-fg text-[12px] sm:text-[13px] font-mono-code leading-relaxed overflow-x-auto",children:l.jsx("code",{children:i})})]})}return l.jsx(JN,{children:i})},pre:({children:n})=>l.jsx(l.Fragment,{children:n}),table:({children:n})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>l.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>l.jsx("th",{className:"px-3 py-1.5 text-left text-xs font-semibold text-cc-fg border-b border-cc-border",children:n}),td:({children:n})=>l.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&l.jsx("span",{"data-testid":"assistant-stream-cursor",className:"inline-block w-[3px] h-[18px] bg-cc-primary rounded-full ml-0.5 align-middle animate-[pulse-dot_1s_ease-in-out_infinite]"})]})}function a9({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(Sv,{text:e.text});if(e.type==="thinking")return l.jsx(rC,{text:e.thinking});if(e.type==="tool_use")return l.jsx(hS,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),a=i==null?void 0:i.name,o=e.is_error??!1;return a==="Bash"?l.jsx(l9,{text:n,isError:o}):l.jsx(o9,{content:n,isError:o})}return null}function iC(e){return`${e} ${e===1?"line":"lines"}`}function l9({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,o]=k.useState(!1),u=va(),[h,f]=k.useState(!1),p=a||!i?e:n.slice(-20).join(`
|
|
102
|
+
`),g=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Af,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:p}),i&&l.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[l.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:a?`${n.length} lines`:`last 20 of ${n.length}`}),l.jsx("button",{onClick:()=>o(!a),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:a?"Show tail":"Show all"})]})]});return u?l.jsxs("div",{children:[l.jsx(_f,{open:h,onToggle:()=>f(!h),marker:"›",label:t?"Error output":"Output",meta:iC(n.length),labelClassName:t?"text-cc-error/70":""}),h&&l.jsx("div",{className:"mt-1",children:g})]}):g}function o9({content:e,isError:t}){const n=va(),[i,a]=k.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Af,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:e})]});return n?l.jsxs("div",{children:[l.jsx(_f,{open:i,onToggle:()=>a(!i),marker:"›",label:t?"Error result":"Result",meta:iC(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:o})]}):o}function c9({name:e,items:t}){const[n,i]=k.useState(!1),a=Lo(e),o=Hi(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ol,{type:a}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:o}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,h)=>{const f=wo(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})}function rC({text:e}){const t=e.trim(),n=va(),[i,a]=k.useState(!1),o=t.split(`
|
|
103
|
+
`),u=n?2:8,h=n?200:600,f=o.length>u||t.length>h,p=f&&!i?o.slice(0,u).join(`
|
|
104
|
+
`):t;return n&&!t?null:l.jsxs("div",{children:[l.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:l.jsx(mv,{remarkPlugins:[wv],components:{p:({children:g})=>l.jsx("p",{className:"mb-2 last:mb-0",children:g}),ul:({children:g})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:g}),ol:({children:g})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:g}),li:({children:g})=>l.jsx("li",{children:g}),code:({children:g})=>l.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:g})},children:p||"No thinking text captured."})}),f&&!i&&l.jsx("button",{onClick:()=>a(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function ru(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function po(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function $2(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":u9(t):"N/A"}catch{return"N/A"}}function vx(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4);return i>0?`${i}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function P2(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function u9(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function d9({tools:e}){return e.length===0?null:l.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono-code pl-10 py-1.5 animate-[fadeSlideIn_0.3s_ease-out]",role:"status","aria-label":`${e.length} tool${e.length>1?"s":""} running`,children:e.map((t,n)=>l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[l.jsx(ol,{type:Lo(t.toolName)}),l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),l.jsx("span",{className:"text-cc-fg/70",children:Hi(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function h9({entries:e}){const[t,n]=k.useState(!1),i=k.useMemo(()=>{const a=e.reduce((f,p)=>f+p.elapsedSeconds,0),o=Math.max(...e.map(f=>f.elapsedSeconds),.1),u=e.filter(f=>f.isError).length,h=e.filter(f=>!f.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:h}},[e]);return e.length===0?null:l.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&l.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(a=>l.jsx("span",{className:`h-full rounded-full ${a.isError?"bg-cc-error/40":a.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,a.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${Hi(a.toolName)} ${a.elapsedSeconds}s`},a.toolUseId))})]}),t&&l.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(a=>l.jsx(f9,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function f9({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[l.jsx(ol,{type:Lo(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Hi(e.toolName)})]}),l.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:l.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),l.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&l.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}function p9(e){var n;const t=e.contentBlocks;return t&&t.length>0?t.some(i=>i.type==="text"&&i.text.trim().length>0):!!((n=e.content)!=null&&n.trim())}function m9(e){if(e.kind!=="message")return!1;const t=e.msg;if(t.role==="user")return!0;if(t.role==="system")return!!t.meta;if(t.isStreaming)return!0;if(t.stopReason==="tool_use")return!1;const n=t.contentBlocks;return n!=null&&n.some(i=>i.type==="tool_use")?!1:p9(t)}function g9(e){switch(e.kind){case"message":return e.msg.id;case"tool_msg_group":return e.firstId;case"subagent":return e.taskToolUseId;case"activity_run":return e.key}}function x9(e){if(e.length>=2)return!0;const t=e[0];return!(t.kind==="message"&&t.msg.role==="system")}function v9(e){const t=[];let n=[];const i=()=>{n.length!==0&&(x9(n)?t.push({kind:"activity_run",key:g9(n[0]),children:n}):t.push(...n),n=[])};for(const a of e)a.kind==="activity_run"||m9(a)?(i(),t.push(a)):n.push(a);return i(),t}const B2=160;function bx(e){const t=e.split(`
|
|
105
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.length>B2?`${t.slice(0,B2)}…`:t:""}function aC(e,t){const n=wo(e,t);return{label:n?`${Hi(e)} · ${n}`:Hi(e),toolName:e}}function b9(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="tool_use")return aC(n.name,n.input);if(n.type==="text"&&n.text.trim())return{label:bx(n.text),italic:!0};if(n.type==="thinking"&&n.thinking.trim())return{label:bx(n.thinking),italic:!0}}return null}function y9(e){var t;switch(e.kind){case"subagent":return{label:`Subagent · ${e.description||"Subagent"}`,toolName:"Task"};case"tool_msg_group":{const n=e.items[e.items.length-1];return n?aC(n.name,n.input):null}case"activity_run":return Rf(e).latest;case"message":{const n=e.msg;if(n.role==="system")return{label:n.content,italic:!0};const i=n.contentBlocks;return i&&i.length>0?b9(i)??{label:"Thinking…",italic:!0}:(t=n.content)!=null&&t.trim()?{label:bx(n.content),italic:!0}:{label:"Thinking…",italic:!0}}}}function lC(e){switch(e.kind){case"message":return[e.msg.timestamp,e.msg.timestamp];case"tool_msg_group":return[e.startedAt,e.endedAt];case"subagent":{let t=null,n=null;for(const i of e.children){const[a,o]=lC(i);a!==null&&(t===null||a<t)&&(t=a),o!==null&&(n===null||o>n)&&(n=o)}return[t,n]}case"activity_run":{const t=Rf(e);return[t.startedAt,t.endedAt]}}}function Rf(e,t){let n=0,i=0,a=0,o=null,u=null;for(const f of e.children){if(f.kind==="subagent")i++;else if(f.kind==="tool_msg_group")n+=f.items.length;else if(f.kind==="message")for(const v of f.msg.contentBlocks??[])v.type==="tool_use"&&n++,v.type==="tool_result"&&v.is_error&&a++;else{const v=Rf(f);n+=v.toolCalls,i+=v.subagents,a+=v.errors}const[p,g]=lC(f);p!==null&&(o===null||p<o)&&(o=p),g!==null&&(u===null||g>u)&&(u=g)}t!==void 0&&o!==null&&(u=Math.max(u??t,t));const h=e.children[e.children.length-1];return{toolCalls:n,subagents:i,errors:a,steps:e.children.length,startedAt:o,endedAt:u,latest:h?y9(h):null}}function _9({run:e,live:t,children:n}){const[i,a]=k.useState(!1),o=t?Date.now():void 0,u=k.useMemo(()=>Rf(e,o),[e,o]),h=u.startedAt!==null&&u.endedAt!==null?Math.max(0,u.endedAt-u.startedAt):null,f=[];u.toolCalls>0&&f.push(`${u.toolCalls} tool call${u.toolCalls===1?"":"s"}`),u.subagents>0&&f.push(`${u.subagents} subagent${u.subagents===1?"":"s"}`),u.errors>0&&f.push(l.jsxs("span",{className:"text-cc-error",children:[u.errors," error",u.errors===1?"":"s"]},"err")),h!==null&&h>=1e3&&f.push(po(h));const p=t?"Working":"Worked",g=`${u.steps} step${u.steps===1?"":"s"}`,v=u.latest;return l.jsxs("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]","data-activity-run":e.key,children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Uh,{}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("button",{type:"button",onClick:()=>a(b=>!b),"aria-expanded":i,"aria-label":`${p}: ${g}, ${i?"collapse":"expand"} details`,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer min-w-0",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full shrink-0 ${t?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsx("span",{className:"text-[11px] font-medium text-cc-fg/70 shrink-0",children:p}),f.length>0&&l.jsx("span",{className:"text-[11px] text-cc-muted/60 font-mono-code truncate min-w-0 tabular-nums",children:f.map((b,y)=>l.jsxs("span",{children:[l.jsx("span",{className:"text-cc-muted/35",children:" · "}),b]},y))}),l.jsx("span",{className:"ml-auto text-[10px] text-cc-muted/40 group-hover:text-cc-muted/70 shrink-0 tabular-nums",children:i?"hide":g})]}),!i&&v&&l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 pl-4 py-0.5 text-[11px] min-w-0",children:[v.toolName&&l.jsx(ol,{type:Lo(v.toolName)}),l.jsx("span",{className:`truncate min-w-0 ${v.italic?"italic text-cc-muted/60":"font-mono-code text-cc-muted/70"}`,children:v.label})]})]})]}),i&&l.jsx("div",{className:"mt-4 space-y-5 sm:space-y-7 animate-[fadeSlideIn_0.2s_ease-out]",children:n})]})}const Nh=100,w9=40,S9=120,F2=1e4,k9=15*6e4,g0=new Map,j9=[],N9=[];function C9(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function E9(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function I2(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function T9(e){return e.kind==="message"?(e.msg.contentBlocks||[]).filter(n=>n.type==="tool_use").filter(n=>n.name==="Task").map(n=>n.id):e.kind==="tool_msg_group"&&e.toolName==="Task"?e.items.map(t=>t.id):[]}function oC(e){const t=[];for(const n of e){const i=E9(n);if(i){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===i){a.items.push(...I2(n)),a.endedAt=Math.max(a.endedAt,n.timestamp);continue}t.push({kind:"tool_msg_group",toolName:i,items:I2(n),firstId:n.id,startedAt:n.timestamp,endedAt:n.timestamp})}else t.push({kind:"message",msg:n})}return t}function cC(e,t,n){const i=oC(e),a=[];for(const o of i){a.push(o);const u=T9(o);for(const h of u){const f=n.get(h);if(f&&f.length>0){const p=t.get(h)||{description:"Subagent",agentType:""},g=cC(f,t,n);a.push({kind:"subagent",taskToolUseId:h,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:g})}}}return a}function M9(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const o of a.contentBlocks)if(o.type==="tool_use"&&o.name==="Task"){const{input:u,id:h}=o,f=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(b=>typeof b=="string"&&b.length>0):void 0,p=f&&f.length>0?f.length:void 0,g=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,v=typeof(u==null?void 0:u.codex_status)=="string"||g!==void 0||p!==void 0;t.set(h,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:v?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:g,receiverThreadIds:f})}}if(t.size===0)return oC(e);const n=new Map,i=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let o=n.get(a.parentToolUseId);o||(o=[],n.set(a.parentToolUseId,o)),o.push(a)}else i.push(a);return cC(i,t,n)}function A9({group:e}){const[t,n]=k.useState(!1),i=Lo(e.toolName),a=Hi(e.toolName),o=e.items.length;if(o===1){const u=e.items[0];return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(U2,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ol,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:wo(u.name,u.input)})]}),t&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:l.jsx("pre",{className:"mt-2 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(u.input,null,2)})})]})})]})})}return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(U2,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ol,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:o})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,h)=>{const f=wo(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})})]})})}function kv({entries:e,toolActivity:t,liveRunKey:n}){return l.jsx(l.Fragment,{children:e.map((i,a)=>{if(i.kind==="activity_run")return l.jsx(_9,{run:i,live:i.key===n,children:l.jsx(kv,{entries:i.children,toolActivity:t})},i.key);if(i.kind==="tool_msg_group")return l.jsx(A9,{group:i},i.firstId||a);if(i.kind==="subagent")return l.jsx(L9,{group:i},i.taskToolUseId);const o=i.msg,u=R9(o),h=t&&u.length>0?t.filter(p=>u.includes(p.toolUseId)):[],f=h.length>0&&h.every(p=>p.completedAt);return l.jsxs("div",{children:[l.jsx(e9,{message:o}),f&&l.jsx(h9,{entries:h})]},o.id)})})}function R9(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function O9(e){if(!e)return null;const t=e.trim().toLowerCase();return t?t==="completed"?{label:"completed",summaryLabel:"completed",className:"text-green-600 bg-green-500/15"}:t==="failed"||t==="error"||t==="errored"?{label:"failed",summaryLabel:"failed",className:"text-cc-error bg-cc-error/10"}:t==="pending"||t==="pendinginit"||t==="pending_init"?{label:"pending",summaryLabel:"pending",className:"text-amber-700 bg-amber-500/15"}:t==="running"||t==="inprogress"||t==="in_progress"||t==="started"?{label:"running",summaryLabel:"running",className:"text-blue-600 bg-blue-500/15"}:{label:e,summaryLabel:"running",className:"text-amber-700 bg-amber-500/15"}:null}function L9({group:e}){const[t,n]=k.useState(!1),i=e.description||"Subagent",a=e.agentType,o=e.children.length,u=O9(e.status),h=e.receiverCount,f=e.senderThreadId,p=e.receiverThreadIds||[],g=e.backend||"claude",v=e.children[e.children.length-1],b=k.useMemo(()=>{var y,_;if(!v)return"";if(v.kind==="tool_msg_group")return`${Hi(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const j=(y=v.msg.content)==null?void 0:y.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const N=(_=v.msg.contentBlocks)==null?void 0:_.find(S=>S.type==="tool_use");if(N)return Hi(N.name)}return""},[v]);return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),h!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[h," agent",h===1?"":"s"]}),!t&&b&&l.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:b}),l.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:o})]}),t&&l.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(f||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[f&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",f]}),p.length>0&&l.jsxs("span",{children:["receivers: ",p.map(y=>l.jsx("span",{className:"font-mono-code ml-1",children:y},y))]})]}),l.jsx(kv,{entries:e.children})]})]})})}function U2(){return l.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function D9({sessionId:e}){var Zt;const t=W(ie=>ie.messages.get(e)??j9),n=W(ie=>(ie.sdkSessions||N9).find(ke=>ke.sessionId===e)),i=W(ie=>ie.streamingStartedAt.get(e)),a=W(ie=>ie.streamingOutputTokens.get(e)),o=W(ie=>ie.sessionStatus.get(e)),u=W(ie=>ie.lastActivityAt.get(e)),h=W(ie=>ie.sessionProcesses.get(e)),f=W(ie=>ie.toolProgress.get(e)),p=W(ie=>ie.toolActivity.get(e)),g=k.useRef(null),v=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(Nh),[S,C]=k.useState([]),[E,R]=k.useState(0),[A,O]=k.useState(!1),[P,z]=k.useState(!1),[Z,I]=k.useState(!1),[q,L]=k.useState(""),de=k.useRef(new Set),Q=W(ie=>ie.chatTabReentryTickBySession.get(e)??0),V=k.useMemo(()=>t.some(ie=>ie.role==="assistant"&&ie.isStreaming),[t]),G=k.useMemo(()=>(h??[]).filter(ie=>ie.status==="running"),[h]),H=G.length>0,ae=k.useMemo(()=>{const ie=p??[];for(let ke=ie.length-1;ke>=0;ke--)if(!ie[ke].completedAt)return ie[ke]},[p]),ye=k.useMemo(()=>G.length>0?Math.min(...G.map(ie=>ie.startedAt)):null,[G]),T=k.useMemo(()=>(n==null?void 0:n.backendType)==="codex"?"":((n==null?void 0:n.resumeSessionAt)||"").trim(),[n==null?void 0:n.backendType,n==null?void 0:n.resumeSessionAt]),Ne=T.length>0,Ce=n!=null&&n.forkSession?"Forked from":"Continuing from",$=k.useMemo(()=>{if(S.length===0)return t;const ie=[],ke=new Set;for(const Qe of S)ke.has(Qe.id)||(ke.add(Qe.id),ie.push(Qe));for(const Qe of t)ke.has(Qe.id)||(ke.add(Qe.id),ie.push(Qe));return ie},[S,t]),B=k.useMemo(()=>M9($),[$]);k.useEffect(()=>{N(Nh),C([]),R(0),O(!1),z(!1),I(!1),L(""),de.current=new Set},[e,T]);const oe=B.length,be=oe>j,je=k.useMemo(()=>be?B.slice(oe-j):B,[B,be,oe,j]),Ee=oe-je.length,Be=va(),Oe=k.useMemo(()=>Be?v9(je):je,[Be,je]),Te=Oe[Oe.length-1],Re=o==="running"&&(Te==null?void 0:Te.kind)==="activity_run"?Te.key:void 0,Ft=k.useCallback(()=>{const ie=v.current,ke=(ie==null?void 0:ie.scrollHeight)??0;N(Qe=>Qe+Nh),requestAnimationFrame(()=>{if(ie){const Qe=ie.scrollHeight;ie.scrollTop+=Qe-ke}})},[]),vn=k.useCallback(async(ie={})=>{if(!Ne||!T||Z)return;const ke=v.current,Qe=(ke==null?void 0:ke.scrollHeight)??0,nt=P?E:0;I(!0),L("");try{const Kt=await we.getClaudeSessionHistory(T,{cursor:nt,limit:w9}),It=Kt.messages.map(U=>({id:U.id,role:U.role,content:U.content,contentBlocks:U.role==="assistant"?U.contentBlocks:void 0,timestamp:U.timestamp||Date.now(),model:U.role==="assistant"?U.model:void 0,stopReason:U.role==="assistant"?U.stopReason:void 0})),ce=[];for(const U of It)de.current.has(U.id)||(de.current.add(U.id),ce.push(U));C(U=>[...ce,...U]),R(Kt.nextCursor),O(Kt.hasMore),z(!0),ce.length>0&&N(U=>U+ce.length),ie.preserveScroll!==!1&&ke&&requestAnimationFrame(()=>{const U=ke.scrollHeight;ke.scrollTop+=U-Qe})}catch(Kt){const It=Kt instanceof Error?Kt.message:String(Kt);L(It||"Failed to load previous history"),P||(C([]),R(0),O(!1))}finally{I(!1)}},[Ne,T,Z,P,E]);k.useEffect(()=>{if(!i&&o!=="running"&&!H){_(0);return}const ie=i||Date.now();_(Date.now()-ie);const ke=setInterval(()=>_(Date.now()-ie),1e3);return()=>clearInterval(ke)},[i,o,H]);function Vt(){const ie=v.current;if(!ie)return;b.current=ie.scrollHeight-ie.scrollTop-ie.clientHeight<120;const ke=Math.max(0,ie.scrollHeight-ie.clientHeight-ie.scrollTop);g0.set(e,ke),Ne&&P&&A&&!Z&&ie.scrollTop<=S9&&vn({preserveScroll:!0})}const St=k.useCallback(()=>{const ie=v.current;if(!ie)return;const ke=ie.style.scrollBehavior;ie.style.scrollBehavior="auto",ie.scrollTop=ie.scrollHeight,ie.style.scrollBehavior=ke},[]),wt=k.useCallback(()=>{const ie=v.current;if(!ie)return;const ke=ie.style.scrollBehavior;ie.style.scrollBehavior="auto";const Qe=g0.get(e);typeof Qe=="number"?ie.scrollTop=Math.max(0,ie.scrollHeight-ie.clientHeight-Qe):ie.scrollTop=ie.scrollHeight,ie.style.scrollBehavior=ke},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>wt())},[e,wt]),k.useEffect(()=>()=>{const ie=v.current;if(!ie)return;const ke=Math.max(0,ie.scrollHeight-ie.clientHeight-ie.scrollTop);g0.set(e,ke)},[e]),k.useEffect(()=>{Q&&requestAnimationFrame(()=>St())},[Q,St]),k.useEffect(()=>{var ie;b.current&&((ie=g.current)==null||ie.scrollIntoView({behavior:"smooth"}))},[t]),$.length===0)return l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-cc-primary/10 to-cc-primary/5 border border-cc-primary/15 flex items-center justify-center shadow-[0_4px_20px_rgba(217,119,87,0.08)]",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[l.jsx("polyline",{points:"4 17 10 11 4 5"}),l.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),l.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary/40 animate-[gentle-bounce_2s_ease-in-out_infinite]",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),l.jsx("div",{className:"text-center max-w-xs",children:Ne?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),l.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[Ce," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:T.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void vn({preserveScroll:!1}),disabled:Z,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),Z?"Loading...":"Load previous history"]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const We=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,xt=H&&(o!=="running"||We>=F2)?"background":We>=k9&&!ae?"stalled":We>=F2?"quiet":"active";return l.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[l.jsx("div",{className:"pointer-events-none absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-cc-bg to-transparent z-10"}),l.jsx("div",{ref:v,onScroll:Vt,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:l.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[Ne&&!P&&l.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[Ce," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[T," ",n!=null&&n.cwd?`· ${C9(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void vn({preserveScroll:!0}),disabled:Z,className:"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-lg hover:bg-cc-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer",children:Z?"Loading...":"Load previous history"})]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}),Ne&&P&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:A?Z?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),be&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Ft,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(Nh,Ee)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ee," hidden)"]})]})}),l.jsx(kv,{entries:Oe,toolActivity:p,liveRunKey:Re}),f&&f.size>0&&!V&&l.jsx(d9,{tools:Array.from(f.values())}),o==="compacting"&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),l.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),l.jsx("span",{children:"Compacting context..."})]}),(o==="running"||H)&&y>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":xt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${xt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${xt==="stalled"?"bg-cc-warning animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`}),xt==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:G.length===1?"Background process running":`${G.length} background processes running`}),ye!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:po(Math.max(0,Date.now()-ye))})]}),((Zt=G[0])==null?void 0:Zt.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:G[0].description})]})]}):xt==="stalled"?l.jsxs("span",{children:["No activity for ",po(We)," — the agent may be stuck"]}):xt==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:ae?`Running ${ae.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:ae?po(Math.max(0,Date.now()-ae.startedAt)):`no update for ${po(We)}`}),(ae==null?void 0:ae.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:ae.preview})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:po(y)}),(a??0)>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsxs("span",{className:"tabular-nums",children:[ru(a)," tokens"]})]})]})]}),l.jsx("div",{ref:g})]})})]})}const z9={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function $9(e,t){for(const[i,a]of Object.entries(z9))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function P9(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:$9(t.value,n)}))}const uC=[{value:"claude-opus-5-5",label:"Opus 5.5",icon:""},{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5-1",label:"Fable 5.1",icon:"★"},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-5-5",label:"Sonnet 5.5",icon:""},{value:"claude-sonnet-5",label:"Sonnet 5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],dC=[{value:"gpt-6-astra",label:"GPT-6-Astra",icon:"✦"},{value:"gpt-5.6-sol",label:"GPT-5.6-Sol",icon:"■"},{value:"gpt-5.6-terra",label:"GPT-5.6-Terra",icon:"✳"},{value:"gpt-5.6-luna",label:"GPT-5.6-Luna",icon:"⚡"},{value:"gpt-5.5",label:"GPT-5.5",icon:"◆"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"}],jv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],Nv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],B9=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],hC=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],fC=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function pC(e){return e==="codex"?dC:uC}function H2(e){return e==="codex"?Nv:jv}function hF(e){return e==="codex"?fC:hC}function q2(e){return e==="codex"?dC[0].value:uC[0].value}function V2(e){return e==="codex"?Nv[0].value:jv[0].value}function fF(e){return e==="codex"?fC[0].value:hC[0].value}function F9(e){return e==="codex"?[]:B9}function G2({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=W(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=W(b=>b.sessions.get(e)),u=W(b=>b.cliConnected.get(e)??!1),h=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",f=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=pC(h),g=p.find(b=>b.value===f)||(f?{label:f,icon:"?"}:null),v=k.useCallback(b=>{if(n(!1),b===f)return;Xn(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=W.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,f]);return k.useEffect(()=>{if(!t)return;const b=y=>{i.current&&!i.current.contains(y.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),k.useEffect(()=>{if(!t)return;const b=y=>{y.key==="Escape"&&n(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t]),!u||!g?null:l.jsxs("div",{ref:i,className:"relative shrink-0",children:[l.jsxs("button",{onClick:()=>n(b=>!b),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${g.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[g.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),l.jsx("span",{children:g.label}),l.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:l.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&l.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(b=>l.jsxs("button",{onClick:()=>v(b.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${b.value===f?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":b.value===f,children:[b.icon&&l.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:b.icon}),l.jsx("span",{className:"flex-1 text-left",children:b.label}),b.value===f&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},b.value))})]})}function mC({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:a,menuRef:o,className:u=""}){return e?l.jsx("div",{ref:o,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((h,f)=>l.jsxs("button",{"data-prompt-index":f,onClick:()=>a(h),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${f===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",h.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:h.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:h.scope})]},h.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function gC({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,o]=k.useState(!1),[u,h]=k.useState(0),[f,p]=k.useState([]),[g,v]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{v(!0);try{const S=await we.listPrompts(n);p(S.filter(C=>!!C.name.trim()))}catch{p([])}finally{v(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const S=e.slice(0,t),C=S.match(/(^|\s)@([^\s@]*)$/);if(!C||C.index===void 0)return null;const E=S.length-C[0].length+C[1].length;return{query:C[2]||"",start:E,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const S=_.query.toLowerCase();if(!S)return f;const C=f.filter(R=>R.name.toLowerCase().startsWith(S)),E=f.filter(R=>!R.name.toLowerCase().startsWith(S)&&R.name.toLowerCase().includes(S));return[...C,...E]},[a,_,f]);k.useEffect(()=>{const S=i&&!!_;S&&!a?(o(!0),h(0)):!S&&a&&o(!1)},[i,_,a]),k.useEffect(()=>{u>=j.length&&h(Math.max(0,j.length-1))},[j.length,u]),k.useEffect(()=>{if(!b.current||!a)return;const C=b.current.querySelectorAll("[data-prompt-index]")[u];C&&C.scrollIntoView({block:"nearest"})},[u,a]);const N=k.useCallback(S=>{if(!_)return{nextText:e,nextCursor:t};const C=`${S.content} `,E=`${e.slice(0,_.start)}${C}${e.slice(_.end)}`,R=_.start+C.length;return{nextText:E,nextCursor:R}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:h,mentionContext:_,filteredPrompts:j,promptsLoading:g,savedPrompts:f,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const I9=[];function Y2({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",h=o?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",f=o?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return l.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?h:f:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),l.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),l.jsx("span",{children:i})]})}function Ch({onClick:e,disabled:t,active:n,title:i,children:a}){return l.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:a})}function X2(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}function Q2({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",h=o?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?l.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):l.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?h:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function U9({sessionId:e}){var It,ce;const[t,n]=k.useState(""),[i,a]=k.useState([]),[o,u]=k.useState(null),[h,f]=k.useState(!1),[p,g]=k.useState(!1),[v,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState("global"),[E,R]=k.useState(null),[A,O]=k.useState(0),P=k.useRef(null),z=k.useRef(null),Z=k.useRef(null),I=k.useRef(null),q=W(U=>U.cliConnected),L=W(U=>U.sessions.get(e)),de=W(U=>U.previousPermissionMode.get(e)||"acceptEdits"),Q=q.get(e)??!1,V=(L==null?void 0:L.permissionMode)||"acceptEdits",G=V==="plan",H=(L==null?void 0:L.backend_type)==="codex",ye=((ce=(It=(H?Nv:jv).find(U=>U.value===V))==null?void 0:It.label)==null?void 0:ce.toLowerCase())||V,T=gC({text:t,caretPos:A,cwd:L==null?void 0:L.cwd,enabled:!p}),Ne=k.useMemo(()=>{const U=[];if(L!=null&&L.slash_commands)for(const fe of L.slash_commands)U.push({name:fe,type:"command"});if(L!=null&&L.skills)for(const fe of L.skills)U.push({name:fe,type:"skill"});return U},[L==null?void 0:L.slash_commands,L==null?void 0:L.skills]),Ce=k.useMemo(()=>{if(!p)return[];const U=t.match(/^\/(\S*)$/);if(!U)return[];const fe=U[1].toLowerCase();return fe===""?Ne:Ne.filter(Ae=>Ae.name.toLowerCase().includes(fe))},[t,p,Ne]);k.useEffect(()=>{const U=t.startsWith("/")&&/^\/\S*$/.test(t)&&Ne.length>0;U&&!p?(g(!0),b(0)):!U&&p&&g(!1)},[t,Ne.length,p]),k.useEffect(()=>{v>=Ce.length&&b(Math.max(0,Ce.length-1))},[Ce.length,v]),k.useEffect(()=>{if(!Z.current||!p)return;const fe=Z.current.querySelectorAll("[data-cmd-index]")[v];fe&&fe.scrollIntoView({block:"nearest"})},[v,p]),k.useEffect(()=>{if(I.current===null||!P.current)return;const U=I.current;P.current.setSelectionRange(U,U),I.current=null},[t]);const $=k.useCallback(U=>{var fe;n(`/${U.name} `),g(!1),(fe=P.current)==null||fe.focus()},[]),B=k.useCallback(U=>{var Ae;const fe=T.selectPrompt(U);I.current=fe.nextCursor,n(fe.nextText),T.setMentionMenuOpen(!1),O(fe.nextCursor),(Ae=P.current)==null||Ae.focus(),P.current&&(P.current.style.height="auto",P.current.style.height=Math.min(P.current.scrollHeight,200)+"px")},[T]);function oe(){var ze;const U=t.trim();if(!U||!Q)return;const fe=k0(),Ae=i.length>0?i.map(st=>({name:st.name,media_type:st.mediaType,data:st.base64,size:st.size})):void 0;Xn(e,{type:"user_message",content:U,session_id:e,attachments:Ae,client_msg_id:fe});const tt=W.getState();tt.appendMessage(e,{id:fe,role:"user",content:U,attachments:Ae,timestamp:Date.now()}),tt.setSessionStatus(e,"running"),tt.setLastActivity(e,Date.now()),tt.streamingStartedAt.has(e)||tt.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),g(!1),T.setMentionMenuOpen(!1),P.current&&(P.current.style.height="auto"),(ze=P.current)==null||ze.focus()}function be(U){if(p&&Ce.length>0){if(U.key==="ArrowDown"){U.preventDefault(),b(fe=>(fe+1)%Ce.length);return}if(U.key==="ArrowUp"){U.preventDefault(),b(fe=>(fe-1+Ce.length)%Ce.length);return}if(U.key==="Tab"&&!U.shiftKey){U.preventDefault(),$(Ce[v]);return}if(U.key==="Enter"&&!U.shiftKey){U.preventDefault(),$(Ce[v]);return}if(U.key==="Escape"){U.preventDefault(),g(!1);return}}if(T.mentionMenuOpen&&U.key==="Escape"){U.preventDefault(),T.setMentionMenuOpen(!1);return}if(T.mentionMenuOpen&&T.filteredPrompts.length>0){if(U.key==="ArrowDown"){U.preventDefault(),T.setMentionMenuIndex(fe=>(fe+1)%T.filteredPrompts.length);return}if(U.key==="ArrowUp"){U.preventDefault(),T.setMentionMenuIndex(fe=>(fe-1+T.filteredPrompts.length)%T.filteredPrompts.length);return}if(U.key==="Tab"&&!U.shiftKey||U.key==="Enter"&&!U.shiftKey){U.preventDefault(),B(T.filteredPrompts[T.mentionMenuIndex]);return}}if(T.mentionMenuOpen&&T.filteredPrompts.length===0&&(U.key==="Enter"&&!U.shiftKey||U.key==="Tab"&&!U.shiftKey)){U.preventDefault();return}if(U.key==="Tab"&&U.shiftKey){U.preventDefault(),We();return}U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),oe())}function je(U){n(U.target.value),O(U.target.selectionStart??U.target.value.length);const fe=U.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Ee(){P.current&&O(P.current.selectionStart??0)}function Be(){Xn(e,{type:"interrupt"})}async function Oe(U){if(U.length===0)return;const fe=[],Ae=[];let tt=i.reduce((ze,st)=>ze+st.size,0);for(const ze of U){if(ze.size>vf){Ae.push(`${ze.name} is too large (${pa(ze.size)}, max ${pa(vf)})`);continue}if(tt+ze.size>bf){Ae.push(`${ze.name} would exceed the per-message limit (${pa(bf)})`);continue}const{base64:st,mediaType:rn}=await eC(ze);fe.push({name:ze.name,base64:st,mediaType:rn,size:ze.size}),tt+=ze.size}fe.length>0&&a(ze=>[...ze,...fe]),u(Ae.length>0?Ae.join("; "):null)}async function Te(U){const fe=U.target.files;fe&&(await Oe(Array.from(fe)),U.target.value="")}function Re(U){a(fe=>fe.filter((Ae,tt)=>tt!==U))}async function Ft(U){var tt;const fe=(tt=U.clipboardData)==null?void 0:tt.items;if(!fe)return;const Ae=[];for(const ze of Array.from(fe)){if(ze.kind!=="file")continue;const st=ze.getAsFile();if(!st)continue;const rn=st.name&&st.name.length>0?st.name:`pasted-${Date.now()}.${(st.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ae.push(new File([st],rn,{type:st.type,lastModified:st.lastModified}))}Ae.length>0&&(U.preventDefault(),await Oe(Ae))}function vn(U){U.dataTransfer.types.includes("Files")&&(U.preventDefault(),U.stopPropagation(),f(!0))}function Vt(U){U.currentTarget===U.target&&f(!1)}async function St(U){if(!U.dataTransfer.types.includes("Files"))return;U.preventDefault(),U.stopPropagation(),f(!1);const fe=Array.from(U.dataTransfer.files);fe.length>0&&await Oe(fe)}function wt(){const U=t.trim().slice(0,32);N(U||""),R(null),_(fe=>!fe)}function We(){if(!Q)return;const U=W.getState();if(!G)U.setPreviousPermissionMode(e,V),Xn(e,{type:"set_permission_mode",mode:"plan"}),U.updateSession(e,{permissionMode:"plan"});else{const fe=de||(H?"bypassPermissions":"acceptEdits");Xn(e,{type:"set_permission_mode",mode:fe}),U.updateSession(e,{permissionMode:fe})}}async function xt(){const U=t.trim(),fe=j.trim();if(!U||!fe)return;if(S==="project"&&!(L!=null&&L.cwd)){R("No project folder available for this session");return}const Ae={name:fe,content:U,scope:S};S==="project"&&(Ae.projectPaths=[L.cwd]);try{await we.createPrompt(Ae),await T.refreshPrompts(),_(!1),N(""),C("global"),R(null)}catch(tt){const ze=tt instanceof Error&&tt.message?tt.message:"Could not save prompt.";R(ze)}}const ie=W(U=>U.promptSuggestions.get(e))??I9,ke=W(U=>U.clearPromptSuggestions),nt=W(U=>U.sessionStatus).get(e)==="running",Kt=t.trim().length>0&&Q;return l.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${h?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:vn,onDragLeave:Vt,onDrop:St,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[h&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:l.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((U,fe)=>l.jsx(sC,{name:U.name,mediaType:U.mediaType,base64:U.base64,size:U.size,onRemove:()=>Re(fe)},fe))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:z,type:"file",multiple:!0,onChange:Te,className:"hidden","aria-label":"Attach files"}),ie.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:ie.map((U,fe)=>l.jsx("button",{onClick:()=>{if(!Q||nt)return;const Ae=k0();Xn(e,{type:"user_message",content:U,session_id:e,client_msg_id:Ae}),W.getState().appendMessage(e,{id:Ae,role:"user",content:U,timestamp:Date.now()}),ke(e)},disabled:!Q||nt,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:U,children:U},fe))}),l.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${G?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[p&&Ce.length>0&&l.jsx("div",{ref:Z,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:Ce.map((U,fe)=>l.jsxs("button",{"data-cmd-index":fe,onClick:()=>$(U),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${fe===v?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:U.type==="skill"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 1l1.796 3.64L14 5.255l-3 2.924.708 4.126L8 10.5l-3.708 1.805L5 8.18 2 5.255l4.204-.615L8 1z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",U.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:U.type})]})]},`${U.type}-${U.name}`))}),l.jsx(mC,{open:T.mentionMenuOpen,loading:T.promptsLoading,prompts:T.filteredPrompts,selectedIndex:T.mentionMenuIndex,onSelect:B,menuRef:T.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),y&&l.jsxs("div",{className:"absolute left-2 right-2 bottom-full mb-1 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 p-3 space-y-2",children:[l.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),l.jsx("input",{value:j,onChange:U=>{N(U.target.value),E&&R(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button","aria-pressed":S==="global",onClick:()=>C("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),l.jsx("button",{type:"button","aria-pressed":S==="project",onClick:()=>C("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),S==="project"&&(L==null?void 0:L.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:L.cwd,children:L.cwd}),E?l.jsx("div",{className:"text-[11px] text-cc-error",children:E}):null,l.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>{_(!1),C("global"),R(null)},className:"px-2 py-1 text-[11px] rounded-md border border-cc-border text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:xt,disabled:!j.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${j.trim()&&t.trim()?"border-cc-primary/40 text-cc-primary bg-cc-primary/8 cursor-pointer":"border-cc-border text-cc-muted cursor-not-allowed"}`,children:"Save"})]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[l.jsx(Y2,{isPlan:G,isConnected:Q,onToggle:We,modeLabel:ye,size:"mobile"}),l.jsx(G2,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(Ch,{onClick:wt,disabled:!Q||!t.trim(),active:Q&&!!t.trim(),title:"Save as prompt",children:l.jsx(X2,{})}),l.jsx(Ch,{onClick:()=>{var U;return(U=z.current)==null?void 0:U.click()},disabled:!Q,active:Q,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),l.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:l.jsx("textarea",{ref:P,value:t,onChange:je,onKeyDown:be,onClick:Ee,onKeyUp:Ee,onPaste:Ft,"aria-label":"Message input",placeholder:Q?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!Q,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),l.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:l.jsx(Q2,{isRunning:nt,canSend:Kt,onSend:oe,onInterrupt:Be,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(Ch,{onClick:()=>{var U;return(U=z.current)==null?void 0:U.click()},disabled:!Q,active:Q,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx(Ch,{onClick:wt,disabled:!Q||!t.trim(),active:Q&&!!t.trim(),title:"Save as prompt",children:l.jsx(X2,{})}),l.jsx(Y2,{isPlan:G,isConnected:Q,onToggle:We,modeLabel:ye,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(G2,{sessionId:e}),l.jsx(Q2,{isRunning:nt,canSend:Kt,onSend:oe,onInterrupt:Be,size:"desktop"})]})]})]})})}function H9(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function q9(e,t){const n={};for(const[i,a]of Object.entries(t)){const o=e[Number(i)],u=typeof(o==null?void 0:o.question)=="string"&&o.question?o.question:i;n[u]=a}return n}function V9({permission:e,sessionId:t}){const[n,i]=k.useState(!1),a=W(p=>p.removePermission);function o(p,g){i(!0),Xn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),a(t,e.request_id)}function u(){i(!0),Xn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const h=e.tool_name==="AskUserQuestion",f=e.permission_suggestions;return l.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:l.jsx("div",{className:"max-w-3xl mx-auto",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${h?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:h?l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:l.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:l.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:`text-xs font-semibold ${h?"text-cc-primary":"text-cc-warning"}`,children:h?"Question":"Permission Request"}),!h&&l.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&l.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),h?l.jsx(W9,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx(X9,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&l.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!h&&l.jsx(Y9,{validation:e.ai_validation}),!h&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>o(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),f==null?void 0:f.map((p,g)=>l.jsxs("button",{onClick:()=>o(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),H9(p)]},g)),l.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function G9(e){return[/^Invalid Anthropic/i,/^Anthropic .*(rate limit|overloaded|unavailable|error|lacks permission)/i,/^AI service/i,/^AI evaluation timed out/i,/^Model not found/i,/^No Anthropic API key/i].some(n=>n.test(e))}function Y9({validation:e}){const t=e.verdict==="uncertain"&&G9(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return l.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),l.jsx("span",{className:"font-medium",children:i}),l.jsx("span",{children:e.reason})]})}function X9({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(Q9,{input:t}):e==="Edit"?l.jsx(Z9,{input:t}):e==="Write"?l.jsx(K9,{input:t}):e==="Read"?l.jsx(J9,{input:t}):e==="Glob"?l.jsx(eP,{input:t}):e==="Grep"?l.jsx(tP,{input:t}):e==="ExitPlanMode"?l.jsx(nP,{input:t}):l.jsx(xC,{input:t,description:n})}function Q9({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return l.jsxs("div",{className:"space-y-1.5",children:[n&&l.jsx("div",{className:"text-xs text-cc-muted",children:n}),l.jsxs("pre",{className:"text-xs text-cc-fg font-mono-code bg-cc-code-bg/30 rounded-lg px-2 sm:px-3 py-2 max-h-32 overflow-y-auto overflow-x-auto whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function W9({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[a,o]=k.useState({}),[u,h]=k.useState({}),[f,p]=k.useState({});function g(N){return q9(i,N)}function v(N,S){const C=String(N);o(E=>({...E,[C]:S})),p(E=>({...E,[C]:!1})),i.length<=1&&t(g({[C]:S}))}function b(N){var E;const S=String(N),C=(E=u[S])==null?void 0:E.trim();C&&(o(R=>({...R,[S]:C})),i.length<=1&&t(g({[S]:C})))}function y(N,S){const C=String(N);h(R=>({...R,[C]:S}));const E=S.trim();o(R=>{if(!E){const A={...R};return delete A[C],A}return{...R,[C]:E}})}function _(N){const S=String(N);p(C=>{const E=!!C[S],R={...C,[S]:!E};return E&&(o(A=>{const O={...A};return delete O[S],O}),h(A=>{const O={...A};return delete O[S],O})),R})}function j(){t(g(a))}if(i.length===0){const N=typeof e.question=="string"?e.question:"";return N?l.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:N}):l.jsx(xC,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[i.map((N,S)=>{const C=typeof N.header=="string"?N.header:"",E=typeof N.question=="string"?N.question:"",R=Array.isArray(N.options)?N.options:[],A=String(S),O=a[A],P=f[A];return l.jsxs("div",{className:"space-y-2",children:[C&&l.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:C}),E&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:E}),R.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[R.map((z,Z)=>{const I=typeof z.label=="string"?z.label:String(z),q=typeof z.description=="string"?z.description:"",L=O===I;return l.jsx("button",{onClick:()=>v(S,I),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${L?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${L?"border-cc-primary":"border-cc-muted/40"}`,children:L&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:I}),q&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:q})]})]})},Z)}),l.jsx("button",{onClick:()=>_(S),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${P?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${P?"border-cc-primary":"border-cc-muted/40"}`,children:P&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),P&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[A]||"",onChange:z=>y(S,z.target.value),onKeyDown:z=>{z.key==="Enter"&&b(S)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},S)}),i.length>1&&Object.keys(a).length>0&&l.jsx("button",{onClick:j,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function Z9({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return l.jsx(Oo,{oldText:n,newText:i,fileName:t,mode:"compact"})}function K9({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Oo,{newText:n,fileName:t,mode:"compact"})}function J9({input:e}){const t=String(e.file_path||"");return l.jsx("div",{className:"text-xs text-cc-muted font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2",children:t})}function eP({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n})]})}function tP({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n}),i&&l.jsx("div",{className:"text-cc-muted",children:i})]})}function nP({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return l.jsxs("div",{className:"space-y-2",children:[t&&l.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[l.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),l.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),l.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:l.jsx(mv,{remarkPlugins:[wv],components:{h1:({children:i})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>l.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>l.jsx("li",{children:i}),strong:({children:i})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:a})=>l.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:i=>{const{children:a,className:o}=i;return/language-(\w+)/.exec(o||"")||typeof a=="string"&&a.includes(`
|
|
106
|
+
`)?l.jsx("pre",{className:"my-2 px-2.5 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto border border-cc-border",children:l.jsx("code",{children:a})}):l.jsx(JN,{textClassName:"text-[12px] text-cc-code-fg",children:a})},pre:({children:i})=>l.jsx(l.Fragment,{children:i}),blockquote:({children:i})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:i})},children:t})})]}),n.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),l.jsx("div",{className:"space-y-1",children:n.map((i,a)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code bg-cc-code-bg/30 rounded-lg px-2.5 py-1.5",children:[l.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function xC({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?l.jsx("div",{className:"text-xs text-cc-fg",children:t}):l.jsxs("div",{className:"space-y-1",children:[t&&l.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),l.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,a])=>{const o=typeof a=="string"?a.length>200?a.slice(0,200)+"...":a:JSON.stringify(a);return l.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[l.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},i)})})]})}function sP({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:a}=e,o=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const h=n.input.command;u=h.length>60?h.slice(0,60)+"...":h}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${o?"text-cc-success":"text-cc-error"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})}),l.jsxs("span",{className:"flex-1",children:["AI auto-",o?"approved":"denied",":"," ",l.jsx("span",{className:"font-mono-code opacity-80",children:u}),a&&l.jsxs("span",{className:"text-cc-muted ml-1",children:["(",a,")"]})]}),t&&l.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const iP=[],rP=[],W2="activity-tray-panel";function aP(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),a=n%60;return`${i}m${a>0?` ${a}s`:""}`}function lP(e,t,n=4e3){const[i,a]=k.useState(!1),o=k.useRef(void 0),u=e.length+t.length,h=u>0&&e.every(f=>f.status==="completed")&&t.every(f=>f.status!=="running");return k.useEffect(()=>(clearTimeout(o.current),h?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[h,n]),k.useEffect(()=>{a(!1)},[u]),i}function oP(e){const[t,n]=k.useState(0);return k.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(i)},[e]),t}function cP({status:e}){return e==="running"||e==="in_progress"?l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function uP({agent:e,tick:t}){const[n,i]=k.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(cP,{status:e.status}),l.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&l.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:aP(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):l.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&l.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function dP({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[l.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug flex-1 truncate ${t?"text-cc-muted line-through":"text-cc-fg/80"}`,children:e.subject}),n&&e.activeForm&&l.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function hP({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=k.useRef(null),o=W(E=>E.sessionTasks.get(e)??iP),u=W(E=>E.sessionBackgroundAgents.get(e)??rP),h=lP(o,u),f=u.some(E=>E.status==="running"),p=oP(f),g=u.filter(E=>E.status==="running").length,v=o.length,b=o.filter(E=>E.status==="completed").length,y=o.filter(E=>E.status==="in_progress").length,_=o.length>0||u.length>0,j=g>0||y>0,N=k.useCallback(()=>n(!1),[]);k.useEffect(()=>{if(!t)return;const E=R=>{R.key==="Escape"&&(R.stopPropagation(),N())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,N]),k.useEffect(()=>{if(!t)return;const E=R=>{i.current&&!i.current.contains(R.target)&&N()};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[t,N]),k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[S,C]=k.useState(!1);return k.useEffect(()=>{_&&C(!1)},[_,o.length,u.length]),!_||S?null:l.jsxs("div",{ref:i,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${h?"opacity-0 pointer-events-none":"opacity-100"}`,style:h?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{h&&C(!0)},children:[t&&l.jsxs("div",{ref:a,id:W2,role:"dialog","aria-label":"Activity panel",tabIndex:-1,className:"mb-1.5 w-72 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto rounded-xl border border-cc-border/60 bg-cc-surface/95 backdrop-blur-xl shadow-lg shadow-black/20 outline-none",style:{animation:"fadeSlideIn 0.2s ease-out"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),l.jsx("button",{type:"button",onClick:N,className:"flex items-center justify-center w-7 h-7 -mr-1 rounded-md text-cc-muted/40 hover:text-cc-muted/70 hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-label":"Close activity tray",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),u.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(E=>l.jsx(uP,{agent:E,tick:p},E.toolUseId))]}),u.length>0&&o.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),o.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),o.map(E=>l.jsx(dP,{task:E},E.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":W2,className:`
|
|
107
|
+
flex items-center gap-2 px-3 min-h-[36px] rounded-full
|
|
108
|
+
border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
|
|
109
|
+
shadow-md shadow-black/15
|
|
110
|
+
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
111
|
+
transition-all duration-200 cursor-pointer
|
|
112
|
+
${t?"ring-1 ring-cc-primary/30":""}
|
|
113
|
+
`,"aria-label":`Activity: ${g} agents running, ${b}/${v} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[b,"/",v]}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function fP({sessionId:e}){const t=W(_=>_.pendingPermissions.get(e)),n=W(_=>_.aiResolvedPermissions.get(e)),i=W(_=>_.clearAiResolvedPermissions),a=W(_=>_.connectionStatus.get(e)??"disconnected"),o=W(_=>_.cliConnected.get(e)??!1),u=W(_=>_.cliReconnecting.get(e)??!1),h=W(_=>_.setCliReconnecting),[f,p]=k.useState(null),g=k.useRef(void 0);k.useEffect(()=>{p(null),clearTimeout(g.current)},[e,o]),k.useEffect(()=>()=>clearTimeout(g.current),[]);const v=k.useCallback(async()=>{p(null),clearTimeout(g.current),h(e,!0);try{await we.relaunchSession(e)}catch(_){ga(_),h(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),g.current=setTimeout(()=>p(null),4e3)}},[e,h]),b=k.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!o;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&l.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:f?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:f}),l.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),a==="disconnected"&&l.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(D9,{sessionId:e}),l.jsx(hP,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(sP,{entry:n[n.length-1],onDismiss:()=>i(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(V9,{permission:_,sessionId:e},_.request_id))}),l.jsx(U9,{sessionId:e})]})}function pP({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=W(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,h=(a==null?void 0:a.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function p(g){i.current&&!i.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function f(p,g){const v=!g,b={[p]:v};W.getState().setSessionAiValidation(e,b),XT(e,b)}return l.jsxs("div",{ref:i,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationEnabled",o),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>f("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationAutoDeny",h),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${h?"text-cc-success":"text-cc-muted"}`,children:h?"On":"Off"})]})]})]})]})}function mP({sessionId:e}){const[t,n]=k.useState(!1),[i,a]=k.useState(null),[o,u]=k.useState(!1),h=k.useRef(null);k.useEffect(()=>{if(!t)return;const p=v=>{h.current&&!h.current.contains(v.target)&&n(!1)},g=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",g)}},[t]);const f=k.useCallback(async p=>{a(p),u(!1);try{const{blob:g,filename:v}=await we.exportSession(e,p),b=URL.createObjectURL(g),y=document.createElement("a");y.href=b,y.download=v,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(g){ga(g),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:h,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>f("html"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>f("txt"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function gP({sessionId:e}){const t=W(g=>g.density),n=W(g=>g.magicUiAvailable),i=W(g=>{var v;return!!e&&((v=g.sessions.get(e))==null?void 0:v.magicUiActive)===!0}),a=k.useCallback(()=>{var v;if(!e)return;const g=W.getState();((v=g.sessions.get(e))==null?void 0:v.magicUiActive)===!0&&(g.setSessionMagicUi(e,!1),sw(e,!1))},[e]),o=k.useCallback(()=>{W.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{W.getState().setDensity("compact"),a()},[a]),h=k.useCallback(()=>{e&&(W.getState().setSessionMagicUi(e,!0),sw(e,!0))},[e]);if(!n||!e)return l.jsx(xP,{});const f=t==="compact",p=[{key:"standard",label:"Standard view",active:!i&&!f,onClick:o,icon:l.jsx(vC,{})},{key:"compact",label:"Compact view",active:!i&&f,onClick:u,icon:l.jsx(bC,{})},{key:"magic",label:"Magic dashboard view",active:i,onClick:h,icon:l.jsx(vP,{})}];return l.jsx("div",{role:"group","aria-label":"View mode",className:"flex items-center rounded-md border border-cc-border overflow-hidden",children:p.map(g=>l.jsx("button",{onClick:g.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${g.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:g.label,"aria-label":g.label,"aria-pressed":g.active,children:g.icon},g.key))})}function xP(){const e=W(a=>a.density),t=k.useCallback(()=>W.getState().toggleDensity(),[]),n=e==="compact",i=n?"Switch to standard density":"Switch to compact density";return l.jsx("button",{onClick:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${n?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:i,"aria-label":i,"aria-pressed":n,children:n?l.jsx(bC,{}):l.jsx(vC,{})})}function vC(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}function bC(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 7h16M4 11h16M4 15h16M4 19h16"})})}function vP(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:[l.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"}),l.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z"})]})}function bP(){var P;const e=k.useSyncExternalStore(z=>(window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)),()=>window.location.hash),t=k.useMemo(()=>Kx(e),[e]),n=t.page==="session"||t.page==="home",i=W(z=>z.currentSessionId),a=W(z=>z.cliConnected),o=W(z=>z.sessionStatus),u=W(z=>z.sessionNames),h=W(z=>z.sdkSessions),f=W(z=>z.sidebarOpen),p=W(z=>z.setSidebarOpen),g=W(z=>z.taskPanelOpen),v=W(z=>z.setTaskPanelOpen),b=W(z=>z.activeTab),y=W(z=>z.setActiveTab),_=W(z=>z.markChatTabReentry),j=W(z=>i?z.gitChangedFilesCount.get(i)??0:0),N=i?o.get(i)??null:null,S=i?a.get(i)??!1:!1,C=i?(u==null?void 0:u.get(i))||((P=h.find(z=>z.sessionId===i))==null?void 0:P.name)||`Session ${i.slice(0,8)}`:null,E=!!(i&&n),R=t.page==="session"&&!!i,A=["chat","diff"],O=z=>{z==="chat"&&b!=="chat"&&i&&_(i),y(z)};return k.useEffect(()=>{const z=Z=>{if(!(Z.metaKey||Z.ctrlKey)||Z.key.toLowerCase()!=="j"||!E)return;const I=Z.target;if(I&&(I.tagName==="TEXTAREA"||I.tagName==="INPUT"||I.isContentEditable))return;Z.preventDefault();const q=Math.max(0,A.indexOf(b)),L=Z.shiftKey?-1:1,de=(q+L+A.length)%A.length;O(A[de])};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[E,A,b,y,_,i]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!f),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${f?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),E&&l.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[l.jsxs("button",{onClick:()=>O("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:C||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>O("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[E&&i&&l.jsx(pP,{sessionId:i}),E&&i&&l.jsx(mP,{sessionId:i}),E&&l.jsx(gP,{sessionId:i??null}),l.jsx(yP,{}),R&&l.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function yP(){const e=W(n=>n.darkMode),t=k.useCallback(()=>W.getState().toggleDarkMode(),[]);return l.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const yC="cc-recent-dirs";function yf(){try{return JSON.parse(localStorage.getItem(yC)||"[]")}catch{return[]}}function _C(e){const t=yf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(yC,JSON.stringify(t.slice(0,5)))}function _P(){return!1}function wC({onClose:e,embedded:t=!1}){const[n,i]=k.useState([]),[a,o]=k.useState(!0),[u,h]=k.useState(null),[f,p]=k.useState(""),[g,v]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,S]=k.useState(""),[C,E]=k.useState([{key:"",value:""}]),[R,A]=k.useState(!1),O=k.useCallback(()=>{we.listEnvs().then(i).catch(()=>{}).finally(()=>o(!1))},[]);k.useEffect(()=>{O()},[O]);function P(V){h(V.slug),p(V.name);const G=Object.entries(V.variables).map(([H,ae])=>({key:H,value:ae}));G.length===0&&G.push({key:"",value:""}),v(G),y("")}function z(){h(null),y("")}async function Z(){if(!u)return;const V={};for(const G of g){const H=G.key.trim();H&&(V[H]=G.value)}try{await we.updateEnv(u,{name:f.trim()||void 0,variables:V}),h(null),y(""),O()}catch(G){y(G instanceof Error?G.message:String(G))}}async function I(V){try{await we.deleteEnv(V),u===V&&h(null),O()}catch(G){y(G instanceof Error?G.message:String(G))}}async function q(){const V=N.trim();if(!V)return;A(!0);const G={};for(const H of C){const ae=H.key.trim();ae&&(G[ae]=H.value)}try{await we.createEnv(V,G),S(""),E([{key:"",value:""}]),j(!1),y(""),O()}catch(H){y(H instanceof Error?H.message:String(H))}finally{A(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:N,onChange:V=>S(V.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:V=>{V.key==="Enter"&&N.trim()&&q()}}),l.jsx(Eh,{rows:C,onChange:E}),b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:q,disabled:!N.trim()||R,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!R?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:R?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(V=>{const G=u===V.slug,H=Object.keys(V.variables).length;return G?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:f,onChange:ae=>p(ae.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(Eh,{rows:g,onChange:v})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:z,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:()=>void Z(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},V.slug):l.jsx(wP,{env:V,varCount:H,onStartEdit:()=>P(V),onDelete:()=>void I(V.slug)},V.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const L=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:V=>S(V.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:V=>{V.key==="Enter"&&N.trim()&&q()}}),l.jsx(Eh,{rows:C,onChange:E}),l.jsx("button",{onClick:q,disabled:!N.trim()||R,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!R?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:R?"Creating...":"Create"})]}),de=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(V=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:V.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(V.variables).length," var",Object.keys(V.variables).length!==1?"s":""]}),u===V.slug?l.jsx("button",{onClick:z,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>P(V),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>I(V.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===V.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:f,onChange:G=>p(G.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(Eh,{rows:g,onChange:v})]})}),l.jsx("button",{onClick:Z,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==V.slug&&Object.keys(V.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(V.variables).map(([G,H])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:G}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:H})]},G))})]},V.slug))}),Q=l.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:V=>V.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),de,L]})]});return $o.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:Q}),document.body)}function wP({env:e,varCount:t,onStartEdit:n,onDelete:i}){return l.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function Eh({rows:e,onChange:t}){function n(o,u,h){const f=[...e];f[o]={...f[o],[u]:h},t(f)}function i(o){const u=e.filter((h,f)=>f!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.key,onChange:h=>n(u,"key",h.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.value,onChange:h=>n(u,"value",h.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const SP=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:wC},Symbol.toStringTag,{value:"Module"}));function kP(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const a of t)i+="/"+a,n.push({label:a,path:i});return n}function jP({initialPath:e,onSelect:t,onClose:n}){const[i,a]=k.useState(""),[o,u]=k.useState([]),[h,f]=k.useState(!0),[p,g]=k.useState(""),[v,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState(-1),[E,R]=k.useState(!1),[A,O]=k.useState(()=>yf()),P=k.useRef(null),z=k.useRef(null),Z=k.useRef(null),I=k.useRef(new Map),q=k.useMemo(()=>{if(!j)return o;const H=j.toLowerCase();return o.filter(ae=>ae.name.toLowerCase().includes(H))},[o,j]),L=k.useCallback(async H=>{f(!0),g(""),N(""),C(-1);try{const ae=await we.listDirs(H);a(ae.path),u(ae.dirs)}catch{g("Could not load directory"),u([])}finally{f(!1)}},[]);k.useEffect(()=>{L(e||void 0)},[]),k.useEffect(()=>{const H=P.current;if(!H)return;function ae(T){if(T.key!=="Tab")return;const Ne=H.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(Ne.length===0)return;const Ce=Ne[0],$=Ne[Ne.length-1];T.shiftKey&&document.activeElement===Ce?(T.preventDefault(),$.focus()):!T.shiftKey&&document.activeElement===$&&(T.preventDefault(),Ce.focus())}document.addEventListener("keydown",ae);const ye=setTimeout(()=>{var T;(T=Z.current)==null||T.focus()},80);return()=>{document.removeEventListener("keydown",ae),clearTimeout(ye)}},[]);const de=k.useCallback(()=>{E||(R(!0),setTimeout(n,150))},[n,E]);k.useEffect(()=>{function H(ae){if(ae.key==="Escape"){if(y)return;de()}}return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[y,de]),k.useEffect(()=>{function H(ae){var T,Ne;if(y)return;if(ae.key==="Backspace"&&document.activeElement!==Z.current){if(i&&i!=="/"){ae.preventDefault();const Ce=i.split("/").slice(0,-1).join("/")||"/";L(Ce)}return}const ye=q.length;if(ye!==0){if(ae.key==="ArrowDown"){ae.preventDefault();const Ce=S<ye-1?S+1:0;C(Ce),(T=I.current.get(Ce))==null||T.focus()}else if(ae.key==="ArrowUp"){ae.preventDefault();const Ce=S>0?S-1:ye-1;C(Ce),(Ne=I.current.get(Ce))==null||Ne.focus()}}}return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[y,q.length,S,i,L]),k.useEffect(()=>{var H;S>=0&&((H=I.current.get(S))==null||H.scrollIntoView({block:"nearest"}))},[S]);function Q(H){_C(H),O(yf()),t(H),n()}const V=kP(i),G=i.split("/").pop()||"/";return $o.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${E?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:de,children:l.jsxs("div",{ref:P,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${E?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:H=>H.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:de,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),A.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),l.jsx("ul",{className:"list-none m-0 p-0",children:A.map(H=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>Q(H),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[l.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:H.split("/").pop()||H}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:H})]})},H))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:y?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:H=>b(H.target.value),onKeyDown:H=>{H.key==="Enter"&&v.trim()&&Q(v.trim()),H.key==="Escape"&&(H.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:V.map((H,ae)=>{const ye=ae===V.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[ae>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{ye||L(H.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${ye?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":ye?"location":void 0,tabIndex:ye?-1:0,children:H.label})]},H.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!y&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:l.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),l.jsx("input",{ref:Z,type:"text","aria-label":"Filter directories",value:j,onChange:H=>{N(H.target.value),C(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),l.jsxs("button",{type:"button",onClick:()=>Q(i),"aria-label":`Select ${G}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:G})]})]}),l.jsx("div",{ref:z,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:h?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((H,ae)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+ae*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${ae*.1}s infinite`}})]},ae))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>L(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):q.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:q.map((H,ae)=>l.jsxs("li",{className:`flex items-center transition-colors ${S===ae?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ye=>{ye?I.current.set(ae,ye):I.current.delete(ae)},onClick:()=>L(H.path),onKeyDown:ye=>{ye.key==="Enter"&&(ye.preventDefault(),Q(H.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:H.path,"aria-label":`Navigate into ${H.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"truncate",children:H.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>Q(H.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${H.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},H.path))})}),l.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function NP(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function CP(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():NP(e.identifier,e.title)}function wu({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),l.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),l.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),l.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function EP({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,o]=k.useState(""),[u,h]=k.useState(""),[f,p]=k.useState(""),[g,v]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,S]=k.useState(""),[C,E]=k.useState(""),[R,A]=k.useState(!0),[O,P]=k.useState(!1),[z,Z]=k.useState("");k.useEffect(()=>{let q=!0;return Promise.all([we.getLinearStates(t),we.getLinearConnection(t)]).then(([L,de])=>{var V;if(!q)return;j(L.teams),S(de.viewerId);const Q=((V=L.teams[0])==null?void 0:V.id)||"";p(Q)}).catch(L=>{q&&Z(L instanceof Error?L.message:"Failed to load teams")}).finally(()=>{q&&A(!1)}),()=>{q=!1}},[t]),k.useEffect(()=>{if(!f||_.length===0){E("");return}const q=_.find(de=>de.id===f),L=q==null?void 0:q.states.find(de=>de.type==="backlog");E((L==null?void 0:L.id)||"")},[f,_]);async function I(){if(!(!a.trim()||!f)){P(!0),Z("");try{const q=await we.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:f,priority:g,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:C||void 0,connectionId:t});n(q.issue)}catch(q){Z(q instanceof Error?q.message:"Failed to create issue")}finally{P(!1)}}}return $o.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:q=>q.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),z&&l.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:z}),R?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:q=>o(q.target.value),onKeyDown:q=>{q.key==="Enter"&&a.trim()&&f&&!O&&I()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:q=>h(q.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:f,onChange:q=>p(q.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(q=>l.jsxs("option",{value:q.id,children:[q.name," (",q.key,")"]},q.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:q=>v(Number(q.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:q=>y(q.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:I,disabled:!a.trim()||!f||O,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:O?"Creating...":"Create Issue"})]})]})]})}),document.body)}function TP({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[h,f]=k.useState([]),[p,g]=k.useState(null),[v,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[S,C]=k.useState(!1),[E,R]=k.useState(!1),[A,O]=k.useState(""),[P,z]=k.useState(!1),[Z,I]=k.useState(null),[q,L]=k.useState([]),[de,Q]=k.useState(!1),[V,G]=k.useState(""),[H,ae]=k.useState(!1),[ye,T]=k.useState([]),[Ne,Ce]=k.useState(!1),[$,B]=k.useState(""),[oe,be]=k.useState(!1),[je,Ee]=k.useState([]),[Be,Oe]=k.useState(!1),[Te,Re]=k.useState(!1),Ft=k.useRef(null);k.useEffect(()=>{function ie(ke){Ft.current&&!Ft.current.contains(ke.target)&&(C(!1),ae(!1))}return document.addEventListener("pointerdown",ie),()=>document.removeEventListener("pointerdown",ie)},[]),k.useEffect(()=>{if(!n){f([]),g(null),b(!1),u(null);return}let ie=!0;return we.listLinearConnections().then(({connections:ke})=>{ie&&(f(ke),b(!0),ke.length>0?(g(ke[0].id),u(ke[0].id)):(g(null),u(null)))}).catch(()=>{ie&&b(!0)}),()=>{ie=!1}},[n]);const vn=k.useCallback(ie=>{g(ie),u(ie),a(null),N([]),_(""),O(""),Ee([]),B(""),T([]),Z&&(Q(!0),G(""),we.getLinearProjectIssues(Z.projectId,10,ie).then(({issues:ke})=>{L(ke)}).catch(ke=>{G(ke instanceof Error?ke.message:String(ke))}).finally(()=>{Q(!1)}))},[Z,u,a]);k.useEffect(()=>{if(!t||!n){I(null),L([]);return}let ie=!0;return Q(!0),G(""),(async()=>{try{const{mapping:ke}=await we.getLinearProjectMapping(t.repoRoot);if(!ie)return;if(I(ke),ke){const{issues:Qe}=await we.getLinearProjectIssues(ke.projectId,10,p??void 0);if(!ie)return;L(Qe)}else L([])}catch(ke){if(!ie)return;G(ke instanceof Error?ke.message:String(ke))}finally{ie&&Q(!1)}})(),()=>{ie=!1}},[t,n,p]),k.useEffect(()=>{if(!n)return;const ie=y.trim();if(ie.length<2){N([]),O(""),R(!1);return}let ke=!0;R(!0),O("");const Qe=setTimeout(()=>{we.searchLinearIssues(ie,8,p??void 0).then(nt=>{ke&&N(nt.issues)}).catch(nt=>{ke&&(N([]),O(nt instanceof Error?nt.message:String(nt)))}).finally(()=>{ke&&R(!1)})},400);return()=>{ke=!1,clearTimeout(Qe)}},[n,y,p]),k.useEffect(()=>{if(!n||!oe){Ee([]),Oe(!1);return}const ie=$.trim();if(ie.length<2){Ee([]),Oe(!1);return}let ke=!0;Oe(!0);const Qe=setTimeout(()=>{we.searchLinearIssues(ie,10,p??void 0).then(nt=>{ke&&Ee(nt.issues)}).catch(()=>{ke&&Ee([])}).finally(()=>{ke&&Oe(!1)})},400);return()=>{ke=!1,clearTimeout(Qe)}},[n,oe,$,p]);function Vt(ie,ke=!1){a(ie),_(`${ie.identifier} - ${ie.title}`);const Qe=CP(ie);o(Qe,!0),ke&&C(!1)}function St(){a(null),_(""),N([]),O("")}async function wt(ie){if(t)try{const{mapping:ke}=await we.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:ie.id,projectName:ie.name});I(ke),ae(!1),Q(!0),G("");const{issues:Qe}=await we.getLinearProjectIssues(ie.id,10,p??void 0);L(Qe)}catch(ke){G(ke instanceof Error?ke.message:String(ke))}finally{Q(!1)}}async function We(){if(t){try{await we.removeLinearProjectMapping(t.repoRoot)}catch{}I(null),L([]),a(null),_("")}}function xt(){if(!n){window.location.hash="#/integrations/linear";return}ae(!0),ye.length===0&&(Ce(!0),we.listLinearProjects(p??void 0).then(({projects:ie})=>T(ie)).catch(()=>{}).finally(()=>Ce(!1)))}function Zt(ie){Re(!1),Vt(ie),Z&&(Q(!0),we.getLinearProjectIssues(Z.projectId,10,p??void 0).then(({issues:ke})=>L(ke)).catch(()=>{}).finally(()=>Q(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Ft,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&h.length>1&&l.jsx("select",{value:p??"",onChange:ie=>vn(ie.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:h.map(ie=>l.jsx("option",{value:ie.id,children:ie.workspaceName||ie.name},ie.id))}),Z?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[l.jsx(wu,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:Z.projectName}),l.jsx("button",{type:"button",onClick:We,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsxs("button",{type:"button",onClick:()=>Re(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":S,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}C(!S)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[l.jsx(wu,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:xt,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>Re(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),Z&&(()=>{const ie=$.trim().toLowerCase(),ke=!oe&&ie?q.filter(nt=>nt.identifier.toLowerCase().includes(ie)||nt.title.toLowerCase().includes(ie)):oe?[]:q,Qe=oe?je:ke;return l.jsxs("div",{className:"mt-2",children:[i&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),l.jsx("button",{type:"button",onClick:St,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsx("input",{type:"text",value:$,onChange:nt=>B(nt.target.value),placeholder:oe?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),de?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):V?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:V}):Be?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):oe&&ie.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):Qe.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:ie?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:Qe.map(nt=>l.jsxs("button",{type:"button",onClick:()=>Vt(nt),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===nt.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:nt.identifier})," ",nt.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[nt.stateName,nt.priorityLabel].filter(Boolean).join(" - ")})]},nt.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:oe,onChange:nt=>{be(nt.target.checked),nt.target.checked||Ee([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),H&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>ae(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),Ne?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):ye.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:ye.map(ie=>l.jsx("button",{type:"button",onClick:()=>wt(ie),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:ie.name})},ie.id))})]}),S&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:ie=>{_(ie.target.value)},onFocus:()=>C(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),l.jsx("button",{type:"button",onClick:()=>{C(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),y.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),y.trim().length>=2&&E&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!E&&A&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:A}),y.trim().length>=2&&!E&&!A&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!E&&!A&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(ie=>l.jsxs("button",{type:"button",onClick:()=>Vt(ie,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:ie.identifier})," - ",ie.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[ie.stateName,ie.teamName].filter(Boolean).join(" • ")})]},ie.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),P&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{z(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),Te&&l.jsx(EP,{defaultProjectId:Z==null?void 0:Z.projectId,connectionId:p??void 0,onCreated:Zt,onClose:()=>Re(!1)})]}):null}function MP({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:h}){const[f,p]=k.useState([]),[g,v]=k.useState(!1),[b,y]=k.useState(""),_=k.useRef(null);return k.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&v(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),k.useEffect(()=>{t?we.listBranches(t.repoRoot).then(j=>{p(j),h(j)}).catch(()=>{p([]),h([])}):(p([]),h([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&we.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{we.listBranches(t.repoRoot).then(j=>{p(j),h(j)}).catch(()=>{p([]),h([])})}),v(!g),y("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:b,onChange:j=>y(j.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:j=>{j.key==="Escape"&&v(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=f.filter(R=>!R.isRemote&&(!j||R.name.toLowerCase().includes(j))),S=f.filter(R=>R.isRemote&&(!j||R.name.toLowerCase().includes(j))),C=f.some(R=>R.name.toLowerCase()===j),E=N.length>0||S.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(R=>l.jsxs("button",{onClick:()=>{o(R.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[R.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[R.ahead,"↑"]}),R.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[R.behind,"↓"]}),R.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),R.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},R.name))]}),S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),S.map(R=>l.jsxs("button",{onClick:()=>{o(R.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${R.name}`))]}),!E&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!C&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(b.trim(),!0),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:b.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const AP=336*60*60*1e3,Ja=12,RP=24;function yx(e){return e.split("/").filter(Boolean).pop()||e}function Z2(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||yx(e.cwd)}function OP(e){return e.length>8?e.slice(0,8):e}function LP(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function DP(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const a=Math.floor(i/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}const Th="cc-draft-prompt";function zP(){var Zi;const[e,t]=k.useState(()=>localStorage.getItem(Th)||"");k.useEffect(()=>{e?localStorage.setItem(Th,e):localStorage.removeItem(Th)},[e]);const[n]=k.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=k.useState(()=>localStorage.getItem("cc-session-prefix")||""),[h,f]=k.useState(""),[p,g]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,b]=k.useState([]),[y,_]=k.useState(()=>q2(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>V2(localStorage.getItem("cc-backend")||"claude")),[S,C]=k.useState(()=>localStorage.getItem("cc-effort")||""),[E,R]=k.useState(()=>yf()[0]||""),[A,O]=k.useState([]),[P,z]=k.useState(null),[Z,I]=k.useState(!1),[q,L]=k.useState(""),[de,Q]=k.useState(null),[V,G]=k.useState(!1),[H,ae]=k.useState(null),[ye,T]=k.useState(null),[Ne,Ce]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),$=de||pC(p),B=H2(p),oe=F9(p),[be,je]=k.useState([]),[Ee,Be]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[Oe,Te]=k.useState(!1),[Re,Ft]=k.useState(!1),vn=_P(),[Vt,St]=k.useState(()=>vn),[wt,We]=k.useState([]),[xt,Zt]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[ie,ke]=k.useState(!1),Qe=k.useRef(null),[nt,Kt]=k.useState(null),It=k.useRef(null),ce=k.useRef(null),[U,fe]=k.useState(!1),[Ae,tt]=k.useState(!1),[ze,st]=k.useState(!1),[rn,Jn]=k.useState(!1),[ln,Fs]=k.useState(!1),[ks,Ut]=k.useState(""),[Jt,hn]=k.useState(!0),[en,yi]=k.useState([]),[_i,kr]=k.useState(!1),[wi,ya]=k.useState(""),[Ln,fn]=k.useState(!1),[Vn,tn]=k.useState(Ja),[te,ve]=k.useState(""),[me,Ge]=k.useState(null),[jt,pn]=k.useState(!1),[Dn,Ot]=k.useState(""),[zn,ti]=k.useState(!1),[Of,Iu]=k.useState([]),[Yi,Si]=k.useState(null),[fl,_a]=k.useState(!1),[Fo,ki]=k.useState(""),[Io,wa]=k.useState(0),Sa=k.useRef(null),ds=k.useRef(null),js=k.useRef(null),mn=k.useRef(null),Tn=k.useRef(null),ji=k.useRef(null),Uo=W(X=>X.currentSessionId),on=gC({text:e,caretPos:Io,cwd:E||void 0});k.useEffect(()=>{if(Sa.current===null||!ds.current)return;const X=Sa.current;ds.current.setSelectionRange(X,X),Sa.current=null},[e]),k.useEffect(()=>{var xe;window.matchMedia("(min-width: 640px)").matches&&((xe=ds.current)==null||xe.focus())},[]),k.useEffect(()=>{we.getHome().then(({home:X,cwd:xe})=>{E||R(xe||X)}).catch(()=>{}),we.listEnvs().then(je).catch(()=>{}),we.listSandboxes().then(We).catch(()=>{}),we.getBackends().then(b).catch(()=>{}),we.getSettings().then(X=>{G(X.linearApiKeyConfigured)}).catch(()=>{})},[]);function Lf(X){g(X),localStorage.setItem("cc-backend",X),Q(null),_(q2(X)),N(V2(X)),X!=="claude"&&(Fs(!1),yi([]),ya(""),kr(!1),fn(!1),tn(Ja),ve(""))}k.useEffect(()=>{if(p!=="codex"){Q(null);return}we.getBackendModels(p).then(X=>{if(X.length>0){const xe=P9(X);Q(xe),xe.some(at=>at.value===y)||_(xe[0].value)}}).catch(()=>{})},[p]),k.useEffect(()=>{if(It.current&&(clearInterval(It.current),It.current=null),Kt(null),!Vt)return;const X="the-companion:latest",xe=()=>{we.getImageStatus(X).then(at=>{Kt(at),at.status==="idle"&&we.pullImage(X).catch(()=>{}),(at.status==="ready"||at.status==="error")&&It.current&&(clearInterval(It.current),It.current=null)}).catch(()=>{})};return xe(),It.current=setInterval(xe,2e3),()=>{It.current&&(clearInterval(It.current),It.current=null)}},[Vt]),k.useEffect(()=>{function X(xe){js.current&&!js.current.contains(xe.target)&&fe(!1),mn.current&&!mn.current.contains(xe.target)&&tt(!1),Tn.current&&!Tn.current.contains(xe.target)&&st(!1),ji.current&&!ji.current.contains(xe.target)&&Te(!1),Qe.current&&!Qe.current.contains(xe.target)&&ke(!1)}return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[]),k.useEffect(()=>{if(!E){Ge(null);return}we.getRepoInfo(E).then(X=>{Ge(X),Ot(X.currentBranch),ti(!1)}).catch(()=>{Ge(null),Ot(""),ti(!1)})},[E]);const Ho=$.find(X=>X.value===y)||$[0],ka=B.find(X=>X.value===j)||B[0],pl=oe.find(X=>X.value===S)||oe[0],ml=p==="codex"?"/logo-codex.svg":"/logo.svg",Xi=E?E.split("/").pop()||E:"Select folder",Ni=k.useMemo(()=>ks.trim(),[ks]),jr=p==="claude"&&ln&&Ni.length>0,hs=k.useMemo(()=>{const X=Date.now()-AP;return en.filter(xe=>xe.createdAt>=X)},[en]),cn=k.useMemo(()=>Ln?en:hs.length>0?hs:en,[Ln,hs,en]),Ns=k.useMemo(()=>te.trim().toLowerCase(),[te]),ni=k.useMemo(()=>Ns?cn.filter(X=>{const xe=Z2(X).toLowerCase(),at=yx(X.cwd).toLowerCase(),pt=(X.gitBranch||"").toLowerCase(),mt=X.cwd.toLowerCase(),Ye=X.resumeSessionId.toLowerCase();return xe.includes(Ns)||at.includes(Ns)||pt.includes(Ns)||mt.includes(Ns)||Ye.includes(Ns)}):cn,[cn,Ns]),gl=k.useMemo(()=>ni.slice(0,Vn),[ni,Vn]),Qi=Vn<ni.length,Wi=Math.max(0,en.length-hs.length),Df=!Ln&&hs.length>0,xl=k.useCallback(async()=>{if(p==="claude"){kr(!0),ya("");try{const[X,xe]=await Promise.all([we.listSessions(),we.discoverClaudeSessions(400).then(Ye=>Ye.sessions)]),at=new Map,pt=Ye=>{const $n=at.get(Ye.resumeSessionId);(!$n||Ye.createdAt>$n.createdAt)&&at.set(Ye.resumeSessionId,Ye)};for(const Ye of X)Ye.backendType!=="codex"&&Ye.cliSessionId&&pt({resumeSessionId:Ye.cliSessionId,sessionId:Ye.sessionId,name:Ye.name,model:Ye.model,createdAt:Ye.createdAt,cwd:Ye.cwd,gitBranch:Ye.gitBranch,source:"companion"});for(const Ye of xe)pt({resumeSessionId:Ye.sessionId,sessionId:Ye.sessionId,slug:Ye.slug,createdAt:Ye.lastActivityAt,cwd:Ye.cwd,gitBranch:Ye.gitBranch,source:"claude_disk"});const mt=Array.from(at.values()).sort((Ye,$n)=>{const ts=E&&Ye.cwd===E?0:1,Er=E&&$n.cwd===E?0:1;return ts!==Er?ts-Er:$n.createdAt-Ye.createdAt});yi(mt),fn(!1),tn(Ja)}catch(X){const xe=X instanceof Error?X.message:String(X);ya(xe||"Failed to load existing sessions"),yi([]),tn(Ja)}finally{kr(!1)}}},[p,E]);k.useEffect(()=>{p==="claude"&&ln&&xl()},[p,ln,xl]),k.useEffect(()=>{tn(Ja)},[Ns,Ln]);async function qo(X){if(X.length===0)return;const xe=[],at=[];let pt=A.reduce((mt,Ye)=>mt+Ye.size,0);for(const mt of X){if(mt.size>vf){at.push(`${mt.name} is too large (${pa(mt.size)}, max ${pa(vf)})`);continue}if(pt+mt.size>bf){at.push(`${mt.name} would exceed the per-message limit (${pa(bf)})`);continue}const{base64:Ye,mediaType:$n}=await eC(mt);xe.push({name:mt.name,base64:Ye,mediaType:$n,size:mt.size}),pt+=mt.size}xe.length>0&&O(mt=>[...mt,...xe]),z(at.length>0?at.join("; "):null)}async function zf(X){const xe=X.target.files;xe&&(await qo(Array.from(xe)),X.target.value="")}function vt(X){O(xe=>xe.filter((at,pt)=>pt!==X))}async function Uu(X){var pt;const xe=(pt=X.clipboardData)==null?void 0:pt.items;if(!xe)return;const at=[];for(const mt of Array.from(xe)){if(mt.kind!=="file")continue;const Ye=mt.getAsFile();if(!Ye)continue;const $n=Ye.name&&Ye.name.length>0?Ye.name:`pasted-${Date.now()}.${(Ye.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;at.push(new File([Ye],$n,{type:Ye.type,lastModified:Ye.lastModified}))}at.length>0&&(X.preventDefault(),await qo(at))}function vl(X){t(X.target.value),wa(X.target.selectionStart??X.target.value.length);const xe=X.target;xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px"}function ja(){ds.current&&wa(ds.current.selectionStart??0)}function Is(X){var at;const xe=on.selectPrompt(X);Sa.current=xe.nextCursor,t(xe.nextText),on.setMentionMenuOpen(!1),wa(xe.nextCursor),(at=ds.current)==null||at.focus(),ds.current&&(ds.current.style.height="auto",ds.current.style.height=Math.min(ds.current.scrollHeight,200)+"px")}function es(X){if(on.mentionMenuOpen&&X.key==="Escape"){X.preventDefault(),on.setMentionMenuOpen(!1);return}if(on.mentionMenuOpen&&on.filteredPrompts.length>0){if(X.key==="ArrowDown"){X.preventDefault(),on.setMentionMenuIndex(xe=>(xe+1)%on.filteredPrompts.length);return}if(X.key==="ArrowUp"){X.preventDefault(),on.setMentionMenuIndex(xe=>(xe-1+on.filteredPrompts.length)%on.filteredPrompts.length);return}if(X.key==="Tab"&&!X.shiftKey||X.key==="Enter"&&!X.shiftKey){X.preventDefault(),Is(on.filteredPrompts[on.mentionMenuIndex]);return}}if(on.mentionMenuOpen&&on.filteredPrompts.length===0&&(X.key==="Enter"&&!X.shiftKey||X.key==="Tab"&&!X.shiftKey)){X.preventDefault();return}if(X.key==="Tab"&&X.shiftKey){X.preventDefault();const xe=H2(p),pt=(xe.findIndex(mt=>mt.value===j)+1)%xe.length;N(xe[pt].value);return}X.key==="Enter"&&!X.shiftKey&&(X.preventDefault(),qu())}function Hu(X){const xe=i.trim(),at=xe?`[${xe}]: ${X}`:X;if(!H)return at;const pt=(H.description??"").trim();return`${["Linear issue context:",`- Identifier: ${H.identifier}`,`- Title: ${H.title}`,H.stateName?`- State: ${H.stateName}`:"",H.priorityLabel?`- Priority: ${H.priorityLabel}`:"",H.teamName?`- Team: ${H.teamName}`:"",`- URL: ${H.url}`,pt?`- Description:
|
|
114
|
+
${pt}`:""].filter(Boolean).join(`
|
|
115
|
+
`)}
|
|
116
|
+
|
|
117
|
+
User request:
|
|
118
|
+
${at}`}async function qu(){const X=e.trim();if(!(!X||Z)){if(n&&!i.trim()){L("Please enter your name before starting a session.");return}if(I(!0),L(""),ki(""),me){const xe=Dn||me.currentBranch;if(xe&&xe===me.currentBranch){const at=Of.find(pt=>pt.name===xe&&!pt.isRemote);if(at&&at.behind>0){Si({behind:at.behind,branchName:xe});return}}}await Nr(X)}}async function Nr(X,xe){const at=W.getState();at.clearCreation(),at.setSessionCreating(!0,p);try{Uo&&C0(Uo);const pt=(xe==null?void 0:xe.resumeSessionAt)||(jr?Ni:void 0),mt=pt?(xe==null?void 0:xe.forkSession)??(jr?Jt:void 0):void 0,Ye=(xe==null?void 0:xe.cwd)||E,$n=(xe==null?void 0:xe.branch)!==void 0?xe.branch.trim()||void 0:Dn.trim()||void 0,ts=(xe==null?void 0:xe.useWorktree)!==void 0?xe.useWorktree:jt,Er=(xe==null?void 0:xe.createBranch)!==void 0?xe.createBranch:!!($n&&zn),bl=X.trim(),Cs=bl.length>0?Hu(bl):null,si=Cs?k0():null,Wo=A.length>0?A.map(Ts=>({name:Ts.name,media_type:Ts.mediaType,data:Ts.base64,size:Ts.size})):void 0,Tr=await tR({initialMessage:Cs&&si?{content:Cs,attachments:Wo,clientMsgId:si}:void 0,model:y,permissionMode:j,effort:p==="claude"&&S?S:void 0,cwd:Ye||void 0,envSlug:Ee||void 0,sandboxEnabled:Vt?!0:void 0,sandboxSlug:Vt&&xt?xt:void 0,branch:$n,createBranch:Er?!0:void 0,useWorktree:ts?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:pt,forkSession:mt,userName:i.trim()||void 0,linearConnectionId:H&&ye||void 0,linearIssue:H?{identifier:H.identifier,title:H.title,stateName:H.stateName,teamName:H.teamName,url:H.url}:void 0},Ts=>{W.getState().addCreationProgress(Ts)}),Es=Tr.sessionId,Mr=W.getState(),ii=Mr.sdkSessions.filter(Ts=>Ts.sessionId!==Es);Mr.setSdkSessions([...ii,{sessionId:Es,state:Tr.state,cwd:Tr.cwd,createdAt:Date.now(),backendType:Tr.backendType||p,model:y,permissionMode:j,userName:i.trim()||void 0,resumeSessionAt:pt,forkSession:pt?mt===!0:void 0}]);const Zo=new Set(W.getState().sessionNames.values()),Na=lS(Zo),ri=o.trim()||i.trim(),Ca=h.trim()||Na,Ko=ri?`${ri}_${Ca}`:Ca;W.getState().setSessionName(Es,Ko),we.renameSession(Es,Ko).catch(()=>{}),f(""),Ye&&_C(Ye),W.getState().setPreviousPermissionMode(Es,j),Cs&&(localStorage.removeItem(Th),t("")),Jx(Es,!0),Do(Es),Cs&&si&&W.getState().appendMessage(Es,{id:si,role:"user",content:Cs,attachments:Wo,timestamp:Date.now()}),H&&(we.linkLinearIssue(Es,H,ye||void 0).then(()=>W.getState().setLinkedLinearIssue(Es,H)).catch(()=>{}),we.transitionLinearIssue(H.id,ye||void 0).catch(()=>{})),W.getState().clearCreation()}catch(pt){const mt=pt instanceof Error?pt.message:String(pt);L(mt);const Ye=X.trim();W.getState().setCreationError(mt,Ye?{text:Ye}:null),I(!1)}}async function Vo(X,xe){Z||(I(!0),L(""),ki(""),R(X.cwd),pn(!1),ti(!1),Ot(X.gitBranch||""),Ut(X.resumeSessionId),hn(xe),await Nr("",{resumeSessionAt:X.resumeSessionId,forkSession:xe,cwd:X.cwd,branch:X.gitBranch,useWorktree:!1,createBranch:!1}))}async function $f(){if(Yi){_a(!0),ki("");try{const X=E||(me==null?void 0:me.repoRoot);if(!X)throw new Error("No working directory");const xe=await we.gitPull(X);if(!xe.success){ki(xe.output||"Pull failed"),_a(!1),I(!1);return}Si(null),_a(!1),await Nr(e.trim())}catch(X){ki(X instanceof Error?X.message:String(X)),_a(!1)}}}function fs(){const X=e.trim();Si(null),ki(""),Nr(X)}function Go(){Si(null),ki(""),I(!1)}const Vu=k.useCallback((X,xe)=>{Ot(X),ti(xe)},[]),Yo=k.useCallback((X,xe)=>{Ot(X),ti(xe)},[]),Cr=k.useCallback(X=>{Iu(X)},[]),Xo=k.useCallback(X=>{ae(X),!X&&me&&(Ot(me.currentBranch),ti(!1))},[me]),Qo=e.trim().length>0&&!Z&&(!n||i.trim().length>0);return l.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:ml,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:i,onChange:X=>{const xe=X.target.value;a(xe),localStorage.setItem("cc-user-name",xe)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":i.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:o,onChange:X=>{const xe=X.target.value;u(xe),localStorage.setItem("cc-session-prefix",xe)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:h,onChange:X=>f(X.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[o.trim()||i.trim()||"MA","_",h.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:ce,type:"file",multiple:!0,onChange:zf,className:"hidden","aria-label":"Attach files"}),l.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[l.jsx(mC,{open:on.mentionMenuOpen,loading:on.promptsLoading,prompts:on.filteredPrompts,selectedIndex:on.mentionMenuIndex,onSelect:Is,menuRef:on.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(H||A.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[H&&l.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Linear"}),l.jsx("span",{className:"font-mono-code shrink-0",children:H.identifier}),l.jsx("span",{className:"truncate",children:H.title}),l.jsx("button",{type:"button",onClick:()=>Xo(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),A.map((X,xe)=>l.jsx(sC,{name:X.name,mediaType:X.mediaType,base64:X.base64,size:X.size,onRemove:()=>vt(xe),className:"w-10 h-10"},xe))]}),P&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:P}),l.jsx("textarea",{ref:ds,value:e,onChange:vl,onKeyDown:es,onClick:ja,onKeyUp:ja,onPaste:Uu,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),l.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[l.jsxs("div",{className:"relative",ref:js,children:[l.jsxs("button",{onClick:()=>fe(!U),"aria-expanded":U,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("span",{children:Ho.icon}),l.jsx("span",{children:Ho.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),U&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:$.map(X=>l.jsxs("button",{onClick:()=>{_(X.value),fe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${X.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:X.icon}),X.label]},X.value))})]}),oe.length>0&&l.jsxs("div",{className:"relative",ref:Tn,children:[l.jsxs("button",{onClick:()=>st(!ze),"aria-expanded":ze,"aria-label":"Reasoning effort",title:"Reasoning effort",className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 13l3.5-3.5L8 12l5.5-6.5M13.5 5.5h-2.5M13.5 5.5v2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{children:pl.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),ze&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:oe.map(X=>l.jsx("button",{onClick:()=>{C(X.value),localStorage.setItem("cc-effort",X.value),st(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${X.value===S?"text-cc-primary font-medium":"text-cc-fg"}`,children:X.label},X.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:mn,children:[l.jsxs("button",{onClick:()=>tt(!Ae),"aria-expanded":Ae,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),ka.label,l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Ae&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:B.map(X=>l.jsx("button",{onClick:()=>{N(X.value),tt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${X.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:X.label},X.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>Jn(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Xi})]}),rn&&l.jsx(jP,{initialPath:E||"",onSelect:X=>{R(X)},onClose:()=>Jn(!1)})]}),l.jsx(MP,{cwd:E,gitRepoInfo:me,selectedBranch:Dn,isNewBranch:zn,useWorktree:jt,onBranchChange:Vu,onWorktreeChange:pn,onBranchesLoaded:Cr}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{className:"relative",ref:ji,children:[l.jsxs("button",{onClick:()=>{Oe||we.listEnvs().then(je).catch(()=>{}),Te(!Oe)},"aria-expanded":Oe,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Ee?((Zi=be.find(X=>X.slug===Ee))==null?void 0:Zi.name)||"Env":"No env"})]}),Oe&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[l.jsx("button",{onClick:()=>{Be(""),localStorage.setItem("cc-selected-env",""),Te(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Ee?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),be.map(X=>l.jsxs("button",{onClick:()=>{Be(X.slug),localStorage.setItem("cc-selected-env",X.slug),Te(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${X.slug===Ee?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:X.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(X.variables).length," var",Object.keys(X.variables).length!==1?"s":""]})]},X.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{Ft(!0),Te(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),vn,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var X;return(X=ce.current)==null?void 0:X.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:qu,disabled:!Qo,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Qo?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(X=>l.jsxs("button",{onClick:()=>X.available&&Lf(X.id),disabled:!X.available,title:X.available?X.name:`${X.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${X.available?p===X.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[X.name,!X.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},X.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>Fs(X=>!X),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${ln?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":ln,"aria-controls":"branch-from-session-panel",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[l.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),l.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${ln?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":ln?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!ln||void 0,children:l.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>void xl(),disabled:_i,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:_i?"Refreshing...":"Refresh detected sessions"}),en.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",gl.length," of ",ni.length," ",Ns?"matching":Df?"recent":"detected"," Claude session",ni.length!==1?"s":"","."]}),!Ln&&Wi>0&&hs.length>0&&l.jsxs("button",{type:"button",onClick:()=>{fn(!0),tn(Ja)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Include older (",Wi,")"]}),Ln&&hs.length>0&&l.jsx("button",{type:"button",onClick:()=>{fn(!1),tn(Ja)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsxs("div",{className:"relative",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),l.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),l.jsx("input",{type:"text",value:te,onChange:X=>ve(X.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),wi&&l.jsx("p",{className:"text-[11px] text-cc-error",children:wi}),!_i&&!wi&&ni.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:Ns?"No sessions match this search.":"No Claude sessions detected yet."}),gl.length>0&&l.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[l.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[l.jsx("span",{children:"Session"}),l.jsx("span",{children:"Project"}),l.jsx("span",{children:"Branch"}),l.jsx("span",{children:"Last active"}),l.jsx("span",{className:"text-right",children:"Action"})]}),l.jsx("div",{className:"divide-y divide-cc-border/50",children:gl.map(X=>{const xe=Z2(X),at=yx(X.cwd),pt=X.source==="companion"?"Companion":"Claude",mt=Ni===X.resumeSessionId;return l.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${mt?"text-cc-primary font-medium":"text-cc-fg"}`,children:xe}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:OP(X.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:pt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:X.cwd,children:[l.jsx("div",{className:"truncate",children:at}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:X.cwd,children:LP(X.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:X.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:DP(X.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{Ut(X.resumeSessionId),hn(!0),Vo(X,!0)},"aria-label":`Fork and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${mt&&Jt?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
|
|
119
|
+
${X.cwd}${X.gitBranch?` (${X.gitBranch})`:""}
|
|
120
|
+
${X.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{Ut(X.resumeSessionId),hn(!1),Vo(X,!1)},"aria-label":`Continue and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${mt&&!Jt?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Continue and open now
|
|
121
|
+
${X.resumeSessionId}`,children:"Continue"})]})]},`${X.resumeSessionId}-row-${X.sessionId}`)})}),Qi&&l.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:l.jsxs("button",{type:"button",onClick:()=>tn(X=>Math.min(X+RP,ni.length)),className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Load more (",ni.length-Vn," remaining)"]})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),Ne&&l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),l.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&l.jsxs(l.Fragment,{children:[" ",l.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),l.jsx("button",{onClick:()=>{Ce(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx(TP,{cwd:E,gitRepoInfo:me,linearConfigured:V,selectedLinearIssue:H,onIssueSelect:Xo,onBranchFromIssue:Yo,onConnectionSelect:T})]}),Yi&&l.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[l.jsx("span",{className:"font-mono-code font-medium",children:Yi.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Yi.behind," commit",Yi.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Fo&&l.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:Fo}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Go,disabled:fl,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:fs,disabled:fl,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),l.jsx("button",{onClick:$f,disabled:fl,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 transition-colors cursor-pointer flex items-center gap-1.5",children:fl?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),q&&l.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),l.jsx("p",{className:"text-xs text-cc-error",children:q})]})]}),Re&&l.jsx(wC,{onClose:()=>{Ft(!1),we.listEnvs().then(je).catch(()=>{})}})]})}const $P=[],PP=[],BP={connected:{label:"Connected",badge:"text-cc-success bg-cc-success/10",dot:"bg-cc-success"},connecting:{label:"Connecting",badge:"text-cc-warning bg-cc-warning/10",dot:"bg-cc-warning animate-pulse"},failed:{label:"Failed",badge:"text-cc-error bg-cc-error/10",dot:"bg-cc-error"},disabled:{label:"Disabled",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"}},FP={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function IP({server:e,sessionId:t}){var h,f;const[n,i]=k.useState(!1),a=BP[e.status]||FP,o=e.status!=="disabled",u=((h=e.tools)==null?void 0:h.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>VT(t,e.name,!o),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${o?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:o?"Disable server":"Enable server",children:o?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&l.jsx("button",{onClick:()=>GT(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(f=e.config.args)!=null&&f.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function UP({sessionId:e,onDone:t}){const[n,i]=k.useState(""),[a,o]=k.useState("stdio"),[u,h]=k.useState(""),[f,p]=k.useState(""),[g,v]=k.useState(""),b=n.trim()&&(a==="stdio"?u.trim():g.trim());function y(_){if(_.preventDefault(),!b)return;const j={type:a};a==="stdio"?(j.command=u.trim(),f.trim()&&(j.args=f.trim().split(/\s+/))):j.url=g.trim(),YT(e,{[n.trim()]:j}),t()}return l.jsxs("form",{onSubmit:y,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),l.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),l.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>l.jsx("button",{type:"button",onClick:()=>o(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>h(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:f,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(a==="sse"||a==="http")&&l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),l.jsx("input",{type:"text",value:g,onChange:_=>v(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{className:"flex gap-1.5 pt-1",children:[l.jsx("button",{type:"submit",disabled:!b,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${b?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),l.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function HP({sessionId:e}){const t=W(h=>h.mcpServers.get(e)||$P),n=W(h=>h.cliConnected.get(e)??!1),[i,a]=k.useState(!1),o=W(h=>{var f;return((f=h.sessions.get(e))==null?void 0:f.mcp_servers)??PP});k.useEffect(()=>{n&&nw(e)},[e,n]);const u=t.length>0?t:o.map(h=>({name:h.name,status:h.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>nw(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(UP,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(h=>l.jsx(IP,{server:h,sessionId:e},h.name))}),!i&&u.length===0&&l.jsx("div",{className:"px-3 py-3",children:l.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&l.jsx("button",{onClick:()=>a(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function qP({cwd:e,open:t,onClose:n}){var q;const[i,a]=k.useState([]),[o,u]=k.useState(!0),[h,f]=k.useState(0),[p,g]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[S,C]=k.useState(null),E=k.useCallback(()=>{u(!0),N(null),we.getClaudeMdFiles(e).then(L=>{a(L.files),L.files.length>0&&(f(0),g(L.files[0].content)),C(null),b(!1),u(!1)}).catch(L=>{N(L.message),u(!1)})},[e]);k.useEffect(()=>{t&&E()},[t,E]);const R=L=>{v&&!confirm("Discard unsaved changes?")||(f(L),g(i[L].content),b(!1),C(null))},A=async()=>{var de;const L=S||((de=i[h])==null?void 0:de.path);if(L){_(!0),N(null);try{await we.saveClaudeMd(L,p),b(!1),S?E():a(Q=>Q.map((V,G)=>G===h?{...V,content:p}:V))}catch(Q){N(Q instanceof Error?Q.message:"Failed to save")}finally{_(!1)}}},O=L=>{const de=L==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;C(de),g(`# CLAUDE.md
|
|
122
|
+
|
|
123
|
+
`),b(!0)},P=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const z=L=>L.startsWith(e+"/")?L.slice(e.length+1):L,Z=i.some(L=>L.path===`${e}/CLAUDE.md`),I=i.some(L=>L.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:P}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),l.jsx("button",{onClick:P,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 flex min-h-0",children:o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[l.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),l.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((L,de)=>l.jsxs("button",{onClick:()=>R(de),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!S&&h===de?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})}),l.jsx("span",{className:"truncate font-mono-code",children:z(L.path)})]},L.path)),S&&l.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"truncate font-mono-code",children:z(S)})]})]}),(!Z||!I)&&!S&&l.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!Z&&l.jsxs("button",{onClick:()=>O("root"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!I&&l.jsxs("button",{onClick:()=>O("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!S?l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed max-w-[280px]",children:"Create a CLAUDE.md file to give Claude Code project-specific instructions, coding conventions, and context."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>O("root"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary/90 transition-colors cursor-pointer",children:"Create CLAUDE.md"}),l.jsx("button",{onClick:()=>O("dotclaude"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-hover text-cc-fg border border-cc-border hover:bg-cc-active transition-colors cursor-pointer",children:"Create .claude/CLAUDE.md"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:z(S||(((q=i[h])==null?void 0:q.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[v&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:A,disabled:!v||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${v&&!y?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:y?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:p,onChange:L=>{g(L.target.value),b(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),j&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:j})]})]})})]})]})}function K2({icon:e,title:t,expanded:n,onToggle:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:`w-3 h-3 text-cc-muted shrink-0 transition-transform ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M1.5 2A1.5 1.5 0 000 3.5v2A1.5 1.5 0 001.5 7h1v5.5A1.5 1.5 0 004 14h8a1.5 1.5 0 001.5-1.5V7h1A1.5 1.5 0 0016 5.5v-2A1.5 1.5 0 0014.5 2h-13zM4 7h8v5.5a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5V7zm10-1H2V3.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5V6z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8.354 1.146a.5.5 0 00-.708 0l-6 6A.5.5 0 002 7.5V14a1 1 0 001 1h3.5a.5.5 0 00.5-.5V11a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.5a.5.5 0 00.5.5H13a1 1 0 001-1V7.5a.5.5 0 00-.146-.354l-6-6z"})})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function hr({label:e,sublabel:t,count:n,onClick:i}){return l.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&l.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-muted shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function VP({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M2 4a2 2 0 012-2h3.17a2 2 0 011.415.586l.828.828A2 2 0 0010.83 4H12a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V4z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:l.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function GP({path:e,label:t,onClose:n}){const[i,a]=k.useState(""),[o,u]=k.useState(!0),[h,f]=k.useState(!1),[p,g]=k.useState(!1),[v,b]=k.useState(null);k.useEffect(()=>{we.readFile(e).then(j=>{a(j.content),u(!1)}).catch(j=>{b(j instanceof Error?j.message:"Failed to read file"),u(!1)})},[e]);const y=async()=>{g(!0),b(null);try{await we.writeFile(e,i),f(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{g(!1)}},_=()=>{h&&!confirm("Discard unsaved changes?")||n()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),l.jsxs("div",{className:"flex items-center gap-2",children:[h&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!h||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${h&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:i,onChange:j=>{a(j.target.value),f(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),v&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:v})]})]})}function YP({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,a]=k.useState(null),[o,u]=k.useState(!0);return k.useEffect(()=>{we.readFile(e.path).then(h=>{a(h.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(VP,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?l.jsx(qP,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(GP,{path:e.path,label:e.label,onClose:n})}function XP({sessionId:e}){const t=W(S=>S.sessions.get(e)),n=W(S=>S.sdkSessions.find(C=>C.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,o]=k.useState(null),[u,h]=k.useState(!0),[f,p]=k.useState(!1),[g,v]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(i)try{const S=await we.getClaudeConfig(i);o(S)}catch{}finally{h(!1)}},[i]);if(k.useEffect(()=>{_()},[_]),!i)return null;if(u)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!a)return null;const j=a.project.claudeMd.length+(a.project.settings?1:0)+(a.project.settingsLocal?1:0)+a.project.commands.length,N=(a.user.claudeMd?1:0)+a.user.skills.length+a.user.agents.length+(a.user.settings?1:0)+a.user.commands.length;return l.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[l.jsx(K2,{icon:"project",title:`Project (${j})`,expanded:f,onToggle:()=>p(S=>!S)}),f&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(S=>l.jsx(hr,{label:S.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:S.path,kind:"claude-md"})},S.path)),a.project.settings&&l.jsx(hr,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(hr,{label:"settings.local.json",onClick:()=>y({label:"settings.local.json",path:a.project.settingsLocal.path,kind:"json"})}),a.project.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.project.commands.length,")"]}),a.project.commands.map(S=>l.jsx(hr,{label:`/${S.name}`,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),j===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),l.jsx(K2,{icon:"user",title:`User (${N})`,expanded:g,onToggle:()=>v(S=>!S)}),g&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(hr,{label:"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:a.user.claudeMd.path,kind:"claude-md",editorCwd:a.user.root})}),a.user.skills.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",a.user.skills.length,")"]}),a.user.skills.map(S=>l.jsx(hr,{label:S.name,sublabel:S.description?S.description.slice(0,40):void 0,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.agents.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",a.user.agents.length,")"]}),a.user.agents.map(S=>l.jsx(hr,{label:S.name,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.settings&&l.jsx(hr,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.user.settings.path,kind:"json"})}),a.user.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.user.commands.length,")"]}),a.user.commands.map(S=>l.jsx(hr,{label:`/${S.name}`,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),N===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),b&&$o.createPortal(l.jsx(YP,{item:b,cwd:i,onClose:()=>y(null)}),document.body)]})}function QP(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class WP extends k.Component{constructor(){super(...arguments);w_(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){ga(n,{section:this.props.label})}render(){return this.state.hasError?l.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),l.jsx("button",{className:"text-[10px] text-cc-muted hover:text-cc-fg px-2 py-0.5 rounded bg-cc-hover cursor-pointer",onClick:()=>this.setState({hasError:!1}),children:"Retry"})]})}):this.props.children}}const SC=[],Cv=3e4,ZP=6e4,KP=5*6e4;let J2=null,eS=new Map;function JP(e){return e!==J2&&(J2=e,eS=new Map(e.map(t=>[t.sessionId,t]))),eS}function Fu(e){return W(k.useCallback(t=>JP(t.sdkSessions).get(e),[e]))}const kC="cc-panel-collapsed";function tS(){try{const e=localStorage.getItem(kC);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function eB(e){try{localStorage.setItem(kC,JSON.stringify([...e]))}catch{}}function jC({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[o,u]=k.useState(()=>tS().has(e)?!0:!i),h=k.useRef(!0);k.useEffect(()=>{if(h.current){h.current=!1;return}const p=tS();o?p.add(e):p.delete(e),eB(p)},[o,e]);const f=k.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:f,"aria-expanded":!o,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${o?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&l.jsx("span",{className:"shrink-0",children:n})]}),l.jsx("div",{className:"accordion-panel","data-open":o?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function tB(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(jC,{id:"identity",label:"Identity",children:l.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),l.jsx("input",{type:"text",value:e,onChange:a=>{const o=a.target.value;t(o),localStorage.setItem("cc-user-name",o)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),l.jsx("input",{type:"text",value:n,onChange:a=>{const o=a.target.value;i(o),localStorage.setItem("cc-session-prefix",o)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",l.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",l.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function NC(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function CC(e){return e>80?"critical":e>50?"elevated":"normal"}function wr({label:e,pct:t,detail:n}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&l.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),l.jsx("div",{role:"meter","aria-label":`${e} usage — ${CC(t)}`,"aria-valuenow":Math.round(t),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${NC(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function nB({sessionId:e}){var f;const[t,n]=k.useState(null),i=k.useCallback(async()=>{try{const p=await we.getSessionUsageLimits(e);n(p)}catch{}},[e]),a=k.useRef(0);if(k.useEffect(()=>{i();const p=setInterval(()=>{a.current+=1,a.current%2===0?i():n(g=>g?{...g}:null)},Cv);return()=>clearInterval(p)},[i]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,h=!o&&!u&&((f=t.extra_usage)==null?void 0:f.is_enabled);return!o&&!u&&!h?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(wr,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?$2(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(wr,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?$2(t.seven_day.resets_at):void 0}),h&&t.extra_usage&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:["$",t.extra_usage.used_credits.toFixed(2)," / $",t.extra_usage.monthly_limit]})]}),t.extra_usage.utilization!==null&&l.jsx("div",{role:"meter","aria-label":`Extra usage — ${CC(t.extra_usage.utilization)}`,"aria-valuenow":Math.round(t.extra_usage.utilization),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${NC(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function Mh(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function sB(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await we.getSystemMemory();i||n(u)}catch{}};a();const o=setInterval(a,ZP);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(wr,{label:"Memory",pct:t.used_percent,detail:`${Mh(t.used_bytes)} / ${Mh(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(wr,{label:"Swap",pct:t.swap_used_percent,detail:`${Mh(t.swap_used_bytes)} / ${Mh(t.swap_total_bytes)}`})]}):null}function iB(e){const t=e/1099511627776;if(t>=1)return`${t.toFixed(1)} TB`;const n=e/1024**3;return n>=1?`${n.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function rB(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await we.getSystemDisk();i||n(u)}catch{}};a();const o=setInterval(a,KP);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(wr,{label:"Disk",pct:t.used_percent,detail:`${iB(t.available_bytes)} free`})}):null}function aB({sessionId:e}){const t=W(o=>{var u;return(u=o.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const o=setInterval(()=>n(u=>u+1),Cv);return()=>clearInterval(o)},[t]),!t)return null;const{primary:i,secondary:a}=t;return!i&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&l.jsx(wr,{label:`${P2(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?vx(i.resetsAt):void 0}),a&&l.jsx(wr,{label:`${P2(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?vx(a.resetsAt):void 0})]})}function lB({sessionId:e}){const t=W(i=>{var a;return(a=i.sessions.get(e))==null?void 0:a.codex_token_details}),n=W(i=>{var a;return((a=i.sessions.get(e))==null?void 0:a.context_used_percent)??0});return t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ru(t.inputTokens)})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ru(t.outputTokens)})]}),t.cachedInputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ru(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:ru(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(wr,{label:"Context",pct:n})]}):null}function oB(e,t){if(t)return{label:"Draft",cls:"text-cc-muted bg-cc-hover"};switch(e){case"OPEN":return{label:"Open",cls:"text-cc-success bg-cc-success/10"};case"MERGED":return{label:"Merged",cls:"text-cc-merged bg-cc-merged/10"};case"CLOSED":return{label:"Closed",cls:"text-cc-error bg-cc-error/10"}}}function cB({pr:e}){const t=oB(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors",children:["PR #",e.number]}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&l.jsx("div",{className:"flex items-center gap-2 text-[11px]","aria-label":`CI checks: ${n.success} passed, ${n.failure} failing, ${n.pending} pending`,children:n.failure>0?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})}),n.failure," failing"]}),n.success>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.success," passed"]})]}):n.pending>0?l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),l.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&l.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.total,"/",n.total," checks passed"]})}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),"Approved"]}),e.reviewDecision==="CHANGES_REQUESTED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 11-2 0 1 1 0 012 0zM8 7a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 7z",clipRule:"evenodd"})}),"Changes requested"]}),(e.reviewDecision==="REVIEW_REQUIRED"||e.reviewDecision===null)&&e.state==="OPEN"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),i.unresolved," unresolved"]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[l.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),l.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),l.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function uB({sessionId:e}){const t=W(u=>u.sessions.get(e)),n=Fu(e),i=W(u=>u.prStatus.get(e)),a=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),o=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return k.useEffect(()=>{i||!a||!o||we.getPRStatus(a,o).then(u=>{W.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(cB,{pr:i.pr})}const dB=6e4;function x0(e,t){switch(e){case"completed":return{label:t||"Done",cls:"text-cc-success bg-cc-success/10"};case"cancelled":return{label:t||"Cancelled",cls:"text-cc-muted bg-cc-hover"};case"started":return{label:t||"In Progress",cls:"text-cc-info bg-cc-info/10"};case"unstarted":return{label:t||"Todo",cls:"text-cc-muted bg-cc-hover"};case"backlog":return{label:t||"Backlog",cls:"text-cc-muted bg-cc-hover"};default:return{label:t||e||"Unknown",cls:"text-cc-muted bg-cc-hover"}}}function hB({sessionId:e}){const t=W(L=>L.linkedLinearIssues.get(e)),[n,i]=k.useState([]),[a,o]=k.useState(null),[u,h]=k.useState([]),[f,p]=k.useState(""),[g,v]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,S]=k.useState(""),[C,E]=k.useState([]),[R,A]=k.useState(!1),O=k.useRef(null);k.useEffect(()=>{we.getLinkedLinearIssue(e).then(L=>{L.issue&&W.getState().setLinkedLinearIssue(e,L.issue)}).catch(()=>{})},[e]);const P=k.useCallback(async()=>{if(t)try{const L=await we.getLinkedLinearIssue(e,!0);L.issue&&(W.getState().setLinkedLinearIssue(e,L.issue),L.issue.stateType==="completed"&&y(!0)),L.comments&&i(L.comments),L.assignee!==void 0&&o(L.assignee??null),L.labels&&h(L.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;P();const L=setInterval(P,dB);return()=>clearInterval(L)},[P,t]),k.useEffect(()=>{if(!_)return;const L=N.trim();if(L.length<2){E([]);return}let de=!0;A(!0);const Q=setTimeout(()=>{we.searchLinearIssues(L,6).then(V=>{de&&E(V.issues)}).catch(()=>{de&&E([])}).finally(()=>{de&&A(!1)})},400);return()=>{de=!1,clearTimeout(Q)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var L;return(L=O.current)==null?void 0:L.focus()},50)},[_]);async function z(){if(!(!t||!f.trim()||g)){v(!0);try{const L=await we.addLinearComment(t.id,f.trim());i(de=>[...de,L.comment]),p("")}catch{}finally{v(!1)}}}async function Z(){try{await we.unlinkLinearIssue(e),W.getState().setLinkedLinearIssue(e,null),i([]),o(null),h([]),y(!1)}catch{}}async function I(L){try{await we.linkLinearIssue(e,L),W.getState().setLinkedLinearIssue(e,L),j(!1),S(""),E([])}catch{}}if(!t)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(wu,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:O,type:"text",value:N,onChange:L=>S(L.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),S(""),E([])},"aria-label":"Close search",className:"w-7 h-7 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),R&&l.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),C.length>0&&l.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:C.map(L=>l.jsxs("button",{onClick:()=>I(L),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:L.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${x0(L.stateType,L.stateName).cls}`,children:x0(L.stateType,L.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:L.title})]},L.id))}),N.trim().length>=2&&!R&&C.length===0&&l.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):l.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[l.jsx(wu,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const q=x0(t.stateType,t.stateName);return l.jsxs("div",{className:"shrink-0",children:[l.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(wu,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${q.cls}`,children:q.label}),l.jsx("button",{onClick:Z,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&l.jsx("span",{children:t.priorityLabel}),t.teamName&&l.jsxs(l.Fragment,{children:[t.priorityLabel&&l.jsx("span",{children:"·"}),l.jsx("span",{children:t.teamName})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{children:["@ ",a.name]})]})]}),u.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(L=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${L.color}20`,color:L.color},children:L.name},L.id))})]}),b&&t.stateType==="completed"&&l.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),l.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:()=>y(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),l.jsx("button",{onClick:async()=>{try{await we.archiveSession(e),W.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&l.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[l.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(L=>l.jsxs("div",{className:"text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:L.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:QP(new Date(L.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:L.body})]},L.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:f,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),z())},placeholder:"Add a comment...","aria-label":"Add a comment",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:z,disabled:!f.trim()||g,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.19.736-5.19.737a.5.5 0 0 0-.397.353L1.01 13.48a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5z"})})})]})]})}function fB({sessionId:e}){const t=W(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(h=>h+1),Cv);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const i=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?vx(t.resetsAt):void 0;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2","data-testid":"claude-rate-limit",children:[a!==void 0?l.jsx(wr,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:o}):l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Plan Limit"}),l.jsxs("span",{className:`text-[11px] tabular-nums ${i?"text-cc-error":"text-cc-warning"}`,children:[i?"rate limited":t.status,o&&` · resets ${o}`]})]}),i&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function pB({sessionId:e}){const t=W(a=>a.sessions.get(e)),n=Fu(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(aB,{sessionId:e}),l.jsx(lB,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(fB,{sessionId:e}),l.jsx(nB,{sessionId:e})]})}function mB({sessionId:e}){const t=W(p=>p.sessions.get(e)),n=Fu(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),a=(t==null?void 0:t.git_ahead)||0,o=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,h=(t==null?void 0:t.total_lines_removed)||0,f=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(a>0||o>0||u>0||h>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[a>0&&l.jsxs("span",{className:"text-cc-success",children:[a,"↑",l.jsx("span",{className:"sr-only",children:" commits ahead"})]}),o>0&&l.jsxs("span",{className:"text-cc-warning",children:[o,"↓",l.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&l.jsxs("span",{className:"text-cc-success",children:["+",u,l.jsx("span",{className:"sr-only",children:" lines added"})]}),h>0&&l.jsxs("span",{className:"text-cc-error",children:["-",h,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&f&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{we.gitPull(f).then(p=>{W.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||ga(new Error(`git pull failed: ${p.output}`))}).catch(p=>ga(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function gB({sessionId:e}){const t=W(o=>o.sessionTasks.get(e)||SC),n=W(o=>o.sessions.get(e)),i=Fu(e),a=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||a?null:l.jsx("div",{className:"px-3 py-2",children:t.length===0?l.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):l.jsx("div",{className:"space-y-0.5",children:t.map(o=>l.jsx(wB,{task:o},o.id))})})}const xB={"usage-limits":pB,"server-memory":sB,"server-disk":rB,"git-branch":mB,"github-pr":uB,"linear-issue":hB,"mcp-servers":HP,tasks:gB};function vB(e,t){const n=W(i=>i.sessionTasks.get(t)||SC);if(e==="tasks"&&n.length>0){const i=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function bB({isCodex:e}){const t=W(p=>p.taskPanelConfig),n=W(p=>p.toggleSectionEnabled),i=W(p=>p.moveSectionUp),a=W(p=>p.moveSectionDown),o=W(p=>p.resetTaskPanelConfig),u=W(p=>p.setTaskPanelConfigMode),h=e?"codex":"claude",f=t.order.filter(p=>{const g=yr.find(v=>v.id===p);return!(!g||g.backends&&!g.backends.includes(h))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:f.map((p,g)=>{const v=yr.find(j=>j.id===p),b=t.enabled[p]??!0,y=g===0,_=g===f.length-1;return l.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${b?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[l.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>i(p),disabled:y,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move up","data-testid":`move-up-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),l.jsx("button",{onClick:()=>a(p),disabled:_,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move down","data-testid":`move-down-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:v.label}),l.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:v.description})]}),l.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${b?"bg-cc-primary":"bg-cc-hover"}`,title:b?"Hide section":"Show section",role:"switch","aria-checked":b,"data-testid":`toggle-${p}`,children:l.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${b?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),l.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[l.jsx("button",{onClick:()=>o(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),l.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function yB({sectionId:e,sessionId:t,children:n}){var o;const i=((o=yr.find(u=>u.id===e))==null?void 0:o.label)??e,a=vB(e,t);return l.jsx(jC,{id:e,label:i,badge:a,children:n})}function _B({sessionId:e}){const t=W(g=>g.sessions.get(e)),n=Fu(e),i=W(g=>g.taskPanelOpen),a=W(g=>g.setTaskPanelOpen),o=W(g=>g.taskPanelConfigMode),u=W(g=>g.taskPanelConfig);if(!i)return null;const h=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",f=h?"codex":"claude",p=u.order.filter(g=>{const v=yr.find(b=>b.id===g);return!(!v||v.backends&&!v.backends.includes(f))});return l.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:o?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{o?W.getState().setTaskPanelConfigMode(!1):a(!1)},"aria-label":"Close panel",className:"flex items-center justify-center w-8 h-8 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),o?l.jsx(bB,{isCodex:h}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[l.jsx(tB,{}),l.jsx(XP,{sessionId:e}),p.filter(g=>u.enabled[g]!==!1).map(g=>{var b;const v=xB[g];return v?l.jsx(yB,{sectionId:g,sessionId:e,children:l.jsx(WP,{label:(b=yr.find(y=>y.id===g))==null?void 0:b.label,children:l.jsx(v,{sessionId:e})})},g):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>W.getState().setTaskPanelConfigMode(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Configure panel sections","data-testid":"customize-panel-btn",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M7.429 1.525a6.593 6.593 0 011.142 0c.036.003.108.036.137.146l.289 1.105c.147.56.55.967.997 1.189.174.086.341.183.501.29.417.278.97.423 1.53.27l1.102-.303c.11-.03.175.016.195.046.219.31.41.641.573.989.014.031.022.11-.059.19l-.815.806c-.411.406-.562.957-.53 1.456a4.588 4.588 0 010 .582c-.032.499.119 1.05.53 1.456l.815.806c.08.08.073.159.059.19a6.494 6.494 0 01-.573.99c-.02.029-.086.074-.195.045l-1.103-.303c-.559-.153-1.112-.008-1.529.27-.16.107-.327.204-.5.29-.449.222-.851.628-.998 1.189l-.289 1.105c-.029.11-.101.143-.137.146a6.613 6.613 0 01-1.142 0c-.036-.003-.108-.037-.137-.146l-.289-1.105c-.147-.56-.55-.967-.997-1.189a4.502 4.502 0 01-.501-.29c-.417-.278-.97-.423-1.53-.27l-1.102.303c-.11.03-.175-.016-.195-.046a6.492 6.492 0 01-.573-.989c-.014-.031-.022-.11.059-.19l.815-.806c.411-.406.562-.957.53-1.456a4.587 4.587 0 010-.582c.032-.499-.119-1.05-.53-1.456l-.815-.806c-.08-.08-.073-.159-.059-.19a6.44 6.44 0 01.573-.99c.02-.029.086-.074.195-.045l1.103.303c.559.153 1.112.008 1.529-.27.16-.107.327-.204.5-.29.449-.222.851-.628.998-1.189l.289-1.105c.029-.11.101-.143.137-.146zM8 10.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",clipRule:"evenodd"})}),"Customize panel"]})})]})]})}function wB({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?l.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),l.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),l.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&l.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&l.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),l.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function SB({status:e}){return e==="created"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-green-500/20 text-green-400",children:"A"}):e==="deleted"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-red-500/20 text-red-400",children:"D"}):l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-cc-warning/20 text-cc-warning",children:"M"})}function kB({sessionId:e}){const t=W(A=>A.sessions.get(e)),n=W(A=>A.sdkSessions.find(O=>O.sessionId===e)),i=W(A=>A.diffPanelSelectedFile.get(e)??null),a=W(A=>A.setDiffPanelSelectedFile),o=W(A=>A.diffBase),u=W(A=>A.setDiffBase),h=W(A=>A.changedFilesTick.get(e)??0),f=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,g]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),S=W(A=>A.setGitChangedFilesCount);k.useEffect(()=>{if(!f)return;let A=!1;return we.getChangedFiles(f,o).then(({files:O})=>{if(A)return;const P=`${f}/`,z=O.filter(Z=>Z.path===f||Z.path.startsWith(P)).map(Z=>({abs:Z.path,rel:Z.path.startsWith(P)?Z.path.slice(P.length):Z.path,status:Z.status==="A"||Z.status==="?"?"created":Z.status==="D"?"deleted":"updated"})).sort((Z,I)=>Z.rel.localeCompare(I.rel));N(z),S(e,z.length)}).catch(()=>{A||(N([]),S(e,0))}),()=>{A=!0}},[f,o,h,e,S]);const C=j;k.useEffect(()=>{!i&&C.length>0&&a(e,C[0].abs)},[i,C,e,a]),k.useEffect(()=>{var A;i&&(C.some(O=>O.abs===i)||a(e,((A=C[0])==null?void 0:A.abs)??null))},[i,C,e,a]),k.useEffect(()=>{if(!i){g("");return}let A=!1;return b(!0),we.getFileDiff(i,o).then(O=>{A||(g(O.diff),b(!1))}).catch(()=>{A||(g(""),b(!1))}),()=>{A=!0}},[i,o]);const E=k.useCallback(A=>{a(e,A),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),R=k.useMemo(()=>!i||!f?i:i.startsWith(f+"/")?i.slice(f.length+1):i,[i,f]);return f?C.length===0?l.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:l.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"File changes compared to the base will appear here once the agent edits files."})]})]}):l.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[y&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),l.jsxs("div",{className:`
|
|
124
|
+
${y?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
|
|
125
|
+
fixed sm:relative z-30 sm:z-auto
|
|
126
|
+
${y?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
|
|
127
|
+
shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
|
|
128
|
+
`,children:[l.jsxs("div",{className:"w-[220px] px-4 py-3 text-[11px] font-semibold text-cc-fg uppercase tracking-wider border-b border-cc-border shrink-0 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),l.jsxs("span",{children:["Changed (",C.length,")"]})]}),l.jsx("button",{onClick:()=>_(!1),className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer sm:hidden",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:C.map(({abs:A,rel:O,status:P})=>l.jsxs("button",{onClick:()=>E(A),className:`flex items-center gap-2 w-full mx-1 px-2 py-2.5 text-[13px] rounded-[10px] hover:bg-cc-hover transition-colors cursor-pointer whitespace-nowrap ${A===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(SB,{status:P}),l.jsx("span",{className:"truncate leading-snug",children:O})]},A))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[i&&l.jsxs("div",{className:"shrink-0 flex items-center gap-2 sm:gap-2.5 px-2 sm:px-4 py-2.5 bg-cc-card border-b border-cc-border",children:[!y&&l.jsx("button",{onClick:()=>_(!0),className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",title:"Show file list",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:R==null?void 0:R.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:R})]}),l.jsx("button",{onClick:()=>u(o==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${o==="last-commit"?"default branch":"last commit"} comparison`,children:o==="default-branch"?"vs default branch":"vs last commit"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:v?l.jsx("div",{className:"h-full flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?l.jsx("div",{className:"p-4",children:l.jsx(Oo,{unifiedDiff:p,fileName:R||void 0,mode:"full"})}):l.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!y&&l.jsxs("button",{onClick:()=>_(!0),className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),"Show file list"]}),l.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:l.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function jB(){const e=W(f=>f.updateInfo),t=W(f=>f.updateDismissedVersion),n=W(f=>f.dismissUpdate),[i,a]=k.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const o=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await we.triggerUpdate(),W.getState().setUpdateOverlayActive(!0)}catch(f){localStorage.removeItem("companion_docker_prompt_pending"),ga(f),a(!1)}},u=()=>{n(e.latestVersion)},h=i||e.updateInProgress;return l.jsxs("div",{className:"px-4 py-1.5 bg-cc-primary/10 border-b border-cc-primary/20 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.2s_ease-out]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 2a.75.75 0 0 0-.75.75v3.69L5.78 6.15a.75.75 0 0 0-.96 1.15l2.5 2.08a.75.75 0 0 0 1.08-.12l2-2.5a.75.75 0 1 0-1.17-.94L8.75 6.5V3.75A.75.75 0 0 0 8 3z"})}),l.jsxs("span",{className:"text-xs text-cc-fg",children:[l.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",l.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?l.jsx("button",{onClick:o,disabled:h,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:h?"Updating...":"Update & Restart"}):l.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",l.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," ","for auto-updates"]}),l.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function NB({text:e}){const[t,n]=k.useState(!1);k.useEffect(()=>{if(!t)return;const a=setTimeout(()=>n(!1),1500);return()=>clearTimeout(a)},[t]);async function i(){try{await navigator.clipboard.writeText(e),n(!0)}catch{}}return l.jsx("div",{className:"mt-3 w-full max-w-xs px-4","data-testid":"unsent-prompt",children:l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-card/80",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-cc-border/60",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-fg",children:"Your prompt was not sent"}),l.jsx("button",{type:"button",onClick:i,className:"px-2 py-1 min-h-[28px] text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:t?"Copied":"Copy"})]}),l.jsx("pre",{className:"px-3 py-2 max-h-40 overflow-auto text-[11px] text-cc-fg whitespace-pre-wrap break-words font-mono-code leading-relaxed select-text",children:e}),l.jsx("p",{className:"px-3 pb-2 text-[10px] text-cc-muted",children:"It is still in the composer — dismiss to edit and retry."})]})})}function CB({steps:e,error:t,unsentPrompt:n,backend:i,onCancel:a}){const o=i==="codex"?"/logo-codex.svg":"/logo.svg",u=e.some(b=>b.status==="in_progress"),h=e.length>0&&e.every(b=>b.status==="done"),f=e.some(b=>b.status==="error")||!!t,p=[...e].reverse().find(b=>b.status==="in_progress"),g=[...e].reverse().find(b=>b.status==="done"),v=f?"Something went wrong":h?"Launching session...":(p==null?void 0:p.label)||(g==null?void 0:g.label)||"Preparing...";return l.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-cc-bg/95 backdrop-blur-sm animate-fade-in",children:[l.jsxs("div",{className:"relative mb-8",children:[u&&!f&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:o,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${u&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),u&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),h&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:v}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((b,y)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${y*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[b.status==="in_progress"&&l.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),b.status==="done"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:l.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),b.status==="error"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),l.jsx("span",{className:`text-xs transition-colors duration-200 ${b.status==="in_progress"?"text-cc-fg font-medium":b.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:b.label}),b.detail&&b.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:b.detail})]},b.step))}),t&&l.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:l.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:l.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),f&&n&&l.jsx(NB,{text:n}),(f||u)&&a&&l.jsx("button",{onClick:a,className:"mt-6 px-4 py-2.5 min-h-[44px] text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:f?"Dismiss":"Cancel"}),!f&&e.length>0&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(b=>b.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function EB(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const TB={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function MB(e){const[t,n]=k.useState("installing"),i=k.useRef(null),a=k.useRef(!0);return k.useEffect(()=>(a.current=!0,()=>{a.current=!1,i.current&&clearTimeout(i.current)}),[]),k.useEffect(()=>{if(!e)return;const o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),h()},5e3);function h(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:EB()}).then(f=>{if(!f.ok)throw new Error("not ready");return f.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(h,1500)})}return()=>{clearTimeout(o),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function EC({phase:e,className:t}){const n=e==="ready";return l.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[l.jsxs("div",{className:"relative mb-8",children:[!n&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),n&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),l.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:TB[e]}),l.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&l.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(i=>l.jsx("span",{"data-testid":"progress-dot",className:"w-1.5 h-1.5 rounded-full bg-cc-primary/50",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${i*.2}s`}},i))}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-1000 ease-out",style:{width:n?"100%":e==="waiting"?"75%":e==="restarting"?"40%":"15%"}})})]})}function AB({active:e}){const t=MB(e);return e?l.jsx(EC,{phase:t,className:"fixed inset-0 z-[100]"}):null}function pF({phase:e}){return l.jsx(EC,{phase:e,className:"absolute inset-0"})}function RB(){const e=W(j=>j.dockerUpdateDialogOpen),t=W(j=>j.setDockerUpdateDialogOpen),[n,i]=k.useState("prompt"),[a,o]=k.useState(!1),[u,h]=k.useState(null),f=k.useRef(null);if(k.useEffect(()=>{e&&we.getSettings().then(j=>{o(j.dockerAutoUpdate),j.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){f.current&&(clearInterval(f.current),f.current=null);return}return f.current=setInterval(()=>{we.getImageStatus("the-companion:latest").then(j=>{h(j),j.status==="ready"?i("done"):j.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{f.current&&(clearInterval(f.current),f.current=null)}},[n]),!e)return null;function p(){i("pulling"),we.pullImage("the-companion:latest").then(j=>{j.state&&h(j.state)}).catch(()=>{i(j=>j==="pulling"?"error":j)})}function g(){p()}function v(){y()}function b(){y()}function y(){i("prompt"),h(null),t(!1)}async function _(){const j=!a;o(j);try{await we.updateSettings({dockerAutoUpdate:j})}catch{o(!j)}}return l.jsx("div",{className:"fixed inset-0 z-[90] flex items-center justify-center bg-black/50 animate-fade-in","data-testid":"docker-update-dialog",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-md mx-4 overflow-hidden",children:[n==="prompt"&&l.jsxs("div",{className:"p-6",children:[l.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("button",{type:"button",onClick:_,className:"w-full flex items-center justify-between px-3 py-3 rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer mb-5",children:[l.jsx("span",{children:"Always update Docker image automatically"}),l.jsx("span",{role:"switch","aria-checked":a,"aria-label":"Always update Docker image automatically",className:`relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ${a?"bg-cc-primary":"bg-cc-border"}`,children:l.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${a?"translate-x-4":"translate-x-0"}`})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Skip"}),l.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Update"})]})]}),n==="pulling"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-3",children:"Pulling the-companion:latest"}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[160px] overflow-auto whitespace-pre-wrap","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
|
|
129
|
+
`)})]}),n==="done"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&l.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[120px] overflow-auto whitespace-pre-wrap mb-4","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
|
|
130
|
+
`)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),l.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function mF({phase:e}){return l.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-sm mx-4 overflow-hidden",children:[e==="prompt"&&l.jsxs("div",{className:"p-5",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg mb-4",children:[l.jsx("span",{children:"Always update automatically"}),l.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:l.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("pre",{className:"px-2 py-1.5 text-[9px] font-mono-code bg-cc-code-bg rounded text-cc-muted max-h-[80px] overflow-auto whitespace-pre-wrap",children:`Pulling the-companion:latest...
|
|
131
|
+
Layer 1/5: abc123 downloading
|
|
132
|
+
Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}function OB(){const[e,t]=k.useState(null),[n,i]=k.useState({state:"idle"}),[a,o]=k.useState(""),[u,h]=k.useState(!1),[f,p]=k.useState(""),g=k.useCallback(async()=>{try{t(await we.getClaudeAccount())}catch(A){p(A instanceof Error?A.message:String(A))}},[]);k.useEffect(()=>{g(),we.getClaudeLoginStatus().then(i).catch(()=>{})},[g]);const v=async()=>{h(!0),p(""),o("");try{const A=await we.startClaudeLogin();i(A),A.state==="error"&&A.error&&p(A.error)}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},b=async()=>{h(!0),p("");try{const A=await we.submitClaudeLoginCode(a);i(A),A.state==="success"&&(o(""),await g())}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},y=async()=>{h(!0);try{i(await we.cancelClaudeLogin()),o("")}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},_=async()=>{h(!0),p("");try{const A=await we.claudeLogout();!A.ok&&A.error&&p(A.error),i({state:"idle"}),await g()}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},j=n.state==="awaiting_code",N=n.state==="verifying",S=j||N,C=(e==null?void 0:e.cliAvailable)===!1,E=e!=null&&e.orgName&&e.email&&e.orgName.includes(e.email)?null:(e==null?void 0:e.orgName)??null,R=e!=null&&e.authenticated?[e.email,e.subscriptionType?LB(e.subscriptionType):null,E].filter(Boolean).join(" · "):null;return l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"block text-sm font-medium",children:"Claude Account"}),l.jsx("p",{className:"text-xs text-cc-muted",children:"Sign in with your Claude subscription. You'll open a link, approve on any device, and paste the code back here — no terminal access needed."}),C&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:"Claude CLI not found on this machine. Install it to sign in."}),!C&&e&&!S&&l.jsx("p",{className:"text-xs text-cc-muted","data-testid":"claude-account-status",children:R?`Signed in as ${R}`:e.authenticated?"Signed in":"Not signed in"}),S&&l.jsxs("div",{className:"px-3 py-3 rounded-lg bg-cc-bg border border-cc-primary/20 space-y-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:"1. Open this link and approve:"}),l.jsx("a",{href:n.authUrl,target:"_blank",rel:"noreferrer","data-testid":"claude-auth-url",className:"block text-xs text-cc-primary underline break-all",children:n.authUrl})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs text-cc-muted",htmlFor:"claude-auth-code",children:"2. Paste the code you were shown:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{id:"claude-auth-code",type:"text",value:a,disabled:N,autoComplete:"off",spellCheck:!1,onChange:A=>o(A.target.value),onKeyDown:A=>{A.key==="Enter"&&a.trim()&&!u&&(A.preventDefault(),b())},placeholder:"Paste code here",className:"flex-1 px-3 py-2 min-h-[40px] text-sm font-mono-code bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40"}),l.jsx("button",{type:"button",onClick:b,disabled:u||!a.trim(),className:`px-3 py-2 min-h-[40px] rounded-lg text-sm font-medium transition-colors ${u||!a.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:N?"Verifying…":"Submit"})]})]}),n.error&&l.jsx("p",{role:"alert",className:"text-xs text-cc-error",children:n.error})]}),n.state==="success"&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Signed in to Claude. New sessions will use this account."}),(n.state==="error"||f)&&l.jsx("div",{role:"alert",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:f||n.error}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[S?l.jsx("button",{type:"button",onClick:y,disabled:u,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Cancel"}):l.jsx("button",{type:"button",onClick:v,disabled:u||C,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${u||C?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:u?"Starting…":e!=null&&e.authenticated?"Sign in again":"Sign in with Claude"}),(e==null?void 0:e.authenticated)&&!S&&l.jsx("button",{type:"button",onClick:_,disabled:u,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Sign out"})]})]})}function LB(e){return e.charAt(0).toUpperCase()+e.slice(1)}const DB=2e3;function zB(){const[e,t]=k.useState(null),[n,i]=k.useState({state:"idle"}),[a,o]=k.useState(!1),[u,h]=k.useState(""),[f,p]=k.useState(!1),g=k.useRef(null),v=k.useCallback(async()=>{try{t(await we.getCodexAccount())}catch(R){h(R instanceof Error?R.message:String(R))}},[]),b=k.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=null)},[]),y=k.useCallback(()=>{b(),g.current=setInterval(async()=>{try{const R=await we.getCodexLoginStatus();i(R),R.state!=="pending"&&(b(),R.state==="success"&&v())}catch{}},DB)},[v,b]);k.useEffect(()=>(v(),we.getCodexLoginStatus().then(R=>{i(R),R.state==="pending"&&y()}).catch(()=>{}),b),[v,y,b]);const _=async()=>{o(!0),h("");try{const R=await we.startCodexLogin();i(R),R.state==="pending"?y():R.error&&h(R.error)}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},j=async()=>{o(!0),b();try{i(await we.cancelCodexLogin())}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},N=async()=>{o(!0),h("");try{const R=await we.codexLogout();!R.ok&&R.error&&h(R.error),i({state:"idle"}),await v()}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},S=async()=>{if(n.userCode)try{await navigator.clipboard.writeText(n.userCode),p(!0),setTimeout(()=>p(!1),1500)}catch{}},C=n.state==="pending",E=(e==null?void 0:e.cliAvailable)===!1;return l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"block text-sm font-medium",children:"ChatGPT Subscription (Codex)"}),l.jsx("p",{className:"text-xs text-cc-muted",children:"Sign in with your ChatGPT plan to use Codex without an API key. You'll get a code to enter on any device — no terminal access needed."}),E&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:"Codex CLI not found on this machine. Install it to sign in."}),!E&&e&&!C&&l.jsx("p",{className:"text-xs text-cc-muted","data-testid":"codex-account-status",children:e.authenticated?e.method==="apiKey"?"Authenticated with an OpenAI API key":`Signed in as ${e.email||"ChatGPT account"}${e.planType?` (${e.planType})`:""}`:"Not signed in"}),C&&l.jsxs("div",{className:"px-3 py-3 rounded-lg bg-cc-bg border border-cc-primary/20 space-y-2",children:[l.jsxs("p",{className:"text-xs text-cc-muted",children:["1. Open"," ",l.jsx("a",{href:n.verificationUrl,target:"_blank",rel:"noreferrer",className:"text-cc-primary underline",children:n.verificationUrl})]}),l.jsx("p",{className:"text-xs text-cc-muted",children:"2. Enter this code:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("code",{className:"font-mono-code text-lg tracking-widest bg-cc-code-bg px-3 py-1.5 rounded text-cc-code-fg","data-testid":"codex-user-code",children:n.userCode}),l.jsx("button",{type:"button",onClick:S,className:"px-2 py-1 min-h-[32px] rounded-md text-xs bg-cc-hover text-cc-fg cursor-pointer",children:f?"Copied":"Copy"})]}),l.jsx("p",{className:"text-xs text-cc-muted",role:"status",children:"Waiting for approval…"})]}),n.state==="success"&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Signed in to Codex. New sessions will use this account."}),(n.state==="error"||u)&&l.jsx("div",{role:"alert",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:u||n.error}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[C?l.jsx("button",{type:"button",onClick:j,disabled:a,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Cancel"}):l.jsx("button",{type:"button",onClick:_,disabled:a||E,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${a||E?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:a?"Starting…":e!=null&&e.authenticated?"Sign in again":"Sign in with ChatGPT"}),(e==null?void 0:e.authenticated)&&!C&&l.jsx("button",{type:"button",onClick:N,disabled:a,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Sign out"})]})]})}const v0=["welcome","claude","codex","done"],nS='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function _x(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function $B({onComplete:e}){const[t,n]=k.useState("welcome"),[i,a]=k.useState(""),[o,u]=k.useState(""),[h,f]=k.useState(!1),[p,g]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(_x),S=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const q=S.current;if(!q)return;function L(Q){if(Q.key==="Escape"){Q.preventDefault();return}if(Q.key!=="Tab")return;const V=q.querySelectorAll(nS);if(V.length===0)return;const G=V[0],H=V[V.length-1];Q.shiftKey?document.activeElement===G&&(Q.preventDefault(),H.focus()):document.activeElement===H&&(Q.preventDefault(),G.focus())}document.addEventListener("keydown",L);const de=q.querySelector(nS);return de==null||de.focus(),()=>document.removeEventListener("keydown",L)},[t]);const C=k.useCallback(async()=>{if(!i.trim()){n("codex");return}f(!0),g("");try{await we.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(q){g(q instanceof Error?q.message:"Failed to save token")}finally{f(!1)}},[i]),E=k.useCallback(async()=>{f(!0),g("");try{(await we.getSettings()).codexDeviceAuthConfigured?(_(!0),await A()):g("No Codex auth found yet. Complete the sign-in above, then check again.")}catch(q){g(q instanceof Error?q.message:"Failed to check auth status")}finally{f(!1)}},[]),R=k.useCallback(async()=>{f(!0),g("");try{await we.updateSettings({openaiApiKey:o.trim()}),_(!0),await A()}catch(q){g(q instanceof Error?q.message:"Failed to save API key")}finally{f(!1)}},[o]),A=k.useCallback(async()=>{try{await we.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),O=k.useCallback(()=>{e()},[e]),P=k.useCallback(async()=>{await A(),e()},[A,e]),z=k.useCallback(q=>{g(""),n(q)},[]),Z=v0.indexOf(t),I=_x();return $o.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:j?1:0,transition:I?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),l.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:I?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${Z+1} of ${v0.length-1}`,children:v0.slice(0,3).map((q,L)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:L===Z?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:L<=Z?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:L<=Z?1:.5}},q))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(PB,{onSetupClaude:()=>z("claude"),onSetupCodex:()=>z("codex")}),t==="claude"&&l.jsx(BB,{token:i,onTokenChange:a,onSave:C,onSkip:()=>z("codex"),saving:h,error:p}),t==="codex"&&l.jsx(FB,{apiKey:o,onApiKeyChange:u,onCheckAuth:E,onSaveApiKey:R,onSkip:()=>A(),onBack:()=>z("claude"),saving:h,error:p}),t==="done"&&l.jsx(IB,{claudeConfigured:v,codexConfigured:y,onDone:O})]}),t==="welcome"&&l.jsx("button",{onClick:P,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function PB({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function BB({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:o}){const u=k.useRef(null);k.useEffect(()=>{var f;(f=u.current)==null||f.focus()},[]);const h="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Sign in with your Claude subscription — no terminal needed."})]}),l.jsx(OB,{}),l.jsx("div",{className:"mt-5 pt-4 border-t border-cc-border",children:l.jsx("p",{className:"text-xs text-cc-muted mb-2",children:"Or paste a long-lived token instead — generate one with:"})}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(UB,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:f=>t(f.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?h:void 0,"aria-invalid":o?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),o&&l.jsxs("div",{id:h,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function FB({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:o,saving:u,error:h}){const[f,p]=k.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Sign in with your ChatGPT account — no terminal needed."})]}),l.jsx(zB,{}),h&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:h})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!f),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:f?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":f?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":h?g:void 0,"aria-invalid":h?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function IB({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=_x(),[o,u]=k.useState(a);return k.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function UB({text:e}){const[t,n]=k.useState(!1),i=k.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}function HB(e){return W(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const qB=k.lazy(()=>Zn(()=>import("./Playground-CvoHRMBd.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),VB=k.lazy(()=>Zn(()=>import("./SettingsPage-BZ2fBrHD.js"),[]).then(e=>({default:e.SettingsPage}))),GB=k.lazy(()=>Zn(()=>import("./IntegrationsPage-C3aW9cDI.js"),[]).then(e=>({default:e.IntegrationsPage}))),YB=k.lazy(()=>Zn(()=>import("./LinearSettingsPage-DDHFHt7j.js"),[]).then(e=>({default:e.LinearSettingsPage}))),XB=k.lazy(()=>Zn(()=>import("./LinearOAuthSettingsPage-_eAbciJN.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),QB=k.lazy(()=>Zn(()=>import("./TailscalePage-DFRiFKcb.js"),[]).then(e=>({default:e.TailscalePage}))),WB=k.lazy(()=>Zn(()=>import("./PromptsPage-CzTs1_Se.js"),[]).then(e=>({default:e.PromptsPage}))),ZB=k.lazy(()=>Zn(()=>Promise.resolve().then(()=>SP),void 0).then(e=>({default:e.EnvManager}))),KB=k.lazy(()=>Zn(()=>import("./SandboxManager-C3tFkiWz.js"),[]).then(e=>({default:e.SandboxManager}))),JB=k.lazy(()=>Zn(()=>import("./CronManager-Bq2lOMbZ.js"),[]).then(e=>({default:e.CronManager}))),eF=k.lazy(()=>Zn(()=>import("./AgentsPage-Byq8wvdn.js"),[]).then(e=>({default:e.AgentsPage}))),tF=k.lazy(()=>Zn(()=>import("./RunsPage-B7xru-Xy.js"),[]).then(e=>({default:e.RunsPage}))),nF=k.lazy(()=>Zn(()=>import("./DashboardPage-V77HIt8S.js"),[]).then(e=>({default:e.DashboardPage}))),sF=k.lazy(()=>Zn(()=>import("./MagicUIView-C0aiMTet.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function bs(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function iF(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function rF(){const e=W(T=>T.isAuthenticated),t=W(T=>T.darkMode),n=W(T=>T.currentSessionId),i=W(T=>T.sidebarOpen),a=W(T=>T.taskPanelOpen),o=W(T=>T.homeResetKey),u=W(T=>T.activeTab),h=HB(n),f=W(T=>T.sessionCreating),p=W(T=>T.sessionCreatingBackend),g=W(T=>T.creationProgress),v=W(T=>T.creationError),b=W(T=>T.creationDraft),y=W(T=>T.updateOverlayActive),_=iF(),j=k.useMemo(()=>Kx(_),[_]),N=j.page==="settings",S=j.page==="prompts",C=j.page==="integrations",E=j.page==="integration-linear",R=j.page==="integration-linear-oauth",A=j.page==="integration-tailscale",O=j.page==="environments",P=j.page==="sandboxes",z=j.page==="scheduled",Z=j.page==="agents"||j.page==="agent-detail",I=j.page==="runs",q=j.page==="dashboard",L=j.page==="session"||j.page==="home";k.useEffect(()=>{J8(_||"#/")},[_]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const de=k.useRef(W.getState().currentSessionId);k.useEffect(()=>{if(de.current!==null&&j.page==="home"){Jx(de.current,!0),de.current=null;return}if(de.current=null,j.page==="session"){const T=W.getState();T.currentSessionId!==j.sessionId&&T.setCurrentSession(j.sessionId),Do(j.sessionId)}else if(j.page==="home"){const T=W.getState();T.currentSessionId!==null&&T.setCurrentSession(null)}},[j]);const Q=W(T=>n?T.changedFilesTick.get(n)??0:0),V=W(T=>T.diffBase),G=W(T=>T.setGitChangedFilesCount),H=W(T=>{var Ne,Ce;return n&&(((Ne=T.sessions.get(n))==null?void 0:Ne.cwd)||((Ce=T.sdkSessions.find($=>$.sessionId===n))==null?void 0:Ce.cwd))||null});k.useEffect(()=>{if(!n||!H)return;let T=!1;return we.getChangedFiles(H,V).then(({files:Ne})=>{if(T)return;const Ce=`${H}/`,$=Ne.filter(B=>B.path===H||B.path.startsWith(Ce)).length;G(n,$)}).catch(()=>{}),()=>{T=!0}},[n,H,V,Q,G]),k.useEffect(()=>{const T=()=>{we.checkForUpdate().then(Ce=>{W.getState().setUpdateInfo(Ce)}).catch(()=>{})};T();const Ne=setInterval(T,300*1e3);return()=>clearInterval(Ne)},[]),k.useEffect(()=>{const T=()=>{we.getClaudeCompat().then(Ce=>{W.getState().setClaudeCompatInfo(Ce)}).catch(()=>{})};T();const Ne=setInterval(T,300*1e3);return()=>clearInterval(Ne)},[]);const[ae,ye]=k.useState(!1);return k.useEffect(()=>{e&&we.getSettings().then(T=>{T.publicUrl&&W.getState().setPublicUrl(T.publicUrl),W.getState().setMagicUiAvailable(!!T.magicUiEnabled&&!!T.claudeCliAvailable),T.onboardingCompleted||ye(!0)}).catch(()=>{})},[e]),k.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?j.page==="playground"?l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(qB,{})}):l.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>W.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
133
|
+
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
134
|
+
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
135
|
+
${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
136
|
+
overflow-hidden
|
|
137
|
+
`,children:l.jsx(vR,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(bP,{}),l.jsx(jB,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(VB,{embedded:!0})})}),S&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(WB,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(GB,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(YB,{embedded:!0})})}),R&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(XB,{embedded:!0})})}),A&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(QB,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(ZB,{embedded:!0})})}),P&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(KB,{embedded:!0})})}),z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(JB,{embedded:!0})})}),Z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(eF,{route:j})})}),I&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(tF,{})})}),q&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(nF,{})})}),L&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(kB,{sessionId:n}):h?l.jsx(k.Suspense,{fallback:l.jsx(bs,{}),children:l.jsx(sF,{sessionId:n})}):l.jsx(fP,{sessionId:n}):l.jsx(zP,{},o)}),f&&g&&g.length>0&&l.jsx(CB,{steps:g,error:v,unsentPrompt:(b==null?void 0:b.text)??null,backend:p??void 0,onCancel:()=>W.getState().clearCreation()})]})]})]}),n&&L&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>W.getState().setTaskPanelOpen(!0),className:"hidden lg:flex fixed right-0 top-1/2 -translate-y-1/2 z-30 items-center gap-1 rounded-l-lg border border-r-0 border-cc-border bg-cc-card/95 backdrop-blur px-2 py-2 text-[11px] text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Open context panel",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3 2.5A1.5 1.5 0 014.5 1h7A1.5 1.5 0 0113 2.5v11a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 13.5v-11zm2 .5v10h6V3H5z"})}),l.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),a&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>W.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
|
|
138
|
+
fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
|
|
139
|
+
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
140
|
+
${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
141
|
+
overflow-hidden
|
|
142
|
+
`,children:l.jsx(_B,{sessionId:n})})]}),l.jsx(AB,{active:y}),l.jsx(RB,{}),ae&&l.jsx($B,{onComplete:()=>ye(!1)})]}):l.jsx(rR,{})}class aF extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){ga(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}K8();g4.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(aF,{children:l.jsx(rF,{})})}));Zn(()=>import("./sw-register-Dc72vh_Y.js"),[]).catch(()=>{});export{sP as A,ol as B,OB as C,oF as D,wo as E,jP as F,cB as G,qP as H,_h as I,Lo as J,$o as K,wu as L,D9 as M,q2 as N,pC as O,V9 as P,P9 as Q,q9 as R,CB as S,hS as T,jB as U,H9 as V,cF as W,fF as X,hF as Y,Zn as _,we as a,Zg as b,zB as c,Xn as d,lR as e,U9 as f,Z8 as g,fP as h,_P as i,l as j,e9 as k,_9 as l,Oo as m,Jx as n,pF as o,mF as p,d9 as q,k as r,uF as s,QP as t,W as u,h9 as v,pP as w,aB as x,lB as y,Hi as z};
|