@vinihcrosa/lumem-os 0.6.0 → 0.7.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/README.md +16 -5
- package/bin/lumem.mjs +1110 -181
- package/dist/server/main.mjs +6434 -2764
- package/dist/web/assets/{codemirror-setup-JaVFPDhT.js → codemirror-setup-Dz1snhDw.js} +1 -1
- package/dist/web/assets/index-CS8iEPU6.css +32 -0
- package/dist/web/assets/index-e0RfxsGe.js +107 -0
- package/dist/web/index.html +2 -2
- package/drizzle/0033_agente_sempre_acp.sql +65 -0
- package/drizzle/0034_motivo_do_pendente.sql +1 -0
- package/drizzle/0035_conta_de_agente.sql +84 -0
- package/drizzle/0036_conta_do_encaixe.sql +5 -0
- package/drizzle/0037_continuacao_de_conta.sql +5 -0
- package/drizzle/0038_conta_principal.sql +7 -0
- package/drizzle/0039_espera_da_cota.sql +2 -0
- package/drizzle/0040_configuracao_do_daemon.sql +11 -0
- package/drizzle/meta/0033_snapshot.json +2644 -0
- package/drizzle/meta/0034_snapshot.json +2651 -0
- package/drizzle/meta/0035_snapshot.json +2823 -0
- package/drizzle/meta/0036_snapshot.json +2850 -0
- package/drizzle/meta/0037_snapshot.json +2870 -0
- package/drizzle/meta/0038_snapshot.json +2870 -0
- package/drizzle/meta/0039_snapshot.json +2885 -0
- package/drizzle/meta/0040_snapshot.json +2931 -0
- package/drizzle/meta/_journal.json +56 -0
- package/package.json +2 -2
- package/dist/web/assets/index-BvSMeFFu.css +0 -32
- package/dist/web/assets/index-DML0Esam.js +0 -101
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var rS=e=>{throw TypeError(e)};var Im=(e,t,s)=>t.has(e)||rS("Cannot "+s);var T=(e,t,s)=>(Im(e,t,"read from private field"),s?s.call(e):t.get(e)),ge=(e,t,s)=>t.has(e)?rS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),le=(e,t,s,n)=>(Im(e,t,"write to private field"),n?n.call(e,s):t.set(e,s),s),Ne=(e,t,s)=>(Im(e,t,"access private method"),s);var id=(e,t,s,n)=>({set _(o){le(e,t,o,s)},get _(){return T(e,t,n)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const d of l.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&n(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(o){if(o.ep)return;o.ep=!0;const l=s(o);fetch(o.href,l)}})();var Hm={exports:{}},Bl={};/**
|
|
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 aS;function c2(){if(aS)return Bl;aS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(n,o,l){var d=null;if(l!==void 0&&(d=""+l),o.key!==void 0&&(d=""+o.key),"key"in o){l={};for(var h in o)h!=="key"&&(l[h]=o[h])}else l=o;return o=l.ref,{$$typeof:e,type:n,key:d,ref:o!==void 0?o:null,props:l}}return Bl.Fragment=t,Bl.jsx=s,Bl.jsxs=s,Bl}var oS;function u2(){return oS||(oS=1,Hm.exports=c2()),Hm.exports}var a=u2(),pa=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Yr,or,mo,Iw,d2=(Iw=class extends pa{constructor(){super();ge(this,Yr);ge(this,or);ge(this,mo);le(this,mo,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){T(this,or)||this.setEventListener(T(this,mo))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,or))==null||t.call(this),le(this,or,void 0))}setEventListener(t){var s;le(this,mo,t),(s=T(this,or))==null||s.call(this),le(this,or,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){T(this,Yr)!==t&&(le(this,Yr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof T(this,Yr)=="boolean"?T(this,Yr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Yr=new WeakMap,or=new WeakMap,mo=new WeakMap,Iw),tg=new d2,h2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},lr,eg,Hw,f2=(Hw=class{constructor(){ge(this,lr,h2);ge(this,eg,!1)}setTimeoutProvider(e){le(this,lr,e)}setTimeout(e,t){return T(this,lr).setTimeout(e,t)}clearTimeout(e){T(this,lr).clearTimeout(e)}setInterval(e,t){return T(this,lr).setInterval(e,t)}clearInterval(e){T(this,lr).clearInterval(e)}},lr=new WeakMap,eg=new WeakMap,Hw),Kr=new f2;function m2(e){setTimeout(e,0)}var p2=typeof window>"u"||"Deno"in globalThis;function _s(){}function _2(e,t){return typeof e=="function"?e(t):e}function xp(e){return typeof e=="number"&&e>=0&&e!==1/0}function tj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function vr(e,t){return typeof e=="function"?e(t):e}function Qs(e,t){return typeof e=="function"?e(t):e}function lS(e,t){const{type:s="all",exact:n,fetchStatus:o,predicate:l,queryKey:d,stale:h}=e;if(d){if(n){if(t.queryHash!==sg(d,t.options))return!1}else if(!To(t.queryKey,d))return!1}if(s!=="all"){const f=t.isActive();if(s==="active"&&!f||s==="inactive"&&f)return!1}return!(typeof h=="boolean"&&t.isStale()!==h||o&&o!==t.state.fetchStatus||l&&!l(t))}function cS(e,t){const{exact:s,status:n,predicate:o,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(s){if(ra(t.options.mutationKey)!==ra(l))return!1}else if(!To(t.options.mutationKey,l))return!1}return!(n&&t.state.status!==n||o&&!o(t))}function sg(e,t){return((t==null?void 0:t.queryKeyHashFn)||ra)(e)}function ra(e){return JSON.stringify(e,(t,s)=>Sp(s)?Object.keys(s).sort().reduce((n,o)=>(n[o]=s[o],n),{}):s)}function To(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!To(e[n],t[n]))return!1;return!0}const s=Object.keys(t);for(const n of s)if(!To(e[n],t[n]))return!1;return!0}return!1}var g2=Object.prototype.hasOwnProperty;function ig(e,t,s=0){if(e===t)return e;if(s>500)return t;const n=uS(e)&&uS(t);if(!n&&!(Sp(e)&&Sp(t)))return t;const l=(n?e:Object.keys(e)).length,d=n?t:Object.keys(t),h=d.length,f=n?new Array(h):{};let m=0;for(let g=0;g<h;g++){const v=n?g:d[g],y=e[v],x=t[v];if(y===x){f[v]=y,(n?g<l:g2.call(e,v))&&m++;continue}if(y===null||x===null||typeof y!="object"||typeof x!="object"){f[v]=x;continue}const S=ig(y,x,s+1);f[v]=S,S===y&&m++}return l===h&&m===l?e:f}function ic(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function uS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sp(e){if(!dS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!dS(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function dS(e){return Object.prototype.toString.call(e)==="[object Object]"}function v2(e){return new Promise(t=>{Kr.setTimeout(t,e)})}function wp(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?ig(e,t):t}function y2(e,t,s=0){const n=[...e,t];return s&&n.length>s?n.slice(1):n}function b2(e,t,s=0){const n=[t,...e];return s&&n.length>s?n.slice(0,-1):n}var ng=Symbol();function sj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ng?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rg(e,t){return typeof e=="function"?e(...t):!!e}function x2(e,t,s){let n=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),n||(n=!0,o.aborted?s():o.addEventListener("abort",s,{once:!0})),o)}),e}var nc=(()=>{let e=()=>p2;return{isServer(){return e()},setIsServer(t){e=t}}})();function jp(){let e,t;const s=new Promise((o,l)=>{e=o,t=l});s.status="pending",s.catch(()=>{});function n(o){Object.assign(s,o),delete s.resolve,delete s.reject}return s.resolve=o=>{n({status:"fulfilled",value:o}),e(o)},s.reject=o=>{n({status:"rejected",reason:o}),t(o)},s}var S2=m2;function w2(){let e=[],t=0,s=h=>{h()},n=h=>{h()},o=S2;const l=h=>{t?e.push(h):o(()=>{s(h)})},d=()=>{const h=e;e=[],h.length&&o(()=>{n(()=>{h.forEach(f=>{s(f)})})})};return{batch:h=>{let f;t++;try{f=h()}finally{t--,t||d()}return f},batchCalls:h=>(...f)=>{l(()=>{h(...f)})},schedule:l,setNotifyFunction:h=>{s=h},setBatchNotifyFunction:h=>{n=h},setScheduler:h=>{o=h}}}var Ct=w2(),po,cr,_o,Fw,j2=(Fw=class extends pa{constructor(){super();ge(this,po,!0);ge(this,cr);ge(this,_o);le(this,_o,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",n)}}})}onSubscribe(){T(this,cr)||this.setEventListener(T(this,_o))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,cr))==null||t.call(this),le(this,cr,void 0))}setEventListener(t){var s;le(this,_o,t),(s=T(this,cr))==null||s.call(this),le(this,cr,t(this.setOnline.bind(this)))}setOnline(t){T(this,po)!==t&&(le(this,po,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return T(this,po)}},po=new WeakMap,cr=new WeakMap,_o=new WeakMap,Fw),Ld=new j2;function C2(e){return Math.min(1e3*2**e,3e4)}function ij(e){return(e??"online")==="online"?Ld.isOnline():!0}var Cp=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function nj(e){let t=!1,s=0,n;const o=jp(),l=()=>o.status!=="pending",d=w=>{var k;if(!l()){const E=new Cp(w);y(E),(k=e.onCancel)==null||k.call(e,E)}},h=()=>{t=!0},f=()=>{t=!1},m=()=>tg.isFocused()&&(e.networkMode==="always"||Ld.isOnline())&&e.canRun(),g=()=>ij(e.networkMode)&&e.canRun(),v=w=>{l()||(n==null||n(),o.resolve(w))},y=w=>{l()||(n==null||n(),o.reject(w))},x=()=>new Promise(w=>{var k;n=E=>{(l()||m())&&w(E)},(k=e.onPause)==null||k.call(e)}).then(()=>{var w;n=void 0,l()||(w=e.onContinue)==null||w.call(e)}),S=()=>{if(l())return;let w;const k=s===0?e.initialPromise:void 0;try{w=k??e.fn()}catch(E){w=Promise.reject(E)}Promise.resolve(w).then(v).catch(E=>{var V;if(l())return;const D=e.retry??(nc.isServer()?0:3),A=e.retryDelay??C2,N=typeof A=="function"?A(s,E):A,z=D===!0||typeof D=="number"&&s<D||typeof D=="function"&&D(s,E);if(t||!z){y(E);return}s++,(V=e.onFail)==null||V.call(e,s,E),v2(N).then(()=>m()?void 0:x()).then(()=>{t?y(E):S()})})};return{promise:o,status:()=>o.status,cancel:d,continue:()=>(n==null||n(),o),cancelRetry:h,continueRetry:f,canStart:g,start:()=>(g()?S():x().then(S),o)}}var Gr,Uw,rj=(Uw=class{constructor(){ge(this,Gr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xp(this.gcTime)&&le(this,Gr,Kr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nc.isServer()?1/0:300*1e3))}clearGcTimeout(){T(this,Gr)!==void 0&&(Kr.clearTimeout(T(this,Gr)),le(this,Gr,void 0))}},Gr=new WeakMap,Uw);function k2(e){return{onFetch:(t,s)=>{var g,v,y,x,S;const n=t.options,o=(y=(v=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:v.fetchMore)==null?void 0:y.direction,l=((x=t.state.data)==null?void 0:x.pages)||[],d=((S=t.state.data)==null?void 0:S.pageParams)||[];let h={pages:[],pageParams:[]},f=0;const m=async()=>{let w=!1;const k=A=>{x2(A,()=>t.signal,()=>w=!0)},E=sj(t.options,t.fetchOptions),D=async(A,N,z)=>{if(w)return Promise.reject(t.signal.reason);if(N==null&&A.pages.length)return Promise.resolve(A);const ee=(()=>{const H={client:t.client,queryKey:t.queryKey,pageParam:N,direction:z?"backward":"forward",meta:t.options.meta};return k(H),H})(),$=await E(ee),{maxPages:ae}=t.options,me=z?b2:y2;return{pages:me(A.pages,$,ae),pageParams:me(A.pageParams,N,ae)}};if(o&&l.length){const A=o==="backward",N=A?N2:hS,z={pages:l,pageParams:d},V=N(n,z);h=await D(z,V,A)}else{const A=e??l.length;do{const N=f===0?d[0]??n.initialPageParam:hS(n,h);if(f>0&&N==null)break;h=await D(h,N),f++}while(f<A)}return h};t.options.persister?t.fetchFn=()=>{var w,k;return(k=(w=t.options).persister)==null?void 0:k.call(w,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=m}}}function hS(e,{pages:t,pageParams:s}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,s[n],s):void 0}function N2(e,{pages:t,pageParams:s}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,s[0],s):void 0}var go,Qr,vo,di,Zr,Zt,vc,Xr,Gs,aj,fn,$w,E2=($w=class extends rj{constructor(t){super();ge(this,Gs);ge(this,go);ge(this,Qr);ge(this,vo);ge(this,di);ge(this,Zr);ge(this,Zt);ge(this,vc);ge(this,Xr);le(this,Xr,!1),le(this,vc,t.defaultOptions),this.setOptions(t.options),this.observers=[],le(this,Zr,t.client),le(this,di,T(this,Zr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,le(this,Qr,mS(this.options)),this.state=t.state??T(this,Qr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return T(this,go)}get promise(){var t;return(t=T(this,Zt))==null?void 0:t.promise}setOptions(t){if(this.options={...T(this,vc),...t},t!=null&&t._type&&le(this,go,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=mS(this.options);s.data!==void 0&&(this.setState(fS(s.data,s.dataUpdatedAt)),le(this,Qr,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,di).remove(this)}setData(t,s){const n=wp(this.state.data,t,this.options);return Ne(this,Gs,fn).call(this,{data:n,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),n}setState(t){Ne(this,Gs,fn).call(this,{type:"setState",state:t})}cancel(t){var n,o;const s=(n=T(this,Zt))==null?void 0:n.promise;return(o=T(this,Zt))==null||o.cancel(t),s?s.then(_s).catch(_s):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return T(this,Qr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Qs(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ng||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>vr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!tj(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=T(this,Zt))==null||s.continue()}onOnline(){var s;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=T(this,Zt))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(this,di).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(T(this,Zt)&&(T(this,Xr)||Ne(this,Gs,aj).call(this)?T(this,Zt).cancel({revert:!0}):T(this,Zt).cancelRetry()),this.scheduleGc()),T(this,di).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Gs,fn).call(this,{type:"invalidate"})}async fetch(t,s){var m,g,v,y,x,S,w,k,E,D,A;if(this.state.fetchStatus!=="idle"&&((m=T(this,Zt))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(T(this,Zt))return T(this,Zt).continueRetry(),T(this,Zt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const N=this.observers.find(z=>z.options.queryFn);N&&this.setOptions(N.options)}const n=new AbortController,o=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(le(this,Xr,!0),n.signal)})},l=()=>{const N=sj(this.options,s),V=(()=>{const ee={client:T(this,Zr),queryKey:this.queryKey,meta:this.meta};return o(ee),ee})();return le(this,Xr,!1),this.options.persister?this.options.persister(N,V,this):N(V)},h=(()=>{const N={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:T(this,Zr),state:this.state,fetchFn:l};return o(N),N})(),f=T(this,go)==="infinite"?k2(this.options.pages):this.options.behavior;f==null||f.onFetch(h,this),le(this,vo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=h.fetchOptions)==null?void 0:g.meta))&&Ne(this,Gs,fn).call(this,{type:"fetch",meta:(v=h.fetchOptions)==null?void 0:v.meta}),le(this,Zt,nj({initialPromise:s==null?void 0:s.initialPromise,fn:h.fetchFn,onCancel:N=>{N instanceof Cp&&N.revert&&this.setState({...T(this,vo),fetchStatus:"idle"}),n.abort()},onFail:(N,z)=>{Ne(this,Gs,fn).call(this,{type:"failed",failureCount:N,error:z})},onPause:()=>{Ne(this,Gs,fn).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Gs,fn).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const N=await T(this,Zt).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(x=(y=T(this,di).config).onSuccess)==null||x.call(y,N,this),(w=(S=T(this,di).config).onSettled)==null||w.call(S,N,this.state.error,this),N}catch(N){if(N instanceof Cp){if(N.silent)return T(this,Zt).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw Ne(this,Gs,fn).call(this,{type:"error",error:N}),(E=(k=T(this,di).config).onError)==null||E.call(k,N,this),(A=(D=T(this,di).config).onSettled)==null||A.call(D,this.state.data,N,this),N}finally{this.scheduleGc()}}},go=new WeakMap,Qr=new WeakMap,vo=new WeakMap,di=new WeakMap,Zr=new WeakMap,Zt=new WeakMap,vc=new WeakMap,Xr=new WeakMap,Gs=new WeakSet,aj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},fn=function(t){const s=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...oj(n.data,this.options),fetchMeta:t.meta??null};case"success":const o={...n,...fS(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return le(this,vo,t.manual?o:void 0),o;case"error":const l=t.error;return{...n,error:l,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=s(this.state),Ct.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),T(this,di).notify({query:this,type:"updated",action:t})})},$w);function oj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ij(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function fS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function mS(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,n=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Os,Ze,yc,ys,Jr,yo,pn,ur,bc,bo,xo,ea,ta,dr,So,nt,$l,kp,Np,Ep,Tp,Ap,Op,Rp,lj,Kw,ag=(Kw=class extends pa{constructor(t,s){super();ge(this,nt);ge(this,Os);ge(this,Ze);ge(this,yc);ge(this,ys);ge(this,Jr);ge(this,yo);ge(this,pn);ge(this,ur);ge(this,bc);ge(this,bo);ge(this,xo);ge(this,ea);ge(this,ta);ge(this,dr);ge(this,So,new Set);this.options=s,le(this,Os,t),le(this,ur,null),le(this,pn,jp()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,Ze).addObserver(this),pS(T(this,Ze),this.options)?Ne(this,nt,$l).call(this):this.updateResult(),Ne(this,nt,Tp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Dp(T(this,Ze),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Dp(T(this,Ze),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,nt,Ap).call(this),Ne(this,nt,Op).call(this),T(this,Ze).removeObserver(this)}setOptions(t){const s=this.options,n=T(this,Ze);if(this.options=T(this,Os).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Qs(this.options.enabled,T(this,Ze))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,nt,Rp).call(this),T(this,Ze).setOptions(this.options),s._defaulted&&!ic(this.options,s)&&T(this,Os).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,Ze),observer:this});const o=this.hasListeners();o&&_S(T(this,Ze),n,this.options,s)&&Ne(this,nt,$l).call(this),this.updateResult(),o&&(T(this,Ze)!==n||Qs(this.options.enabled,T(this,Ze))!==Qs(s.enabled,T(this,Ze))||vr(this.options.staleTime,T(this,Ze))!==vr(s.staleTime,T(this,Ze)))&&Ne(this,nt,kp).call(this);const l=Ne(this,nt,Np).call(this);o&&(T(this,Ze)!==n||Qs(this.options.enabled,T(this,Ze))!==Qs(s.enabled,T(this,Ze))||l!==T(this,dr))&&Ne(this,nt,Ep).call(this,l)}getOptimisticResult(t){const s=T(this,Os).getQueryCache().build(T(this,Os),t),n=this.createResult(s,t);return A2(this,n)&&(le(this,ys,n),le(this,yo,this.options),le(this,Jr,T(this,Ze).state)),n}getCurrentResult(){return T(this,ys)}trackResult(t,s){return new Proxy(t,{get:(n,o)=>(this.trackProp(o),s==null||s(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&T(this,pn).status==="pending"&&T(this,pn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,o))})}trackProp(t){T(this,So).add(t)}getCurrentQuery(){return T(this,Ze)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=T(this,Os).defaultQueryOptions(t),n=T(this,Os).getQueryCache().build(T(this,Os),s);return n.fetch().then(()=>this.createResult(n,s))}fetch(t){return Ne(this,nt,$l).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,ys)))}createResult(t,s){var ae;const n=T(this,Ze),o=this.options,l=T(this,ys),d=T(this,Jr),h=T(this,yo),m=t!==n?t.state:T(this,yc),{state:g}=t;let v={...g},y=!1,x;if(s._optimisticResults){const me=this.hasListeners(),H=!me&&pS(t,s),B=me&&_S(t,n,s,o);(H||B)&&(v={...v,...oj(g.data,t.options)}),s._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:S,errorUpdatedAt:w,status:k}=v;x=v.data;let E=!1;if(s.placeholderData!==void 0&&x===void 0&&k==="pending"){let me;l!=null&&l.isPlaceholderData&&s.placeholderData===(h==null?void 0:h.placeholderData)?(me=l.data,E=!0):me=typeof s.placeholderData=="function"?s.placeholderData((ae=T(this,xo))==null?void 0:ae.state.data,T(this,xo)):s.placeholderData,me!==void 0&&(k="success",x=wp(l==null?void 0:l.data,me,s),y=!0)}if(s.select&&x!==void 0&&!E)if(l&&x===(d==null?void 0:d.data)&&s.select===T(this,bc))x=T(this,bo);else try{le(this,bc,s.select),x=s.select(x),x=wp(l==null?void 0:l.data,x,s),le(this,bo,x),le(this,ur,null)}catch(me){le(this,ur,me)}T(this,ur)&&(S=T(this,ur),x=T(this,bo),w=Date.now(),k="error");const D=v.fetchStatus==="fetching",A=k==="pending",N=k==="error",z=A&&D,V=x!==void 0,$={status:k,fetchStatus:v.fetchStatus,isPending:A,isSuccess:k==="success",isError:N,isInitialLoading:z,isLoading:z,data:x,dataUpdatedAt:v.dataUpdatedAt,error:S,errorUpdatedAt:w,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:D,isRefetching:D&&!A,isLoadingError:N&&!V,isPaused:v.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:N&&V,isStale:og(t,s),refetch:this.refetch,promise:T(this,pn),isEnabled:Qs(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const me=$.data!==void 0,H=$.status==="error"&&!me,B=re=>{H?re.reject($.error):me&&re.resolve($.data)},O=()=>{const re=le(this,pn,$.promise=jp());B(re)},se=T(this,pn);switch(se.status){case"pending":t.queryHash===n.queryHash&&B(se);break;case"fulfilled":(H||$.data!==se.value)&&O();break;case"rejected":(!H||$.error!==se.reason)&&O();break}}return $}updateResult(){const t=T(this,ys),s=this.createResult(T(this,Ze),this.options);if(le(this,Jr,T(this,Ze).state),le(this,yo,this.options),T(this,Jr).data!==void 0&&le(this,xo,T(this,Ze)),ic(s,t))return;le(this,ys,s);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,l=typeof o=="function"?o():o;if(l==="all"||!l&&!T(this,So).size)return!0;const d=new Set(l??T(this,So));return this.options.throwOnError&&d.add("error"),Object.keys(T(this,ys)).some(h=>{const f=h;return T(this,ys)[f]!==t[f]&&d.has(f)})};Ne(this,nt,lj).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,nt,Tp).call(this)}},Os=new WeakMap,Ze=new WeakMap,yc=new WeakMap,ys=new WeakMap,Jr=new WeakMap,yo=new WeakMap,pn=new WeakMap,ur=new WeakMap,bc=new WeakMap,bo=new WeakMap,xo=new WeakMap,ea=new WeakMap,ta=new WeakMap,dr=new WeakMap,So=new WeakMap,nt=new WeakSet,$l=function(t){Ne(this,nt,Rp).call(this);let s=T(this,Ze).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(_s)),s},kp=function(){Ne(this,nt,Ap).call(this);const t=vr(this.options.staleTime,T(this,Ze));if(nc.isServer()||T(this,ys).isStale||!xp(t))return;const n=tj(T(this,ys).dataUpdatedAt,t)+1;le(this,ea,Kr.setTimeout(()=>{T(this,ys).isStale||this.updateResult()},n))},Np=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,Ze)):this.options.refetchInterval)??!1},Ep=function(t){Ne(this,nt,Op).call(this),le(this,dr,t),!(nc.isServer()||Qs(this.options.enabled,T(this,Ze))===!1||!xp(T(this,dr))||T(this,dr)===0)&&le(this,ta,Kr.setInterval(()=>{(this.options.refetchIntervalInBackground||tg.isFocused())&&Ne(this,nt,$l).call(this)},T(this,dr)))},Tp=function(){Ne(this,nt,kp).call(this),Ne(this,nt,Ep).call(this,Ne(this,nt,Np).call(this))},Ap=function(){T(this,ea)!==void 0&&(Kr.clearTimeout(T(this,ea)),le(this,ea,void 0))},Op=function(){T(this,ta)!==void 0&&(Kr.clearInterval(T(this,ta)),le(this,ta,void 0))},Rp=function(){const t=T(this,Os).getQueryCache().build(T(this,Os),this.options);if(t===T(this,Ze))return;const s=T(this,Ze);le(this,Ze,t),le(this,yc,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},lj=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(T(this,ys))}),T(this,Os).getQueryCache().notify({query:T(this,Ze),type:"observerResultsUpdated"})})},Kw);function T2(e,t){return Qs(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Qs(t.retryOnMount,e)===!1)}function pS(e,t){return T2(e,t)||e.state.data!==void 0&&Dp(e,t,t.refetchOnMount)}function Dp(e,t,s){if(Qs(t.enabled,e)!==!1&&vr(t.staleTime,e)!=="static"){const n=typeof s=="function"?s(e):s;return n==="always"||n!==!1&&og(e,t)}return!1}function _S(e,t,s,n){return(e!==t||Qs(n.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&og(e,s)}function og(e,t){return Qs(t.enabled,e)!==!1&&e.isStaleByTime(vr(t.staleTime,e))}function A2(e,t){return!ic(e.getCurrentResult(),t)}var xc,Mi,ps,sa,Li,sr,Ww,O2=(Ww=class extends rj{constructor(t){super();ge(this,Li);ge(this,xc);ge(this,Mi);ge(this,ps);ge(this,sa);le(this,xc,t.client),this.mutationId=t.mutationId,le(this,ps,t.mutationCache),le(this,Mi,[]),this.state=t.state||cj(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,Mi).includes(t)||(T(this,Mi).push(t),this.clearGcTimeout(),T(this,ps).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){le(this,Mi,T(this,Mi).filter(s=>s!==t)),this.scheduleGc(),T(this,ps).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,Mi).length||(this.state.status==="pending"?this.scheduleGc():T(this,ps).remove(this))}continue(){var t;return((t=T(this,sa))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var d,h,f,m,g,v,y,x,S,w,k,E,D,A,N,z,V,ee;const s=()=>{Ne(this,Li,sr).call(this,{type:"continue"})},n={client:T(this,xc),meta:this.options.meta,mutationKey:this.options.mutationKey};le(this,sa,nj({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:($,ae)=>{Ne(this,Li,sr).call(this,{type:"failed",failureCount:$,error:ae})},onPause:()=>{Ne(this,Li,sr).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>T(this,ps).canRun(this)}));const o=this.state.status==="pending",l=!T(this,sa).canStart();try{if(o)s();else{Ne(this,Li,sr).call(this,{type:"pending",variables:t,isPaused:l}),T(this,ps).config.onMutate&&await T(this,ps).config.onMutate(t,this,n);const ae=await((h=(d=this.options).onMutate)==null?void 0:h.call(d,t,n));ae!==this.state.context&&Ne(this,Li,sr).call(this,{type:"pending",context:ae,variables:t,isPaused:l})}const $=await T(this,sa).start();return await((m=(f=T(this,ps).config).onSuccess)==null?void 0:m.call(f,$,t,this.state.context,this,n)),await((v=(g=this.options).onSuccess)==null?void 0:v.call(g,$,t,this.state.context,n)),await((x=(y=T(this,ps).config).onSettled)==null?void 0:x.call(y,$,null,this.state.variables,this.state.context,this,n)),await((w=(S=this.options).onSettled)==null?void 0:w.call(S,$,null,t,this.state.context,n)),Ne(this,Li,sr).call(this,{type:"success",data:$}),$}catch($){try{await((E=(k=T(this,ps).config).onError)==null?void 0:E.call(k,$,t,this.state.context,this,n))}catch(ae){Promise.reject(ae)}try{await((A=(D=this.options).onError)==null?void 0:A.call(D,$,t,this.state.context,n))}catch(ae){Promise.reject(ae)}try{await((z=(N=T(this,ps).config).onSettled)==null?void 0:z.call(N,void 0,$,this.state.variables,this.state.context,this,n))}catch(ae){Promise.reject(ae)}try{await((ee=(V=this.options).onSettled)==null?void 0:ee.call(V,void 0,$,t,this.state.context,n))}catch(ae){Promise.reject(ae)}throw Ne(this,Li,sr).call(this,{type:"error",error:$}),$}finally{T(this,ps).runNext(this)}}},xc=new WeakMap,Mi=new WeakMap,ps=new WeakMap,sa=new WeakMap,Li=new WeakSet,sr=function(t){const s=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),Ct.batch(()=>{T(this,Mi).forEach(n=>{n.onMutationUpdate(t)}),T(this,ps).notify({mutation:this,type:"updated",action:t})})},Ww);function cj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _n,wi,Sc,Vw,uj=(Vw=class extends pa{constructor(t={}){super();ge(this,_n);ge(this,wi);ge(this,Sc);this.config=t,le(this,_n,new Set),le(this,wi,new Map),le(this,Sc,0)}build(t,s,n){const o=new O2({client:t,mutationCache:this,mutationId:++id(this,Sc)._,options:t.defaultMutationOptions(s),state:n});return this.add(o),o}add(t){T(this,_n).add(t);const s=nd(t);if(typeof s=="string"){const n=T(this,wi).get(s);n?n.push(t):T(this,wi).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,_n).delete(t)){const s=nd(t);if(typeof s=="string"){const n=T(this,wi).get(s);if(n)if(n.length>1){const o=n.indexOf(t);o!==-1&&n.splice(o,1)}else n[0]===t&&T(this,wi).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=nd(t);if(typeof s=="string"){const n=T(this,wi).get(s),o=n==null?void 0:n.find(l=>l.state.status==="pending");return!o||o===t}else return!0}runNext(t){var n;const s=nd(t);if(typeof s=="string"){const o=(n=T(this,wi).get(s))==null?void 0:n.find(l=>l!==t&&l.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ct.batch(()=>{T(this,_n).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,_n).clear(),T(this,wi).clear()})}getAll(){return Array.from(T(this,_n))}find(t){const s={exact:!0,...t};return this.getAll().find(n=>cS(s,n))}findAll(t={}){return this.getAll().filter(s=>cS(t,s))}notify(t){Ct.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return Ct.batch(()=>Promise.all(t.map(s=>s.continue().catch(_s))))}},_n=new WeakMap,wi=new WeakMap,Sc=new WeakMap,Vw);function nd(e){var t;return(t=e.options.scope)==null?void 0:t.id}var gn,hr,Rs,vn,jn,kd,Mp,Yw,R2=(Yw=class extends pa{constructor(s,n){super();ge(this,jn);ge(this,gn);ge(this,hr);ge(this,Rs);ge(this,vn);le(this,gn,s),this.setOptions(n),this.bindMethods(),Ne(this,jn,kd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){var o;const n=this.options;this.options=T(this,gn).defaultMutationOptions(s),ic(this.options,n)||T(this,gn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:T(this,Rs),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ra(n.mutationKey)!==ra(this.options.mutationKey)?this.reset():((o=T(this,Rs))==null?void 0:o.state.status)==="pending"&&T(this,Rs).setOptions(this.options)}onUnsubscribe(){var s;this.hasListeners()||(s=T(this,Rs))==null||s.removeObserver(this)}onMutationUpdate(s){Ne(this,jn,kd).call(this),Ne(this,jn,Mp).call(this,s)}getCurrentResult(){return T(this,hr)}reset(){var s;(s=T(this,Rs))==null||s.removeObserver(this),le(this,Rs,void 0),Ne(this,jn,kd).call(this),Ne(this,jn,Mp).call(this)}mutate(s,n){var o;return le(this,vn,n),(o=T(this,Rs))==null||o.removeObserver(this),le(this,Rs,T(this,gn).getMutationCache().build(T(this,gn),this.options)),T(this,Rs).addObserver(this),T(this,Rs).execute(s)}},gn=new WeakMap,hr=new WeakMap,Rs=new WeakMap,vn=new WeakMap,jn=new WeakSet,kd=function(){var n;const s=((n=T(this,Rs))==null?void 0:n.state)??cj();le(this,hr,{...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset})},Mp=function(s){Ct.batch(()=>{var n,o,l,d,h,f,m,g;if(T(this,vn)&&this.hasListeners()){const v=T(this,hr).variables,y=T(this,hr).context,x={client:T(this,gn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((s==null?void 0:s.type)==="success"){try{(o=(n=T(this,vn)).onSuccess)==null||o.call(n,s.data,v,y,x)}catch(S){Promise.reject(S)}try{(d=(l=T(this,vn)).onSettled)==null||d.call(l,s.data,null,v,y,x)}catch(S){Promise.reject(S)}}else if((s==null?void 0:s.type)==="error"){try{(f=(h=T(this,vn)).onError)==null||f.call(h,s.error,v,y,x)}catch(S){Promise.reject(S)}try{(g=(m=T(this,vn)).onSettled)==null||g.call(m,void 0,s.error,v,y,x)}catch(S){Promise.reject(S)}}}this.listeners.forEach(v=>{v(T(this,hr))})})},Yw);function gS(e,t){const s=new Set(t);return e.filter(n=>!s.has(n))}function D2(e,t,s){const n=e.slice(0);return n[t]=s,n}var wo,Ds,jo,ia,Ys,fr,wc,jc,Cc,kc,Yt,Lp,Bp,dj,zp,qp,Pp,Gw,M2=(Gw=class extends pa{constructor(t,s,n){super();ge(this,Yt);ge(this,wo);ge(this,Ds);ge(this,jo);ge(this,ia);ge(this,Ys);ge(this,fr);ge(this,wc);ge(this,jc);ge(this,Cc);ge(this,kc,[]);le(this,wo,t),le(this,ia,n),le(this,jo,[]),le(this,Ys,[]),le(this,Ds,[]),this.setQueries(s)}onSubscribe(){this.listeners.size===1&&T(this,Ys).forEach(t=>{t.subscribe(s=>{Ne(this,Yt,qp).call(this,t,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,T(this,Ys).forEach(t=>{t.destroy()})}setQueries(t,s){le(this,jo,t),le(this,ia,s),Ct.batch(()=>{const n=T(this,Ys),o=Ne(this,Yt,zp).call(this,T(this,jo));o.forEach(v=>v.observer.setOptions(v.defaultedQueryOptions));const l=o.map(v=>v.observer),d=l.map(v=>v.getCurrentResult()),h=n.length!==l.length,f=l.some((v,y)=>v!==n[y]),m=h||f,g=m?!0:d.some((v,y)=>{const x=T(this,Ds)[y];return!x||!ic(v,x)});!m&&!g||(m&&(le(this,kc,o),le(this,Ys,l)),le(this,Ds,d),this.hasListeners()&&(m&&(gS(n,l).forEach(v=>{v.destroy()}),gS(l,n).forEach(v=>{v.subscribe(y=>{Ne(this,Yt,qp).call(this,v,y)})})),Ne(this,Yt,Pp).call(this)))})}getCurrentResult(){return T(this,Ds)}getQueries(){return T(this,Ys).map(t=>t.getCurrentQuery())}getObservers(){return T(this,Ys)}getOptimisticResult(t,s){const n=Ne(this,Yt,zp).call(this,t),o=n.map(d=>d.observer.getOptimisticResult(d.defaultedQueryOptions)),l=n.map(d=>d.defaultedQueryOptions.queryHash);return[o,d=>Ne(this,Yt,Bp).call(this,d??o,s,l),()=>Ne(this,Yt,Lp).call(this,o,n)]}},wo=new WeakMap,Ds=new WeakMap,jo=new WeakMap,ia=new WeakMap,Ys=new WeakMap,fr=new WeakMap,wc=new WeakMap,jc=new WeakMap,Cc=new WeakMap,kc=new WeakMap,Yt=new WeakSet,Lp=function(t,s){return s.map((n,o)=>{const l=t[o];return n.defaultedQueryOptions.notifyOnChangeProps?l:n.observer.trackResult(l,d=>{s.forEach(h=>{h.observer.trackProp(d)})})})},Bp=function(t,s,n){if(s){const o=T(this,Cc),l=n!==void 0&&o!==void 0&&(o.length!==n.length||n.some((d,h)=>d!==o[h]));return(!T(this,fr)||T(this,Ds)!==T(this,jc)||l||s!==T(this,wc))&&(le(this,wc,s),le(this,jc,T(this,Ds)),n!==void 0&&le(this,Cc,n),le(this,fr,ig(T(this,fr),s(t)))),T(this,fr)}return t},dj=function(){var t;return((t=T(this,ia))==null?void 0:t.combine)!==void 0&&T(this,Ys).some((s,n)=>{var o;return s.options.suspense&&((o=T(this,Ds)[n])==null?void 0:o.data)===void 0})},zp=function(t){const s=new Map;T(this,Ys).forEach(o=>{const l=o.options.queryHash;if(!l)return;const d=s.get(l);d?d.push(o):s.set(l,[o])});const n=[];return t.forEach(o=>{var f;const l=T(this,wo).defaultQueryOptions(o),h=((f=s.get(l.queryHash))==null?void 0:f.shift())??new ag(T(this,wo),l);n.push({defaultedQueryOptions:l,observer:h})}),n},qp=function(t,s){const n=T(this,Ys).indexOf(t);n!==-1&&(le(this,Ds,D2(T(this,Ds),n,s)),Ne(this,Yt,Pp).call(this))},Pp=function(){var t;if(this.hasListeners()){const s=Ne(this,Yt,Lp).call(this,T(this,Ds),T(this,kc)),n=Ne(this,Yt,dj).call(this),o=T(this,fr),l=n?o:Ne(this,Yt,Bp).call(this,s,(t=T(this,ia))==null?void 0:t.combine);(n||o!==l)&&Ct.batch(()=>{this.listeners.forEach(d=>{d(T(this,Ds))})})}},Gw),Bi,Qw,hj=(Qw=class extends pa{constructor(t={}){super();ge(this,Bi);this.config=t,le(this,Bi,new Map)}build(t,s,n){const o=s.queryKey,l=s.queryHash??sg(o,s);let d=this.get(l);return d||(d=new E2({client:t,queryKey:o,queryHash:l,options:t.defaultQueryOptions(s),state:n,defaultOptions:t.getQueryDefaults(o)}),this.add(d)),d}add(t){T(this,Bi).has(t.queryHash)||(T(this,Bi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=T(this,Bi).get(t.queryHash);s&&(t.destroy(),s===t&&T(this,Bi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,Bi).get(t)}getAll(){return[...T(this,Bi).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(n=>lS(s,n))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(n=>lS(t,n)):s}notify(t){Ct.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Bi=new WeakMap,Qw),St,mr,pr,Co,ko,_r,No,Eo,Zw,L2=(Zw=class{constructor(e={}){ge(this,St);ge(this,mr);ge(this,pr);ge(this,Co);ge(this,ko);ge(this,_r);ge(this,No);ge(this,Eo);le(this,St,e.queryCache||new hj),le(this,mr,e.mutationCache||new uj),le(this,pr,e.defaultOptions||{}),le(this,Co,new Map),le(this,ko,new Map),le(this,_r,0)}mount(){id(this,_r)._++,T(this,_r)===1&&(le(this,No,tg.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,St).onFocus())})),le(this,Eo,Ld.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,St).onOnline())})))}unmount(){var e,t;id(this,_r)._--,T(this,_r)===0&&((e=T(this,No))==null||e.call(this),le(this,No,void 0),(t=T(this,Eo))==null||t.call(this),le(this,Eo,void 0))}isFetching(e){return T(this,St).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,mr).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=T(this,St).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=T(this,St).build(this,t),n=s.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(vr(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return T(this,St).findAll(e).map(({queryKey:t,state:s})=>{const n=s.data;return[t,n]})}setQueryData(e,t,s){const n=this.defaultQueryOptions({queryKey:e}),o=T(this,St).get(n.queryHash),l=o==null?void 0:o.state.data,d=_2(t,l);if(d!==void 0)return T(this,St).build(this,n).setData(d,{...s,manual:!0})}setQueriesData(e,t,s){return Ct.batch(()=>T(this,St).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=T(this,St).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=T(this,St);Ct.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=T(this,St);return Ct.batch(()=>(s.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},n=Ct.batch(()=>T(this,St).findAll(e).map(o=>o.cancel(s)));return Promise.all(n).then(_s).catch(_s)}invalidateQueries(e,t={}){return Ct.batch(()=>(T(this,St).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},n=Ct.batch(()=>T(this,St).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,s);return s.throwOnError||(l=l.catch(_s)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(n).then(_s)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=T(this,St).build(this,t);return s.isStaleByTime(vr(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_s).catch(_s)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_s).catch(_s)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ld.isOnline()?T(this,mr).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,St)}getMutationCache(){return T(this,mr)}getDefaultOptions(){return T(this,pr)}setDefaultOptions(e){le(this,pr,e)}setQueryDefaults(e,t){T(this,Co).set(ra(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,Co).values()],s={};return t.forEach(n=>{To(e,n.queryKey)&&Object.assign(s,n.defaultOptions)}),s}setMutationDefaults(e,t){T(this,ko).set(ra(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,ko).values()],s={};return t.forEach(n=>{To(e,n.mutationKey)&&Object.assign(s,n.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...T(this,pr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=sg(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ng&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...T(this,pr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,St).clear(),T(this,mr).clear()}},St=new WeakMap,mr=new WeakMap,pr=new WeakMap,Co=new WeakMap,ko=new WeakMap,_r=new WeakMap,No=new WeakMap,Eo=new WeakMap,Zw),Fm={exports:{}},Me={};/**
|
|
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 vS;function B2(){if(vS)return Me;vS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function x(L){return L===null||typeof L!="object"?null:(L=y&&L[y]||L["@@iterator"],typeof L=="function"?L:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function E(L,X,ce){this.props=L,this.context=X,this.refs=k,this.updater=ce||S}E.prototype.isReactComponent={},E.prototype.setState=function(L,X){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,X,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function D(){}D.prototype=E.prototype;function A(L,X,ce){this.props=L,this.context=X,this.refs=k,this.updater=ce||S}var N=A.prototype=new D;N.constructor=A,w(N,E.prototype),N.isPureReactComponent=!0;var z=Array.isArray;function V(){}var ee={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function ae(L,X,ce){var Y=ce.ref;return{$$typeof:e,type:L,key:X,ref:Y!==void 0?Y:null,props:ce}}function me(L,X){return ae(L.type,X,L.props)}function H(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function B(L){var X={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(ce){return X[ce]})}var O=/\/+/g;function se(L,X){return typeof L=="object"&&L!==null&&L.key!=null?B(""+L.key):X.toString(36)}function re(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(V,V):(L.status="pending",L.then(function(X){L.status==="pending"&&(L.status="fulfilled",L.value=X)},function(X){L.status==="pending"&&(L.status="rejected",L.reason=X)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function q(L,X,ce,Y,de){var xe=typeof L;(xe==="undefined"||xe==="boolean")&&(L=null);var ze=!1;if(L===null)ze=!0;else switch(xe){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(L.$$typeof){case e:case t:ze=!0;break;case g:return ze=L._init,q(ze(L._payload),X,ce,Y,de)}}if(ze)return de=de(L),ze=Y===""?"."+se(L,0):Y,z(de)?(ce="",ze!=null&&(ce=ze.replace(O,"$&/")+"/"),q(de,X,ce,"",function(Ls){return Ls})):de!=null&&(H(de)&&(de=me(de,ce+(de.key==null||L&&L.key===de.key?"":(""+de.key).replace(O,"$&/")+"/")+ze)),X.push(de)),1;ze=0;var Et=Y===""?".":Y+":";if(z(L))for(var Xe=0;Xe<L.length;Xe++)Y=L[Xe],xe=Et+se(Y,Xe),ze+=q(Y,X,ce,xe,de);else if(Xe=x(L),typeof Xe=="function")for(L=Xe.call(L),Xe=0;!(Y=L.next()).done;)Y=Y.value,xe=Et+se(Y,Xe++),ze+=q(Y,X,ce,xe,de);else if(xe==="object"){if(typeof L.then=="function")return q(re(L),X,ce,Y,de);throw X=String(L),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ze}function M(L,X,ce){if(L==null)return L;var Y=[],de=0;return q(L,Y,"","",function(xe){return X.call(ce,xe,de++)}),Y}function K(L){if(L._status===-1){var X=L._result;X=X(),X.then(function(ce){(L._status===0||L._status===-1)&&(L._status=1,L._result=ce)},function(ce){(L._status===0||L._status===-1)&&(L._status=2,L._result=ce)}),L._status===-1&&(L._status=0,L._result=X)}if(L._status===1)return L._result.default;throw L._result}var fe=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},Ae={map:M,forEach:function(L,X,ce){M(L,function(){X.apply(this,arguments)},ce)},count:function(L){var X=0;return M(L,function(){X++}),X},toArray:function(L){return M(L,function(X){return X})||[]},only:function(L){if(!H(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Me.Activity=v,Me.Children=Ae,Me.Component=E,Me.Fragment=s,Me.Profiler=o,Me.PureComponent=A,Me.StrictMode=n,Me.Suspense=f,Me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ee,Me.__COMPILER_RUNTIME={__proto__:null,c:function(L){return ee.H.useMemoCache(L)}},Me.cache=function(L){return function(){return L.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.cloneElement=function(L,X,ce){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var Y=w({},L.props),de=L.key;if(X!=null)for(xe in X.key!==void 0&&(de=""+X.key),X)!$.call(X,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&X.ref===void 0||(Y[xe]=X[xe]);var xe=arguments.length-2;if(xe===1)Y.children=ce;else if(1<xe){for(var ze=Array(xe),Et=0;Et<xe;Et++)ze[Et]=arguments[Et+2];Y.children=ze}return ae(L.type,de,Y)},Me.createContext=function(L){return L={$$typeof:d,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:l,_context:L},L},Me.createElement=function(L,X,ce){var Y,de={},xe=null;if(X!=null)for(Y in X.key!==void 0&&(xe=""+X.key),X)$.call(X,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(de[Y]=X[Y]);var ze=arguments.length-2;if(ze===1)de.children=ce;else if(1<ze){for(var Et=Array(ze),Xe=0;Xe<ze;Xe++)Et[Xe]=arguments[Xe+2];de.children=Et}if(L&&L.defaultProps)for(Y in ze=L.defaultProps,ze)de[Y]===void 0&&(de[Y]=ze[Y]);return ae(L,xe,de)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(L){return{$$typeof:h,render:L}},Me.isValidElement=H,Me.lazy=function(L){return{$$typeof:g,_payload:{_status:-1,_result:L},_init:K}},Me.memo=function(L,X){return{$$typeof:m,type:L,compare:X===void 0?null:X}},Me.startTransition=function(L){var X=ee.T,ce={};ee.T=ce;try{var Y=L(),de=ee.S;de!==null&&de(ce,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(V,fe)}catch(xe){fe(xe)}finally{X!==null&&ce.types!==null&&(X.types=ce.types),ee.T=X}},Me.unstable_useCacheRefresh=function(){return ee.H.useCacheRefresh()},Me.use=function(L){return ee.H.use(L)},Me.useActionState=function(L,X,ce){return ee.H.useActionState(L,X,ce)},Me.useCallback=function(L,X){return ee.H.useCallback(L,X)},Me.useContext=function(L){return ee.H.useContext(L)},Me.useDebugValue=function(){},Me.useDeferredValue=function(L,X){return ee.H.useDeferredValue(L,X)},Me.useEffect=function(L,X){return ee.H.useEffect(L,X)},Me.useEffectEvent=function(L){return ee.H.useEffectEvent(L)},Me.useId=function(){return ee.H.useId()},Me.useImperativeHandle=function(L,X,ce){return ee.H.useImperativeHandle(L,X,ce)},Me.useInsertionEffect=function(L,X){return ee.H.useInsertionEffect(L,X)},Me.useLayoutEffect=function(L,X){return ee.H.useLayoutEffect(L,X)},Me.useMemo=function(L,X){return ee.H.useMemo(L,X)},Me.useOptimistic=function(L,X){return ee.H.useOptimistic(L,X)},Me.useReducer=function(L,X,ce){return ee.H.useReducer(L,X,ce)},Me.useRef=function(L){return ee.H.useRef(L)},Me.useState=function(L){return ee.H.useState(L)},Me.useSyncExternalStore=function(L,X,ce){return ee.H.useSyncExternalStore(L,X,ce)},Me.useTransition=function(){return ee.H.useTransition()},Me.version="19.2.8",Me}var yS;function lg(){return yS||(yS=1,Fm.exports=B2()),Fm.exports}var j=lg(),fj=j.createContext(void 0),$e=e=>{const t=j.useContext(fj);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},z2=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(fj.Provider,{value:e,children:t})),mj=j.createContext(!1),pj=()=>j.useContext(mj);mj.Provider;function q2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var P2=j.createContext(q2()),_j=()=>j.useContext(P2),gj=(e,t,s)=>{const n=s!=null&&s.state.error&&typeof e.throwOnError=="function"?rg(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},vj=e=>{j.useEffect(()=>{e.clearReset()},[e])},yj=({result:e,errorResetBoundary:t,throwOnError:s,query:n,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(o&&e.data===void 0||rg(s,[e.error,n])),bj=e=>{if(e.suspense){const s=o=>o==="static"?o:Math.max(o??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...o)=>s(n(...o)):s(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},I2=(e,t)=>e.isLoading&&e.isFetching&&!t,Ip=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Hp=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function xj({queries:e,...t},s){const n=$e(),o=pj(),l=_j(),d=j.useMemo(()=>e.map(w=>{const k=n.defaultQueryOptions(w);return k._optimisticResults=o?"isRestoring":"optimistic",k}),[e,n,o]);d.forEach(w=>{bj(w);const k=n.getQueryCache().get(w.queryHash);gj(w,l,k)}),vj(l);const[h]=j.useState(()=>new M2(n,d,t)),[f,m,g]=h.getOptimisticResult(d,t.combine),v=!o&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(w=>v?h.subscribe(Ct.batchCalls(w)):_s,[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),j.useEffect(()=>{h.setQueries(d,t)},[d,t,h]);const x=f.some((w,k)=>Ip(d[k],w))?f.flatMap((w,k)=>{const E=d[k];if(E&&Ip(E,w)){const D=new ag(n,E);return Hp(E,D,l)}return[]}):[];if(x.length>0)throw Promise.all(x);const S=f.find((w,k)=>{const E=d[k];return E&&yj({result:w,errorResetBoundary:l,throwOnError:E.throwOnError,query:n.getQueryCache().get(E.queryHash),suspense:E.suspense})});if(S!=null&&S.error)throw S.error;return m(g())}function H2(e,t,s){var x,S,w,k;const n=pj(),o=_j(),l=$e(),d=l.defaultQueryOptions(e);(S=(x=l.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||S.call(x,d);const h=l.getQueryCache().get(d.queryHash),f=e.subscribed!==!1;d._optimisticResults=n?"isRestoring":f?"optimistic":void 0,bj(d),gj(d,o,h),vj(o);const m=!l.getQueryCache().get(d.queryHash),[g]=j.useState(()=>new t(l,d)),v=g.getOptimisticResult(d),y=!n&&f;if(j.useSyncExternalStore(j.useCallback(E=>{const D=y?g.subscribe(Ct.batchCalls(E)):_s;return g.updateResult(),D},[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),j.useEffect(()=>{g.setOptions(d)},[d,g]),Ip(d,v))throw Hp(d,g,o);if(yj({result:v,errorResetBoundary:o,throwOnError:d.throwOnError,query:h,suspense:d.suspense}))throw v.error;if((k=(w=l.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||k.call(w,d,v),d.experimental_prefetchInRender&&!nc.isServer()&&I2(v,n)){const E=m?Hp(d,g,o):h==null?void 0:h.promise;E==null||E.catch(_s).finally(()=>{g.updateResult()})}return d.notifyOnChangeProps?v:g.trackResult(v)}function be(e,t){return H2(e,ag)}function Se(e,t){const s=$e(),[n]=j.useState(()=>new R2(s,e));j.useEffect(()=>{n.setOptions(e)},[n,e]);const o=j.useSyncExternalStore(j.useCallback(d=>n.subscribe(Ct.batchCalls(d)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),l=j.useCallback((d,h)=>{n.mutate(d,h).catch(_s)},[n]);if(o.error&&rg(n.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:l,mutateAsync:o.mutate}}var Um={exports:{}},zl={},$m={exports:{}},Km={};/**
|
|
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 bS;function F2(){return bS||(bS=1,(function(e){function t(q,M){var K=q.length;q.push(M);e:for(;0<K;){var fe=K-1>>>1,Ae=q[fe];if(0<o(Ae,M))q[fe]=M,q[K]=Ae,K=fe;else break e}}function s(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var M=q[0],K=q.pop();if(K!==M){q[0]=K;e:for(var fe=0,Ae=q.length,L=Ae>>>1;fe<L;){var X=2*(fe+1)-1,ce=q[X],Y=X+1,de=q[Y];if(0>o(ce,K))Y<Ae&&0>o(de,ce)?(q[fe]=de,q[Y]=K,fe=Y):(q[fe]=ce,q[X]=K,fe=X);else if(Y<Ae&&0>o(de,K))q[fe]=de,q[Y]=K,fe=Y;else break e}}return M}function o(q,M){var K=q.sortIndex-M.sortIndex;return K!==0?K:q.id-M.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var f=[],m=[],g=1,v=null,y=3,x=!1,S=!1,w=!1,k=!1,E=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function N(q){for(var M=s(m);M!==null;){if(M.callback===null)n(m);else if(M.startTime<=q)n(m),M.sortIndex=M.expirationTime,t(f,M);else break;M=s(m)}}function z(q){if(w=!1,N(q),!S)if(s(f)!==null)S=!0,V||(V=!0,B());else{var M=s(m);M!==null&&re(z,M.startTime-q)}}var V=!1,ee=-1,$=5,ae=-1;function me(){return k?!0:!(e.unstable_now()-ae<$)}function H(){if(k=!1,V){var q=e.unstable_now();ae=q;var M=!0;try{e:{S=!1,w&&(w=!1,D(ee),ee=-1),x=!0;var K=y;try{t:{for(N(q),v=s(f);v!==null&&!(v.expirationTime>q&&me());){var fe=v.callback;if(typeof fe=="function"){v.callback=null,y=v.priorityLevel;var Ae=fe(v.expirationTime<=q);if(q=e.unstable_now(),typeof Ae=="function"){v.callback=Ae,N(q),M=!0;break t}v===s(f)&&n(f),N(q)}else n(f);v=s(f)}if(v!==null)M=!0;else{var L=s(m);L!==null&&re(z,L.startTime-q),M=!1}}break e}finally{v=null,y=K,x=!1}M=void 0}}finally{M?B():V=!1}}}var B;if(typeof A=="function")B=function(){A(H)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,se=O.port2;O.port1.onmessage=H,B=function(){se.postMessage(null)}}else B=function(){E(H,0)};function re(q,M){ee=E(function(){q(e.unstable_now())},M)}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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(q){switch(y){case 1:case 2:case 3:var M=3;break;default:M=y}var K=y;y=M;try{return q()}finally{y=K}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(q,M){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=y;y=q;try{return M()}finally{y=K}},e.unstable_scheduleCallback=function(q,M,K){var fe=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?fe+K:fe):K=fe,q){case 1:var Ae=-1;break;case 2:Ae=250;break;case 5:Ae=1073741823;break;case 4:Ae=1e4;break;default:Ae=5e3}return Ae=K+Ae,q={id:g++,callback:M,priorityLevel:q,startTime:K,expirationTime:Ae,sortIndex:-1},K>fe?(q.sortIndex=K,t(m,q),s(f)===null&&q===s(m)&&(w?(D(ee),ee=-1):w=!0,re(z,K-fe))):(q.sortIndex=Ae,t(f,q),S||x||(S=!0,V||(V=!0,B()))),q},e.unstable_shouldYield=me,e.unstable_wrapCallback=function(q){var M=y;return function(){var K=y;y=M;try{return q.apply(this,arguments)}finally{y=K}}}})(Km)),Km}var xS;function U2(){return xS||(xS=1,$m.exports=F2()),$m.exports}var Wm={exports:{}},fs={};/**
|
|
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 SS;function $2(){if(SS)return fs;SS=1;var e=lg();function t(f){var m="https://react.dev/errors/"+f;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var n={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(f,m,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:f,containerInfo:m,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,m){if(f==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return fs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,fs.createPortal=function(f,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(f,m,null,g)},fs.flushSync=function(f){var m=d.T,g=n.p;try{if(d.T=null,n.p=2,f)return f()}finally{d.T=m,n.p=g,n.d.f()}},fs.preconnect=function(f,m){typeof f=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,n.d.C(f,m))},fs.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},fs.preinit=function(f,m){if(typeof f=="string"&&m&&typeof m.as=="string"){var g=m.as,v=h(g,m.crossOrigin),y=typeof m.integrity=="string"?m.integrity:void 0,x=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?n.d.S(f,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:x}):g==="script"&&n.d.X(f,{crossOrigin:v,integrity:y,fetchPriority:x,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},fs.preinitModule=function(f,m){if(typeof f=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=h(m.as,m.crossOrigin);n.d.M(f,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&n.d.M(f)},fs.preload=function(f,m){if(typeof f=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,v=h(g,m.crossOrigin);n.d.L(f,g,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},fs.preloadModule=function(f,m){if(typeof f=="string")if(m){var g=h(m.as,m.crossOrigin);n.d.m(f,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else n.d.m(f)},fs.requestFormReset=function(f){n.d.r(f)},fs.unstable_batchedUpdates=function(f,m){return f(m)},fs.useFormState=function(f,m,g){return d.H.useFormState(f,m,g)},fs.useFormStatus=function(){return d.H.useHostTransitionStatus()},fs.version="19.2.8",fs}var wS;function K2(){if(wS)return Wm.exports;wS=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(),Wm.exports=$2(),Wm.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 jS;function W2(){if(jS)return zl;jS=1;var e=U2(),t=lg(),s=K2();function n(i){var r="https://react.dev/errors/"+i;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 #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function l(i){var r=i,c=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(c=r.return),i=r.return;while(i)}return r.tag===3?c:null}function d(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function h(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function f(i){if(l(i)!==i)throw Error(n(188))}function m(i){var r=i.alternate;if(!r){if(r=l(i),r===null)throw Error(n(188));return r!==i?null:i}for(var c=i,u=r;;){var p=c.return;if(p===null)break;var _=p.alternate;if(_===null){if(u=p.return,u!==null){c=u;continue}break}if(p.child===_.child){for(_=p.child;_;){if(_===c)return f(p),i;if(_===u)return f(p),r;_=_.sibling}throw Error(n(188))}if(c.return!==u.return)c=p,u=_;else{for(var b=!1,C=p.child;C;){if(C===c){b=!0,c=p,u=_;break}if(C===u){b=!0,u=p,c=_;break}C=C.sibling}if(!b){for(C=_.child;C;){if(C===c){b=!0,c=_,u=p;break}if(C===u){b=!0,u=_,c=p;break}C=C.sibling}if(!b)throw Error(n(189))}}if(c.alternate!==u)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?i:r}function g(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=g(i),r!==null)return r;i=i.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),A=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),me=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function B(i){return i===null||typeof i!="object"?null:(i=H&&i[H]||i["@@iterator"],typeof i=="function"?i:null)}var O=Symbol.for("react.client.reference");function se(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===O?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case w:return"Fragment";case E:return"Profiler";case k:return"StrictMode";case z:return"Suspense";case V:return"SuspenseList";case ae:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case A:return i.displayName||"Context";case D:return(i._context.displayName||"Context")+".Consumer";case N:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ee:return r=i.displayName||null,r!==null?r:se(i.type)||"Memo";case $:r=i._payload,i=i._init;try{return se(i(r))}catch{}}return null}var re=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},fe=[],Ae=-1;function L(i){return{current:i}}function X(i){0>Ae||(i.current=fe[Ae],fe[Ae]=null,Ae--)}function ce(i,r){Ae++,fe[Ae]=i.current,i.current=r}var Y=L(null),de=L(null),xe=L(null),ze=L(null);function Et(i,r){switch(ce(xe,r),ce(de,i),ce(Y,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?Ex(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=Ex(r),i=Tx(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}X(Y),ce(Y,i)}function Xe(){X(Y),X(de),X(xe)}function Ls(i){i.memoizedState!==null&&ce(ze,i);var r=Y.current,c=Tx(r,i.type);r!==c&&(ce(de,i),ce(Y,c))}function ki(i){de.current===i&&(X(Y),X(de)),ze.current===i&&(X(ze),Rl._currentValue=K)}var Xs,et;function vi(i){if(Xs===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);Xs=r&&r[1]||"",et=-1<c.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Xs+i+et}var Sh=!1;function wh(i,r){if(!i||Sh)return"";Sh=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(G){var W=G}Reflect.construct(i,[],ie)}else{try{ie.call()}catch(G){W=G}i.call(ie.prototype)}}else{try{throw Error()}catch(G){W=G}(ie=i())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(G){if(G&&W&&typeof G.stack=="string")return[G.stack,W.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=u.DetermineComponentFrameRoot(),b=_[0],C=_[1];if(b&&C){var R=b.split(`
|
|
45
|
+
`),U=C.split(`
|
|
46
|
+
`);for(p=u=0;u<R.length&&!R[u].includes("DetermineComponentFrameRoot");)u++;for(;p<U.length&&!U[p].includes("DetermineComponentFrameRoot");)p++;if(u===R.length||p===U.length)for(u=R.length-1,p=U.length-1;1<=u&&0<=p&&R[u]!==U[p];)p--;for(;1<=u&&0<=p;u--,p--)if(R[u]!==U[p]){if(u!==1||p!==1)do if(u--,p--,0>p||R[u]!==U[p]){var Z=`
|
|
47
|
+
`+R[u].replace(" at new "," at ");return i.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",i.displayName)),Z}while(1<=u&&0<=p);break}}}finally{Sh=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?vi(c):""}function Ik(i,r){switch(i.tag){case 26:case 27:case 5:return vi(i.type);case 16:return vi("Lazy");case 13:return i.child!==r&&r!==null?vi("Suspense Fallback"):vi("Suspense");case 19:return vi("SuspenseList");case 0:case 15:return wh(i.type,!1);case 11:return wh(i.type.render,!1);case 1:return wh(i.type,!0);case 31:return vi("Activity");default:return""}}function rv(i){try{var r="",c=null;do r+=Ik(i,c),c=i,i=i.return;while(i);return r}catch(u){return`
|
|
48
|
+
Error generating stack: `+u.message+`
|
|
49
|
+
`+u.stack}}var jh=Object.prototype.hasOwnProperty,Ch=e.unstable_scheduleCallback,kh=e.unstable_cancelCallback,Hk=e.unstable_shouldYield,Fk=e.unstable_requestPaint,Bs=e.unstable_now,Uk=e.unstable_getCurrentPriorityLevel,av=e.unstable_ImmediatePriority,ov=e.unstable_UserBlockingPriority,Ic=e.unstable_NormalPriority,$k=e.unstable_LowPriority,lv=e.unstable_IdlePriority,Kk=e.log,Wk=e.unstable_setDisableYieldValue,$o=null,zs=null;function En(i){if(typeof Kk=="function"&&Wk(i),zs&&typeof zs.setStrictMode=="function")try{zs.setStrictMode($o,i)}catch{}}var qs=Math.clz32?Math.clz32:Gk,Vk=Math.log,Yk=Math.LN2;function Gk(i){return i>>>=0,i===0?32:31-(Vk(i)/Yk|0)|0}var Hc=256,Fc=262144,Uc=4194304;function wr(i){var r=i&42;if(r!==0)return r;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function $c(i,r,c){var u=i.pendingLanes;if(u===0)return 0;var p=0,_=i.suspendedLanes,b=i.pingedLanes;i=i.warmLanes;var C=u&134217727;return C!==0?(u=C&~_,u!==0?p=wr(u):(b&=C,b!==0?p=wr(b):c||(c=C&~i,c!==0&&(p=wr(c))))):(C=u&~_,C!==0?p=wr(C):b!==0?p=wr(b):c||(c=u&~i,c!==0&&(p=wr(c)))),p===0?0:r!==0&&r!==p&&(r&_)===0&&(_=p&-p,c=r&-r,_>=c||_===32&&(c&4194048)!==0)?r:p}function Ko(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function Qk(i,r){switch(i){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 cv(){var i=Uc;return Uc<<=1,(Uc&62914560)===0&&(Uc=4194304),i}function Nh(i){for(var r=[],c=0;31>c;c++)r.push(i);return r}function Wo(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Zk(i,r,c,u,p,_){var b=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var C=i.entanglements,R=i.expirationTimes,U=i.hiddenUpdates;for(c=b&~c;0<c;){var Z=31-qs(c),ie=1<<Z;C[Z]=0,R[Z]=-1;var W=U[Z];if(W!==null)for(U[Z]=null,Z=0;Z<W.length;Z++){var G=W[Z];G!==null&&(G.lane&=-536870913)}c&=~ie}u!==0&&uv(i,u,0),_!==0&&p===0&&i.tag!==0&&(i.suspendedLanes|=_&~(b&~r))}function uv(i,r,c){i.pendingLanes|=r,i.suspendedLanes&=~r;var u=31-qs(r);i.entangledLanes|=r,i.entanglements[u]=i.entanglements[u]|1073741824|c&261930}function dv(i,r){var c=i.entangledLanes|=r;for(i=i.entanglements;c;){var u=31-qs(c),p=1<<u;p&r|i[u]&r&&(i[u]|=r),c&=~p}}function hv(i,r){var c=r&-r;return c=(c&42)!==0?1:Eh(c),(c&(i.suspendedLanes|r))!==0?0:c}function Eh(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Th(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function fv(){var i=M.p;return i!==0?i:(i=window.event,i===void 0?32:Xx(i.type))}function mv(i,r){var c=M.p;try{return M.p=i,r()}finally{M.p=c}}var Tn=Math.random().toString(36).slice(2),ns="__reactFiber$"+Tn,ws="__reactProps$"+Tn,xa="__reactContainer$"+Tn,Ah="__reactEvents$"+Tn,Xk="__reactListeners$"+Tn,Jk="__reactHandles$"+Tn,pv="__reactResources$"+Tn,Vo="__reactMarker$"+Tn;function Oh(i){delete i[ns],delete i[ws],delete i[Ah],delete i[Xk],delete i[Jk]}function Sa(i){var r=i[ns];if(r)return r;for(var c=i.parentNode;c;){if(r=c[xa]||c[ns]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(i=Bx(i);i!==null;){if(c=i[ns])return c;i=Bx(i)}return r}i=c,c=i.parentNode}return null}function wa(i){if(i=i[ns]||i[xa]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function Yo(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(n(33))}function ja(i){var r=i[pv];return r||(r=i[pv]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Gt(i){i[Vo]=!0}var _v=new Set,gv={};function jr(i,r){Ca(i,r),Ca(i+"Capture",r)}function Ca(i,r){for(gv[i]=r,i=0;i<r.length;i++)_v.add(r[i])}var eN=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]*$"),vv={},yv={};function tN(i){return jh.call(yv,i)?!0:jh.call(vv,i)?!1:eN.test(i)?yv[i]=!0:(vv[i]=!0,!1)}function Kc(i,r,c){if(tN(r))if(c===null)i.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+c)}}function Wc(i,r,c){if(c===null)i.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+c)}}function Vi(i,r,c,u){if(u===null)i.removeAttribute(c);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(r,c,""+u)}}function Js(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function bv(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function sN(i,r,c){var u=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,_=u.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return p.call(this)},set:function(b){c=""+b,_.call(this,b)}}),Object.defineProperty(i,r,{enumerable:u.enumerable}),{getValue:function(){return c},setValue:function(b){c=""+b},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function Rh(i){if(!i._valueTracker){var r=bv(i)?"checked":"value";i._valueTracker=sN(i,r,""+i[r])}}function xv(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var c=r.getValue(),u="";return i&&(u=bv(i)?i.checked?"true":"false":i.value),i=u,i!==c?(r.setValue(i),!0):!1}function Vc(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var iN=/[\n"\\]/g;function ei(i){return i.replace(iN,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Dh(i,r,c,u,p,_,b,C){i.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?i.type=b:i.removeAttribute("type"),r!=null?b==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+Js(r)):i.value!==""+Js(r)&&(i.value=""+Js(r)):b!=="submit"&&b!=="reset"||i.removeAttribute("value"),r!=null?Mh(i,b,Js(r)):c!=null?Mh(i,b,Js(c)):u!=null&&i.removeAttribute("value"),p==null&&_!=null&&(i.defaultChecked=!!_),p!=null&&(i.checked=p&&typeof p!="function"&&typeof p!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?i.name=""+Js(C):i.removeAttribute("name")}function Sv(i,r,c,u,p,_,b,C){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(i.type=_),r!=null||c!=null){if(!(_!=="submit"&&_!=="reset"||r!=null)){Rh(i);return}c=c!=null?""+Js(c):"",r=r!=null?""+Js(r):c,C||r===i.value||(i.value=r),i.defaultValue=r}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,i.checked=C?i.checked:!!u,i.defaultChecked=!!u,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.name=b),Rh(i)}function Mh(i,r,c){r==="number"&&Vc(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function ka(i,r,c,u){if(i=i.options,r){r={};for(var p=0;p<c.length;p++)r["$"+c[p]]=!0;for(c=0;c<i.length;c++)p=r.hasOwnProperty("$"+i[c].value),i[c].selected!==p&&(i[c].selected=p),p&&u&&(i[c].defaultSelected=!0)}else{for(c=""+Js(c),r=null,p=0;p<i.length;p++){if(i[p].value===c){i[p].selected=!0,u&&(i[p].defaultSelected=!0);return}r!==null||i[p].disabled||(r=i[p])}r!==null&&(r.selected=!0)}}function wv(i,r,c){if(r!=null&&(r=""+Js(r),r!==i.value&&(i.value=r),c==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=c!=null?""+Js(c):""}function jv(i,r,c,u){if(r==null){if(u!=null){if(c!=null)throw Error(n(92));if(re(u)){if(1<u.length)throw Error(n(93));u=u[0]}c=u}c==null&&(c=""),r=c}c=Js(r),i.defaultValue=c,u=i.textContent,u===c&&u!==""&&u!==null&&(i.value=u),Rh(i)}function Na(i,r){if(r){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=r;return}}i.textContent=r}var nN=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 Cv(i,r,c){var u=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?u?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":u?i.setProperty(r,c):typeof c!="number"||c===0||nN.has(r)?r==="float"?i.cssFloat=c:i[r]=(""+c).trim():i[r]=c+"px"}function kv(i,r,c){if(r!=null&&typeof r!="object")throw Error(n(62));if(i=i.style,c!=null){for(var u in c)!c.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?i.setProperty(u,""):u==="float"?i.cssFloat="":i[u]="");for(var p in r)u=r[p],r.hasOwnProperty(p)&&c[p]!==u&&Cv(i,p,u)}else for(var _ in r)r.hasOwnProperty(_)&&Cv(i,_,r[_])}function Lh(i){if(i.indexOf("-")===-1)return!1;switch(i){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 rN=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"],["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"]]),aN=/^[\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 Yc(i){return aN.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Yi(){}var Bh=null;function zh(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Ea=null,Ta=null;function Nv(i){var r=wa(i);if(r&&(i=r.stateNode)){var c=i[ws]||null;e:switch(i=r.stateNode,r.type){case"input":if(Dh(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+ei(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var u=c[r];if(u!==i&&u.form===i.form){var p=u[ws]||null;if(!p)throw Error(n(90));Dh(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(r=0;r<c.length;r++)u=c[r],u.form===i.form&&xv(u)}break e;case"textarea":wv(i,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&ka(i,!!c.multiple,r,!1)}}}var qh=!1;function Ev(i,r,c){if(qh)return i(r,c);qh=!0;try{var u=i(r);return u}finally{if(qh=!1,(Ea!==null||Ta!==null)&&(Lu(),Ea&&(r=Ea,i=Ta,Ta=Ea=null,Nv(r),i)))for(r=0;r<i.length;r++)Nv(i[r])}}function Go(i,r){var c=i.stateNode;if(c===null)return null;var u=c[ws]||null;if(u===null)return null;c=u[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":(u=!u.disabled)||(i=i.type,u=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!u;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(n(231,r,typeof c));return c}var Gi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ph=!1;if(Gi)try{var Qo={};Object.defineProperty(Qo,"passive",{get:function(){Ph=!0}}),window.addEventListener("test",Qo,Qo),window.removeEventListener("test",Qo,Qo)}catch{Ph=!1}var An=null,Ih=null,Gc=null;function Tv(){if(Gc)return Gc;var i,r=Ih,c=r.length,u,p="value"in An?An.value:An.textContent,_=p.length;for(i=0;i<c&&r[i]===p[i];i++);var b=c-i;for(u=1;u<=b&&r[c-u]===p[_-u];u++);return Gc=p.slice(i,1<u?1-u:void 0)}function Qc(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function Zc(){return!0}function Av(){return!1}function js(i){function r(c,u,p,_,b){this._reactName=c,this._targetInst=p,this.type=u,this.nativeEvent=_,this.target=b,this.currentTarget=null;for(var C in i)i.hasOwnProperty(C)&&(c=i[C],this[C]=c?c(_):_[C]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Zc:Av,this.isPropagationStopped=Av,this}return v(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=Zc)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Zc)},persist:function(){},isPersistent:Zc}),r}var Cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xc=js(Cr),Zo=v({},Cr,{view:0,detail:0}),oN=js(Zo),Hh,Fh,Xo,Jc=v({},Zo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$h,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Xo&&(Xo&&i.type==="mousemove"?(Hh=i.screenX-Xo.screenX,Fh=i.screenY-Xo.screenY):Fh=Hh=0,Xo=i),Hh)},movementY:function(i){return"movementY"in i?i.movementY:Fh}}),Ov=js(Jc),lN=v({},Jc,{dataTransfer:0}),cN=js(lN),uN=v({},Zo,{relatedTarget:0}),Uh=js(uN),dN=v({},Cr,{animationName:0,elapsedTime:0,pseudoElement:0}),hN=js(dN),fN=v({},Cr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),mN=js(fN),pN=v({},Cr,{data:0}),Rv=js(pN),_N={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gN={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"},vN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yN(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=vN[i])?!!r[i]:!1}function $h(){return yN}var bN=v({},Zo,{key:function(i){if(i.key){var r=_N[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Qc(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?gN[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$h,charCode:function(i){return i.type==="keypress"?Qc(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Qc(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),xN=js(bN),SN=v({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dv=js(SN),wN=v({},Zo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$h}),jN=js(wN),CN=v({},Cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),kN=js(CN),NN=v({},Jc,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),EN=js(NN),TN=v({},Cr,{newState:0,oldState:0}),AN=js(TN),ON=[9,13,27,32],Kh=Gi&&"CompositionEvent"in window,Jo=null;Gi&&"documentMode"in document&&(Jo=document.documentMode);var RN=Gi&&"TextEvent"in window&&!Jo,Mv=Gi&&(!Kh||Jo&&8<Jo&&11>=Jo),Lv=" ",Bv=!1;function zv(i,r){switch(i){case"keyup":return ON.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Aa=!1;function DN(i,r){switch(i){case"compositionend":return qv(r);case"keypress":return r.which!==32?null:(Bv=!0,Lv);case"textInput":return i=r.data,i===Lv&&Bv?null:i;default:return null}}function MN(i,r){if(Aa)return i==="compositionend"||!Kh&&zv(i,r)?(i=Tv(),Gc=Ih=An=null,Aa=!1,i):null;switch(i){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 Mv&&r.locale!=="ko"?null:r.data;default:return null}}var LN={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 Pv(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!LN[i.type]:r==="textarea"}function Iv(i,r,c,u){Ea?Ta?Ta.push(u):Ta=[u]:Ea=u,r=Fu(r,"onChange"),0<r.length&&(c=new Xc("onChange","change",null,c,u),i.push({event:c,listeners:r}))}var el=null,tl=null;function BN(i){Sx(i,0)}function eu(i){var r=Yo(i);if(xv(r))return i}function Hv(i,r){if(i==="change")return r}var Fv=!1;if(Gi){var Wh;if(Gi){var Vh="oninput"in document;if(!Vh){var Uv=document.createElement("div");Uv.setAttribute("oninput","return;"),Vh=typeof Uv.oninput=="function"}Wh=Vh}else Wh=!1;Fv=Wh&&(!document.documentMode||9<document.documentMode)}function $v(){el&&(el.detachEvent("onpropertychange",Kv),tl=el=null)}function Kv(i){if(i.propertyName==="value"&&eu(tl)){var r=[];Iv(r,tl,i,zh(i)),Ev(BN,r)}}function zN(i,r,c){i==="focusin"?($v(),el=r,tl=c,el.attachEvent("onpropertychange",Kv)):i==="focusout"&&$v()}function qN(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return eu(tl)}function PN(i,r){if(i==="click")return eu(r)}function IN(i,r){if(i==="input"||i==="change")return eu(r)}function HN(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var Ps=typeof Object.is=="function"?Object.is:HN;function sl(i,r){if(Ps(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var c=Object.keys(i),u=Object.keys(r);if(c.length!==u.length)return!1;for(u=0;u<c.length;u++){var p=c[u];if(!jh.call(r,p)||!Ps(i[p],r[p]))return!1}return!0}function Wv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Vv(i,r){var c=Wv(i);i=0;for(var u;c;){if(c.nodeType===3){if(u=i+c.textContent.length,i<=r&&u>=r)return{node:c,offset:r-i};i=u}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Wv(c)}}function Yv(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?Yv(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function Gv(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Vc(i.document);r instanceof i.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)i=r.contentWindow;else break;r=Vc(i.document)}return r}function Yh(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var FN=Gi&&"documentMode"in document&&11>=document.documentMode,Oa=null,Gh=null,il=null,Qh=!1;function Qv(i,r,c){var u=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Qh||Oa==null||Oa!==Vc(u)||(u=Oa,"selectionStart"in u&&Yh(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),il&&sl(il,u)||(il=u,u=Fu(Gh,"onSelect"),0<u.length&&(r=new Xc("onSelect","select",null,r,c),i.push({event:r,listeners:u}),r.target=Oa)))}function kr(i,r){var c={};return c[i.toLowerCase()]=r.toLowerCase(),c["Webkit"+i]="webkit"+r,c["Moz"+i]="moz"+r,c}var Ra={animationend:kr("Animation","AnimationEnd"),animationiteration:kr("Animation","AnimationIteration"),animationstart:kr("Animation","AnimationStart"),transitionrun:kr("Transition","TransitionRun"),transitionstart:kr("Transition","TransitionStart"),transitioncancel:kr("Transition","TransitionCancel"),transitionend:kr("Transition","TransitionEnd")},Zh={},Zv={};Gi&&(Zv=document.createElement("div").style,"AnimationEvent"in window||(delete Ra.animationend.animation,delete Ra.animationiteration.animation,delete Ra.animationstart.animation),"TransitionEvent"in window||delete Ra.transitionend.transition);function Nr(i){if(Zh[i])return Zh[i];if(!Ra[i])return i;var r=Ra[i],c;for(c in r)if(r.hasOwnProperty(c)&&c in Zv)return Zh[i]=r[c];return i}var Xv=Nr("animationend"),Jv=Nr("animationiteration"),ey=Nr("animationstart"),UN=Nr("transitionrun"),$N=Nr("transitionstart"),KN=Nr("transitioncancel"),ty=Nr("transitionend"),sy=new Map,Xh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(" ");Xh.push("scrollEnd");function yi(i,r){sy.set(i,r),jr(r,[i])}var tu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},ti=[],Da=0,Jh=0;function su(){for(var i=Da,r=Jh=Da=0;r<i;){var c=ti[r];ti[r++]=null;var u=ti[r];ti[r++]=null;var p=ti[r];ti[r++]=null;var _=ti[r];if(ti[r++]=null,u!==null&&p!==null){var b=u.pending;b===null?p.next=p:(p.next=b.next,b.next=p),u.pending=p}_!==0&&iy(c,p,_)}}function iu(i,r,c,u){ti[Da++]=i,ti[Da++]=r,ti[Da++]=c,ti[Da++]=u,Jh|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function ef(i,r,c,u){return iu(i,r,c,u),nu(i)}function Er(i,r){return iu(i,null,null,r),nu(i)}function iy(i,r,c){i.lanes|=c;var u=i.alternate;u!==null&&(u.lanes|=c);for(var p=!1,_=i.return;_!==null;)_.childLanes|=c,u=_.alternate,u!==null&&(u.childLanes|=c),_.tag===22&&(i=_.stateNode,i===null||i._visibility&1||(p=!0)),i=_,_=_.return;return i.tag===3?(_=i.stateNode,p&&r!==null&&(p=31-qs(c),i=_.hiddenUpdates,u=i[p],u===null?i[p]=[r]:u.push(r),r.lane=c|536870912),_):null}function nu(i){if(50<Cl)throw Cl=0,um=null,Error(n(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var Ma={};function WN(i,r,c,u){this.tag=i,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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Is(i,r,c,u){return new WN(i,r,c,u)}function tf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Qi(i,r){var c=i.alternate;return c===null?(c=Is(i.tag,r,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=r,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,r=i.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function ny(i,r){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,r=c.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function ru(i,r,c,u,p,_){var b=0;if(u=i,typeof i=="function")tf(i)&&(b=1);else if(typeof i=="string")b=ZE(i,c,Y.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ae:return i=Is(31,c,r,p),i.elementType=ae,i.lanes=_,i;case w:return Tr(c.children,p,_,r);case k:b=8,p|=24;break;case E:return i=Is(12,c,r,p|2),i.elementType=E,i.lanes=_,i;case z:return i=Is(13,c,r,p),i.elementType=z,i.lanes=_,i;case V:return i=Is(19,c,r,p),i.elementType=V,i.lanes=_,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case A:b=10;break e;case D:b=9;break e;case N:b=11;break e;case ee:b=14;break e;case $:b=16,u=null;break e}b=29,c=Error(n(130,i===null?"null":typeof i,"")),u=null}return r=Is(b,c,r,p),r.elementType=i,r.type=u,r.lanes=_,r}function Tr(i,r,c,u){return i=Is(7,i,u,r),i.lanes=c,i}function sf(i,r,c){return i=Is(6,i,null,r),i.lanes=c,i}function ry(i){var r=Is(18,null,null,0);return r.stateNode=i,r}function nf(i,r,c){return r=Is(4,i.children!==null?i.children:[],i.key,r),r.lanes=c,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var ay=new WeakMap;function si(i,r){if(typeof i=="object"&&i!==null){var c=ay.get(i);return c!==void 0?c:(r={value:i,source:r,stack:rv(r)},ay.set(i,r),r)}return{value:i,source:r,stack:rv(r)}}var La=[],Ba=0,au=null,nl=0,ii=[],ni=0,On=null,Ni=1,Ei="";function Zi(i,r){La[Ba++]=nl,La[Ba++]=au,au=i,nl=r}function oy(i,r,c){ii[ni++]=Ni,ii[ni++]=Ei,ii[ni++]=On,On=i;var u=Ni;i=Ei;var p=32-qs(u)-1;u&=~(1<<p),c+=1;var _=32-qs(r)+p;if(30<_){var b=p-p%5;_=(u&(1<<b)-1).toString(32),u>>=b,p-=b,Ni=1<<32-qs(r)+p|c<<p|u,Ei=_+i}else Ni=1<<_|c<<p|u,Ei=i}function rf(i){i.return!==null&&(Zi(i,1),oy(i,1,0))}function af(i){for(;i===au;)au=La[--Ba],La[Ba]=null,nl=La[--Ba],La[Ba]=null;for(;i===On;)On=ii[--ni],ii[ni]=null,Ei=ii[--ni],ii[ni]=null,Ni=ii[--ni],ii[ni]=null}function ly(i,r){ii[ni++]=Ni,ii[ni++]=Ei,ii[ni++]=On,Ni=r.id,Ei=r.overflow,On=i}var rs=null,ft=null,Qe=!1,Rn=null,ri=!1,of=Error(n(519));function Dn(i){var r=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rl(si(r,i)),of}function cy(i){var r=i.stateNode,c=i.type,u=i.memoizedProps;switch(r[ns]=i,r[ws]=u,c){case"dialog":We("cancel",r),We("close",r);break;case"iframe":case"object":case"embed":We("load",r);break;case"video":case"audio":for(c=0;c<Nl.length;c++)We(Nl[c],r);break;case"source":We("error",r);break;case"img":case"image":case"link":We("error",r),We("load",r);break;case"details":We("toggle",r);break;case"input":We("invalid",r),Sv(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":We("invalid",r);break;case"textarea":We("invalid",r),jv(r,u.value,u.defaultValue,u.children)}c=u.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||u.suppressHydrationWarning===!0||kx(r.textContent,c)?(u.popover!=null&&(We("beforetoggle",r),We("toggle",r)),u.onScroll!=null&&We("scroll",r),u.onScrollEnd!=null&&We("scrollend",r),u.onClick!=null&&(r.onclick=Yi),r=!0):r=!1,r||Dn(i,!0)}function uy(i){for(rs=i.return;rs;)switch(rs.tag){case 5:case 31:case 13:ri=!1;return;case 27:case 3:ri=!0;return;default:rs=rs.return}}function za(i){if(i!==rs)return!1;if(!Qe)return uy(i),Qe=!0,!1;var r=i.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||Cm(i.type,i.memoizedProps)),c=!c),c&&ft&&Dn(i),uy(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));ft=Lx(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));ft=Lx(i)}else r===27?(r=ft,Vn(i.type)?(i=Am,Am=null,ft=i):ft=r):ft=rs?oi(i.stateNode.nextSibling):null;return!0}function Ar(){ft=rs=null,Qe=!1}function lf(){var i=Rn;return i!==null&&(Es===null?Es=i:Es.push.apply(Es,i),Rn=null),i}function rl(i){Rn===null?Rn=[i]:Rn.push(i)}var cf=L(null),Or=null,Xi=null;function Mn(i,r,c){ce(cf,r._currentValue),r._currentValue=c}function Ji(i){i._currentValue=cf.current,X(cf)}function uf(i,r,c){for(;i!==null;){var u=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),i===c)break;i=i.return}}function df(i,r,c,u){var p=i.child;for(p!==null&&(p.return=i);p!==null;){var _=p.dependencies;if(_!==null){var b=p.child;_=_.firstContext;e:for(;_!==null;){var C=_;_=p;for(var R=0;R<r.length;R++)if(C.context===r[R]){_.lanes|=c,C=_.alternate,C!==null&&(C.lanes|=c),uf(_.return,c,i),u||(b=null);break e}_=C.next}}else if(p.tag===18){if(b=p.return,b===null)throw Error(n(341));b.lanes|=c,_=b.alternate,_!==null&&(_.lanes|=c),uf(b,c,i),b=null}else b=p.child;if(b!==null)b.return=p;else for(b=p;b!==null;){if(b===i){b=null;break}if(p=b.sibling,p!==null){p.return=b.return,b=p;break}b=b.return}p=b}}function qa(i,r,c,u){i=null;for(var p=r,_=!1;p!==null;){if(!_){if((p.flags&524288)!==0)_=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var b=p.alternate;if(b===null)throw Error(n(387));if(b=b.memoizedProps,b!==null){var C=p.type;Ps(p.pendingProps.value,b.value)||(i!==null?i.push(C):i=[C])}}else if(p===ze.current){if(b=p.alternate,b===null)throw Error(n(387));b.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(i!==null?i.push(Rl):i=[Rl])}p=p.return}i!==null&&df(r,i,c,u),r.flags|=262144}function ou(i){for(i=i.firstContext;i!==null;){if(!Ps(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Rr(i){Or=i,Xi=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function as(i){return dy(Or,i)}function lu(i,r){return Or===null&&Rr(i),dy(i,r)}function dy(i,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},Xi===null){if(i===null)throw Error(n(308));Xi=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else Xi=Xi.next=r;return c}var VN=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(c,u){i.push(u)}};this.abort=function(){r.aborted=!0,i.forEach(function(c){return c()})}},YN=e.unstable_scheduleCallback,GN=e.unstable_NormalPriority,Dt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hf(){return{controller:new VN,data:new Map,refCount:0}}function al(i){i.refCount--,i.refCount===0&&YN(GN,function(){i.controller.abort()})}var ol=null,ff=0,Pa=0,Ia=null;function QN(i,r){if(ol===null){var c=ol=[];ff=0,Pa=_m(),Ia={status:"pending",value:void 0,then:function(u){c.push(u)}}}return ff++,r.then(hy,hy),r}function hy(){if(--ff===0&&ol!==null){Ia!==null&&(Ia.status="fulfilled");var i=ol;ol=null,Pa=0,Ia=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function ZN(i,r){var c=[],u={status:"pending",value:null,reason:null,then:function(p){c.push(p)}};return i.then(function(){u.status="fulfilled",u.value=r;for(var p=0;p<c.length;p++)(0,c[p])(r)},function(p){for(u.status="rejected",u.reason=p,p=0;p<c.length;p++)(0,c[p])(void 0)}),u}var fy=q.S;q.S=function(i,r){Qb=Bs(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&QN(i,r),fy!==null&&fy(i,r)};var Dr=L(null);function mf(){var i=Dr.current;return i!==null?i:dt.pooledCache}function cu(i,r){r===null?ce(Dr,Dr.current):ce(Dr,r.pool)}function my(){var i=mf();return i===null?null:{parent:Dt._currentValue,pool:i}}var Ha=Error(n(460)),pf=Error(n(474)),uu=Error(n(542)),du={then:function(){}};function py(i){return i=i.status,i==="fulfilled"||i==="rejected"}function _y(i,r,c){switch(c=i[c],c===void 0?i.push(r):c!==r&&(r.then(Yi,Yi),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,vy(i),i;default:if(typeof r.status=="string")r.then(Yi,Yi);else{if(i=dt,i!==null&&100<i.shellSuspendCounter)throw Error(n(482));i=r,i.status="pending",i.then(function(u){if(r.status==="pending"){var p=r;p.status="fulfilled",p.value=u}},function(u){if(r.status==="pending"){var p=r;p.status="rejected",p.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,vy(i),i}throw Lr=r,Ha}}function Mr(i){try{var r=i._init;return r(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Lr=c,Ha):c}}var Lr=null;function gy(){if(Lr===null)throw Error(n(459));var i=Lr;return Lr=null,i}function vy(i){if(i===Ha||i===uu)throw Error(n(483))}var Fa=null,ll=0;function hu(i){var r=ll;return ll+=1,Fa===null&&(Fa=[]),_y(Fa,i,r)}function cl(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function fu(i,r){throw r.$$typeof===y?Error(n(525)):(i=Object.prototype.toString.call(r),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function yy(i){function r(I,P){if(i){var F=I.deletions;F===null?(I.deletions=[P],I.flags|=16):F.push(P)}}function c(I,P){if(!i)return null;for(;P!==null;)r(I,P),P=P.sibling;return null}function u(I){for(var P=new Map;I!==null;)I.key!==null?P.set(I.key,I):P.set(I.index,I),I=I.sibling;return P}function p(I,P){return I=Qi(I,P),I.index=0,I.sibling=null,I}function _(I,P,F){return I.index=F,i?(F=I.alternate,F!==null?(F=F.index,F<P?(I.flags|=67108866,P):F):(I.flags|=67108866,P)):(I.flags|=1048576,P)}function b(I){return i&&I.alternate===null&&(I.flags|=67108866),I}function C(I,P,F,te){return P===null||P.tag!==6?(P=sf(F,I.mode,te),P.return=I,P):(P=p(P,F),P.return=I,P)}function R(I,P,F,te){var ke=F.type;return ke===w?Z(I,P,F.props.children,te,F.key):P!==null&&(P.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===$&&Mr(ke)===P.type)?(P=p(P,F.props),cl(P,F),P.return=I,P):(P=ru(F.type,F.key,F.props,null,I.mode,te),cl(P,F),P.return=I,P)}function U(I,P,F,te){return P===null||P.tag!==4||P.stateNode.containerInfo!==F.containerInfo||P.stateNode.implementation!==F.implementation?(P=nf(F,I.mode,te),P.return=I,P):(P=p(P,F.children||[]),P.return=I,P)}function Z(I,P,F,te,ke){return P===null||P.tag!==7?(P=Tr(F,I.mode,te,ke),P.return=I,P):(P=p(P,F),P.return=I,P)}function ie(I,P,F){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=sf(""+P,I.mode,F),P.return=I,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case x:return F=ru(P.type,P.key,P.props,null,I.mode,F),cl(F,P),F.return=I,F;case S:return P=nf(P,I.mode,F),P.return=I,P;case $:return P=Mr(P),ie(I,P,F)}if(re(P)||B(P))return P=Tr(P,I.mode,F,null),P.return=I,P;if(typeof P.then=="function")return ie(I,hu(P),F);if(P.$$typeof===A)return ie(I,lu(I,P),F);fu(I,P)}return null}function W(I,P,F,te){var ke=P!==null?P.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return ke!==null?null:C(I,P,""+F,te);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case x:return F.key===ke?R(I,P,F,te):null;case S:return F.key===ke?U(I,P,F,te):null;case $:return F=Mr(F),W(I,P,F,te)}if(re(F)||B(F))return ke!==null?null:Z(I,P,F,te,null);if(typeof F.then=="function")return W(I,P,hu(F),te);if(F.$$typeof===A)return W(I,P,lu(I,F),te);fu(I,F)}return null}function G(I,P,F,te,ke){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return I=I.get(F)||null,C(P,I,""+te,ke);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case x:return I=I.get(te.key===null?F:te.key)||null,R(P,I,te,ke);case S:return I=I.get(te.key===null?F:te.key)||null,U(P,I,te,ke);case $:return te=Mr(te),G(I,P,F,te,ke)}if(re(te)||B(te))return I=I.get(F)||null,Z(P,I,te,ke,null);if(typeof te.then=="function")return G(I,P,F,hu(te),ke);if(te.$$typeof===A)return G(I,P,F,lu(P,te),ke);fu(P,te)}return null}function ye(I,P,F,te){for(var ke=null,tt=null,we=P,qe=P=0,Ye=null;we!==null&&qe<F.length;qe++){we.index>qe?(Ye=we,we=null):Ye=we.sibling;var st=W(I,we,F[qe],te);if(st===null){we===null&&(we=Ye);break}i&&we&&st.alternate===null&&r(I,we),P=_(st,P,qe),tt===null?ke=st:tt.sibling=st,tt=st,we=Ye}if(qe===F.length)return c(I,we),Qe&&Zi(I,qe),ke;if(we===null){for(;qe<F.length;qe++)we=ie(I,F[qe],te),we!==null&&(P=_(we,P,qe),tt===null?ke=we:tt.sibling=we,tt=we);return Qe&&Zi(I,qe),ke}for(we=u(we);qe<F.length;qe++)Ye=G(we,I,qe,F[qe],te),Ye!==null&&(i&&Ye.alternate!==null&&we.delete(Ye.key===null?qe:Ye.key),P=_(Ye,P,qe),tt===null?ke=Ye:tt.sibling=Ye,tt=Ye);return i&&we.forEach(function(Xn){return r(I,Xn)}),Qe&&Zi(I,qe),ke}function Ee(I,P,F,te){if(F==null)throw Error(n(151));for(var ke=null,tt=null,we=P,qe=P=0,Ye=null,st=F.next();we!==null&&!st.done;qe++,st=F.next()){we.index>qe?(Ye=we,we=null):Ye=we.sibling;var Xn=W(I,we,st.value,te);if(Xn===null){we===null&&(we=Ye);break}i&&we&&Xn.alternate===null&&r(I,we),P=_(Xn,P,qe),tt===null?ke=Xn:tt.sibling=Xn,tt=Xn,we=Ye}if(st.done)return c(I,we),Qe&&Zi(I,qe),ke;if(we===null){for(;!st.done;qe++,st=F.next())st=ie(I,st.value,te),st!==null&&(P=_(st,P,qe),tt===null?ke=st:tt.sibling=st,tt=st);return Qe&&Zi(I,qe),ke}for(we=u(we);!st.done;qe++,st=F.next())st=G(we,I,qe,st.value,te),st!==null&&(i&&st.alternate!==null&&we.delete(st.key===null?qe:st.key),P=_(st,P,qe),tt===null?ke=st:tt.sibling=st,tt=st);return i&&we.forEach(function(l2){return r(I,l2)}),Qe&&Zi(I,qe),ke}function ct(I,P,F,te){if(typeof F=="object"&&F!==null&&F.type===w&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case x:e:{for(var ke=F.key;P!==null;){if(P.key===ke){if(ke=F.type,ke===w){if(P.tag===7){c(I,P.sibling),te=p(P,F.props.children),te.return=I,I=te;break e}}else if(P.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===$&&Mr(ke)===P.type){c(I,P.sibling),te=p(P,F.props),cl(te,F),te.return=I,I=te;break e}c(I,P);break}else r(I,P);P=P.sibling}F.type===w?(te=Tr(F.props.children,I.mode,te,F.key),te.return=I,I=te):(te=ru(F.type,F.key,F.props,null,I.mode,te),cl(te,F),te.return=I,I=te)}return b(I);case S:e:{for(ke=F.key;P!==null;){if(P.key===ke)if(P.tag===4&&P.stateNode.containerInfo===F.containerInfo&&P.stateNode.implementation===F.implementation){c(I,P.sibling),te=p(P,F.children||[]),te.return=I,I=te;break e}else{c(I,P);break}else r(I,P);P=P.sibling}te=nf(F,I.mode,te),te.return=I,I=te}return b(I);case $:return F=Mr(F),ct(I,P,F,te)}if(re(F))return ye(I,P,F,te);if(B(F)){if(ke=B(F),typeof ke!="function")throw Error(n(150));return F=ke.call(F),Ee(I,P,F,te)}if(typeof F.then=="function")return ct(I,P,hu(F),te);if(F.$$typeof===A)return ct(I,P,lu(I,F),te);fu(I,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,P!==null&&P.tag===6?(c(I,P.sibling),te=p(P,F),te.return=I,I=te):(c(I,P),te=sf(F,I.mode,te),te.return=I,I=te),b(I)):c(I,P)}return function(I,P,F,te){try{ll=0;var ke=ct(I,P,F,te);return Fa=null,ke}catch(we){if(we===Ha||we===uu)throw we;var tt=Is(29,we,null,I.mode);return tt.lanes=te,tt.return=I,tt}finally{}}}var Br=yy(!0),by=yy(!1),Ln=!1;function _f(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gf(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Bn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function zn(i,r,c){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(it&2)!==0){var p=u.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),u.pending=r,r=nu(i),iy(i,null,c),r}return iu(i,u,r,c),nu(i)}function ul(i,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var u=r.lanes;u&=i.pendingLanes,c|=u,r.lanes=c,dv(i,c)}}function vf(i,r){var c=i.updateQueue,u=i.alternate;if(u!==null&&(u=u.updateQueue,c===u)){var p=null,_=null;if(c=c.firstBaseUpdate,c!==null){do{var b={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};_===null?p=_=b:_=_.next=b,c=c.next}while(c!==null);_===null?p=_=r:_=_.next=r}else p=_=r;c={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:_,shared:u.shared,callbacks:u.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=r:i.next=r,c.lastBaseUpdate=r}var yf=!1;function dl(){if(yf){var i=Ia;if(i!==null)throw i}}function hl(i,r,c,u){yf=!1;var p=i.updateQueue;Ln=!1;var _=p.firstBaseUpdate,b=p.lastBaseUpdate,C=p.shared.pending;if(C!==null){p.shared.pending=null;var R=C,U=R.next;R.next=null,b===null?_=U:b.next=U,b=R;var Z=i.alternate;Z!==null&&(Z=Z.updateQueue,C=Z.lastBaseUpdate,C!==b&&(C===null?Z.firstBaseUpdate=U:C.next=U,Z.lastBaseUpdate=R))}if(_!==null){var ie=p.baseState;b=0,Z=U=R=null,C=_;do{var W=C.lane&-536870913,G=W!==C.lane;if(G?(Ve&W)===W:(u&W)===W){W!==0&&W===Pa&&(yf=!0),Z!==null&&(Z=Z.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var ye=i,Ee=C;W=r;var ct=c;switch(Ee.tag){case 1:if(ye=Ee.payload,typeof ye=="function"){ie=ye.call(ct,ie,W);break e}ie=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Ee.payload,W=typeof ye=="function"?ye.call(ct,ie,W):ye,W==null)break e;ie=v({},ie,W);break e;case 2:Ln=!0}}W=C.callback,W!==null&&(i.flags|=64,G&&(i.flags|=8192),G=p.callbacks,G===null?p.callbacks=[W]:G.push(W))}else G={lane:W,tag:C.tag,payload:C.payload,callback:C.callback,next:null},Z===null?(U=Z=G,R=ie):Z=Z.next=G,b|=W;if(C=C.next,C===null){if(C=p.shared.pending,C===null)break;G=C,C=G.next,G.next=null,p.lastBaseUpdate=G,p.shared.pending=null}}while(!0);Z===null&&(R=ie),p.baseState=R,p.firstBaseUpdate=U,p.lastBaseUpdate=Z,_===null&&(p.shared.lanes=0),Fn|=b,i.lanes=b,i.memoizedState=ie}}function xy(i,r){if(typeof i!="function")throw Error(n(191,i));i.call(r)}function Sy(i,r){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)xy(c[i],r)}var Ua=L(null),mu=L(0);function wy(i,r){i=cn,ce(mu,i),ce(Ua,r),cn=i|r.baseLanes}function bf(){ce(mu,cn),ce(Ua,Ua.current)}function xf(){cn=mu.current,X(Ua),X(mu)}var Hs=L(null),ai=null;function qn(i){var r=i.alternate;ce(Tt,Tt.current&1),ce(Hs,i),ai===null&&(r===null||Ua.current!==null||r.memoizedState!==null)&&(ai=i)}function Sf(i){ce(Tt,Tt.current),ce(Hs,i),ai===null&&(ai=i)}function jy(i){i.tag===22?(ce(Tt,Tt.current),ce(Hs,i),ai===null&&(ai=i)):Pn()}function Pn(){ce(Tt,Tt.current),ce(Hs,Hs.current)}function Fs(i){X(Hs),ai===i&&(ai=null),X(Tt)}var Tt=L(0);function pu(i){for(var r=i;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Em(c)||Tm(c)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var en=0,Le=null,ot=null,Mt=null,_u=!1,$a=!1,zr=!1,gu=0,fl=0,Ka=null,XN=0;function bt(){throw Error(n(321))}function wf(i,r){if(r===null)return!1;for(var c=0;c<r.length&&c<i.length;c++)if(!Ps(i[c],r[c]))return!1;return!0}function jf(i,r,c,u,p,_){return en=_,Le=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,q.H=i===null||i.memoizedState===null?ob:Pf,zr=!1,_=c(u,p),zr=!1,$a&&(_=ky(r,c,u,p)),Cy(i),_}function Cy(i){q.H=_l;var r=ot!==null&&ot.next!==null;if(en=0,Mt=ot=Le=null,_u=!1,fl=0,Ka=null,r)throw Error(n(300));i===null||Lt||(i=i.dependencies,i!==null&&ou(i)&&(Lt=!0))}function ky(i,r,c,u){Le=i;var p=0;do{if($a&&(Ka=null),fl=0,$a=!1,25<=p)throw Error(n(301));if(p+=1,Mt=ot=null,i.updateQueue!=null){var _=i.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}q.H=lb,_=r(c,u)}while($a);return _}function JN(){var i=q.H,r=i.useState()[0];return r=typeof r.then=="function"?ml(r):r,i=i.useState()[0],(ot!==null?ot.memoizedState:null)!==i&&(Le.flags|=1024),r}function Cf(){var i=gu!==0;return gu=0,i}function kf(i,r,c){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~c}function Nf(i){if(_u){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}_u=!1}en=0,Mt=ot=Le=null,$a=!1,fl=gu=0,Ka=null}function gs(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Le.memoizedState=Mt=i:Mt=Mt.next=i,Mt}function At(){if(ot===null){var i=Le.alternate;i=i!==null?i.memoizedState:null}else i=ot.next;var r=Mt===null?Le.memoizedState:Mt.next;if(r!==null)Mt=r,ot=i;else{if(i===null)throw Le.alternate===null?Error(n(467)):Error(n(310));ot=i,i={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},Mt===null?Le.memoizedState=Mt=i:Mt=Mt.next=i}return Mt}function vu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ml(i){var r=fl;return fl+=1,Ka===null&&(Ka=[]),i=_y(Ka,i,r),r=Le,(Mt===null?r.memoizedState:Mt.next)===null&&(r=r.alternate,q.H=r===null||r.memoizedState===null?ob:Pf),i}function yu(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return ml(i);if(i.$$typeof===A)return as(i)}throw Error(n(438,String(i)))}function Ef(i){var r=null,c=Le.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var u=Le.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(p){return p.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=vu(),Le.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(i),u=0;u<i;u++)c[u]=me;return r.index++,c}function tn(i,r){return typeof r=="function"?r(i):r}function bu(i){var r=At();return Tf(r,ot,i)}function Tf(i,r,c){var u=i.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=c;var p=i.baseQueue,_=u.pending;if(_!==null){if(p!==null){var b=p.next;p.next=_.next,_.next=b}r.baseQueue=p=_,u.pending=null}if(_=i.baseState,p===null)i.memoizedState=_;else{r=p.next;var C=b=null,R=null,U=r,Z=!1;do{var ie=U.lane&-536870913;if(ie!==U.lane?(Ve&ie)===ie:(en&ie)===ie){var W=U.revertLane;if(W===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),ie===Pa&&(Z=!0);else if((en&W)===W){U=U.next,W===Pa&&(Z=!0);continue}else ie={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},R===null?(C=R=ie,b=_):R=R.next=ie,Le.lanes|=W,Fn|=W;ie=U.action,zr&&c(_,ie),_=U.hasEagerState?U.eagerState:c(_,ie)}else W={lane:ie,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},R===null?(C=R=W,b=_):R=R.next=W,Le.lanes|=ie,Fn|=ie;U=U.next}while(U!==null&&U!==r);if(R===null?b=_:R.next=C,!Ps(_,i.memoizedState)&&(Lt=!0,Z&&(c=Ia,c!==null)))throw c;i.memoizedState=_,i.baseState=b,i.baseQueue=R,u.lastRenderedState=_}return p===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function Af(i){var r=At(),c=r.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=i;var u=c.dispatch,p=c.pending,_=r.memoizedState;if(p!==null){c.pending=null;var b=p=p.next;do _=i(_,b.action),b=b.next;while(b!==p);Ps(_,r.memoizedState)||(Lt=!0),r.memoizedState=_,r.baseQueue===null&&(r.baseState=_),c.lastRenderedState=_}return[_,u]}function Ny(i,r,c){var u=Le,p=At(),_=Qe;if(_){if(c===void 0)throw Error(n(407));c=c()}else c=r();var b=!Ps((ot||p).memoizedState,c);if(b&&(p.memoizedState=c,Lt=!0),p=p.queue,Df(Ay.bind(null,u,p,i),[i]),p.getSnapshot!==r||b||Mt!==null&&Mt.memoizedState.tag&1){if(u.flags|=2048,Wa(9,{destroy:void 0},Ty.bind(null,u,p,c,r),null),dt===null)throw Error(n(349));_||(en&127)!==0||Ey(u,r,c)}return c}function Ey(i,r,c){i.flags|=16384,i={getSnapshot:r,value:c},r=Le.updateQueue,r===null?(r=vu(),Le.updateQueue=r,r.stores=[i]):(c=r.stores,c===null?r.stores=[i]:c.push(i))}function Ty(i,r,c,u){r.value=c,r.getSnapshot=u,Oy(r)&&Ry(i)}function Ay(i,r,c){return c(function(){Oy(r)&&Ry(i)})}function Oy(i){var r=i.getSnapshot;i=i.value;try{var c=r();return!Ps(i,c)}catch{return!0}}function Ry(i){var r=Er(i,2);r!==null&&Ts(r,i,2)}function Of(i){var r=gs();if(typeof i=="function"){var c=i;if(i=c(),zr){En(!0);try{c()}finally{En(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:i},r}function Dy(i,r,c,u){return i.baseState=c,Tf(i,ot,typeof u=="function"?u:tn)}function eE(i,r,c,u,p){if(wu(i))throw Error(n(485));if(i=r.action,i!==null){var _={payload:p,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){_.listeners.push(b)}};q.T!==null?c(!0):_.isTransition=!1,u(_),c=r.pending,c===null?(_.next=r.pending=_,My(r,_)):(_.next=c.next,r.pending=c.next=_)}}function My(i,r){var c=r.action,u=r.payload,p=i.state;if(r.isTransition){var _=q.T,b={};q.T=b;try{var C=c(p,u),R=q.S;R!==null&&R(b,C),Ly(i,r,C)}catch(U){Rf(i,r,U)}finally{_!==null&&b.types!==null&&(_.types=b.types),q.T=_}}else try{_=c(p,u),Ly(i,r,_)}catch(U){Rf(i,r,U)}}function Ly(i,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(u){By(i,r,u)},function(u){return Rf(i,r,u)}):By(i,r,c)}function By(i,r,c){r.status="fulfilled",r.value=c,zy(r),i.state=c,r=i.pending,r!==null&&(c=r.next,c===r?i.pending=null:(c=c.next,r.next=c,My(i,c)))}function Rf(i,r,c){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=c,zy(r),r=r.next;while(r!==u)}i.action=null}function zy(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function qy(i,r){return r}function Py(i,r){if(Qe){var c=dt.formState;if(c!==null){e:{var u=Le;if(Qe){if(ft){t:{for(var p=ft,_=ri;p.nodeType!==8;){if(!_){p=null;break t}if(p=oi(p.nextSibling),p===null){p=null;break t}}_=p.data,p=_==="F!"||_==="F"?p:null}if(p){ft=oi(p.nextSibling),u=p.data==="F!";break e}}Dn(u)}u=!1}u&&(r=c[0])}}return c=gs(),c.memoizedState=c.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qy,lastRenderedState:r},c.queue=u,c=nb.bind(null,Le,u),u.dispatch=c,u=Of(!1),_=qf.bind(null,Le,!1,u.queue),u=gs(),p={state:r,dispatch:null,action:i,pending:null},u.queue=p,c=eE.bind(null,Le,p,_,c),p.dispatch=c,u.memoizedState=i,[r,c,!1]}function Iy(i){var r=At();return Hy(r,ot,i)}function Hy(i,r,c){if(r=Tf(i,r,qy)[0],i=bu(tn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=ml(r)}catch(b){throw b===Ha?uu:b}else u=r;r=At();var p=r.queue,_=p.dispatch;return c!==r.memoizedState&&(Le.flags|=2048,Wa(9,{destroy:void 0},tE.bind(null,p,c),null)),[u,_,i]}function tE(i,r){i.action=r}function Fy(i){var r=At(),c=ot;if(c!==null)return Hy(r,c,i);At(),r=r.memoizedState,c=At();var u=c.queue.dispatch;return c.memoizedState=i,[r,u,!1]}function Wa(i,r,c,u){return i={tag:i,create:c,deps:u,inst:r,next:null},r=Le.updateQueue,r===null&&(r=vu(),Le.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=i.next=i:(u=c.next,c.next=i,i.next=u,r.lastEffect=i),i}function Uy(){return At().memoizedState}function xu(i,r,c,u){var p=gs();Le.flags|=i,p.memoizedState=Wa(1|r,{destroy:void 0},c,u===void 0?null:u)}function Su(i,r,c,u){var p=At();u=u===void 0?null:u;var _=p.memoizedState.inst;ot!==null&&u!==null&&wf(u,ot.memoizedState.deps)?p.memoizedState=Wa(r,_,c,u):(Le.flags|=i,p.memoizedState=Wa(1|r,_,c,u))}function $y(i,r){xu(8390656,8,i,r)}function Df(i,r){Su(2048,8,i,r)}function sE(i){Le.flags|=4;var r=Le.updateQueue;if(r===null)r=vu(),Le.updateQueue=r,r.events=[i];else{var c=r.events;c===null?r.events=[i]:c.push(i)}}function Ky(i){var r=At().memoizedState;return sE({ref:r,nextImpl:i}),function(){if((it&2)!==0)throw Error(n(440));return r.impl.apply(void 0,arguments)}}function Wy(i,r){return Su(4,2,i,r)}function Vy(i,r){return Su(4,4,i,r)}function Yy(i,r){if(typeof r=="function"){i=i();var c=r(i);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function Gy(i,r,c){c=c!=null?c.concat([i]):null,Su(4,4,Yy.bind(null,r,i),c)}function Mf(){}function Qy(i,r){var c=At();r=r===void 0?null:r;var u=c.memoizedState;return r!==null&&wf(r,u[1])?u[0]:(c.memoizedState=[i,r],i)}function Zy(i,r){var c=At();r=r===void 0?null:r;var u=c.memoizedState;if(r!==null&&wf(r,u[1]))return u[0];if(u=i(),zr){En(!0);try{i()}finally{En(!1)}}return c.memoizedState=[u,r],u}function Lf(i,r,c){return c===void 0||(en&1073741824)!==0&&(Ve&261930)===0?i.memoizedState=r:(i.memoizedState=c,i=Xb(),Le.lanes|=i,Fn|=i,c)}function Xy(i,r,c,u){return Ps(c,r)?c:Ua.current!==null?(i=Lf(i,c,u),Ps(i,r)||(Lt=!0),i):(en&42)===0||(en&1073741824)!==0&&(Ve&261930)===0?(Lt=!0,i.memoizedState=c):(i=Xb(),Le.lanes|=i,Fn|=i,r)}function Jy(i,r,c,u,p){var _=M.p;M.p=_!==0&&8>_?_:8;var b=q.T,C={};q.T=C,qf(i,!1,r,c);try{var R=p(),U=q.S;if(U!==null&&U(C,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Z=ZN(R,u);pl(i,r,Z,Ks(i))}else pl(i,r,u,Ks(i))}catch(ie){pl(i,r,{then:function(){},status:"rejected",reason:ie},Ks())}finally{M.p=_,b!==null&&C.types!==null&&(b.types=C.types),q.T=b}}function iE(){}function Bf(i,r,c,u){if(i.tag!==5)throw Error(n(476));var p=eb(i).queue;Jy(i,p,r,K,c===null?iE:function(){return tb(i),c(u)})}function eb(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:K},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:c},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function tb(i){var r=eb(i);r.next===null&&(r=i.alternate.memoizedState),pl(i,r.next.queue,{},Ks())}function zf(){return as(Rl)}function sb(){return At().memoizedState}function ib(){return At().memoizedState}function nE(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var c=Ks();i=Bn(c);var u=zn(r,i,c);u!==null&&(Ts(u,r,c),ul(u,r,c)),r={cache:hf()},i.payload=r;return}r=r.return}}function rE(i,r,c){var u=Ks();c={lane:u,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},wu(i)?rb(r,c):(c=ef(i,r,c,u),c!==null&&(Ts(c,i,u),ab(c,r,u)))}function nb(i,r,c){var u=Ks();pl(i,r,c,u)}function pl(i,r,c,u){var p={lane:u,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(wu(i))rb(r,p);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=r.lastRenderedReducer,_!==null))try{var b=r.lastRenderedState,C=_(b,c);if(p.hasEagerState=!0,p.eagerState=C,Ps(C,b))return iu(i,r,p,0),dt===null&&su(),!1}catch{}finally{}if(c=ef(i,r,p,u),c!==null)return Ts(c,i,u),ab(c,r,u),!0}return!1}function qf(i,r,c,u){if(u={lane:2,revertLane:_m(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},wu(i)){if(r)throw Error(n(479))}else r=ef(i,c,u,2),r!==null&&Ts(r,i,2)}function wu(i){var r=i.alternate;return i===Le||r!==null&&r===Le}function rb(i,r){$a=_u=!0;var c=i.pending;c===null?r.next=r:(r.next=c.next,c.next=r),i.pending=r}function ab(i,r,c){if((c&4194048)!==0){var u=r.lanes;u&=i.pendingLanes,c|=u,r.lanes=c,dv(i,c)}}var _l={readContext:as,use:yu,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};_l.useEffectEvent=bt;var ob={readContext:as,use:yu,useCallback:function(i,r){return gs().memoizedState=[i,r===void 0?null:r],i},useContext:as,useEffect:$y,useImperativeHandle:function(i,r,c){c=c!=null?c.concat([i]):null,xu(4194308,4,Yy.bind(null,r,i),c)},useLayoutEffect:function(i,r){return xu(4194308,4,i,r)},useInsertionEffect:function(i,r){xu(4,2,i,r)},useMemo:function(i,r){var c=gs();r=r===void 0?null:r;var u=i();if(zr){En(!0);try{i()}finally{En(!1)}}return c.memoizedState=[u,r],u},useReducer:function(i,r,c){var u=gs();if(c!==void 0){var p=c(r);if(zr){En(!0);try{c(r)}finally{En(!1)}}}else p=r;return u.memoizedState=u.baseState=p,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:p},u.queue=i,i=i.dispatch=rE.bind(null,Le,i),[u.memoizedState,i]},useRef:function(i){var r=gs();return i={current:i},r.memoizedState=i},useState:function(i){i=Of(i);var r=i.queue,c=nb.bind(null,Le,r);return r.dispatch=c,[i.memoizedState,c]},useDebugValue:Mf,useDeferredValue:function(i,r){var c=gs();return Lf(c,i,r)},useTransition:function(){var i=Of(!1);return i=Jy.bind(null,Le,i.queue,!0,!1),gs().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,c){var u=Le,p=gs();if(Qe){if(c===void 0)throw Error(n(407));c=c()}else{if(c=r(),dt===null)throw Error(n(349));(Ve&127)!==0||Ey(u,r,c)}p.memoizedState=c;var _={value:c,getSnapshot:r};return p.queue=_,$y(Ay.bind(null,u,_,i),[i]),u.flags|=2048,Wa(9,{destroy:void 0},Ty.bind(null,u,_,c,r),null),c},useId:function(){var i=gs(),r=dt.identifierPrefix;if(Qe){var c=Ei,u=Ni;c=(u&~(1<<32-qs(u)-1)).toString(32)+c,r="_"+r+"R_"+c,c=gu++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=XN++,r="_"+r+"r_"+c.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:zf,useFormState:Py,useActionState:Py,useOptimistic:function(i){var r=gs();r.memoizedState=r.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=qf.bind(null,Le,!0,c),c.dispatch=r,[i,r]},useMemoCache:Ef,useCacheRefresh:function(){return gs().memoizedState=nE.bind(null,Le)},useEffectEvent:function(i){var r=gs(),c={impl:i};return r.memoizedState=c,function(){if((it&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}},Pf={readContext:as,use:yu,useCallback:Qy,useContext:as,useEffect:Df,useImperativeHandle:Gy,useInsertionEffect:Wy,useLayoutEffect:Vy,useMemo:Zy,useReducer:bu,useRef:Uy,useState:function(){return bu(tn)},useDebugValue:Mf,useDeferredValue:function(i,r){var c=At();return Xy(c,ot.memoizedState,i,r)},useTransition:function(){var i=bu(tn)[0],r=At().memoizedState;return[typeof i=="boolean"?i:ml(i),r]},useSyncExternalStore:Ny,useId:sb,useHostTransitionStatus:zf,useFormState:Iy,useActionState:Iy,useOptimistic:function(i,r){var c=At();return Dy(c,ot,i,r)},useMemoCache:Ef,useCacheRefresh:ib};Pf.useEffectEvent=Ky;var lb={readContext:as,use:yu,useCallback:Qy,useContext:as,useEffect:Df,useImperativeHandle:Gy,useInsertionEffect:Wy,useLayoutEffect:Vy,useMemo:Zy,useReducer:Af,useRef:Uy,useState:function(){return Af(tn)},useDebugValue:Mf,useDeferredValue:function(i,r){var c=At();return ot===null?Lf(c,i,r):Xy(c,ot.memoizedState,i,r)},useTransition:function(){var i=Af(tn)[0],r=At().memoizedState;return[typeof i=="boolean"?i:ml(i),r]},useSyncExternalStore:Ny,useId:sb,useHostTransitionStatus:zf,useFormState:Fy,useActionState:Fy,useOptimistic:function(i,r){var c=At();return ot!==null?Dy(c,ot,i,r):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Ef,useCacheRefresh:ib};lb.useEffectEvent=Ky;function If(i,r,c,u){r=i.memoizedState,c=c(u,r),c=c==null?r:v({},r,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Hf={enqueueSetState:function(i,r,c){i=i._reactInternals;var u=Ks(),p=Bn(u);p.payload=r,c!=null&&(p.callback=c),r=zn(i,p,u),r!==null&&(Ts(r,i,u),ul(r,i,u))},enqueueReplaceState:function(i,r,c){i=i._reactInternals;var u=Ks(),p=Bn(u);p.tag=1,p.payload=r,c!=null&&(p.callback=c),r=zn(i,p,u),r!==null&&(Ts(r,i,u),ul(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var c=Ks(),u=Bn(c);u.tag=2,r!=null&&(u.callback=r),r=zn(i,u,c),r!==null&&(Ts(r,i,c),ul(r,i,c))}};function cb(i,r,c,u,p,_,b){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(u,_,b):r.prototype&&r.prototype.isPureReactComponent?!sl(c,u)||!sl(p,_):!0}function ub(i,r,c,u){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,u),r.state!==i&&Hf.enqueueReplaceState(r,r.state,null)}function qr(i,r){var c=r;if("ref"in r){c={};for(var u in r)u!=="ref"&&(c[u]=r[u])}if(i=i.defaultProps){c===r&&(c=v({},c));for(var p in i)c[p]===void 0&&(c[p]=i[p])}return c}function db(i){tu(i)}function hb(i){console.error(i)}function fb(i){tu(i)}function ju(i,r){try{var c=i.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function mb(i,r,c){try{var u=i.onCaughtError;u(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Ff(i,r,c){return c=Bn(c),c.tag=3,c.payload={element:null},c.callback=function(){ju(i,r)},c}function pb(i){return i=Bn(i),i.tag=3,i}function _b(i,r,c,u){var p=c.type.getDerivedStateFromError;if(typeof p=="function"){var _=u.value;i.payload=function(){return p(_)},i.callback=function(){mb(r,c,u)}}var b=c.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(i.callback=function(){mb(r,c,u),typeof p!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var C=u.stack;this.componentDidCatch(u.value,{componentStack:C!==null?C:""})})}function aE(i,r,c,u,p){if(c.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=c.alternate,r!==null&&qa(r,c,p,!0),c=Hs.current,c!==null){switch(c.tag){case 31:case 13:return ai===null?Bu():c.alternate===null&&xt===0&&(xt=3),c.flags&=-257,c.flags|=65536,c.lanes=p,u===du?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([u]):r.add(u),fm(i,u,p)),!1;case 22:return c.flags|=65536,u===du?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([u]):c.add(u)),fm(i,u,p)),!1}throw Error(n(435,c.tag))}return fm(i,u,p),Bu(),!1}if(Qe)return r=Hs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,u!==of&&(i=Error(n(422),{cause:u}),rl(si(i,c)))):(u!==of&&(r=Error(n(423),{cause:u}),rl(si(r,c))),i=i.current.alternate,i.flags|=65536,p&=-p,i.lanes|=p,u=si(u,c),p=Ff(i.stateNode,u,p),vf(i,p),xt!==4&&(xt=2)),!1;var _=Error(n(520),{cause:u});if(_=si(_,c),jl===null?jl=[_]:jl.push(_),xt!==4&&(xt=2),r===null)return!0;u=si(u,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,i=p&-p,c.lanes|=i,i=Ff(c.stateNode,u,i),vf(c,i),!1;case 1:if(r=c.type,_=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Un===null||!Un.has(_))))return c.flags|=65536,p&=-p,c.lanes|=p,p=pb(p),_b(p,i,c,u),vf(c,p),!1}c=c.return}while(c!==null);return!1}var Uf=Error(n(461)),Lt=!1;function os(i,r,c,u){r.child=i===null?by(r,null,c,u):Br(r,i.child,c,u)}function gb(i,r,c,u,p){c=c.render;var _=r.ref;if("ref"in u){var b={};for(var C in u)C!=="ref"&&(b[C]=u[C])}else b=u;return Rr(r),u=jf(i,r,c,b,_,p),C=Cf(),i!==null&&!Lt?(kf(i,r,p),sn(i,r,p)):(Qe&&C&&rf(r),r.flags|=1,os(i,r,u,p),r.child)}function vb(i,r,c,u,p){if(i===null){var _=c.type;return typeof _=="function"&&!tf(_)&&_.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=_,yb(i,r,_,u,p)):(i=ru(c.type,null,u,r,r.mode,p),i.ref=r.ref,i.return=r,r.child=i)}if(_=i.child,!Zf(i,p)){var b=_.memoizedProps;if(c=c.compare,c=c!==null?c:sl,c(b,u)&&i.ref===r.ref)return sn(i,r,p)}return r.flags|=1,i=Qi(_,u),i.ref=r.ref,i.return=r,r.child=i}function yb(i,r,c,u,p){if(i!==null){var _=i.memoizedProps;if(sl(_,u)&&i.ref===r.ref)if(Lt=!1,r.pendingProps=u=_,Zf(i,p))(i.flags&131072)!==0&&(Lt=!0);else return r.lanes=i.lanes,sn(i,r,p)}return $f(i,r,c,u,p)}function bb(i,r,c,u){var p=u.children,_=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(_=_!==null?_.baseLanes|c:c,i!==null){for(u=r.child=i.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~_}else u=0,r.child=null;return xb(i,r,_,c,u)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&cu(r,_!==null?_.cachePool:null),_!==null?wy(r,_):bf(),jy(r);else return u=r.lanes=536870912,xb(i,r,_!==null?_.baseLanes|c:c,c,u)}else _!==null?(cu(r,_.cachePool),wy(r,_),Pn(),r.memoizedState=null):(i!==null&&cu(r,null),bf(),Pn());return os(i,r,p,c),r.child}function gl(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function xb(i,r,c,u,p){var _=mf();return _=_===null?null:{parent:Dt._currentValue,pool:_},r.memoizedState={baseLanes:c,cachePool:_},i!==null&&cu(r,null),bf(),jy(r),i!==null&&qa(i,r,u,!0),r.childLanes=p,null}function Cu(i,r){return r=Nu({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function Sb(i,r,c){return Br(r,i.child,null,c),i=Cu(r,r.pendingProps),i.flags|=2,Fs(r),r.memoizedState=null,i}function oE(i,r,c){var u=r.pendingProps,p=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(Qe){if(u.mode==="hidden")return i=Cu(r,u),r.lanes=536870912,gl(null,i);if(Sf(r),(i=ft)?(i=Mx(i,ri),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:On!==null?{id:Ni,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},c=ry(i),c.return=r,r.child=c,rs=r,ft=null)):i=null,i===null)throw Dn(r);return r.lanes=536870912,null}return Cu(r,u)}var _=i.memoizedState;if(_!==null){var b=_.dehydrated;if(Sf(r),p)if(r.flags&256)r.flags&=-257,r=Sb(i,r,c);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(n(558));else if(Lt||qa(i,r,c,!1),p=(c&i.childLanes)!==0,Lt||p){if(u=dt,u!==null&&(b=hv(u,c),b!==0&&b!==_.retryLane))throw _.retryLane=b,Er(i,b),Ts(u,i,b),Uf;Bu(),r=Sb(i,r,c)}else i=_.treeContext,ft=oi(b.nextSibling),rs=r,Qe=!0,Rn=null,ri=!1,i!==null&&ly(r,i),r=Cu(r,u),r.flags|=4096;return r}return i=Qi(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function ku(i,r){var c=r.ref;if(c===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(n(284));(i===null||i.ref!==c)&&(r.flags|=4194816)}}function $f(i,r,c,u,p){return Rr(r),c=jf(i,r,c,u,void 0,p),u=Cf(),i!==null&&!Lt?(kf(i,r,p),sn(i,r,p)):(Qe&&u&&rf(r),r.flags|=1,os(i,r,c,p),r.child)}function wb(i,r,c,u,p,_){return Rr(r),r.updateQueue=null,c=ky(r,u,c,p),Cy(i),u=Cf(),i!==null&&!Lt?(kf(i,r,_),sn(i,r,_)):(Qe&&u&&rf(r),r.flags|=1,os(i,r,c,_),r.child)}function jb(i,r,c,u,p){if(Rr(r),r.stateNode===null){var _=Ma,b=c.contextType;typeof b=="object"&&b!==null&&(_=as(b)),_=new c(u,_),r.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Hf,r.stateNode=_,_._reactInternals=r,_=r.stateNode,_.props=u,_.state=r.memoizedState,_.refs={},_f(r),b=c.contextType,_.context=typeof b=="object"&&b!==null?as(b):Ma,_.state=r.memoizedState,b=c.getDerivedStateFromProps,typeof b=="function"&&(If(r,c,b,u),_.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(b=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),b!==_.state&&Hf.enqueueReplaceState(_,_.state,null),hl(r,u,_,p),dl(),_.state=r.memoizedState),typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){_=r.stateNode;var C=r.memoizedProps,R=qr(c,C);_.props=R;var U=_.context,Z=c.contextType;b=Ma,typeof Z=="object"&&Z!==null&&(b=as(Z));var ie=c.getDerivedStateFromProps;Z=typeof ie=="function"||typeof _.getSnapshotBeforeUpdate=="function",C=r.pendingProps!==C,Z||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(C||U!==b)&&ub(r,_,u,b),Ln=!1;var W=r.memoizedState;_.state=W,hl(r,u,_,p),dl(),U=r.memoizedState,C||W!==U||Ln?(typeof ie=="function"&&(If(r,c,ie,u),U=r.memoizedState),(R=Ln||cb(r,c,R,u,W,U,b))?(Z||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(r.flags|=4194308)):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=U),_.props=u,_.state=U,_.context=b,u=R):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{_=r.stateNode,gf(i,r),b=r.memoizedProps,Z=qr(c,b),_.props=Z,ie=r.pendingProps,W=_.context,U=c.contextType,R=Ma,typeof U=="object"&&U!==null&&(R=as(U)),C=c.getDerivedStateFromProps,(U=typeof C=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(b!==ie||W!==R)&&ub(r,_,u,R),Ln=!1,W=r.memoizedState,_.state=W,hl(r,u,_,p),dl();var G=r.memoizedState;b!==ie||W!==G||Ln||i!==null&&i.dependencies!==null&&ou(i.dependencies)?(typeof C=="function"&&(If(r,c,C,u),G=r.memoizedState),(Z=Ln||cb(r,c,Z,u,W,G,R)||i!==null&&i.dependencies!==null&&ou(i.dependencies))?(U||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(u,G,R),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(u,G,R)),typeof _.componentDidUpdate=="function"&&(r.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof _.componentDidUpdate!="function"||b===i.memoizedProps&&W===i.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&W===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=G),_.props=u,_.state=G,_.context=R,u=Z):(typeof _.componentDidUpdate!="function"||b===i.memoizedProps&&W===i.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&W===i.memoizedState||(r.flags|=1024),u=!1)}return _=u,ku(i,r),u=(r.flags&128)!==0,_||u?(_=r.stateNode,c=u&&typeof c.getDerivedStateFromError!="function"?null:_.render(),r.flags|=1,i!==null&&u?(r.child=Br(r,i.child,null,p),r.child=Br(r,null,c,p)):os(i,r,c,p),r.memoizedState=_.state,i=r.child):i=sn(i,r,p),i}function Cb(i,r,c,u){return Ar(),r.flags|=256,os(i,r,c,u),r.child}var Kf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wf(i){return{baseLanes:i,cachePool:my()}}function Vf(i,r,c){return i=i!==null?i.childLanes&~c:0,r&&(i|=$s),i}function kb(i,r,c){var u=r.pendingProps,p=!1,_=(r.flags&128)!==0,b;if((b=_)||(b=i!==null&&i.memoizedState===null?!1:(Tt.current&2)!==0),b&&(p=!0,r.flags&=-129),b=(r.flags&32)!==0,r.flags&=-33,i===null){if(Qe){if(p?qn(r):Pn(),(i=ft)?(i=Mx(i,ri),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:On!==null?{id:Ni,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},c=ry(i),c.return=r,r.child=c,rs=r,ft=null)):i=null,i===null)throw Dn(r);return Tm(i)?r.lanes=32:r.lanes=536870912,null}var C=u.children;return u=u.fallback,p?(Pn(),p=r.mode,C=Nu({mode:"hidden",children:C},p),u=Tr(u,p,c,null),C.return=r,u.return=r,C.sibling=u,r.child=C,u=r.child,u.memoizedState=Wf(c),u.childLanes=Vf(i,b,c),r.memoizedState=Kf,gl(null,u)):(qn(r),Yf(r,C))}var R=i.memoizedState;if(R!==null&&(C=R.dehydrated,C!==null)){if(_)r.flags&256?(qn(r),r.flags&=-257,r=Gf(i,r,c)):r.memoizedState!==null?(Pn(),r.child=i.child,r.flags|=128,r=null):(Pn(),C=u.fallback,p=r.mode,u=Nu({mode:"visible",children:u.children},p),C=Tr(C,p,c,null),C.flags|=2,u.return=r,C.return=r,u.sibling=C,r.child=u,Br(r,i.child,null,c),u=r.child,u.memoizedState=Wf(c),u.childLanes=Vf(i,b,c),r.memoizedState=Kf,r=gl(null,u));else if(qn(r),Tm(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var U=b.dgst;b=U,u=Error(n(419)),u.stack="",u.digest=b,rl({value:u,source:null,stack:null}),r=Gf(i,r,c)}else if(Lt||qa(i,r,c,!1),b=(c&i.childLanes)!==0,Lt||b){if(b=dt,b!==null&&(u=hv(b,c),u!==0&&u!==R.retryLane))throw R.retryLane=u,Er(i,u),Ts(b,i,u),Uf;Em(C)||Bu(),r=Gf(i,r,c)}else Em(C)?(r.flags|=192,r.child=i.child,r=null):(i=R.treeContext,ft=oi(C.nextSibling),rs=r,Qe=!0,Rn=null,ri=!1,i!==null&&ly(r,i),r=Yf(r,u.children),r.flags|=4096);return r}return p?(Pn(),C=u.fallback,p=r.mode,R=i.child,U=R.sibling,u=Qi(R,{mode:"hidden",children:u.children}),u.subtreeFlags=R.subtreeFlags&65011712,U!==null?C=Qi(U,C):(C=Tr(C,p,c,null),C.flags|=2),C.return=r,u.return=r,u.sibling=C,r.child=u,gl(null,u),u=r.child,C=i.child.memoizedState,C===null?C=Wf(c):(p=C.cachePool,p!==null?(R=Dt._currentValue,p=p.parent!==R?{parent:R,pool:R}:p):p=my(),C={baseLanes:C.baseLanes|c,cachePool:p}),u.memoizedState=C,u.childLanes=Vf(i,b,c),r.memoizedState=Kf,gl(i.child,u)):(qn(r),c=i.child,i=c.sibling,c=Qi(c,{mode:"visible",children:u.children}),c.return=r,c.sibling=null,i!==null&&(b=r.deletions,b===null?(r.deletions=[i],r.flags|=16):b.push(i)),r.child=c,r.memoizedState=null,c)}function Yf(i,r){return r=Nu({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function Nu(i,r){return i=Is(22,i,null,r),i.lanes=0,i}function Gf(i,r,c){return Br(r,i.child,null,c),i=Yf(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function Nb(i,r,c){i.lanes|=r;var u=i.alternate;u!==null&&(u.lanes|=r),uf(i.return,r,c)}function Qf(i,r,c,u,p,_){var b=i.memoizedState;b===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:c,tailMode:p,treeForkCount:_}:(b.isBackwards=r,b.rendering=null,b.renderingStartTime=0,b.last=u,b.tail=c,b.tailMode=p,b.treeForkCount=_)}function Eb(i,r,c){var u=r.pendingProps,p=u.revealOrder,_=u.tail;u=u.children;var b=Tt.current,C=(b&2)!==0;if(C?(b=b&1|2,r.flags|=128):b&=1,ce(Tt,b),os(i,r,u,c),u=Qe?nl:0,!C&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Nb(i,c,r);else if(i.tag===19)Nb(i,c,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(p){case"forwards":for(c=r.child,p=null;c!==null;)i=c.alternate,i!==null&&pu(i)===null&&(p=c),c=c.sibling;c=p,c===null?(p=r.child,r.child=null):(p=c.sibling,c.sibling=null),Qf(r,!1,p,c,_,u);break;case"backwards":case"unstable_legacy-backwards":for(c=null,p=r.child,r.child=null;p!==null;){if(i=p.alternate,i!==null&&pu(i)===null){r.child=p;break}i=p.sibling,p.sibling=c,c=p,p=i}Qf(r,!0,c,null,_,u);break;case"together":Qf(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function sn(i,r,c){if(i!==null&&(r.dependencies=i.dependencies),Fn|=r.lanes,(c&r.childLanes)===0)if(i!==null){if(qa(i,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(n(153));if(r.child!==null){for(i=r.child,c=Qi(i,i.pendingProps),r.child=c,c.return=r;i.sibling!==null;)i=i.sibling,c=c.sibling=Qi(i,i.pendingProps),c.return=r;c.sibling=null}return r.child}function Zf(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&ou(i)))}function lE(i,r,c){switch(r.tag){case 3:Et(r,r.stateNode.containerInfo),Mn(r,Dt,i.memoizedState.cache),Ar();break;case 27:case 5:Ls(r);break;case 4:Et(r,r.stateNode.containerInfo);break;case 10:Mn(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Sf(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(qn(r),r.flags|=128,null):(c&r.child.childLanes)!==0?kb(i,r,c):(qn(r),i=sn(i,r,c),i!==null?i.sibling:null);qn(r);break;case 19:var p=(i.flags&128)!==0;if(u=(c&r.childLanes)!==0,u||(qa(i,r,c,!1),u=(c&r.childLanes)!==0),p){if(u)return Eb(i,r,c);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),ce(Tt,Tt.current),u)break;return null;case 22:return r.lanes=0,bb(i,r,c,r.pendingProps);case 24:Mn(r,Dt,i.memoizedState.cache)}return sn(i,r,c)}function Tb(i,r,c){if(i!==null)if(i.memoizedProps!==r.pendingProps)Lt=!0;else{if(!Zf(i,c)&&(r.flags&128)===0)return Lt=!1,lE(i,r,c);Lt=(i.flags&131072)!==0}else Lt=!1,Qe&&(r.flags&1048576)!==0&&oy(r,nl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=Mr(r.elementType),r.type=i,typeof i=="function")tf(i)?(u=qr(i,u),r.tag=1,r=jb(null,r,i,u,c)):(r.tag=0,r=$f(null,r,i,u,c));else{if(i!=null){var p=i.$$typeof;if(p===N){r.tag=11,r=gb(null,r,i,u,c);break e}else if(p===ee){r.tag=14,r=vb(null,r,i,u,c);break e}}throw r=se(i)||i,Error(n(306,r,""))}}return r;case 0:return $f(i,r,r.type,r.pendingProps,c);case 1:return u=r.type,p=qr(u,r.pendingProps),jb(i,r,u,p,c);case 3:e:{if(Et(r,r.stateNode.containerInfo),i===null)throw Error(n(387));u=r.pendingProps;var _=r.memoizedState;p=_.element,gf(i,r),hl(r,u,null,c);var b=r.memoizedState;if(u=b.cache,Mn(r,Dt,u),u!==_.cache&&df(r,[Dt],c,!0),dl(),u=b.element,_.isDehydrated)if(_={element:u,isDehydrated:!1,cache:b.cache},r.updateQueue.baseState=_,r.memoizedState=_,r.flags&256){r=Cb(i,r,u,c);break e}else if(u!==p){p=si(Error(n(424)),r),rl(p),r=Cb(i,r,u,c);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(ft=oi(i.firstChild),rs=r,Qe=!0,Rn=null,ri=!0,c=by(r,null,u,c),r.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Ar(),u===p){r=sn(i,r,c);break e}os(i,r,u,c)}r=r.child}return r;case 26:return ku(i,r),i===null?(c=Ix(r.type,null,r.pendingProps,null))?r.memoizedState=c:Qe||(c=r.type,i=r.pendingProps,u=Uu(xe.current).createElement(c),u[ns]=r,u[ws]=i,ls(u,c,i),Gt(u),r.stateNode=u):r.memoizedState=Ix(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ls(r),i===null&&Qe&&(u=r.stateNode=zx(r.type,r.pendingProps,xe.current),rs=r,ri=!0,p=ft,Vn(r.type)?(Am=p,ft=oi(u.firstChild)):ft=p),os(i,r,r.pendingProps.children,c),ku(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&Qe&&((p=u=ft)&&(u=qE(u,r.type,r.pendingProps,ri),u!==null?(r.stateNode=u,rs=r,ft=oi(u.firstChild),ri=!1,p=!0):p=!1),p||Dn(r)),Ls(r),p=r.type,_=r.pendingProps,b=i!==null?i.memoizedProps:null,u=_.children,Cm(p,_)?u=null:b!==null&&Cm(p,b)&&(r.flags|=32),r.memoizedState!==null&&(p=jf(i,r,JN,null,null,c),Rl._currentValue=p),ku(i,r),os(i,r,u,c),r.child;case 6:return i===null&&Qe&&((i=c=ft)&&(c=PE(c,r.pendingProps,ri),c!==null?(r.stateNode=c,rs=r,ft=null,i=!0):i=!1),i||Dn(r)),null;case 13:return kb(i,r,c);case 4:return Et(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=Br(r,null,u,c):os(i,r,u,c),r.child;case 11:return gb(i,r,r.type,r.pendingProps,c);case 7:return os(i,r,r.pendingProps,c),r.child;case 8:return os(i,r,r.pendingProps.children,c),r.child;case 12:return os(i,r,r.pendingProps.children,c),r.child;case 10:return u=r.pendingProps,Mn(r,r.type,u.value),os(i,r,u.children,c),r.child;case 9:return p=r.type._context,u=r.pendingProps.children,Rr(r),p=as(p),u=u(p),r.flags|=1,os(i,r,u,c),r.child;case 14:return vb(i,r,r.type,r.pendingProps,c);case 15:return yb(i,r,r.type,r.pendingProps,c);case 19:return Eb(i,r,c);case 31:return oE(i,r,c);case 22:return bb(i,r,c,r.pendingProps);case 24:return Rr(r),u=as(Dt),i===null?(p=mf(),p===null&&(p=dt,_=hf(),p.pooledCache=_,_.refCount++,_!==null&&(p.pooledCacheLanes|=c),p=_),r.memoizedState={parent:u,cache:p},_f(r),Mn(r,Dt,p)):((i.lanes&c)!==0&&(gf(i,r),hl(r,null,null,c),dl()),p=i.memoizedState,_=r.memoizedState,p.parent!==u?(p={parent:u,cache:u},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),Mn(r,Dt,u)):(u=_.cache,Mn(r,Dt,u),u!==p.cache&&df(r,[Dt],c,!0))),os(i,r,r.pendingProps.children,c),r.child;case 29:throw r.pendingProps}throw Error(n(156,r.tag))}function nn(i){i.flags|=4}function Xf(i,r,c,u,p){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(p&335544128)===p)if(i.stateNode.complete)i.flags|=8192;else if(sx())i.flags|=8192;else throw Lr=du,pf}else i.flags&=-16777217}function Ab(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Kx(r))if(sx())i.flags|=8192;else throw Lr=du,pf}function Eu(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?cv():536870912,i.lanes|=r,Qa|=r)}function vl(i,r){if(!Qe)switch(i.tailMode){case"hidden":r=i.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var u=null;c!==null;)c.alternate!==null&&(u=c),c=c.sibling;u===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:u.sibling=null}}function mt(i){var r=i.alternate!==null&&i.alternate.child===i.child,c=0,u=0;if(r)for(var p=i.child;p!==null;)c|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=i,p=p.sibling;else for(p=i.child;p!==null;)c|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=i,p=p.sibling;return i.subtreeFlags|=u,i.childLanes=c,r}function cE(i,r,c){var u=r.pendingProps;switch(af(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(r),null;case 1:return mt(r),null;case 3:return c=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),Ji(Dt),Xe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(za(r)?nn(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,lf())),mt(r),null;case 26:var p=r.type,_=r.memoizedState;return i===null?(nn(r),_!==null?(mt(r),Ab(r,_)):(mt(r),Xf(r,p,null,u,c))):_?_!==i.memoizedState?(nn(r),mt(r),Ab(r,_)):(mt(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&nn(r),mt(r),Xf(r,p,i,u,c)),null;case 27:if(ki(r),c=xe.current,p=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&nn(r);else{if(!u){if(r.stateNode===null)throw Error(n(166));return mt(r),null}i=Y.current,za(r)?cy(r):(i=zx(p,u,c),r.stateNode=i,nn(r))}return mt(r),null;case 5:if(ki(r),p=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&nn(r);else{if(!u){if(r.stateNode===null)throw Error(n(166));return mt(r),null}if(_=Y.current,za(r))cy(r);else{var b=Uu(xe.current);switch(_){case 1:_=b.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:_=b.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":_=b.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":_=b.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":_=b.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof u.is=="string"?b.createElement("select",{is:u.is}):b.createElement("select"),u.multiple?_.multiple=!0:u.size&&(_.size=u.size);break;default:_=typeof u.is=="string"?b.createElement(p,{is:u.is}):b.createElement(p)}}_[ns]=r,_[ws]=u;e:for(b=r.child;b!==null;){if(b.tag===5||b.tag===6)_.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===r)break e;for(;b.sibling===null;){if(b.return===null||b.return===r)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}r.stateNode=_;e:switch(ls(_,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&nn(r)}}return mt(r),Xf(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,c),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&nn(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(n(166));if(i=xe.current,za(r)){if(i=r.stateNode,c=r.memoizedProps,u=null,p=rs,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}i[ns]=r,i=!!(i.nodeValue===c||u!==null&&u.suppressHydrationWarning===!0||kx(i.nodeValue,c)),i||Dn(r,!0)}else i=Uu(i).createTextNode(u),i[ns]=r,r.stateNode=i}return mt(r),null;case 31:if(c=r.memoizedState,i===null||i.memoizedState!==null){if(u=za(r),c!==null){if(i===null){if(!u)throw Error(n(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(557));i[ns]=r}else Ar(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mt(r),i=!1}else c=lf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return r.flags&256?(Fs(r),r):(Fs(r),null);if((r.flags&128)!==0)throw Error(n(558))}return mt(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(p=za(r),u!==null&&u.dehydrated!==null){if(i===null){if(!p)throw Error(n(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(n(317));p[ns]=r}else Ar(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mt(r),p=!1}else p=lf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(Fs(r),r):(Fs(r),null)}return Fs(r),(r.flags&128)!==0?(r.lanes=c,r):(c=u!==null,i=i!==null&&i.memoizedState!==null,c&&(u=r.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),_=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(_=u.memoizedState.cachePool.pool),_!==p&&(u.flags|=2048)),c!==i&&c&&(r.child.flags|=8192),Eu(r,r.updateQueue),mt(r),null);case 4:return Xe(),i===null&&bm(r.stateNode.containerInfo),mt(r),null;case 10:return Ji(r.type),mt(r),null;case 19:if(X(Tt),u=r.memoizedState,u===null)return mt(r),null;if(p=(r.flags&128)!==0,_=u.rendering,_===null)if(p)vl(u,!1);else{if(xt!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(_=pu(i),_!==null){for(r.flags|=128,vl(u,!1),i=_.updateQueue,r.updateQueue=i,Eu(r,i),r.subtreeFlags=0,i=c,c=r.child;c!==null;)ny(c,i),c=c.sibling;return ce(Tt,Tt.current&1|2),Qe&&Zi(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&Bs()>Du&&(r.flags|=128,p=!0,vl(u,!1),r.lanes=4194304)}else{if(!p)if(i=pu(_),i!==null){if(r.flags|=128,p=!0,i=i.updateQueue,r.updateQueue=i,Eu(r,i),vl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!_.alternate&&!Qe)return mt(r),null}else 2*Bs()-u.renderingStartTime>Du&&c!==536870912&&(r.flags|=128,p=!0,vl(u,!1),r.lanes=4194304);u.isBackwards?(_.sibling=r.child,r.child=_):(i=u.last,i!==null?i.sibling=_:r.child=_,u.last=_)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=Bs(),i.sibling=null,c=Tt.current,ce(Tt,p?c&1|2:c&1),Qe&&Zi(r,u.treeForkCount),i):(mt(r),null);case 22:case 23:return Fs(r),xf(),u=r.memoizedState!==null,i!==null?i.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(c&536870912)!==0&&(r.flags&128)===0&&(mt(r),r.subtreeFlags&6&&(r.flags|=8192)):mt(r),c=r.updateQueue,c!==null&&Eu(r,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==c&&(r.flags|=2048),i!==null&&X(Dr),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Ji(Dt),mt(r),null;case 25:return null;case 30:return null}throw Error(n(156,r.tag))}function uE(i,r){switch(af(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return Ji(Dt),Xe(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return ki(r),null;case 31:if(r.memoizedState!==null){if(Fs(r),r.alternate===null)throw Error(n(340));Ar()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(Fs(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(n(340));Ar()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return X(Tt),null;case 4:return Xe(),null;case 10:return Ji(r.type),null;case 22:case 23:return Fs(r),xf(),i!==null&&X(Dr),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return Ji(Dt),null;case 25:return null;default:return null}}function Ob(i,r){switch(af(r),r.tag){case 3:Ji(Dt),Xe();break;case 26:case 27:case 5:ki(r);break;case 4:Xe();break;case 31:r.memoizedState!==null&&Fs(r);break;case 13:Fs(r);break;case 19:X(Tt);break;case 10:Ji(r.type);break;case 22:case 23:Fs(r),xf(),i!==null&&X(Dr);break;case 24:Ji(Dt)}}function yl(i,r){try{var c=r.updateQueue,u=c!==null?c.lastEffect:null;if(u!==null){var p=u.next;c=p;do{if((c.tag&i)===i){u=void 0;var _=c.create,b=c.inst;u=_(),b.destroy=u}c=c.next}while(c!==p)}}catch(C){at(r,r.return,C)}}function In(i,r,c){try{var u=r.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var _=p.next;u=_;do{if((u.tag&i)===i){var b=u.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,p=r;var R=c,U=C;try{U()}catch(Z){at(p,R,Z)}}}u=u.next}while(u!==_)}}catch(Z){at(r,r.return,Z)}}function Rb(i){var r=i.updateQueue;if(r!==null){var c=i.stateNode;try{Sy(r,c)}catch(u){at(i,i.return,u)}}}function Db(i,r,c){c.props=qr(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(u){at(i,r,u)}}function bl(i,r){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var u=i.stateNode;break;case 30:u=i.stateNode;break;default:u=i.stateNode}typeof c=="function"?i.refCleanup=c(u):c.current=u}}catch(p){at(i,r,p)}}function Ti(i,r){var c=i.ref,u=i.refCleanup;if(c!==null)if(typeof u=="function")try{u()}catch(p){at(i,r,p)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(p){at(i,r,p)}else c.current=null}function Mb(i){var r=i.type,c=i.memoizedProps,u=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&u.focus();break e;case"img":c.src?u.src=c.src:c.srcSet&&(u.srcset=c.srcSet)}}catch(p){at(i,i.return,p)}}function Jf(i,r,c){try{var u=i.stateNode;RE(u,i.type,c,r),u[ws]=r}catch(p){at(i,i.return,p)}}function Lb(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Vn(i.type)||i.tag===4}function em(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Lb(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Vn(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function tm(i,r,c){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(i),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=Yi));else if(u!==4&&(u===27&&Vn(i.type)&&(c=i.stateNode,r=null),i=i.child,i!==null))for(tm(i,r,c),i=i.sibling;i!==null;)tm(i,r,c),i=i.sibling}function Tu(i,r,c){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?c.insertBefore(i,r):c.appendChild(i);else if(u!==4&&(u===27&&Vn(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(Tu(i,r,c),i=i.sibling;i!==null;)Tu(i,r,c),i=i.sibling}function Bb(i){var r=i.stateNode,c=i.memoizedProps;try{for(var u=i.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);ls(r,u,c),r[ns]=i,r[ws]=c}catch(_){at(i,i.return,_)}}var rn=!1,Bt=!1,sm=!1,zb=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function dE(i,r){if(i=i.containerInfo,wm=Qu,i=Gv(i),Yh(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var u=c.getSelection&&c.getSelection();if(u&&u.rangeCount!==0){c=u.anchorNode;var p=u.anchorOffset,_=u.focusNode;u=u.focusOffset;try{c.nodeType,_.nodeType}catch{c=null;break e}var b=0,C=-1,R=-1,U=0,Z=0,ie=i,W=null;t:for(;;){for(var G;ie!==c||p!==0&&ie.nodeType!==3||(C=b+p),ie!==_||u!==0&&ie.nodeType!==3||(R=b+u),ie.nodeType===3&&(b+=ie.nodeValue.length),(G=ie.firstChild)!==null;)W=ie,ie=G;for(;;){if(ie===i)break t;if(W===c&&++U===p&&(C=b),W===_&&++Z===u&&(R=b),(G=ie.nextSibling)!==null)break;ie=W,W=ie.parentNode}ie=G}c=C===-1||R===-1?null:{start:C,end:R}}else c=null}c=c||{start:0,end:0}}else c=null;for(jm={focusedElem:i,selectionRange:c},Qu=!1,Qt=r;Qt!==null;)if(r=Qt,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Qt=i;else for(;Qt!==null;){switch(r=Qt,_=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)p=i[c],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&_!==null){i=void 0,c=r,p=_.memoizedProps,_=_.memoizedState,u=c.stateNode;try{var ye=qr(c.type,p);i=u.getSnapshotBeforeUpdate(ye,_),u.__reactInternalSnapshotBeforeUpdate=i}catch(Ee){at(c,c.return,Ee)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,c=i.nodeType,c===9)Nm(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Nm(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(n(163))}if(i=r.sibling,i!==null){i.return=r.return,Qt=i;break}Qt=r.return}}function qb(i,r,c){var u=c.flags;switch(c.tag){case 0:case 11:case 15:on(i,c),u&4&&yl(5,c);break;case 1:if(on(i,c),u&4)if(i=c.stateNode,r===null)try{i.componentDidMount()}catch(b){at(c,c.return,b)}else{var p=qr(c.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(p,r,i.__reactInternalSnapshotBeforeUpdate)}catch(b){at(c,c.return,b)}}u&64&&Rb(c),u&512&&bl(c,c.return);break;case 3:if(on(i,c),u&64&&(i=c.updateQueue,i!==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{Sy(i,r)}catch(b){at(c,c.return,b)}}break;case 27:r===null&&u&4&&Bb(c);case 26:case 5:on(i,c),r===null&&u&4&&Mb(c),u&512&&bl(c,c.return);break;case 12:on(i,c);break;case 31:on(i,c),u&4&&Hb(i,c);break;case 13:on(i,c),u&4&&Fb(i,c),u&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=bE.bind(null,c),IE(i,c))));break;case 22:if(u=c.memoizedState!==null||rn,!u){r=r!==null&&r.memoizedState!==null||Bt,p=rn;var _=Bt;rn=u,(Bt=r)&&!_?ln(i,c,(c.subtreeFlags&8772)!==0):on(i,c),rn=p,Bt=_}break;case 30:break;default:on(i,c)}}function Pb(i){var r=i.alternate;r!==null&&(i.alternate=null,Pb(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&Oh(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var _t=null,Cs=!1;function an(i,r,c){for(c=c.child;c!==null;)Ib(i,r,c),c=c.sibling}function Ib(i,r,c){if(zs&&typeof zs.onCommitFiberUnmount=="function")try{zs.onCommitFiberUnmount($o,c)}catch{}switch(c.tag){case 26:Bt||Ti(c,r),an(i,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Bt||Ti(c,r);var u=_t,p=Cs;Vn(c.type)&&(_t=c.stateNode,Cs=!1),an(i,r,c),Tl(c.stateNode),_t=u,Cs=p;break;case 5:Bt||Ti(c,r);case 6:if(u=_t,p=Cs,_t=null,an(i,r,c),_t=u,Cs=p,_t!==null)if(Cs)try{(_t.nodeType===9?_t.body:_t.nodeName==="HTML"?_t.ownerDocument.body:_t).removeChild(c.stateNode)}catch(_){at(c,r,_)}else try{_t.removeChild(c.stateNode)}catch(_){at(c,r,_)}break;case 18:_t!==null&&(Cs?(i=_t,Rx(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),no(i)):Rx(_t,c.stateNode));break;case 4:u=_t,p=Cs,_t=c.stateNode.containerInfo,Cs=!0,an(i,r,c),_t=u,Cs=p;break;case 0:case 11:case 14:case 15:In(2,c,r),Bt||In(4,c,r),an(i,r,c);break;case 1:Bt||(Ti(c,r),u=c.stateNode,typeof u.componentWillUnmount=="function"&&Db(c,r,u)),an(i,r,c);break;case 21:an(i,r,c);break;case 22:Bt=(u=Bt)||c.memoizedState!==null,an(i,r,c),Bt=u;break;default:an(i,r,c)}}function Hb(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{no(i)}catch(c){at(r,r.return,c)}}}function Fb(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{no(i)}catch(c){at(r,r.return,c)}}function hE(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new zb),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new zb),r;default:throw Error(n(435,i.tag))}}function Au(i,r){var c=hE(i);r.forEach(function(u){if(!c.has(u)){c.add(u);var p=xE.bind(null,i,u);u.then(p,p)}})}function ks(i,r){var c=r.deletions;if(c!==null)for(var u=0;u<c.length;u++){var p=c[u],_=i,b=r,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(Vn(C.type)){_t=C.stateNode,Cs=!1;break e}break;case 5:_t=C.stateNode,Cs=!1;break e;case 3:case 4:_t=C.stateNode.containerInfo,Cs=!0;break e}C=C.return}if(_t===null)throw Error(n(160));Ib(_,b,p),_t=null,Cs=!1,_=p.alternate,_!==null&&(_.return=null),p.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Ub(r,i),r=r.sibling}var bi=null;function Ub(i,r){var c=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:ks(r,i),Ns(i),u&4&&(In(3,i,i.return),yl(3,i),In(5,i,i.return));break;case 1:ks(r,i),Ns(i),u&512&&(Bt||c===null||Ti(c,c.return)),u&64&&rn&&(i=i.updateQueue,i!==null&&(u=i.callbacks,u!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?u:c.concat(u))));break;case 26:var p=bi;if(ks(r,i),Ns(i),u&512&&(Bt||c===null||Ti(c,c.return)),u&4){var _=c!==null?c.memoizedState:null;if(u=i.memoizedState,c===null)if(u===null)if(i.stateNode===null){e:{u=i.type,c=i.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":_=p.getElementsByTagName("title")[0],(!_||_[Vo]||_[ns]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=p.createElement(u),p.head.insertBefore(_,p.querySelector("head > title"))),ls(_,u,c),_[ns]=i,Gt(_),u=_;break e;case"link":var b=Ux("link","href",p).get(u+(c.href||""));if(b){for(var C=0;C<b.length;C++)if(_=b[C],_.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&_.getAttribute("rel")===(c.rel==null?null:c.rel)&&_.getAttribute("title")===(c.title==null?null:c.title)&&_.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){b.splice(C,1);break t}}_=p.createElement(u),ls(_,u,c),p.head.appendChild(_);break;case"meta":if(b=Ux("meta","content",p).get(u+(c.content||""))){for(C=0;C<b.length;C++)if(_=b[C],_.getAttribute("content")===(c.content==null?null:""+c.content)&&_.getAttribute("name")===(c.name==null?null:c.name)&&_.getAttribute("property")===(c.property==null?null:c.property)&&_.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&_.getAttribute("charset")===(c.charSet==null?null:c.charSet)){b.splice(C,1);break t}}_=p.createElement(u),ls(_,u,c),p.head.appendChild(_);break;default:throw Error(n(468,u))}_[ns]=i,Gt(_),u=_}i.stateNode=u}else $x(p,i.type,i.stateNode);else i.stateNode=Fx(p,u,i.memoizedProps);else _!==u?(_===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):_.count--,u===null?$x(p,i.type,i.stateNode):Fx(p,u,i.memoizedProps)):u===null&&i.stateNode!==null&&Jf(i,i.memoizedProps,c.memoizedProps)}break;case 27:ks(r,i),Ns(i),u&512&&(Bt||c===null||Ti(c,c.return)),c!==null&&u&4&&Jf(i,i.memoizedProps,c.memoizedProps);break;case 5:if(ks(r,i),Ns(i),u&512&&(Bt||c===null||Ti(c,c.return)),i.flags&32){p=i.stateNode;try{Na(p,"")}catch(ye){at(i,i.return,ye)}}u&4&&i.stateNode!=null&&(p=i.memoizedProps,Jf(i,p,c!==null?c.memoizedProps:p)),u&1024&&(sm=!0);break;case 6:if(ks(r,i),Ns(i),u&4){if(i.stateNode===null)throw Error(n(162));u=i.memoizedProps,c=i.stateNode;try{c.nodeValue=u}catch(ye){at(i,i.return,ye)}}break;case 3:if(Wu=null,p=bi,bi=$u(r.containerInfo),ks(r,i),bi=p,Ns(i),u&4&&c!==null&&c.memoizedState.isDehydrated)try{no(r.containerInfo)}catch(ye){at(i,i.return,ye)}sm&&(sm=!1,$b(i));break;case 4:u=bi,bi=$u(i.stateNode.containerInfo),ks(r,i),Ns(i),bi=u;break;case 12:ks(r,i),Ns(i);break;case 31:ks(r,i),Ns(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,Au(i,u)));break;case 13:ks(r,i),Ns(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Ru=Bs()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,Au(i,u)));break;case 22:p=i.memoizedState!==null;var R=c!==null&&c.memoizedState!==null,U=rn,Z=Bt;if(rn=U||p,Bt=Z||R,ks(r,i),Bt=Z,rn=U,Ns(i),u&8192)e:for(r=i.stateNode,r._visibility=p?r._visibility&-2:r._visibility|1,p&&(c===null||R||rn||Bt||Pr(i)),c=null,r=i;;){if(r.tag===5||r.tag===26){if(c===null){R=c=r;try{if(_=R.stateNode,p)b=_.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=R.stateNode;var ie=R.memoizedProps.style,W=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;C.style.display=W==null||typeof W=="boolean"?"":(""+W).trim()}}catch(ye){at(R,R.return,ye)}}}else if(r.tag===6){if(c===null){R=r;try{R.stateNode.nodeValue=p?"":R.memoizedProps}catch(ye){at(R,R.return,ye)}}}else if(r.tag===18){if(c===null){R=r;try{var G=R.stateNode;p?Dx(G,!0):Dx(R.stateNode,!1)}catch(ye){at(R,R.return,ye)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;c===r&&(c=null),r=r.return}c===r&&(c=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=i.updateQueue,u!==null&&(c=u.retryQueue,c!==null&&(u.retryQueue=null,Au(i,c))));break;case 19:ks(r,i),Ns(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,Au(i,u)));break;case 30:break;case 21:break;default:ks(r,i),Ns(i)}}function Ns(i){var r=i.flags;if(r&2){try{for(var c,u=i.return;u!==null;){if(Lb(u)){c=u;break}u=u.return}if(c==null)throw Error(n(160));switch(c.tag){case 27:var p=c.stateNode,_=em(i);Tu(i,_,p);break;case 5:var b=c.stateNode;c.flags&32&&(Na(b,""),c.flags&=-33);var C=em(i);Tu(i,C,b);break;case 3:case 4:var R=c.stateNode.containerInfo,U=em(i);tm(i,U,R);break;default:throw Error(n(161))}}catch(Z){at(i,i.return,Z)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function $b(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;$b(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function on(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)qb(i,r.alternate,r),r=r.sibling}function Pr(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:In(4,r,r.return),Pr(r);break;case 1:Ti(r,r.return);var c=r.stateNode;typeof c.componentWillUnmount=="function"&&Db(r,r.return,c),Pr(r);break;case 27:Tl(r.stateNode);case 26:case 5:Ti(r,r.return),Pr(r);break;case 22:r.memoizedState===null&&Pr(r);break;case 30:Pr(r);break;default:Pr(r)}i=i.sibling}}function ln(i,r,c){for(c=c&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,p=i,_=r,b=_.flags;switch(_.tag){case 0:case 11:case 15:ln(p,_,c),yl(4,_);break;case 1:if(ln(p,_,c),u=_,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(U){at(u,u.return,U)}if(u=_,p=u.updateQueue,p!==null){var C=u.stateNode;try{var R=p.shared.hiddenCallbacks;if(R!==null)for(p.shared.hiddenCallbacks=null,p=0;p<R.length;p++)xy(R[p],C)}catch(U){at(u,u.return,U)}}c&&b&64&&Rb(_),bl(_,_.return);break;case 27:Bb(_);case 26:case 5:ln(p,_,c),c&&u===null&&b&4&&Mb(_),bl(_,_.return);break;case 12:ln(p,_,c);break;case 31:ln(p,_,c),c&&b&4&&Hb(p,_);break;case 13:ln(p,_,c),c&&b&4&&Fb(p,_);break;case 22:_.memoizedState===null&&ln(p,_,c),bl(_,_.return);break;case 30:break;default:ln(p,_,c)}r=r.sibling}}function im(i,r){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&al(c))}function nm(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&al(i))}function xi(i,r,c,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Kb(i,r,c,u),r=r.sibling}function Kb(i,r,c,u){var p=r.flags;switch(r.tag){case 0:case 11:case 15:xi(i,r,c,u),p&2048&&yl(9,r);break;case 1:xi(i,r,c,u);break;case 3:xi(i,r,c,u),p&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&al(i)));break;case 12:if(p&2048){xi(i,r,c,u),i=r.stateNode;try{var _=r.memoizedProps,b=_.id,C=_.onPostCommit;typeof C=="function"&&C(b,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(R){at(r,r.return,R)}}else xi(i,r,c,u);break;case 31:xi(i,r,c,u);break;case 13:xi(i,r,c,u);break;case 23:break;case 22:_=r.stateNode,b=r.alternate,r.memoizedState!==null?_._visibility&2?xi(i,r,c,u):xl(i,r):_._visibility&2?xi(i,r,c,u):(_._visibility|=2,Va(i,r,c,u,(r.subtreeFlags&10256)!==0||!1)),p&2048&&im(b,r);break;case 24:xi(i,r,c,u),p&2048&&nm(r.alternate,r);break;default:xi(i,r,c,u)}}function Va(i,r,c,u,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var _=i,b=r,C=c,R=u,U=b.flags;switch(b.tag){case 0:case 11:case 15:Va(_,b,C,R,p),yl(8,b);break;case 23:break;case 22:var Z=b.stateNode;b.memoizedState!==null?Z._visibility&2?Va(_,b,C,R,p):xl(_,b):(Z._visibility|=2,Va(_,b,C,R,p)),p&&U&2048&&im(b.alternate,b);break;case 24:Va(_,b,C,R,p),p&&U&2048&&nm(b.alternate,b);break;default:Va(_,b,C,R,p)}r=r.sibling}}function xl(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=i,u=r,p=u.flags;switch(u.tag){case 22:xl(c,u),p&2048&&im(u.alternate,u);break;case 24:xl(c,u),p&2048&&nm(u.alternate,u);break;default:xl(c,u)}r=r.sibling}}var Sl=8192;function Ya(i,r,c){if(i.subtreeFlags&Sl)for(i=i.child;i!==null;)Wb(i,r,c),i=i.sibling}function Wb(i,r,c){switch(i.tag){case 26:Ya(i,r,c),i.flags&Sl&&i.memoizedState!==null&&XE(c,bi,i.memoizedState,i.memoizedProps);break;case 5:Ya(i,r,c);break;case 3:case 4:var u=bi;bi=$u(i.stateNode.containerInfo),Ya(i,r,c),bi=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=Sl,Sl=16777216,Ya(i,r,c),Sl=u):Ya(i,r,c));break;default:Ya(i,r,c)}}function Vb(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function wl(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var u=r[c];Qt=u,Gb(u,i)}Vb(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Yb(i),i=i.sibling}function Yb(i){switch(i.tag){case 0:case 11:case 15:wl(i),i.flags&2048&&In(9,i,i.return);break;case 3:wl(i);break;case 12:wl(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,Ou(i)):wl(i);break;default:wl(i)}}function Ou(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var u=r[c];Qt=u,Gb(u,i)}Vb(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:In(8,r,r.return),Ou(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,Ou(r));break;default:Ou(r)}i=i.sibling}}function Gb(i,r){for(;Qt!==null;){var c=Qt;switch(c.tag){case 0:case 11:case 15:In(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var u=c.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:al(c.memoizedState.cache)}if(u=c.child,u!==null)u.return=c,Qt=u;else e:for(c=i;Qt!==null;){u=Qt;var p=u.sibling,_=u.return;if(Pb(u),u===c){Qt=null;break e}if(p!==null){p.return=_,Qt=p;break e}Qt=_}}}var fE={getCacheForType:function(i){var r=as(Dt),c=r.data.get(i);return c===void 0&&(c=i(),r.data.set(i,c)),c},cacheSignal:function(){return as(Dt).controller.signal}},mE=typeof WeakMap=="function"?WeakMap:Map,it=0,dt=null,Ke=null,Ve=0,rt=0,Us=null,Hn=!1,Ga=!1,rm=!1,cn=0,xt=0,Fn=0,Ir=0,am=0,$s=0,Qa=0,jl=null,Es=null,om=!1,Ru=0,Qb=0,Du=1/0,Mu=null,Un=null,Ut=0,$n=null,Za=null,un=0,lm=0,cm=null,Zb=null,Cl=0,um=null;function Ks(){return(it&2)!==0&&Ve!==0?Ve&-Ve:q.T!==null?_m():fv()}function Xb(){if($s===0)if((Ve&536870912)===0||Qe){var i=Fc;Fc<<=1,(Fc&3932160)===0&&(Fc=262144),$s=i}else $s=536870912;return i=Hs.current,i!==null&&(i.flags|=32),$s}function Ts(i,r,c){(i===dt&&(rt===2||rt===9)||i.cancelPendingCommit!==null)&&(Xa(i,0),Kn(i,Ve,$s,!1)),Wo(i,c),((it&2)===0||i!==dt)&&(i===dt&&((it&2)===0&&(Ir|=c),xt===4&&Kn(i,Ve,$s,!1)),Ai(i))}function Jb(i,r,c){if((it&6)!==0)throw Error(n(327));var u=!c&&(r&127)===0&&(r&i.expiredLanes)===0||Ko(i,r),p=u?gE(i,r):hm(i,r,!0),_=u;do{if(p===0){Ga&&!u&&Kn(i,r,0,!1);break}else{if(c=i.current.alternate,_&&!pE(c)){p=hm(i,r,!1),_=!1;continue}if(p===2){if(_=r,i.errorRecoveryDisabledLanes&_)var b=0;else b=i.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){r=b;e:{var C=i;p=jl;var R=C.current.memoizedState.isDehydrated;if(R&&(Xa(C,b).flags|=256),b=hm(C,b,!1),b!==2){if(rm&&!R){C.errorRecoveryDisabledLanes|=_,Ir|=_,p=4;break e}_=Es,Es=p,_!==null&&(Es===null?Es=_:Es.push.apply(Es,_))}p=b}if(_=!1,p!==2)continue}}if(p===1){Xa(i,0),Kn(i,r,0,!0);break}e:{switch(u=i,_=p,_){case 0:case 1:throw Error(n(345));case 4:if((r&4194048)!==r)break;case 6:Kn(u,r,$s,!Hn);break e;case 2:Es=null;break;case 3:case 5:break;default:throw Error(n(329))}if((r&62914560)===r&&(p=Ru+300-Bs(),10<p)){if(Kn(u,r,$s,!Hn),$c(u,0,!0)!==0)break e;un=r,u.timeoutHandle=Ax(ex.bind(null,u,c,Es,Mu,om,r,$s,Ir,Qa,Hn,_,"Throttled",-0,0),p);break e}ex(u,c,Es,Mu,om,r,$s,Ir,Qa,Hn,_,null,-0,0)}}break}while(!0);Ai(i)}function ex(i,r,c,u,p,_,b,C,R,U,Z,ie,W,G){if(i.timeoutHandle=-1,ie=r.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yi},Wb(r,_,ie);var ye=(_&62914560)===_?Ru-Bs():(_&4194048)===_?Qb-Bs():0;if(ye=JE(ie,ye),ye!==null){un=_,i.cancelPendingCommit=ye(lx.bind(null,i,r,_,c,u,p,b,C,R,Z,ie,null,W,G)),Kn(i,_,b,!U);return}}lx(i,r,_,c,u,p,b,C,R)}function pE(i){for(var r=i;;){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 u=0;u<c.length;u++){var p=c[u],_=p.getSnapshot;p=p.value;try{if(!Ps(_(),p))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Kn(i,r,c,u){r&=~am,r&=~Ir,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var p=r;0<p;){var _=31-qs(p),b=1<<_;u[_]=-1,p&=~b}c!==0&&uv(i,c,r)}function Lu(){return(it&6)===0?(kl(0),!1):!0}function dm(){if(Ke!==null){if(rt===0)var i=Ke.return;else i=Ke,Xi=Or=null,Nf(i),Fa=null,ll=0,i=Ke;for(;i!==null;)Ob(i.alternate,i),i=i.return;Ke=null}}function Xa(i,r){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,LE(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),un=0,dm(),dt=i,Ke=c=Qi(i.current,null),Ve=r,rt=0,Us=null,Hn=!1,Ga=Ko(i,r),rm=!1,Qa=$s=am=Ir=Fn=xt=0,Es=jl=null,om=!1,(r&8)!==0&&(r|=r&32);var u=i.entangledLanes;if(u!==0)for(i=i.entanglements,u&=r;0<u;){var p=31-qs(u),_=1<<p;r|=i[p],u&=~_}return cn=r,su(),c}function tx(i,r){Le=null,q.H=_l,r===Ha||r===uu?(r=gy(),rt=3):r===pf?(r=gy(),rt=4):rt=r===Uf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Us=r,Ke===null&&(xt=1,ju(i,si(r,i.current)))}function sx(){var i=Hs.current;return i===null?!0:(Ve&4194048)===Ve?ai===null:(Ve&62914560)===Ve||(Ve&536870912)!==0?i===ai:!1}function ix(){var i=q.H;return q.H=_l,i===null?_l:i}function nx(){var i=q.A;return q.A=fE,i}function Bu(){xt=4,Hn||(Ve&4194048)!==Ve&&Hs.current!==null||(Ga=!0),(Fn&134217727)===0&&(Ir&134217727)===0||dt===null||Kn(dt,Ve,$s,!1)}function hm(i,r,c){var u=it;it|=2;var p=ix(),_=nx();(dt!==i||Ve!==r)&&(Mu=null,Xa(i,r)),r=!1;var b=xt;e:do try{if(rt!==0&&Ke!==null){var C=Ke,R=Us;switch(rt){case 8:dm(),b=6;break e;case 3:case 2:case 9:case 6:Hs.current===null&&(r=!0);var U=rt;if(rt=0,Us=null,Ja(i,C,R,U),c&&Ga){b=0;break e}break;default:U=rt,rt=0,Us=null,Ja(i,C,R,U)}}_E(),b=xt;break}catch(Z){tx(i,Z)}while(!0);return r&&i.shellSuspendCounter++,Xi=Or=null,it=u,q.H=p,q.A=_,Ke===null&&(dt=null,Ve=0,su()),b}function _E(){for(;Ke!==null;)rx(Ke)}function gE(i,r){var c=it;it|=2;var u=ix(),p=nx();dt!==i||Ve!==r?(Mu=null,Du=Bs()+500,Xa(i,r)):Ga=Ko(i,r);e:do try{if(rt!==0&&Ke!==null){r=Ke;var _=Us;t:switch(rt){case 1:rt=0,Us=null,Ja(i,r,_,1);break;case 2:case 9:if(py(_)){rt=0,Us=null,ax(r);break}r=function(){rt!==2&&rt!==9||dt!==i||(rt=7),Ai(i)},_.then(r,r);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:py(_)?(rt=0,Us=null,ax(r)):(rt=0,Us=null,Ja(i,r,_,7));break;case 5:var b=null;switch(Ke.tag){case 26:b=Ke.memoizedState;case 5:case 27:var C=Ke;if(b?Kx(b):C.stateNode.complete){rt=0,Us=null;var R=C.sibling;if(R!==null)Ke=R;else{var U=C.return;U!==null?(Ke=U,zu(U)):Ke=null}break t}}rt=0,Us=null,Ja(i,r,_,5);break;case 6:rt=0,Us=null,Ja(i,r,_,6);break;case 8:dm(),xt=6;break e;default:throw Error(n(462))}}vE();break}catch(Z){tx(i,Z)}while(!0);return Xi=Or=null,q.H=u,q.A=p,it=c,Ke!==null?0:(dt=null,Ve=0,su(),xt)}function vE(){for(;Ke!==null&&!Hk();)rx(Ke)}function rx(i){var r=Tb(i.alternate,i,cn);i.memoizedProps=i.pendingProps,r===null?zu(i):Ke=r}function ax(i){var r=i,c=r.alternate;switch(r.tag){case 15:case 0:r=wb(c,r,r.pendingProps,r.type,void 0,Ve);break;case 11:r=wb(c,r,r.pendingProps,r.type.render,r.ref,Ve);break;case 5:Nf(r);default:Ob(c,r),r=Ke=ny(r,cn),r=Tb(c,r,cn)}i.memoizedProps=i.pendingProps,r===null?zu(i):Ke=r}function Ja(i,r,c,u){Xi=Or=null,Nf(r),Fa=null,ll=0;var p=r.return;try{if(aE(i,p,r,c,Ve)){xt=1,ju(i,si(c,i.current)),Ke=null;return}}catch(_){if(p!==null)throw Ke=p,_;xt=1,ju(i,si(c,i.current)),Ke=null;return}r.flags&32768?(Qe||u===1?i=!0:Ga||(Ve&536870912)!==0?i=!1:(Hn=i=!0,(u===2||u===9||u===3||u===6)&&(u=Hs.current,u!==null&&u.tag===13&&(u.flags|=16384))),ox(r,i)):zu(r)}function zu(i){var r=i;do{if((r.flags&32768)!==0){ox(r,Hn);return}i=r.return;var c=cE(r.alternate,r,cn);if(c!==null){Ke=c;return}if(r=r.sibling,r!==null){Ke=r;return}Ke=r=i}while(r!==null);xt===0&&(xt=5)}function ox(i,r){do{var c=uE(i.alternate,i);if(c!==null){c.flags&=32767,Ke=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(i=i.sibling,i!==null)){Ke=i;return}Ke=i=c}while(i!==null);xt=6,Ke=null}function lx(i,r,c,u,p,_,b,C,R){i.cancelPendingCommit=null;do qu();while(Ut!==0);if((it&6)!==0)throw Error(n(327));if(r!==null){if(r===i.current)throw Error(n(177));if(_=r.lanes|r.childLanes,_|=Jh,Zk(i,c,_,b,C,R),i===dt&&(Ke=dt=null,Ve=0),Za=r,$n=i,un=c,lm=_,cm=p,Zb=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,SE(Ic,function(){return fx(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=q.T,q.T=null,p=M.p,M.p=2,b=it,it|=4;try{dE(i,r,c)}finally{it=b,M.p=p,q.T=u}}Ut=1,cx(),ux(),dx()}}function cx(){if(Ut===1){Ut=0;var i=$n,r=Za,c=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||c){c=q.T,q.T=null;var u=M.p;M.p=2;var p=it;it|=4;try{Ub(r,i);var _=jm,b=Gv(i.containerInfo),C=_.focusedElem,R=_.selectionRange;if(b!==C&&C&&C.ownerDocument&&Yv(C.ownerDocument.documentElement,C)){if(R!==null&&Yh(C)){var U=R.start,Z=R.end;if(Z===void 0&&(Z=U),"selectionStart"in C)C.selectionStart=U,C.selectionEnd=Math.min(Z,C.value.length);else{var ie=C.ownerDocument||document,W=ie&&ie.defaultView||window;if(W.getSelection){var G=W.getSelection(),ye=C.textContent.length,Ee=Math.min(R.start,ye),ct=R.end===void 0?Ee:Math.min(R.end,ye);!G.extend&&Ee>ct&&(b=ct,ct=Ee,Ee=b);var I=Vv(C,Ee),P=Vv(C,ct);if(I&&P&&(G.rangeCount!==1||G.anchorNode!==I.node||G.anchorOffset!==I.offset||G.focusNode!==P.node||G.focusOffset!==P.offset)){var F=ie.createRange();F.setStart(I.node,I.offset),G.removeAllRanges(),Ee>ct?(G.addRange(F),G.extend(P.node,P.offset)):(F.setEnd(P.node,P.offset),G.addRange(F))}}}}for(ie=[],G=C;G=G.parentNode;)G.nodeType===1&&ie.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ie.length;C++){var te=ie[C];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Qu=!!wm,jm=wm=null}finally{it=p,M.p=u,q.T=c}}i.current=r,Ut=2}}function ux(){if(Ut===2){Ut=0;var i=$n,r=Za,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=q.T,q.T=null;var u=M.p;M.p=2;var p=it;it|=4;try{qb(i,r.alternate,r)}finally{it=p,M.p=u,q.T=c}}Ut=3}}function dx(){if(Ut===4||Ut===3){Ut=0,Fk();var i=$n,r=Za,c=un,u=Zb;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Ut=5:(Ut=0,Za=$n=null,hx(i,i.pendingLanes));var p=i.pendingLanes;if(p===0&&(Un=null),Th(c),r=r.stateNode,zs&&typeof zs.onCommitFiberRoot=="function")try{zs.onCommitFiberRoot($o,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=q.T,p=M.p,M.p=2,q.T=null;try{for(var _=i.onRecoverableError,b=0;b<u.length;b++){var C=u[b];_(C.value,{componentStack:C.stack})}}finally{q.T=r,M.p=p}}(un&3)!==0&&qu(),Ai(i),p=i.pendingLanes,(c&261930)!==0&&(p&42)!==0?i===um?Cl++:(Cl=0,um=i):Cl=0,kl(0)}}function hx(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,al(r)))}function qu(){return cx(),ux(),dx(),fx()}function fx(){if(Ut!==5)return!1;var i=$n,r=lm;lm=0;var c=Th(un),u=q.T,p=M.p;try{M.p=32>c?32:c,q.T=null,c=cm,cm=null;var _=$n,b=un;if(Ut=0,Za=$n=null,un=0,(it&6)!==0)throw Error(n(331));var C=it;if(it|=4,Yb(_.current),Kb(_,_.current,b,c),it=C,kl(0,!1),zs&&typeof zs.onPostCommitFiberRoot=="function")try{zs.onPostCommitFiberRoot($o,_)}catch{}return!0}finally{M.p=p,q.T=u,hx(i,r)}}function mx(i,r,c){r=si(c,r),r=Ff(i.stateNode,r,2),i=zn(i,r,2),i!==null&&(Wo(i,2),Ai(i))}function at(i,r,c){if(i.tag===3)mx(i,i,c);else for(;r!==null;){if(r.tag===3){mx(r,i,c);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Un===null||!Un.has(u))){i=si(c,i),c=pb(2),u=zn(r,c,2),u!==null&&(_b(c,u,r,i),Wo(u,2),Ai(u));break}}r=r.return}}function fm(i,r,c){var u=i.pingCache;if(u===null){u=i.pingCache=new mE;var p=new Set;u.set(r,p)}else p=u.get(r),p===void 0&&(p=new Set,u.set(r,p));p.has(c)||(rm=!0,p.add(c),i=yE.bind(null,i,r,c),r.then(i,i))}function yE(i,r,c){var u=i.pingCache;u!==null&&u.delete(r),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,dt===i&&(Ve&c)===c&&(xt===4||xt===3&&(Ve&62914560)===Ve&&300>Bs()-Ru?(it&2)===0&&Xa(i,0):am|=c,Qa===Ve&&(Qa=0)),Ai(i)}function px(i,r){r===0&&(r=cv()),i=Er(i,r),i!==null&&(Wo(i,r),Ai(i))}function bE(i){var r=i.memoizedState,c=0;r!==null&&(c=r.retryLane),px(i,c)}function xE(i,r){var c=0;switch(i.tag){case 31:case 13:var u=i.stateNode,p=i.memoizedState;p!==null&&(c=p.retryLane);break;case 19:u=i.stateNode;break;case 22:u=i.stateNode._retryCache;break;default:throw Error(n(314))}u!==null&&u.delete(r),px(i,c)}function SE(i,r){return Ch(i,r)}var Pu=null,eo=null,mm=!1,Iu=!1,pm=!1,Wn=0;function Ai(i){i!==eo&&i.next===null&&(eo===null?Pu=eo=i:eo=eo.next=i),Iu=!0,mm||(mm=!0,jE())}function kl(i,r){if(!pm&&Iu){pm=!0;do for(var c=!1,u=Pu;u!==null;){if(i!==0){var p=u.pendingLanes;if(p===0)var _=0;else{var b=u.suspendedLanes,C=u.pingedLanes;_=(1<<31-qs(42|i)+1)-1,_&=p&~(b&~C),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(c=!0,yx(u,_))}else _=Ve,_=$c(u,u===dt?_:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(_&3)===0||Ko(u,_)||(c=!0,yx(u,_));u=u.next}while(c);pm=!1}}function wE(){_x()}function _x(){Iu=mm=!1;var i=0;Wn!==0&&ME()&&(i=Wn);for(var r=Bs(),c=null,u=Pu;u!==null;){var p=u.next,_=gx(u,r);_===0?(u.next=null,c===null?Pu=p:c.next=p,p===null&&(eo=c)):(c=u,(i!==0||(_&3)!==0)&&(Iu=!0)),u=p}Ut!==0&&Ut!==5||kl(i),Wn!==0&&(Wn=0)}function gx(i,r){for(var c=i.suspendedLanes,u=i.pingedLanes,p=i.expirationTimes,_=i.pendingLanes&-62914561;0<_;){var b=31-qs(_),C=1<<b,R=p[b];R===-1?((C&c)===0||(C&u)!==0)&&(p[b]=Qk(C,r)):R<=r&&(i.expiredLanes|=C),_&=~C}if(r=dt,c=Ve,c=$c(i,i===r?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,c===0||i===r&&(rt===2||rt===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&kh(u),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||Ko(i,c)){if(r=c&-c,r===i.callbackPriority)return r;switch(u!==null&&kh(u),Th(c)){case 2:case 8:c=ov;break;case 32:c=Ic;break;case 268435456:c=lv;break;default:c=Ic}return u=vx.bind(null,i),c=Ch(c,u),i.callbackPriority=r,i.callbackNode=c,r}return u!==null&&u!==null&&kh(u),i.callbackPriority=2,i.callbackNode=null,2}function vx(i,r){if(Ut!==0&&Ut!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(qu()&&i.callbackNode!==c)return null;var u=Ve;return u=$c(i,i===dt?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(Jb(i,u,r),gx(i,Bs()),i.callbackNode!=null&&i.callbackNode===c?vx.bind(null,i):null)}function yx(i,r){if(qu())return null;Jb(i,r,!0)}function jE(){BE(function(){(it&6)!==0?Ch(av,wE):_x()})}function _m(){if(Wn===0){var i=Pa;i===0&&(i=Hc,Hc<<=1,(Hc&261888)===0&&(Hc=256)),Wn=i}return Wn}function bx(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Yc(""+i)}function xx(i,r){var c=r.ownerDocument.createElement("input");return c.name=r.name,c.value=r.value,i.id&&c.setAttribute("form",i.id),r.parentNode.insertBefore(c,r),i=new FormData(i),c.parentNode.removeChild(c),i}function CE(i,r,c,u,p){if(r==="submit"&&c&&c.stateNode===p){var _=bx((p[ws]||null).action),b=u.submitter;b&&(r=(r=b[ws]||null)?bx(r.formAction):b.getAttribute("formAction"),r!==null&&(_=r,b=null));var C=new Xc("action","action",null,u,p);i.push({event:C,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Wn!==0){var R=b?xx(p,b):new FormData(p);Bf(c,{pending:!0,data:R,method:p.method,action:_},null,R)}}else typeof _=="function"&&(C.preventDefault(),R=b?xx(p,b):new FormData(p),Bf(c,{pending:!0,data:R,method:p.method,action:_},_,R))},currentTarget:p}]})}}for(var gm=0;gm<Xh.length;gm++){var vm=Xh[gm],kE=vm.toLowerCase(),NE=vm[0].toUpperCase()+vm.slice(1);yi(kE,"on"+NE)}yi(Xv,"onAnimationEnd"),yi(Jv,"onAnimationIteration"),yi(ey,"onAnimationStart"),yi("dblclick","onDoubleClick"),yi("focusin","onFocus"),yi("focusout","onBlur"),yi(UN,"onTransitionRun"),yi($N,"onTransitionStart"),yi(KN,"onTransitionCancel"),yi(ty,"onTransitionEnd"),Ca("onMouseEnter",["mouseout","mouseover"]),Ca("onMouseLeave",["mouseout","mouseover"]),Ca("onPointerEnter",["pointerout","pointerover"]),Ca("onPointerLeave",["pointerout","pointerover"]),jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Nl="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(" "),EE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Nl));function Sx(i,r){r=(r&4)!==0;for(var c=0;c<i.length;c++){var u=i[c],p=u.event;u=u.listeners;e:{var _=void 0;if(r)for(var b=u.length-1;0<=b;b--){var C=u[b],R=C.instance,U=C.currentTarget;if(C=C.listener,R!==_&&p.isPropagationStopped())break e;_=C,p.currentTarget=U;try{_(p)}catch(Z){tu(Z)}p.currentTarget=null,_=R}else for(b=0;b<u.length;b++){if(C=u[b],R=C.instance,U=C.currentTarget,C=C.listener,R!==_&&p.isPropagationStopped())break e;_=C,p.currentTarget=U;try{_(p)}catch(Z){tu(Z)}p.currentTarget=null,_=R}}}}function We(i,r){var c=r[Ah];c===void 0&&(c=r[Ah]=new Set);var u=i+"__bubble";c.has(u)||(wx(r,i,2,!1),c.add(u))}function ym(i,r,c){var u=0;r&&(u|=4),wx(c,i,u,r)}var Hu="_reactListening"+Math.random().toString(36).slice(2);function bm(i){if(!i[Hu]){i[Hu]=!0,_v.forEach(function(c){c!=="selectionchange"&&(EE.has(c)||ym(c,!1,i),ym(c,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[Hu]||(r[Hu]=!0,ym("selectionchange",!1,r))}}function wx(i,r,c,u){switch(Xx(r)){case 2:var p=s2;break;case 8:p=i2;break;default:p=Lm}c=p.bind(null,r,c,i),p=void 0,!Ph||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),u?p!==void 0?i.addEventListener(r,c,{capture:!0,passive:p}):i.addEventListener(r,c,!0):p!==void 0?i.addEventListener(r,c,{passive:p}):i.addEventListener(r,c,!1)}function xm(i,r,c,u,p){var _=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var b=u.tag;if(b===3||b===4){var C=u.stateNode.containerInfo;if(C===p)break;if(b===4)for(b=u.return;b!==null;){var R=b.tag;if((R===3||R===4)&&b.stateNode.containerInfo===p)return;b=b.return}for(;C!==null;){if(b=Sa(C),b===null)return;if(R=b.tag,R===5||R===6||R===26||R===27){u=_=b;continue e}C=C.parentNode}}u=u.return}Ev(function(){var U=_,Z=zh(c),ie=[];e:{var W=sy.get(i);if(W!==void 0){var G=Xc,ye=i;switch(i){case"keypress":if(Qc(c)===0)break e;case"keydown":case"keyup":G=xN;break;case"focusin":ye="focus",G=Uh;break;case"focusout":ye="blur",G=Uh;break;case"beforeblur":case"afterblur":G=Uh;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":G=Ov;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=cN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=jN;break;case Xv:case Jv:case ey:G=hN;break;case ty:G=kN;break;case"scroll":case"scrollend":G=oN;break;case"wheel":G=EN;break;case"copy":case"cut":case"paste":G=mN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=Dv;break;case"toggle":case"beforetoggle":G=AN}var Ee=(r&4)!==0,ct=!Ee&&(i==="scroll"||i==="scrollend"),I=Ee?W!==null?W+"Capture":null:W;Ee=[];for(var P=U,F;P!==null;){var te=P;if(F=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||F===null||I===null||(te=Go(P,I),te!=null&&Ee.push(El(P,te,F))),ct)break;P=P.return}0<Ee.length&&(W=new G(W,ye,null,c,Z),ie.push({event:W,listeners:Ee}))}}if((r&7)===0){e:{if(W=i==="mouseover"||i==="pointerover",G=i==="mouseout"||i==="pointerout",W&&c!==Bh&&(ye=c.relatedTarget||c.fromElement)&&(Sa(ye)||ye[xa]))break e;if((G||W)&&(W=Z.window===Z?Z:(W=Z.ownerDocument)?W.defaultView||W.parentWindow:window,G?(ye=c.relatedTarget||c.toElement,G=U,ye=ye?Sa(ye):null,ye!==null&&(ct=l(ye),Ee=ye.tag,ye!==ct||Ee!==5&&Ee!==27&&Ee!==6)&&(ye=null)):(G=null,ye=U),G!==ye)){if(Ee=Ov,te="onMouseLeave",I="onMouseEnter",P="mouse",(i==="pointerout"||i==="pointerover")&&(Ee=Dv,te="onPointerLeave",I="onPointerEnter",P="pointer"),ct=G==null?W:Yo(G),F=ye==null?W:Yo(ye),W=new Ee(te,P+"leave",G,c,Z),W.target=ct,W.relatedTarget=F,te=null,Sa(Z)===U&&(Ee=new Ee(I,P+"enter",ye,c,Z),Ee.target=F,Ee.relatedTarget=ct,te=Ee),ct=te,G&&ye)t:{for(Ee=TE,I=G,P=ye,F=0,te=I;te;te=Ee(te))F++;te=0;for(var ke=P;ke;ke=Ee(ke))te++;for(;0<F-te;)I=Ee(I),F--;for(;0<te-F;)P=Ee(P),te--;for(;F--;){if(I===P||P!==null&&I===P.alternate){Ee=I;break t}I=Ee(I),P=Ee(P)}Ee=null}else Ee=null;G!==null&&jx(ie,W,G,Ee,!1),ye!==null&&ct!==null&&jx(ie,ct,ye,Ee,!0)}}e:{if(W=U?Yo(U):window,G=W.nodeName&&W.nodeName.toLowerCase(),G==="select"||G==="input"&&W.type==="file")var tt=Hv;else if(Pv(W))if(Fv)tt=IN;else{tt=qN;var we=zN}else G=W.nodeName,!G||G.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?U&&Lh(U.elementType)&&(tt=Hv):tt=PN;if(tt&&(tt=tt(i,U))){Iv(ie,tt,c,Z);break e}we&&we(i,W,U),i==="focusout"&&U&&W.type==="number"&&U.memoizedProps.value!=null&&Mh(W,"number",W.value)}switch(we=U?Yo(U):window,i){case"focusin":(Pv(we)||we.contentEditable==="true")&&(Oa=we,Gh=U,il=null);break;case"focusout":il=Gh=Oa=null;break;case"mousedown":Qh=!0;break;case"contextmenu":case"mouseup":case"dragend":Qh=!1,Qv(ie,c,Z);break;case"selectionchange":if(FN)break;case"keydown":case"keyup":Qv(ie,c,Z)}var qe;if(Kh)e:{switch(i){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else Aa?zv(i,c)&&(Ye="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(Ye="onCompositionStart");Ye&&(Mv&&c.locale!=="ko"&&(Aa||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&Aa&&(qe=Tv()):(An=Z,Ih="value"in An?An.value:An.textContent,Aa=!0)),we=Fu(U,Ye),0<we.length&&(Ye=new Rv(Ye,i,null,c,Z),ie.push({event:Ye,listeners:we}),qe?Ye.data=qe:(qe=qv(c),qe!==null&&(Ye.data=qe)))),(qe=RN?DN(i,c):MN(i,c))&&(Ye=Fu(U,"onBeforeInput"),0<Ye.length&&(we=new Rv("onBeforeInput","beforeinput",null,c,Z),ie.push({event:we,listeners:Ye}),we.data=qe)),CE(ie,i,U,c,Z)}Sx(ie,r)})}function El(i,r,c){return{instance:i,listener:r,currentTarget:c}}function Fu(i,r){for(var c=r+"Capture",u=[];i!==null;){var p=i,_=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||_===null||(p=Go(i,c),p!=null&&u.unshift(El(i,p,_)),p=Go(i,r),p!=null&&u.push(El(i,p,_))),i.tag===3)return u;i=i.return}return[]}function TE(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function jx(i,r,c,u,p){for(var _=r._reactName,b=[];c!==null&&c!==u;){var C=c,R=C.alternate,U=C.stateNode;if(C=C.tag,R!==null&&R===u)break;C!==5&&C!==26&&C!==27||U===null||(R=U,p?(U=Go(c,_),U!=null&&b.unshift(El(c,U,R))):p||(U=Go(c,_),U!=null&&b.push(El(c,U,R)))),c=c.return}b.length!==0&&i.push({event:r,listeners:b})}var AE=/\r\n?/g,OE=/\u0000|\uFFFD/g;function Cx(i){return(typeof i=="string"?i:""+i).replace(AE,`
|
|
50
|
+
`).replace(OE,"")}function kx(i,r){return r=Cx(r),Cx(i)===r}function lt(i,r,c,u,p,_){switch(c){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||Na(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&Na(i,""+u);break;case"className":Wc(i,"class",u);break;case"tabIndex":Wc(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Wc(i,c,u);break;case"style":kv(i,u,_);break;case"data":if(r!=="object"){Wc(i,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||c!=="href")){i.removeAttribute(c);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(c);break}u=Yc(""+u),i.setAttribute(c,u);break;case"action":case"formAction":if(typeof u=="function"){i.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 _=="function"&&(c==="formAction"?(r!=="input"&<(i,r,"name",p.name,p,null),lt(i,r,"formEncType",p.formEncType,p,null),lt(i,r,"formMethod",p.formMethod,p,null),lt(i,r,"formTarget",p.formTarget,p,null)):(lt(i,r,"encType",p.encType,p,null),lt(i,r,"method",p.method,p,null),lt(i,r,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(c);break}u=Yc(""+u),i.setAttribute(c,u);break;case"onClick":u!=null&&(i.onclick=Yi);break;case"onScroll":u!=null&&We("scroll",i);break;case"onScrollEnd":u!=null&&We("scrollend",i);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(n(61));if(c=u.__html,c!=null){if(p.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"multiple":i.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":i.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){i.removeAttribute("xlink:href");break}c=Yc(""+u),i.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":u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(c,""+u):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":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":u&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":u===!0?i.setAttribute(c,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(c,u):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?i.setAttribute(c,u):i.removeAttribute(c);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?i.removeAttribute(c):i.setAttribute(c,u);break;case"popover":We("beforetoggle",i),We("toggle",i),Kc(i,"popover",u);break;case"xlinkActuate":Vi(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Vi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Vi(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Vi(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Vi(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Vi(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Vi(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Vi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Vi(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Kc(i,"is",u);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=rN.get(c)||c,Kc(i,c,u))}}function Sm(i,r,c,u,p,_){switch(c){case"style":kv(i,u,_);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(n(61));if(c=u.__html,c!=null){if(p.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"children":typeof u=="string"?Na(i,u):(typeof u=="number"||typeof u=="bigint")&&Na(i,""+u);break;case"onScroll":u!=null&&We("scroll",i);break;case"onScrollEnd":u!=null&&We("scrollend",i);break;case"onClick":u!=null&&(i.onclick=Yi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gv.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(p=c.endsWith("Capture"),r=c.slice(2,p?c.length-7:void 0),_=i[ws]||null,_=_!=null?_[c]:null,typeof _=="function"&&i.removeEventListener(r,_,p),typeof u=="function")){typeof _!="function"&&_!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(r,u,p);break e}c in i?i[c]=u:u===!0?i.setAttribute(c,""):Kc(i,c,u)}}}function ls(i,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",i),We("load",i);var u=!1,p=!1,_;for(_ in c)if(c.hasOwnProperty(_)){var b=c[_];if(b!=null)switch(_){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:lt(i,r,_,b,c,null)}}p&<(i,r,"srcSet",c.srcSet,c,null),u&<(i,r,"src",c.src,c,null);return;case"input":We("invalid",i);var C=_=b=p=null,R=null,U=null;for(u in c)if(c.hasOwnProperty(u)){var Z=c[u];if(Z!=null)switch(u){case"name":p=Z;break;case"type":b=Z;break;case"checked":R=Z;break;case"defaultChecked":U=Z;break;case"value":_=Z;break;case"defaultValue":C=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(n(137,r));break;default:lt(i,r,u,Z,c,null)}}Sv(i,_,C,R,U,b,p,!1);return;case"select":We("invalid",i),u=b=_=null;for(p in c)if(c.hasOwnProperty(p)&&(C=c[p],C!=null))switch(p){case"value":_=C;break;case"defaultValue":b=C;break;case"multiple":u=C;default:lt(i,r,p,C,c,null)}r=_,c=b,i.multiple=!!u,r!=null?ka(i,!!u,r,!1):c!=null&&ka(i,!!u,c,!0);return;case"textarea":We("invalid",i),_=p=u=null;for(b in c)if(c.hasOwnProperty(b)&&(C=c[b],C!=null))switch(b){case"value":u=C;break;case"defaultValue":p=C;break;case"children":_=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(n(91));break;default:lt(i,r,b,C,c,null)}jv(i,u,p,_);return;case"option":for(R in c)if(c.hasOwnProperty(R)&&(u=c[R],u!=null))switch(R){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:lt(i,r,R,u,c,null)}return;case"dialog":We("beforetoggle",i),We("toggle",i),We("cancel",i),We("close",i);break;case"iframe":case"object":We("load",i);break;case"video":case"audio":for(u=0;u<Nl.length;u++)We(Nl[u],i);break;case"image":We("error",i),We("load",i);break;case"details":We("toggle",i);break;case"embed":case"source":case"link":We("error",i),We("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in c)if(c.hasOwnProperty(U)&&(u=c[U],u!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:lt(i,r,U,u,c,null)}return;default:if(Lh(r)){for(Z in c)c.hasOwnProperty(Z)&&(u=c[Z],u!==void 0&&Sm(i,r,Z,u,c,void 0));return}}for(C in c)c.hasOwnProperty(C)&&(u=c[C],u!=null&<(i,r,C,u,c,null))}function RE(i,r,c,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,_=null,b=null,C=null,R=null,U=null,Z=null;for(G in c){var ie=c[G];if(c.hasOwnProperty(G)&&ie!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":R=ie;default:u.hasOwnProperty(G)||lt(i,r,G,null,u,ie)}}for(var W in u){var G=u[W];if(ie=c[W],u.hasOwnProperty(W)&&(G!=null||ie!=null))switch(W){case"type":_=G;break;case"name":p=G;break;case"checked":U=G;break;case"defaultChecked":Z=G;break;case"value":b=G;break;case"defaultValue":C=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(n(137,r));break;default:G!==ie&<(i,r,W,G,u,ie)}}Dh(i,b,C,R,U,Z,_,p);return;case"select":G=b=C=W=null;for(_ in c)if(R=c[_],c.hasOwnProperty(_)&&R!=null)switch(_){case"value":break;case"multiple":G=R;default:u.hasOwnProperty(_)||lt(i,r,_,null,u,R)}for(p in u)if(_=u[p],R=c[p],u.hasOwnProperty(p)&&(_!=null||R!=null))switch(p){case"value":W=_;break;case"defaultValue":C=_;break;case"multiple":b=_;default:_!==R&<(i,r,p,_,u,R)}r=C,c=b,u=G,W!=null?ka(i,!!c,W,!1):!!u!=!!c&&(r!=null?ka(i,!!c,r,!0):ka(i,!!c,c?[]:"",!1));return;case"textarea":G=W=null;for(C in c)if(p=c[C],c.hasOwnProperty(C)&&p!=null&&!u.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:lt(i,r,C,null,u,p)}for(b in u)if(p=u[b],_=c[b],u.hasOwnProperty(b)&&(p!=null||_!=null))switch(b){case"value":W=p;break;case"defaultValue":G=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(n(91));break;default:p!==_&<(i,r,b,p,u,_)}wv(i,W,G);return;case"option":for(var ye in c)if(W=c[ye],c.hasOwnProperty(ye)&&W!=null&&!u.hasOwnProperty(ye))switch(ye){case"selected":i.selected=!1;break;default:lt(i,r,ye,null,u,W)}for(R in u)if(W=u[R],G=c[R],u.hasOwnProperty(R)&&W!==G&&(W!=null||G!=null))switch(R){case"selected":i.selected=W&&typeof W!="function"&&typeof W!="symbol";break;default:lt(i,r,R,W,u,G)}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 Ee in c)W=c[Ee],c.hasOwnProperty(Ee)&&W!=null&&!u.hasOwnProperty(Ee)&<(i,r,Ee,null,u,W);for(U in u)if(W=u[U],G=c[U],u.hasOwnProperty(U)&&W!==G&&(W!=null||G!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(n(137,r));break;default:lt(i,r,U,W,u,G)}return;default:if(Lh(r)){for(var ct in c)W=c[ct],c.hasOwnProperty(ct)&&W!==void 0&&!u.hasOwnProperty(ct)&&Sm(i,r,ct,void 0,u,W);for(Z in u)W=u[Z],G=c[Z],!u.hasOwnProperty(Z)||W===G||W===void 0&&G===void 0||Sm(i,r,Z,W,u,G);return}}for(var I in c)W=c[I],c.hasOwnProperty(I)&&W!=null&&!u.hasOwnProperty(I)&<(i,r,I,null,u,W);for(ie in u)W=u[ie],G=c[ie],!u.hasOwnProperty(ie)||W===G||W==null&&G==null||lt(i,r,ie,W,u,G)}function Nx(i){switch(i){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 i=0,r=0,c=performance.getEntriesByType("resource"),u=0;u<c.length;u++){var p=c[u],_=p.transferSize,b=p.initiatorType,C=p.duration;if(_&&C&&Nx(b)){for(b=0,C=p.responseEnd,u+=1;u<c.length;u++){var R=c[u],U=R.startTime;if(U>C)break;var Z=R.transferSize,ie=R.initiatorType;Z&&Nx(ie)&&(R=R.responseEnd,b+=Z*(R<C?1:(C-U)/(R-U)))}if(--u,r+=8*(_+b)/(p.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var wm=null,jm=null;function Uu(i){return i.nodeType===9?i:i.ownerDocument}function Ex(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Tx(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function Cm(i,r){return i==="textarea"||i==="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 km=null;function ME(){var i=window.event;return i&&i.type==="popstate"?i===km?!1:(km=i,!0):(km=null,!1)}var Ax=typeof setTimeout=="function"?setTimeout:void 0,LE=typeof clearTimeout=="function"?clearTimeout:void 0,Ox=typeof Promise=="function"?Promise:void 0,BE=typeof queueMicrotask=="function"?queueMicrotask:typeof Ox<"u"?function(i){return Ox.resolve(null).then(i).catch(zE)}:Ax;function zE(i){setTimeout(function(){throw i})}function Vn(i){return i==="head"}function Rx(i,r){var c=r,u=0;do{var p=c.nextSibling;if(i.removeChild(c),p&&p.nodeType===8)if(c=p.data,c==="/$"||c==="/&"){if(u===0){i.removeChild(p),no(r);return}u--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")u++;else if(c==="html")Tl(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,Tl(c);for(var _=c.firstChild;_;){var b=_.nextSibling,C=_.nodeName;_[Vo]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&_.rel.toLowerCase()==="stylesheet"||c.removeChild(_),_=b}}else c==="body"&&Tl(i.ownerDocument.body);c=p}while(c);no(r)}function Dx(i,r){var c=i;i=0;do{var u=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||""),u&&u.nodeType===8)if(c=u.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=u}while(c)}function Nm(i){var r=i.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":Nm(c),Oh(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function qE(i,r,c,u){for(;i.nodeType===1;){var p=c;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(u){if(!i[Vo])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(_=i.getAttribute("rel"),_==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(_!==p.rel||i.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||i.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||i.getAttribute("title")!==(p.title==null?null:p.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(_=i.getAttribute("src"),(_!==(p.src==null?null:p.src)||i.getAttribute("type")!==(p.type==null?null:p.type)||i.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&_&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var _=p.name==null?null:""+p.name;if(p.type==="hidden"&&i.getAttribute("name")===_)return i}else return i;if(i=oi(i.nextSibling),i===null)break}return null}function PE(i,r,c){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=oi(i.nextSibling),i===null))return null;return i}function Mx(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=oi(i.nextSibling),i===null))return null;return i}function Em(i){return i.data==="$?"||i.data==="$~"}function Tm(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function IE(i,r){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||c.readyState!=="loading")r();else{var u=function(){r(),c.removeEventListener("DOMContentLoaded",u)};c.addEventListener("DOMContentLoaded",u),i._reactRetry=u}}function oi(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var Am=null;function Lx(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(r===0)return oi(i.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}i=i.nextSibling}return null}function Bx(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return i;r--}else c!=="/$"&&c!=="/&"||r++}i=i.previousSibling}return null}function zx(i,r,c){switch(r=Uu(c),i){case"html":if(i=r.documentElement,!i)throw Error(n(452));return i;case"head":if(i=r.head,!i)throw Error(n(453));return i;case"body":if(i=r.body,!i)throw Error(n(454));return i;default:throw Error(n(451))}}function Tl(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Oh(i)}var li=new Map,qx=new Set;function $u(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var dn=M.d;M.d={f:HE,r:FE,D:UE,C:$E,L:KE,m:WE,X:YE,S:VE,M:GE};function HE(){var i=dn.f(),r=Lu();return i||r}function FE(i){var r=wa(i);r!==null&&r.tag===5&&r.type==="form"?tb(r):dn.r(i)}var to=typeof document>"u"?null:document;function Px(i,r,c){var u=to;if(u&&typeof r=="string"&&r){var p=ei(r);p='link[rel="'+i+'"][href="'+p+'"]',typeof c=="string"&&(p+='[crossorigin="'+c+'"]'),qx.has(p)||(qx.add(p),i={rel:i,crossOrigin:c,href:r},u.querySelector(p)===null&&(r=u.createElement("link"),ls(r,"link",i),Gt(r),u.head.appendChild(r)))}}function UE(i){dn.D(i),Px("dns-prefetch",i,null)}function $E(i,r){dn.C(i,r),Px("preconnect",i,r)}function KE(i,r,c){dn.L(i,r,c);var u=to;if(u&&i&&r){var p='link[rel="preload"][as="'+ei(r)+'"]';r==="image"&&c&&c.imageSrcSet?(p+='[imagesrcset="'+ei(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(p+='[imagesizes="'+ei(c.imageSizes)+'"]')):p+='[href="'+ei(i)+'"]';var _=p;switch(r){case"style":_=so(i);break;case"script":_=io(i)}li.has(_)||(i=v({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:i,as:r},c),li.set(_,i),u.querySelector(p)!==null||r==="style"&&u.querySelector(Al(_))||r==="script"&&u.querySelector(Ol(_))||(r=u.createElement("link"),ls(r,"link",i),Gt(r),u.head.appendChild(r)))}}function WE(i,r){dn.m(i,r);var c=to;if(c&&i){var u=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+ei(u)+'"][href="'+ei(i)+'"]',_=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=io(i)}if(!li.has(_)&&(i=v({rel:"modulepreload",href:i},r),li.set(_,i),c.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ol(_)))return}u=c.createElement("link"),ls(u,"link",i),Gt(u),c.head.appendChild(u)}}}function VE(i,r,c){dn.S(i,r,c);var u=to;if(u&&i){var p=ja(u).hoistableStyles,_=so(i);r=r||"default";var b=p.get(_);if(!b){var C={loading:0,preload:null};if(b=u.querySelector(Al(_)))C.loading=5;else{i=v({rel:"stylesheet",href:i,"data-precedence":r},c),(c=li.get(_))&&Om(i,c);var R=b=u.createElement("link");Gt(R),ls(R,"link",i),R._p=new Promise(function(U,Z){R.onload=U,R.onerror=Z}),R.addEventListener("load",function(){C.loading|=1}),R.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Ku(b,r,u)}b={type:"stylesheet",instance:b,count:1,state:C},p.set(_,b)}}}function YE(i,r){dn.X(i,r);var c=to;if(c&&i){var u=ja(c).hoistableScripts,p=io(i),_=u.get(p);_||(_=c.querySelector(Ol(p)),_||(i=v({src:i,async:!0},r),(r=li.get(p))&&Rm(i,r),_=c.createElement("script"),Gt(_),ls(_,"link",i),c.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function GE(i,r){dn.M(i,r);var c=to;if(c&&i){var u=ja(c).hoistableScripts,p=io(i),_=u.get(p);_||(_=c.querySelector(Ol(p)),_||(i=v({src:i,async:!0,type:"module"},r),(r=li.get(p))&&Rm(i,r),_=c.createElement("script"),Gt(_),ls(_,"link",i),c.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function Ix(i,r,c,u){var p=(p=xe.current)?$u(p):null;if(!p)throw Error(n(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(r=so(c.href),c=ja(p).hoistableStyles,u=c.get(r),u||(u={type:"style",instance:null,count:0,state:null},c.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=so(c.href);var _=ja(p).hoistableStyles,b=_.get(i);if(b||(p=p.ownerDocument||p,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(i,b),(_=p.querySelector(Al(i)))&&!_._p&&(b.instance=_,b.state.loading=5),li.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},li.set(i,c),_||QE(p,i,c,b.state))),r&&u===null)throw Error(n(528,""));return b}if(r&&u!==null)throw Error(n(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=io(c),c=ja(p).hoistableScripts,u=c.get(r),u||(u={type:"script",instance:null,count:0,state:null},c.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,i))}}function so(i){return'href="'+ei(i)+'"'}function Al(i){return'link[rel="stylesheet"]['+i+"]"}function Hx(i){return v({},i,{"data-precedence":i.precedence,precedence:null})}function QE(i,r,c,u){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=i.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),ls(r,"link",c),Gt(r),i.head.appendChild(r))}function io(i){return'[src="'+ei(i)+'"]'}function Ol(i){return"script[async]"+i}function Fx(i,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var u=i.querySelector('style[data-href~="'+ei(c.href)+'"]');if(u)return r.instance=u,Gt(u),u;var p=v({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),Gt(u),ls(u,"style",p),Ku(u,c.precedence,i),r.instance=u;case"stylesheet":p=so(c.href);var _=i.querySelector(Al(p));if(_)return r.state.loading|=4,r.instance=_,Gt(_),_;u=Hx(c),(p=li.get(p))&&Om(u,p),_=(i.ownerDocument||i).createElement("link"),Gt(_);var b=_;return b._p=new Promise(function(C,R){b.onload=C,b.onerror=R}),ls(_,"link",u),r.state.loading|=4,Ku(_,c.precedence,i),r.instance=_;case"script":return _=io(c.src),(p=i.querySelector(Ol(_)))?(r.instance=p,Gt(p),p):(u=c,(p=li.get(_))&&(u=v({},c),Rm(u,p)),i=i.ownerDocument||i,p=i.createElement("script"),Gt(p),ls(p,"link",u),i.head.appendChild(p),r.instance=p);case"void":return null;default:throw Error(n(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Ku(u,c.precedence,i));return r.instance}function Ku(i,r,c){for(var u=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,_=p,b=0;b<u.length;b++){var C=u[b];if(C.dataset.precedence===r)_=C;else if(_!==p)break}_?_.parentNode.insertBefore(i,_.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(i,r.firstChild))}function Om(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function Rm(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Wu=null;function Ux(i,r,c){if(Wu===null){var u=new Map,p=Wu=new Map;p.set(c,u)}else p=Wu,u=p.get(c),u||(u=new Map,p.set(c,u));if(u.has(i))return u;for(u.set(i,null),c=c.getElementsByTagName(i),p=0;p<c.length;p++){var _=c[p];if(!(_[Vo]||_[ns]||i==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var b=_.getAttribute(r)||"";b=i+b;var C=u.get(b);C?C.push(_):u.set(b,[_])}}return u}function $x(i,r,c){i=i.ownerDocument||i,i.head.insertBefore(c,r==="title"?i.querySelector("head > title"):null)}function ZE(i,r,c){if(c===1||r.itemProp!=null)return!1;switch(i){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 i=r.disabled,typeof r.precedence=="string"&&i==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 Kx(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function XE(i,r,c,u){if(c.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var p=so(u.href),_=r.querySelector(Al(p));if(_){r=_._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Vu.bind(i),r.then(i,i)),c.state.loading|=4,c.instance=_,Gt(_);return}_=r.ownerDocument||r,u=Hx(u),(p=li.get(p))&&Om(u,p),_=_.createElement("link"),Gt(_);var b=_;b._p=new Promise(function(C,R){b.onload=C,b.onerror=R}),ls(_,"link",u),c.instance=_}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=Vu.bind(i),r.addEventListener("load",c),r.addEventListener("error",c))}}var Dm=0;function JE(i,r){return i.stylesheets&&i.count===0&&Gu(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var u=setTimeout(function(){if(i.stylesheets&&Gu(i,i.stylesheets),i.unsuspend){var _=i.unsuspend;i.unsuspend=null,_()}},6e4+r);0<i.imgBytes&&Dm===0&&(Dm=62500*DE());var p=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Gu(i,i.stylesheets),i.unsuspend)){var _=i.unsuspend;i.unsuspend=null,_()}},(i.imgBytes>Dm?50:800)+r);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Vu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gu(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Yu=null;function Gu(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Yu=new Map,r.forEach(e2,i),Yu=null,Vu.call(i))}function e2(i,r){if(!(r.state.loading&4)){var c=Yu.get(i);if(c)var u=c.get(null);else{c=new Map,Yu.set(i,c);for(var p=i.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<p.length;_++){var b=p[_];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(c.set(b.dataset.precedence,b),u=b)}u&&c.set(null,u)}p=r.instance,b=p.getAttribute("data-precedence"),_=c.get(b)||u,_===u&&c.set(null,p),c.set(b,p),this.count++,u=Vu.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),_?_.parentNode.insertBefore(p,_.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(p,i.firstChild)),r.state.loading|=4}}var Rl={$$typeof:A,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function t2(i,r,c,u,p,_,b,C,R){this.tag=1,this.containerInfo=i,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=Nh(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nh(0),this.hiddenUpdates=Nh(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=_,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Wx(i,r,c,u,p,_,b,C,R,U,Z,ie){return i=new t2(i,r,c,b,R,U,Z,ie,C),r=1,_===!0&&(r|=24),_=Is(3,null,null,r),i.current=_,_.stateNode=i,r=hf(),r.refCount++,i.pooledCache=r,r.refCount++,_.memoizedState={element:u,isDehydrated:c,cache:r},_f(_),i}function Vx(i){return i?(i=Ma,i):Ma}function Yx(i,r,c,u,p,_){p=Vx(p),u.context===null?u.context=p:u.pendingContext=p,u=Bn(r),u.payload={element:c},_=_===void 0?null:_,_!==null&&(u.callback=_),c=zn(i,u,r),c!==null&&(Ts(c,i,r),ul(c,i,r))}function Gx(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<r?c:r}}function Mm(i,r){Gx(i,r),(i=i.alternate)&&Gx(i,r)}function Qx(i){if(i.tag===13||i.tag===31){var r=Er(i,67108864);r!==null&&Ts(r,i,67108864),Mm(i,67108864)}}function Zx(i){if(i.tag===13||i.tag===31){var r=Ks();r=Eh(r);var c=Er(i,r);c!==null&&Ts(c,i,r),Mm(i,r)}}var Qu=!0;function s2(i,r,c,u){var p=q.T;q.T=null;var _=M.p;try{M.p=2,Lm(i,r,c,u)}finally{M.p=_,q.T=p}}function i2(i,r,c,u){var p=q.T;q.T=null;var _=M.p;try{M.p=8,Lm(i,r,c,u)}finally{M.p=_,q.T=p}}function Lm(i,r,c,u){if(Qu){var p=Bm(u);if(p===null)xm(i,r,u,Zu,c),Jx(i,u);else if(r2(p,i,r,c,u))u.stopPropagation();else if(Jx(i,u),r&4&&-1<n2.indexOf(i)){for(;p!==null;){var _=wa(p);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var b=wr(_.pendingLanes);if(b!==0){var C=_;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var R=1<<31-qs(b);C.entanglements[1]|=R,b&=~R}Ai(_),(it&6)===0&&(Du=Bs()+500,kl(0))}}break;case 31:case 13:C=Er(_,2),C!==null&&Ts(C,_,2),Lu(),Mm(_,2)}if(_=Bm(u),_===null&&xm(i,r,u,Zu,c),_===p)break;p=_}p!==null&&u.stopPropagation()}else xm(i,r,u,null,c)}}function Bm(i){return i=zh(i),zm(i)}var Zu=null;function zm(i){if(Zu=null,i=Sa(i),i!==null){var r=l(i);if(r===null)i=null;else{var c=r.tag;if(c===13){if(i=d(r),i!==null)return i;i=null}else if(c===31){if(i=h(r),i!==null)return i;i=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Zu=i,null}function Xx(i){switch(i){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"resize":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"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"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Uk()){case av:return 2;case ov:return 8;case Ic:case $k:return 32;case lv:return 268435456;default:return 32}default:return 32}}var qm=!1,Yn=null,Gn=null,Qn=null,Dl=new Map,Ml=new Map,Zn=[],n2="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 Jx(i,r){switch(i){case"focusin":case"focusout":Yn=null;break;case"dragenter":case"dragleave":Gn=null;break;case"mouseover":case"mouseout":Qn=null;break;case"pointerover":case"pointerout":Dl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ml.delete(r.pointerId)}}function Ll(i,r,c,u,p,_){return i===null||i.nativeEvent!==_?(i={blockedOn:r,domEventName:c,eventSystemFlags:u,nativeEvent:_,targetContainers:[p]},r!==null&&(r=wa(r),r!==null&&Qx(r)),i):(i.eventSystemFlags|=u,r=i.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),i)}function r2(i,r,c,u,p){switch(r){case"focusin":return Yn=Ll(Yn,i,r,c,u,p),!0;case"dragenter":return Gn=Ll(Gn,i,r,c,u,p),!0;case"mouseover":return Qn=Ll(Qn,i,r,c,u,p),!0;case"pointerover":var _=p.pointerId;return Dl.set(_,Ll(Dl.get(_)||null,i,r,c,u,p)),!0;case"gotpointercapture":return _=p.pointerId,Ml.set(_,Ll(Ml.get(_)||null,i,r,c,u,p)),!0}return!1}function eS(i){var r=Sa(i.target);if(r!==null){var c=l(r);if(c!==null){if(r=c.tag,r===13){if(r=d(c),r!==null){i.blockedOn=r,mv(i.priority,function(){Zx(c)});return}}else if(r===31){if(r=h(c),r!==null){i.blockedOn=r,mv(i.priority,function(){Zx(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Xu(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var c=Bm(i.nativeEvent);if(c===null){c=i.nativeEvent;var u=new c.constructor(c.type,c);Bh=u,c.target.dispatchEvent(u),Bh=null}else return r=wa(c),r!==null&&Qx(r),i.blockedOn=c,!1;r.shift()}return!0}function tS(i,r,c){Xu(i)&&c.delete(r)}function a2(){qm=!1,Yn!==null&&Xu(Yn)&&(Yn=null),Gn!==null&&Xu(Gn)&&(Gn=null),Qn!==null&&Xu(Qn)&&(Qn=null),Dl.forEach(tS),Ml.forEach(tS)}function Ju(i,r){i.blockedOn===r&&(i.blockedOn=null,qm||(qm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,a2)))}var ed=null;function sS(i){ed!==i&&(ed=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ed===i&&(ed=null);for(var r=0;r<i.length;r+=3){var c=i[r],u=i[r+1],p=i[r+2];if(typeof u!="function"){if(zm(u||c)===null)continue;break}var _=wa(c);_!==null&&(i.splice(r,3),r-=3,Bf(_,{pending:!0,data:p,method:c.method,action:u},u,p))}}))}function no(i){function r(R){return Ju(R,i)}Yn!==null&&Ju(Yn,i),Gn!==null&&Ju(Gn,i),Qn!==null&&Ju(Qn,i),Dl.forEach(r),Ml.forEach(r);for(var c=0;c<Zn.length;c++){var u=Zn[c];u.blockedOn===i&&(u.blockedOn=null)}for(;0<Zn.length&&(c=Zn[0],c.blockedOn===null);)eS(c),c.blockedOn===null&&Zn.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(u=0;u<c.length;u+=3){var p=c[u],_=c[u+1],b=p[ws]||null;if(typeof _=="function")b||sS(c);else if(b){var C=null;if(_&&_.hasAttribute("formAction")){if(p=_,b=_[ws]||null)C=b.formAction;else if(zm(p)!==null)continue}else C=b.action;typeof C=="function"?c[u+1]=C:(c.splice(u,3),u-=3),sS(c)}}}function iS(){function i(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(b){return p=b})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),u||setTimeout(c,20)}function c(){if(!u&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){u=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function Pm(i){this._internalRoot=i}td.prototype.render=Pm.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(n(409));var c=r.current,u=Ks();Yx(c,u,i,r,null,null)},td.prototype.unmount=Pm.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;Yx(i.current,2,null,i,null,null),Lu(),r[xa]=null}};function td(i){this._internalRoot=i}td.prototype.unstable_scheduleHydration=function(i){if(i){var r=fv();i={blockedOn:null,target:i,priority:r};for(var c=0;c<Zn.length&&r!==0&&r<Zn[c].priority;c++);Zn.splice(c,0,i),c===0&&eS(i)}};var nS=t.version;if(nS!=="19.2.8")throw Error(n(527,nS,"19.2.8"));M.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=m(r),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var o2={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sd.isDisabled&&sd.supportsFiber)try{$o=sd.inject(o2),zs=sd}catch{}}return zl.createRoot=function(i,r){if(!o(i))throw Error(n(299));var c=!1,u="",p=db,_=hb,b=fb;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(_=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError)),r=Wx(i,1,!1,null,null,c,u,null,p,_,b,iS),i[xa]=r.current,bm(i),new Pm(r)},zl.hydrateRoot=function(i,r,c){if(!o(i))throw Error(n(299));var u=!1,p="",_=db,b=hb,C=fb,R=null;return c!=null&&(c.unstable_strictMode===!0&&(u=!0),c.identifierPrefix!==void 0&&(p=c.identifierPrefix),c.onUncaughtError!==void 0&&(_=c.onUncaughtError),c.onCaughtError!==void 0&&(b=c.onCaughtError),c.onRecoverableError!==void 0&&(C=c.onRecoverableError),c.formState!==void 0&&(R=c.formState)),r=Wx(i,1,!0,r,c??null,u,p,R,_,b,C,iS),r.context=Vx(null),c=r.current,u=Ks(),u=Eh(u),p=Bn(u),p.callback=null,zn(c,p,u),c=u,r.current.lanes=c,Wo(r,c),Ai(r),i[xa]=r.current,bm(i),new td(r)},zl.version="19.2.8",zl}var CS;function V2(){if(CS)return Um.exports;CS=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(),Um.exports=W2(),Um.exports}var Y2=V2();const aa=["workspace","list"];function Sj(e){return["workspace","slots",e]}function Xl(e){return["project","listByWorkspace",e]}function Do(e){return["worktree","listByProject",e]}function uh(e,t){const s=["task","listByWorkspace",e];return t===void 0?s:[...s,t]}function cg(e){return["task","get",e]}function wj(e,t){return["task","board",e,t]}function jj(e){return["task","settings",e]}function G2(e){return["worktree","branches",e]}function Q2(e){return["worktree","hostOrigins",e]}function ug(e){return["project","detail",e]}function dg(e){return["worktree","detail",e]}function oa(e,t){return["session","listByScope",e,t]}function hg(e){return["session","getDetail",e]}function fg(e,t){return["scripts","status",e,t]}function mg(e,t,s){return["files","listDir",e,t,s]}function Z2(e,t,s,n){return[...mg(e,t,s),n??"default"]}function rd(e,t,s){return["files","read",e,t,s]}function X2(e,t,s){return["files","deletePreview",e,t,s]}function J2(e,t,s){return["changes","list",e,t,s]}function eT(e,t,s,n){return["changes","patch",e,t,s,n]}function tT(e,t){return["memory","list",e??"-",t??"-"]}function Cj(e){return["memory","proposals",e]}function sT(e,t){return["memory","core",e??"-",t??"-"]}function iT(e,t,s){return["memory","search",e??"-",t??"-",s]}const nT=["memory","decisions"],rT=["memory","usage"],aT=["memory","settings"];function oT(e,t){return["usage","byProject",e,t]}function lT(e,t){return["usage","byWorktree",e,t]}function cT(e,t){return["usage","byProjectAndAgent",e,t]}function uT(e,t){return["usage","byProjectAndAccount",e,t]}function dT(e,t){return["memory","playbooks",e??"-",t?"arquivados":"ativos"]}function Bd(e){return["project","cloneJobs",e]}function hT(e){return["pr","getByWorktree",e]}function fT(e){return["pr","listByProject",e]}function mT(e){return["pr","draft",e]}const pT=["health"],pg=["system","updateStatus"],_T=["agentAccount","rateLimits"],gT=["system","resources"],vT=["system","live"],yT=["workspace","recent"];function bT(e){return["usage","total",e]}const kj=["system","settings"];function rc(){return["agentConfig","list"]}function xT(e){return["adapterCatalog","list",e??"-"]}function ST(){return["agentAccount","list"]}function Nj(){return["secrets"]}function _g(){return["setup","agents"]}const Ej=["setup","probe"];function wT(e,t){return["setup","probe",e,t.join(" ")]}function jT(e){return["setup","probe","account",e]}const CT=["setup","preflight"];function kT(e){return["setup","authState",e]}function NT(e){return["project","inspect",e]}function ET(e,t){return["worktree","plan",e,t]}function TT(e,t,s){return["project","parseSource",e,t,s]}function AT(e){return["task","getByWorktree",e]}function OT(e){return["session","byTask",e]}function RT(e){return["usage","byTask",e]}const gg=["memory"],zd=["pr"],Tj=["files"],Nc=["changes"],Aj=["worktree"],Oj=["session"],DT=["project","detail"],MT=["task","get"],LT=["task","board"],BT=["task","settings"],vg=["agentAccount"],qd=["adapterCatalog","list"];var zT=Object.create,Rj=Object.defineProperty,qT=Object.getOwnPropertyDescriptor,Dj=Object.getOwnPropertyNames,PT=Object.getPrototypeOf,IT=Object.prototype.hasOwnProperty,Wi=(e,t)=>function(){return t||(0,e[Dj(e)[0]])((t={exports:{}}).exports,t),t.exports},HT=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Dj(t),l=0,d=o.length,h;l<d;l++)h=o[l],!IT.call(e,h)&&h!==s&&Rj(e,h,{get:(f=>t[f]).bind(null,h),enumerable:!(n=qT(t,h))||n.enumerable});return e},Rt=(e,t,s)=>(s=e!=null?zT(PT(e)):{},HT(t||!e||!e.__esModule?Rj(s,"default",{value:e,enumerable:!0}):s,e)),Mj=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function s(n){"@babel/helpers - typeof";return t.exports=s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t.exports.__esModule=!0,t.exports.default=t.exports,s(n)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),FT=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var s=Mj().default;function n(o,l){if(s(o)!="object"||!o)return o;var d=o[Symbol.toPrimitive];if(d!==void 0){var h=d.call(o,l||"default");if(s(h)!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),UT=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var s=Mj().default,n=FT();function o(l){var d=n(l,"string");return s(d)=="symbol"?d:d+""}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}}),_a=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var s=UT();function n(o,l,d){return(l=s(l))in o?Object.defineProperty(o,l,{value:d,enumerable:!0,configurable:!0,writable:!0}):o[l]=d,o}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),ji=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var s=_a();function n(l,d){var h=Object.keys(l);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(l);d&&(f=f.filter(function(m){return Object.getOwnPropertyDescriptor(l,m).enumerable})),h.push.apply(h,f)}return h}function o(l){for(var d=1;d<arguments.length;d++){var h=arguments[d]!=null?arguments[d]:{};d%2?n(Object(h),!0).forEach(function(f){s(l,f,h[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(h)):n(Object(h)).forEach(function(f){Object.defineProperty(l,f,Object.getOwnPropertyDescriptor(h,f))})}return l}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}});function ga(e){const t={subscribe(s){let n=null,o=!1,l=!1,d=!1;function h(){if(n===null){d=!0;return}l||(l=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=e({next(f){var m;o||(m=s.next)===null||m===void 0||m.call(s,f)},error(f){var m;o||(o=!0,(m=s.error)===null||m===void 0||m.call(s,f),h())},complete(){var f;o||(o=!0,(f=s.complete)===null||f===void 0||f.call(s),h())}}),d&&h(),{unsubscribe:h}},pipe(...s){return s.reduce($T,t)}};return t}function $T(e,t){return t(e)}function KT(e){const t=new AbortController;return new Promise((n,o)=>{let l=!1;function d(){l||(l=!0,h.unsubscribe())}t.signal.addEventListener("abort",()=>{o(t.signal.reason)});const h=e.subscribe({next(f){l=!0,n(f),d()},error(f){o(f)},complete(){t.abort(),d()}})})}function WT(e){return t=>{let s=0,n=null;const o=[];function l(){n||(n=t.subscribe({next(h){for(const m of o){var f;(f=m.next)===null||f===void 0||f.call(m,h)}},error(h){for(const m of o){var f;(f=m.error)===null||f===void 0||f.call(m,h)}},complete(){for(const f of o){var h;(h=f.complete)===null||h===void 0||h.call(f)}}}))}function d(){if(s===0&&n){const h=n;n=null,h.unsubscribe()}}return ga(h=>(s++,o.push(h),l(),{unsubscribe(){s--,d();const f=o.findIndex(m=>m===h);f>-1&&o.splice(f,1)}}))}}function Lj(e){let t=e;const s=[],n=d=>{t!==void 0&&d.next(t),s.push(d)},o=d=>{s.splice(s.indexOf(d),1)},l=ga(d=>(n(d),()=>{o(d)}));return l.next=d=>{if(t!==d){t=d;for(const h of s)h.next(d)}},l.get=()=>t,l}function Bj(e){return ga(t=>{function s(o=0,l=e.op){const d=e.links[o];if(!d)throw new Error("No more links to execute - did you forget to add an ending link?");return d({op:l,next(f){return s(o+1,f)}})}return s().subscribe(t)})}function kS(e){return Array.isArray(e)?e:[e]}function NS(e){return t=>{const s=kS(e.true).map(o=>o(t)),n=kS(e.false).map(o=>o(t));return o=>ga(l=>{const d=e.condition(o.op)?s:n;return Bj({op:o.op,links:d}).subscribe(l)})}}function ac(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function zj(){return Object.create(null)}const qj=e=>e(),ad={INTERNAL_SERVER_ERROR:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603},VT=[ad.BAD_GATEWAY,ad.SERVICE_UNAVAILABLE,ad.GATEWAY_TIMEOUT,ad.INTERNAL_SERVER_ERROR];var YT=Object.create,Pj=Object.defineProperty,GT=Object.getOwnPropertyDescriptor,Ij=Object.getOwnPropertyNames,QT=Object.getPrototypeOf,ZT=Object.prototype.hasOwnProperty,Ci=(e,t)=>function(){return t||(0,e[Ij(e)[0]])((t={exports:{}}).exports,t),t.exports},XT=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Ij(t),l=0,d=o.length,h;l<d;l++)h=o[l],!ZT.call(e,h)&&h!==s&&Pj(e,h,{get:(f=>t[f]).bind(null,h),enumerable:!(n=GT(t,h))||n.enumerable});return e},ht=(e,t,s)=>(s=e!=null?YT(QT(e)):{},XT(Pj(s,"default",{value:e,enumerable:!0}),e));const Hj=()=>{},ES=e=>{Object.freeze&&Object.freeze(e)};function Fj(e,t,s){var n;const o=t.join(".");return(n=s[o])!==null&&n!==void 0||(s[o]=new Proxy(Hj,{get(l,d){if(!(typeof d!="string"||d==="then"))return Fj(e,[...t,d],s)},apply(l,d,h){const f=t[t.length-1];if(f==="valueOf"||f==="toString"||f==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let m={args:h,path:t};return f==="call"?m={args:h.length>=2?[h[1]]:[],path:t.slice(0,-1)}:f==="apply"&&(m={args:h.length>=2?h[1]:[],path:t.slice(0,-1)}),ES(m.args),ES(m.path),e(m)}})),s[o]}const JT=e=>Fj(e,[],zj()),eA=e=>new Proxy(Hj,{get(t,s){if(s!=="then")return e(s)}});var Uj=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function s(n){"@babel/helpers - typeof";return t.exports=s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t.exports.__esModule=!0,t.exports.default=t.exports,s(n)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),tA=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var s=Uj().default;function n(o,l){if(s(o)!="object"||!o)return o;var d=o[Symbol.toPrimitive];if(d!==void 0){var h=d.call(o,l||"default");if(s(h)!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),sA=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var s=Uj().default,n=tA();function o(l){var d=n(l,"string");return s(d)=="symbol"?d:d+""}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}}),yg=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var s=sA();function n(o,l,d){return(l=s(l))in o?Object.defineProperty(o,l,{value:d,enumerable:!0,configurable:!0,writable:!0}):o[l]=d,o}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ec=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var s=yg();function n(l,d){var h=Object.keys(l);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(l);d&&(f=f.filter(function(m){return Object.getOwnPropertyDescriptor(l,m).enumerable})),h.push.apply(h,f)}return h}function o(l){for(var d=1;d<arguments.length;d++){var h=arguments[d]!=null?arguments[d]:{};d%2?n(Object(h),!0).forEach(function(f){s(l,f,h[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(h)):n(Object(h)).forEach(function(f){Object.defineProperty(l,f,Object.getOwnPropertyDescriptor(h,f))})}return l}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}});ht(Ec());ht(yg());var od=ht(Ec());function iA(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,od.default)((0,od.default)({},e),{},{error:n})}}return{ok:!0,result:(0,od.default)((0,od.default)({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var Vm=class extends Error{constructor(){super("Unable to transform response from server")}};function $j(e,t){let s;try{s=iA(e,t)}catch{throw new Vm}if(!s.ok&&(!ac(s.error.error)||typeof s.error.error.code!="number"))throw new Vm;if(s.ok&&!ac(s.result))throw new Vm;return s}ht(Ec());ht(Ec());var ld=ht(yg());let Kj;const Ym=new WeakMap,nA=()=>{};Kj=Symbol.toStringTag;var Wj=class Fr{constructor(t){(0,ld.default)(this,"promise",void 0),(0,ld.default)(this,"subscribers",[]),(0,ld.default)(this,"settlement",null),(0,ld.default)(this,Kj,"Unpromise"),typeof t=="function"?this.promise=new Promise(t):this.promise=t;const s=this.promise.then(n=>{const{subscribers:o}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:n},o==null||o.forEach(({resolve:l})=>{l(n)})});"catch"in s&&s.catch(n=>{const{subscribers:o}=this;this.subscribers=null,this.settlement={status:"rejected",reason:n},o==null||o.forEach(({reject:l})=>{l(n)})})}subscribe(){let t,s;const{settlement:n}=this;if(n===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const o=aA();this.subscribers=oA(this.subscribers,o),t=o.promise,s=()=>{this.subscribers!==null&&(this.subscribers=cA(this.subscribers,o))}}else{const{status:o}=n;o==="fulfilled"?t=Promise.resolve(n.value):t=Promise.reject(n.reason),s=nA}return Object.assign(t,{unsubscribe:s})}then(t,s){const n=this.subscribe(),{unsubscribe:o}=n;return Object.assign(n.then(t,s),{unsubscribe:o})}catch(t){const s=this.subscribe(),{unsubscribe:n}=s;return Object.assign(s.catch(t),{unsubscribe:n})}finally(t){const s=this.subscribe(),{unsubscribe:n}=s;return Object.assign(s.finally(t),{unsubscribe:n})}static proxy(t){const s=Fr.getSubscribablePromise(t);return typeof s<"u"?s:Fr.createSubscribablePromise(t)}static createSubscribablePromise(t){const s=new Fr(t);return Ym.set(t,s),Ym.set(s,s),s}static getSubscribablePromise(t){return Ym.get(t)}static resolve(t){const s=typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"?t:Promise.resolve(t);return Fr.proxy(s).subscribe()}static async any(t){const n=(Array.isArray(t)?t:[...t]).map(Fr.resolve);try{return await Promise.any(n)}finally{n.forEach(({unsubscribe:o})=>{o()})}}static async race(t){const n=(Array.isArray(t)?t:[...t]).map(Fr.resolve);try{return await Promise.race(n)}finally{n.forEach(({unsubscribe:o})=>{o()})}}static async raceReferences(t){const s=t.map(rA);try{return await Promise.race(s)}finally{for(const n of s)n.unsubscribe()}}};function rA(e){return Wj.proxy(e).then(()=>[e])}function aA(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}function oA(e,t){return[...e,t]}function lA(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function cA(e,t){const s=e.indexOf(t);return s!==-1?lA(e,s):e}var TS,AS,OS,RS;(AS=(TS=Symbol).dispose)!==null&&AS!==void 0||(TS.dispose=Symbol());(RS=(OS=Symbol).asyncDispose)!==null&&RS!==void 0||(OS.asyncDispose=Symbol());function uA(e,t){const s=e,n=s[Symbol.dispose];return s[Symbol.dispose]=()=>{t(),n==null||n()},s}function dA(e,t){const s=e,n=s[Symbol.asyncDispose];return s[Symbol.asyncDispose]=async()=>{await t(),await(n==null?void 0:n())},s}const Vj=Symbol();function hA(e){let t=null;return uA({start(){if(t)throw new Error("Timer already started");return new Promise(n=>{t=setTimeout(()=>n(Vj),e)})}},()=>{t&&clearTimeout(t)})}var Tc=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function s(){var n=typeof SuppressedError=="function"?SuppressedError:function(h,f){var m=Error();return m.name="SuppressedError",m.error=h,m.suppressed=f,m},o={},l=[];function d(h,f){if(f!=null){if(Object(f)!==f)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(h)var m=f[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=f[Symbol.dispose||Symbol.for("Symbol.dispose")],h))var g=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");g&&(m=function(){try{g.call(f)}catch(y){return Promise.reject(y)}}),l.push({v:f,d:m,a:h})}else h&&l.push({d:f,a:h});return f}return{e:o,u:d.bind(null,!1),a:d.bind(null,!0),d:function(){var f,m=this.e,g=0;function v(){for(;f=l.pop();)try{if(!f.a&&g===1)return g=0,l.push(f),Promise.resolve().then(v);if(f.d){var x=f.d.call(f.v);if(f.a)return g|=2,Promise.resolve(x).then(v,y)}else g|=1}catch(S){return y(S)}if(g===1)return m!==o?Promise.reject(m):Promise.resolve();if(m!==o)throw m}function y(x){return m=m!==o?new n(x,m):x,v()}return v()}}}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),bg=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function s(n,o){this.v=n,this.k=o}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ac=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var s=bg();function n(o){return new s(o,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Mo=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var s=bg();function n(l){return function(){return new o(l.apply(this,arguments))}}function o(l){var d,h;function f(g,v){try{var y=l[g](v),x=y.value,S=x instanceof s;Promise.resolve(S?x.v:x).then(function(w){if(S){var k=g==="return"?"return":"next";if(!x.k||w.done)return f(k,w);w=l[k](w).value}m(y.done?"return":"normal",w)},function(w){f("throw",w)})}catch(w){m("throw",w)}}function m(g,v){switch(g){case"return":d.resolve({value:v,done:!0});break;case"throw":d.reject(v);break;default:d.resolve({value:v,done:!1})}(d=d.next)?f(d.key,d.arg):h=null}this._invoke=function(g,v){return new Promise(function(y,x){var S={key:g,arg:v,resolve:y,reject:x,next:null};h?h=h.next=S:(d=h=S,f(g,v))})},typeof l.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(l){return this._invoke("next",l)},o.prototype.throw=function(l){return this._invoke("throw",l)},o.prototype.return=function(l){return this._invoke("return",l)},t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});ht(Tc());ht(Ac());ht(Mo());ht(Tc());ht(Ac());ht(Mo());ht(Tc());ht(Ac());ht(Mo());var Yj=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function s(o){var l,d,h,f=2;for(typeof Symbol<"u"&&(d=Symbol.asyncIterator,h=Symbol.iterator);f--;){if(d&&(l=o[d])!=null)return l.call(o);if(h&&(l=o[h])!=null)return new n(l.call(o));d="@@asyncIterator",h="@@iterator"}throw new TypeError("Object is not async iterable")}function n(o){function l(d){if(Object(d)!==d)return Promise.reject(new TypeError(d+" is not an object."));var h=d.done;return Promise.resolve(d.value).then(function(f){return{value:f,done:h}})}return n=function(h){this.s=h,this.n=h.next},n.prototype={s:null,n:null,next:function(){return l(this.n.apply(this.s,arguments))},return:function(h){var f=this.s.return;return f===void 0?Promise.resolve({value:h,done:!0}):l(f.apply(this.s,arguments))},throw:function(h){var f=this.s.return;return f===void 0?Promise.reject(h):l(f.apply(this.s,arguments))}},new n(o)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}});ht(Ac());ht(Mo());ht(Tc());ht(Yj());var fA=Ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js"(e,t){var s=bg();function n(o){var l={},d=!1;function h(f,m){return d=!0,m=new Promise(function(g){g(o[f](m))}),{done:!1,value:new s(m,1)}}return l[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},l.next=function(f){return d?(d=!1,f):h("next",f)},typeof o.throw=="function"&&(l.throw=function(f){if(d)throw d=!1,f;return h("throw",f)}),typeof o.return=="function"&&(l.return=function(f){return d?(d=!1,f):h("return",f)}),l}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});ht(Yj());var DS=ht(Ac()),mA=ht(Mo());ht(fA());var Gj=ht(Tc());const pA="ping",_A="serialized-error",gA="connected",vA="return";async function yA(e){try{var t=(0,Gj.default)();const s=t.u(hA(e.timeoutMs)),n=await Wj.race([e.promise,s.start()]);return n===Vj?await e.onTimeout():n}catch(s){t.e=s}finally{t.d()}}function bA(e){const{deserialize:t=h=>h}=e;let s=zj();const n=e.signal;let o=null;const l=()=>new ReadableStream({async start(h){const[f,m]=await Promise.all([e.url(),e.init()]),g=o=new e.EventSource(f,m);h.enqueue({type:"connecting",eventSource:o,event:null}),g.addEventListener(gA,y=>{const S=JSON.parse(y.data);s=S,h.enqueue({type:"connected",options:S,eventSource:g})}),g.addEventListener(_A,y=>{const x=y;h.enqueue({type:"serialized-error",error:t(JSON.parse(x.data)),eventSource:g})}),g.addEventListener(pA,()=>{h.enqueue({type:"ping",eventSource:g})}),g.addEventListener(vA,()=>{g.close(),h.close(),o=null}),g.addEventListener("error",y=>{g.readyState===g.CLOSED?h.error(y):h.enqueue({type:"connecting",eventSource:g,event:y})}),g.addEventListener("message",y=>{const x=y,w={data:t(JSON.parse(x.data))};x.lastEventId&&(w.id=x.lastEventId),h.enqueue({type:"data",data:w,eventSource:g})});const v=()=>{try{g.close(),h.close()}catch{}};n.aborted?v():n.addEventListener("abort",v)},cancel(){o==null||o.close()}}),d=()=>{let h=l(),f=h.getReader();async function m(){await f.cancel(),o=null}return dA({read(){return f.read()},async recreate(){await m(),h=l(),f=h.getReader()}},m)};return qj((0,mA.default)(function*(){try{var h=(0,Gj.default)();const f=h.a(d());for(;;){let m=f.read();const g=s.reconnectAfterInactivityMs;g&&(m=yA({promise:m,timeoutMs:g,onTimeout:async()=>{const y={value:{type:"timeout",ms:g,eventSource:o},done:!1};return await f.recreate(),y}}));const v=yield(0,DS.default)(m);if(v.done)return v.value;yield v.value}}catch(f){h.e=f}finally{yield(0,DS.default)(h.d())}}))}ht(Mo());ht(Ec());var cd=Rt(_a(),1),ro=Rt(ji(),1);function xA(e){return e instanceof qi}function SA(e){return ac(e)&&ac(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function wA(e,t){return typeof e=="string"?e:ac(e)&&typeof e.message=="string"?e.message:t}var qi=class Nd extends Error{constructor(t,s){var n,o;const l=s==null?void 0:s.cause;super(t,{cause:l}),(0,cd.default)(this,"cause",void 0),(0,cd.default)(this,"shape",void 0),(0,cd.default)(this,"data",void 0),(0,cd.default)(this,"meta",void 0),this.meta=s==null?void 0:s.meta,this.cause=l,this.shape=s==null||(n=s.result)===null||n===void 0?void 0:n.error,this.data=s==null||(o=s.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Nd.prototype)}static from(t,s={}){const n=t;return xA(n)?(s.meta&&(n.meta=(0,ro.default)((0,ro.default)({},n.meta),s.meta)),n):SA(n)?new Nd(n.error.message,(0,ro.default)((0,ro.default)({},s),{},{result:n,cause:s.cause})):new Nd(wA(n,"Unknown error"),(0,ro.default)((0,ro.default)({},s),{},{cause:n}))}};function Qj(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:s=>s,deserialize:s=>s},output:{serialize:s=>s,deserialize:s=>s}}}const MS=e=>typeof e=="function";function jA(e){if(e)return e;if(typeof window<"u"&&MS(window.fetch))return window.fetch;if(typeof globalThis<"u"&&MS(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var Jl=Rt(ji());function Zj(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Qj(e.transformer),methodOverride:e.methodOverride}}function CA(e){const t={};for(let s=0;s<e.length;s++){const n=e[s];t[s]=n}return t}const kA={query:"GET",mutation:"POST",subscription:"PATCH"};function Xj(e){return"input"in e?e.transformer.input.serialize(e.input):CA(e.inputs.map(t=>e.transformer.input.serialize(t)))}const oc=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const o=[];if(t[1]&&o.push(t[1]),"inputs"in e&&o.push("batch=1"),e.type==="query"||e.type==="subscription"){const l=Xj(e);l!==void 0&&e.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(l))}`)}return o.length&&(n+="?"+o.join("&")),n},NA=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Xj(e);return t!==void 0?JSON.stringify(t):void 0},Jj=e=>Fp((0,Jl.default)((0,Jl.default)({},e),{},{contentTypeHeader:"application/json",getUrl:oc,getBody:NA}));var EA=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const TA=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new EA};async function AA(e){var t,s;TA(e.signal);const n=e.getUrl(e),o=e.getBody(e),l=(t=e.methodOverride)!==null&&t!==void 0?t:kA[e.type],d=await(async()=>{const f=await e.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),h=(0,Jl.default)((0,Jl.default)((0,Jl.default)({},e.contentTypeHeader&&l!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(s=e.trpcAcceptHeaderKey)!==null&&s!==void 0?s:"trpc-accept"]:e.trpcAcceptHeader}:void 0),d);return jA(e.fetch)(n,{method:l,signal:e.signal,body:o,headers:h})}async function Fp(e){const t={},s=await AA(e);t.response=s;const n=await s.json();return t.responseJSON=n,{json:n,meta:t}}function OA(e){return e instanceof Uint8Array||e instanceof Blob}function RA(e){return e instanceof FormData}var co=Rt(ji(),1);const DA=e=>{if("input"in e){const{input:t}=e;if(RA(t)){if(e.type!=="mutation"&&e.methodOverride!=="POST")throw new Error("FormData is only supported for mutations");return Fp((0,co.default)((0,co.default)({},e),{},{contentTypeHeader:void 0,getUrl:oc,getBody:()=>t}))}if(OA(t)){if(e.type!=="mutation"&&e.methodOverride!=="POST")throw new Error("Octet type input is only supported for mutations");return Fp((0,co.default)((0,co.default)({},e),{},{contentTypeHeader:"application/octet-stream",getUrl:oc,getBody:()=>t}))}}return Jj(e)};function MA(e){const t=Zj(e);return()=>s=>{const{op:n}=s;return ga(o=>{const{path:l,input:d,type:h}=n;/* istanbul ignore if -- @preserve */if(h==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const f=DA((0,co.default)((0,co.default)({},t),{},{type:h,path:l,input:d,signal:n.signal,headers(){return e.headers?typeof e.headers=="function"?e.headers({op:n}):e.headers:{}}}));let m;return f.then(g=>{m=g.meta;const v=$j(g.json,t.transformer.output);if(!v.ok){o.error(qi.from(v.error,{meta:m}));return}o.next({context:g.meta,result:v.result}),o.complete()}).catch(g=>{o.error(qi.from(g,{meta:m}))}),()=>{}})}}const LS=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function BS(e){let t=null,s=null;const n=()=>{clearTimeout(s),s=null,t=null};function o(h){const f=[[]];let m=0;for(;;){const y=h[m];if(!y)break;const x=f[f.length-1];if(y.aborted){var g;(g=y.reject)===null||g===void 0||g.call(y,new Error("Aborted")),m++;continue}if(e.validate(x.concat(y).map(w=>w.key))){x.push(y),m++;continue}if(x.length===0){var v;(v=y.reject)===null||v===void 0||v.call(y,new Error("Input is too big for a single dispatch")),m++;continue}f.push([])}return f}function l(){const h=o(t);n();for(const f of h){if(!f.length)continue;const m={items:f};for(const v of f)v.batch=m;e.fetch(m.items.map(v=>v.key)).then(async v=>{await Promise.all(v.map(async(x,S)=>{const w=m.items[S];try{var k;const D=await Promise.resolve(x);(k=w.resolve)===null||k===void 0||k.call(w,D)}catch(D){var E;(E=w.reject)===null||E===void 0||E.call(w,D)}w.batch=null,w.reject=null,w.resolve=null}));for(const x of m.items){var y;(y=x.reject)===null||y===void 0||y.call(x,new Error("Missing result")),x.batch=null}}).catch(v=>{for(const x of m.items){var y;(y=x.reject)===null||y===void 0||y.call(x,v),x.batch=null}})}}function d(h){var f;const m={aborted:!1,key:h,batch:null,resolve:LS,reject:LS},g=new Promise((v,y)=>{var x;m.reject=y,m.resolve=v,(x=t)!==null&&x!==void 0||(t=[]),t.push(m)});return(f=s)!==null&&f!==void 0||(s=setTimeout(l)),g}return{load:d}}function LA(...e){const t=new AbortController,s=e.length;let n=0;const o=()=>{++n===s&&t.abort()};for(const l of e)l!=null&&l.aborted?o():l==null||l.addEventListener("abort",o,{once:!0});return t.signal}function BA(...e){const t=new AbortController;for(const s of e)s!=null&&s.aborted?t.abort():s==null||s.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}var ud=Rt(ji(),1);function zA(e){var t,s;const n=Zj(e),o=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,l=(s=e.maxItems)!==null&&s!==void 0?s:1/0;return()=>{const d=g=>({validate(v){if(o===1/0&&l===1/0)return!0;if(v.length>l)return!1;const y=v.map(w=>w.path).join(","),x=v.map(w=>w.input);return oc((0,ud.default)((0,ud.default)({},n),{},{type:g,path:y,inputs:x,signal:null})).length<=o},async fetch(v){const y=v.map(D=>D.path).join(","),x=v.map(D=>D.input),S=LA(...v.map(D=>D.signal)),w=await Jj((0,ud.default)((0,ud.default)({},n),{},{path:y,inputs:x,type:g,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:v}):e.headers:{}},signal:S}));return(Array.isArray(w.json)?w.json:v.map(()=>w.json)).map(D=>({meta:w.meta,json:D}))}}),h=BS(d("query")),f=BS(d("mutation")),m={query:h,mutation:f};return({op:g})=>ga(v=>{/* istanbul ignore if -- @preserve */if(g.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const x=m[g.type].load(g);let S;return x.then(w=>{S=w;const k=$j(w.json,n.transformer.output);if(!k.ok){v.error(qi.from(k.error,{meta:w.meta}));return}v.next({context:w.meta,result:k.result}),v.complete()}).catch(w=>{v.error(qi.from(w,{meta:S==null?void 0:S.meta}))}),()=>{}})}}Rt(ji(),1);const lc=(e,...t)=>typeof e=="function"?e(...t):e;Rt(_a(),1);function qA(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}async function PA(e){const t=await lc(e.url);if(!e.connectionParams)return t;const n=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+n}async function IA(e,t){const s={method:"connectionParams",data:await lc(e)};return t.encode(s)}Rt(_a(),1);var ir=Rt(_a(),1);function HA(e){const{promise:t,resolve:s,reject:n}=qA();return e.addEventListener("open",()=>{e.removeEventListener("error",n),s()}),e.addEventListener("error",n),t}function FA(e,{intervalMs:t,pongTimeoutMs:s}){let n,o;function l(){n=setTimeout(()=>{e.send("PING"),o=setTimeout(()=>{e.close()},s)},t)}function d(){clearTimeout(n),l()}function h(){clearTimeout(o),d()}e.addEventListener("open",l),e.addEventListener("message",({data:f})=>{clearTimeout(n),l(),f==="PONG"&&h()}),e.addEventListener("close",()=>{clearTimeout(n),clearTimeout(o)})}var UA=class Up{constructor(t){var s;if((0,ir.default)(this,"id",++Up.connectCount),(0,ir.default)(this,"WebSocketPonyfill",void 0),(0,ir.default)(this,"urlOptions",void 0),(0,ir.default)(this,"keepAliveOpts",void 0),(0,ir.default)(this,"encoder",void 0),(0,ir.default)(this,"wsObservable",Lj(null)),(0,ir.default)(this,"openPromise",null),this.WebSocketPonyfill=(s=t.WebSocketPonyfill)!==null&&s!==void 0?s:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++Up.connectCount;const s=PA(t.urlOptions).then(n=>new t.WebSocketPonyfill(n));t.openPromise=s.then(async n=>{t.ws=n,n.binaryType="arraybuffer",n.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),t.keepAliveOpts.enabled&&FA(n,t.keepAliveOpts),n.addEventListener("close",()=>{t.ws===n&&(t.ws=null)}),await HA(n),t.urlOptions.connectionParams&&n.send(await IA(t.urlOptions.connectionParams,t.encoder))});try{await t.openPromise}finally{t.openPromise=null}}async close(){var t=this;try{await t.openPromise}finally{var s;(s=t.ws)===null||s===void 0||s.close()}}};(0,ir.default)(UA,"connectCount",0);Rt(_a(),1);Rt(ji(),1);var Gm=Rt(_a(),1),zS=Rt(ji(),1),$A=class{constructor(e){(0,Gm.default)(this,"links",void 0),(0,Gm.default)(this,"runtime",void 0),(0,Gm.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Bj({links:this.links,op:(0,zS.default)((0,zS.default)({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(WT())}async requestAsPromise(e){var t=this;try{const s=t.$request(e);return(await KT(s)).result.data}catch(s){throw qi.from(s)}}query(e,t,s){return this.requestAsPromise({type:"query",path:e,input:t,context:s==null?void 0:s.context,signal:s==null?void 0:s.signal})}mutation(e,t,s){return this.requestAsPromise({type:"mutation",path:e,input:t,context:s==null?void 0:s.context,signal:s==null?void 0:s.signal})}subscription(e,t,s){return this.$request({type:"subscription",path:e,input:t,context:s.context,signal:s.signal}).subscribe({next(o){switch(o.result.type){case"state":{var l;(l=s.onConnectionStateChange)===null||l===void 0||l.call(s,o.result);break}case"started":{var d;(d=s.onStarted)===null||d===void 0||d.call(s,{context:o.context});break}case"stopped":{var h;(h=s.onStopped)===null||h===void 0||h.call(s);break}case"data":case void 0:{var f;(f=s.onData)===null||f===void 0||f.call(s,o.result.data);break}}},error(o){var l;(l=s.onError)===null||l===void 0||l.call(s,o)},complete(){var o;(o=s.onComplete)===null||o===void 0||o.call(s)}})}};const KA=Symbol.for("trpc_untypedClient"),WA={query:"query",mutate:"mutation",subscribe:"subscription"},VA=e=>WA[e];function YA(e){const t=JT(({path:s,args:n})=>{const o=[...s],l=VA(o.pop()),d=o.join(".");return e[l](d,...n)});return eA(s=>s===KA?e:t[s])}function GA(e){const t=new $A(e);return YA(t)}Rt(ji(),1);var qS=Rt(ji(),1);function QA(e,t){return!t||e!=null&&typeof e!="object"?e:(0,qS.default)((0,qS.default)({},e??{}),{},{lastEventId:t})}var ZA=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function s(o){var l,d,h,f=2;for(typeof Symbol<"u"&&(d=Symbol.asyncIterator,h=Symbol.iterator);f--;){if(d&&(l=o[d])!=null)return l.call(o);if(h&&(l=o[h])!=null)return new n(l.call(o));d="@@asyncIterator",h="@@iterator"}throw new TypeError("Object is not async iterable")}function n(o){function l(d){if(Object(d)!==d)return Promise.reject(new TypeError(d+" is not an object."));var h=d.done;return Promise.resolve(d.value).then(function(f){return{value:f,done:h}})}return n=function(h){this.s=h,this.n=h.next},n.prototype={s:null,n:null,next:function(){return l(this.n.apply(this.s,arguments))},return:function(h){var f=this.s.return;return f===void 0?Promise.resolve({value:h,done:!0}):l(f.apply(this.s,arguments))},throw:function(h){var f=this.s.return;return f===void 0?Promise.reject(h):l(f.apply(this.s,arguments))}},new n(o)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),XA=Rt(ZA(),1);async function JA(e){let t=await lc(e.url);if(e.connectionParams){const s=await lc(e.connectionParams),n=t.includes("?")?"&":"?";t+=n+"connectionParams="+encodeURIComponent(JSON.stringify(s))}return t}function eO(e){const t=Qj(e.transformer);return()=>({op:s})=>ga(n=>{var o;const{type:l,path:d,input:h}=s;/* istanbul ignore if -- @preserve */if(l!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let f;const m=new AbortController,g=BA(s.signal,m.signal),v=bA({url:async()=>oc({transformer:t,url:await JA(e),input:QA(h,f),path:d,type:l,signal:null}),init:()=>lc(e.eventSourceOptions,{op:s}),signal:g,deserialize:S=>t.output.deserialize(S),EventSource:(o=e.EventSource)!==null&&o!==void 0?o:globalThis.EventSource}),y=Lj({type:"state",state:"connecting",error:null}),x=y.subscribe({next(S){n.next({result:S})}});return qj(async()=>{var S=!1,w=!1,k;try{for(var E=(0,XA.default)(v),D;S=!(D=await E.next()).done;S=!1){const A=D.value;switch(A.type){case"ping":break;case"data":const N=A.data;let z;N.id?(f=N.id,z={id:N.id,data:N}):z={data:N.data},n.next({result:z,context:{eventSource:A.eventSource}});break;case"connected":{n.next({result:{type:"started"},context:{eventSource:A.eventSource}}),y.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const V=qi.from({error:A.error});if(VT.includes(A.error.code)){y.next({type:"state",state:"connecting",error:V});break}throw V}case"connecting":{const V=y.get(),ee=A.event&&qi.from(A.event);if(!ee&&V.state==="connecting")break;y.next({type:"state",state:"connecting",error:ee});break}case"timeout":y.next({type:"state",state:"connecting",error:new qi(`Timeout of ${A.ms}ms reached while waiting for a response`)})}}}catch(A){w=!0,k=A}finally{try{S&&E.return!=null&&await E.return()}finally{if(w)throw k}}n.next({result:{type:"stopped"}}),y.next({type:"state",state:"idle",error:null}),n.complete()}).catch(S=>{n.error(qi.from(S))}),()=>{n.complete(),m.abort(),x.unsubscribe()}})}Rt(ji(),1);var tO=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function s(){var n=typeof SuppressedError=="function"?SuppressedError:function(h,f){var m=Error();return m.name="SuppressedError",m.error=h,m.suppressed=f,m},o={},l=[];function d(h,f){if(f!=null){if(Object(f)!==f)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(h)var m=f[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=f[Symbol.dispose||Symbol.for("Symbol.dispose")],h))var g=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");g&&(m=function(){try{g.call(f)}catch(y){return Promise.reject(y)}}),l.push({v:f,d:m,a:h})}else h&&l.push({d:f,a:h});return f}return{e:o,u:d.bind(null,!1),a:d.bind(null,!0),d:function(){var f,m=this.e,g=0;function v(){for(;f=l.pop();)try{if(!f.a&&g===1)return g=0,l.push(f),Promise.resolve().then(v);if(f.d){var x=f.d.call(f.v);if(f.a)return g|=2,Promise.resolve(x).then(v,y)}else g|=1}catch(S){return y(S)}if(g===1)return m!==o?Promise.reject(m):Promise.resolve();if(m!==o)throw m}function y(x){return m=m!==o?new n(x,m):x,v()}return v()}}}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),e1=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function s(n,o){this.v=n,this.k=o}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}}),sO=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var s=e1();function n(o){return new s(o,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),iO=Wi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var s=e1();function n(l){return function(){return new o(l.apply(this,arguments))}}function o(l){var d,h;function f(g,v){try{var y=l[g](v),x=y.value,S=x instanceof s;Promise.resolve(S?x.v:x).then(function(w){if(S){var k=g==="return"?"return":"next";if(!x.k||w.done)return f(k,w);w=l[k](w).value}m(y.done?"return":"normal",w)},function(w){f("throw",w)})}catch(w){m("throw",w)}}function m(g,v){switch(g){case"return":d.resolve({value:v,done:!0});break;case"throw":d.reject(v);break;default:d.resolve({value:v,done:!1})}(d=d.next)?f(d.key,d.arg):h=null}this._invoke=function(g,v){return new Promise(function(y,x){var S={key:g,arg:v,resolve:y,reject:x,next:null};h?h=h.next=S:(d=h=S,f(g,v))})},typeof l.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(l){return this._invoke("next",l)},o.prototype.throw=function(l){return this._invoke("throw",l)},o.prototype.return=function(l){return this._invoke("return",l)},t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});Rt(tO(),1);Rt(sO(),1);Rt(iO(),1);Rt(ji(),1);const nO=new Set(["setup.probe","setup.authenticate","setup.installAdapter","session.createAgent","session.continueIn","worktree.start"]);function rO(e){return nO.has(e)}const aO=4e3,Q=GA({links:[NS({condition:e=>e.type==="subscription",true:eO({url:"/trpc"}),false:NS({condition:e=>rO(e.path),true:MA({url:"/trpc"}),false:zA({url:"/trpc",maxURLLength:aO})})})]}),oO={connecting:"conectando",counting:"contando objetos",compressing:"comprimindo",receiving:"recebendo objetos",resolving:"resolvendo deltas",checkout:"preparando arquivos"},lO=new Set(["done","failed","cancelled"]);function Pd(e){return lO.has(e)}function cO(e){const t=be({queryKey:Bd(e),queryFn:()=>Q.project.cloneJobs.query({workspaceId:e})});return uO(t.data??[])}function uO(e){const t=e.find(s=>!Pd(s.state));return t!==void 0?t:e.reduce((s,n)=>s===null||n.updatedAt>s.updatedAt?n:s,null)}function dO(e){const t=$e(),s=cO(e),n=s!==null&&!Pd(s.state)?s.id:null;return j.useEffect(()=>{if(n===null)return;const o=Q.project.cloneProgress.subscribe({jobId:n},{onData:l=>{const d=l;t.setQueryData(Bd(e),h=>[...(h??[]).filter(m=>m.id!==d.id),d])}});return()=>o.unsubscribe()},[n,e,t]),s}function dh(e,t={}){return be({queryKey:Xl(e),queryFn:()=>Q.project.listByWorkspace.query({workspaceId:e}),enabled:t.enabled??!0})}function t1(e){return be({queryKey:ug(e),queryFn:()=>Q.project.get.query({id:e})})}function xg(e){const t=$e(),s=Se({mutationFn:h=>Q.project.add.mutate({workspaceId:e,...h}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Xl(e)})}}),n=Se({mutationFn:h=>Q.project.clone.mutate({workspaceId:e,...h}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Bd(e)})}}),o=Se({mutationFn:h=>Q.project.cloneCancel.mutate({jobId:h}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Bd(e)})}}),l=Se({mutationFn:h=>Q.project.remove.mutate({id:h}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Xl(e)})}});return{add:s,clone:n,cloneCancel:o,remove:l,invalidateProjects:()=>t.invalidateQueries({queryKey:Xl(e)})}}const hO=250;function fO(e,t,s){const[n,o]=j.useState("");return j.useEffect(()=>{const l=setTimeout(()=>o(t.trim()),hO);return()=>clearTimeout(l)},[t]),be({queryKey:TT(e,n,s.trim()),queryFn:()=>Q.project.parseSource.query({workspaceId:e,source:n,...s.trim()===""?{}:{name:s.trim()}}),enabled:n!==""})}const mO={info:"◆",warning:"⚠",danger:"⚠"};function Ce({tone:e,children:t,actions:s}){return a.jsxs("div",{className:`banner banner--${e}`,role:e==="danger"?"alert":"status",children:[a.jsx("span",{className:"banner__glyph","aria-hidden":"true",children:mO[e]}),a.jsx("span",{children:t}),s!==void 0&&a.jsx("span",{className:"banner__actions",children:s})]})}function J({variant:e="default",size:t="md",glyph:s,className:n,children:o,type:l="button",...d}){const h=["btn",e==="default"?"":`btn--${e}`,t==="sm"?"btn--sm":"",n??""].filter(Boolean).join(" ");return a.jsxs("button",{type:l,className:h,...d,children:[s,o]})}function s1({title:e,lede:t,children:s}){return a.jsxs("div",{className:"card",children:[e!==void 0&&a.jsx("h2",{className:"card__title",children:e}),t!==void 0&&a.jsx("p",{className:"card__lede",children:t}),s]})}const pO={ok:"✓",warn:"⚠",fail:"✕",running:"◐"};function Zs({state:e,what:t,value:s,status:n,action:o}){return a.jsxs("div",{className:`ck ck--${e}`,children:[a.jsx("span",{className:"ck__glyph","aria-hidden":"true",children:pO[e]}),a.jsx("span",{className:"ck__what",children:t}),a.jsx("span",{className:"ck__val",children:s}),a.jsx("span",{className:"ck__st",children:n}),o!==void 0&&a.jsx("span",{className:"ck__act",children:o})]})}function cc({label:e,children:t}){return a.jsx("div",{className:"check",role:"group","aria-label":e,children:t})}function kt({tone:e="neutral",dot:t=!1,children:s}){const n=e==="neutral"?"":` chip--${e}`;return a.jsxs("span",{className:`chip${n}`,children:[t&&a.jsx("span",{className:"chip__dot","aria-hidden":"true"}),s]})}function PS({title:e,description:t,meta:s,glyph:n,selected:o,onSelect:l,disabled:d=!1}){return a.jsxs("button",{type:"button",role:"radio","aria-checked":o,className:`choice${o?" is-on":""}`,disabled:d,onClick:l,children:[a.jsxs("span",{className:"choice__top",children:[n,a.jsx("span",{className:"choice__t",children:e}),a.jsx("span",{className:"choice__mark","aria-hidden":"true",children:o?"◉":"○"})]}),t!==void 0&&a.jsx("span",{className:"choice__d",children:t}),s!==void 0&&a.jsx("span",{className:"choice__meta",children:s})]})}function _O({label:e,columns:t=2,children:s}){return a.jsx("div",{className:`choices${t===2?" choices--2":""}`,role:"radiogroup","aria-label":e,children:s})}function gO({title:e,children:t,onUnderstood:s,onNever:n}){return a.jsxs("div",{className:"coach",role:"note",children:[a.jsxs("span",{className:"coach__t",children:[a.jsx("span",{"aria-hidden":"true",children:"◆"}),e]}),a.jsx("span",{className:"coach__b",children:t}),a.jsxs("span",{className:"coach__acts",children:[a.jsx(J,{size:"sm",variant:"primary",onClick:s,children:"entendi"}),n!==void 0&&a.jsx(J,{size:"sm",variant:"ghost",onClick:n,children:"não mostrar de novo"})]})]})}function Sg({command:e}){const[t,s]=j.useState(!1);j.useEffect(()=>s(!1),[e]),j.useEffect(()=>{if(!t)return;const o=setTimeout(()=>s(!1),1500);return()=>clearTimeout(o)},[t]);const n=navigator.clipboard;return a.jsxs("div",{className:"copy",children:[a.jsx("code",{className:"copy__cmd",children:e}),n!==void 0&&a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{n.writeText(e).then(()=>s(!0),()=>s(!1))},children:t?"copiado":"copiar"})]})}function i1({path:e}){const[t,s]=j.useState(!1);j.useEffect(()=>s(!1),[e]),j.useEffect(()=>{if(!t)return;const o=setTimeout(()=>s(!1),1500);return()=>clearTimeout(o)},[t]);const n=navigator.clipboard;return a.jsxs("span",{className:"path",children:[a.jsx("span",{className:"path__value",children:e}),n!==void 0&&a.jsx("button",{type:"button",className:"path__copy","aria-label":t?"caminho copiado":"copiar caminho",onClick:()=>{n.writeText(e).then(()=>s(!0),()=>s(!1))},children:a.jsx("span",{"aria-hidden":"true",children:t?"✓":"⧉"})})]})}function hs({title:e,children:t,action:s}){return a.jsxs("div",{className:"empty",children:[a.jsx("span",{className:"empty__title",children:e}),t!==void 0&&a.jsx("span",{children:t}),s]})}function ss({widths:e=["70%","40%","100%","70%"],label:t="carregando"}){return a.jsx("div",{role:"status","aria-label":t,children:e.map((s,n)=>a.jsx("div",{className:"skeleton",style:{width:s}},n))})}function Ht({id:e,label:t,error:s,hint:n,children:o}){return a.jsxs("div",{className:"field",children:[a.jsx("label",{className:"field__label",htmlFor:e,children:t}),o,n!==void 0&&a.jsx("span",{className:"field__hint",id:`${e}-hint`,children:n}),s!==void 0&&a.jsx("span",{className:"field__error",id:`${e}-error`,role:"alert",children:s})]})}function Ft({invalid:e=!1,className:t,id:s,...n}){const o=["input",e?"input--error":"",t??""].filter(Boolean).join(" ");return a.jsx("input",{id:s,className:o,"aria-invalid":e||void 0,"aria-describedby":e&&s!==void 0?`${s}-error`:void 0,...n})}function Be({tone:e="none",children:t}){const s=e==="none"?"":` glyph--${e}`;return a.jsx("span",{className:`glyph${s}`,"aria-hidden":"true",children:t})}function n1({name:e,glyph:t,detail:s,state:n,age:o,onSelect:l,action:d}){const h=a.jsxs(a.Fragment,{children:[t,a.jsx("span",{className:"item__name",children:e}),s!==void 0&&a.jsx("span",{className:"item__detail",title:s,children:s}),n!==void 0&&a.jsx("span",{className:`item__state state--${n.tone}`,children:n.label}),o!==void 0&&a.jsx("span",{className:"item__age",children:o})]});return a.jsxs("div",{className:"item",children:[l===void 0?a.jsx("span",{className:"item__main",children:h}):a.jsx("button",{type:"button",className:"item__main",onClick:l,children:h}),d!==void 0&&a.jsx("span",{className:"item__act",children:d})]})}function Oc({label:e,children:t}){return a.jsx("div",{className:"menu",role:"menu","aria-label":e,children:t})}function Pi({children:e,onSelect:t,glyph:s,hint:n,disabled:o=!1}){return a.jsxs("button",{type:"button",role:"menuitem",className:"menu__item",disabled:o,onClick:t,children:[s,e,n!==void 0&&a.jsx("span",{className:"menu__hint",title:typeof n=="string"?n:void 0,children:n})]})}const IS='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function hh({open:e,title:t,where:s,header:n,size:o="default",onClose:l,dismissible:d=!0,reason:h,footer:f,children:m}){const g=j.useRef(null),v=j.useRef(null);if(j.useEffect(()=>{var w;if(!e)return;v.current=document.activeElement;const x=g.current;return(w=(x==null?void 0:x.querySelector("[data-modal-focus]"))??(x==null?void 0:x.querySelector(IS)))==null||w.focus(),()=>{var k;(k=v.current)==null||k.focus(),v.current=null}},[e]),j.useEffect(()=>{if(!e)return;const x=S=>{var A,N;if(S.key==="Escape"){if(!d)return;S.preventDefault(),l();return}if(S.key!=="Tab")return;const w=[...((A=g.current)==null?void 0:A.querySelectorAll(IS))??[]];if(w.length===0)return;const k=w[0],E=w[w.length-1],D=document.activeElement;S.shiftKey&&(D===k||!((N=g.current)!=null&&N.contains(D)))?(S.preventDefault(),E.focus()):!S.shiftKey&&D===E&&(S.preventDefault(),k.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,d,l]),!e)return null;const y=`modal-title-${t.replace(/\s+/g,"-").toLowerCase()}`;return a.jsxs("div",{className:"modal",children:[a.jsx("div",{className:"modal__scrim","aria-hidden":"true",onClick:d?l:void 0}),a.jsxs("div",{className:`modal__card${o==="wide"?" modal__card--wide":""}`,ref:g,role:"dialog","aria-modal":"true","aria-labelledby":y,children:[a.jsx("div",{className:"modal__head",children:a.jsxs("div",{className:"modal__head-b",children:[a.jsx("h3",{className:n===void 0?"modal__t":"sr-only",id:y,children:t}),n,s!==void 0&&a.jsx("p",{className:"modal__where",children:s})]})}),a.jsx("div",{className:"modal__body",children:m}),a.jsxs("div",{className:"modal__foot",children:[f,a.jsx("span",{className:d?"modal__esc":"modal__esc modal__esc--held",children:d?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"kbd",children:"Esc"})," fecha"]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"kbd",children:"Esc"})," ",h??"não fecha agora"]})})]}),a.jsx("button",{type:"button",className:"modal__close","aria-label":"fechar",disabled:!d,onClick:l,children:"✕"})]})]})}function va({entries:e,variant:t="meta"}){return t==="recap"?a.jsx("dl",{className:"recap",children:e.map(s=>a.jsxs("div",{className:"recap__r",children:[a.jsx("dt",{className:"recap__k",children:s.label}),a.jsx("dd",{className:"recap__v",title:s.title,children:s.value})]},s.label))}):a.jsx("dl",{className:"meta",children:e.map(s=>a.jsxs(j.Fragment,{children:[a.jsx("dt",{children:s.label}),a.jsx("dd",{title:s.title,children:s.value})]},s.label))})}function ho({depth:e,label:t,onSelect:s,selected:n=!1,muted:o=!1,emphasis:l=!1,expanded:d,onToggle:h,glyph:f,meta:m,count:g,countTone:v="running",action:y,reserveAction:x=!1}){const S=["row",n?"row--selected":"",o?"row--muted":"",l?"row--emphasis":""].filter(Boolean).join(" "),w=d!==void 0&&h!==void 0;return a.jsxs("div",{className:S,style:{"--depth":e},children:[w?a.jsx("button",{type:"button",className:"row__twist","aria-expanded":d,"aria-label":`${d?"recolher":"expandir"} ${t}`,onClick:h,children:a.jsx("span",{"aria-hidden":"true",children:d?"▾":"▸"})}):a.jsx("span",{className:"row__twist row__twist--empty","aria-hidden":"true"}),a.jsxs("button",{type:"button",className:"row__main","aria-current":n,onClick:s,children:[f,a.jsx("span",{className:"row__label",children:t}),m!==void 0&&a.jsx("span",{className:"row__meta",children:m}),g!==void 0&&g>0&&a.jsxs("span",{className:`row__count row__count--${v}`,children:[a.jsx("span",{className:"row__count__dot","aria-hidden":"true"}),g,a.jsx("span",{className:"sr-only",children:v==="asking"?g===1?" sessão esperando permissão":" sessões esperando permissão":g===1?" sessão rodando":" sessões rodando"})]})]}),y??(x?a.jsx("span",{className:"row__slot","aria-hidden":"true"}):null)]})}function xr({title:e,count:t,aside:s}){return a.jsxs("div",{className:"section-head",children:[a.jsx("span",{className:"section-head__title",children:e}),t!==void 0&&a.jsx("span",{className:"section-head__count",children:t}),s!==void 0&&a.jsx("span",{className:"section-head__aside",children:s})]})}function vO({steps:e,current:t}){return a.jsx("div",{className:"steps","aria-hidden":"true",children:e.map((s,n)=>{const o=n<t?" steps__i--done":n===t?" steps__i--now":"";return a.jsxs(j.Fragment,{children:[a.jsxs("span",{className:`steps__i${o}`,children:[a.jsx("span",{className:"steps__n",children:n<t?"✓":n+1}),a.jsx("span",{className:"steps__l",children:s})]}),n<e.length-1&&a.jsx("span",{className:"steps__bar"})]},s)})})}function Qm({label:e,onSelect:t,glyph:s,ordinal:n,active:o=!1,state:l,stateLabel:d,note:h,onClose:f}){return a.jsxs("div",{className:`tab-item${o?" tab-item--active":""}`,children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":o,className:"tab-item__main",onClick:t,children:[s,a.jsx("span",{className:"tab-item__label",children:e}),n!==void 0&&a.jsx("span",{className:"tab-item__ord",children:n}),h!==void 0&&a.jsx("span",{className:"tab-item__note",children:h}),l!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`tab-item__dot tab-item__dot--${l}`}),d!==void 0&&a.jsx("span",{className:"sr-only",children:d})]})]}),f!==void 0&&a.jsx("button",{type:"button",className:"tab-item__close","aria-label":`fechar ${e}`,onClick:f,children:a.jsx("span",{"aria-hidden":"true",children:"✕"})})]})}function yO({label:e,lead:t,children:s,action:n,end:o}){return a.jsxs("div",{className:"tabs-bar",role:"tablist","aria-label":e,children:[t!==void 0&&a.jsxs(a.Fragment,{children:[t,a.jsx("span",{className:"tabs-bar__sep","aria-hidden":"true"})]}),a.jsx("div",{className:"tabs-bar__scroll",children:s}),n!==void 0&&a.jsx("span",{className:"tabs-bar__action",children:n}),o!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"tabs-bar__sep","aria-hidden":"true"}),a.jsx("span",{className:"tabs-bar__end",children:o})]})]})}function bO({label:e,pressed:t,onToggle:s,children:n}){return a.jsx("button",{type:"button",className:"tab-toggle","aria-pressed":t,"aria-label":`${t?"fechar":"abrir"} ${e}`,onClick:s,children:a.jsx("span",{"aria-hidden":"true",children:n})})}function xO({eyebrow:e,title:t,lede:s,narrow:n=!1,children:o,footer:l}){return a.jsxs("div",{className:`wizard__card${n?" wizard__card--narrow":""}`,children:[a.jsxs("div",{className:"wizard__head",children:[e!==void 0&&a.jsx("span",{className:"wizard__eyebrow",children:e}),a.jsx("h2",{className:"wizard__title",children:t}),s!==void 0&&a.jsx("p",{className:"wizard__lede",children:s})]}),o,l!==void 0&&a.jsx("div",{className:"wizard__foot",children:l})]})}function la({title:e,children:t}){return a.jsxs("section",{className:"wizard__sec",children:[a.jsx("span",{className:"wizard__sec-t",children:e}),t]})}function SO({job:e}){const t=e.percent,s=e.phase===null?null:oO[e.phase]??e.phase;return a.jsxs("div",{className:"modal__work","data-state":e.state,"aria-label":`clonando ${e.name}`,children:[a.jsxs("div",{className:"modal__work-top",children:[a.jsx(Be,{tone:"project",children:"■"}),a.jsx("span",{className:"modal__work-name",children:e.name}),t!==null&&a.jsxs("span",{className:"modal__work-pct",children:[t,"%"]})]}),a.jsx("div",{className:t===null?"bar bar--unknown":"bar",children:a.jsx("div",{className:"bar__fill",style:t===null?void 0:{width:`${t}%`}})}),a.jsx("p",{className:"modal__work-phase",children:e.state==="registering"?"registrando":s??"conectando"})]})}function HS(e){return e.state==="cancelled"?!1:e.state!=="done"?!0:e.message!==null&&e.message.includes("registrado como")}function wO({job:e,onDismiss:t,onRetry:s}){if(e.state==="done")return e.message===null||!e.message.includes("registrado como")?null:a.jsxs("div",{className:"clone-outcome clone-outcome--done",role:"status",children:[a.jsx("p",{className:"clone-outcome__body",children:e.message}),a.jsx(J,{variant:"ghost",size:"sm",onClick:t,children:"entendi"})]});const n=e.failure==="auth"?CO(e.url):null;return a.jsxs("div",{className:"clone-outcome clone-outcome--failed",role:"alert",children:[a.jsx("p",{className:"clone-outcome__title",children:e.failure==="auth"?`não consegui autenticar em ${jO(e.url)}`:`não deu para clonar ${e.name}`}),e.failure==="auth"&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"clone-outcome__body",children:"O Lumem usa as credenciais que já estão na sua máquina — ele não guarda token nenhum. Duas saídas:"}),a.jsxs("ul",{className:"clone-outcome__ways",children:[a.jsx("li",{children:"usar a URL ssh do mesmo repositório, com a chave no ssh-agent;"}),a.jsx("li",{children:"configurar um credential.helper para https."})]})]}),e.message!==null&&a.jsx("code",{className:"clone-outcome__git",children:e.message}),a.jsxs("div",{className:"clone-outcome__actions",children:[n!==null&&s!==void 0&&a.jsx(J,{variant:"primary",size:"sm",onClick:()=>s(n),children:"tentar por ssh"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:t,children:"dispensar"})]}),n!==null&&a.jsx("p",{className:"clone-outcome__path",children:n})]})}function jO(e){try{return new URL(e).host}catch{return e}}function CO(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="https:"&&t.protocol!=="http:")return null;const s=t.pathname.replace(/^\/+/,"");return s===""?null:t.port!==""?`ssh://git@${t.hostname}:${t.port}/${s}`:`git@${t.hostname}:${s}`}function kO({workspaceId:e,workspaceName:t,open:s,onClose:n,onRequestOpen:o,onAdded:l,prefill:d=null,onPrefillConsumed:h}){const[f,m]=j.useState(""),[g,v]=j.useState(""),[y,x]=j.useState(null),[S,w]=j.useState(null),k=dO(e),E=k!==null&&!Pd(k.state)?k:null,D=k!==null&&k.id!==y&&Pd(k.state)&&HS(k)?k:null,A=fO(e,f,g).data??null;j.useEffect(()=>{d!==null&&(m(d),v(""),h==null||h())},[d,h]),j.useEffect(()=>{s||(E!==null||D!==null)&&o()},[E,D,s,o]),j.useEffect(()=>{E!==null&&w(E.id)},[E==null?void 0:E.id]);const{add:N,clone:z,cloneCancel:V,invalidateProjects:ee}=xg(e),$=()=>{N.mutate({path:(A==null?void 0:A.kind)==="path"?A.path:f.trim(),...g.trim()===""?{}:{name:g.trim()}},{onSuccess:fe=>{l(fe.id),me()}})},ae=()=>{z.mutate({source:f.trim(),...g.trim()===""?{}:{name:g.trim()}},{onSuccess:()=>x(null)})};j.useEffect(()=>{!s||k===null||k.id!==S||k.state!=="done"||HS(k)&&k.id!==y||(ee(),w(null),me())},[s,S,k==null?void 0:k.id,k==null?void 0:k.state,y]);function me(){D!==null&&x(D.id),m(""),v(""),N.reset(),z.reset(),n()}const H=(A==null?void 0:A.kind)==="url",B=(A==null?void 0:A.kind)==="refused",O=f.trim().startsWith("/")||f.trim().startsWith("~"),se=A===null&&!O&&f.trim()!=="",re=N.isPending||z.isPending,q=N.isError?N.error.message:z.isError?z.error.message:void 0,M=E!==null,K=fe=>{fe.preventDefault(),!(f.trim()===""||B||se)&&(H?ae():$())};return a.jsxs(hh,{open:s,title:"Adicionar projeto",where:a.jsxs(a.Fragment,{children:["no workspace",a.jsx(Be,{tone:"workspace",children:"◈"}),a.jsx("b",{children:t})]}),onClose:me,dismissible:!M,reason:"não fecha enquanto clona",footer:M?E.state==="cloning"?a.jsx(J,{variant:"ghost",onClick:()=>V.mutate(E.id),children:"cancelar o clone"}):null:a.jsxs(a.Fragment,{children:[a.jsx(J,{type:"submit",form:FS,variant:"primary",disabled:re||f.trim()===""||B||se,children:N.isPending?"validando…":H?"clonar":"adicionar"}),a.jsx(J,{variant:"ghost",onClick:me,children:"cancelar"})]}),children:[D!==null&&a.jsx(wO,{job:D,onDismiss:()=>x(D.id),onRetry:fe=>{x(D.id),m(fe)}}),M?a.jsx(SO,{job:E}):a.jsxs("form",{id:FS,onSubmit:K,children:[a.jsx(Ht,{id:"project-source",label:"Caminho ou URL",error:q,children:a.jsx(Ft,{id:"project-source",value:f,onChange:fe=>m(fe.target.value),placeholder:"git@gitlab.interno:time/api.git",invalid:B||N.isError||z.isError})}),A!==null&&a.jsx(NO,{plan:A}),a.jsx(Ht,{id:"project-name",label:"Nome",children:a.jsx(Ft,{id:"project-name",value:g,onChange:fe=>v(fe.target.value),placeholder:H?A.name??"o nome do repositório":"o nome da pasta"})}),H&&a.jsxs("p",{className:"add-project__answer",children:[a.jsx("span",{className:"add-project__answer-label",children:"Vai em"}),a.jsx("span",{className:"add-project__answer-path",children:A.targetPath})]})]})]})}const FS="add-project";function NO({plan:e}){return e.kind==="refused"?a.jsxs("p",{className:"echo echo--refused",role:"status",children:[a.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),e.message]}):e.kind==="path"?a.jsxs("p",{className:"echo",children:[a.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),"registrar o repositório em ",a.jsx("strong",{children:e.path})]}):a.jsxs("p",{className:"echo",children:[a.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),"clonar via ",e.scheme,e.insecure===!0&&a.jsx(kt,{tone:"insecure",children:"sem TLS"})]})}const ec={backlog:"Backlog",open:"To-Do",in_progress:"In Progress",review:"In Review",testing:"Testing",ready_to_merge:"Ready to Merge",done:"Done"},r1=["backlog","done"],a1=["open","ready_to_merge","done"],EO={in_progress:{warn:30,over:120},review:{warn:30,over:120},testing:{warn:30,over:120},ready_to_merge:{warn:240,over:1440}};function wg(e,t,s){const n=s??e.status;if(n===void 0||e.seal.kind==="paused"||e.queuedBeyondSlots===!0&&n!=="ready_to_merge")return null;const o=EO[n];if(o===void 0)return null;const l=(t-new Date(e.statusChangedAt).getTime())/6e4;return l>=o.over?"over":l>=o.warn?"warn":null}function TO(e,t){let s=0,n=0;for(const o of e.cards){const l=wg(o,t,e.status);l==="over"?n+=1:l==="warn"&&(s+=1)}return{warn:s,over:n}}function $p(e,t,s){return e.seal.kind==="blocked"||a1.includes(t)&&t!=="done"?!0:wg(e,s,t)!==null}function o1(e,t){return be({queryKey:wj(e,t??null),queryFn:()=>Q.task.board.query({workspaceId:e,...t===void 0?{}:{projectId:t}})})}function AO(e,t){const s=$e(),n=wj(e,t??null),o=()=>s.invalidateQueries({queryKey:n}),l=Se({mutationFn:g=>Q.task.move.mutate(g),onSettled:o}),d=Se({mutationFn:g=>Q.task.stop.mutate({id:g}),onSettled:o}),h=Se({mutationFn:g=>Q.task.sendPrepared.mutate({id:g}),onSettled:o}),f=Se({mutationFn:g=>Q.task.setAutonomy.mutate({id:g,autonomy:"off"}),onSettled:o}),m=Se({mutationFn:g=>Q.task.finish.mutate({id:g}),onSettled:o});return{move:l,stop:d,send:h,takeOver:f,finish:m}}function OO(e){return be({queryKey:cg(e),queryFn:()=>Q.task.get.query({id:e})})}function l1(e,t){const s=$e();return Se({mutationFn:n=>Q.task.setStatus.mutate({id:t,...n}),onSuccess:async()=>{await s.invalidateQueries({queryKey:uh(e)}),await s.invalidateQueries({queryKey:cg(t)})}})}function jg(e,t){return be({queryKey:uh(e,t),queryFn:()=>Q.task.listByWorkspace.query({workspaceId:e,...(t==null?void 0:t.projectId)===void 0?{}:{projectId:t.projectId},...(t==null?void 0:t.status)===void 0?{}:{status:t.status}})})}function c1(e){return be({queryKey:jj(e),queryFn:()=>Q.task.settings.query({workspaceId:e})})}function RO(e){return be({queryKey:AT(e),queryFn:()=>Q.task.getByWorktree.query({worktreeId:e})})}function DO(e,t,s){const n=$e();return Se({mutationFn:async o=>{const l=o.mode==="new"?(await Q.worktree.create.mutate({projectId:t,name:o.name,taskId:e})).id:o.checkout;if(l===null)throw new Error("escolha um checkout");if(o.agentConfigId===null)throw new Error("nenhum agente configurado");o.mode==="existing"&&await Q.task.attachWorktree.mutate({id:e,worktreeId:l});const d=await Q.session.createAgent.mutate({scopeType:"worktree",scopeId:l,agentConfigId:o.agentConfigId,taskId:e});return{worktreeId:l,sessionId:d.id,draft:s}},onSuccess:async()=>{await n.invalidateQueries({queryKey:Do(t)}),await n.invalidateQueries({queryKey:cg(e)})}})}function u1(){return typeof window<"u"&&"Notification"in window}async function MO(){u1()&&Notification.permission==="default"&&await Notification.requestPermission().catch(()=>{})}function LO(e){const t=j.useRef(new Set);j.useEffect(()=>{if(e!==void 0)for(const s of e)for(const n of s.cards){if(n.notice===null){t.current.delete(n.id);continue}if(t.current.has(n.id))continue;t.current.add(n.id);const o=n.notice;Q.task.markNotified.mutate({id:n.id}).then(l=>{l.first&&(!u1()||Notification.permission!=="granted"||new Notification("Lumem",{body:o,tag:`lumem-task-${n.id}`}))}).catch(()=>{t.current.delete(n.id)})}},[e])}const BO={implementador:"implementando",revisor:"revisando",testador:"testando"};function d1(e,t=Date.now()){const s=Math.floor((t-new Date(e).getTime())/6e4);if(s<1)return"agora";if(s<60)return`${String(s)} min`;const n=Math.floor(s/60);return n<24?`${String(n)} h`:`${String(Math.floor(n/24))} d`}function zO(e){return e.kind==="working"?"work":e.kind==="waiting"?"wait":e.kind}function qO(e,t=Date.now()){switch(e.kind){case"manual":return"manual — ninguém pega";case"waiting":return`aguardando ${e.role}`;case"working":return`${e.role===null?"trabalhando":BO[e.role]} há ${d1(e.since,t)}`;case"blocked":return`bloqueada: ${e.reason}`;case"paused":return`pausada até ~${new Date(e.until).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}}function PO({seal:e,now:t}){return a.jsxs("div",{className:"seal",children:[a.jsx("span",{className:"seal__dot"}),a.jsx("span",{className:"seal__t",children:qO(e,t)})]})}function IO(e){return e.cost===null?"—":new Intl.NumberFormat("pt-BR",{style:"currency",currency:e.currency??"USD"}).format(e.cost)}function HO(e){return e.seal.kind==="blocked"?e.seal.reason:e.preparedPrompt}function FO({card:e,status:t,now:s=Date.now(),onOpen:n,ghost:o=!1,onDragStart:l,onDragEnd:d,onSend:h,onStop:f}){const m=wg(e,s,t),g=e.links[0],v=HO(e),y=e.preparedPrompt!==null&&h!==void 0,x=e.seal.kind==="working"&&f!==void 0;return a.jsxs("button",{type:"button",className:`tcard tcard--${zO(e.seal)}${o?" tcard--ghost":""} focus-ring`,onClick:()=>n(e.id),draggable:l!==void 0,onDragStart:S=>{S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",e.id),l==null||l()},onDragEnd:()=>d==null?void 0:d(),children:[a.jsxs("div",{className:"tcard__top",children:[a.jsx("span",{className:"glyph glyph--project",children:"■"}),a.jsx("span",{className:"tcard__proj",children:e.projectName}),a.jsx("span",{className:`tcard__cost${e.cost===null?" tcard__cost--none":""}`,children:IO(e)})]}),a.jsx("div",{className:"tcard__t",children:e.title}),a.jsx(PO,{seal:e.seal,now:s}),v===null?null:a.jsx("div",{className:"tcard__ask",children:a.jsx("span",{className:"tcard__ask-t",children:v})}),y||x?a.jsxs("div",{className:"tcard__act",children:[y?a.jsx(US,{label:"enviar",onRun:()=>h(e.id)}):null,x?a.jsx(US,{label:"parar",onRun:()=>f(e.id)}):null]}):null,a.jsxs("div",{className:"tcard__foot",children:[e.createdBy==="agent"?a.jsx("span",{className:"tcard__from tcard__from--agent",children:"◆ proposta"}):g===void 0?null:a.jsxs("span",{className:"tcard__from tcard__from--track",children:["↗ ",UO(g)]}),e.attempts>1?a.jsxs("span",{className:"tcard__from",children:["tentativa ",e.attempts]}):null,a.jsx("span",{className:`stale${m===null?"":` stale--${m}`}`,children:d1(e.statusChangedAt,s)})]})]})}function US({label:e,onRun:t}){return a.jsx("span",{role:"button",tabIndex:0,className:"btn btn--sm focus-ring",onClick:s=>{s.stopPropagation(),t()},onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),s.stopPropagation(),t())},children:e})}function UO(e){const t=e.split("/").filter(s=>s!=="");return t[t.length-1]??e}const $O=1418,KO=200;function WO(e,t){const s=e-t;return s<=0?0:Math.max(1,Math.ceil(s/KO))}function VO({workspaceId:e,projectId:t,onOpen:s,now:n=Date.now()}){const[o,l]=j.useState(r1),[d,h]=j.useState(!1),[f,m]=j.useState(null),[g,v]=j.useState(null),{ref:y,clipped:x}=GO(),S=o1(e,t),{move:w,stop:k,send:E,takeOver:D,finish:A}=AO(e,t);LO(S.data);const N=(S.data??[]).map(H=>({...H,cards:d?H.cards.filter(B=>$p(B,H.status,n)):H.cards})),z=H=>{var B;return((B=(S.data??[]).find(O=>O.status===H))==null?void 0:B.cards)??[]},V=(H,B)=>{const O=z(H).findIndex(se=>se.id===B);return O===-1?z(H).length:O},ee=(S.data??[]).reduce((H,B)=>H+B.cards.filter(O=>O.notice!==null).length,0),$=(S.data??[]).reduce((H,B)=>H+B.cards.filter(O=>$p(O,B.status,n)).length,0);function ae(H){const B=(S.data??[]).flatMap(O=>O.cards).find(O=>O.id===H);(B==null?void 0:B.seal.kind)==="working"&&B.autonomy!=="off"&&D.mutate(H),s(H)}function me(H,B){if(f!==null){if(H==="done"){A.mutate(f,{onSuccess:O=>{v(O.cleanup.kind==="keep"?O.cleanup.reason??null:null)}}),m(null);return}w.mutate({id:f,status:H,index:B}),m(null)}}return a.jsxs("main",{className:"bd",children:[a.jsx("div",{className:"bd__head",children:a.jsxs("div",{className:"bd__title",children:[a.jsx("h2",{className:"bd__t",children:"Quadro de tarefas"}),a.jsx("span",{className:"bd__sub",children:"todas as tarefas deste workspace, em uma tela"})]})}),a.jsxs("div",{className:"bd__bar",children:[a.jsxs("button",{type:"button",className:"needme focus-ring","aria-pressed":d,onClick:()=>h(H=>!H),children:["precisa de mim",$===0?null:a.jsx("span",{className:"needme__n",children:$})]}),g===null?null:a.jsxs("span",{className:"bd__unseen",children:["a worktree ficou: ",g]}),ee===0?null:a.jsx("span",{className:"bd__unseen",children:ee===1?"1 parou enquanto você não estava":`${String(ee)} pararam enquanto você não estava`})]}),x===0?null:a.jsxs("div",{className:"bd__clip",children:[a.jsx("span",{className:"bd__clip-g",children:"⟷"}),a.jsxs("span",{children:[a.jsx("b",{children:x===1?"1 coluna fora da tela.":`${String(x)} colunas fora da tela.`})," ","O quadro pede ",String($O),"px de janela com as duas pontas recolhidas — role para o lado, ou alargue."]}),a.jsx("span",{className:"bd__clip__which",children:ec.ready_to_merge})]}),a.jsx("div",{className:"bd__cols",ref:y,children:N.map(H=>o.includes(H.status)?a.jsx("button",{type:"button",className:"col col--rail focus-ring","aria-expanded":!1,onClick:()=>l(B=>B.filter(O=>O!==H.status)),children:a.jsxs("div",{className:"col__h",children:[a.jsx("span",{className:"col__t",children:ec[H.status]}),a.jsx("span",{className:"col__n",children:H.cards.length})]})},H.status):a.jsxs("section",{className:"col","aria-label":ec[H.status],children:[a.jsx(YO,{column:H,now:n,onCollapse:()=>l(B=>[...B,H.status])}),a.jsx("div",{className:"col__body",onDragOver:B=>{f!==null&&B.preventDefault()},onDrop:()=>me(H.status,z(H.status).length),children:H.cards.length===0?a.jsx("div",{className:"col__empty",children:"vazia"}):H.cards.map(B=>a.jsx("div",{onDragOver:O=>{f!==null&&O.preventDefault()},onDrop:O=>{O.stopPropagation(),me(H.status,V(H.status,B.id))},children:a.jsx(FO,{card:B,status:H.status,now:n,onOpen:ae,ghost:f===B.id,onDragStart:()=>m(B.id),onDragEnd:()=>m(null),onSend:O=>E.mutate(O),onStop:O=>k.mutate(O)})},B.id))})]},H.status))})]})}function YO({column:e,now:t,onCollapse:s}){const n=TO(e,t),o=n.over>0?"over":n.warn>0?"warn":null,l=n.over+n.warn;return a.jsxs("div",{className:"col__h",children:[a.jsx("span",{className:"col__t",children:ec[e.status]}),a.jsx("span",{className:"col__n",children:e.cards.length}),a1.includes(e.status)&&e.status!=="done"?a.jsx("span",{className:"col__you",children:"sua vez"}):null,o===null?r1.includes(e.status)?a.jsx("button",{type:"button",className:"col__add focus-ring",onClick:s,"aria-label":`Recolher ${ec[e.status]}`,children:"‹"}):null:a.jsx("span",{className:`col__stale col__stale--${o}`,title:l===1?"1 tarefa encalhada":`${String(l)} tarefas encalhadas`})]})}function GO(){const[e,t]=j.useState(0),s=j.useRef(null),n=j.useCallback(()=>{const l=s.current;l!==null&&t(WO(l.scrollWidth,l.clientWidth))},[]);return j.useLayoutEffect(n),j.useEffect(()=>{const l=()=>n();return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[n]),{ref:j.useCallback(l=>{s.current=l},[]),clipped:e}}const QO={proposed:"proposta",open:"open",in_progress:"in progress",review:"review",done:"done",dropped:"dropped"},ZO={done:"✓",dropped:"–"};function XO({workspaceId:e,projectId:t,onOpen:s,onCreate:n,onOpenBoard:o}){var A,N;const[l,d]=j.useState(t??null),[h,f]=j.useState(!1),g=jg(e,l===null?void 0:{projectId:l}),v=c1(e),y=be({queryKey:RT(e),queryFn:()=>Q.usage.byTask.query({workspaceId:e,period:"7d"})}),x=dh(e,{enabled:t===void 0}),S=z=>{var V,ee;return((ee=(V=x.data)==null?void 0:V.find($=>$.id===z))==null?void 0:ee.name)??""},w=z=>{var V,ee;return((ee=(V=y.data)==null?void 0:V.find($=>$.taskId===z))==null?void 0:ee.cost)??null},k=g.data??[],E=k.filter(z=>z.status!=="done"&&z.status!=="dropped"),D=k.filter(z=>z.status==="done");return a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"Tarefas",count:k.length,aside:a.jsxs(a.Fragment,{children:[t===void 0&&(((A=x.data)==null?void 0:A.length)??0)>1&&a.jsxs("select",{className:"input tlist__filter","aria-label":"Filtrar tarefas por projeto",value:l??"",onChange:z=>d(z.target.value===""?null:z.target.value),children:[a.jsx("option",{value:"",children:"todos os projetos"}),(N=x.data)==null?void 0:N.map(z=>a.jsx("option",{value:z.id,children:z.name},z.id))]}),o&&t===void 0&&a.jsx(J,{size:"sm",variant:"ghost",onClick:o,children:"quadro"}),n&&a.jsx(J,{size:"sm",onClick:n,children:"+ tarefa"})]})}),g.isError?a.jsx(Ce,{tone:"danger",children:g.error.message}):g.isPending?a.jsx(ss,{label:"buscando as tarefas",widths:["90%","70%"]}):k.length===0?a.jsx(hs,{title:"Nenhuma tarefa ainda",action:n&&a.jsx(J,{variant:"primary",onClick:n,children:"criar a primeira"}),children:"Tarefa é para o trabalho que você quer acompanhar — ela guarda o corpo, o checkout, as sessões e o custo. Conversa rápida continua a um clique, sem tarefa nenhuma."}):a.jsxs("div",{className:"tlist",children:[v.data!==void 0&&v.data.sessions>0&&a.jsxs("p",{className:"tlist__ceremony",children:[a.jsxs("b",{children:[v.data.sessionsWithTask," de ",v.data.sessions]})," ","sessões têm tarefa"]}),E.map(z=>a.jsx($S,{row:z,projectName:S(z.projectId),cost:w(z.id),onOpen:s},z.id)),D.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"tfold focus-ring","aria-expanded":h,onClick:()=>f(z=>!z),children:[a.jsx("span",{className:"tfold__caret","aria-hidden":"true",children:h?"▾":"▸"}),"done",a.jsx("span",{className:"tfold__n",children:D.length})]}),h&&D.map(z=>a.jsx($S,{row:z,projectName:S(z.projectId),cost:w(z.id),onOpen:s},z.id))]})]})]})}function $S({row:e,projectName:t,cost:s,onOpen:n}){const o=ZO[e.status];return a.jsxs("button",{type:"button",className:`trow trow--${e.status} focus-ring`,onClick:()=>n(e.id),children:[a.jsxs("span",{className:"task-status",children:[o===void 0?a.jsx("span",{className:"task-status__dot","aria-hidden":"true"}):a.jsx("span",{className:"task-status__g","aria-hidden":"true",children:o}),QO[e.status]??e.status]}),a.jsxs("span",{className:"trow__t",children:[e.title,e.reason!==null&&e.reason!==""&&a.jsxs("span",{className:"trow__why",children:[" — ",e.reason]})]}),a.jsx("span",{className:"trow__proj",children:t!==""&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"glyph glyph--project","aria-hidden":"true",children:"■"}),t]})}),a.jsx("span",{className:"task-provenance",children:e.createdBy==="agent"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"task-provenance__g","aria-hidden":"true",children:"◆"}),"proposta"]})}),a.jsx("span",{className:"trow__wt",children:e.worktreeId!==null&&a.jsx("span",{className:"glyph glyph--worktree","aria-hidden":"true",children:"◇"})}),a.jsx("span",{className:`trow__cost${s===null?" trow__cost--none":""}`,children:s===null?"—":`US$ ${s.toFixed(2)}`})]})}var Je;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function s(o){throw new Error}e.assertNever=s,e.arrayToEnum=o=>{const l={};for(const d of o)l[d]=d;return l},e.getValidEnumValues=o=>{const l=e.objectKeys(o).filter(h=>typeof o[o[h]]!="number"),d={};for(const h of l)d[h]=o[h];return e.objectValues(d)},e.objectValues=o=>e.objectKeys(o).map(function(l){return o[l]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const l=[];for(const d in o)Object.prototype.hasOwnProperty.call(o,d)&&l.push(d);return l},e.find=(o,l)=>{for(const d of o)if(l(d))return d},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,l=" | "){return o.map(d=>typeof d=="string"?`'${d}'`:d).join(l)}e.joinValues=n,e.jsonStringifyReplacer=(o,l)=>typeof l=="bigint"?l.toString():l})(Je||(Je={}));var KS;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(KS||(KS={}));const ve=Je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nr=e=>{switch(typeof e){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(e)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(e)?ve.array:e===null?ve.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ve.promise:typeof Map<"u"&&e instanceof Map?ve.map:typeof Set<"u"&&e instanceof Set?ve.set:typeof Date<"u"&&e instanceof Date?ve.date:ve.object;default:return ve.unknown}},oe=Je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Cn extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(l){return l.message},n={_errors:[]},o=l=>{for(const d of l.issues)if(d.code==="invalid_union")d.unionErrors.map(o);else if(d.code==="invalid_return_type")o(d.returnTypeError);else if(d.code==="invalid_arguments")o(d.argumentsError);else if(d.path.length===0)n._errors.push(s(d));else{let h=n,f=0;for(;f<d.path.length;){const m=d.path[f];f===d.path.length-1?(h[m]=h[m]||{_errors:[]},h[m]._errors.push(s(d))):h[m]=h[m]||{_errors:[]},h=h[m],f++}}};return o(this),n}static assert(t){if(!(t instanceof Cn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Je.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s={},n=[];for(const o of this.issues)if(o.path.length>0){const l=o.path[0];s[l]=s[l]||[],s[l].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}Cn.create=e=>new Cn(e);const Kp=(e,t)=>{let s;switch(e.code){case oe.invalid_type:e.received===ve.undefined?s="Required":s=`Expected ${e.expected}, received ${e.received}`;break;case oe.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,Je.jsonStringifyReplacer)}`;break;case oe.unrecognized_keys:s=`Unrecognized key(s) in object: ${Je.joinValues(e.keys,", ")}`;break;case oe.invalid_union:s="Invalid input";break;case oe.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${Je.joinValues(e.options)}`;break;case oe.invalid_enum_value:s=`Invalid enum value. Expected ${Je.joinValues(e.options)}, received '${e.received}'`;break;case oe.invalid_arguments:s="Invalid function arguments";break;case oe.invalid_return_type:s="Invalid function return type";break;case oe.invalid_date:s="Invalid date";break;case oe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:Je.assertNever(e.validation):e.validation!=="regex"?s=`Invalid ${e.validation}`:s="Invalid";break;case oe.too_small:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?s=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:s="Invalid input";break;case oe.too_big:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?s=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:s="Invalid input";break;case oe.custom:s="Invalid input";break;case oe.invalid_intersection_types:s="Intersection results could not be merged";break;case oe.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case oe.not_finite:s="Number must be finite";break;default:s=t.defaultError,Je.assertNever(e)}return{message:s}};let JO=Kp;function eR(){return JO}const tR=e=>{const{data:t,path:s,errorMaps:n,issueData:o}=e,l=[...s,...o.path||[]],d={...o,path:l};if(o.message!==void 0)return{...o,path:l,message:o.message};let h="";const f=n.filter(m=>!!m).slice().reverse();for(const m of f)h=m(d,{data:t,defaultError:h}).message;return{...o,path:l,message:h}};function pe(e,t){const s=eR(),n=tR({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===Kp?void 0:Kp].filter(o=>!!o)});e.common.issues.push(n)}class bs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){const n=[];for(const o of s){if(o.status==="aborted")return Re;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,s){const n=[];for(const o of s){const l=await o.key,d=await o.value;n.push({key:l,value:d})}return bs.mergeObjectSync(t,n)}static mergeObjectSync(t,s){const n={};for(const o of s){const{key:l,value:d}=o;if(l.status==="aborted"||d.status==="aborted")return Re;l.status==="dirty"&&t.dirty(),d.status==="dirty"&&t.dirty(),l.value!=="__proto__"&&(typeof d.value<"u"||o.alwaysSet)&&(n[l.value]=d.value)}return{status:t.value,value:n}}}const Re=Object.freeze({status:"aborted"}),Kl=e=>({status:"dirty",value:e}),gi=e=>({status:"valid",value:e}),WS=e=>e.status==="aborted",VS=e=>e.status==="dirty",Ao=e=>e.status==="valid",Id=e=>typeof Promise<"u"&&e instanceof Promise;var je;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(je||(je={}));class $i{constructor(t,s,n,o){this._cachedPath=[],this.parent=t,this.data=s,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const YS=(e,t)=>{if(Ao(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new Cn(e.common.issues);return this._error=s,this._error}}};function Ie(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:n,description:o}=e;if(t&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(d,h)=>{const{message:f}=e;return d.code==="invalid_enum_value"?{message:f??h.defaultError}:typeof h.data>"u"?{message:f??n??h.defaultError}:d.code!=="invalid_type"?{message:h.defaultError}:{message:f??s??h.defaultError}},description:o}}class Ge{get description(){return this._def.description}_getType(t){return nr(t.data)}_getOrReturnCtx(t,s){return s||{common:t.parent.common,data:t.data,parsedType:nr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new bs,ctx:{common:t.parent.common,data:t.data,parsedType:nr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const s=this._parse(t);if(Id(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){const s=this._parse(t);return Promise.resolve(s)}parse(t,s){const n=this.safeParse(t,s);if(n.success)return n.data;throw n.error}safeParse(t,s){const n={common:{issues:[],async:(s==null?void 0:s.async)??!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:nr(t)},o=this._parseSync({data:t,path:n.path,parent:n});return YS(n,o)}"~validate"(t){var n,o;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:nr(t)};if(!this["~standard"].async)try{const l=this._parseSync({data:t,path:[],parent:s});return Ao(l)?{value:l.value}:{issues:s.common.issues}}catch(l){(o=(n=l==null?void 0:l.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:s}).then(l=>Ao(l)?{value:l.value}:{issues:s.common.issues})}async parseAsync(t,s){const n=await this.safeParseAsync(t,s);if(n.success)return n.data;throw n.error}async safeParseAsync(t,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:nr(t)},o=this._parse({data:t,path:n.path,parent:n}),l=await(Id(o)?o:Promise.resolve(o));return YS(n,l)}refine(t,s){const n=o=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(o):s;return this._refinement((o,l)=>{const d=t(o),h=()=>l.addIssue({code:oe.custom,...n(o)});return typeof Promise<"u"&&d instanceof Promise?d.then(f=>f?!0:(h(),!1)):d?!0:(h(),!1)})}refinement(t,s){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof s=="function"?s(n,o):s),!1))}_refinement(t){return new da({schema:this,typeName:De.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return Sn.create(this,this._def)}nullable(){return ha.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fi.create(this)}promise(){return Wd.create(this,this._def)}or(t){return Fd.create([this,t],this._def)}and(t){return Ud.create(this,t,this._def)}transform(t){return new da({...Ie(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const s=typeof t=="function"?t:()=>t;return new Vd({...Ie(this._def),innerType:this,defaultValue:s,typeName:De.ZodDefault})}brand(){return new p1({typeName:De.ZodBranded,type:this,...Ie(this._def)})}catch(t){const s=typeof t=="function"?t:()=>t;return new Yd({...Ie(this._def),innerType:this,catchValue:s,typeName:De.ZodCatch})}describe(t){const s=this.constructor;return new s({...this._def,description:t})}pipe(t){return kg.create(this,t)}readonly(){return Gd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const sR=/^c[^\s-]{8,}$/i,iR=/^[0-9a-z]+$/,nR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rR=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,aR=/^[a-z0-9_-]{21}$/i,oR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lR=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Zm;const dR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,fR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,mR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_R=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,h1="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",gR=new RegExp(`^${h1}$`);function f1(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const s=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${s}`}function vR(e){return new RegExp(`^${f1(e)}$`)}function yR(e){let t=`${h1}T${f1(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function bR(e,t){return!!((t==="v4"||!t)&&dR.test(e)||(t==="v6"||!t)&&fR.test(e))}function xR(e,t){if(!oR.test(e))return!1;try{const[s]=e.split(".");if(!s)return!1;const n=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function SR(e,t){return!!((t==="v4"||!t)&&hR.test(e)||(t==="v6"||!t)&&mR.test(e))}class yn extends Ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ve.string){const l=this._getOrReturnCtx(t);return pe(l,{code:oe.invalid_type,expected:ve.string,received:l.parsedType}),Re}const n=new bs;let o;for(const l of this._def.checks)if(l.kind==="min")t.data.length<l.value&&(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="max")t.data.length>l.value&&(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="length"){const d=t.data.length>l.value,h=t.data.length<l.value;(d||h)&&(o=this._getOrReturnCtx(t,o),d?pe(o,{code:oe.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):h&&pe(o,{code:oe.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),n.dirty())}else if(l.kind==="email")cR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"email",code:oe.invalid_string,message:l.message}),n.dirty());else if(l.kind==="emoji")Zm||(Zm=new RegExp(uR,"u")),Zm.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"emoji",code:oe.invalid_string,message:l.message}),n.dirty());else if(l.kind==="uuid")rR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"uuid",code:oe.invalid_string,message:l.message}),n.dirty());else if(l.kind==="nanoid")aR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"nanoid",code:oe.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid")sR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"cuid",code:oe.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid2")iR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"cuid2",code:oe.invalid_string,message:l.message}),n.dirty());else if(l.kind==="ulid")nR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"ulid",code:oe.invalid_string,message:l.message}),n.dirty());else if(l.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),pe(o,{validation:"url",code:oe.invalid_string,message:l.message}),n.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"regex",code:oe.invalid_string,message:l.message}),n.dirty())):l.kind==="trim"?t.data=t.data.trim():l.kind==="includes"?t.data.includes(l.value,l.position)||(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),n.dirty()):l.kind==="toLowerCase"?t.data=t.data.toLowerCase():l.kind==="toUpperCase"?t.data=t.data.toUpperCase():l.kind==="startsWith"?t.data.startsWith(l.value)||(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.invalid_string,validation:{startsWith:l.value},message:l.message}),n.dirty()):l.kind==="endsWith"?t.data.endsWith(l.value)||(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.invalid_string,validation:{endsWith:l.value},message:l.message}),n.dirty()):l.kind==="datetime"?yR(l).test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.invalid_string,validation:"datetime",message:l.message}),n.dirty()):l.kind==="date"?gR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.invalid_string,validation:"date",message:l.message}),n.dirty()):l.kind==="time"?vR(l).test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.invalid_string,validation:"time",message:l.message}),n.dirty()):l.kind==="duration"?lR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"duration",code:oe.invalid_string,message:l.message}),n.dirty()):l.kind==="ip"?bR(t.data,l.version)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"ip",code:oe.invalid_string,message:l.message}),n.dirty()):l.kind==="jwt"?xR(t.data,l.alg)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"jwt",code:oe.invalid_string,message:l.message}),n.dirty()):l.kind==="cidr"?SR(t.data,l.version)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"cidr",code:oe.invalid_string,message:l.message}),n.dirty()):l.kind==="base64"?pR.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"base64",code:oe.invalid_string,message:l.message}),n.dirty()):l.kind==="base64url"?_R.test(t.data)||(o=this._getOrReturnCtx(t,o),pe(o,{validation:"base64url",code:oe.invalid_string,message:l.message}),n.dirty()):Je.assertNever(l);return{status:n.value,value:t.data}}_regex(t,s,n){return this.refinement(o=>t.test(o),{validation:s,code:oe.invalid_string,...je.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...je.errToObj(t)})}url(t){return this._addCheck({kind:"url",...je.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...je.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...je.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...je.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...je.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...je.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...je.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...je.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...je.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...je.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...je.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...je.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...je.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...je.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...je.errToObj(t)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...je.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s==null?void 0:s.position,...je.errToObj(s==null?void 0:s.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...je.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...je.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...je.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...je.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...je.errToObj(s)})}nonempty(t){return this.min(1,je.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}yn.create=e=>new yn({checks:[],typeName:De.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Ie(e)});function wR(e,t){const s=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=s>n?s:n,l=Number.parseInt(e.toFixed(o).replace(".","")),d=Number.parseInt(t.toFixed(o).replace(".",""));return l%d/10**o}class Oo extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ve.number){const l=this._getOrReturnCtx(t);return pe(l,{code:oe.invalid_type,expected:ve.number,received:l.parsedType}),Re}let n;const o=new bs;for(const l of this._def.checks)l.kind==="int"?Je.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.invalid_type,expected:"integer",received:"float",message:l.message}),o.dirty()):l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),o.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),o.dirty()):l.kind==="multipleOf"?wR(t.data,l.value)!==0&&(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.not_multiple_of,multipleOf:l.value,message:l.message}),o.dirty()):l.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.not_finite,message:l.message}),o.dirty()):Je.assertNever(l);return{status:o.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,je.toString(s))}gt(t,s){return this.setLimit("min",t,!1,je.toString(s))}lte(t,s){return this.setLimit("max",t,!0,je.toString(s))}lt(t,s){return this.setLimit("max",t,!1,je.toString(s))}setLimit(t,s,n,o){return new Oo({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:n,message:je.toString(o)}]})}_addCheck(t){return new Oo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:je.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:je.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:je.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:je.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:je.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:je.toString(t)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Je.isInteger(t.value))}get isFinite(){let t=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(s)&&Number.isFinite(t)}}Oo.create=e=>new Oo({checks:[],typeName:De.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ie(e)});class uc extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ve.bigint)return this._getInvalidInput(t);let n;const o=new bs;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),o.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),o.dirty()):l.kind==="multipleOf"?t.data%l.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),pe(n,{code:oe.not_multiple_of,multipleOf:l.value,message:l.message}),o.dirty()):Je.assertNever(l);return{status:o.value,value:t.data}}_getInvalidInput(t){const s=this._getOrReturnCtx(t);return pe(s,{code:oe.invalid_type,expected:ve.bigint,received:s.parsedType}),Re}gte(t,s){return this.setLimit("min",t,!0,je.toString(s))}gt(t,s){return this.setLimit("min",t,!1,je.toString(s))}lte(t,s){return this.setLimit("max",t,!0,je.toString(s))}lt(t,s){return this.setLimit("max",t,!1,je.toString(s))}setLimit(t,s,n,o){return new uc({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:n,message:je.toString(o)}]})}_addCheck(t){return new uc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:je.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:je.toString(s)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}uc.create=e=>new uc({checks:[],typeName:De.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ie(e)});class Wp extends Ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ve.boolean){const n=this._getOrReturnCtx(t);return pe(n,{code:oe.invalid_type,expected:ve.boolean,received:n.parsedType}),Re}return gi(t.data)}}Wp.create=e=>new Wp({typeName:De.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ie(e)});class Hd extends Ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ve.date){const l=this._getOrReturnCtx(t);return pe(l,{code:oe.invalid_type,expected:ve.date,received:l.parsedType}),Re}if(Number.isNaN(t.data.getTime())){const l=this._getOrReturnCtx(t);return pe(l,{code:oe.invalid_date}),Re}const n=new bs;let o;for(const l of this._def.checks)l.kind==="min"?t.data.getTime()<l.value&&(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),n.dirty()):l.kind==="max"?t.data.getTime()>l.value&&(o=this._getOrReturnCtx(t,o),pe(o,{code:oe.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),n.dirty()):Je.assertNever(l);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hd({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:je.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:je.toString(s)})}get minDate(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t!=null?new Date(t):null}}Hd.create=e=>new Hd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:De.ZodDate,...Ie(e)});class GS extends Ge{_parse(t){if(this._getType(t)!==ve.symbol){const n=this._getOrReturnCtx(t);return pe(n,{code:oe.invalid_type,expected:ve.symbol,received:n.parsedType}),Re}return gi(t.data)}}GS.create=e=>new GS({typeName:De.ZodSymbol,...Ie(e)});class Vp extends Ge{_parse(t){if(this._getType(t)!==ve.undefined){const n=this._getOrReturnCtx(t);return pe(n,{code:oe.invalid_type,expected:ve.undefined,received:n.parsedType}),Re}return gi(t.data)}}Vp.create=e=>new Vp({typeName:De.ZodUndefined,...Ie(e)});class Yp extends Ge{_parse(t){if(this._getType(t)!==ve.null){const n=this._getOrReturnCtx(t);return pe(n,{code:oe.invalid_type,expected:ve.null,received:n.parsedType}),Re}return gi(t.data)}}Yp.create=e=>new Yp({typeName:De.ZodNull,...Ie(e)});class QS extends Ge{constructor(){super(...arguments),this._any=!0}_parse(t){return gi(t.data)}}QS.create=e=>new QS({typeName:De.ZodAny,...Ie(e)});class ZS extends Ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gi(t.data)}}ZS.create=e=>new ZS({typeName:De.ZodUnknown,...Ie(e)});class br extends Ge{_parse(t){const s=this._getOrReturnCtx(t);return pe(s,{code:oe.invalid_type,expected:ve.never,received:s.parsedType}),Re}}br.create=e=>new br({typeName:De.ZodNever,...Ie(e)});class XS extends Ge{_parse(t){if(this._getType(t)!==ve.undefined){const n=this._getOrReturnCtx(t);return pe(n,{code:oe.invalid_type,expected:ve.void,received:n.parsedType}),Re}return gi(t.data)}}XS.create=e=>new XS({typeName:De.ZodVoid,...Ie(e)});class Fi extends Ge{_parse(t){const{ctx:s,status:n}=this._processInputParams(t),o=this._def;if(s.parsedType!==ve.array)return pe(s,{code:oe.invalid_type,expected:ve.array,received:s.parsedType}),Re;if(o.exactLength!==null){const d=s.data.length>o.exactLength.value,h=s.data.length<o.exactLength.value;(d||h)&&(pe(s,{code:d?oe.too_big:oe.too_small,minimum:h?o.exactLength.value:void 0,maximum:d?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&s.data.length<o.minLength.value&&(pe(s,{code:oe.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&s.data.length>o.maxLength.value&&(pe(s,{code:oe.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((d,h)=>o.type._parseAsync(new $i(s,d,s.path,h)))).then(d=>bs.mergeArray(n,d));const l=[...s.data].map((d,h)=>o.type._parseSync(new $i(s,d,s.path,h)));return bs.mergeArray(n,l)}get element(){return this._def.type}min(t,s){return new Fi({...this._def,minLength:{value:t,message:je.toString(s)}})}max(t,s){return new Fi({...this._def,maxLength:{value:t,message:je.toString(s)}})}length(t,s){return new Fi({...this._def,exactLength:{value:t,message:je.toString(s)}})}nonempty(t){return this.min(1,t)}}Fi.create=(e,t)=>new Fi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...Ie(t)});function lo(e){if(e instanceof Pt){const t={};for(const s in e.shape){const n=e.shape[s];t[s]=Sn.create(lo(n))}return new Pt({...e._def,shape:()=>t})}else return e instanceof Fi?new Fi({...e._def,type:lo(e.element)}):e instanceof Sn?Sn.create(lo(e.unwrap())):e instanceof ha?ha.create(lo(e.unwrap())):e instanceof ca?ca.create(e.items.map(t=>lo(t))):e}class Pt extends Ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),s=Je.objectKeys(t);return this._cached={shape:t,keys:s},this._cached}_parse(t){if(this._getType(t)!==ve.object){const m=this._getOrReturnCtx(t);return pe(m,{code:oe.invalid_type,expected:ve.object,received:m.parsedType}),Re}const{status:n,ctx:o}=this._processInputParams(t),{shape:l,keys:d}=this._getCached(),h=[];if(!(this._def.catchall instanceof br&&this._def.unknownKeys==="strip"))for(const m in o.data)d.includes(m)||h.push(m);const f=[];for(const m of d){const g=l[m],v=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new $i(o,v,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof br){const m=this._def.unknownKeys;if(m==="passthrough")for(const g of h)f.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(m==="strict")h.length>0&&(pe(o,{code:oe.unrecognized_keys,keys:h}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const g of h){const v=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new $i(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const m=[];for(const g of f){const v=await g.key,y=await g.value;m.push({key:v,value:y,alwaysSet:g.alwaysSet})}return m}).then(m=>bs.mergeObjectSync(n,m)):bs.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return je.errToObj,new Pt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,n)=>{var l,d;const o=((d=(l=this._def).errorMap)==null?void 0:d.call(l,s,n).message)??n.defaultError;return s.code==="unrecognized_keys"?{message:je.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new Pt({...this._def,unknownKeys:"strip"})}passthrough(){return new Pt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Pt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Pt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:De.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new Pt({...this._def,catchall:t})}pick(t){const s={};for(const n of Je.objectKeys(t))t[n]&&this.shape[n]&&(s[n]=this.shape[n]);return new Pt({...this._def,shape:()=>s})}omit(t){const s={};for(const n of Je.objectKeys(this.shape))t[n]||(s[n]=this.shape[n]);return new Pt({...this._def,shape:()=>s})}deepPartial(){return lo(this)}partial(t){const s={};for(const n of Je.objectKeys(this.shape)){const o=this.shape[n];t&&!t[n]?s[n]=o:s[n]=o.optional()}return new Pt({...this._def,shape:()=>s})}required(t){const s={};for(const n of Je.objectKeys(this.shape))if(t&&!t[n])s[n]=this.shape[n];else{let l=this.shape[n];for(;l instanceof Sn;)l=l._def.innerType;s[n]=l}return new Pt({...this._def,shape:()=>s})}keyof(){return m1(Je.objectKeys(this.shape))}}Pt.create=(e,t)=>new Pt({shape:()=>e,unknownKeys:"strip",catchall:br.create(),typeName:De.ZodObject,...Ie(t)});Pt.strictCreate=(e,t)=>new Pt({shape:()=>e,unknownKeys:"strict",catchall:br.create(),typeName:De.ZodObject,...Ie(t)});Pt.lazycreate=(e,t)=>new Pt({shape:e,unknownKeys:"strip",catchall:br.create(),typeName:De.ZodObject,...Ie(t)});class Fd extends Ge{_parse(t){const{ctx:s}=this._processInputParams(t),n=this._def.options;function o(l){for(const h of l)if(h.result.status==="valid")return h.result;for(const h of l)if(h.result.status==="dirty")return s.common.issues.push(...h.ctx.common.issues),h.result;const d=l.map(h=>new Cn(h.ctx.common.issues));return pe(s,{code:oe.invalid_union,unionErrors:d}),Re}if(s.common.async)return Promise.all(n.map(async l=>{const d={...s,common:{...s.common,issues:[]},parent:null};return{result:await l._parseAsync({data:s.data,path:s.path,parent:d}),ctx:d}})).then(o);{let l;const d=[];for(const f of n){const m={...s,common:{...s.common,issues:[]},parent:null},g=f._parseSync({data:s.data,path:s.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!l&&(l={result:g,ctx:m}),m.common.issues.length&&d.push(m.common.issues)}if(l)return s.common.issues.push(...l.ctx.common.issues),l.result;const h=d.map(f=>new Cn(f));return pe(s,{code:oe.invalid_union,unionErrors:h}),Re}}get options(){return this._def.options}}Fd.create=(e,t)=>new Fd({options:e,typeName:De.ZodUnion,...Ie(t)});const mn=e=>e instanceof Qp?mn(e.schema):e instanceof da?mn(e.innerType()):e instanceof Kd?[e.value]:e instanceof ua?e.options:e instanceof Zp?Je.objectValues(e.enum):e instanceof Vd?mn(e._def.innerType):e instanceof Vp?[void 0]:e instanceof Yp?[null]:e instanceof Sn?[void 0,...mn(e.unwrap())]:e instanceof ha?[null,...mn(e.unwrap())]:e instanceof p1||e instanceof Gd?mn(e.unwrap()):e instanceof Yd?mn(e._def.innerType):[];class Cg extends Ge{_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==ve.object)return pe(s,{code:oe.invalid_type,expected:ve.object,received:s.parsedType}),Re;const n=this.discriminator,o=s.data[n],l=this.optionsMap.get(o);return l?s.common.async?l._parseAsync({data:s.data,path:s.path,parent:s}):l._parseSync({data:s.data,path:s.path,parent:s}):(pe(s,{code:oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,s,n){const o=new Map;for(const l of s){const d=mn(l.shape[t]);if(!d.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const h of d){if(o.has(h))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(h)}`);o.set(h,l)}}return new Cg({typeName:De.ZodDiscriminatedUnion,discriminator:t,options:s,optionsMap:o,...Ie(n)})}}function Gp(e,t){const s=nr(e),n=nr(t);if(e===t)return{valid:!0,data:e};if(s===ve.object&&n===ve.object){const o=Je.objectKeys(t),l=Je.objectKeys(e).filter(h=>o.indexOf(h)!==-1),d={...e,...t};for(const h of l){const f=Gp(e[h],t[h]);if(!f.valid)return{valid:!1};d[h]=f.data}return{valid:!0,data:d}}else if(s===ve.array&&n===ve.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let l=0;l<e.length;l++){const d=e[l],h=t[l],f=Gp(d,h);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return s===ve.date&&n===ve.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ud extends Ge{_parse(t){const{status:s,ctx:n}=this._processInputParams(t),o=(l,d)=>{if(WS(l)||WS(d))return Re;const h=Gp(l.value,d.value);return h.valid?((VS(l)||VS(d))&&s.dirty(),{status:s.value,value:h.data}):(pe(n,{code:oe.invalid_intersection_types}),Re)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([l,d])=>o(l,d)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ud.create=(e,t,s)=>new Ud({left:e,right:t,typeName:De.ZodIntersection,...Ie(s)});class ca extends Ge{_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.array)return pe(n,{code:oe.invalid_type,expected:ve.array,received:n.parsedType}),Re;if(n.data.length<this._def.items.length)return pe(n,{code:oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Re;!this._def.rest&&n.data.length>this._def.items.length&&(pe(n,{code:oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const l=[...n.data].map((d,h)=>{const f=this._def.items[h]||this._def.rest;return f?f._parse(new $i(n,d,n.path,h)):null}).filter(d=>!!d);return n.common.async?Promise.all(l).then(d=>bs.mergeArray(s,d)):bs.mergeArray(s,l)}get items(){return this._def.items}rest(t){return new ca({...this._def,rest:t})}}ca.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ca({items:e,typeName:De.ZodTuple,rest:null,...Ie(t)})};class $d extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.object)return pe(n,{code:oe.invalid_type,expected:ve.object,received:n.parsedType}),Re;const o=[],l=this._def.keyType,d=this._def.valueType;for(const h in n.data)o.push({key:l._parse(new $i(n,h,n.path,h)),value:d._parse(new $i(n,n.data[h],n.path,h)),alwaysSet:h in n.data});return n.common.async?bs.mergeObjectAsync(s,o):bs.mergeObjectSync(s,o)}get element(){return this._def.valueType}static create(t,s,n){return s instanceof Ge?new $d({keyType:t,valueType:s,typeName:De.ZodRecord,...Ie(n)}):new $d({keyType:yn.create(),valueType:t,typeName:De.ZodRecord,...Ie(s)})}}class JS extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.map)return pe(n,{code:oe.invalid_type,expected:ve.map,received:n.parsedType}),Re;const o=this._def.keyType,l=this._def.valueType,d=[...n.data.entries()].map(([h,f],m)=>({key:o._parse(new $i(n,h,n.path,[m,"key"])),value:l._parse(new $i(n,f,n.path,[m,"value"]))}));if(n.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const f of d){const m=await f.key,g=await f.value;if(m.status==="aborted"||g.status==="aborted")return Re;(m.status==="dirty"||g.status==="dirty")&&s.dirty(),h.set(m.value,g.value)}return{status:s.value,value:h}})}else{const h=new Map;for(const f of d){const m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return Re;(m.status==="dirty"||g.status==="dirty")&&s.dirty(),h.set(m.value,g.value)}return{status:s.value,value:h}}}}JS.create=(e,t,s)=>new JS({valueType:t,keyType:e,typeName:De.ZodMap,...Ie(s)});class dc extends Ge{_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.set)return pe(n,{code:oe.invalid_type,expected:ve.set,received:n.parsedType}),Re;const o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(pe(n,{code:oe.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),s.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(pe(n,{code:oe.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),s.dirty());const l=this._def.valueType;function d(f){const m=new Set;for(const g of f){if(g.status==="aborted")return Re;g.status==="dirty"&&s.dirty(),m.add(g.value)}return{status:s.value,value:m}}const h=[...n.data.values()].map((f,m)=>l._parse(new $i(n,f,n.path,m)));return n.common.async?Promise.all(h).then(f=>d(f)):d(h)}min(t,s){return new dc({...this._def,minSize:{value:t,message:je.toString(s)}})}max(t,s){return new dc({...this._def,maxSize:{value:t,message:je.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}}dc.create=(e,t)=>new dc({valueType:e,minSize:null,maxSize:null,typeName:De.ZodSet,...Ie(t)});class Qp extends Ge{get schema(){return this._def.getter()}_parse(t){const{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Qp.create=(e,t)=>new Qp({getter:e,typeName:De.ZodLazy,...Ie(t)});class Kd extends Ge{_parse(t){if(t.data!==this._def.value){const s=this._getOrReturnCtx(t);return pe(s,{received:s.data,code:oe.invalid_literal,expected:this._def.value}),Re}return{status:"valid",value:t.data}}get value(){return this._def.value}}Kd.create=(e,t)=>new Kd({value:e,typeName:De.ZodLiteral,...Ie(t)});function m1(e,t){return new ua({values:e,typeName:De.ZodEnum,...Ie(t)})}class ua extends Ge{_parse(t){if(typeof t.data!="string"){const s=this._getOrReturnCtx(t),n=this._def.values;return pe(s,{expected:Je.joinValues(n),received:s.parsedType,code:oe.invalid_type}),Re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const s=this._getOrReturnCtx(t),n=this._def.values;return pe(s,{received:s.data,code:oe.invalid_enum_value,options:n}),Re}return gi(t.data)}get options(){return this._def.values}get enum(){const t={};for(const s of this._def.values)t[s]=s;return t}get Values(){const t={};for(const s of this._def.values)t[s]=s;return t}get Enum(){const t={};for(const s of this._def.values)t[s]=s;return t}extract(t,s=this._def){return ua.create(t,{...this._def,...s})}exclude(t,s=this._def){return ua.create(this.options.filter(n=>!t.includes(n)),{...this._def,...s})}}ua.create=m1;class Zp extends Ge{_parse(t){const s=Je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ve.string&&n.parsedType!==ve.number){const o=Je.objectValues(s);return pe(n,{expected:Je.joinValues(o),received:n.parsedType,code:oe.invalid_type}),Re}if(this._cache||(this._cache=new Set(Je.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=Je.objectValues(s);return pe(n,{received:n.data,code:oe.invalid_enum_value,options:o}),Re}return gi(t.data)}get enum(){return this._def.values}}Zp.create=(e,t)=>new Zp({values:e,typeName:De.ZodNativeEnum,...Ie(t)});class Wd extends Ge{unwrap(){return this._def.type}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==ve.promise&&s.common.async===!1)return pe(s,{code:oe.invalid_type,expected:ve.promise,received:s.parsedType}),Re;const n=s.parsedType===ve.promise?s.data:Promise.resolve(s.data);return gi(n.then(o=>this._def.type.parseAsync(o,{path:s.path,errorMap:s.common.contextualErrorMap})))}}Wd.create=(e,t)=>new Wd({type:e,typeName:De.ZodPromise,...Ie(t)});class da extends Ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:n}=this._processInputParams(t),o=this._def.effect||null,l={addIssue:d=>{pe(n,d),d.fatal?s.abort():s.dirty()},get path(){return n.path}};if(l.addIssue=l.addIssue.bind(l),o.type==="preprocess"){const d=o.transform(n.data,l);if(n.common.async)return Promise.resolve(d).then(async h=>{if(s.value==="aborted")return Re;const f=await this._def.schema._parseAsync({data:h,path:n.path,parent:n});return f.status==="aborted"?Re:f.status==="dirty"||s.value==="dirty"?Kl(f.value):f});{if(s.value==="aborted")return Re;const h=this._def.schema._parseSync({data:d,path:n.path,parent:n});return h.status==="aborted"?Re:h.status==="dirty"||s.value==="dirty"?Kl(h.value):h}}if(o.type==="refinement"){const d=h=>{const f=o.refinement(h,l);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(n.common.async===!1){const h=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return h.status==="aborted"?Re:(h.status==="dirty"&&s.dirty(),d(h.value),{status:s.value,value:h.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(h=>h.status==="aborted"?Re:(h.status==="dirty"&&s.dirty(),d(h.value).then(()=>({status:s.value,value:h.value}))))}if(o.type==="transform")if(n.common.async===!1){const d=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ao(d))return Re;const h=o.transform(d.value,l);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:h}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(d=>Ao(d)?Promise.resolve(o.transform(d.value,l)).then(h=>({status:s.value,value:h})):Re);Je.assertNever(o)}}da.create=(e,t,s)=>new da({schema:e,typeName:De.ZodEffects,effect:t,...Ie(s)});da.createWithPreprocess=(e,t,s)=>new da({schema:t,effect:{type:"preprocess",transform:e},typeName:De.ZodEffects,...Ie(s)});class Sn extends Ge{_parse(t){return this._getType(t)===ve.undefined?gi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:De.ZodOptional,...Ie(t)});class ha extends Ge{_parse(t){return this._getType(t)===ve.null?gi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ha.create=(e,t)=>new ha({innerType:e,typeName:De.ZodNullable,...Ie(t)});class Vd extends Ge{_parse(t){const{ctx:s}=this._processInputParams(t);let n=s.data;return s.parsedType===ve.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Vd.create=(e,t)=>new Vd({innerType:e,typeName:De.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ie(t)});class Yd extends Ge{_parse(t){const{ctx:s}=this._processInputParams(t),n={...s,common:{...s.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Id(o)?o.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new Cn(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Cn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Yd.create=(e,t)=>new Yd({innerType:e,typeName:De.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ie(t)});class e0 extends Ge{_parse(t){if(this._getType(t)!==ve.nan){const n=this._getOrReturnCtx(t);return pe(n,{code:oe.invalid_type,expected:ve.nan,received:n.parsedType}),Re}return{status:"valid",value:t.data}}}e0.create=e=>new e0({typeName:De.ZodNaN,...Ie(e)});class p1 extends Ge{_parse(t){const{ctx:s}=this._processInputParams(t),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class kg extends Ge{_parse(t){const{status:s,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Re:l.status==="dirty"?(s.dirty(),Kl(l.value)):this._def.out._parseAsync({data:l.value,path:n.path,parent:n})})();{const o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Re:o.status==="dirty"?(s.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,s){return new kg({in:t,out:s,typeName:De.ZodPipeline})}}class Gd extends Ge{_parse(t){const s=this._def.innerType._parse(t),n=o=>(Ao(o)&&(o.value=Object.freeze(o.value)),o);return Id(s)?s.then(o=>n(o)):n(s)}unwrap(){return this._def.innerType}}Gd.create=(e,t)=>new Gd({innerType:e,typeName:De.ZodReadonly,...Ie(t)});var De;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(De||(De={}));const he=yn.create,jt=Oo.create,Ng=Wp.create;br.create;const Ms=Fi.create,Te=Pt.create,jR=Fd.create,Lo=Cg.create;Ud.create;ca.create;const t0=$d.create,Pe=Kd.create,ds=ua.create;Wd.create;Sn.create;ha.create;const CR="/acp",kR="session",NR=4404,ER=1024*1024,TR=ds(["running","exited"]),s0=ds(["pending","running","ok","failed","cancelled"]),AR=ds(["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"]),i0=Te({path:he(),line:jt().int().nullish()}),n0=Lo("type",[Te({type:Pe("content"),text:he()}),Te({type:Pe("diff"),path:he(),oldText:he().nullish(),newText:he()}),Te({type:Pe("terminal"),terminalId:he()})]),OR=ds(["allow_once","allow_always","reject_once","reject_always"]),Eg=ds(["ask","auto","free"]),_1=ds(["ask","auto"]),g1=ds(["agent","lumem"]),RR=Te({optionId:he(),name:he(),kind:OR}),DR=ds(["end_turn","max_tokens","max_turn_requests","refusal","cancelled"]),MR=ds(["pending","in_progress","completed"]),LR=Te({content:he(),status:MR,priority:ds(["high","medium","low"]).nullish()}),BR=Te({utilization:jt(),surpassedThreshold:jt().nullish(),isUsingOverage:Ng(),resetsAt:jt().int().nullish(),kind:he().nullish()}),zR=Te({value:he(),name:he(),description:he().nullish()}),Qd=Te({id:he(),name:he(),category:he().nullish(),currentValue:he(),choices:Ms(zR)}),v1=Te({name:he(),description:he(),takesInput:Ng()}),y1=Lo("type",[Te({type:Pe("message"),messageId:he(),role:ds(["user","agent"]),text:he()}),Te({type:Pe("thought"),messageId:he(),text:he()}),Te({type:Pe("tool_call"),toolCallId:he(),title:he(),name:he().nullish(),kind:AR,status:s0,locations:Ms(i0).default([]),content:Ms(n0).optional()}),Te({type:Pe("tool_call_update"),toolCallId:he(),status:s0.optional(),title:he().optional(),content:Ms(n0).optional(),locations:Ms(i0).optional()}),Te({type:Pe("permission_request"),requestId:he(),toolCallId:he(),title:he(),command:he().nullish(),cwd:he(),options:Ms(RR).min(1),policyReason:he().nullable().default(null)}),Te({type:Pe("permission_resolved"),requestId:he(),outcome:jR([Pe("cancelled"),Te({optionId:he()})]),by:ds(["user","lumem"]).default("user"),reason:he().nullable().default(null)}),Te({type:Pe("plan"),entries:Ms(LR)}),Te({type:Pe("plan_removed")}),Te({type:Pe("usage"),used:jt().int().nonnegative(),size:jt().int().positive(),cost:Te({amount:jt(),currency:he()}).nullish(),rateLimit:BR.nullish()}),Te({type:Pe("config"),mode:he(),options:Ms(Qd),modeOwner:g1.default("agent"),lumemMode:Eg.default("ask"),lumemModeDefault:_1.default("ask")}),Te({type:Pe("commands"),commands:Ms(v1)}),Te({type:Pe("terminal"),terminalId:he(),ptySessionId:he(),command:he()}),Te({type:Pe("turn_end"),stopReason:DR}),Te({type:Pe("resumed"),fromSessionId:he()}),Te({type:Pe("model_unavailable"),model:he(),current:he()}),Te({type:Pe("account_default_unavailable"),requested:he(),got:he()}),Te({type:Pe("continued_in"),sessionId:he(),label:he()}),Te({type:Pe("continued_from"),sessionId:he(),label:he(),messages:jt().int().nonnegative(),approxTokens:jt().int().nonnegative()}),Te({type:Pe("memory_core"),entries:jt().int().nonnegative(),chars:jt().int().nonnegative()}),Te({type:Pe("budget"),outcome:ds(["warn","block"]),cap:ds(["cost-per-task","cost-per-day","turns-per-session"]),limit:jt().nonnegative(),spent:jt().nonnegative(),message:he()}),Te({type:Pe("quota_refused"),accountId:he().nullable(),accountLabel:he().nullable(),agent:he(),message:he()}),Te({type:Pe("turn_failed"),message:he()}),Te({type:Pe("unknown"),sessionUpdate:he()})]),qR=Te({at:jt().int().nonnegative(),event:y1}),PR=ds(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","ADAPTER_UNAVAILABLE","INTERNAL"]),IR=Lo("type",[Te({type:Pe("prompt"),text:he().min(1)}),Te({type:Pe("cancel")}),Te({type:Pe("permission_response"),requestId:he(),optionId:he()}),Te({type:Pe("set_config"),optionId:he().min(1),value:he().min(1)}),Te({type:Pe("set_lumem_mode"),mode:Eg})]),HR=Lo("type",[Te({type:Pe("attached"),sessionId:he(),state:TR,acpSessionId:he(),model:he(),mode:he(),configOptions:Ms(Qd).default([]),modeOwner:g1.default("agent"),lumemMode:Eg.default("ask"),lumemModeDefault:_1.default("ask"),cwd:he().default(""),transcript:Ms(qR)}),Te({type:Pe("event"),at:jt().int().nonnegative(),event:y1}),Te({type:Pe("error"),code:PR,message:he(),remedy:he().optional()})]);function FR(e,t){let s;try{s=JSON.parse(t)}catch(o){return{ok:!1,error:`not valid JSON: ${o.message}`}}const n=e.safeParse(s);return n.success?{ok:!0,message:n.data}:{ok:!1,error:n.error.issues.map(l=>`${l.path.join(".")||"<root>"}: ${l.message}`).join("; ")}}function UR(e){return FR(HR,e)}function $R(e){return JSON.stringify(e)}Te({adapterId:he().min(1),accountId:he().nullable().default(null),adapterVersion:he().nullable(),configOptions:Ms(Qd),optionsByModel:t0(he(),Ms(Qd)),authRequired:Ng().nullable(),commandsByProject:t0(he(),Ms(v1)),capturedAt:jt().int()});const fo={id:"claude",label:"Claude Code",package:"@agentclientprotocol/claude-agent-acp",command:"claude-agent-acp",pinnedVersion:"0.75.1",cli:null,runtime:"@anthropic-ai/claude-agent-sdk",apiKeyEnv:["ANTHROPIC_API_KEY"],autonomousMode:"bypassPermissions",accountEnv:"CLAUDE_CONFIG_DIR",defaultConfigDir:".claude",inheritLinks:["settings.json","CLAUDE.md","rules","skills","plugins","agents"],notInherited:["os servidores MCP do usuário, que moram no ~/.claude.json junto da identidade"],identity:"cli-auth-status",quotaRefusalKind:"rate_limit",reasoningMeta:{claudeCode:{options:{thinking:{type:"adaptive",display:"summarized"}}}}},KR={id:"codex",label:"Codex",package:"@agentclientprotocol/codex-acp",command:"codex-acp",pinnedVersion:"1.10.0",cli:null,runtime:"@openai/codex",apiKeyEnv:["CODEX_API_KEY","OPENAI_API_KEY"],autonomousMode:null,accountEnv:"CODEX_HOME",defaultConfigDir:".codex",inheritLinks:["config.toml","AGENTS.md","skills"],notInherited:[],identity:"auth-status-notification",quotaRefusalKind:null,reasoningMeta:null},Tg=[fo,KR],Xp=fo.id;function WR(e){return Tg.find(t=>t.id===e)??null}const VR="0.7.0",YR="/pty",GR="session",QR=ds(["running","exited"]),ZR=ds(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","INTERNAL"]),r0=5e3;Lo("type",[Te({type:Pe("input"),data:he()}),Te({type:Pe("resize"),cols:jt().int().min(1).max(r0),rows:jt().int().min(1).max(r0)})]);const XR=Lo("type",[Te({type:Pe("attached"),sessionId:he(),state:QR,cols:jt().int(),rows:jt().int(),snapshot:he()}),Te({type:Pe("output"),data:he()}),Te({type:Pe("exit"),exitCode:jt().int(),signal:jt().int().nullable()}),Te({type:Pe("error"),code:ZR,message:he()})]);function JR(e,t){let s;try{s=JSON.parse(t)}catch(o){return{ok:!1,error:`not valid JSON: ${o.message}`}}const n=e.safeParse(s);return n.success?{ok:!0,message:n.data}:{ok:!1,error:n.error.issues.map(l=>`${l.path.join(".")||"<root>"}: ${l.message}`).join("; ")}}function eD(e){return JR(XR,e)}function a0(e){return JSON.stringify(e)}const tD="worktree",sD=6,iD=48;function nD(e){const s=e.normalize("NFD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n!=="").slice(0,sD).join("-").slice(0,iD).replace(/-+$/,"");return s===""?tD:s}function b1(e={}){return{queryKey:rc(),queryFn:()=>Q.agentConfig.list.query(),enabled:e.enabled??!0}}function Bo(e={}){return be(b1(e))}function rD(){const e=$e(),t=Se({mutationFn:n=>Q.agentConfig.create.mutate(n),onSuccess:async()=>{await e.invalidateQueries({queryKey:rc()})}}),s=Se({mutationFn:n=>Q.agentConfig.remove.mutate({id:n}),onSuccess:async()=>{await e.invalidateQueries({queryKey:rc()})}});return{create:t,remove:s}}function x1(e){return be({queryKey:wT(e.command,e.args),queryFn:()=>Q.setup.probe.query({command:e.command,args:[...e.args]}),retry:!1,refetchOnWindowFocus:!1,staleTime:5*6e4})}function aD(){return be({queryKey:Ej,queryFn:()=>Q.setup.probe.query(),refetchOnWindowFocus:!1,retry:!1})}function S1(){const e=$e();return j.useCallback(()=>e.invalidateQueries({queryKey:Ej}),[e])}function Ag(){return be({queryKey:_g(),queryFn:()=>Q.setup.agents.query(),refetchOnWindowFocus:!1})}function oD(){const e=$e();return Se({mutationFn:t=>Q.setup.installAdapter.mutate({adapterId:t}),onSuccess:async()=>{await e.invalidateQueries({queryKey:_g()})}})}function Jp(e,t){if(t!==void 0)return e==null?void 0:e.adapters.find(s=>s.id===t)}function w1(e,t){const s=$e();return Se({mutationFn:async n=>{var m;const o=Jp(e,n.id);let l=(o==null?void 0:o.adapter.path)??null;const d=(o==null?void 0:o.adapter.version)!=null&&o.adapter.version!==n.pinnedVersion;(l===null||d)&&(t==null||t("installing"),l=(await Q.setup.installAdapter.mutate({adapterId:n.id})).path),t==null||t("handshaking");const h=await Q.setup.probe.query({command:l});return(await Q.agentConfig.create.mutate({name:n.id,command:l,args:[],adapterVersion:((m=h.agentInfo)==null?void 0:m.version)??n.pinnedVersion})).id},onSettled:async()=>{await s.invalidateQueries({queryKey:rc()}),await s.invalidateQueries({queryKey:_g()})}})}function lD(e,t){const s=$e();return Se({mutationFn:async n=>{var d;const o=e==null?void 0:e.find(h=>h.command===n.command);if(o!==void 0)return o;const l=(d=n.agentInfo)==null?void 0:d.version;if(l===void 0)throw new Error("o adaptador não declarou a versão dele no handshake");return Q.agentConfig.create.mutate({name:t,command:n.command,args:[...n.args],adapterVersion:l})},onSuccess:async()=>{await s.invalidateQueries({queryKey:rc()})}})}function j1(e){return"command"in e?{command:e.command,args:[...e.args]}:{adapterId:e.adapterId,accountId:e.accountId}}function cD(){return Se({mutationFn:({target:e,methodId:t})=>Q.setup.login.mutate({methodId:t,...j1(e)})})}function uD(){return Se({mutationFn:({target:e,methodId:t,apiKey:s})=>Q.setup.authenticate.mutate({methodId:t,...s===void 0?{}:{apiKey:s},...j1(e)})})}function dD(e){return be({queryKey:kT(e??""),queryFn:()=>Q.setup.authState.query({loginId:e??""}),enabled:e!==null,refetchInterval:t=>t.state.data===void 0||t.state.data.state==="running"?700:!1})}function hD(){return Se({mutationFn:e=>Q.setup.cancelAuth.mutate({loginId:e})})}function Og(e){return be({queryKey:xT(e),queryFn:()=>Q.adapterCatalog.list.query(e===null?void 0:{projectId:e})})}function fD({embedded:e=!1,onClose:t}={}){const[s,n]=j.useState(e),o=Bo({enabled:s}),{create:l,remove:d}=rD(),[h,f]=j.useState(""),[m,g]=j.useState(""),[v,y]=j.useState(""),[x,S]=j.useState(""),[w,k]=j.useState(null),E=h.trim()!==""&&m.trim()!==""&&x.trim()!=="",D=N=>{N.preventDefault(),E&&l.mutate({name:h.trim(),command:m.trim(),args:v.trim()===""?[]:v.trim().split(/\s+/),adapterVersion:x.trim()},{onSuccess:()=>{f(""),g(""),y(""),S("")}})};if(!s)return a.jsxs("button",{type:"button",className:"sidebar__add",onClick:()=>n(!0),children:[a.jsx(Be,{tone:"agent",children:"◆"}),"agentes"]});const A=o.data??[];return a.jsx("div",{className:"agents",children:a.jsxs(s1,{children:[A.length===0&&!o.isPending&&a.jsx("p",{className:"agents__empty",children:"nenhum agente configurado"}),A.map(N=>a.jsxs("div",{className:"agents__row",children:[a.jsxs("div",{className:"agents__head",children:[a.jsx(Be,{tone:"agent",children:"◆"}),a.jsx("span",{className:"agents__name",children:N.name}),!N.available&&a.jsx(kt,{tone:"missing",children:"fora do PATH"})]}),a.jsxs("div",{className:"agents__foot",children:[a.jsxs("span",{className:"agents__cmd",title:N.command,children:[N.command,N.adapterVersion?` @${N.adapterVersion}`:""]}),w===N.id?a.jsx(J,{size:"sm",variant:"danger",disabled:d.isPending,onClick:()=>d.mutate(N.id,{onSuccess:()=>k(null)}),children:"confirmar"}):a.jsxs(J,{size:"sm",variant:"ghost",onClick:()=>k(N.id),children:["remover ",a.jsx("span",{className:"sr-only",children:N.name})]})]})]},N.id)),d.isError&&a.jsx(Ce,{tone:"danger",children:d.error.message}),a.jsxs("form",{className:"agents__form",onSubmit:D,children:[a.jsx(Ht,{id:"agent-name",label:"Nome",error:l.isError?l.error.message:void 0,children:a.jsx(Ft,{id:"agent-name",value:h,onChange:N=>f(N.target.value),placeholder:"claude-acp",invalid:l.isError,autoFocus:!0})}),a.jsx(Ht,{id:"agent-command",label:"Comando",children:a.jsx(Ft,{id:"agent-command",value:m,onChange:N=>g(N.target.value),placeholder:"claude-agent-acp"})}),a.jsx(Ht,{id:"agent-args",label:"Argumentos (opcional)",children:a.jsx(Ft,{id:"agent-args",value:v,onChange:N=>y(N.target.value),placeholder:"--flag valor"})}),a.jsx(Ht,{id:"agent-version",label:"Versão do adaptador",children:a.jsx(Ft,{id:"agent-version",value:x,onChange:N=>S(N.target.value),placeholder:fo.pinnedVersion})}),a.jsxs("div",{className:"agents__actions",children:[a.jsx(J,{type:"submit",variant:"primary",disabled:l.isPending||!E,children:l.isPending?"criando…":"adicionar"}),a.jsx(J,{variant:"ghost",onClick:()=>{e?t==null||t():n(!1)},children:"fechar"})]})]})]})})}function mD(e,t,s,n){var o;return s?"já conectado":n?"procurando na sua máquina…":e.cli!==null?((o=t==null?void 0:t.cli)==null?void 0:o.path)==null?`o CLI ${e.cli.command} não está no PATH — o adaptador precisa dele`:`${e.cli.command} encontrado · ${t.cli.version??"versão não lida"}`:(t==null?void 0:t.adapter.path)==null?"o adaptador traz o próprio agente dentro":`instalado · ${t.adapter.version??"versão não lida"}`}function pD(e){return e.type==="env_var"||/api[- ]?key/i.test(e.id)}function _D(e){return e.description!==null&&e.description!==""?e.description:e.type==="terminal"?"roda um comando num terminal do daemon":"abre o navegador nesta máquina"}/**
|
|
51
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
52
|
+
* @license MIT
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
55
|
+
* @license MIT
|
|
56
|
+
*
|
|
57
|
+
* Originally forked from (with the author's permission):
|
|
58
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
59
|
+
* http://bellard.org/jslinux/
|
|
60
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
61
|
+
*/var gD=2,vD=1,yD=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var v;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((v=this._terminal.options.overviewRuler)==null?void 0:v.width)||14,s=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),d={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},h=d.top+d.bottom,f=d.right+d.left,m=n-h,g=o-f-t;return{cols:Math.max(gD,Math.floor(g/e.css.cell.width)),rows:Math.max(vD,Math.floor(m/e.css.cell.height))}}};/**
|
|
62
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
63
|
+
* @license MIT
|
|
64
|
+
*
|
|
65
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
66
|
+
* @license MIT
|
|
67
|
+
*
|
|
68
|
+
* Originally forked from (with the author's permission):
|
|
69
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
70
|
+
* http://bellard.org/jslinux/
|
|
71
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
72
|
+
*/var C1=Object.defineProperty,bD=Object.getOwnPropertyDescriptor,xD=(e,t)=>{for(var s in t)C1(e,s,{get:t[s],enumerable:!0})},Nt=(e,t,s,n)=>{for(var o=n>1?void 0:n?bD(t,s):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(o=(n?d(t,s,o):d(o))||o);return n&&o&&C1(t,s,o),o},_e=(e,t)=>(s,n)=>t(s,n,e),o0="Terminal input",e_={get:()=>o0,set:e=>o0=e},l0="Too much output to announce, navigate to rows manually to read",t_={get:()=>l0,set:e=>l0=e};function SD(e){return e.replace(/\r?\n/g,"\r")}function wD(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function jD(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function CD(e,t,s,n){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");k1(o,t,s,n)}}function k1(e,t,s,n){e=SD(e),e=wD(e,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function N1(e,t,s){let n=s.getBoundingClientRect(),o=e.clientX-n.left-10,l=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function c0(e,t,s,n,o){N1(e,t,s),o&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function rr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function fh(e,t=0,s=e.length){let n="";for(let o=t;o<s;++o){let l=e[o];l>65535?(l-=65536,n+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):n+=String.fromCharCode(l)}return n}var kD=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let n=0,o=0;if(this._interim){let l=e.charCodeAt(o++);56320<=l&&l<=57343?t[n++]=(this._interim-55296)*1024+l-56320+65536:(t[n++]=this._interim,t[n++]=l),this._interim=0}for(let l=o;l<s;++l){let d=e.charCodeAt(l);if(55296<=d&&d<=56319){if(++l>=s)return this._interim=d,n;let h=e.charCodeAt(l);56320<=h&&h<=57343?t[n++]=(d-55296)*1024+h-56320+65536:(t[n++]=d,t[n++]=h);continue}d!==65279&&(t[n++]=d)}return n}},ND=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let n=0,o,l,d,h,f=0,m=0;if(this.interim[0]){let y=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let S=0,w;for(;(w=this.interim[++S]&63)&&S<4;)x<<=6,x|=w;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,E=k-S;for(;m<E;){if(m>=s)return 0;if(w=e[m++],(w&192)!==128){m--,y=!0;break}else this.interim[S++]=w,x<<=6,x|=w&63}y||(k===2?x<128?m--:t[n++]=x:k===3?x<2048||x>=55296&&x<=57343||x===65279||(t[n++]=x):x<65536||x>1114111||(t[n++]=x)),this.interim.fill(0)}let g=s-4,v=m;for(;v<s;){for(;v<g&&!((o=e[v])&128)&&!((l=e[v+1])&128)&&!((d=e[v+2])&128)&&!((h=e[v+3])&128);)t[n++]=o,t[n++]=l,t[n++]=d,t[n++]=h,v+=4;if(o=e[v++],o<128)t[n++]=o;else if((o&224)===192){if(v>=s)return this.interim[0]=o,n;if(l=e[v++],(l&192)!==128){v--;continue}if(f=(o&31)<<6|l&63,f<128){v--;continue}t[n++]=f}else if((o&240)===224){if(v>=s)return this.interim[0]=o,n;if(l=e[v++],(l&192)!==128){v--;continue}if(v>=s)return this.interim[0]=o,this.interim[1]=l,n;if(d=e[v++],(d&192)!==128){v--;continue}if(f=(o&15)<<12|(l&63)<<6|d&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[n++]=f}else if((o&248)===240){if(v>=s)return this.interim[0]=o,n;if(l=e[v++],(l&192)!==128){v--;continue}if(v>=s)return this.interim[0]=o,this.interim[1]=l,n;if(d=e[v++],(d&192)!==128){v--;continue}if(v>=s)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=d,n;if(h=e[v++],(h&192)!==128){v--;continue}if(f=(o&7)<<18|(l&63)<<12|(d&63)<<6|h&63,f<65536||f>1114111)continue;t[n++]=f}}return n}},E1="",gr=" ",Rc=class T1{constructor(){this.fg=0,this.bg=0,this.extended=new Zd}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new T1;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Zd=class A1{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new A1(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},pi=class O1 extends Rc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Zd,this.combinedData=""}static fromCharData(t){let s=new O1;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?rr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(n-55296)*1024+o-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},u0="di$target",s_="di$dependencies",Xm=new Map;function ED(e){return e[s_]||[]}function is(e){if(Xm.has(e))return Xm.get(e);let t=function(s,n,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");TD(t,s,o)};return t._id=e,Xm.set(e,t),t}function TD(e,t,s){t[u0]===t?t[s_].push({id:e,index:s}):(t[s_]=[{id:e,index:s}],t[u0]=t)}var xs=is("BufferService"),R1=is("CoreMouseService"),ya=is("CoreService"),AD=is("CharsetService"),Rg=is("InstantiationService"),D1=is("LogService"),Ss=is("OptionsService"),M1=is("OscLinkService"),OD=is("UnicodeService"),Dc=is("DecorationService"),i_=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){var g;let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let n=[],o=this._optionsService.rawOptions.linkHandler,l=new pi,d=s.getTrimmedLength(),h=-1,f=-1,m=!1;for(let v=0;v<d;v++)if(!(f===-1&&!s.hasContent(v))){if(s.loadCell(v,l),l.hasExtendedAttrs()&&l.extended.urlId)if(f===-1){f=v,h=l.extended.urlId;continue}else m=l.extended.urlId!==h;else f!==-1&&(m=!0);if(m||f!==-1&&v===d-1){let y=(g=this._oscLinkService.getLinkData(h))==null?void 0:g.uri;if(y){let x={start:{x:f+1,y:e},end:{x:v+(!m&&v===d-1?1:0),y:e}},S=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||n.push({text:y,range:x,activate:(w,k)=>o?o.activate(w,k,x):RD(w,k),hover:(w,k)=>{var E;return(E=o==null?void 0:o.hover)==null?void 0:E.call(o,w,k,x)},leave:(w,k)=>{var E;return(E=o==null?void 0:o.leave)==null?void 0:E.call(o,w,k,x)}})}m=!1,l.hasExtendedAttrs()&&l.extended.urlId?(f=v,h=l.extended.urlId):(f=-1,h=-1)}}t(n)}};i_=Nt([_e(0,xs),_e(1,Ss),_e(2,M1)],i_);function RD(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
73
|
+
|
|
74
|
+
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var mh=is("CharSizeService"),kn=is("CoreBrowserService"),Dg=is("MouseService"),Nn=is("RenderService"),DD=is("SelectionService"),L1=is("CharacterJoinerService"),zo=is("ThemeService"),B1=is("LinkProviderService"),MD=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?d0.isErrorNoTelemetry(e)?new d0(e.message+`
|
|
75
|
+
|
|
76
|
+
`+e.stack):new Error(e.message+`
|
|
77
|
+
|
|
78
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},LD=new MD;function Ed(e){BD(e)||LD.onUnexpectedError(e)}var n_="Canceled";function BD(e){return e instanceof zD?!0:e instanceof Error&&e.name===n_&&e.message===n_}var zD=class extends Error{constructor(){super(n_),this.name=this.message}};function qD(e){return new Error(`Illegal argument: ${e}`)}var d0=class r_ extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof r_)return t;let s=new r_;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},a_=class z1 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,z1.prototype)}};function Ws(e,t=0){return e[e.length-(1+t)]}var PD;(e=>{function t(l){return l<0}e.isLessThan=t;function s(l){return l<=0}e.isLessThanOrEqual=s;function n(l){return l>0}e.isGreaterThan=n;function o(l){return l===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(PD||(PD={}));function ID(e,t){let s=this,n=!1,o;return function(){return n||(n=!0,t||(o=e.apply(s,arguments))),o}}var q1;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function n(){return s}e.empty=n;function*o(N){yield N}e.single=o;function l(N){return t(N)?N:o(N)}e.wrap=l;function d(N){return N||s}e.from=d;function*h(N){for(let z=N.length-1;z>=0;z--)yield N[z]}e.reverse=h;function f(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=f;function m(N){return N[Symbol.iterator]().next().value}e.first=m;function g(N,z){let V=0;for(let ee of N)if(z(ee,V++))return!0;return!1}e.some=g;function v(N,z){for(let V of N)if(z(V))return V}e.find=v;function*y(N,z){for(let V of N)z(V)&&(yield V)}e.filter=y;function*x(N,z){let V=0;for(let ee of N)yield z(ee,V++)}e.map=x;function*S(N,z){let V=0;for(let ee of N)yield*z(ee,V++)}e.flatMap=S;function*w(...N){for(let z of N)yield*z}e.concat=w;function k(N,z,V){let ee=V;for(let $ of N)ee=z(ee,$);return ee}e.reduce=k;function*E(N,z,V=N.length){for(z<0&&(z+=N.length),V<0?V+=N.length:V>N.length&&(V=N.length);z<V;z++)yield N[z]}e.slice=E;function D(N,z=Number.POSITIVE_INFINITY){let V=[];if(z===0)return[V,N];let ee=N[Symbol.iterator]();for(let $=0;$<z;$++){let ae=ee.next();if(ae.done)return[V,e.empty()];V.push(ae.value)}return[V,{[Symbol.iterator](){return ee}}]}e.consume=D;async function A(N){let z=[];for await(let V of N)z.push(V);return Promise.resolve(z)}e.asyncToArray=A})(q1||(q1={}));function fa(e){if(q1.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function HD(...e){return gt(()=>fa(e))}function gt(e){return{dispose:ID(()=>{e()})}}var P1=class I1{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{fa(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?I1.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};P1.DISABLE_DISPOSED_WARNING=!1;var yr=P1,Ue=class{constructor(){this._store=new yr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ue.None=Object.freeze({dispose(){}});var Ro=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},bn=typeof window=="object"?window:globalThis,o_=class l_{constructor(t){this.element=t,this.next=l_.Undefined,this.prev=l_.Undefined}};o_.Undefined=new o_(void 0);var vt=o_,h0=class{constructor(){this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===vt.Undefined}clear(){let e=this._first;for(;e!==vt.Undefined;){let t=e.next;e.prev=vt.Undefined,e.next=vt.Undefined,e=t}this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new vt(e);if(this._first===vt.Undefined)this._first=s,this._last=s;else if(t){let o=this._last;this._last=s,s.prev=o,o.next=s}else{let o=this._first;this._first=s,s.next=o,o.prev=s}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(s))}}shift(){if(this._first!==vt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==vt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==vt.Undefined&&e.next!==vt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===vt.Undefined&&e.next===vt.Undefined?(this._first=vt.Undefined,this._last=vt.Undefined):e.next===vt.Undefined?(this._last=this._last.prev,this._last.next=vt.Undefined):e.prev===vt.Undefined&&(this._first=this._first.next,this._first.prev=vt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==vt.Undefined;)yield e.element,e=e.next}},FD=globalThis.performance&&typeof globalThis.performance.now=="function",UD=class H1{static create(t){return new H1(t)}constructor(t){this._now=FD&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},us;(e=>{e.None=()=>Ue.None;function t(B,O){return v(B,()=>{},0,void 0,!0,void 0,O)}e.defer=t;function s(B){return(O,se=null,re)=>{let q=!1,M;return M=B(K=>{if(!q)return M?M.dispose():q=!0,O.call(se,K)},null,re),q&&M.dispose(),M}}e.once=s;function n(B,O,se){return m((re,q=null,M)=>B(K=>re.call(q,O(K)),null,M),se)}e.map=n;function o(B,O,se){return m((re,q=null,M)=>B(K=>{O(K),re.call(q,K)},null,M),se)}e.forEach=o;function l(B,O,se){return m((re,q=null,M)=>B(K=>O(K)&&re.call(q,K),null,M),se)}e.filter=l;function d(B){return B}e.signal=d;function h(...B){return(O,se=null,re)=>{let q=HD(...B.map(M=>M(K=>O.call(se,K))));return g(q,re)}}e.any=h;function f(B,O,se,re){let q=se;return n(B,M=>(q=O(q,M),q),re)}e.reduce=f;function m(B,O){let se,re={onWillAddFirstListener(){se=B(q.fire,q)},onDidRemoveLastListener(){se==null||se.dispose()}},q=new ue(re);return O==null||O.add(q),q.event}function g(B,O){return O instanceof Array?O.push(B):O&&O.add(B),B}function v(B,O,se=100,re=!1,q=!1,M,K){let fe,Ae,L,X=0,ce,Y={leakWarningThreshold:M,onWillAddFirstListener(){fe=B(xe=>{X++,Ae=O(Ae,xe),re&&!L&&(de.fire(Ae),Ae=void 0),ce=()=>{let ze=Ae;Ae=void 0,L=void 0,(!re||X>1)&&de.fire(ze),X=0},typeof se=="number"?(clearTimeout(L),L=setTimeout(ce,se)):L===void 0&&(L=0,queueMicrotask(ce))})},onWillRemoveListener(){q&&X>0&&(ce==null||ce())},onDidRemoveLastListener(){ce=void 0,fe.dispose()}},de=new ue(Y);return K==null||K.add(de),de.event}e.debounce=v;function y(B,O=0,se){return e.debounce(B,(re,q)=>re?(re.push(q),re):[q],O,void 0,!0,void 0,se)}e.accumulate=y;function x(B,O=(re,q)=>re===q,se){let re=!0,q;return l(B,M=>{let K=re||!O(M,q);return re=!1,q=M,K},se)}e.latch=x;function S(B,O,se){return[e.filter(B,O,se),e.filter(B,re=>!O(re),se)]}e.split=S;function w(B,O=!1,se=[],re){let q=se.slice(),M=B(Ae=>{q?q.push(Ae):fe.fire(Ae)});re&&re.add(M);let K=()=>{q==null||q.forEach(Ae=>fe.fire(Ae)),q=null},fe=new ue({onWillAddFirstListener(){M||(M=B(Ae=>fe.fire(Ae)),re&&re.add(M))},onDidAddFirstListener(){q&&(O?setTimeout(K):K())},onDidRemoveLastListener(){M&&M.dispose(),M=null}});return re&&re.add(fe),fe.event}e.buffer=w;function k(B,O){return(se,re,q)=>{let M=O(new D);return B(function(K){let fe=M.evaluate(K);fe!==E&&se.call(re,fe)},void 0,q)}}e.chain=k;let E=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(se=>(O(se),se)),this}filter(O){return this.steps.push(se=>O(se)?se:E),this}reduce(O,se){let re=se;return this.steps.push(q=>(re=O(re,q),re)),this}latch(O=(se,re)=>se===re){let se=!0,re;return this.steps.push(q=>{let M=se||!O(q,re);return se=!1,re=q,M?q:E}),this}evaluate(O){for(let se of this.steps)if(O=se(O),O===E)break;return O}}function A(B,O,se=re=>re){let re=(...fe)=>K.fire(se(...fe)),q=()=>B.on(O,re),M=()=>B.removeListener(O,re),K=new ue({onWillAddFirstListener:q,onDidRemoveLastListener:M});return K.event}e.fromNodeEventEmitter=A;function N(B,O,se=re=>re){let re=(...fe)=>K.fire(se(...fe)),q=()=>B.addEventListener(O,re),M=()=>B.removeEventListener(O,re),K=new ue({onWillAddFirstListener:q,onDidRemoveLastListener:M});return K.event}e.fromDOMEventEmitter=N;function z(B){return new Promise(O=>s(B)(O))}e.toPromise=z;function V(B){let O=new ue;return B.then(se=>{O.fire(se)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}e.fromPromise=V;function ee(B,O){return B(se=>O.fire(se))}e.forward=ee;function $(B,O,se){return O(se),B(re=>O(re))}e.runAndSubscribe=$;class ae{constructor(O,se){this._observable=O,this._counter=0,this._hasChanged=!1;let re={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new ue(re),se&&se.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,se){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function me(B,O){return new ae(B,O).emitter.event}e.fromObservable=me;function H(B){return(O,se,re)=>{let q=0,M=!1,K={beginUpdate(){q++},endUpdate(){q--,q===0&&(B.reportChanges(),M&&(M=!1,O.call(se)))},handlePossibleChange(){},handleChange(){M=!0}};B.addObserver(K),B.reportChanges();let fe={dispose(){B.removeObserver(K)}};return re instanceof yr?re.add(fe):Array.isArray(re)&&re.push(fe),fe}}e.fromObservableLight=H})(us||(us={}));var c_=class u_{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${u_._idPool++}`,u_.all.add(this)}start(t){this._stopWatch=new UD,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};c_.all=new Set,c_._idPool=0;var $D=c_,KD=-1,F1=class U1{constructor(t,s,n=(U1._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,s){let n=this.threshold;if(n<=0||s<n)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,d]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${d}):`;console.warn(h),console.warn(l);let f=new YD(h,l);this._errorHandler(f)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[n,o]of this._stacks)(!t||s<o)&&(t=[n,o],s=o);return t}};F1._idPool=1;var WD=F1,VD=class $1{constructor(t){this.value=t}static create(){let t=new Error;return new $1(t.stack??"")}print(){console.warn(this.value.split(`
|
|
79
|
+
`).slice(2).join(`
|
|
80
|
+
`))}},YD=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},GD=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},QD=0,Jm=class{constructor(e){this.value=e,this.id=QD++}},ZD=2,XD,ue=class{constructor(e){var t,s,n,o;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new WD((e==null?void 0:e.onListenerError)??Ed,((s=this._options)==null?void 0:s.leakWarningThreshold)??KD):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new $D(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var e,t,s,n;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||s.call(t),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(e,t,s)=>{var d,h,f,m,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let v=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(v);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new GD(`${v}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((d=this._options)==null?void 0:d.onListenerError)||Ed)(x),Ue.None}if(this._disposed)return Ue.None;t&&(e=e.bind(t));let n=new Jm(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=VD.create(),o=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof Jm?(this._deliveryQueue??(this._deliveryQueue=new JD),this._listeners=[this._listeners,n]):this._listeners.push(n):((f=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||f.call(h,this),this._listeners=n,(g=(m=this._options)==null?void 0:m.onDidAddFirstListener)==null||g.call(m,this)),this._size++;let l=gt(()=>{o==null||o(),this._removeListener(n)});return s instanceof yr?s.add(l):Array.isArray(s)&&s.push(l),l}),this._event}_removeListener(e){var o,l,d,h;if((l=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||l.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||h.call(d,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let n=this._deliveryQueue.current===this;if(this._size*ZD<=t.length){let f=0;for(let m=0;m<t.length;m++)t[m]?t[f++]=t[m]:n&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=f}}_deliver(e,t){var n;if(!e)return;let s=((n=this._options)==null?void 0:n.onListenerError)||Ed;if(!s){e.value(t);return}try{e.value(t)}catch(o){s(o)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,n,o;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof Jm)this._deliver(this._listeners,e);else{let l=this._deliveryQueue;l.enqueue(this,e,this._listeners.length),this._deliverQueue(l)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},JD=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},d_=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let n=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let n=this.getWindowId(s);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};d_.INSTANCE=new d_;var Mg=d_;function eM(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}Mg.INSTANCE.onDidChangeZoomLevel;function tM(e){return Mg.INSTANCE.getZoomFactor(e)}Mg.INSTANCE.onDidChangeFullscreen;var qo=typeof navigator=="object"?navigator.userAgent:"",h_=qo.indexOf("Firefox")>=0,sM=qo.indexOf("AppleWebKit")>=0,Lg=qo.indexOf("Chrome")>=0,iM=!Lg&&qo.indexOf("Safari")>=0;qo.indexOf("Electron/")>=0;qo.indexOf("Android")>=0;var ep=!1;if(typeof bn.matchMedia=="function"){let e=bn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=bn.matchMedia("(display-mode: fullscreen)");ep=e.matches,eM(bn,e,({matches:s})=>{ep&&t.matches||(ep=s)})}var uo="en",f_=!1,m_=!1,Td=!1,K1=!1,dd,Ad=uo,f0=uo,nM,Si,na=globalThis,cs,Xw;typeof na.vscode<"u"&&typeof na.vscode.process<"u"?cs=na.vscode.process:typeof process<"u"&&typeof((Xw=process==null?void 0:process.versions)==null?void 0:Xw.node)=="string"&&(cs=process);var Jw,rM=typeof((Jw=cs==null?void 0:cs.versions)==null?void 0:Jw.electron)=="string",aM=rM&&(cs==null?void 0:cs.type)==="renderer",ej;if(typeof cs=="object"){f_=cs.platform==="win32",m_=cs.platform==="darwin",Td=cs.platform==="linux",Td&&cs.env.SNAP&&cs.env.SNAP_REVISION,cs.env.CI||cs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dd=uo,Ad=uo;let e=cs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);dd=t.userLocale,f0=t.osLocale,Ad=t.resolvedLanguage||uo,nM=(ej=t.languagePack)==null?void 0:ej.translationsConfigFile}catch{}K1=!0}else typeof navigator=="object"&&!aM?(Si=navigator.userAgent,f_=Si.indexOf("Windows")>=0,m_=Si.indexOf("Macintosh")>=0,(Si.indexOf("Macintosh")>=0||Si.indexOf("iPad")>=0||Si.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Td=Si.indexOf("Linux")>=0,(Si==null?void 0:Si.indexOf("Mobi"))>=0,Ad=globalThis._VSCODE_NLS_LANGUAGE||uo,dd=navigator.language.toLowerCase(),f0=dd):console.error("Unable to resolve platform.");var W1=f_,Ui=m_,oM=Td,m0=K1,Ki=Si,Jn=Ad,lM;(e=>{function t(){return Jn}e.value=t;function s(){return Jn.length===2?Jn==="en":Jn.length>=3?Jn[0]==="e"&&Jn[1]==="n"&&Jn[2]==="-":!1}e.isDefaultVariant=s;function n(){return Jn==="en"}e.isDefault=n})(lM||(lM={}));var cM=typeof na.postMessage=="function"&&!na.importScripts;(()=>{if(cM){let e=[];na.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let n=0,o=e.length;n<o;n++){let l=e[n];if(l.id===s.data.vscodeScheduleAsyncWork){e.splice(n,1),l.callback();return}}});let t=0;return s=>{let n=++t;e.push({id:n,callback:s}),na.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var uM=!!(Ki&&Ki.indexOf("Chrome")>=0);Ki&&Ki.indexOf("Firefox")>=0;!uM&&Ki&&Ki.indexOf("Safari")>=0;Ki&&Ki.indexOf("Edg/")>=0;Ki&&Ki.indexOf("Android")>=0;var ao=typeof navigator=="object"?navigator:{};m0||document.queryCommandSupported&&document.queryCommandSupported("copy")||ao&&ao.clipboard&&ao.clipboard.writeText,m0||ao&&ao.clipboard&&ao.clipboard.readText;var Bg=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},tp=new Bg,p0=new Bg,_0=new Bg,dM=new Array(230),V1;(e=>{function t(h){return tp.keyCodeToStr(h)}e.toString=t;function s(h){return tp.strToKeyCode(h)}e.fromString=s;function n(h){return p0.keyCodeToStr(h)}e.toUserSettingsUS=n;function o(h){return _0.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function l(h){return p0.strToKeyCode(h)||_0.strToKeyCode(h)}e.fromUserSettings=l;function d(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return tp.keyCodeToStr(h)}e.toElectronAccelerator=d})(V1||(V1={}));var hM=class Y1{constructor(t,s,n,o,l){this.ctrlKey=t,this.shiftKey=s,this.altKey=n,this.metaKey=o,this.keyCode=l}equals(t){return t instanceof Y1&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",s=this.shiftKey?"1":"0",n=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${s}${n}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new fM([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},fM=class{constructor(e){if(e.length===0)throw qD("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function mM(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return V1.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(h_)switch(t){case 59:return 85;case 60:if(oM)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ui)return 57;break}else if(sM&&(Ui&&t===93||!Ui&&t===92))return 57;return dM[t]||0}var pM=Ui?256:2048,_M=512,gM=1024,vM=Ui?2048:256,g0=class{constructor(e){var s;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(s=t.getModifierState)==null?void 0:s.call(t,"AltGraph"),this.keyCode=mM(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=pM),this.altKey&&(t|=_M),this.shiftKey&&(t|=gM),this.metaKey&&(t|=vM),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new hM(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},v0=new WeakMap;function yM(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var bM=class{static getSameOriginWindowChain(e){let t=v0.get(e);if(!t){t=[],v0.set(e,t);let s=e,n;do n=yM(s),n?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=n;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,n=0,o=this.getSameOriginWindowChain(e);for(let l of o){let d=l.window.deref();if(s+=(d==null?void 0:d.scrollY)??0,n+=(d==null?void 0:d.scrollX)??0,d===t||!l.iframeElement)break;let h=l.iframeElement.getBoundingClientRect();s+=h.top,n+=h.left}return{top:s,left:n}}},hd=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=bM.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},y0=class{constructor(e,t=0,s=0){var o;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let n=!1;if(Lg){let l=navigator.userAgent.match(/Chrome\/(\d+)/);n=(l?parseInt(l[1]):123)<=122}if(e){let l=e,d=e,h=((o=e.view)==null?void 0:o.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")n?this.deltaY=l.wheelDeltaY/(120*h):this.deltaY=l.wheelDeltaY/120;else if(typeof d.VERTICAL_AXIS<"u"&&d.axis===d.VERTICAL_AXIS)this.deltaY=-d.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?h_&&!Ui?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")iM&&W1?this.deltaX=-(l.wheelDeltaX/120):n?this.deltaX=l.wheelDeltaX/(120*h):this.deltaX=l.wheelDeltaX/120;else if(typeof d.HORIZONTAL_AXIS<"u"&&d.axis===d.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?h_&&!Ui?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},G1=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),xM;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof SM?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:us.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:G1})})(xM||(xM={}));var SM=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?G1:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zg=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new a_("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new a_("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},wM=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new a_("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=s.setInterval(()=>{e()},t);this.disposable=gt(()=>{s.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},jM;(e=>{async function t(n){let o,l=await Promise.all(n.map(d=>d.then(h=>h,h=>{o||(o=h)})));if(typeof o<"u")throw o;return l}e.settled=t;function s(n){return new Promise(async(o,l)=>{try{await n(o,l)}catch(d){l(d)}})}e.withAsyncBody=s})(jM||(jM={}));var b0=class ui{static fromArray(t){return new ui(s=>{s.emitMany(t)})}static fromPromise(t){return new ui(async s=>{s.emitMany(await t)})}static fromPromises(t){return new ui(async s=>{await Promise.all(t.map(async n=>s.emitOne(await n)))})}static merge(t){return new ui(async s=>{await Promise.all(t.map(async n=>{for await(let o of n)s.emitOne(o)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new ue,queueMicrotask(async()=>{let n={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(n)),this.resolve()}catch(o){this.reject(o)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await us.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var s;return(s=this._onReturn)==null||s.call(this),{done:!0,value:void 0}}}}static map(t,s){return new ui(async n=>{for await(let o of t)n.emitOne(s(o))})}map(t){return ui.map(this,t)}static filter(t,s){return new ui(async n=>{for await(let o of t)s(o)&&n.emitOne(o)})}filter(t){return ui.filter(this,t)}static coalesce(t){return ui.filter(t,s=>!!s)}coalesce(){return ui.coalesce(this)}static async toPromise(t){let s=[];for await(let n of t)s.push(n);return s}toPromise(){return ui.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};b0.EMPTY=b0.fromArray([]);var{getWindow:Ii,getWindowId:CM,onDidRegisterWindow:kM}=(function(){let e=new Map,t={window:bn,disposables:new yr};e.set(bn.vscodeWindowId,t);let s=new ue,n=new ue,o=new ue;function l(d,h){return(typeof d=="number"?e.get(d):void 0)??(h?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:n.event,registerWindow(d){if(e.has(d.vscodeWindowId))return Ue.None;let h=new yr,f={window:d,disposables:h.add(new yr)};return e.set(d.vscodeWindowId,f),h.add(gt(()=>{e.delete(d.vscodeWindowId),n.fire(d)})),h.add(Oe(d,Xt.BEFORE_UNLOAD,()=>{o.fire(d)})),s.fire(f),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:l,getWindow(d){var m;let h=d;if((m=h==null?void 0:h.ownerDocument)!=null&&m.defaultView)return h.ownerDocument.defaultView.window;let f=d;return f!=null&&f.view?f.view.window:bn},getDocument(d){return Ii(d).document}}})(),NM=class{constructor(e,t,s,n){this._node=e,this._type=t,this._handler=s,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Oe(e,t,s,n){return new NM(e,t,s,n)}var x0=function(e,t,s,n){return Oe(e,t,s,n)},qg,EM=class extends wM{constructor(e){super(),this.defaultTarget=e&&Ii(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},S0=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ed(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,n=new Map,o=l=>{s.set(l,!1);let d=e.get(l)??[];for(t.set(l,d),e.set(l,[]),n.set(l,!0);d.length>0;)d.sort(S0.sort),d.shift().execute();n.set(l,!1)};qg=(l,d,h=0)=>{let f=CM(l),m=new S0(d,h),g=e.get(f);return g||(g=[],e.set(f,g)),g.push(m),s.get(f)||(s.set(f,!0),l.requestAnimationFrame(()=>o(f))),m}})();function TM(e){let t=e.getBoundingClientRect(),s=Ii(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var Xt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},AM=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=As(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=As(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=As(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=As(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=As(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=As(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=As(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=As(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=As(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=As(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=As(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=As(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=As(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=As(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function As(e){return typeof e=="number"?`${e}px`:e}function tc(e){return new AM(e)}var Q1=class{constructor(){this._hooks=new yr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,n,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=o;let l=e;try{e.setPointerCapture(t),this._hooks.add(gt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Ii(e)}this._hooks.add(Oe(l,Xt.POINTER_MOVE,d=>{if(d.buttons!==s){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(Oe(l,Xt.POINTER_UP,d=>this.stopMonitoring(!0)))}};function OM(e,t,s){let n=null,o=null;if(typeof s.value=="function"?(n="value",o=s.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(n="get",o=s.get),!o)throw new Error("not supported");let l=`$memoize$${t}`;s[n]=function(...d){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,d)}),this[l]}}var Di;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Di||(Di={}));var Wl=class ms extends Ue{constructor(){super(),this.dispatched=!1,this.targets=new h0,this.ignoreTargets=new h0,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(us.runAndSubscribe(kM,({window:t,disposables:s})=>{s.add(Oe(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),s.add(Oe(t.document,"touchend",n=>this.onTouchEnd(t,n))),s.add(Oe(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:bn,disposables:this._store}))}static addTarget(t){if(!ms.isTouchDevice())return Ue.None;ms.INSTANCE||(ms.INSTANCE=new ms);let s=ms.INSTANCE.targets.push(t);return gt(s)}static ignoreTarget(t){if(!ms.isTouchDevice())return Ue.None;ms.INSTANCE||(ms.INSTANCE=new ms);let s=ms.INSTANCE.ignoreTargets.push(t);return gt(s)}static isTouchDevice(){return"ontouchstart"in bn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,o=t.targetTouches.length;n<o;n++){let l=t.targetTouches.item(n);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:s,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[s],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let d=this.newGestureEvent(Di.Start,l.target);d.pageX=l.pageX,d.pageY=l.pageY,this.dispatchEvent(d)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let n=Date.now(),o=Object.keys(this.activeTouches).length;for(let l=0,d=s.changedTouches.length;l<d;l++){let h=s.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let f=this.activeTouches[h.identifier],m=Date.now()-f.initialTimeStamp;if(m<ms.HOLD_DELAY&&Math.abs(f.initialPageX-Ws(f.rollingPageX))<30&&Math.abs(f.initialPageY-Ws(f.rollingPageY))<30){let g=this.newGestureEvent(Di.Tap,f.initialTarget);g.pageX=Ws(f.rollingPageX),g.pageY=Ws(f.rollingPageY),this.dispatchEvent(g)}else if(m>=ms.HOLD_DELAY&&Math.abs(f.initialPageX-Ws(f.rollingPageX))<30&&Math.abs(f.initialPageY-Ws(f.rollingPageY))<30){let g=this.newGestureEvent(Di.Contextmenu,f.initialTarget);g.pageX=Ws(f.rollingPageX),g.pageY=Ws(f.rollingPageY),this.dispatchEvent(g)}else if(o===1){let g=Ws(f.rollingPageX),v=Ws(f.rollingPageY),y=Ws(f.rollingTimestamps)-f.rollingTimestamps[0],x=g-f.rollingPageX[0],S=v-f.rollingPageY[0],w=[...this.targets].filter(k=>f.initialTarget instanceof Node&&k.contains(f.initialTarget));this.inertia(t,w,n,Math.abs(x)/y,x>0?1:-1,g,Math.abs(S)/y,S>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(Di.End,f.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=s,n.tapCount=0,n}dispatchEvent(t){if(t.type===Di.Tap){let s=new Date().getTime(),n=0;s-this._lastSetTapCountTime>ms.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=s,t.tapCount=n}else(t.type===Di.Change||t.type===Di.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let s=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let o=0,l=t.initialTarget;for(;l&&l!==n;)o++,l=l.parentElement;s.push([o,n])}s.sort((n,o)=>n[0]-o[0]);for(let[n,o]of s)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,n,o,l,d,h,f,m){this.handle=qg(t,()=>{let g=Date.now(),v=g-n,y=0,x=0,S=!0;o+=ms.SCROLL_FRICTION*v,h+=ms.SCROLL_FRICTION*v,o>0&&(S=!1,y=l*o*v),h>0&&(S=!1,x=f*h*v);let w=this.newGestureEvent(Di.Change);w.translationX=y,w.translationY=x,s.forEach(k=>k.dispatchEvent(w)),S||this.inertia(t,s,g,o,l,d+y,h,f,m+x)})}onTouchMove(t){let s=Date.now();for(let n=0,o=t.changedTouches.length;n<o;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let d=this.activeTouches[l.identifier],h=this.newGestureEvent(Di.Change,d.initialTarget);h.translationX=l.pageX-Ws(d.rollingPageX),h.translationY=l.pageY-Ws(d.rollingPageY),h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(l.pageX),d.rollingPageY.push(l.pageY),d.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Wl.SCROLL_FRICTION=-.005,Wl.HOLD_DELAY=700,Wl.CLEAR_TAP_COUNT_TIME=400,Nt([OM],Wl,"isTouchDevice",1);var RM=Wl,Pg=class extends Ue{onclick(e,t){this._register(Oe(e,Xt.CLICK,s=>t(new hd(Ii(e),s))))}onmousedown(e,t){this._register(Oe(e,Xt.MOUSE_DOWN,s=>t(new hd(Ii(e),s))))}onmouseover(e,t){this._register(Oe(e,Xt.MOUSE_OVER,s=>t(new hd(Ii(e),s))))}onmouseleave(e,t){this._register(Oe(e,Xt.MOUSE_LEAVE,s=>t(new hd(Ii(e),s))))}onkeydown(e,t){this._register(Oe(e,Xt.KEY_DOWN,s=>t(new g0(s))))}onkeyup(e,t){this._register(Oe(e,Xt.KEY_UP,s=>t(new g0(s))))}oninput(e,t){this._register(Oe(e,Xt.INPUT,t))}onblur(e,t){this._register(Oe(e,Xt.BLUR,t))}onfocus(e,t){this._register(Oe(e,Xt.FOCUS,t))}onchange(e,t){this._register(Oe(e,Xt.CHANGE,t))}ignoreGesture(e){return RM.ignoreTarget(e)}},w0=11,DM=class extends Pg{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=w0+"px",this.domNode.style.height=w0+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Q1),this._register(x0(this.bgDomNode,Xt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(x0(this.domNode,Xt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new EM),this._pointerdownScheduleRepeatTimer=this._register(new zg)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ii(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},MM=class p_{constructor(t,s,n,o,l,d,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,n=n|0,o=o|0,l=l|0,d=d|0,h=h|0),this.rawScrollLeft=o,this.rawScrollTop=h,s<0&&(s=0),o+s>n&&(o=n-s),o<0&&(o=0),l<0&&(l=0),h+l>d&&(h=d-l),h<0&&(h=0),this.width=s,this.scrollWidth=n,this.scrollLeft=o,this.height=l,this.scrollHeight=d,this.scrollTop=h}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,s){return new p_(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new p_(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,s){let n=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,d=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:o,scrollLeftChanged:l,heightChanged:d,scrollHeightChanged:h,scrollTopChanged:f}}},LM=class extends Ue{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new MM(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var n;let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let n;t?n=new C0(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=C0.start(this._state,s,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},j0=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function sp(e,t){let s=t-e;return function(n){return e+s*qM(n)}}function BM(e,t,s){return function(n){return n<s?e(n/s):t((n-s)/(1-s))}}var C0=class __{constructor(t,s,n,o){this.from=t,this.to=s,this.duration=o,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,s,n){if(Math.abs(t-s)>2.5*n){let o,l;return t<s?(o=t+.75*n,l=s-.75*n):(o=t-.75*n,l=s+.75*n),BM(sp(t,o),sp(l,s),.33)}return sp(t,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let s=(t-this.startTime)/this.duration;if(s<1){let n=this.scrollLeft(s),o=this.scrollTop(s);return new j0(n,o,!1)}return new j0(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,n){return __.start(t,s,n)}static start(t,s,n){n=n+10;let o=Date.now()-10;return new __(t,s,o,n)}};function zM(e){return Math.pow(e,3)}function qM(e){return 1-zM(1-e)}var PM=class extends Ue{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new zg)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},IM=140,Z1=class extends Pg{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new PM(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Q1),this._shouldRender=!0,this.domNode=tc(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Oe(this.domNode.domNode,Xt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new DM(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,n){this.slider=tc(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Oe(this.slider.domNode,Xt.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,s=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);s<=o&&o<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let o=TM(this.domNode.domNode);t=e.pageX-o.left,s=e.pageY-o.top}let n=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let l=this._sliderOrthogonalPointerPosition(o),d=Math.abs(l-s);if(W1&&d>IM){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let h=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},X1=class g_{constructor(t,s,n,o,l,d){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=l,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new g_(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,n,o,l){let d=Math.max(0,n-t),h=Math.max(0,d-2*s),f=o>0&&o>n;if(!f)return{computedAvailableSize:Math.round(d),computedIsNeeded:f,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(n*h/o))),g=(h-m)/(o-n),v=l*g;return{computedAvailableSize:Math.round(d),computedIsNeeded:f,computedSliderSize:Math.round(m),computedSliderRatio:g,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=g_._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,n=this._scrollPosition;return s<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},HM=class extends Z1{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new X1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},FM=class extends Z1{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new X1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},UM=500,k0=50,$M=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},v_=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,s=0,n=1,o=this._rear;do{let l=o===this._front?t:Math.pow(2,-n);if(t-=l,s+=this._memory[o].score*l,o===this._front)break;o=(this._capacity+o-1)%this._capacity,n++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(Lg){let s=Ii(t.browserEvent),n=tM(s);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,n){let o=null,l=new $M(t,s,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,o)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),s){let o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),d=Math.abs(s.deltaX),h=Math.abs(s.deltaY),f=Math.max(Math.min(o,d),1),m=Math.max(Math.min(l,h),1),g=Math.max(o,d),v=Math.max(l,h);g%f===0&&v%m===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};v_.INSTANCE=new v_;var KM=v_,WM=class extends Pg{constructor(e,t,s){super(),this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ue),this.onWillScroll=this._onWillScroll.event,this._options=YM(t),this._scrollable=s,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let n={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new FM(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new HM(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=tc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=tc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=tc(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new zg),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=fa(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Ui&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new y0(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=fa(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new y0(s))};this._mouseWheelToDispose.push(Oe(this._listenOnDomNode,Xt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var o;if((o=e.browserEvent)!=null&&o.defaultPrevented)return;let t=KM.INSTANCE;t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,d=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&d+l===0?d=l=0:Math.abs(l)>=Math.abs(d)?d=0:l=0),this._options.flipAxes&&([l,d]=[d,l]);let h=!Ui&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!d&&(d=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(d=d*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),m={};if(l){let g=k0*l,v=f.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(m,v)}if(d){let g=k0*d,v=f.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(m,v)}m=this._scrollable.validateScrollPosition(m),(f.scrollLeft!==m.scrollLeft||f.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),s=!0)}let n=s;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,s=e.scrollLeft>0,n=s?" left":"",o=t?" top":"",l=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),UM)}},VM=class extends WM{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function YM(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ui&&(t.className+=" mac"),t}var y_=class extends Ue{constructor(e,t,s,n,o,l,d,h){super(),this._bufferService=s,this._optionsService=d,this._renderService=h,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new LM({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>qg(n.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new VM(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(us.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(gt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(gt(()=>this._styleElement.remove())),this._register(us.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
81
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(m=>this._handleScroll(m)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};y_=Nt([_e(2,xs),_e(3,kn),_e(4,R1),_e(5,zo),_e(6,Ss),_e(7,Nn)],y_);var b_=class extends Ue{constructor(e,t,s,n,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=n,this._renderService=o,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(l=>this._removeDecoration(l))),this._register(gt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};b_=Nt([_e(1,xs),_e(2,kn),_e(3,Dc),_e(4,Nn)],b_);var GM=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Oi={full:0,left:0,center:0,right:0},er={full:0,left:0,center:0,right:0},ql={full:0,left:0,center:0,right:0},Xd=class extends Ue{constructor(e,t,s,n,o,l,d,h){var m;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=n,this._renderService=o,this._optionsService=l,this._themeService=d,this._coreBrowserService=h,this._colorZoneStore=new GM,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(m=this._viewportElement.parentElement)==null||m.insertBefore(this._canvas,this._viewportElement),this._register(gt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let f=this._canvas.getContext("2d");if(f)this._ctx=f;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);er.full=this._canvas.width,er.left=e,er.center=t,er.right=e,this._refreshDrawHeightConstants(),ql.full=1,ql.left=1,ql.center=1+er.left,ql.right=1+er.left+er.center}_refreshDrawHeightConstants(){Oi.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Oi.left=t,Oi.center=t,Oi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Oi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Oi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Oi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Oi.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(ql[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Oi[e.position||"full"]/2),er[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Oi[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Xd=Nt([_e(2,xs),_e(3,Dc),_e(4,Nn),_e(5,Ss),_e(6,zo),_e(7,kn)],Xd);var ne;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
82
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ne||(ne={}));var Od;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Od||(Od={}));var J1;(e=>e.ST=`${ne.ESC}\\`)(J1||(J1={}));var x_=class{constructor(e,t,s,n,o,l){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=n,this._coreService=o,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ne.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};x_=Nt([_e(2,xs),_e(3,Ss),_e(4,ya),_e(5,Nn)],x_);var Jt=0,es=0,ts=0,wt=0,N0={css:"#00000000",rgba:0},It;(e=>{function t(o,l,d,h){return h!==void 0?`#${Hr(o)}${Hr(l)}${Hr(d)}${Hr(h)}`:`#${Hr(o)}${Hr(l)}${Hr(d)}`}e.toCss=t;function s(o,l,d,h=255){return(o<<24|l<<16|d<<8|h)>>>0}e.toRgba=s;function n(o,l,d,h){return{css:e.toCss(o,l,d,h),rgba:e.toRgba(o,l,d,h)}}e.toColor=n})(It||(It={}));var pt;(e=>{function t(f,m){if(wt=(m.rgba&255)/255,wt===1)return{css:m.css,rgba:m.rgba};let g=m.rgba>>24&255,v=m.rgba>>16&255,y=m.rgba>>8&255,x=f.rgba>>24&255,S=f.rgba>>16&255,w=f.rgba>>8&255;Jt=x+Math.round((g-x)*wt),es=S+Math.round((v-S)*wt),ts=w+Math.round((y-w)*wt);let k=It.toCss(Jt,es,ts),E=It.toRgba(Jt,es,ts);return{css:k,rgba:E}}e.blend=t;function s(f){return(f.rgba&255)===255}e.isOpaque=s;function n(f,m,g){let v=Rd.ensureContrastRatio(f.rgba,m.rgba,g);if(v)return It.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=n;function o(f){let m=(f.rgba|255)>>>0;return[Jt,es,ts]=Rd.toChannels(m),{css:It.toCss(Jt,es,ts),rgba:m}}e.opaque=o;function l(f,m){return wt=Math.round(m*255),[Jt,es,ts]=Rd.toChannels(f.rgba),{css:It.toCss(Jt,es,ts,wt),rgba:It.toRgba(Jt,es,ts,wt)}}e.opacity=l;function d(f,m){return wt=f.rgba&255,l(f,wt*m/255)}e.multiplyOpacity=d;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=h})(pt||(pt={}));var yt;(e=>{let t,s;try{let o=document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function n(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Jt=parseInt(o.slice(1,2).repeat(2),16),es=parseInt(o.slice(2,3).repeat(2),16),ts=parseInt(o.slice(3,4).repeat(2),16),It.toColor(Jt,es,ts);case 5:return Jt=parseInt(o.slice(1,2).repeat(2),16),es=parseInt(o.slice(2,3).repeat(2),16),ts=parseInt(o.slice(3,4).repeat(2),16),wt=parseInt(o.slice(4,5).repeat(2),16),It.toColor(Jt,es,ts,wt);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let l=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Jt=parseInt(l[1]),es=parseInt(l[2]),ts=parseInt(l[3]),wt=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),It.toColor(Jt,es,ts,wt);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Jt,es,ts,wt]=t.getImageData(0,0,1,1).data,wt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:It.toRgba(Jt,es,ts,wt),css:o}}e.toColor=n})(yt||(yt={}));var vs;(e=>{function t(n){return s(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function s(n,o,l){let d=n/255,h=o/255,f=l/255,m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),v=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return m*.2126+g*.7152+v*.0722}e.relativeLuminance2=s})(vs||(vs={}));var Rd;(e=>{function t(d,h){if(wt=(h&255)/255,wt===1)return h;let f=h>>24&255,m=h>>16&255,g=h>>8&255,v=d>>24&255,y=d>>16&255,x=d>>8&255;return Jt=v+Math.round((f-v)*wt),es=y+Math.round((m-y)*wt),ts=x+Math.round((g-x)*wt),It.toRgba(Jt,es,ts)}e.blend=t;function s(d,h,f){let m=vs.relativeLuminance(d>>8),g=vs.relativeLuminance(h>>8);if(hn(m,g)<f){if(g<m){let x=n(d,h,f),S=hn(m,vs.relativeLuminance(x>>8));if(S<f){let w=o(d,h,f),k=hn(m,vs.relativeLuminance(w>>8));return S>k?x:w}return x}let v=o(d,h,f),y=hn(m,vs.relativeLuminance(v>>8));if(y<f){let x=n(d,h,f),S=hn(m,vs.relativeLuminance(x>>8));return y>S?v:x}return v}}e.ensureContrastRatio=s;function n(d,h,f){let m=d>>24&255,g=d>>16&255,v=d>>8&255,y=h>>24&255,x=h>>16&255,S=h>>8&255,w=hn(vs.relativeLuminance2(y,x,S),vs.relativeLuminance2(m,g,v));for(;w<f&&(y>0||x>0||S>0);)y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),S-=Math.max(0,Math.ceil(S*.1)),w=hn(vs.relativeLuminance2(y,x,S),vs.relativeLuminance2(m,g,v));return(y<<24|x<<16|S<<8|255)>>>0}e.reduceLuminance=n;function o(d,h,f){let m=d>>24&255,g=d>>16&255,v=d>>8&255,y=h>>24&255,x=h>>16&255,S=h>>8&255,w=hn(vs.relativeLuminance2(y,x,S),vs.relativeLuminance2(m,g,v));for(;w<f&&(y<255||x<255||S<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=hn(vs.relativeLuminance2(y,x,S),vs.relativeLuminance2(m,g,v));return(y<<24|x<<16|S<<8|255)>>>0}e.increaseLuminance=o;function l(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=l})(Rd||(Rd={}));function Hr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function hn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var QM=class extends Rc{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Jd=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new pi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],n=t.translateToString(!0),o=0,l=0,d=0,h=t.getFg(0),f=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==f){if(m-o>1){let g=this._getJoinedRanges(n,d,l,t,o);for(let v=0;v<g.length;v++)s.push(g[v])}o=m,d=l,h=this._workCell.fg,f=this._workCell.bg}l+=this._workCell.getChars().length||gr.length}if(this._bufferService.cols-o>1){let m=this._getJoinedRanges(n,d,l,t,o);for(let g=0;g<m.length;g++)s.push(m[g])}return s}_getJoinedRanges(e,t,s,n,o){let l=e.substring(t,s),d=[];try{d=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let f=this._characterJoiners[h].handler(l);for(let m=0;m<f.length;m++)Jd._mergeRanges(d,f[m])}catch(f){console.error(f)}return this._stringRangesToCellRanges(d,n,o),d}_stringRangesToCellRanges(e,t,s){let n=0,o=!1,l=0,d=e[n];if(d){for(let h=s;h<this._bufferService.cols;h++){let f=t.getWidth(h),m=t.getString(h).length||gr.length;if(f!==0){if(!o&&d[0]<=l&&(d[0]=h,o=!0),d[1]<=l){if(d[1]=h,d=e[++n],!d)break;d[0]<=l?(d[0]=h,o=!0):o=!1}l+=m}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let n=0;n<e.length;n++){let o=e[n];if(s){if(t[1]<=o[0])return e[n-1][1]=t[1],e;if(t[1]<=o[1])return e[n-1][1]=Math.max(t[1],o[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=o[0])return e.splice(n,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};Jd=Nt([_e(0,xs)],Jd);function ZM(e){return 57508<=e&&e<=57558}function XM(e){return 9472<=e&&e<=9631}function JM(e){return ZM(e)||XM(e)}function eL(){return{css:{canvas:fd(),cell:fd()},device:{canvas:fd(),cell:fd(),char:{width:0,height:0,left:0,top:0}}}}function fd(){return{width:0,height:0}}var S_=class{constructor(e,t,s,n,o,l,d){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=n,this._coreService=o,this._decorationService=l,this._themeService=d,this._workCell=new pi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,n,o,l,d,h,f,m,g){let v=[],y=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,S=e.getNoBgTrimmedLength();s&&S<l+1&&(S=l+1);let w,k=0,E="",D=0,A=0,N=0,z=0,V=!1,ee=0,$=!1,ae=0,me=0,H=[],B=m!==-1&&g!==-1;for(let O=0;O<S;O++){e.loadCell(O,this._workCell);let se=this._workCell.getWidth();if(se===0)continue;let re=!1,q=O>=me,M=O,K=this._workCell;if(y.length>0&&O===y[0][0]&&q){let et=y.shift(),vi=this._isCellInSelection(et[0],t);for(D=et[0]+1;D<et[1];D++)q&&(q=vi===this._isCellInSelection(D,t));q&&(q=!s||l<et[0]||l>=et[1]),q?(re=!0,K=new QM(this._workCell,e.translateToString(!0,et[0],et[1]),et[1]-et[0]),M=et[1]-1,se=K.getWidth()):me=et[1]}let fe=this._isCellInSelection(O,t),Ae=s&&O===l,L=B&&O>=m&&O<=g,X=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,et=>{X=!0});let ce=K.getChars()||gr;if(ce===" "&&(K.isUnderline()||K.isOverline())&&(ce=" "),ae=se*h-f.get(ce,K.isBold(),K.isItalic()),!w)w=this._document.createElement("span");else if(k&&(fe&&$||!fe&&!$&&K.bg===A)&&(fe&&$&&x.selectionForeground||K.fg===N)&&K.extended.ext===z&&L===V&&ae===ee&&!Ae&&!re&&!X&&q){K.isInvisible()?E+=gr:E+=ce,k++;continue}else k&&(w.textContent=E),w=this._document.createElement("span"),k=0,E="";if(A=K.bg,N=K.fg,z=K.extended.ext,V=L,ee=ae,$=fe,re&&l>=O&&l<=M&&(l=O),!this._coreService.isCursorHidden&&Ae&&this._coreService.isCursorInitialized){if(H.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&H.push("xterm-cursor-blink"),H.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":H.push("xterm-cursor-outline");break;case"block":H.push("xterm-cursor-block");break;case"bar":H.push("xterm-cursor-bar");break;case"underline":H.push("xterm-cursor-underline");break}}if(K.isBold()&&H.push("xterm-bold"),K.isItalic()&&H.push("xterm-italic"),K.isDim()&&H.push("xterm-dim"),K.isInvisible()?E=gr:E=K.getChars()||gr,K.isUnderline()&&(H.push(`xterm-underline-${K.extended.underlineStyle}`),E===" "&&(E=" "),!K.isUnderlineColorDefault()))if(K.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${Rc.toColorRGB(K.getUnderlineColor()).join(",")})`;else{let et=K.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&K.isBold()&&et<8&&(et+=8),w.style.textDecorationColor=x.ansi[et].css}K.isOverline()&&(H.push("xterm-overline"),E===" "&&(E=" ")),K.isStrikethrough()&&H.push("xterm-strikethrough"),L&&(w.style.textDecoration="underline");let Y=K.getFgColor(),de=K.getFgColorMode(),xe=K.getBgColor(),ze=K.getBgColorMode(),Et=!!K.isInverse();if(Et){let et=Y;Y=xe,xe=et;let vi=de;de=ze,ze=vi}let Xe,Ls,ki=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,et=>{et.options.layer!=="top"&&ki||(et.backgroundColorRGB&&(ze=50331648,xe=et.backgroundColorRGB.rgba>>8&16777215,Xe=et.backgroundColorRGB),et.foregroundColorRGB&&(de=50331648,Y=et.foregroundColorRGB.rgba>>8&16777215,Ls=et.foregroundColorRGB),ki=et.options.layer==="top")}),!ki&&fe&&(Xe=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,xe=Xe.rgba>>8&16777215,ze=50331648,ki=!0,x.selectionForeground&&(de=50331648,Y=x.selectionForeground.rgba>>8&16777215,Ls=x.selectionForeground)),ki&&H.push("xterm-decoration-top");let Xs;switch(ze){case 16777216:case 33554432:Xs=x.ansi[xe],H.push(`xterm-bg-${xe}`);break;case 50331648:Xs=It.toColor(xe>>16,xe>>8&255,xe&255),this._addStyle(w,`background-color:#${E0((xe>>>0).toString(16),"0",6)}`);break;case 0:default:Et?(Xs=x.foreground,H.push("xterm-bg-257")):Xs=x.background}switch(Xe||K.isDim()&&(Xe=pt.multiplyOpacity(Xs,.5)),de){case 16777216:case 33554432:K.isBold()&&Y<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Y+=8),this._applyMinimumContrast(w,Xs,x.ansi[Y],K,Xe,void 0)||H.push(`xterm-fg-${Y}`);break;case 50331648:let et=It.toColor(Y>>16&255,Y>>8&255,Y&255);this._applyMinimumContrast(w,Xs,et,K,Xe,Ls)||this._addStyle(w,`color:#${E0(Y.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(w,Xs,x.foreground,K,Xe,Ls)||Et&&H.push("xterm-fg-257")}H.length&&(w.className=H.join(" "),H.length=0),!Ae&&!re&&!X&&q?k++:w.textContent=E,ae!==this.defaultSpacing&&(w.style.letterSpacing=`${ae}px`),v.push(w),O=M}return w&&k&&(w.textContent=E),v}_applyMinimumContrast(e,t,s,n,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||JM(n.getCode()))return!1;let d=this._getContrastCache(n),h;if(!o&&!l&&(h=d.getColor(t.rgba,s.rgba)),h===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);h=pt.ensureContrastRatio(o||t,l||s,f),d.setColor((o||t).rgba,(l||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,n=this._selectionEnd;return!s||!n?!1:this._columnSelectMode?s[0]<=n[0]?e>=s[0]&&t>=s[1]&&e<n[0]&&t<=n[1]:e<s[0]&&t>=s[1]&&e>=n[0]&&t<=n[1]:t>s[1]&&t<n[1]||s[1]===n[1]&&t===s[1]&&e>=s[0]&&e<n[0]||s[1]<n[1]&&t===n[1]&&e<n[0]||s[1]<n[1]&&t===s[1]&&e>=s[0]}};S_=Nt([_e(1,L1),_e(2,Ss),_e(3,kn),_e(4,ya),_e(5,Dc),_e(6,zo)],S_);function E0(e,t,s){for(;e.length<s;)e=t+e;return e}var tL=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[s,n,o,l],this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(o),this._container.appendChild(l),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,n){e===this._font&&t===this._fontSize&&s===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,s){let n=0;if(!t&&!s&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let d=this._measure(e,0);return d>0&&(this._flat[n]=d),d}let o=e;t&&(o+="B"),s&&(o+="I");let l=this._holey.get(o);if(l===void 0){let d=0;t&&(d|=1),s&&(d|=2),l=this._measure(e,d),l>0&&this._holey.set(o,l)}return l}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},sL=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,n=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let o=e.buffers.active.ydisp,l=t[1]-o,d=s[1]-o,h=Math.max(l,0),f=Math.min(d,e.rows-1);if(h>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=d,this.viewportCappedStartRow=h,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function iL(){return new sL}var ip="xterm-dom-renderer-owner-",ci="xterm-rows",md="xterm-fg-",T0="xterm-bg-",Pl="xterm-focus",pd="xterm-selection",nL=1,w_=class extends Ue{constructor(e,t,s,n,o,l,d,h,f,m,g,v,y,x){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=n,this._viewportElement=o,this._helperContainer=l,this._linkifier2=d,this._charSizeService=f,this._optionsService=m,this._bufferService=g,this._coreService=v,this._coreBrowserService=y,this._themeService=x,this._terminalClass=nL++,this._rowElements=[],this._selectionRenderModel=iL(),this.onRequestRedraw=this._register(new ue).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ci),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(pd),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=eL(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(S_,document),this._element.classList.add(ip+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(gt(()=>{this._element.classList.remove(ip+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new tL(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ci} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ci} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ci} .xterm-dim { color: ${pt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ci}.${Pl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ci}.${Pl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ci}.${Pl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ci} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ci} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ci} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ci} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ci} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${pd} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${pd} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${pd} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,d]of e.ansi.entries())t+=`${this._terminalSelector} .${md}${l} { color: ${d.css}; }${this._terminalSelector} .${md}${l}.xterm-dim { color: ${pt.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${T0}${l} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${md}257 { color: ${pt.opaque(e.background).css}; }${this._terminalSelector} .${md}257.xterm-dim { color: ${pt.multiplyOpacity(pt.opaque(e.background),.5).css}; }${this._terminalSelector} .${T0}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Pl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Pl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let f=e[0]>t[0];h.appendChild(this._createSelectionElement(l,f?t[0]:e[0],f?e[0]:t[0],d-l+1))}else{let f=n===l?e[0]:0,m=l===o?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,f,m));let g=d-l-1;if(h.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,g)),l!==d){let v=o===d?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(d,0,v))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,s,n=1){let o=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(s-t);return l+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-l),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}px`,o.style.width=`${d}px`,o}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,n=s.ybase+s.y,o=Math.min(s.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let m=f+s.ydisp,g=this._rowElements[f],v=s.lines.get(m);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,m,m===n,d,h,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ip}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,n,o,l){s<0&&(e=0),n<0&&(t=0);let d=this._bufferService.rows-1;s=Math.max(Math.min(s,d),0),n=Math.max(Math.min(n,d),0),o=Math.min(o,this._bufferService.cols);let h=this._bufferService.buffer,f=h.ybase+h.y,m=Math.min(h.x,o-1),g=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=s;x<=n;++x){let S=x+h.ydisp,w=this._rowElements[x],k=h.lines.get(S);if(!w||!k)break;w.replaceChildren(...this._rowFactory.createRow(k,S,S===f,v,y,m,g,this.dimensions.css.cell.width,this._widthCache,l?x===s?e:0:-1,l?(x===n?t:o)-1:-1))}}};w_=Nt([_e(7,Rg),_e(8,mh),_e(9,Ss),_e(10,xs),_e(11,ya),_e(12,kn),_e(13,zo)],w_);var j_=class extends Ue{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ue),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new aL(this._optionsService))}catch{this._measureStrategy=this._register(new rL(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};j_=Nt([_e(2,Ss)],j_);var eC=class extends Ue{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},rL=class extends eC{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},aL=class extends eC{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},oL=class extends Ue{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new lL(this._window)),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ue),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(us.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Oe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Oe(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},lL=class extends Ue{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ro),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(gt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Oe(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},cL=class extends Ue{constructor(){super(),this.linkProviders=[],this._register(gt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Ig(e,t,s){let n=s.getBoundingClientRect(),o=e.getComputedStyle(s),l=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-n.left-l,t.clientY-n.top-d]}function uL(e,t,s,n,o,l,d,h,f){if(!l)return;let m=Ig(e,t,s);if(m)return m[0]=Math.ceil((m[0]+(f?d/2:0))/d),m[1]=Math.ceil(m[1]/h),m[0]=Math.min(Math.max(m[0],1),n+(f?1:0)),m[1]=Math.min(Math.max(m[1],1),o),m}var C_=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,n,o){return uL(window,e,t,s,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let s=Ig(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};C_=Nt([_e(0,Nn),_e(1,mh)],C_);var dL=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},tC={};xD(tC,{getSafariVersion:()=>fL,isChromeOS:()=>rC,isFirefox:()=>sC,isIpad:()=>mL,isIphone:()=>pL,isLegacyEdge:()=>hL,isLinux:()=>Hg,isMac:()=>eh,isNode:()=>ph,isSafari:()=>iC,isWindows:()=>nC});var ph=typeof process<"u"&&"title"in process,Mc=ph?"node":navigator.userAgent,Lc=ph?"node":navigator.platform,sC=Mc.includes("Firefox"),hL=Mc.includes("Edge"),iC=/^((?!chrome|android).)*safari/i.test(Mc);function fL(){if(!iC)return 0;let e=Mc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var eh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Lc),mL=Lc==="iPad",pL=Lc==="iPhone",nC=["Windows","Win16","Win32","WinCE"].includes(Lc),Hg=Lc.indexOf("Linux")>=0,rC=/\bCrOS\b/.test(Mc),aC=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,s=0,n=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),o=e.timeRemaining(),s*1.5>o){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=o}this.clear()}},_L=class extends aC{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},gL=class extends aC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},th=!ph&&"requestIdleCallback"in window?gL:_L,vL=class{constructor(){this._queue=new th}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},k_=class extends Ue{constructor(e,t,s,n,o,l,d,h,f){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=n,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new Ro),this._pausedResizeTask=new vL,this._observerDisposable=this._register(new Ro),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new ue),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ue),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ue),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new dL((m,g)=>this._renderRows(m,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new yL(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(gt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>{var m;return(m=this._renderer.value)==null?void 0:m.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=gt(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var s;return(s=this._renderer.value)==null?void 0:s.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,s){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};k_=Nt([_e(2,Ss),_e(3,mh),_e(4,ya),_e(5,Dc),_e(6,xs),_e(7,kn),_e(8,zo)],k_);var yL=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function bL(e,t,s,n){let o=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return wL(o,l,e,t,s,n)+_h(l,t,s,n)+jL(o,l,e,t,s,n);let d;if(l===t)return d=o>e?"D":"C",fc(Math.abs(o-e),hc(d,n));d=l>t?"D":"C";let h=Math.abs(l-t),f=SL(l>t?e:o,s)+(h-1)*s.cols+1+xL(l>t?o:e);return fc(f,hc(d,n))}function xL(e,t){return e-1}function SL(e,t){return t.cols-e}function wL(e,t,s,n,o,l){return _h(t,n,o,l).length===0?"":fc(lC(e,t,e,t-ma(t,o),!1,o).length,hc("D",l))}function _h(e,t,s,n){let o=e-ma(e,s),l=t-ma(t,s),d=Math.abs(o-l)-CL(e,t,s);return fc(d,hc(oC(e,t),n))}function jL(e,t,s,n,o,l){let d;_h(t,n,o,l).length>0?d=n-ma(n,o):d=t;let h=n,f=kL(e,t,s,n,o,l);return fc(lC(e,d,s,h,f==="C",o).length,hc(f,l))}function CL(e,t,s){var d;let n=0,o=e-ma(e,s),l=t-ma(t,s);for(let h=0;h<Math.abs(o-l);h++){let f=oC(e,t)==="A"?-1:1;(d=s.buffer.lines.get(o+f*h))!=null&&d.isWrapped&&n++}return n}function ma(e,t){let s=0,n=t.buffer.lines.get(e),o=n==null?void 0:n.isWrapped;for(;o&&e>=0&&e<t.rows;)s++,n=t.buffer.lines.get(--e),o=n==null?void 0:n.isWrapped;return s}function kL(e,t,s,n,o,l){let d;return _h(s,n,o,l).length>0?d=n-ma(n,o):d=t,e<s&&d<=n||e>=s&&d<n?"C":"D"}function oC(e,t){return e>t?"A":"B"}function lC(e,t,s,n,o,l){let d=e,h=t,f="";for(;(d!==s||h!==n)&&h>=0&&h<l.buffer.lines.length;)d+=o?1:-1,o&&d>l.cols-1?(f+=l.buffer.translateBufferLineToString(h,!1,e,d),d=0,e=0,h++):!o&&d<0&&(f+=l.buffer.translateBufferLineToString(h,!1,0,e+1),d=l.cols-1,e=d,h--);return f+l.buffer.translateBufferLineToString(h,!1,e,d)}function hc(e,t){let s=t?"O":"[";return ne.ESC+s+e}function fc(e,t){e=Math.floor(e);let s="";for(let n=0;n<e;n++)s+=t;return s}var NL=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function A0(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var np=50,EL=15,TL=50,AL=500,OL=" ",RL=new RegExp(OL,"g"),N_=class extends Ue{constructor(e,t,s,n,o,l,d,h,f){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=n,this._coreService=o,this._mouseService=l,this._optionsService=d,this._renderService=h,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new pi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ue),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ue),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new NL(this._bufferService),this._activeSelectionMode=0,this._register(gt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let h=s.translateBufferLineToString(d,!0,o,l);n.push(h)}}else{let o=e[1]===t[1]?t[0]:void 0;n.push(s.translateBufferLineToString(e[1],!0,e[0],o));for(let l=e[1]+1;l<=t[1]-1;l++){let d=s.lines.get(l),h=s.translateBufferLineToString(l,!0);d!=null&&d.isWrapped?n[n.length-1]+=h:n.push(h)}if(e[1]!==t[1]){let l=s.lines.get(t[1]),d=s.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?n[n.length-1]+=d:n.push(d)}}return n.map(o=>o.replace(RL," ")).join(nC?`\r
|
|
83
|
+
`:`
|
|
84
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Hg&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!s||!n||!t?!1:this._areCoordsInSelection(t,s,n)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!s||!n?!1:this._areCoordsInSelection([e,t],s,n)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var o,l;let s=(l=(o=this._linkifier.currentLink)==null?void 0:o.link)==null?void 0:l.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=A0(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Ig(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-np),np),t/=np,t/Math.abs(t)+Math.round(t*(EL-1)))}shouldForceSelection(e){return eh?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),TL)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(eh&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let n=s.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<AL&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let n=bL(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let n=0;t>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:o>1&&t!==n&&(s+=o-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let d=o.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),f=h,m=e[0]-h,g=0,v=0,y=0,x=0;if(d.charAt(h)===" "){for(;h>0&&d.charAt(h-1)===" ";)h--;for(;f<d.length&&d.charAt(f+1)===" ";)f++}else{let k=e[0],E=e[0];l.getWidth(k)===0&&(g++,k--),l.getWidth(E)===2&&(v++,E++);let D=l.getString(E).length;for(D>1&&(x+=D-1,f+=D-1);k>0&&h>0&&!this._isCharWordSeparator(l.loadCell(k-1,this._workCell));){l.loadCell(k-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,k--):A>1&&(y+=A-1,h-=A-1),h--,k--}for(;E<l.length&&f+1<d.length&&!this._isCharWordSeparator(l.loadCell(E+1,this._workCell));){l.loadCell(E+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,E++):A>1&&(x+=A-1,f+=A-1),f++,E++}}f++;let S=h+m-g+y,w=Math.min(this._bufferService.cols,f-h+g+v-y-x);if(!(!t&&d.slice(h,f).trim()==="")){if(s&&S===0&&l.getCodePoint(0)!==32){let k=o.lines.get(e[1]-1);if(k&&l.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let E=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(E){let D=this._bufferService.cols-E.start;S-=D,w+=D}}}if(n&&S+w===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let k=o.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(w+=E.length)}}return{start:S,length:w}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=A0(s,this._bufferService.cols)}};N_=Nt([_e(3,xs),_e(4,ya),_e(5,Dg),_e(6,Ss),_e(7,Nn),_e(8,kn)],N_);var O0=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},R0=class{constructor(){this._color=new O0,this._css=new O0}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},$t=Object.freeze((()=>{let e=[yt.toColor("#2e3436"),yt.toColor("#cc0000"),yt.toColor("#4e9a06"),yt.toColor("#c4a000"),yt.toColor("#3465a4"),yt.toColor("#75507b"),yt.toColor("#06989a"),yt.toColor("#d3d7cf"),yt.toColor("#555753"),yt.toColor("#ef2929"),yt.toColor("#8ae234"),yt.toColor("#fce94f"),yt.toColor("#729fcf"),yt.toColor("#ad7fa8"),yt.toColor("#34e2e2"),yt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let n=t[s/36%6|0],o=t[s/6%6|0],l=t[s%6];e.push({css:It.toCss(n,o,l),rgba:It.toRgba(n,o,l)})}for(let s=0;s<24;s++){let n=8+s*10;e.push({css:It.toCss(n,n,n),rgba:It.toRgba(n,n,n)})}return e})()),Ur=yt.toColor("#ffffff"),Vl=yt.toColor("#000000"),D0=yt.toColor("#ffffff"),M0=Vl,Il={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},DL=Ur,E_=class extends Ue{constructor(e){super(),this._optionsService=e,this._contrastCache=new R0,this._halfContrastCache=new R0,this._onChangeColors=this._register(new ue),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ur,background:Vl,cursor:D0,cursorAccent:M0,selectionForeground:void 0,selectionBackgroundTransparent:Il,selectionBackgroundOpaque:pt.blend(Vl,Il),selectionInactiveBackgroundTransparent:Il,selectionInactiveBackgroundOpaque:pt.blend(Vl,Il),scrollbarSliderBackground:pt.opacity(Ur,.2),scrollbarSliderHoverBackground:pt.opacity(Ur,.4),scrollbarSliderActiveBackground:pt.opacity(Ur,.5),overviewRulerBorder:Ur,ansi:$t.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ut(e.foreground,Ur),t.background=ut(e.background,Vl),t.cursor=pt.blend(t.background,ut(e.cursor,D0)),t.cursorAccent=pt.blend(t.background,ut(e.cursorAccent,M0)),t.selectionBackgroundTransparent=ut(e.selectionBackground,Il),t.selectionBackgroundOpaque=pt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ut(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=pt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ut(e.selectionForeground,N0):void 0,t.selectionForeground===N0&&(t.selectionForeground=void 0),pt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=pt.opacity(t.selectionBackgroundTransparent,.3)),pt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=pt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ut(e.scrollbarSliderBackground,pt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ut(e.scrollbarSliderHoverBackground,pt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ut(e.scrollbarSliderActiveBackground,pt.opacity(t.foreground,.5)),t.overviewRulerBorder=ut(e.overviewRulerBorder,DL),t.ansi=$t.slice(),t.ansi[0]=ut(e.black,$t[0]),t.ansi[1]=ut(e.red,$t[1]),t.ansi[2]=ut(e.green,$t[2]),t.ansi[3]=ut(e.yellow,$t[3]),t.ansi[4]=ut(e.blue,$t[4]),t.ansi[5]=ut(e.magenta,$t[5]),t.ansi[6]=ut(e.cyan,$t[6]),t.ansi[7]=ut(e.white,$t[7]),t.ansi[8]=ut(e.brightBlack,$t[8]),t.ansi[9]=ut(e.brightRed,$t[9]),t.ansi[10]=ut(e.brightGreen,$t[10]),t.ansi[11]=ut(e.brightYellow,$t[11]),t.ansi[12]=ut(e.brightBlue,$t[12]),t.ansi[13]=ut(e.brightMagenta,$t[13]),t.ansi[14]=ut(e.brightCyan,$t[14]),t.ansi[15]=ut(e.brightWhite,$t[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<s;n++)t.ansi[n+16]=ut(e.extendedAnsi[n],$t[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};E_=Nt([_e(0,Ss)],E_);function ut(e,t){if(e!==void 0)try{return yt.toColor(e)}catch{}return t}var ML=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},LL=class{constructor(){this._services=new ML,this._services.set(Rg,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=ED(e).sort((l,d)=>l.index-d.index),n=[];for(let l of s){let d=this._services.get(l.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);n.push(d)}let o=s.length>0?s[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},BL={trace:0,debug:1,info:2,warn:3,error:4,off:5},zL="xterm.js: ",T_=class extends Ue{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=BL[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":zL)+t,...s)}trace(e,...t){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,t)}};T_=Nt([_e(0,Ss)],T_);var L0=class extends Ue{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ue),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ue),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ue),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+s.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<s.length;n++)this._array[this._getCyclicIndex(e+n)]=s[n];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let n=this._length+s.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let o=t-1;o>=0;o--)this.set(e+o+s,this.get(e+o));let n=e+t+s-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+s,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},He=3,qt=Object.freeze(new Rc),_d=0,rp=2,Yl=class cC{constructor(t,s,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*He);let o=s||pi.fromCharData([0,E1,1,0]);for(let l=0;l<t;++l)this.setCell(l,o);this.length=t}get(t){let s=this._data[t*He+0],n=s&2097151;return[this._data[t*He+1],s&2097152?this._combined[t]:n?rr(n):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,s){this._data[t*He+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*He+0]=t|2097152|s[2]<<22):this._data[t*He+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*He+0]>>22}hasWidth(t){return this._data[t*He+0]&12582912}getFg(t){return this._data[t*He+1]}getBg(t){return this._data[t*He+2]}hasContent(t){return this._data[t*He+0]&4194303}getCodePoint(t){let s=this._data[t*He+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*He+0]&2097152}getString(t){let s=this._data[t*He+0];return s&2097152?this._combined[t]:s&2097151?rr(s&2097151):""}isProtected(t){return this._data[t*He+2]&536870912}loadCell(t,s){return _d=t*He,s.content=this._data[_d+0],s.fg=this._data[_d+1],s.bg=this._data[_d+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*He+0]=s.content,this._data[t*He+1]=s.fg,this._data[t*He+2]=s.bg}setCellFromCodepoint(t,s,n,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*He+0]=s|n<<22,this._data[t*He+1]=o.fg,this._data[t*He+2]=o.bg}addCodepointToCell(t,s,n){let o=this._data[t*He+0];o&2097152?this._combined[t]+=rr(s):o&2097151?(this._combined[t]=rr(o&2097151)+rr(s),o&=-2097152,o|=2097152):o=s|1<<22,n&&(o&=-12582913,o|=n<<22),this._data[t*He+0]=o}insertCells(t,s,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length-t){let o=new pi;for(let l=this.length-t-s-1;l>=0;--l)this.setCell(t+s+l,this.loadCell(t+l,o));for(let l=0;l<s;++l)this.setCell(t+l,n)}else for(let o=t;o<this.length;++o)this.setCell(o,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,s,n){if(t%=this.length,s<this.length-t){let o=new pi;for(let l=0;l<this.length-t-s;++l)this.setCell(t+l,this.loadCell(t+s+l,o));for(let l=this.length-s;l<this.length;++l)this.setCell(l,n)}else for(let o=t;o<this.length;++o)this.setCell(o,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,s,n,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,n);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,n);t<s&&t<this.length;)this.setCell(t++,n)}resize(t,s){if(t===this.length)return this._data.length*4*rp<this._data.buffer.byteLength;let n=t*He;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let o=new Uint32Array(n);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,s)}else{this._data=this._data.subarray(0,n);let o=Object.keys(this._combined);for(let d=0;d<o.length;d++){let h=parseInt(o[d],10);h>=t&&delete this._combined[h]}let l=Object.keys(this._extendedAttrs);for(let d=0;d<l.length;d++){let h=parseInt(l[d],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,n*4*rp<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*rp<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new cC(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303)return t+(this._data[t*He+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303||this._data[t*He+2]&50331648)return t+(this._data[t*He+0]>>22);return 0}copyCellsFrom(t,s,n,o,l){let d=t._data;if(l)for(let f=o-1;f>=0;f--){for(let m=0;m<He;m++)this._data[(n+f)*He+m]=d[(s+f)*He+m];d[(s+f)*He+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}else for(let f=0;f<o;f++){for(let m=0;m<He;m++)this._data[(n+f)*He+m]=d[(s+f)*He+m];d[(s+f)*He+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}let h=Object.keys(t._combined);for(let f=0;f<h.length;f++){let m=parseInt(h[f],10);m>=s&&(this._combined[m-s+n]=t._combined[m])}}translateToString(t,s,n,o){s=s??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),o&&(o.length=0);let l="";for(;s<n;){let d=this._data[s*He+0],h=d&2097151,f=d&2097152?this._combined[s]:h?rr(h):gr;if(l+=f,o)for(let m=0;m<f.length;++m)o.push(s);s+=d>>22||1}return o&&o.push(s),l}};function qL(e,t,s,n,o,l){let d=[];for(let h=0;h<e.length-1;h++){let f=h,m=e.get(++f);if(!m.isWrapped)continue;let g=[e.get(h)];for(;f<e.length&&m.isWrapped;)g.push(m),m=e.get(++f);if(!l&&n>=h&&n<f){h+=g.length-1;continue}let v=0,y=mc(g,v,t),x=1,S=0;for(;x<g.length;){let k=mc(g,x,t),E=k-S,D=s-y,A=Math.min(E,D);g[v].copyCellsFrom(g[x],S,y,A,!1),y+=A,y===s&&(v++,y=0),S+=A,S===k&&(x++,S=0),y===0&&v!==0&&g[v-1].getWidth(s-1)===2&&(g[v].copyCellsFrom(g[v-1],s-1,y++,1,!1),g[v-1].setCell(s-1,o))}g[v].replaceCells(y,s,o);let w=0;for(let k=g.length-1;k>0&&(k>v||g[k].getTrimmedLength()===0);k--)w++;w>0&&(d.push(h+g.length-w),d.push(w)),h+=g.length-1}return d}function PL(e,t){let s=[],n=0,o=t[n],l=0;for(let d=0;d<e.length;d++)if(o===d){let h=t[++n];e.onDeleteEmitter.fire({index:d-l,amount:h}),d+=h-1,l+=h,o=t[++n]}else s.push(d);return{layout:s,countRemoved:l}}function IL(e,t){let s=[];for(let n=0;n<t.length;n++)s.push(e.get(t[n]));for(let n=0;n<s.length;n++)e.set(n,s[n]);e.length=t.length}function HL(e,t,s){let n=[],o=e.map((f,m)=>mc(e,m,t)).reduce((f,m)=>f+m),l=0,d=0,h=0;for(;h<o;){if(o-h<s){n.push(o-h);break}l+=s;let f=mc(e,d,t);l>f&&(l-=f,d++);let m=e[d].getWidth(l-1)===2;m&&l--;let g=m?s-1:s;n.push(g),h+=g}return n}function mc(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,o=e[t+1].getWidth(0)===2;return n&&o?s-1:s}var uC=class dC{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=dC._nextId++,this._onDispose=this.register(new ue),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),fa(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};uC._nextId=1;var FL=uC,Vt={},$r=Vt.B;Vt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Vt.A={"#":"£"};Vt.B=void 0;Vt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Vt.C=Vt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Vt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Vt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Vt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Vt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Vt.E=Vt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Vt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Vt.H=Vt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Vt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var B0=4294967295,z0=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=qt.clone(),this.savedCharset=$r,this.markers=[],this._nullCell=pi.fromCharData([0,E1,1,0]),this._whitespaceCell=pi.fromCharData([0,gr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new th,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new L0(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Zd),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Zd),this._whitespaceCell}getBlankLine(e,t){return new Yl(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>B0?B0:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=qt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new L0(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(qt),n=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)n+=+this.lines.get(d).resize(e,s);let l=0;if(this._rows<t)for(let d=this._rows;d<t;d++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Yl(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Yl(e,s)));else for(let d=this._rows;d>t;d--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let d=this.lines.length-o;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let l=0;l<this.lines.length;l++)n+=+this.lines.get(l).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,n=qL(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(qt),s);if(n.length>0){let o=PL(this.lines,n);IL(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let n=this.getNullCell(qt),o=s;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Yl(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(qt),o=[],l=0;for(let d=this.lines.length-1;d>=0;d--){let h=this.lines.get(d);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let f=[h];for(;h.isWrapped&&d>0;)h=this.lines.get(--d),f.unshift(h);if(!s){let A=this.ybase+this.y;if(A>=d&&A<d+f.length)continue}let m=f[f.length-1].getTrimmedLength(),g=HL(f,this._cols,e),v=g.length-f.length,y;this.ybase===0&&this.y!==this.lines.length-1?y=Math.max(0,this.y-this.lines.maxLength+v):y=Math.max(0,this.lines.length-this.lines.maxLength+v);let x=[];for(let A=0;A<v;A++){let N=this.getBlankLine(qt,!0);x.push(N)}x.length>0&&(o.push({start:d+f.length+l,newLines:x}),l+=x.length),f.push(...x);let S=g.length-1,w=g[S];w===0&&(S--,w=g[S]);let k=f.length-v-1,E=m;for(;k>=0;){let A=Math.min(E,w);if(f[S]===void 0)break;if(f[S].copyCellsFrom(f[k],E-A,w-A,A,!0),w-=A,w===0&&(S--,w=g[S]),E-=A,E===0){k--;let N=Math.max(k,0);E=mc(f,N,this._cols)}}for(let A=0;A<f.length;A++)g[A]<e&&f[A].setCell(g[A],n);let D=v-y;for(;D-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+t-1)}if(o.length>0){let d=[],h=[];for(let w=0;w<this.lines.length;w++)h.push(this.lines.get(w));let f=this.lines.length,m=f-1,g=0,v=o[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let y=0;for(let w=Math.min(this.lines.maxLength-1,f+l-1);w>=0;w--)if(v&&v.start>m+y){for(let k=v.newLines.length-1;k>=0;k--)this.lines.set(w--,v.newLines[k]);w++,d.push({index:m+1,amount:v.newLines.length}),y+=v.newLines.length,v=o[++g]}else this.lines.set(w,h[m--]);let x=0;for(let w=d.length-1;w>=0;w--)d[w].index+=x,this.lines.onInsertEmitter.fire(d[w]),x+=d[w].amount;let S=Math.max(0,f+l-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,s=0,n){let o=this.lines.get(e);return o?o.translateToString(t,s,n):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new FL(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},UL=class extends Ue{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ue),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new z0(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new z0(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},hC=2,fC=1,A_=class extends Ue{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,hC),this.rows=Math.max(e.rawOptions.rows||0,fC),this.buffers=this._register(new UL(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=s.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let o=s.ybase+s.scrollTop,l=s.ybase+s.scrollBottom;if(s.scrollTop===0){let d=s.lines.isFull;l===s.lines.length-1?d?s.lines.recycle().copyFrom(n):s.lines.push(n.clone()):s.lines.splice(l+1,0,n.clone()),d?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let d=l-o+1;s.lines.shiftElements(o+1,d-1,-1),s.lines.set(l,n.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let n=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),n!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};A_=Nt([_e(0,Ss)],A_);var oo={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:eh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},$L=["normal","bold","100","200","300","400","500","600","700","800","900"],KL=class extends Ue{constructor(e){super(),this._onOptionChange=this._register(new ue),this.onOptionChange=this._onOptionChange.event;let t={...oo};for(let s in e)if(s in t)try{let n=e[s];t[s]=this._sanitizeAndValidateOption(s,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(gt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in oo))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,n)=>{if(!(s in oo))throw new Error(`No option with key "${s}"`);n=this._sanitizeAndValidateOption(s,n),this.rawOptions[s]!==n&&(this.rawOptions[s]=n,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let n={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=oo[e]),!WL(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=oo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=$L.includes(t)?t:oo[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function WL(e){return e==="block"||e==="underline"||e==="bar"}function Gl(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let n in e)s[n]=t<=1?e[n]:e[n]&&Gl(e[n],t-1);return s}var q0=Object.freeze({insertMode:!1}),P0=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),O_=class extends Ue{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ue),this.onData=this._onData.event,this._onUserInput=this._register(new ue),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ue),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Gl(q0),this.decPrivateModes=Gl(P0)}reset(){this.modes=Gl(q0),this.decPrivateModes=Gl(P0)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};O_=Nt([_e(0,xs),_e(1,D1),_e(2,Ss)],O_);var I0={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function ap(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var op=String.fromCharCode,H0={DEFAULT:e=>{let t=[ap(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${op(t[0])}${op(t[1])}${op(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ap(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ap(e,!0)};${e.x};${e.y}${t}`}},R_=class extends Ue{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ue),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(I0))this.addProtocol(n,I0[n]);for(let n of Object.keys(H0))this.addEncoding(n,H0[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let n=t/s,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=n+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,s){if(s){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};R_=Nt([_e(0,xs),_e(1,ya),_e(2,Ss)],R_);var lp=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],VL=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Kt;function YL(e,t){let s=0,n=t.length-1,o;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=s;)if(o=s+n>>1,e>t[o][1])s=o+1;else if(e<t[o][0])n=o-1;else return!0;return!1}var GL=class{constructor(){if(this.version="6",!Kt){Kt=new Uint8Array(65536),Kt.fill(1),Kt[0]=0,Kt.fill(0,1,32),Kt.fill(0,127,160),Kt.fill(2,4352,4448),Kt[9001]=2,Kt[9002]=2,Kt.fill(2,11904,42192),Kt[12351]=1,Kt.fill(2,44032,55204),Kt.fill(2,63744,64256),Kt.fill(2,65040,65050),Kt.fill(2,65072,65136),Kt.fill(2,65280,65377),Kt.fill(2,65504,65511);for(let e=0;e<lp.length;++e)Kt.fill(0,lp[e][0],lp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Kt[e]:YL(e,VL)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),n=s===0&&t!==0;if(n){let o=Wr.extractWidth(t);o===0?n=!1:o>s&&(s=o)}return Wr.createPropertyValue(0,s,n)}},Wr=class Dd{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ue,this.onChange=this._onChange.event;let t=new GL;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,n=!1){return(t&16777215)<<3|(s&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,n=0,o=t.length;for(let l=0;l<o;++l){let d=t.charCodeAt(l);if(55296<=d&&d<=56319){if(++l>=o)return s+this.wcwidth(d);let m=t.charCodeAt(l);56320<=m&&m<=57343?d=(d-55296)*1024+m-56320+65536:s+=this.wcwidth(m)}let h=this.charProperties(d,n),f=Dd.extractWidth(h);Dd.extractShouldJoin(h)&&(f-=Dd.extractWidth(n)),s+=f,n=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},QL=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function F0(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var Hl=2147483647,ZL=256,mC=class D_{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>ZL)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new D_;if(!t.length)return s;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let o=t[n];if(Array.isArray(o))for(let l=0;l<o.length;++l)s.addSubParam(o[l]);else s.addParam(o)}return s}clone(){let t=new D_(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let n=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,o))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Hl?Hl:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Hl?Hl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-s>0?this._subParams.subarray(s,n):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let n=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-n>0&&(t[s]=this._subParams.slice(n,o))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,o=n[s-1];n[s-1]=~o?Math.min(o*10+t,Hl):t}},Fl=[],XL=class{constructor(){this._state=0,this._active=Fl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Fl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Fl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Fl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,s){if(!this._active.length)this._handlerFb(this._id,"PUT",fh(e,t,s));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&s-t>0&&this._put(e,t,s)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,n=this._active.length-1,o=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;n>=0&&(s=this._active[n].end(e),s!==!0);n--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,s;n--}for(;n>=0;n--)if(s=this._active[n].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,s}this._active=Fl,this._id=-1,this._state=0}}},Vs=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=fh(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},Ul=[],JL=class{constructor(){this._handlers=Object.create(null),this._active=Ul,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ul}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Ul,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ul,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",fh(e,t,s));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,n=this._active.length-1,o=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;n>=0&&(s=this._active[n].unhook(e),s!==!0);n--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,s;n--}for(;n>=0;n--)if(s=this._active[n].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,s}this._active=Ul,this._ident=0}},Ql=new mC;Ql.addParam(0);var U0=class{constructor(e){this._handler=e,this._data="",this._params=Ql,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ql,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=fh(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(s=>(this._params=Ql,this._data="",this._hitLimit=!1,s));return this._params=Ql,this._data="",this._hitLimit=!1,t}},e3=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,n){this.table[t<<8|e]=s<<4|n}addMany(e,t,s,n){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=s<<4|n}},hi=160,t3=(function(){let e=new e3(4095),t=Array.apply(null,Array(256)).map((h,f)=>f),s=(h,f)=>t.slice(h,f),n=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));let l=s(0,14),d;e.setDefault(1,0),e.addMany(n,0,2,0);for(d in l)e.addMany([24,26,153,154],d,3,0),e.addMany(s(128,144),d,3,0),e.addMany(s(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(hi,0,2,0),e.add(hi,8,5,8),e.add(hi,6,0,6),e.add(hi,11,0,11),e.add(hi,13,13,13),e})(),s3=class extends Ue{constructor(e=t3){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new mC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(gt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new XL),this._dcsParser=this._register(new JL),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let l=e.intermediates.charCodeAt(o);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=n,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let n=this._escHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let n=this._csiHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,n,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,t,s){let n=0,o=0,l=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&f>-1){for(;f>=0&&(d=h[f](this._params),d!==!0);f--)if(d instanceof Promise)return this._parseStack.handlerPos=f,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&f>-1){for(;f>=0&&(d=h[f](),d!==!0);f--)if(d instanceof Promise)return this._parseStack.handlerPos=f,d}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(n!==24&&n!==26,s),d)return d;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],d=this._oscParser.end(n!==24&&n!==26,s),d)return d;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=l;h<t;++h){switch(n=e[h],o=this._transitions.table[this.currentState<<8|(n<160?n:hi)],o>>4){case 2:for(let y=h+1;;++y){if(y>=t||(n=e[y])<32||n>126&&n<hi){this._printHandler(e,h,y),h=y-1;break}if(++y>=t||(n=e[y])<32||n>126&&n<hi){this._printHandler(e,h,y),h=y-1;break}if(++y>=t||(n=e[y])<32||n>126&&n<hi){this._printHandler(e,h,y),h=y-1;break}if(++y>=t||(n=e[y])<32||n>126&&n<hi){this._printHandler(e,h,y),h=y-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|n],m=f?f.length-1:-1;for(;m>=0&&(d=f[m](this._params),d!==!0);m--)if(d instanceof Promise)return this._preserveStack(3,f,m,o,h),d;m<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++h<t&&(n=e[h])>47&&n<60);h--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let g=this._escHandlers[this._collect<<8|n],v=g?g.length-1:-1;for(;v>=0&&(d=g[v](),d!==!0);v--)if(d instanceof Promise)return this._preserveStack(4,g,v,o,h),d;v<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let y=h+1;;++y)if(y>=t||(n=e[y])===24||n===26||n===27||n>127&&n<hi){this._dcsParser.put(e,h,y),h=y-1;break}break;case 14:if(d=this._dcsParser.unhook(n!==24&&n!==26),d)return this._preserveStack(6,[],0,o,h),d;n===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let y=h+1;;y++)if(y>=t||(n=e[y])<32||n>127&&n<hi){this._oscParser.put(e,h,y),h=y-1;break}break;case 6:if(d=this._oscParser.end(n!==24&&n!==26),d)return this._preserveStack(5,[],0,o,h),d;n===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},i3=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,n3=/^[\da-f]+$/;function $0(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=i3.exec(t);if(s){let n=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/n*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/n*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),n3.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,n=[0,0,0];for(let o=0;o<3;++o){let l=parseInt(t.slice(s*o,s*o+s),16);n[o]=s===1?l<<4:s===2?l:s===3?l>>4:l>>8}return n}}function cp(e,t){let s=e.toString(16),n=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function r3(e,t=16){let[s,n,o]=e;return`rgb:${cp(s,t)}/${cp(n,t)}/${cp(o,t)}`}var a3={"(":0,")":1,"*":2,"+":3,"-":1,".":2},tr=131072,K0=10;function W0(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var V0=5e3,Y0=0,o3=class extends Ue{constructor(e,t,s,n,o,l,d,h,f=new s3){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=n,this._optionsService=o,this._oscLinkService=l,this._coreMouseService=d,this._unicodeService=h,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new kD,this._utf8Decoder=new ND,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=qt.clone(),this._eraseAttrDataInternal=qt.clone(),this._onRequestBell=this._register(new ue),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ue),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ue),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ue),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ue),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ue),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ue),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ue),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ue),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new M_(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:g.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,g,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:g,data:v})}),this._parser.setDcsHandlerFallback((m,g,v)=>{g==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:g,payload:v})}),this._parser.setPrintHandler((m,g,v)=>this.print(m,g,v)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(ne.BEL,()=>this.bell()),this._parser.setExecuteHandler(ne.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ne.BS,()=>this.backspace()),this._parser.setExecuteHandler(ne.HT,()=>this.tab()),this._parser.setExecuteHandler(ne.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ne.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Od.IND,()=>this.index()),this._parser.setExecuteHandler(Od.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Od.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Vs(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new Vs(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new Vs(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new Vs(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new Vs(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new Vs(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new Vs(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new Vs(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new Vs(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new Vs(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new Vs(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new Vs(m=>this.restoreCursorColor(m))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let m in Vt)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new U0((m,g)=>this.requestStatusString(m,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),V0))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${V0} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,n=this._activeBuffer.x,o=this._activeBuffer.y,l=0,d=this._parseStack.paused;if(d){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;n=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>tr&&(l=this._parseStack.position+tr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<tr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,tr))),d||this._dirtyRowTracker.clearRange(),e.length>tr)for(let m=l;m<e.length;m+=tr){let g=m+tr<e.length?m+tr:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(m,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,g),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,v))return this._preserveStack(n,o,v,m),this._logSlowResolvingAsync(s),s}else if(!d){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,m))return this._preserveStack(n,o,m,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==n||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,s){let n,o,l=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,g=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let y=this._parser.precedingJoinState;for(let x=t;x<s;++x){if(n=e[x],n<127&&l){let E=l[String.fromCharCode(n)];E&&(n=E.charCodeAt(0))}let S=this._unicodeService.charProperties(n,y);o=Wr.extractWidth(S);let w=Wr.extractShouldJoin(S),k=w?Wr.extractWidth(y):0;if(y=S,d&&this._onA11yChar.fire(rr(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-k>h){if(f){let E=v,D=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&v instanceof Yl&&v.copyCellsFrom(E,D,0,k,!1);D<h;)E.setCellFromCodepoint(D++,0,1,g)}else if(this._activeBuffer.x=h-1,o===2)continue}if(w&&this._activeBuffer.x){let E=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-E,n,o);for(let D=o-k;--D>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(m&&(v.insertCells(this._activeBuffer.x,o-k,this._activeBuffer.getNullCell(g)),v.getWidth(h-1)===2&&v.setCellFromCodepoint(h-1,0,1,g)),v.setCellFromCodepoint(this._activeBuffer.x++,n,o,g),o>0)for(;--o;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=y,this._activeBuffer.x<h&&s-t>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>W0(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new U0(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Vs(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,s,n=!1,o=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),o),n&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s))!=null&&n.getTrimmedLength()););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let o=this._activeBuffer.lines.length-this._bufferService.rows;o>0&&(this._activeBuffer.lines.trimStart(o),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-o,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-o,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(qt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,n=Wr.extractWidth(t),o=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),d=new Uint32Array(l.length*s),h=0;for(let m=0;m<l.length;){let g=l.codePointAt(m)||0;d[h++]=g,m+=g>65535?2:1}let f=h;for(let m=1;m<s;++m)d.copyWithin(f,0,h),f+=h;return this.print(d,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ne.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ne.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ne.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ne.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ne.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,$r),this._charsetService.setgCharset(1,$r),this._charsetService.setgCharset(2,$r),this._charsetService.setgCharset(3,$r);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(s={}));let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,d=this._coreService,{buffers:h,cols:f}=this._bufferService,{active:m,alt:g}=h,v=this._optionsService.rawOptions,y=(w,k)=>(d.triggerDataEvent(`${ne.ESC}[${t?"":"?"}${w};${k}$y`),!0),x=w=>w?1:2,S=e.params[0];return t?S===2?y(S,4):S===4?y(S,x(d.modes.insertMode)):S===12?y(S,3):S===20?y(S,x(v.convertEol)):y(S,0):S===1?y(S,x(n.applicationCursorKeys)):S===3?y(S,v.windowOptions.setWinLines?f===80?2:f===132?1:0:0):S===6?y(S,x(n.origin)):S===7?y(S,x(n.wraparound)):S===8?y(S,3):S===9?y(S,x(o==="X10")):S===12?y(S,x(v.cursorBlink)):S===25?y(S,x(!d.isCursorHidden)):S===45?y(S,x(n.reverseWraparound)):S===66?y(S,x(n.applicationKeypad)):S===67?y(S,4):S===1e3?y(S,x(o==="VT200")):S===1002?y(S,x(o==="DRAG")):S===1003?y(S,x(o==="ANY")):S===1004?y(S,x(n.sendFocus)):S===1005?y(S,4):S===1006?y(S,x(l==="SGR")):S===1015?y(S,4):S===1016?y(S,x(l==="SGR_PIXELS")):S===1048?y(S,1):S===47||S===1047||S===1049?y(S,x(m===g)):S===2004?y(S,x(n.bracketedPasteMode)):S===2026?y(S,x(n.synchronizedOutput)):y(S,0)}_updateAttrColor(e,t,s,n,o){return t===2?(e|=50331648,e&=-16777216,e|=Rc.fromColorRGB([s,n,o])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let n=[0,0,-1,0,0,0],o=0,l=0;do{if(n[l+o]=e.params[t+l],e.hasSubParams(t+l)){let d=e.getSubParams(t+l),h=0;do n[1]===5&&(o=1),n[l+h+1+o]=d[h];while(++h<d.length&&h+l+1+o<n.length);break}if(n[1]===5&&l+o>=2||n[1]===2&&l+o>=5)break;n[1]&&(o=1)}while(++l+t<e.length&&l+o<n.length);for(let d=2;d<n.length;++d)n[d]===-1&&(n[d]=0);switch(n[0]){case 38:s.fg=this._updateAttrColor(s.fg,n[1],n[3],n[4],n[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,n[1],n[3],n[4],n[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,n[1],n[3],n[4],n[5])}return l}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=qt.fg,e.bg=qt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,s,n=this._curAttrData;for(let o=0;o<t;o++)s=e.params[o],s>=30&&s<=37?(n.fg&=-50331904,n.fg|=16777216|s-30):s>=40&&s<=47?(n.bg&=-50331904,n.bg|=16777216|s-40):s>=90&&s<=97?(n.fg&=-50331904,n.fg|=16777216|s-90|8):s>=100&&s<=107?(n.bg&=-50331904,n.bg|=16777216|s-100|8):s===0?this._processSGR0(n):s===1?n.fg|=134217728:s===3?n.bg|=67108864:s===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):s===5?n.fg|=536870912:s===7?n.fg|=67108864:s===8?n.fg|=1073741824:s===9?n.fg|=2147483648:s===2?n.bg|=134217728:s===21?this._processUnderline(2,n):s===22?(n.fg&=-134217729,n.bg&=-134217729):s===23?n.bg&=-67108865:s===24?(n.fg&=-268435457,this._processUnderline(0,n)):s===25?n.fg&=-536870913:s===27?n.fg&=-67108865:s===28?n.fg&=-1073741825:s===29?n.fg&=2147483647:s===39?(n.fg&=-67108864,n.fg|=qt.fg&16777215):s===49?(n.bg&=-67108864,n.bg|=qt.bg&16777215):s===38||s===48||s===58?o+=this._extractColor(e,o,n):s===53?n.bg|=1073741824:s===55?n.bg&=-1073741825:s===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):s===100?(n.fg&=-67108864,n.fg|=qt.fg&16777215,n.bg&=-67108864,n.bg|=qt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ne.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.ESC}[?${t};${s}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=qt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!W0(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ne.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>K0&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>K0&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],s=e.split(";");for(;s.length>1;){let n=s.shift(),o=s.shift();if(/^\d+$/.exec(n)){let l=parseInt(n);if(G0(l))if(o==="?")t.push({type:0,index:l});else{let d=$0(o);d&&t.push({type:1,index:l,color:d})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(s,n):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),n,o=s.findIndex(l=>l.startsWith("id="));return o!==-1&&(n=s[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let s=e.split(";");for(let n=0;n<s.length&&!(t>=this._specialColors.length);++n,++t)if(s[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=$0(s[n]);o&&this._onColor.fire([{type:1,index:this._specialColors[t],color:o}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],s=e.split(";");for(let n=0;n<s.length;++n)if(/^\d+$/.exec(s[n])){let o=parseInt(s[n]);G0(o)&&t.push({type:2,index:o})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,$r),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(a3[e[0]],Vt[e[1]]||$r),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=qt.clone(),this._eraseAttrDataInternal=qt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new pi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(s);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=d=>(this._coreService.triggerDataEvent(`${ne.ESC}${d}${ne.ESC}\\`),!0),n=this._bufferService.buffer,o=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},M_=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Y0=e,e=t,t=Y0),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};M_=Nt([_e(0,xs)],M_);function G0(e){return 0<=e&&e<256}var l3=5e7,Q0=12,c3=50,u3=class extends Ue{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>l3)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],o=this._action(n,t);if(o){let d=h=>performance.now()-s>=Q0?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);o.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(d);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-s>=Q0)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>c3&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},L_=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let h=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(f,h)),this._dataByLinkId.set(f.id,f),f.id}let s=e,n=this._getEntryIdKey(s),o=this._entriesWithId.get(n);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let l=t.addMarker(t.ybase+t.y),d={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(d,l)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);s.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(s,n))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};L_=Nt([_e(0,xs)],L_);var Z0=!1,d3=class extends Ue{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ro),this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onData=this._register(new ue),this.onData=this._onData.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ue),this._instantiationService=new LL,this.optionsService=this._register(new KL(e)),this._instantiationService.setService(Ss,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(A_)),this._instantiationService.setService(xs,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(T_)),this._instantiationService.setService(D1,this._logService),this.coreService=this._register(this._instantiationService.createInstance(O_)),this._instantiationService.setService(ya,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(R_)),this._instantiationService.setService(R1,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Wr)),this._instantiationService.setService(OD,this.unicodeService),this._charsetService=this._instantiationService.createInstance(QL),this._instantiationService.setService(AD,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(L_),this._instantiationService.setService(M1,this._oscLinkService),this._inputHandler=this._register(new o3(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(us.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(us.forward(this._bufferService.onResize,this._onResize)),this._register(us.forward(this.coreService.onData,this._onData)),this._register(us.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new u3((t,s)=>this._inputHandler.parse(t,s))),this._register(us.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ue),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Z0&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Z0=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,hC),t=Math.max(t,fC),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(F0.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(F0(this._bufferService),!1))),this._windowsWrappingHeuristics.value=gt(()=>{for(let t of e)t.dispose()})}}},h3={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function f3(e,t,s,n){var d;let o={type:0,cancel:!1,key:void 0},l=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?o.key=ne.ESC+"OA":o.key=ne.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ne.ESC+"OD":o.key=ne.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ne.ESC+"OC":o.key=ne.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ne.ESC+"OB":o.key=ne.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ne.DEL,e.altKey&&(o.key=ne.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ne.ESC+"[Z";break}o.key=ne.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ne.ESC+ne.CR:ne.CR,o.cancel=!0;break;case 27:o.key=ne.ESC,e.altKey&&(o.key=ne.ESC+ne.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=ne.ESC+"[1;"+(l+1)+"D":t?o.key=ne.ESC+"OD":o.key=ne.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=ne.ESC+"[1;"+(l+1)+"C":t?o.key=ne.ESC+"OC":o.key=ne.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=ne.ESC+"[1;"+(l+1)+"A":t?o.key=ne.ESC+"OA":o.key=ne.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=ne.ESC+"[1;"+(l+1)+"B":t?o.key=ne.ESC+"OB":o.key=ne.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ne.ESC+"[2~");break;case 46:l?o.key=ne.ESC+"[3;"+(l+1)+"~":o.key=ne.ESC+"[3~";break;case 36:l?o.key=ne.ESC+"[1;"+(l+1)+"H":t?o.key=ne.ESC+"OH":o.key=ne.ESC+"[H";break;case 35:l?o.key=ne.ESC+"[1;"+(l+1)+"F":t?o.key=ne.ESC+"OF":o.key=ne.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ne.ESC+"[5;"+(l+1)+"~":o.key=ne.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ne.ESC+"[6;"+(l+1)+"~":o.key=ne.ESC+"[6~";break;case 112:l?o.key=ne.ESC+"[1;"+(l+1)+"P":o.key=ne.ESC+"OP";break;case 113:l?o.key=ne.ESC+"[1;"+(l+1)+"Q":o.key=ne.ESC+"OQ";break;case 114:l?o.key=ne.ESC+"[1;"+(l+1)+"R":o.key=ne.ESC+"OR";break;case 115:l?o.key=ne.ESC+"[1;"+(l+1)+"S":o.key=ne.ESC+"OS";break;case 116:l?o.key=ne.ESC+"[15;"+(l+1)+"~":o.key=ne.ESC+"[15~";break;case 117:l?o.key=ne.ESC+"[17;"+(l+1)+"~":o.key=ne.ESC+"[17~";break;case 118:l?o.key=ne.ESC+"[18;"+(l+1)+"~":o.key=ne.ESC+"[18~";break;case 119:l?o.key=ne.ESC+"[19;"+(l+1)+"~":o.key=ne.ESC+"[19~";break;case 120:l?o.key=ne.ESC+"[20;"+(l+1)+"~":o.key=ne.ESC+"[20~";break;case 121:l?o.key=ne.ESC+"[21;"+(l+1)+"~":o.key=ne.ESC+"[21~";break;case 122:l?o.key=ne.ESC+"[23;"+(l+1)+"~":o.key=ne.ESC+"[23~";break;case 123:l?o.key=ne.ESC+"[24;"+(l+1)+"~":o.key=ne.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=ne.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ne.DEL:e.keyCode===219?o.key=ne.ESC:e.keyCode===220?o.key=ne.FS:e.keyCode===221&&(o.key=ne.GS);else if((!s||n)&&e.altKey&&!e.metaKey){let h=(d=h3[e.keyCode])==null?void 0:d[e.shiftKey?1:0];if(h)o.key=ne.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(f);e.shiftKey&&(m=m.toUpperCase()),o.key=ne.ESC+m}else if(e.keyCode===32)o.key=ne.ESC+(e.ctrlKey?ne.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),o.key=ne.ESC+f,o.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=ne.US),e.key==="@"&&(o.key=ne.NUL));break}return o}var Ot=0,m3=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new th,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new th,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((o,l)=>this._getKey(o)-this._getKey(l)),t=0,s=0,n=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<n.length;o++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(n[o]=e[t],t++):n[o]=this._array[s++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Ot=this._search(t),Ot===-1)||this._getKey(this._array[Ot])!==t)return!1;do if(this._array[Ot]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ot),!0;while(++Ot<this._array.length&&this._getKey(this._array[Ot])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,l)=>o-l),t=0,s=new Array(this._array.length-e.length),n=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:s[n++]=this._array[o];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ot=this._search(e),!(Ot<0||Ot>=this._array.length)&&this._getKey(this._array[Ot])===e))do yield this._array[Ot];while(++Ot<this._array.length&&this._getKey(this._array[Ot])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ot=this._search(e),!(Ot<0||Ot>=this._array.length)&&this._getKey(this._array[Ot])===e))do t(this._array[Ot]);while(++Ot<this._array.length&&this._getKey(this._array[Ot])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let n=t+s>>1,o=this._getKey(this._array[n]);if(o>e)s=n-1;else if(o<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},up=0,X0=0,p3=class extends Ue{constructor(){super(),this._decorations=new m3(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ue),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ue),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(gt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new _3(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,s){let n=0,o=0;for(let l of this._decorations.getKeyIterator(t))n=l.options.x??0,o=n+(l.options.width??1),e>=n&&e<o&&(!s||(l.options.layer??"bottom")===s)&&(yield l)}forEachDecorationAtCell(e,t,s,n){this._decorations.forEachByKey(t,o=>{up=o.options.x??0,X0=up+(o.options.width??1),e>=up&&e<X0&&(!s||(o.options.layer??"bottom")===s)&&n(o)})}},_3=class extends yr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ue),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ue),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=yt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=yt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},g3=1e3,v3=class{constructor(e,t=g3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=n-this._lastRefreshMs,l=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},J0=20,sh=class extends Ue{constructor(e,t,s,n){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new v3(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
85
|
+
`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Oe(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(gt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<J0+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
86
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===J0+1&&(this._liveRegion.textContent+=t_.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,n=s.lines.length.toString();for(let o=e;o<=t;o++){let l=s.lines.get(s.ydisp+o),d=[],h=(l==null?void 0:l.translateToString(!0,void 0,void 0,d))||"",f=(s.ydisp+o+1).toString(),m=this._rowElements[o];m&&(h.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=h,this._rowColumns.set(m,d)),m.setAttribute("aria-posinset",f),m.setAttribute("aria-setsize",n),this._alignRowWidth(m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],o=s.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let d,h;if(t===0?(d=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(d=this._rowElements.shift(),h=s,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var h;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:n,offset:((h=n.textContent)==null?void 0:h.length)??0}),!this._rowContainer.contains(s.node))return;let o=({node:f,offset:m})=>{let g=f instanceof Text?f.parentNode:f,v=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(v))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(g);if(!y)return console.warn("columns is null. Race condition?"),null;let x=m<y.length?y[m]:y.slice(-1)[0]+1;return x>=this._terminal.cols&&(++v,x=0),{row:v,column:x}},l=o(t),d=o(s);if(!(!l||!d)){if(l.row>d.row||l.row===d.row&&l.column>=d.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(d.row-l.row)*this._terminal.cols-l.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var o,l;e.style.transform="";let t=e.getBoundingClientRect().width,s=(l=(o=this._rowColumns.get(e))==null?void 0:o.slice(-1))==null?void 0:l[0];if(!s)return;let n=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};sh=Nt([_e(1,Rg),_e(2,kn),_e(3,Nn)],sh);var B_=class extends Ue{constructor(e,t,s,n,o){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=n,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ue),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ue),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(gt(()=>{var l;fa(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Oe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Oe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Oe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Oe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let n=0;n<s.length;n++){let o=s[n];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,o;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(l=>{l==null||l.forEach(d=>{d.link.dispose&&d.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[l,d]of this._linkProviderService.linkProviders.entries())t?(o=this._activeProviderReplies)!=null&&o.get(l)&&(s=this._checkLinkProviderResult(l,e,s)):d.provideLinks(e.y,h=>{var m,g;if(this._isMouseOut)return;let f=h==null?void 0:h.map(v=>({link:v}));(m=this._activeProviderReplies)==null||m.set(l,f),s=this._checkLinkProviderResult(l,e,s),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let n=0;n<t.size;n++){let o=t.get(n);if(o)for(let l=0;l<o.length;l++){let d=o[l],h=d.link.range.start.y<e?0:d.link.range.start.x,f=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let m=h;m<=f;m++){if(s.has(m)){o.splice(l--,1);break}s.add(m)}}}}_checkLinkProviderResult(e,t,s){var l;if(!this._activeProviderReplies)return s;let n=this._activeProviderReplies.get(e),o=!1;for(let d=0;d<e;d++)(!this._activeProviderReplies.has(d)||this._activeProviderReplies.get(d))&&(o=!0);if(!o&&n){let d=n.find(h=>this._linkAtPosition(h.link,t));d&&(s=!0,this._handleNewLink(d))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let d=0;d<this._activeProviderReplies.size;d++){let h=(l=this._activeProviderReplies.get(d))==null?void 0:l.find(f=>this._linkAtPosition(f.link,t));if(h){s=!0,this._handleNewLink(h);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&y3(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,fa(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var s,n;return(n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.pointerCursor},set:s=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,n;return(n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline},set:s=>{var n,o,l;(n=this._currentLink)!=null&&n.state&&((l=(o=this._currentLink)==null?void 0:o.state)==null?void 0:l.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let n=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(n,o),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,s){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,n=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-n-1,s.end.x,s.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,s){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return s<=o&&o<=n}_positionFromMouseEvent(e,t,s){let n=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,n,o){return{x1:e,y1:t,x2:s,y2:n,cols:this._bufferService.cols,fg:o}}};B_=Nt([_e(1,Dg),_e(2,Nn),_e(3,xs),_e(4,B1)],B_);function y3(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var b3=class extends d3{constructor(e={}){super(e),this._linkifier=this._register(new Ro),this.browser=tC,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ro),this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ue),this.onKey=this._onKey.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ue),this.onBell=this._onBell.event,this._onFocus=this._register(new ue),this._onBlur=this._register(new ue),this._onA11yCharEmitter=this._register(new ue),this._onA11yTabEmitter=this._register(new ue),this._onWillOpen=this._register(new ue),this._setup(),this._decorationService=this._instantiationService.createInstance(p3),this._instantiationService.setService(Dc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(cL),this._instantiationService.setService(B1,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(i_)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(us.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(us.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(us.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(us.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(gt(()=>{var t,s;this._customKeyEventHandler=void 0,(s=(t=this.element)==null?void 0:t.parentNode)==null||s.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let s,n="";switch(t.index){case 256:s="foreground",n="10";break;case 257:s="background",n="11";break;case 258:s="cursor",n="12";break;default:s="ansi",n="4;"+t.index}switch(t.type){case 0:let o=pt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${ne.ESC}]${n};${r3(o)}${J1.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=It.toColor(...t.color));else{let l=s;this._themeService.modifyColors(d=>d[l]=It.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(sh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let s=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,o=t.getWidth(s),l=this._renderService.dimensions.css.cell.width*o,d=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=d+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Oe(this.element,"copy",t=>{this.hasSelection()&&jD(t,this._selectionService)}));let e=t=>CD(t,this.textarea,this.coreService,this.optionsService);this._register(Oe(this.textarea,"paste",e)),this._register(Oe(this.element,"paste",e)),sC?this._register(Oe(this.element,"mousedown",t=>{t.button===2&&c0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Oe(this.element,"contextmenu",t=>{c0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Hg&&this._register(Oe(this.element,"auxclick",t=>{t.button===1&&N1(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Oe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Oe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Oe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Oe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Oe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Oe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Oe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var o;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((o=this.element)==null?void 0:o.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Oe(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",e_.get()),rC||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(oL,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(kn,this._coreBrowserService),this._register(Oe(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Oe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(j_,this._document,this._helperContainer),this._instantiationService.setService(mh,this._charSizeService),this._themeService=this._instantiationService.createInstance(E_),this._instantiationService.setService(zo,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Jd),this._instantiationService.setService(L1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(k_,this.rows,this.screenElement)),this._instantiationService.setService(Nn,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(x_,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(C_),this._instantiationService.setService(Dg,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(B_,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(y_,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(N_,this.element,this.screenElement,n)),this._instantiationService.setService(DD,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(us.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(b_,this.screenElement)),this._register(Oe(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(sh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Xd,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Xd,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(w_,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){var m,g,v,y,x;let d=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!d)return!1;let h,f;switch(l.overrideType||l.type){case"mousemove":f=32,l.buttons===void 0?(h=3,l.button!==void 0&&(h=l.button<3?l.button:3)):h=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":f=0,h=l.button<3?l.button:3;break;case"mousedown":f=1,h=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let S=l.deltaY;if(S===0||e.coreMouseService.consumeWheelEvent(l,(y=(v=(g=(m=e._renderService)==null?void 0:m.dimensions)==null?void 0:g.device)==null?void 0:v.cell)==null?void 0:y.height,(x=e._coreBrowserService)==null?void 0:x.dpr)===0)return!1;f=S<0?0:1,h=4;break;default:return!1}return f===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:h,action:f,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(s(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(s(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&s(l)},mousemove:l=>{l.buttons||s(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?n.mousemove||(t.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Oe(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return s(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(Oe(t,"wheel",l=>{var d,h,f,m,g;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(m=(f=(h=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:h.device)==null?void 0:f.cell)==null?void 0:m.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(l,!0);let v=ne.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(v,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){var s;(s=this._renderService)==null||s.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){k1(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,s){this._selectionService.setSelection(e,t,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var s;(s=this._selectionService)==null||s.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=f3(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let n=this.rows-1;return this.scrollLines(s.type===2?-n:n),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===ne.ETX||s.key===ne.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(x3(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var s;(s=this._charSizeService)==null||s.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(qt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ne.ESC+"[I"):this.coreService.triggerDataEvent(ne.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[4;${s};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ne.ESC}[6;${o};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function x3(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var S3=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},w3=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new pi)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},ew=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new w3(t)}getNullCell(){return new pi}},j3=class extends Ue{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ue),this.onBufferChange=this._onBufferChange.event,this._normal=new ew(this._core.buffers.normal,"normal"),this._alternate=new ew(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},C3=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,n)=>t(s,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},k3=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},N3=["cols","rows"],Ri=0,E3=class extends Ue{constructor(e){super(),this._core=this._register(new b3(e)),this._addonManager=this._register(new S3),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],s=(n,o)=>{this._checkReadonlyOptions(n),this._core.options[n]=o};for(let n in this._core.options){let o={get:t.bind(this,n),set:s.bind(this,n)};Object.defineProperty(this._publicOptions,n,o)}}_checkReadonlyOptions(e){if(N3.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new C3(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new k3(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new j3(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
87
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return e_.get()},set promptLabel(e){e_.set(e)},get tooMuchOutput(){return t_.get()},set tooMuchOutput(e){t_.set(e)}}}_verifyIntegers(...e){for(Ri of e)if(Ri===1/0||isNaN(Ri)||Ri%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ri of e)if(Ri&&(Ri===1/0||isNaN(Ri)||Ri%1!==0||Ri<0))throw new Error("This API only accepts positive integers")}};const T3=1;function A3(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${YR}?${GR}=${encodeURIComponent(e)}`}function pC(e,t,s={}){const{createWebSocket:n=h=>new WebSocket(h),origin:o=window.location}=s,l=n(A3(e,o));let d=[];return l.onopen=()=>{const h=d;d=[];for(const f of h)l.send(a0(f))},l.onmessage=h=>{var m;const f=eD(String(h.data));f.ok?t.onMessage(f.message):(m=t.onDecodeError)==null||m.call(t,f.error)},l.onclose=h=>{var f;d=[],(f=t.onClose)==null||f.call(t,{code:h.code,clean:h.wasClean})},l.onerror=()=>{},{send(h){l.readyState===T3?l.send(a0(h)):d.push(h)},close(){l.onmessage=null,l.onclose=null,l.onopen=null,d=[],l.close()}}}const Fe={brand:{300:"#FDB9A4",500:"#F54E00",900:"#551500",950:"#3B0C00"},accent:{400:"#ABBE55"},agent:{400:"#C69CF5",900:"#3C1B59"},neutral:{50:"#F8F8F5",300:"#CDCBC3",400:"#B4B3A9",500:"#939287",600:"#75746A",900:"#2F2F2A",925:"#27261F",960:"#1A1912",980:"#11100A",1010:"#050502"},success:{300:"#8AE1BB",400:"#52CD9D",500:"#00AC7B"},warning:{300:"#F9BF76",500:"#C58111"},danger:{300:"#FEB4BC",400:"#FE8B9A",500:"#EE5271"},info:{200:"#CAE1FF",300:"#A9CEFF",400:"#7DB5FF",500:"#4F93E9"}},zt={"bg/surface":Fe.neutral[980],"bg/inset":Fe.neutral[1010],"bg/active":Fe.neutral[925],"bg/brand":Fe.brand[500],"bg/brand-subtle":Fe.brand[950],"bg/brand-muted":Fe.brand[900],"text/primary":Fe.neutral[50],"text/code":Fe.neutral[300],"border/subtle":Fe.neutral[960],"git/added":Fe.success[400],"git/removed":Fe.danger[400],"syntax/keyword":Fe.agent[400],"syntax/string":Fe.accent[400],"syntax/number":Fe.warning[300],"syntax/comment":Fe.neutral[600],"syntax/function":Fe.info[400],"syntax/type":Fe.success[300],"syntax/punctuation":Fe.neutral[400],"editor/cursor":Fe.agent[400],"editor/selection":Fe.agent[900],"editor/active-line":Fe.neutral[980],"editor/line-number":Fe.neutral[500],"editor/line-number-active":Fe.neutral[300]},WP={2:2,8:8,10:10,12:12},VP={"gutter/line":44},O3={background:zt["bg/inset"],foreground:zt["text/primary"],cursor:zt["text/primary"],cursorAccent:zt["bg/inset"],selectionBackground:`${zt["bg/brand"]}55`,selectionInactiveBackground:`${zt["bg/active"]}88`,black:Fe.neutral[900],red:Fe.danger[500],green:Fe.success[500],yellow:Fe.warning[500],blue:Fe.info[500],magenta:Fe.brand[500],cyan:Fe.info[400],white:Fe.neutral[300],brightBlack:Fe.neutral[600],brightRed:Fe.danger[300],brightGreen:Fe.success[300],brightYellow:Fe.warning[300],brightBlue:Fe.info[300],brightMagenta:Fe.brand[300],brightCyan:Fe.info[200],brightWhite:Fe.neutral[50]},R3=['"JetBrainsMono Nerd Font"','"MesloLGS NF"','"FiraCode Nerd Font"','"Hack Nerd Font"','"JetBrains Mono"',"ui-monospace","SFMono-Regular","Menlo","monospace"].join(", "),D3=13,M3=20/13;function gh({sessionId:e,connect:t=pC,readOnly:s=!1,onReady:n,onMessage:o}){const l=j.useRef(null),d=j.useRef(null),h=j.useRef(s);h.current=s;const f=j.useRef(n),m=j.useRef(o);return f.current=n,m.current=o,j.useEffect(()=>{var D;const g=l.current;if(!g)return;const v=new E3({convertEol:!1,cursorBlink:!h.current,disableStdin:h.current,scrollback:1e4,theme:O3,fontFamily:R3,fontSize:D3,lineHeight:M3}),y=new yD;v.loadAddon(y),v.open(g),d.current=v,dp(y),h.current||v.focus();const x=t(e,{onMessage(A){var N;A.type==="attached"?(dp(y),v.reset(),v.write(A.snapshot)):A.type==="output"&&v.write(A.data),(N=m.current)==null||N.call(m,A)}}),S=v.onData(A=>{h.current||x.send({type:"input",data:A})}),w=v.onResize(({cols:A,rows:N})=>x.send({type:"resize",cols:A,rows:N})),k=()=>dp(y);window.addEventListener("resize",k);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(k);return E==null||E.observe(g),(D=f.current)==null||D.call(f,v),()=>{E==null||E.disconnect(),window.removeEventListener("resize",k),S.dispose(),w.dispose(),x.close(),v.dispose(),d.current=null}},[e,t]),j.useEffect(()=>{var v;const g=d.current;g!==null&&(g.options.disableStdin=s,g.options.cursorBlink=!s,s&&((v=l.current)!=null&&v.contains(document.activeElement))&&g.blur())},[s]),a.jsx("div",{className:"terminal","data-testid":"terminal","data-readonly":s?"true":void 0,ref:l})}function dp(e){try{e.fit()}catch{}}function Bc(){const[e,t]=j.useState(!1),s=j.useRef(null),n=j.useRef(null),o=j.useCallback(()=>{t(d=>{var h;return d&&((h=s.current)==null||h.focus()),!1})},[]),l=j.useCallback(()=>t(d=>!d),[]);return j.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&o()},h=f=>{var g,v;const m=f.target;((g=n.current)==null?void 0:g.contains(m))!==!0&&((v=s.current)==null?void 0:v.contains(m))!==!0&&t(!1)};return document.addEventListener("keydown",d),document.addEventListener("pointerdown",h),()=>{document.removeEventListener("keydown",d),document.removeEventListener("pointerdown",h)}},[e,o]),{open:e,toggle:l,close:o,triggerRef:s,panelRef:n}}function _C(e,t="worktree"){return be({queryKey:J2(e.scopeType,e.scopeId,t),queryFn:()=>Q.changes.list.query({scopeType:e.scopeType,scopeId:e.scopeId,ref:t}),refetchOnWindowFocus:!0})}function gC(e){switch(e){case"added":return"A";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}}function vC(e){switch(e){case"added":return"a";case"deleted":return"d";case"untracked":return"u";default:return"m"}}const L3=15e3,z_=6e4;function B3(e){var t;return e.visible?e.status&&(((t=e.status.pull)==null?void 0:t.counts.running)??0)>0?L3:z_:!1}function yC(){const[e,t]=j.useState(()=>typeof document>"u"||!document.hidden);return j.useEffect(()=>{if(typeof document>"u")return;const s=()=>t(!document.hidden);return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[]),e}function z3(e,{panelOpen:t}){const s=yC();return be({queryKey:hT(e??"-"),queryFn:()=>Q.pr.getByWorktree.query({worktreeId:e}),enabled:e!==null,refetchInterval:n=>B3({visible:s,status:n.state.data}),placeholderData:n=>n})}function q3(e){const t=yC();return be({queryKey:fT(e??"-"),queryFn:()=>Q.pr.listByProject.query({projectId:e}),enabled:e!==null,refetchInterval:()=>t?z_:!1,placeholderData:s=>s})}function P3(e){return be({queryKey:mT(e??"-"),queryFn:()=>Q.pr.draft.query({worktreeId:e}),enabled:e!==null,staleTime:Number.POSITIVE_INFINITY})}function bC(){const e=$e(),t=async()=>{await e.invalidateQueries({queryKey:zd}),await e.invalidateQueries({queryKey:Aj}),await e.invalidateQueries({queryKey:Nc})},s=Se({mutationFn:o=>Q.pr.merge.mutate(o),onSuccess:t}),n=Se({mutationFn:o=>Q.pr.create.mutate(o),onSuccess:t});return{merge:s,create:n}}function I3(e){const t=$e();return Se({mutationFn:async()=>{await Q.pr.refresh.mutate(e)},onSettled:async()=>{await t.cancelQueries({queryKey:zd}),await t.refetchQueries({queryKey:zd})}})}const xC="lumem.pr.dismissed";function H3(e){const[t,s]=j.useState(()=>F3());return{isDismissed:e!==null&&t.includes(e),dismiss:()=>{if(e===null)return;const n=[...new Set([...t,e])];s(n);try{localStorage.setItem(xC,JSON.stringify(n))}catch{}}}}function F3(){try{const e=localStorage.getItem(xC);if(e===null)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}catch{return[]}}const tw={squash:"squash",merge:"merge commit",rebase:"rebase"};function U3(e){const t=j.useRef(null);return j.useEffect(()=>{var s;return(s=t.current)==null?void 0:s.focus()},[]),a.jsx("div",{className:"prgate",role:"dialog","aria-modal":"true","aria-label":e.verb==="merge"?"mesclar a pull request":"abrir uma pull request",onKeyDown:s=>{s.key==="Escape"&&(s.stopPropagation(),e.onClose())},children:e.verb==="merge"?a.jsx($3,{...e,cancelRef:t}):a.jsx(K3,{...e,cancelRef:t})})}function $3({status:e,worktreeId:t,onClose:s,cancelRef:n}){const{merge:o}=bC(),l=W3(e),[d,h]=j.useState(l[0]??"merge"),[f,m]=j.useState(e.merge.deleteBranchOnMerge),g=e.pull;return g===null?null:a.jsxs("form",{className:"prform",onSubmit:v=>{v.preventDefault(),o.mutate({worktreeId:t,strategy:d,deleteBranch:f},{onSuccess:s})},children:[a.jsxs("div",{className:"prgate__t",children:[a.jsx("span",{className:"prgate__g","aria-hidden":"true",children:"⚠"}),"Mesclar a #",g.number,"?"]}),a.jsxs("div",{className:"prform__what",children:[a.jsxs("span",{children:[a.jsx("b",{children:g.head})," entra em ",a.jsx("b",{children:g.base}),", por ",a.jsx("b",{children:tw[d]}),"."]}),a.jsx("span",{children:f?"A branch remota é apagada. A worktree local fica onde está.":"A branch remota fica. A worktree local também."})]}),a.jsxs("div",{className:"prform__field",children:[a.jsx("span",{className:"prform__label",children:"estratégia"}),a.jsx("div",{className:"prform__strategies",role:"radiogroup","aria-label":"estratégia de merge",children:l.map(v=>a.jsx(J,{size:"sm",variant:v===d?"primary":"default",role:"radio","aria-checked":v===d,onClick:()=>h(v),children:tw[v]},v))})]}),a.jsx("label",{className:"prform__field",children:a.jsxs("span",{children:[a.jsx("input",{type:"checkbox",checked:f,onChange:v=>m(v.target.checked)})," ","apagar a branch remota depois"]})}),o.isError&&a.jsx("p",{className:"prform__error",role:"alert",children:o.error.message}),a.jsxs("div",{className:"prform__acts",children:[a.jsx(J,{size:"sm",variant:"ghost",ref:n,onClick:s,children:"cancelar"}),a.jsx(J,{size:"sm",variant:"danger",type:"submit",disabled:o.isPending,children:o.isPending?"mesclando…":"mesclar"})]})]})}function K3({status:e,worktreeId:t,onClose:s,cancelRef:n}){var w;const{create:o}=bC(),l=P3(t),[d,h]=j.useState(null),f=d??((w=l.data)==null?void 0:w.title)??"",m=h,[g,v]=j.useState(""),[y,x]=j.useState(!1),S=`pr-title-${t}`;return a.jsxs("form",{className:"prform",onSubmit:k=>{k.preventDefault(),f.trim()!==""&&o.mutate({worktreeId:t,title:f.trim(),body:g,draft:y},{onSuccess:s})},children:[a.jsx("div",{className:"prgate__t",children:"Abrir pull request"}),a.jsx("div",{className:"prform__what",children:a.jsxs("span",{children:[a.jsx("b",{children:e.branch})," para ",a.jsx("b",{children:e.base}),", em ",a.jsx("b",{children:e.host??"GitHub"}),"."]})}),a.jsx(Ht,{id:S,label:"Título",error:o.isError?o.error.message:void 0,children:a.jsx(Ft,{id:S,value:f,onChange:k=>m(k.target.value),placeholder:"feat: o que esta branch faz",invalid:o.isError,autoFocus:!0})}),a.jsxs("div",{className:"prform__field",children:[a.jsx("label",{className:"prform__label",htmlFor:`${S}-body`,children:"descrição"}),a.jsx("textarea",{id:`${S}-body`,className:"prform__body",rows:5,value:g,onChange:k=>v(k.target.value)})]}),a.jsx("label",{className:"prform__field",children:a.jsxs("span",{children:[a.jsx("input",{type:"checkbox",checked:y,onChange:k=>x(k.target.checked)})," ","abrir como rascunho"]})}),a.jsxs("div",{className:"prform__acts",children:[a.jsx(J,{size:"sm",variant:"ghost",ref:n,onClick:s,children:"cancelar"}),a.jsx(J,{size:"sm",variant:"primary",type:"submit",disabled:o.isPending||f.trim()==="",children:o.isPending?"abrindo…":"abrir"}),e.compareUrl!==null&&a.jsxs("a",{className:"btn btn--ghost btn--sm focus-ring",href:e.compareUrl,target:"_blank",rel:"noopener noreferrer",children:["abrir no GitHub ",a.jsx("span",{"aria-hidden":"true",children:"↗"})]})]})]})}function W3(e){return["squash","merge","rebase"].filter(t=>e.merge[t])}function pc(e,t=Date.now()){const s=Date.parse(e);if(Number.isNaN(s))return"";const n=Math.max(0,Math.round((t-s)/1e3));if(n<60)return"agora";const o=Math.floor(n/60);if(o<60)return`${o} min`;const l=Math.floor(o/60);return l<24?`${l} h`:`${Math.floor(l/24)} d`}function SC(e){const t=Math.floor(e/1e3);if(t<60)return`${String(t)} s`;const s=Math.floor(t/60);if(s<60)return`${String(s)} min`;const n=Math.floor(s/60);return n<24?`${String(n)} h`:`${String(Math.floor(n/24))} d`}function V3(e){const t=Math.floor((Date.now()-new Date(e).getTime())/864e5);return t<=0?"hoje":t===1?"ontem":`há ${String(t)} dias`}function Fg(e,t="2-digit"){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:t,hour:"2-digit",minute:"2-digit"})}function Y3(e){switch(e){case"ready":return"ready";case"blocked":return"blocked";case"pending":return"pending";case"merged":return"merged";default:return"none"}}const gd=(e,t,s)=>`${String(e)} ${e===1?t:s}`;function vd(e,t=2){return e.slice(0,t)}function G3(e){const t=e.reason;switch(t.kind){case"conflict":return{state:"conflito com a base",why:[{text:"não mescla sozinha em "},{text:t.base,strong:!0}]};case"checks-failed":{const s=vd(t.names),n=t.names.length-s.length;return{state:gd(t.names.length,"verificação falhou","verificações falharam"),why:[...s.flatMap((o,l)=>[...l>0?[{text:", "}]:[],{text:o,strong:!0}]),...n>0?[{text:` e mais ${String(n)}`}]:[]]}}case"changes-requested":{const s=vd(t.by,1);return{state:"mudanças pedidas",why:s.length===0?[{text:"alguém pediu mudanças nesta pull request"}]:[{text:"por "},{text:s[0],strong:!0}]}}case"review-required":return{state:"falta revisão",why:[{text:"a regra da base exige aprovação"}]};case"behind":return{state:"atrás da base",why:[{text:"atualize a partir de "},{text:t.base,strong:!0}]};case"blocked-by-host":return{state:"bloqueada pelo GitHub",why:[{text:"uma regra da base impede o merge — o motivo está na pull request"}]};case"checks-running":{const s=vd(t.names,1),n=t.running+t.queued;return{state:gd(n,"verificação rodando","verificações rodando"),why:[...s.length>0?[{text:s[0],strong:!0}]:[],...t.queued>0?[{text:`${s.length>0?" · ":""}${String(t.queued)} na fila`}]:[]]}}case"mergeability-unknown":return{state:"verificando",why:[{text:"o GitHub ainda não disse se ela mescla"}]};case"ready":{const s=vd(t.approvedBy,1);return{state:"pronta para merge",why:[{text:t.passed===0?"nada impede":gd(t.passed,"verificação passou","verificações passaram")},...s.length>0?[{text:" · aprovada por "},{text:s[0],strong:!0}]:[]]}}case"draft":return{state:"rascunho",why:[{text:t.passed===0?"marque como pronta no GitHub":`${gd(t.passed,"verificação passou","verificações passaram")} · marque como pronta no GitHub`}]};case"merged":return{state:"mesclada",why:[{text:"em "},{text:t.base,strong:!0},{text:" · esta worktree pode ser removida"}]};case"closed":return{state:"fechada sem merge",why:[{text:"ninguém mesclou esta pull request"}]}}}function Q3(e){return e.published?{state:"sem pull request",why:[{text:"publicada · ninguém abriu pull request para "},{text:e.base,strong:!0}]}:{state:"branch não publicada",why:[{text:"nenhum remoto conhece "},{text:e.branch,strong:!0}]}}function hp(e,t){switch(e.kind){case"no-binary":return{state:"sem integração com o GitHub",why:[{text:"instale o "},{text:"gh",strong:!0},{text:" para ver PR e verificações aqui"}],dismissible:!0};case"no-auth":return{state:"gh não autenticado",why:[{text:"rode "},{text:"gh auth login",strong:!0},{text:" num shell desta worktree"}],dismissible:!1};case"unsupported-host":return{state:t===null?"sem integração":`sem integração com ${t}`,why:[{text:"o v1 fala só GitHub · o adaptador de host é a porta para os outros"}],dismissible:!0};case"rate-limit":return{state:"limite do GitHub atingido",why:e.retryAt===null?[{text:"o dado acima é de antes · tente de novo mais tarde"}]:[{text:"volta a consultar às "},{text:Z3(e.retryAt),strong:!0},{text:" · o dado acima é de antes"}],dismissible:!1};case"not-a-repo":return{state:"sem integração",why:[{text:"este checkout não é um repositório git"}],dismissible:!0};case"offline":case"timeout":return{state:"sem conexão com o GitHub",why:[{text:"o dado acima é o último que deu para ler"}],dismissible:!1};default:return{state:"não deu para ler a pull request",why:[{text:e.message}],dismissible:!1}}}function Z3(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}const X3=12e4;function wC(e,t=Date.now()){if(e===null)return null;const s=Date.parse(e);if(Number.isNaN(s))return null;const n=Math.max(0,t-s);return{label:`há ${SC(n)}`,stale:n>X3}}function J3(e){if(e===null)return"—";const t=Math.round(e/1e3);if(t<60)return`${String(t)}s`;const s=Math.floor(t/60),n=t%60;return`${String(s)}m${String(n).padStart(2,"0")}s`}function eB({words:e}){return a.jsx("span",{className:"prbar__why",children:e.map((t,s)=>t.strong===!0?a.jsx("b",{children:t.text},s):a.jsx("span",{children:t.text},s))})}function tB({status:e,worktreeId:t,now:s,onRetry:n,onDismiss:o}){const[l,d]=j.useState(null),h=e.pull,f=e.failure,m=h===null?"none":Y3(h.verdict),g=h!==null?G3(h):f!==null?hp(f,e.host):Q3(e),v=h!==null&&f!==null?hp(f,e.host):null,y=wC(e.readAt,s),x=h===null&&f!==null&&hp(f,e.host).dismissible,S=h!==null&&h.verdict==="ready"&&(e.merge.merge||e.merge.squash||e.merge.rebase),w=h===null&&e.published&&f===null&&e.host!==null;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`prbar prbar--${m}`,role:"status","aria-label":"estado da pull request",children:[a.jsxs("div",{className:"prbar__top",children:[h!==null&&a.jsx(sB,{pull:h}),a.jsxs("span",{className:"prbar__state",children:[a.jsx("span",{className:"prbar__dot","aria-hidden":"true"}),a.jsx("span",{className:"prbar__word",children:g.state})]})]}),a.jsxs("div",{className:"prbar__reason",children:[a.jsx(eB,{words:v===null?g.why:[...g.why,{text:" · "},...v.why]}),y!==null&&a.jsx("span",{className:`prbar__fresh${y.stale?" prbar__fresh--stale":""}`,children:y.label})]}),(S||w||e.compareUrl!==null||f!==null)&&a.jsxs("div",{className:"prbar__acts",children:[S&&a.jsx(J,{size:"sm",variant:"primary",onClick:()=>d("merge"),children:"mesclar"}),w&&a.jsx(J,{size:"sm",onClick:()=>d("create"),children:"abrir pull request"}),h===null&&e.compareUrl!==null&&a.jsxs("a",{className:"btn btn--sm focus-ring",href:e.compareUrl,target:"_blank",rel:"noopener noreferrer",children:["comparar no GitHub ",a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),f!==null&&a.jsx(J,{size:"sm",variant:"ghost",onClick:n,children:"tentar de novo"}),x&&a.jsx(J,{size:"sm",variant:"ghost",onClick:o,children:"não mostrar mais"})]})]}),l!==null&&a.jsx(U3,{verb:l,status:e,worktreeId:t,onClose:()=>d(null)})]})}function sB({pull:e}){const t=`abrir a pull request ${String(e.number)} no navegador`;return a.jsxs(a.Fragment,{children:[e.url===null?a.jsx("span",{className:"prbar__pr",title:"o endereço desta pull request não é do host do projeto",children:a.jsxs("span",{className:"prbar__num",children:["#",e.number]})}):a.jsxs("a",{className:"prbar__pr focus-ring",href:e.url,target:"_blank",rel:"noopener noreferrer",children:[a.jsxs("span",{className:"prbar__num",children:["#",e.number]}),a.jsx("span",{className:"prbar__go","aria-hidden":"true",children:"↗"}),a.jsx("span",{className:"sr-only",children:t})]}),e.alsoOpen>0&&a.jsxs("span",{className:"prbar__more",title:"esta branch tem mais de uma pull request aberta",children:["+",e.alsoOpen]})]})}const iB=[{group:"failed",title:"precisa de você"},{group:"running",title:"em andamento"},{group:"passed",title:"passaram"},{group:"skipped",title:"ignoradas"}],nB={failed:{char:"✕",word:"falhou",suffix:"bad"},running:{char:"●",word:"rodando",suffix:"run"},passed:{char:"✓",word:"passou",suffix:"ok"},skipped:{char:"–",word:"pulada",suffix:"skip"}};function rB({pull:e,readAt:t,now:s}){const n=wC(t,s);return e.checks.length===0?a.jsx("div",{className:"checks",children:a.jsx(hs,{title:"Nenhuma verificação",children:"Esta pull request não tem verificação configurada, ou o host ainda não relatou nenhuma."})}):a.jsxs("div",{className:"checks",children:[iB.map(({group:o,title:l})=>{const d=e.checks.filter(h=>h.group===o);return d.length===0?null:a.jsxs("div",{children:[a.jsx("div",{className:"checks__group",children:l}),d.map(h=>a.jsx(aB,{check:h},`${o}:${h.name}`))]},o)}),a.jsxs("div",{className:"checks__foot",children:[n===null?"lido do gh":`lido do gh ${n.label}`," · reexecutar se faz no navegador"]})]})}function aB({check:e}){const t=nB[e.group],s=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"checks__glyph","aria-hidden":"true",children:t.char}),a.jsx("span",{className:"sr-only",children:t.word}),a.jsxs("span",{className:"checks__body",children:[a.jsx("span",{className:"checks__name",children:e.name}),e.app!==""&&a.jsx("span",{className:"checks__app",children:e.app})]}),a.jsx("span",{className:"checks__time",children:J3(e.durationMs)})]});return e.url===null?a.jsxs("div",{className:"checks__row",title:"o endereço desta execução não é do host do projeto",children:[s,a.jsx("span",{className:"checks__go","aria-hidden":"true"})]}):a.jsxs("a",{className:`checks__row checks__row--${t.suffix} focus-ring`,href:e.url,target:"_blank",rel:"noopener noreferrer",children:[s,a.jsx("span",{className:"checks__go","aria-hidden":"true",children:"↗"}),a.jsxs("span",{className:"sr-only",children:["abrir a execução de ",e.name]})]})}function oB(e){const{failed:t,running:s,passed:n}=e.counts;return t>0?{text:`✕${String(t)}`,tone:"bad"}:s>0?{text:`●${String(s)}`,tone:"run"}:{text:`✓${String(n)}`,tone:"ok"}}const q_=new Set;function lB(e){q_.add(e);const t=()=>q_.delete(e);e.then(t,t)}async function cB(){await Promise.allSettled(q_)}function sw(e,t,s){return`${e}:${t}:${s??"context"}`}const jC=j.createContext(null);function uB({children:e}){const[t,s]=j.useState(null),[n,o]=j.useState({}),l=j.useCallback(f=>{o(m=>t===null?m:{...m,[t]:f})},[t]),d=j.useCallback(f=>{o(m=>{if(!(f in m))return m;const g={...m};return delete g[f],g})},[]),h=j.useMemo(()=>({activeTab:t,setActiveTab:s,fileFor:f=>n[f]??null,open:l,close:d}),[t,n,l,d]);return a.jsx(jC.Provider,{value:h,children:e})}function Ug(){const e=j.useContext(jC);if(e===null)throw new Error("useOpenFiles precisa de um OpenFilesProvider acima");return e}function yd(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function iw(e,t){return t===e||t.startsWith(`${e}/`)}function dB(e){var ae,me,H;const t=$e(),s=Ug(),[n,o]=j.useState({kind:"idle"}),l=s.activeTab,d=l===null?null:s.fileFor(l),h=d!==null&&d.view==="file"?d.path:null,f=j.useRef(null),[m,g]=j.useState(0);j.useEffect(()=>{const B=f.current;B!==null&&(f.current=null,cB().then(B))},[m]);const v=j.useCallback(B=>{if(l===null){B();return}f.current=B,s.close(l),g(O=>O+1)},[s,l]),y=j.useCallback((...B)=>{t.invalidateQueries({queryKey:Nc});for(const O of new Set(B))t.invalidateQueries({queryKey:mg(e.scopeType,e.scopeId,O)})},[t,e.scopeType,e.scopeId]),x=Se({mutationFn:B=>Q.files.create.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:B.path,kind:B.kind}),onSuccess:B=>{y(yd(B.path)),o({kind:"idle"})}}),S=Se({mutationFn:B=>Q.files.rename.mutate({scopeType:e.scopeType,scopeId:e.scopeId,from:B.from,to:B.to}),onSuccess:(B,O)=>{if(y(yd(O.from),yd(B.path)),O.reopen!==null){const se=O.reopen.slice(O.from.length);s.open({path:`${B.path}${se}`,view:"file"})}o({kind:"idle"})},onError:(B,O)=>{O.reopen!==null&&s.open({path:O.reopen,view:"file"})}}),w=Se({mutationFn:B=>Q.files.remove.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:B.path,recursive:B.recursive}),onSuccess:(B,O)=>{y(yd(O.path)),o({kind:"idle"})},onError:(B,O)=>{O.reopen!==null&&s.open({path:O.reopen,view:"file"})}}),k=n.kind==="delete"?n.path:null,E=be({queryKey:X2(e.scopeType,e.scopeId,k??""),queryFn:()=>Q.files.deletePreview.query({scopeType:e.scopeType,scopeId:e.scopeId,path:k??""}),enabled:k!==null,gcTime:0}),D=x.reset,A=S.reset,N=w.reset,z=j.useCallback(B=>{D(),A(),N(),o(B)},[D,A,N]),V=j.useCallback(()=>z({kind:"idle"}),[z]),ee=j.useCallback(B=>{const O=B.trim();if(O==="")return;if(n.kind==="create"){const M=n.parent;x.mutate({path:M===""?O:`${M}/${O}`,kind:n.makes});return}if(n.kind!=="rename")return;const se=n.path,re=h!==null&&iw(se,h)?h:null,q=()=>S.mutate({from:se,to:O,reopen:re});re===null?q():v(q)},[x,n,v,S,h]),$=j.useCallback(()=>{if(n.kind!=="delete")return;const B=n.path,O=h!==null&&iw(B,h)?h:null,se=()=>w.mutate({path:B,recursive:n.directory,reopen:O});O===null?se():v(se)},[n,v,w,h]);return{gesture:n,ask:z,cancel:V,refusal:((ae=x.error)==null?void 0:ae.message)??((me=S.error)==null?void 0:me.message)??((H=w.error)==null?void 0:H.message)??null,busy:x.isPending||S.isPending||w.isPending,submit:ee,confirm:$,preview:E}}function hB(e){return be({queryKey:tT(e.workspaceId,e.projectId),queryFn:()=>Q.memory.list.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function $g(e="pending"){return be({queryKey:Cj(e),queryFn:()=>Q.memory.proposals.query({status:e})})}function fB(e,t){const s=t.trim();return be({queryKey:iT(e.workspaceId,e.projectId,s),queryFn:()=>Q.memory.search.query({query:s,...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}}),enabled:s!==""})}function mB(){return be({queryKey:nT,queryFn:()=>Q.memory.decisions.query()})}function pB(e){return be({queryKey:sT(e.workspaceId,e.projectId),queryFn:()=>Q.memory.core.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function _B(){const e=$e();return Se({mutationFn:t=>Q.memory.pin.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:gg})})}function gB(){return be({queryKey:aT,queryFn:()=>Q.memory.settings.query()})}function vB(e){const t=e.archived??!1;return be({queryKey:dT(e.workspaceId,t),queryFn:()=>Q.memory.playbooks.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},archived:t})})}function yB(){const e=$e();return Se({mutationFn:t=>Q.memory.archivePlaybook.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:gg})})}function bB(){return be({queryKey:rT,queryFn:()=>Q.memory.usage.query()})}function xB(){const e=$e(),t=()=>e.invalidateQueries({queryKey:gg}),s=Se({mutationFn:o=>Q.memory.approveProposal.mutate(o),onSuccess:t}),n=Se({mutationFn:o=>Q.memory.rejectProposal.mutate(o),onSuccess:t});return{approve:s,reject:n}}const CC={low:"baixa",medium:"média",high:"alta"},P_={human:"você",agent:"agente",distiller:"destilação",auto_research:"auto-learn",import:"importação"},Kg={global:"você · atravessa workspace",workspace:"workspace",project:"projeto"};function SB({query:e,core:t,scope:s}){var x;const[n,o]=j.useState(""),l=fB(s,n),d=a.jsx("div",{className:"mem-find",children:a.jsx("input",{type:"search",className:"focus-ring",placeholder:"buscar na memória…","aria-label":"Buscar na memória",value:n,onChange:S=>o(S.target.value)})});if(n.trim()!=="")return a.jsxs(a.Fragment,{children:[d,a.jsx(jB,{found:l})]});if(e.isPending)return a.jsx("p",{className:"mem-meta",children:"carregando…"});if(e.isError)return a.jsx(hs,{title:"Não deu para ler a memória",children:e.error.message});const{entries:h,shadowed:f}=e.data;if(h.length===0)return a.jsx(hs,{title:"Nada aprendido ainda",children:"A memória aparece aqui quando algo durável for salvo."});const m=new Map;for(const S of f)m.set(S.winner,[...m.get(S.winner)??[],S.identity]);const g=new Map((((x=t.data)==null?void 0:x.entries)??[]).map(S=>[S.path,S.chars])),y=["project","workspace","global"].map(S=>({scope:S,rows:h.filter(w=>w.scope===S)})).filter(S=>S.rows.length>0);return a.jsxs(a.Fragment,{children:[d,y.map(S=>a.jsxs("section",{children:[a.jsxs("h3",{className:"mem-group__t",children:[a.jsx("span",{className:"mem-scope","data-scope":S.scope,children:Kg[S.scope]??S.scope}),a.jsx("span",{className:"mem-group__n",children:S.rows.length})]}),a.jsx("ul",{className:"mem-list",children:S.rows.map(w=>{var k;return a.jsxs("li",{className:"mem-item",children:[a.jsx(CB,{entry:w}),a.jsx("p",{className:"mem-desc",children:w.description}),a.jsxs("p",{className:"mem-meta",children:[a.jsx("span",{children:P_[w.sourceActor]??w.sourceActor}),a.jsxs("span",{children:["confiança ",CC[w.confidence]??w.confidence]}),a.jsx(wB,{entry:w}),w.pinned&&g.get(w.path)!==void 0?a.jsxs("span",{className:"mem-pin-cost",children:[(g.get(w.path)??0).toLocaleString("pt-BR")," car."]}):null]}),(k=m.get(w.path))==null?void 0:k.map(E=>a.jsxs("p",{className:"mem-shadow-note",children:["sombreia ",a.jsx("strong",{children:E})," — continua no disco"]},E))]},w.path)})})]},S.scope))]})}function wB({entry:e}){const t=_B();return a.jsx("button",{type:"button",className:"mem-pin focus-ring","aria-pressed":e.pinned,disabled:t.isPending,onClick:()=>t.mutate({path:e.path,pinned:!e.pinned}),children:e.pinned?"no núcleo":"fixar no núcleo"})}function jB({found:e}){return e.isPending?a.jsx("p",{className:"mem-meta",children:"buscando…"}):e.isError?a.jsx(hs,{title:"Não deu para buscar",children:e.error.message}):e.data.skipped==="trivial_query"?a.jsx(hs,{title:"Busca não realizada",children:"Menos de dois termos significativos — dizer que não buscou é diferente de dizer que não achou."}):a.jsxs(a.Fragment,{children:[e.data.staleIndex?a.jsx("p",{className:"mem-stale",children:"índice desatualizado — o resultado pode estar curto"}):null,e.data.hits.length===0?a.jsx(hs,{title:"Nada encontrado",children:"Nenhuma memória casa com esses termos no escopo ativo."}):a.jsx("ul",{className:"mem-list",children:e.data.hits.map(t=>a.jsxs("li",{className:"mem-item",children:[a.jsxs("p",{className:"mem-row",children:[a.jsx("span",{className:"mem-scope","data-scope":t.entry.scope,children:Kg[t.entry.scope]??t.entry.scope}),a.jsx("span",{className:"mem-kind",children:t.entry.type}),a.jsx("span",{className:"mem-name",children:t.entry.name})]}),a.jsx("p",{className:"mem-desc",children:t.entry.description}),a.jsx("p",{className:"mem-why",children:t.why.map(s=>a.jsx("span",{children:s},s))})]},t.entry.path))})]})}function CB({entry:e}){return a.jsxs("p",{className:"mem-row",children:[a.jsx("span",{className:"mem-kind",children:e.type}),a.jsx("span",{className:"mem-name",children:e.name})]})}const nw=4e3;function kB({core:e}){const t=bB(),s=gB();if(t.isPending)return a.jsx("p",{className:"mem-meta",children:"carregando…"});if(t.isError)return a.jsx(hs,{title:"Não deu para ler os números",children:t.error.message});const n=e.data;return a.jsxs("div",{className:"mem-stats",children:[n!==void 0&&n.entries.length>0?a.jsxs("div",{className:`mem-stat${n.chars>nw?" mem-stat--warn":""}`,children:[a.jsx("div",{className:"n",children:n.chars.toLocaleString("pt-BR")}),a.jsx("div",{className:"l",children:"caracteres no núcleo"}),a.jsxs("div",{className:"hint",children:[n.entries.length," ",n.entries.length===1?"diretriz fixada":"diretrizes fixadas",n.recentChars>0?` · ${n.recentChars.toLocaleString("pt-BR")} entraram em 30 dias`:"",n.chars>nw?" · hora de consolidar":""]})]}):null,s.data!==void 0?a.jsxs("div",{className:"mem-stat",children:[a.jsx("div",{className:"n",children:s.data.distill?"on":"off"}),a.jsx("div",{className:"l",children:"destilação de fim de sessão"}),a.jsx("div",{className:"hint",children:s.data.distill?"cada sessão de agente que termina custa uma sessão de destilação":"ligue com LUMEM_MEMORY_DISTILL=1"})]}):null,s.data!==void 0?a.jsxs("div",{className:"mem-stat",children:[a.jsx("div",{className:"n",children:s.data.autoLearn?"on":"off"}),a.jsx("div",{className:"l",children:"pesquisa automática"}),a.jsx("div",{className:"hint",children:s.data.autoLearn?`pergunta sem resposta sobe um agente · até ${String(s.data.autoLearnBudget)} por sessão`:"ligue com LUMEM_MEMORY_AUTO_LEARN=1"})]}):null,t.data.map(o=>a.jsxs("div",{className:"mem-stat",children:[a.jsx("div",{className:"n",children:o.events}),a.jsxs("div",{className:"l",children:[o.kind," · ",o.totalAmount," no total · ",o.averageDurationMs," ms"]})]},o.kind)),t.data.length===0?a.jsxs("div",{className:"mem-stat",children:[a.jsx("div",{className:"n",children:"0"}),a.jsx("div",{className:"l",children:"uso registrado"}),a.jsx("div",{className:"hint",children:"os números aparecem depois da primeira busca"})]}):null]})}const NB={active:"ativo",stale:"parado",archived:"arquivado"};function EB({workspaceId:e,projectId:t}){var d,h;const[s,n]=j.useState(!1),o=vB({workspaceId:e,archived:s}),l=yB();return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mem-seg",role:"group","aria-label":"Vista dos playbooks",children:[{label:"ativos",value:!1},{label:"arquivados",value:!0}].map(f=>a.jsx("button",{type:"button",className:`mem-seg__item${s===f.value?" mem-seg__item--active":""}`,"aria-pressed":s===f.value,onClick:()=>n(f.value),children:f.label},f.label))}),o.isPending?a.jsx("p",{className:"mem-meta",children:"carregando…"}):null,o.isError?a.jsx(hs,{title:"Não deu para ler os playbooks",children:o.error.message}):null,((d=o.data)==null?void 0:d.length)===0?a.jsx(hs,{title:s?"Nenhum playbook arquivado":"Nenhum playbook ainda",children:s?"Arquivar não apaga: o que for arquivado aparece aqui.":"Playbook é procedimento — o caminho que já funcionou, para a próxima vez."}):null,(h=o.data)==null?void 0:h.map(f=>a.jsxs("div",{className:"pb",children:[a.jsxs("p",{className:"pb__row",children:[a.jsx("span",{className:"life","data-life":f.lifecycle,children:NB[f.lifecycle]??f.lifecycle}),a.jsx("span",{className:"pb__class",children:f.taskClass})]}),a.jsx("p",{className:"pb__desc",children:f.description}),a.jsxs("p",{className:"pb__use",children:[a.jsxs("span",{className:"pb__loads",children:[f.loads,"×"]}),a.jsx("span",{children:f.lastLoadedAt===null?"nunca carregado":`último uso ${V3(f.lastLoadedAt)}`}),a.jsx("span",{className:"mem-scope","data-scope":f.scope,children:Kg[f.scope]??f.scope}),a.jsx("button",{type:"button",className:"pb__act focus-ring",disabled:l.isPending,onClick:()=>l.mutate({path:f.path,archived:!f.archived}),children:f.archived?"desarquivar":"arquivar"})]}),f.lifecycle==="stale"?a.jsx("p",{className:"pb__suggest",children:"parado há muito tempo — talvez o procedimento tenha mudado. Arquivar não apaga: carregar de novo reativa."}):null]},f.path))]})}const TB={applied:"aprendeu",rejected:"recusou",noop:"nada a fazer"};function AB(){const e=mB();return e.isPending?a.jsx("p",{className:"mem-meta",children:"carregando…"}):e.isError?a.jsx(hs,{title:"Não deu para ler o histórico",children:e.error.message}):e.data.length===0?a.jsx(hs,{title:"Nada decidido ainda",children:"Cada escrita — e cada recusa — aparece aqui."}):a.jsx("ol",{className:"mem-tl",children:e.data.map(t=>a.jsxs("li",{className:"mem-tl-item","data-outcome":t.outcome,children:[a.jsx("span",{className:"mem-tl-when",children:Fg(t.createdAt)}),a.jsx("span",{className:"mem-tl-dot",children:t.outcome==="rejected"?"▲":"●"}),a.jsxs("span",{children:[a.jsx("span",{className:"mem-tl-verb",children:TB[t.outcome]??t.outcome})," ",a.jsx("span",{children:t.path}),t.reason===null?null:a.jsxs(a.Fragment,{children:[" — ",a.jsx("em",{children:t.reason})]}),(t.taskTitles??[]).length>0&&a.jsxs("span",{className:"mem-tl-task",children:[" · ",(t.taskTitles??[]).join(", ")]})]})]},t.id))})}const OB=[{id:"entries",label:"Memória"},{id:"playbooks",label:"Playbooks"},{id:"timeline",label:"Histórico"},{id:"numbers",label:"Números"}];function kC({workspaceId:e,projectId:t,tab:s,onTabChange:n}){const[o,l]=j.useState("entries"),d=s??o,h=g=>{l(g),n==null||n(g)},f=hB({workspaceId:e,projectId:t}),m=pB({workspaceId:e,projectId:t});return $g("pending"),a.jsxs("section",{className:"mem-panel","aria-label":"Memória do workspace",children:[a.jsx("header",{className:"mem-head",children:a.jsx("div",{role:"tablist","aria-label":"Vistas da memória",className:"mem-tabs",children:OB.map(g=>a.jsx("button",{type:"button",role:"tab",id:`mem-tab-${g.id}`,"aria-selected":d===g.id,"aria-controls":"mem-panel-body",className:`mem-tab${d===g.id?" mem-tab--active":""}`,onClick:()=>{h(g.id)},children:g.label},g.id))})}),a.jsxs("div",{className:"mem-body",id:"mem-panel-body",role:"tabpanel","aria-labelledby":`mem-tab-${d}`,children:[d==="entries"?a.jsx(SB,{query:f,core:m,scope:{workspaceId:e,projectId:t}}):null,d==="playbooks"?a.jsx(EB,{workspaceId:e,projectId:t}):null,d==="timeline"?a.jsx(AB,{}):null,d==="numbers"?a.jsx(kB,{core:m}):null]})]})}const RB=[{id:"pending",label:"Pendentes"},{id:"resolved",label:"Resolvidas"}];function DB({status:e}={}){const[t,s]=j.useState("pending"),n=e??t,o=$g(n);return a.jsxs(a.Fragment,{children:[e===void 0&&a.jsx("div",{className:"mem-seg",role:"group","aria-label":"Propostas por estado",children:RB.map(l=>a.jsx("button",{type:"button",className:`mem-seg__item${n===l.id?" mem-seg__item--active":""}`,"aria-pressed":n===l.id,onClick:()=>s(l.id),children:l.label},l.id))}),a.jsx(MB,{query:o,status:n})]})}function MB({query:e,status:t}){return e.isPending?a.jsx("p",{className:"mem-meta",children:"carregando…"}):e.isError?a.jsx(hs,{title:"Não deu para ler as propostas",children:e.error.message}):e.data.length===0?t==="pending"?a.jsx(hs,{title:"Nenhuma proposta pendente",children:"Escrita de workspace feita por agente cai aqui antes de valer."}):a.jsx(hs,{title:"Nada decidido ainda",children:"Aprovar ou rejeitar move a proposta para cá — recusar é histórico, não apagamento."}):a.jsx("ul",{className:"mem-list",children:e.data.map(s=>a.jsx("li",{className:"mem-item",children:s.status==="pending"?a.jsx(BB,{proposal:s}):a.jsx(PB,{proposal:s})},s.id))})}function LB({current:e,proposal:t}){return a.jsxs("div",{className:"mem-conflict",children:[a.jsxs("p",{className:"mem-conflict__t",children:[a.jsx("span",{className:"mem-warn",children:"conflito no mesmo escopo"}),"já existe memória aqui — aprovar substitui"]}),a.jsxs("div",{className:"mem-split",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"A que está valendo"}),a.jsx("p",{className:"mem-desc",children:e.description}),a.jsxs("p",{className:"mem-meta",children:[a.jsx("span",{children:P_[e.sourceActor]??e.sourceActor}),a.jsxs("span",{children:["confiança ",CC[e.confidence]??e.confidence]})]})]}),a.jsxs("div",{children:[a.jsx("strong",{children:"A que chegou"}),a.jsx("p",{className:"mem-desc",children:t.description}),a.jsxs("p",{className:"mem-meta",children:[a.jsx("span",{children:P_[t.actor]??t.actor}),a.jsx("span",{children:t.evidence===null?"sem evidência":"com evidência"})]})]})]})]})}function BB({proposal:e}){const{approve:t,reject:s}=xB(),[n,o]=j.useState("none");return a.jsxs(a.Fragment,{children:[a.jsx(NC,{proposal:e}),a.jsx("p",{className:"mem-desc",children:e.description}),a.jsx("pre",{className:"mem-body-text",children:e.body===""?"(sem corpo — só nome e descrição)":e.body}),a.jsx(IB,{proposal:e}),e.current===null?null:a.jsx(LB,{current:e.current,proposal:e}),n==="edit"?a.jsx(zB,{proposal:e,approve:t,onCancel:()=>o("none")}):n==="reject"?a.jsx(qB,{proposal:e,reject:s,onCancel:()=>o("none")}):a.jsxs("div",{className:"mem-actions",children:[a.jsx(J,{variant:"primary",disabled:t.isPending,onClick:()=>t.mutate({id:e.id}),children:"Aprovar"}),a.jsx(J,{onClick:()=>o("edit"),children:"Editar e aprovar"}),a.jsx(J,{variant:"ghost",onClick:()=>o("reject"),children:"Rejeitar"})]}),t.isError?a.jsxs(Ce,{tone:"danger",children:["não deu para aprovar: ",t.error.message]}):null,s.isError?a.jsxs(Ce,{tone:"danger",children:["não deu para rejeitar: ",s.error.message]}):null]})}function zB({proposal:e,approve:t,onCancel:s}){const[n,o]=j.useState(e.name),[l,d]=j.useState(e.description),[h,f]=j.useState(e.body),m=n.trim()===""||l.trim()==="";return a.jsxs("div",{className:"mem-form",children:[a.jsx(Ht,{id:`prop-${e.id}-name`,label:"Nome",children:a.jsx(Ft,{id:`prop-${e.id}-name`,value:n,onChange:g=>{o(g.target.value)}})}),a.jsx(Ht,{id:`prop-${e.id}-description`,label:"Descrição",children:a.jsx(Ft,{id:`prop-${e.id}-description`,value:l,onChange:g=>{d(g.target.value)}})}),a.jsx(Ht,{id:`prop-${e.id}-body`,label:"Corpo",children:a.jsx("textarea",{id:`prop-${e.id}-body`,className:"mem-textarea",rows:6,value:h,onChange:g=>{f(g.target.value)}})}),a.jsxs("div",{className:"mem-actions",children:[a.jsx(J,{variant:"primary",disabled:t.isPending||m,onClick:()=>{t.mutate({id:e.id,...n===e.name?{}:{name:n},...l===e.description?{}:{description:l},...h===e.body?{}:{body:h}})},children:"Aprovar com edição"}),a.jsx(J,{variant:"ghost",onClick:s,children:"Cancelar"})]})]})}function qB({proposal:e,reject:t,onCancel:s}){const[n,o]=j.useState("");return a.jsxs("div",{className:"mem-form",children:[a.jsx(Ce,{tone:"warning",children:"Rejeitar não tem volta: a proposta fica no histórico como recusada, e não há como reabri-la."}),a.jsx(Ht,{id:`prop-${e.id}-note`,label:"Por que não? (fica registrado)",children:a.jsx(Ft,{id:`prop-${e.id}-note`,value:n,maxLength:500,placeholder:"isso é regra do api, não do produto",onChange:l=>{o(l.target.value)}})}),a.jsxs("div",{className:"mem-actions",children:[a.jsx(J,{variant:"danger",disabled:t.isPending,onClick:()=>{t.mutate({id:e.id,...n.trim()===""?{}:{note:n.trim()}})},children:"Rejeitar"}),a.jsx(J,{variant:"ghost",onClick:s,children:"Cancelar"})]})]})}function PB({proposal:e}){return a.jsxs(a.Fragment,{children:[a.jsx(NC,{proposal:e}),a.jsx("p",{className:"mem-desc",children:e.description}),a.jsxs("p",{className:"mem-meta",children:[a.jsx("span",{className:"mem-verdict","data-status":e.status,children:e.status==="approved"?"aprovada":"rejeitada"}),a.jsxs("span",{children:["proposta por ",e.actor]}),e.resolvedAt===null?null:a.jsx("span",{children:Fg(e.resolvedAt)})]}),e.resolutionNote===null?null:a.jsx("p",{className:"mem-shadow-note",children:e.resolutionNote})]})}function IB({proposal:e}){return a.jsxs("div",{className:"mem-evidence",children:[e.evidence===null?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"Sem evidência verificável"})," — o agente concluiu. Conclusão vira proposta; fato vira memória."]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"Evidência"})," — ",a.jsx("code",{children:e.evidence})]}),a.jsx("br",{}),"proposta por ",a.jsx("strong",{children:e.actor}),e.fromProjectId===null?null:a.jsxs(a.Fragment,{children:[" · projeto ",e.fromProjectId]})]})}function NC({proposal:e}){return a.jsxs("p",{className:"mem-row",children:[a.jsx("span",{className:"mem-scope","data-scope":e.scope,children:e.scope==="global"?"você":e.scope}),a.jsx("span",{className:"mem-kind",children:e.type}),a.jsx("span",{className:"mem-name",children:e.name})]})}function HB({workspaceId:e,projectName:t}){var g;const[s,n]=j.useState("pending"),l=jg(e,{status:s==="pending"?"proposed":"dropped"}),d=be({queryKey:Cj(s),queryFn:()=>Q.memory.proposals.query({status:s})}),h=l.data??[],f=((g=d.data)==null?void 0:g.length)??0,m=h.length+f;return m===0&&s==="pending"?null:a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"Propostas",count:m,aside:a.jsxs("div",{className:"mem-seg",role:"group","aria-label":"Propostas por estado",children:[a.jsx("button",{type:"button",className:`mem-seg__item${s==="pending"?" mem-seg__item--active":""}`,"aria-pressed":s==="pending",onClick:()=>n("pending"),children:"Pendentes"}),a.jsx("button",{type:"button",className:`mem-seg__item${s!=="pending"?" mem-seg__item--active":""}`,"aria-pressed":s!=="pending",onClick:()=>n("rejected"),children:"Resolvidas"})]})}),a.jsx("div",{className:"tlist",children:h.map(v=>a.jsx(FB,{row:v,workspaceId:e,projectName:t(v.projectId),decided:s!=="pending"},v.id))}),f>0&&a.jsx(DB,{status:s})]})}function FB({row:e,workspaceId:t,projectName:s,decided:n}){const[o,l]=j.useState(!1),[d,h]=j.useState(""),f=l1(t,e.id);return a.jsxs("div",{className:"proposal-item",children:[a.jsxs("div",{className:"proposal-item__head",children:[a.jsx("span",{className:"task-provenance__g","aria-hidden":"true",children:"◆"}),a.jsx("span",{className:"proposal-item__who",children:"agente"}),a.jsxs("span",{className:"proposal-item__kind",children:["tarefa · ",s]})]}),a.jsx("div",{className:"proposal-item__title",children:e.title}),e.body!==""&&a.jsx("div",{className:"proposal-item__why",children:e.body}),f.isError&&a.jsx(Ce,{tone:"danger",children:f.error.message}),n?a.jsxs("div",{className:"proposal-item__acts",children:[a.jsx("span",{className:"proposal-item__verdict",children:"✕ rejeitada"}),e.reason!==null&&e.reason!==""&&a.jsxs("span",{className:"proposal-item__note",children:['"',e.reason,'"']})]}):o?a.jsxs("div",{className:"proposal-item__acts",children:[a.jsx("input",{className:"input","aria-label":"por que rejeitar",placeholder:"por que rejeitar?",value:d,onChange:m=>h(m.target.value)}),a.jsx(J,{variant:"danger",disabled:d.trim()===""||f.isPending,onClick:()=>f.mutate({status:"dropped",reason:d.trim()}),children:"rejeitar"}),a.jsx(J,{variant:"ghost",onClick:()=>l(!1),children:"cancelar"})]}):a.jsxs("div",{className:"proposal-item__acts",children:[a.jsx(J,{variant:"primary",disabled:f.isPending,onClick:()=>f.mutate({status:"open"}),children:"aprovar"}),a.jsx(J,{variant:"ghost",onClick:()=>l(!0),children:"rejeitar"}),a.jsx("span",{className:"proposal-item__note",children:"rejeitar pede um motivo — é o que ensina o agente a não propor de novo"})]})]})}function UB(e){var o,l;const t=be({queryKey:dg(e.scopeId),queryFn:()=>Q.worktree.getDetail.query({id:e.scopeId}),enabled:e.scopeType==="worktree"}),s=e.scopeType==="project"?e.scopeId:((o=t.data)==null?void 0:o.projectId)??null;return{workspaceId:((l=be({queryKey:ug(s??"-"),queryFn:()=>Q.project.get.query({id:s}),enabled:s!==null}).data)==null?void 0:l.workspaceId)??null,projectId:s}}function $B({scope:e,openPath:t,onOpenPatch:s,onRefChange:n}){var S,w;const[o,l]=j.useState("worktree"),d=_C(e,o),h=o==="base"&&d.isError?d.error.message:null,f=j.useRef("base");j.useEffect(()=>{d.data!==void 0&&(f.current=d.data.baseBranch)},[d.data]);const m=((S=d.data)==null?void 0:S.baseBranch)??f.current,g=((w=d.data)==null?void 0:w.files)??[],v=g.reduce((k,E)=>k+E.additions,0),y=g.reduce((k,E)=>k+E.deletions,0);function x(k){l(k),n==null||n(k)}return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"seg-wrap",children:a.jsxs("div",{className:"seg",role:"group","aria-label":"o que comparar",children:[a.jsx("button",{type:"button",className:`seg__btn${o==="worktree"?" seg__btn--on":""}`,"aria-pressed":o==="worktree",onClick:()=>x("worktree"),children:"não commitado"}),a.jsxs("button",{type:"button",className:`seg__btn${o==="base"?" seg__btn--on":""}${h===null?"":" seg__btn--off"}`,"aria-pressed":o==="base",onClick:()=>x("base"),children:["vs ",m]})]})}),h!==null&&a.jsxs("p",{className:"fnote",role:"alert",children:[a.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),a.jsx("span",{children:h})]}),d.isPending?a.jsx("div",{className:"rp__scroll",children:a.jsx("p",{className:"fnote",children:"carregando…"})}):g.length===0&&h===null?WB(o,m):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"sum",children:[a.jsxs("span",{children:[g.length," ",g.length===1?"arquivo":"arquivos"]}),v>0&&a.jsxs("span",{className:"plus",children:["+",v]}),y>0&&a.jsxs("span",{className:"minus",children:["−",y]})]}),a.jsx("div",{className:"rp__scroll",children:g.map(k=>a.jsx(KB,{file:k,open:t===k.path,onOpen:()=>s(k.path,o)},k.path))})]})]})}function KB({file:e,open:t,onOpen:s}){const n=e.path.lastIndexOf("/"),o=n===-1?"":e.path.slice(0,n+1),l=e.path.slice(n+1);return a.jsxs("button",{type:"button",className:`drow${t?" drow--open":""}`,onClick:s,children:[a.jsx("span",{className:`mark mark--${vC(e.status)}`,title:e.status,children:gC(e.status)}),a.jsxs("span",{className:"dpath",title:e.path,children:[a.jsx("span",{className:"dpath__dir",children:o}),a.jsx("span",{className:"dpath__name",children:l})]}),e.binary?a.jsx("span",{className:"dstat",children:"binário"}):a.jsxs(a.Fragment,{children:[e.additions>0&&a.jsxs("span",{className:"dstat plus",children:["+",e.additions]}),e.deletions>0&&a.jsxs("span",{className:"dstat minus",children:["−",e.deletions]})]}),e.oldPath!==null&&a.jsxs("span",{className:"drow__was",children:["era ",e.oldPath]}),a.jsx("span",{className:"drow__gap"})]})}function WB(e,t){return a.jsxs("div",{className:"empty empty--right-panel",children:[a.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"✓"}),a.jsx("span",{className:"empty__title",children:e==="worktree"?"nada por commitar":`idêntica a ${t}`}),a.jsx("span",{className:"empty__why",children:e==="worktree"?"a árvore de trabalho está igual ao HEAD. O que já foi commitado aparece na outra vista.":"nada nesta worktree diverge da base — nem commitado, nem por commitar."})]})}function VB({scope:e,openPath:t,onOpen:s,statusOf:n,edits:o}){const[l,d]=j.useState(new Set),h=j.useCallback(m=>{d(g=>{const v=new Set(g);return v.delete(m)||v.add(m),v})},[]),f=j.useCallback(m=>{d(g=>g.has(m)?g:new Set(g).add(m))},[]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rp__scroll",role:"tree","aria-label":"arquivos",children:a.jsx(EC,{scope:e,path:"",depth:0,expanded:l,onToggle:h,onExpand:f,edits:o,openPath:t,onOpen:s,statusOf:n})}),a.jsx(QB,{edits:o})]})}function EC({scope:e,path:t,depth:s,expanded:n,onToggle:o,onExpand:l,edits:d,openPath:h,onOpen:f,statusOf:m}){const[g,v]=j.useState(void 0),y=be({queryKey:Z2(e.scopeType,e.scopeId,t,g),queryFn:()=>Q.files.listDir.query({scopeType:e.scopeType,scopeId:e.scopeId,path:t,...g===void 0?{}:{limit:g}}),refetchOnWindowFocus:!0}),x=d.gesture,S=x.kind==="create"&&x.parent===t?a.jsx(rw,{depth:s,label:x.makes==="dir"?"nova pasta":"novo arquivo",initial:"",hint:a.jsxs(a.Fragment,{children:["enter cria em ",a.jsx("code",{children:t===""?"./":`${t}/`})," · esc cancela"]}),edits:d},`${t}:${x.makes}`):null;if(y.isPending)return a.jsxs(a.Fragment,{children:[S,a.jsx("p",{className:"fnote",style:{"--depth":s},children:"carregando…"})]});if(y.isError)return a.jsxs(a.Fragment,{children:[S,a.jsxs("p",{className:"fnote",style:{"--depth":s},role:"alert",children:[a.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),a.jsx("span",{children:y.error.message})]})]});const{entries:w,total:k,truncated:E}=y.data;return w.length===0?a.jsxs(a.Fragment,{children:[S,a.jsx("p",{className:"fnote",style:{"--depth":s},children:"vazio"})]}):a.jsxs(a.Fragment,{children:[S,w.map(D=>{const A=t===""?D.name:`${t}/${D.name}`,N=D.kind==="dir",z=n.has(A),V=m(A);return x.kind==="rename"&&x.path===A?a.jsx(rw,{depth:s,label:"renomear",initial:A,hint:a.jsx(a.Fragment,{children:"com barra, move · esc cancela"}),edits:d},A):a.jsxs("div",{role:"group",children:[a.jsxs("div",{className:"frow-wrap",children:[a.jsxs("button",{type:"button",className:["frow",N?"frow--dir":"",V==="deleted"?"frow--dim":"",h===A?"frow--open":""].filter(Boolean).join(" "),"aria-expanded":N?z:void 0,onClick:()=>N?o(A):f(A),children:[a.jsx("span",{className:"frow__twist",style:{"--depth":s},"aria-hidden":"true",children:N?z?"▾":"▸":""}),a.jsx("span",{className:"frow__name",children:D.name}),V!==void 0&&a.jsx("span",{className:`mark mark--${vC(V)}`,title:V,children:gC(V)}),a.jsx("span",{className:"frow__gap"}),D.size!==null&&D.size>0&&a.jsx("span",{className:"frow__size",children:Zl(D.size)})]}),a.jsx(GB,{path:A,isDir:N,edits:d,onExpand:l})]}),N&&z&&a.jsx(EC,{scope:e,path:A,depth:s+1,expanded:n,onToggle:o,onExpand:l,edits:d,openPath:h,onOpen:f,statusOf:m})]},A)}),E&&a.jsxs("p",{className:"fnote",style:{"--depth":s},children:[a.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),a.jsxs("span",{children:[w.length," de ",k," entradas."," ",a.jsx("button",{type:"button",onClick:()=>v(k),children:"listar assim mesmo"})]})]})]})}function YB({edits:e}){const t=Bc(),s=n=>()=>{t.close(),e.ask({kind:"create",parent:"",makes:n})};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",ref:t.triggerRef,className:"rp__icon","aria-haspopup":"menu","aria-expanded":t.open,"aria-label":"criar na raiz",title:"criar na raiz do checkout",onClick:t.toggle,children:"+"}),t.open&&a.jsx("div",{className:"rp__menu",ref:t.panelRef,children:a.jsxs(Oc,{label:"criar na raiz",children:[a.jsx(Pi,{glyph:a.jsx(Be,{children:"+"}),onSelect:s("file"),children:"novo arquivo"}),a.jsx(Pi,{glyph:a.jsx(Be,{children:"▤"}),onSelect:s("dir"),children:"nova pasta"})]})})]})}function GB({path:e,isDir:t,edits:s,onExpand:n}){const o=Bc(),l=d=>()=>{o.close(),n(e),s.ask({kind:"create",parent:e,makes:d})};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",ref:o.triggerRef,className:"fact","aria-haspopup":"menu","aria-expanded":o.open,"aria-label":`ações de ${e}`,onClick:o.toggle,children:"⋯"}),o.open&&a.jsx("div",{className:"frow-menu",ref:o.panelRef,children:a.jsxs(Oc,{label:`ações de ${e}`,children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(Pi,{glyph:a.jsx(Be,{children:"+"}),onSelect:l("file"),children:"novo arquivo"}),a.jsx(Pi,{glyph:a.jsx(Be,{children:"▤"}),onSelect:l("dir"),children:"nova pasta"}),a.jsx("div",{className:"frow-menu__sep",role:"separator"})]}),a.jsx(Pi,{glyph:a.jsx(Be,{children:"✎"}),onSelect:()=>{o.close(),s.ask({kind:"rename",path:e})},children:"renomear"}),a.jsx(Pi,{glyph:a.jsx(Be,{tone:"warn",children:"✕"}),onSelect:()=>{o.close(),s.ask({kind:"delete",path:e,directory:t})},children:"apagar"})]})})]})}function rw({depth:e,label:t,initial:s,hint:n,edits:o}){const[l,d]=j.useState(s),h=o.refusal!==null;return a.jsxs(a.Fragment,{children:[a.jsxs("form",{className:"fedit",onSubmit:f=>{f.preventDefault(),o.submit(l)},children:[a.jsx("span",{className:"frow__twist",style:{"--depth":e},"aria-hidden":"true"}),a.jsx("input",{className:`finput${h?" finput--error":""}`,"aria-label":t,"aria-invalid":h,value:l,autoFocus:!0,disabled:o.busy,onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Escape"&&o.cancel()}})]}),a.jsx("p",{className:`fhint${h?" fhint--error":""}`,style:{"--depth":e},role:h?"alert":void 0,children:o.refusal??n})]})}function QB({edits:e}){const{gesture:t,cancel:s}=e;if(j.useEffect(()=>{if(t.kind!=="delete")return;const f=m=>{m.key==="Escape"&&s()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[t.kind,s]),t.kind!=="delete")return null;const n=e.preview,o=n.data??null,l=o!==null&&o.kind==="dir"?o.files+o.dirs:null,d=o!==null&&o.kind==="dir"&&o.truncated,h=o===null?t.directory:o.kind==="dir";return a.jsx("div",{className:"fdim",role:"dialog","aria-modal":"true","aria-label":`apagar ${t.path}`,children:a.jsxs(s1,{title:h?"apagar esta pasta e o que tem dentro?":"apagar este arquivo?",children:[a.jsx("code",{className:"fdim__target",children:t.path}),n.isPending&&a.jsx("p",{className:"fdim__note",children:"consultando o git…"}),n.isError&&a.jsxs(Ce,{tone:"danger",children:["não deu para consultar o git: ",n.error.message,". Nada foi verificado sobre o que volta."]}),o!==null&&o.kind==="file"&&a.jsx(ZB,{path:t.path,tracked:o.tracked}),o!==null&&o.kind==="dir"&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"fdim__note",children:[d?"pelo menos ":"",ar(o.files)," ",o.files===1?"arquivo":"arquivos"," e"," ",ar(o.dirs)," ",o.dirs===1?"pasta":"pastas",", contando os subdiretórios.",d?" A contagem parou no teto do daemon.":""]}),a.jsx(XB,{path:t.path,files:o.files,untracked:o.untracked,truncated:o.truncated})]}),a.jsxs("div",{className:"fdim__actions",children:[a.jsx(J,{variant:"ghost",onClick:s,children:"cancelar"}),a.jsx(J,{variant:"danger",disabled:e.busy,onClick:e.confirm,children:l===null?"apagar":`apagar ${d?"pelo menos ":"as "}${ar(l)} ${l===1?"entrada":"entradas"}`})]}),e.refusal!==null&&a.jsx(Ce,{tone:"danger",children:e.refusal})]})})}function ZB({path:e,tracked:t}){return t?a.jsxs(Ce,{tone:"info",children:["o git tem uma cópia: ",a.jsxs("code",{children:["git checkout -- ",e]})," traz de volta o que está no índice."]}):a.jsxs(Ce,{tone:"danger",children:[a.jsx("strong",{children:"o git não confirmou ter uma cópia disto."})," Pode não haver nada que traga de volta — nem o histórico, nem esta janela."]})}function XB({path:e,files:t,untracked:s,truncated:n}){if(n)return a.jsxs(Ce,{tone:"danger",children:[a.jsx("strong",{children:s>0?`de pelo menos ${ar(t)}, ${ar(s)} o git não confirmou ter.`:"o git não foi consultado sobre tudo que está aqui dentro."})," ","O que a caminhada não alcançou também não foi verificado, e nada aqui promete que volte."]});if(s===0)return a.jsxs(Ce,{tone:"info",children:["o git tem cópia do que está aqui dentro: ",a.jsxs("code",{children:["git checkout -- ",e]})," traz de volta o que está no índice."]});const o=t-s;return a.jsxs(Ce,{tone:"danger",children:[a.jsxs("strong",{children:["de ",ar(t),", ",ar(s)," o git não confirmou ter."]})," ",o>0?`Nada garante que voltem; ${ar(o)} o git desfaz.`:"Nada garante que voltem."]})}function ar(e){return e.toLocaleString("pt-BR")}function Zl(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1).replace(".",",")} MB`}const TC="lumem.rightPanel",JB=360,e5=260,t5=720;function s5(){const e={open:!1,width:JB};try{const t=window.localStorage.getItem(TC);if(t===null)return e;const s=JSON.parse(t);if(typeof s!="object"||s===null)return e;const{open:n,width:o}=s;return{open:typeof n=="boolean"?n:e.open,width:typeof o=="number"?Wg(o):e.width}}catch{return e}}function aw(e){try{window.localStorage.setItem(TC,JSON.stringify(e))}catch{}}function Wg(e){return Math.min(t5,Math.max(e5,Math.round(e)))}const AC=j.createContext(null);function i5({children:e}){const[t,s]=j.useState(s5),n=j.useCallback(()=>{s(d=>{const h={...d,open:!d.open};return aw(h),h})},[]),o=j.useCallback(d=>{s(h=>{const f={...h,width:Wg(d)};return aw(f),f})},[]),l=j.useMemo(()=>({open:t.open,width:t.width,toggle:n,setWidth:o}),[t,n,o]);return a.jsx(AC.Provider,{value:l,children:e})}function vh(){const e=j.useContext(AC);if(e===null)throw new Error("useRightPanel precisa de um RightPanelProvider acima");return e}function n5({proposalCount:e=null,prBar:t,prBadge:s=null,tab:n,onSelectTab:o,changeCount:l,actions:d,onReload:h,onClose:f,onResize:m,dock:g,footLeft:v,footRight:y,children:x}){const S=j.useRef(!1),w=j.useRef(null),[k,E]=j.useState(!1),D=j.useCallback(A=>{var z;const N=(z=w.current)==null?void 0:z.getBoundingClientRect().right;N===void 0||!Number.isFinite(A)||m(Wg(N-A))},[m]);return j.useEffect(()=>{if(!k)return;const A=z=>{S.current&&(z.preventDefault(),D(z.clientX))},N=()=>{S.current=!1,E(!1)};return window.addEventListener("pointermove",A),window.addEventListener("pointerup",N),()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",N)}},[k,D]),a.jsxs("aside",{className:"rp","aria-label":"arquivos do checkout",ref:w,children:[a.jsx("span",{className:"rp__grip",role:"separator","aria-orientation":"vertical","aria-label":"largura da coluna",onPointerDown:A=>{A.preventDefault(),S.current=!0,E(!0)}}),t,a.jsxs("div",{className:"rp__bar",role:"tablist","aria-label":"conteúdo da coluna",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":n==="files",className:`rtab${n==="files"?" rtab--active":""}`,onClick:()=>o("files"),children:"Arquivos"}),a.jsxs("button",{type:"button",role:"tab","aria-selected":n==="changes",className:`rtab${n==="changes"?" rtab--active":""}`,onClick:()=>o("changes"),children:["Mudanças",l!==null&&l>0&&a.jsx("span",{className:"rtab__count",children:l})]}),a.jsxs("button",{type:"button",role:"tab","aria-selected":n==="memory",className:`rtab${n==="memory"?" rtab--active":""}`,onClick:()=>o("memory"),children:["Memória",e!==null&&e>0&&a.jsx("span",{className:"rtab__count",children:e})]}),s!==null&&a.jsxs("button",{type:"button",role:"tab","aria-selected":n==="pr",className:`rtab${n==="pr"?" rtab--active":""}`,onClick:()=>o("pr"),children:["PR",a.jsx("span",{className:`rtab__count rtab__count--${s.tone}`,children:s.text})]}),a.jsx("span",{className:"rp__spacer"}),d,a.jsxs("button",{type:"button",className:"rp__icon",onClick:h,title:"recarregar",children:["⟳",a.jsx("span",{className:"sr-only",children:"recarregar"})]}),a.jsxs("button",{type:"button",className:"rp__icon",onClick:f,title:"fechar a coluna",children:["›",a.jsx("span",{className:"sr-only",children:"fechar a coluna"})]})]}),a.jsxs("div",{className:"rp__body",children:[x,a.jsxs("div",{className:"rp__foot",children:[a.jsx("span",{children:v}),a.jsx("span",{className:"rp__spacer"}),a.jsx("span",{children:y})]}),g]})]})}const r5=2e3;function OC(e){return be({queryKey:fg(e.scopeType,e.scopeId),queryFn:()=>Q.scripts.status.query(e),refetchInterval:t=>{const s=t.state.data;return s&&[s.setup,s.run,s.test,s.teardown].some(o=>{var l;return(l=o.last)==null?void 0:l.running})?r5:!1}})}function a5(e){const t=$e(),s=()=>{t.invalidateQueries({queryKey:fg(e.scopeType,e.scopeId)}),t.invalidateQueries({queryKey:Oj})},n=Se({mutationFn:d=>Q.scripts.start.mutate({...e,phase:d}),onSettled:s}),o=Se({mutationFn:d=>Q.scripts.stop.mutate({...e,phase:d}),onSettled:s}),l=Se({mutationFn:()=>Q.scripts.trust.mutate(e),onSettled:s});return{start:n,stop:o,trust:l}}const o5=3e3;function RC(e){return{queryKey:oa(e.scopeType,e.scopeId),queryFn:()=>Q.session.listByScope.query(e),refetchInterval:o5}}function Vg(e){return be(RC(e))}function Yg(e){return xj({queries:e.map(RC),combine:t=>t.reduce((s,n)=>s+(n.data??[]).filter(o=>o.state==="running").length,0)})}function l5(e){return be({queryKey:OT(e),queryFn:()=>Q.session.listByTask.query({taskId:e})})}function Po(e){const t=$e(),s=()=>t.invalidateQueries({queryKey:oa(e.scopeType,e.scopeId)}),n=Se({mutationFn:()=>Q.session.createShell.mutate(e),onSuccess:s}),o=Se({mutationFn:d=>Q.session.createAgent.mutate({...e,...d}),onSuccess:s}),l=Se({mutationFn:d=>Q.session.close.mutate({id:d}),onSuccess:s});return{createShell:n,createAgent:o,close:l}}function c5({scope:e,dock:t,onAskAgent:s}){var h,f,m;const[n,o]=j.useState("run"),l=OC(e),d=a5(e);return t.open?a.jsxs("div",{className:"dock",style:{height:`${String(t.height)}px`},"data-testid":"run-dock",children:[a.jsx("span",{className:"dock__grip",role:"separator","aria-orientation":"horizontal","aria-label":"altura do rodapé",onPointerDown:t.beginResize}),a.jsxs("div",{className:"dock__bar",role:"tablist","aria-label":"execução do checkout",children:[a.jsx("button",{type:"button",className:"dock__fold",title:"recolher o rodapé","aria-label":"recolher o rodapé",onClick:t.toggle,children:"⌄"}),a.jsx(bd,{label:"Setup",active:n==="setup",dot:fp((h=l.data)==null?void 0:h.setup),onClick:()=>o("setup")}),a.jsx(bd,{label:"Run",active:n==="run",dot:fp((f=l.data)==null?void 0:f.run),onClick:()=>o("run")}),a.jsx(bd,{label:"Testes",active:n==="test",dot:fp((m=l.data)==null?void 0:m.test),onClick:()=>o("test")}),a.jsx(bd,{label:"Terminal",active:n==="terminal",onClick:()=>o("terminal")}),a.jsx("span",{className:"dock__spacer"}),a.jsxs("div",{className:"dock__acts",children:[n==="run"&&a.jsx(u5,{status:l.data,actions:d}),(n==="setup"||n==="test")&&a.jsx(d5,{phase:n,status:l.data,actions:d})]})]}),n==="terminal"?a.jsx(_5,{scope:e}):l.isError?a.jsx("div",{className:"dock__idle",role:"alert",children:a.jsx("span",{children:l.error.message})}):a.jsx(h5,{scope:e,phase:n,status:l.data,actions:d,onAskAgent:s})]}):a.jsx(g5,{scope:e,status:l.data,onOpen:t.toggle})}function fp(e){return e!=null&&e.last?e.last.running?"run":e.last.exitCode===0?"ok":"fail":null}function bd({label:e,active:t,dot:s=null,onClick:n}){return a.jsxs("button",{type:"button",role:"tab","aria-selected":t,className:`dtab${t?" dtab--active":""}`,onClick:n,children:[s!==null&&a.jsx("span",{className:`dtab__dot dtab__dot--${s}`,"data-testid":`dot-${e.toLowerCase()}`}),e]})}function u5({status:e,actions:t}){var o;const s=((o=e==null?void 0:e.run.last)==null?void 0:o.running)===!0,n=(e==null?void 0:e.port)??null;return s?a.jsxs(a.Fragment,{children:[n!==null&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"openbtn__from dock__note",children:n.source==="env"?"porta de LUMEM_RUN_PORT":"porta lida da saída"}),a.jsxs("a",{className:"openbtn",href:`http://127.0.0.1:${String(n.port)}`,target:"_blank",rel:"noreferrer",children:[a.jsx("span",{children:"Abrir"}),a.jsxs("span",{className:"openbtn__port",children:[":",n.port]})]})]}),a.jsx(J,{size:"sm",glyph:a.jsx("span",{className:"stopglyph",children:"⏹"}),disabled:t.stop.isPending,onClick:()=>t.stop.mutate("run"),children:"parar"})]}):a.jsx(J,{size:"sm",variant:"primary",disabled:(e==null?void 0:e.run.command)===null||t.start.isPending,onClick:()=>t.start.mutate("run"),children:"▶ rodar"})}function d5({phase:e,status:t,actions:s}){if(t===void 0||t[e].command===null)return null;const n=t[e].last;if((n==null?void 0:n.running)===!0)return a.jsx(J,{size:"sm",glyph:a.jsx("span",{className:"stopglyph",children:"⏹"}),onClick:()=>s.stop.mutate(e),children:"parar"});const o=n!==null&&n.exitCode!==0;return a.jsxs(J,{size:"sm",variant:o?"primary":"default",disabled:s.start.isPending,onClick:()=>s.start.mutate(e),children:["▶ ",n===null?"rodar":o?"tentar de novo":"rodar de novo"]})}function h5({scope:e,phase:t,status:s,actions:n,onAskAgent:o}){if(!s)return a.jsx("div",{className:"dock__idle",children:"lendo o checkout…"});const l=s[t].command;if(l===null)return a.jsx(m5,{scope:e,status:s,onAskAgent:o});if(!s.trusted)return a.jsx(p5,{status:s,phase:t,actions:n});const d=s[t].last,h=d!==null&&!d.running&&d.exitCode!==0;return a.jsxs(a.Fragment,{children:[t==="setup"&&h&&a.jsxs("div",{className:"dock__banner",role:"status",children:[a.jsx(Be,{tone:"warn",children:"⚠"}),a.jsxs("span",{children:[a.jsx("strong",{children:"A worktree foi criada; o setup dela falhou."})," Ela funciona — só não está preparada."]})]}),a.jsxs("div",{className:"dock__state",children:[d===null?a.jsx(kt,{children:"nunca rodou"}):d.running?a.jsxs(kt,{tone:"clean",dot:!0,children:["rodando · ",pc(d.startedAt)]}):a.jsxs(kt,{dot:!0,children:["saiu ",d.exitCode??"?"," · ",pc(d.finishedAt??d.startedAt)]}),a.jsx("span",{className:"dock__cmd",children:l}),a.jsx("span",{className:"dock__spacer"}),a.jsx("span",{className:"dock__note",children:s.reservedPort===null?"":`porta reservada :${String(s.reservedPort)}`})]}),d!==null&&!d.outputAvailable?a.jsx("div",{className:"dock__idle",children:a.jsx("span",{children:"A saída desta execução não existe mais — ela vivia na memória do daemon, e ele reiniciou desde então."})}):d===null?a.jsx("div",{className:"dock__idle",children:a.jsxs("span",{children:["Este checkout ainda não rodou ",t==="test"?"os testes":`o ${t}`,". O botão está ali em cima."]})}):a.jsx("div",{className:"dock__out",children:a.jsx(gh,{sessionId:d.sessionId,readOnly:!d.running},d.sessionId)})]})}function f5(e){return["Este checkout ainda não diz ao Lumem como rodar.","",`Escreva a tabela \`[scripts]\` em \`${e}\`, com as quatro fases:`,"","- `setup`: deixa um checkout novo pronto para trabalhar — instalar dependências, preparar banco, o que for. Precisa ser idempetente: rodar de novo não pode estragar nada.","- `run`: sobe a aplicação em primeiro plano (nada de daemon em background). Se ela aceitar porta configurável, use `$LUMEM_RUN_PORT` — é a porta que o Lumem reserva para este checkout, e é o que faz duas worktrees rodarem ao mesmo tempo.","- `test`: roda a suíte de testes do projeto, uma vez e até o fim (nada de modo watch — o rodapé quer um código de saída, não um processo que fica).","- `teardown`: desfaz o que sobrevive ao diretório — container, volume, porta presa. Se não houver nada assim, omita a linha.","","Antes de escrever, **leia o repositório** para descobrir os comandos de verdade: `package.json`, `Makefile`, `docker-compose.yml`, `README`, e o que mais existir. Não invente comando que não está lá; se não achar o de alguma fase, diga isso em vez de chutar.","","Cada valor é uma string só, executada pelo shell de login no diretório do checkout. Preserve o resto do arquivo — ele pode já ter o `id` do projeto dentro, e ele é do time.","","Não commite: eu reviso a mudança."].join(`
|
|
88
|
+
`)}function m5({scope:e,status:t,onAskAgent:s}){var f;const o=((f=Bo().data)==null?void 0:f[0])??null,{createAgent:l}=Po(e),d=Se({mutationFn:async()=>{if(o===null)throw new Error("nenhum agente conectado");return(await l.mutateAsync({agentConfigId:o.id})).id},onSuccess:m=>s==null?void 0:s(m,f5(t.file))}),h=j.useMemo(()=>["# o id já está aqui; o que falta é o resto",'id = "prj_…"',"","[scripts]",'setup = "./scripts/setup.sh"','run = "pnpm dev"','test = "pnpm test"','teardown = "./scripts/teardown.sh"'].join(`
|
|
89
|
+
`),[]);return a.jsxs("div",{className:"noscripts",children:[a.jsx("span",{className:"noscripts__t",children:"Este projeto não diz como rodar."}),a.jsxs("p",{className:"noscripts__d",children:["O Lumem lê os comandos de um arquivo ",a.jsx("strong",{children:"do repositório"}),", versionado junto com o código: quem clonar depois herda o mesmo setup, com Lumem ou sem. Enquanto ele não existir, as abas ",a.jsx("code",{children:"Setup"})," e ",a.jsx("code",{children:"Run"})," ficam vazias — o ",a.jsx("code",{children:"Terminal"})," continua funcionando."]}),a.jsx("span",{className:"noscripts__where",children:t.file}),a.jsx("pre",{className:"toml",children:h}),a.jsxs("div",{className:"noscripts__acts",children:[a.jsx(J,{size:"sm",variant:"primary",disabled:o===null||s===void 0||d.isPending,onClick:()=>d.mutate(),children:d.isPending?"abrindo a conversa…":"pedir para o agente criar"}),a.jsx(J,{size:"sm",onClick:()=>{var m;return void((m=navigator.clipboard)==null?void 0:m.writeText(h))},children:"copiar o exemplo"}),o===null&&a.jsx("span",{className:"trust__note",children:"conecte um agente na barra da esquerda para pedir — ou escreva o arquivo à mão"}),d.isError&&a.jsx("span",{className:"trust__note",role:"alert",children:d.error.message})]})]})}function p5({status:e,phase:t,actions:s}){return a.jsxs("div",{className:"trust",children:[a.jsxs("div",{className:"trust__head",children:[a.jsx("span",{className:"trust__glyph",children:"⚠"}),"Este comando vem do repositório, não de você."]}),a.jsx("p",{className:"trust__why",children:"Este projeto foi clonado de uma URL. O que está abaixo estava dentro dele, e vai rodar na sua máquina com as suas permissões."}),a.jsx("div",{className:"trust__cmd",children:e[t].command}),a.jsxs("div",{className:"trust__acts",children:[a.jsx(J,{size:"sm",variant:"primary",disabled:s.trust.isPending,onClick:()=>s.trust.mutate(),children:"confiar neste projeto"}),a.jsx("span",{className:"trust__note",children:"Vale para este projeto nesta máquina — e volta a perguntar se o comando mudar."})]})]})}function _5({scope:e}){const t=Vg(e),{createShell:s}=Po(e),[n,o]=j.useState(null),l=(t.data??[]).filter(f=>f.kind==="shell"&&f.state==="running"),d=l.find(f=>f.id===n)??l[0]??null;async function h(){const f=await s.mutateAsync();o(f.id)}return d==null?a.jsxs("div",{className:"dock__idle",children:[a.jsx("span",{children:"Nenhum terminal aberto neste checkout."}),a.jsx(J,{size:"sm",onClick:()=>void h(),children:"+ abrir terminal"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dock__state",children:[a.jsxs(kt,{tone:"clean",dot:!0,children:[l.length," viva",l.length>1?"s":""]}),a.jsxs("span",{className:"dock__cmd dock__cmd--dim",children:["cwd ",d.cwd]}),a.jsx("span",{className:"dock__spacer"}),a.jsx("button",{type:"button",className:"dock__new",onClick:()=>void h(),children:"+ outro terminal"})]}),a.jsx("div",{className:"dock__out",children:a.jsx(gh,{sessionId:d.id},d.id)})]})}function g5({scope:e,status:t,onOpen:s}){var l;const n=((l=t==null?void 0:t.run.last)==null?void 0:l.running)===!0,o=(t==null?void 0:t.port)??null;return a.jsx("div",{className:"dock dock--collapsed","data-testid":"run-dock-folded",children:a.jsxs("div",{className:"dock__folded",children:[a.jsx("button",{type:"button",className:"dock__fold","aria-label":"abrir o rodapé",onClick:s,children:"⌃"}),n?a.jsxs("span",{className:"runmark",children:[a.jsx("span",{className:"runmark__glyph",children:"▶"}),o===null?"run":`run · :${String(o.port)}`]}):a.jsx("span",{children:"setup, run e terminal"}),a.jsx("span",{className:"dock__spacer"}),a.jsx("span",{className:"dock__note",children:e.scopeType==="worktree"?"worktree":"projeto"})]})})}function v5({scope:e,onClose:t,onResize:s,dock:n,onAskAgent:o}){var ae,me,H,B;const l=$e(),[d,h]=j.useState("files"),[f,m]=j.useState("worktree"),g=Ug(),v=dB(e),y=_C(e,"worktree"),x=$g("pending"),S=UB(e),w=e.scopeType==="worktree"?e.scopeId:null,k=z3(w,{panelOpen:!0}),E=I3(e),D=H3(S.projectId),A=k.data??null,N=(A==null?void 0:A.pull)??null,z=A!==null&&w!==null&&!D.isDismissed,V=d==="pr"&&N===null?"files":d,ee=new Map((((ae=y.data)==null?void 0:ae.files)??[]).map(O=>[O.path,O.status])),$=g.activeTab===null?null:g.fileFor(g.activeTab);return a.jsxs(n5,{tab:V,onSelectTab:h,changeCount:((me=y.data)==null?void 0:me.files.length)??null,proposalCount:((H=x.data)==null?void 0:H.length)??null,prBar:z&&w!==null?a.jsx(tB,{status:A,worktreeId:w,onRetry:()=>E.mutate(),onDismiss:D.dismiss}):void 0,prBadge:N===null?null:oB(N),actions:V==="files"?a.jsx(YB,{edits:v}):void 0,onReload:()=>{l.invalidateQueries({queryKey:Tj}),l.invalidateQueries({queryKey:Nc}),E.mutate()},onClose:t,onResize:s,dock:a.jsx(c5,{scope:e,dock:n,onAskAgent:o}),footLeft:y.isError?"não deu para ler o checkout":void 0,footRight:V==="changes"?f==="worktree"?"árvore de trabalho vs HEAD":`vs ${((B=y.data)==null?void 0:B.baseBranch)??"base"}`:void 0,children:[V==="files"&&a.jsx(VB,{scope:e,openPath:($==null?void 0:$.view)==="file"?$.path:null,onOpen:O=>g.open({path:O,view:"file"}),statusOf:O=>ee.get(O),edits:v}),V==="changes"&&a.jsx($B,{scope:e,openPath:($==null?void 0:$.view)==="patch"?$.path:null,onOpenPatch:(O,se)=>g.open({path:O,view:"patch",ref:se}),onRefChange:m}),V==="pr"&&N!==null&&a.jsx(rB,{pull:N,readAt:(A==null?void 0:A.readAt)??null}),V==="memory"&&a.jsx(kC,{workspaceId:S.workspaceId,projectId:S.projectId})]})}const DC=j.createContext(null);function y5({children:e}){const[t,s]=j.useState(new Set),n=j.useCallback((l,d)=>{s(h=>{if(h.has(l)===d)return h;const f=new Set(h);return d?f.add(l):f.delete(l),f})},[]),o=j.useMemo(()=>({isWaiting:l=>t.has(l),countIn:l=>l.filter(d=>t.has(d)).length,setWaiting:n}),[t,n]);return a.jsx(DC.Provider,{value:o,children:e})}function Gg(){return j.useContext(DC)??{isWaiting:()=>!1,countIn:()=>0,setWaiting:()=>{}}}const Md={home:"/",tasks:"/tasks",settings:"/settings",menubar:"/menubar"};function b5(e){const t=MC(e);return t===Md.tasks?"tasks":t===Md.settings?"settings":t===Md.menubar?"menubar":"home"}function MC(e){var s;const t=((s=e.split("?")[0])==null?void 0:s.split("#")[0])??"/";return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}const I_="lumem:route";function sc(e,{replace:t=!1}={}){const s=Md[e];MC(window.location.pathname)!==s&&(t?window.history.replaceState(null,"",s):window.history.pushState(null,"",s),window.dispatchEvent(new Event(I_)))}function x5(e){return window.addEventListener("popstate",e),window.addEventListener(I_,e),()=>{window.removeEventListener("popstate",e),window.removeEventListener(I_,e)}}function Qg(){return j.useSyncExternalStore(x5,ow,ow)}function ow(){return b5(window.location.pathname)}let _i={selection:null,arrival:null,pendingDraft:null};const H_=new Set;function Io(e){_i=e;for(const t of H_)t()}function S5(e){return H_.add(e),()=>H_.delete(e)}function lw(){return _i}function xn(e){Io({..._i,selection:e}),sc("home",{replace:!0})}function Vr(){_i.selection===null&&_i.arrival===null&&_i.pendingDraft===null||Io({selection:null,arrival:null,pendingDraft:null})}function Ho(e){Io({..._i,arrival:e})}function w5(e){const t=_i.arrival;return t===null||t.sessionId!==e?null:(Io({..._i,arrival:null}),t)}function j5(e,t){Io({..._i,pendingDraft:{scope:e,text:t}})}function C5(e){const t=_i.pendingDraft;return t===null||t.scope.scopeType!==e.scopeType||t.scope.scopeId!==e.scopeId?null:(Io({..._i,pendingDraft:null}),t.text)}function Fo(){return j.useSyncExternalStore(S5,lw,lw)}function k5(e){var me;const t=Vg(e),s=$e(),[n,o]=j.useState(null),[l,d]=j.useState(new Set),[h,f]=j.useState(new Set),[m,g]=j.useState(null),[v,y]=j.useState([]),x=j.useMemo(()=>t.data??[],[t.data]),S=j.useMemo(()=>{const H=x.filter(O=>!h.has(O.id)&&(O.state==="running"||l.has(O.id))),B=new Map;return H.map(O=>{const se=O.agentName??"shell",re=O.multiAccount?O.agentAccountLabel:null,q=re===null?se:`${se} · ${re}`,M=(B.get(q)??0)+1;return B.set(q,M),{sessionId:O.id,label:q,agentName:se,kind:O.kind,state:O.state,exitCode:O.exitCode,command:O.command,transport:O.transport==="acp"?"acp":"pty",...M>1?{ordinal:M}:{},accountId:O.agentAccountId??null,accountLabel:re}})},[x,l,h]);j.useEffect(()=>{n!==null&&!S.some(H=>H.sessionId===n)&&!v.some(H=>H.id===n)&&o(null)},[S,v,n]),j.useEffect(()=>{m===null||!S.some(H=>H.sessionId===m)||(o(m),g(null))},[S,m]);const w=j.useCallback(H=>{g(null),o(H)},[]),k=j.useCallback((H="")=>{const B=`draft:${globalThis.crypto.randomUUID()}`;y(O=>[...O,{id:B,initialText:H}]),o(B)},[]),E=j.useCallback(H=>{y(B=>B.filter(O=>O.id!==H)),o(B=>B===H?null:B)},[]),{pendingDraft:D}=Fo();j.useEffect(()=>{const H=C5(e);H!==null&&k(H)},[e.scopeType,e.scopeId,D,k]);const A=j.useCallback(H=>{const B=x.find(O=>O.id===H);B===void 0||B.state==="running"||(f(O=>new Set(O).add(H)),d(O=>{const se=new Set(O);return se.delete(H),se}))},[x]),N=j.useCallback(H=>{f(B=>{const O=new Set(B);return O.delete(H),O}),d(B=>new Set(B).add(H)),o(H)},[]),z=Se({mutationFn:H=>Q.session.resume.mutate({id:H}),onSuccess:async H=>{g(H.id),await s.invalidateQueries({queryKey:oa(e.scopeType,e.scopeId)})}}),V=j.useCallback(H=>z.mutate(H),[z]),ee=Se({mutationFn:H=>Q.session.continueIn.mutate(H),onSuccess:async H=>{g(H.id),await s.invalidateQueries({queryKey:oa(e.scopeType,e.scopeId)})}}),$=j.useCallback((H,B)=>ee.mutate({sessionId:H,agentAccountId:B}),[ee]),ae=j.useCallback(H=>x.some(B=>B.id===H)?()=>N(H):null,[x,N]);return{tabs:S,drafts:v,activeId:n,select:w,close:A,reopen:N,resume:V,resuming:z.isPending?z.variables??null:null,resumeError:z.isError&&z.variables!==void 0?{sessionId:z.variables,message:z.error.message}:null,sessions:t,addDraft:k,closeDraft:E,continueIn:$,continuing:ee.isPending?((me=ee.variables)==null?void 0:me.sessionId)??null:null,continueError:ee.isError&&ee.variables!==void 0?{sessionId:ee.variables.sessionId,message:ee.error.message}:null,linkTo:ae}}const N5="modulepreload",E5=function(e){return"/"+e},cw={},Wt=function(t,s,n){let o=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.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"));o=d(s.map(m=>{if(m=E5(m),m in cw)return;cw[m]=!0;const g=m.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":N5,g||(y.as="script"),y.crossOrigin="",y.href=m,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((x,S)=>{y.addEventListener("load",x),y.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})},T5=800;function uw(e,t){if(e===t)return{added:0,removed:0};const s=e.split(`
|
|
90
|
+
`),n=t.split(`
|
|
91
|
+
`);let o=0;for(;o<s.length&&o<n.length&&s[o]===n[o];)o++;let l=0;for(;l<s.length-o&&l<n.length-o&&s[s.length-1-l]===n[n.length-1-l];)l++;return{added:n.length-o-l,removed:s.length-o-l}}function xd(e,t){return e.scopeType===t.scopeType&&e.scopeId===t.scopeId&&e.path===t.path}function A5(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function O5(e){return e instanceof Error?e.message:String(e)}function dw(e){return e===void 0||e.kind!=="text"?null:e}function R5({scope:e,path:t,active:s}){const n=$e(),o=j.useRef(null),l=j.useRef(null),d=j.useRef({scopeType:e.scopeType,scopeId:e.scopeId,path:t}),h=j.useRef(null),f=j.useRef(0),m=j.useRef(0),g=j.useRef(null),v=j.useRef(!1),y=j.useRef(!1),x=j.useRef(null),S=j.useRef(null),w=j.useRef(!1),k=j.useRef([]),[E,D]=j.useState({kind:"clean"}),[A,N]=j.useState(!0),z=j.useRef(!0),V=rd(e.scopeType,e.scopeId,t),ee=be({queryKey:V,queryFn:()=>{const Y=n.getQueryData(V);return!z.current&&Y!==void 0?(w.current=!0,Y):Q.files.read.query({scopeType:e.scopeType,scopeId:e.scopeId,path:t})},refetchOnWindowFocus:A}),$=dw(ee.data),ae=j.useRef(!1);ae.current=$===null||$.readOnly!==null;const me=j.useCallback(Y=>{z.current=Y,N(Y)},[]),H=j.useCallback(()=>{S.current!==null&&(window.clearTimeout(S.current),S.current=null)},[]),B=j.useCallback(Y=>{x.current=Y,D({kind:"stale",...Y})},[]),O=j.useCallback(()=>!v.current&&(g.current===null||y.current),[]),se=j.useCallback(()=>{if(!O())return;const Y=k.current;if(Y.length!==0){k.current=[];for(const de of Y)de()}},[O]),re=j.useCallback(Y=>{n.invalidateQueries({queryKey:Nc}),n.invalidateQueries({queryKey:mg(Y.scopeType,Y.scopeId,A5(Y.path))})},[n]),q=j.useCallback(()=>{if(v.current||y.current)return;const Y=g.current;Y!==null&&(g.current=null,v.current=!0,D({kind:"saving"}),n.cancelQueries({queryKey:rd(Y.target.scopeType,Y.target.scopeId,Y.target.path)}),Q.files.write.mutate({scopeType:Y.target.scopeType,scopeId:Y.target.scopeId,path:Y.target.path,text:Y.text,baseRevision:Y.baseRevision}).then(de=>{var xe,ze;if(!de.ok){if(!xd(Y.target,d.current))return;y.current=!0,H(),B({revision:de.revision,changedAt:de.changedAt,base:((xe=l.current)==null?void 0:xe.text)??Y.text,mine:((ze=o.current)==null?void 0:ze.getDoc())??Y.text,disk:null}),Q.files.read.query(Y.target).then(Et=>{const Xe=dw(Et),Ls=x.current;Xe===null||Ls===null||B({...Ls,disk:Xe})}).catch(()=>{});return}xd(Y.target,d.current)&&(l.current={text:Y.text,revision:de.revision},f.current===Y.version&&(m.current=Y.version,me(!0)),D({kind:"saved",at:Date.now()})),g.current!==null&&xd(g.current.target,Y.target)&&(g.current={...g.current,baseRevision:de.revision}),re(Y.target)}).catch(de=>{xd(Y.target,d.current)&&D({kind:"failed",why:O5(de)})}).finally(()=>{v.current=!1,q(),se()}))},[H,re,n,se,me,B]),M=j.useCallback(()=>{H();const Y=o.current,de=l.current,xe=h.current;Y===null||de===null||xe===null||f.current!==m.current&&(g.current={target:xe,text:Y.getDoc(),baseRevision:de.revision,version:f.current},q())},[H,q]),K=j.useCallback(()=>{if(y.current||(M(),O()))return Promise.resolve();const Y=new Promise(de=>{k.current.push(de)});return lB(Y),Y},[O,M]),fe=j.useCallback(()=>{if(f.current+=1,h.current=d.current,me(!1),y.current){const Y=x.current,de=o.current;Y!==null&&de!==null&&B({...Y,mine:de.getDoc()});return}H(),S.current=window.setTimeout(()=>{S.current=null,M()},T5)},[H,M,me,B]),Ae=j.useCallback(Y=>{var de;if(Y===null){K(),(de=o.current)==null||de.onChange(null),o.current=null;return}o.current=Y,!ae.current&&Y.onChange(fe)},[fe,K]),L=j.useCallback(()=>{M()},[M]),X=j.useCallback(()=>{const Y=x.current,de=h.current;if(Y===null||de===null)return;x.current=null,y.current=!1,m.current=f.current,me(!0),D({kind:"clean"});const xe=rd(de.scopeType,de.scopeId,de.path);if(Y.disk===null){n.invalidateQueries({queryKey:xe});return}n.setQueryData(xe,Y.disk)},[n,me]),ce=j.useCallback(()=>{const Y=x.current,de=o.current,xe=h.current;Y===null||de===null||xe===null||(x.current=null,y.current=!1,g.current={target:xe,text:de.getDoc(),baseRevision:Y.revision,version:f.current},q())},[q]);return j.useEffect(()=>{d.current={scopeType:e.scopeType,scopeId:e.scopeId,path:t},h.current=null,m.current=f.current,y.current=!1,x.current=null,l.current=null,me(!0),D({kind:"clean"})},[e.scopeType,e.scopeId,t,me]),j.useEffect(()=>{var Y;$!==null&&z.current&&(l.current={text:$.text,revision:$.revision},(Y=o.current)==null||Y.setDoc($.text))},[$]),j.useEffect(()=>{!A||!w.current||(w.current=!1,n.invalidateQueries({queryKey:rd(e.scopeType,e.scopeId,t)}))},[A,n,e.scopeType,e.scopeId,t]),j.useEffect(()=>{s||K()},[s,K]),j.useEffect(()=>{const Y=()=>void K();return window.addEventListener("blur",Y),()=>window.removeEventListener("blur",Y)},[K]),j.useEffect(()=>H,[H]),{content:ee,state:E,attach:Ae,retry:L,reload:X,overwrite:ce}}const LC="lumem",D5={name:LC,type:"dark",colors:{"editor.background":zt["bg/inset"],"editor.foreground":zt["text/code"]},settings:[{settings:{background:zt["bg/inset"],foreground:zt["text/code"]}},{scope:["comment","punctuation.definition.comment","string.comment"],settings:{foreground:zt["syntax/comment"]}},{scope:["string","string.quoted","constant.other.symbol","meta.embedded.line"],settings:{foreground:zt["syntax/string"]}},{scope:["constant.numeric","constant.language","constant.character","keyword.other.unit"],settings:{foreground:zt["syntax/number"]}},{scope:["keyword","storage","storage.type","keyword.operator.new","keyword.control"],settings:{foreground:zt["syntax/keyword"]}},{scope:["entity.name.function","support.function","meta.function-call","variable.function"],settings:{foreground:zt["syntax/function"]}},{scope:["entity.name.type","entity.name.class","support.type","support.class","entity.other.inherited-class"],settings:{foreground:zt["syntax/type"]}},{scope:["punctuation","meta.brace","keyword.operator"],settings:{foreground:zt["syntax/punctuation"]}},{scope:["markup.heading","entity.name.section"],settings:{foreground:zt["syntax/keyword"]}},{scope:["markup.inserted"],settings:{foreground:zt["git/added"]}},{scope:["markup.deleted"],settings:{foreground:zt["git/removed"]}}]},M5={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",json:"json",md:"markdown",css:"css",html:"html",yml:"yaml",yaml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",py:"python",sql:"sql",toml:"toml",diff:"diff",patch:"diff"},L5={typescript:()=>Wt(()=>import("./typescript-BPQ3VLAy.js"),[]),tsx:()=>Wt(()=>import("./tsx-COt5Ahok.js"),[]),javascript:()=>Wt(()=>import("./javascript-wDzz0qaB.js"),[]),jsx:()=>Wt(()=>import("./jsx-g9-lgVsj.js"),[]),json:()=>Wt(()=>import("./json-Cp-IABpG.js"),[]),markdown:()=>Wt(()=>import("./markdown-Cvjx9yec.js"),[]),css:()=>Wt(()=>import("./css-CLj8gQPS.js"),[]),html:()=>Wt(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2])),yaml:()=>Wt(()=>import("./yaml-Buea-lGh.js"),[]),shellscript:()=>Wt(()=>import("./shellscript-Yzrsuije.js"),[]),python:()=>Wt(()=>import("./python-B6aJPvgy.js"),[]),sql:()=>Wt(()=>import("./sql-CRqJ_cUM.js"),[]),toml:()=>Wt(()=>import("./toml-vGWfd6FD.js"),[]),diff:()=>Wt(()=>import("./diff-D97Zzqfu.js"),[]),docker:()=>Wt(()=>import("./docker-BcOcwvcX.js"),[]),make:()=>Wt(()=>import("./make-CHLpvVh8.js"),[])},hw={dockerfile:"docker",makefile:"make"};function B5(e){const t=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(t in hw)return hw[t];const s=t.lastIndexOf(".");return s<=0?null:M5[t.slice(s+1)]??null}let Sd=null,mp=null;const fw=new Set;async function z5(){if(Sd!==null)return Sd;mp??(mp=q5());try{return Sd=await mp,Sd}catch(e){throw mp=null,e}}async function q5(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t}]=await Promise.all([Wt(()=>import("./core-rofTMs1b.js"),[]),Wt(()=>import("./engine-javascript-DBd1bXLz.js"),[])]);return e({themes:[D5],langs:[],engine:t()})}async function P5(e){try{const t=await z5();if(!fw.has(e)){const s=L5[e];if(s===void 0)return null;const n=await s();await t.loadLanguage(n.default),fw.add(e)}return t}catch{return null}}function BC({path:e,headExtra:t,wrap:s,onToggleWrap:n,onClose:o,footLeft:l,footRight:d,children:h}){const f=e.lastIndexOf("/"),m=f===-1?"":e.slice(0,f+1),g=e.slice(f+1);return a.jsxs("div",{className:"viewer",children:[a.jsxs("div",{className:"viewer__head",children:[a.jsxs("span",{className:"fpath",title:e,children:[a.jsx("span",{className:"fpath__dir",children:m}),a.jsx("span",{className:"fpath__name",children:g})]}),t,a.jsx("span",{className:"viewer__spacer"}),a.jsxs("button",{type:"button",className:`rp__icon${s?" rp__icon--on":""}`,"aria-pressed":s,onClick:n,title:"quebrar linhas longas",children:["⇄",a.jsx("span",{className:"sr-only",children:"quebrar linhas longas"})]}),a.jsxs("button",{type:"button",className:"rp__icon",onClick:o,title:"fechar",children:["✕",a.jsx("span",{className:"sr-only",children:"fechar"})]})]}),h,a.jsxs("div",{className:"viewer__foot",children:[l,d===void 0?null:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"viewer__spacer"}),d]})]})]})}const mw={"inside-git":{chip:"dentro de .git",why:a.jsxs(a.Fragment,{children:["está dentro de ",a.jsx("code",{children:".git"}),": reescrever aqui destrói a worktree e o que ainda não foi commitado."]})},"not-writable":{chip:"sem permissão de escrita",why:a.jsx(a.Fragment,{children:"o daemon não consegue gravar neste arquivo, e a gravação atômica não serve de atalho para o modo que alguém deixou aqui."})},"not-utf8":{chip:"não é UTF-8",why:a.jsx(a.Fragment,{children:"os bytes deste arquivo não voltam iguais depois de uma ida e volta em UTF-8, e gravar trocaria o que não for representável por outra coisa."})}};function I5({scope:e,path:t,active:s,onClose:n}){const[o,l]=j.useState(!0),d=R5({scope:e,path:t,active:s}),h=d.content,f=B5(t),m=h.data,g=m===void 0?null:m.kind==="binary"?"binário":m.kind==="too-large"?"acima do teto":m.readOnly===null?null:mw[m.readOnly].chip,v=g===null&&(d.state.kind==="failed"||d.state.kind==="stale");return a.jsx(BC,{path:t,onClose:n,wrap:o,onToggleWrap:()=>l(x=>!x),footLeft:g===null?a.jsx(U5,{state:d.state,onRetry:d.retry}):a.jsxs("span",{className:"save save--readonly",children:[a.jsx("span",{className:"save__mark","aria-hidden":"true",children:"⊘"}),"somente leitura · ",g]}),footRight:v||m===void 0?void 0:m.kind==="text"?`${Zl(m.bytes)} · ${m.lines} linhas · ${f??"texto"}`:Zl(m.bytes),children:y()});function y(){if(h.isPending)return a.jsx("div",{className:"code",children:"carregando…"});if(h.isError)return a.jsxs("div",{className:"refuse",role:"alert",children:[a.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"⚠"}),a.jsx("span",{className:"refuse__title",children:"não deu para abrir"}),a.jsx("span",{className:"refuse__why",children:h.error.message})]});if(h.data.kind==="binary")return a.jsxs("div",{className:"refuse",children:[a.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▦"}),a.jsx("span",{className:"refuse__title",children:"arquivo binário"}),a.jsx("span",{className:"refuse__why",children:"tem bytes nulos nos primeiros KiB — o split não tenta desenhá-lo como texto, e não há buffer para editar."}),a.jsx("span",{className:"refuse__why",children:a.jsx("code",{children:t})})]});if(h.data.kind==="too-large")return a.jsxs("div",{className:"refuse",children:[a.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▤"}),a.jsxs("span",{className:"refuse__title",children:[Zl(h.data.bytes)," passa do teto de ",Zl(h.data.limit)]}),a.jsx("span",{className:"refuse__why",children:"o daemon não leu o arquivo — sem leitura não há revisão, e sem revisão não haveria contra o que gravar."}),a.jsx("span",{className:"refuse__why",children:a.jsx("code",{children:t})})]});const x=h.data.readOnly;return a.jsxs(a.Fragment,{children:[x!==null&&a.jsxs("div",{className:"robar",children:[a.jsx("span",{className:"robar__glyph","aria-hidden":"true",children:"⊘"}),a.jsx("span",{children:mw[x].why})]}),d.state.kind==="stale"&&a.jsx(H5,{conflict:d.state,onReload:d.reload,onOverwrite:d.overwrite}),a.jsx($5,{path:t,text:h.data.text,language:f,readOnly:x!==null,wrap:o,onReady:d.attach})]})}}function H5({conflict:e,onReload:t,onOverwrite:s}){const n=uw(e.base,e.mine),o=e.disk===null?null:uw(e.base,e.disk.text);return a.jsxs("div",{className:"conflict",role:"alert",children:[a.jsxs("div",{className:"conflict__head",children:[a.jsx("span",{className:"conflict__glyph","aria-hidden":"true",children:"⚠"}),"o agente escreveu este arquivo há ",a.jsx(zC,{at:e.changedAt})]}),a.jsx("p",{className:"conflict__why",children:"O disco não é mais o que você abriu, e o que você digitou ainda não foi para lá."}),a.jsxs("div",{className:"conflict__exits",children:[a.jsxs("button",{type:"button",className:"exit",onClick:t,children:[a.jsx("span",{className:"exit__what",children:"recarregar do disco"}),a.jsxs("span",{className:"exit__cost",children:["perde ",F5(n)]})]}),a.jsxs("button",{type:"button",className:"exit",onClick:s,children:[a.jsx("span",{className:"exit__what",children:"sobrescrever"}),a.jsxs("span",{className:"exit__cost",children:["perde a edição do agente",o===null?"":` (+${o.added} −${o.removed})`]})]})]})]})}function F5(e){const t=e.added>0?"digitou":"apagou",s=e.added>0?e.added:e.removed;return s===0?"nada: o seu texto é igual ao que você abriu":s===1?`a linha que você ${t}`:`as ${s} linhas que você ${t}`}function U5({state:e,onRetry:t}){return e.kind==="clean"?null:e.kind==="saving"?a.jsx(wd,{tone:"saving",children:"salvando…"}):e.kind==="saved"?a.jsxs(wd,{tone:"saved",children:["salvo há ",a.jsx(zC,{at:e.at})]}):e.kind==="failed"?a.jsxs(a.Fragment,{children:[a.jsx(wd,{tone:"failed",children:"não deu para salvar"}),a.jsx("span",{className:"save__why",title:e.why,children:e.why}),a.jsx("button",{type:"button",className:"save__act",onClick:t,children:"tentar de novo"})]}):a.jsxs(a.Fragment,{children:[a.jsx(wd,{tone:"stale",children:"mudou no disco"}),a.jsx("span",{className:"save__why",children:"o autosave parou até você escolher"})]})}function wd({tone:e,children:t}){return a.jsxs("span",{className:`save save--${e}`,children:[a.jsx("span",{className:"save__dot","aria-hidden":"true"}),t]})}function zC({at:e}){const[t,s]=j.useState(e);j.useEffect(()=>{s(Date.now());const o=window.setInterval(()=>s(Date.now()),1e3);return()=>window.clearInterval(o)},[e]);const n=Math.max(0,Math.round((t-e)/1e3));return a.jsx(a.Fragment,{children:n<60?`${n} s`:`${Math.floor(n/60)} min`})}function $5({path:e,text:t,language:s,readOnly:n,wrap:o,onReady:l}){const d=j.useRef(null),h=j.useRef(null),f=j.useRef(null),m=j.useRef({text:t,wrap:o});return j.useEffect(()=>{m.current.text=t},[t]),j.useEffect(()=>{var g;m.current.wrap=o,(g=h.current)==null||g.setWrap(o)},[o]),j.useEffect(()=>{const g=d.current;if(g===null)return;let v=!0;return Wt(async()=>{const{mountEditor:y}=await import("./codemirror-setup-Dz1snhDw.js");return{mountEditor:y}},[]).then(({mountEditor:y})=>{v&&(h.current=y(g,{doc:m.current.text,wrap:m.current.wrap,readOnly:n}),h.current.setHighlight(f.current),l(h.current))}),()=>{var y;v=!1,l(null),(y=h.current)==null||y.destroy(),h.current=null}},[e,n,l]),j.useEffect(()=>{var v;if(f.current=null,(v=h.current)==null||v.setHighlight(null),s===null)return;let g=!0;return P5(s).then(y=>{var x;!g||y===null||(f.current={highlighter:y,language:s,theme:LC},(x=h.current)==null||x.setHighlight(f.current))}),()=>{g=!1}},[s]),a.jsx("div",{className:"cmhost",ref:d,"data-testid":"editor"})}function qC({lines:e,wrap:t=!0}){return a.jsx("div",{className:`patch${t?"":" patch--nowrap"}`,children:e.map((s,n)=>s.kind==="hunk"?a.jsx("div",{className:"hunk",children:s.text},n):a.jsxs("div",{className:`dl${s.kind==="add"?" dl--add":s.kind==="del"?" dl--del":""}`,children:[a.jsx("span",{className:"dl__sig","aria-hidden":"true",children:s.kind==="add"?"+":s.kind==="del"?"−":" "}),a.jsx("span",{className:"dl__t",children:s.text})]},n))})}function K5(e,t){const s=pw(e??""),n=pw(t);let o=0;for(;o<s.length&&o<n.length&&s[o]===n[o];)o+=1;let l=0;for(;l<s.length-o&&l<n.length-o&&s[s.length-1-l]===n[n.length-1-l];)l+=1;const d=s.slice(o,s.length-l),h=n.slice(o,n.length-l),f=[];o>0&&f.push({kind:"context",text:`… ${o} linha(s) acima, sem mudança`});for(const m of d)f.push({kind:"del",text:m});for(const m of h)f.push({kind:"add",text:m});return l>0&&f.push({kind:"context",text:`… ${l} linha(s) abaixo, sem mudança`}),f}function pw(e){if(e==="")return[];const t=e.split(`
|
|
92
|
+
`);return t.at(-1)===""&&t.pop(),t}function W5({scope:e,path:t,changeRef:s,onClose:n}){const[o,l]=j.useState(!0),d=be({queryKey:eT(e.scopeType,e.scopeId,s,t),queryFn:()=>Q.changes.patch.query({scopeType:e.scopeType,scopeId:e.scopeId,ref:s,path:t}),refetchOnWindowFocus:!0}),h=d.data===void 0?[]:V5(d.data.patch),f=h.filter(g=>g.kind==="hunk").length;return a.jsx(BC,{path:t,onClose:n,wrap:o,onToggleWrap:()=>l(g=>!g),footLeft:s==="worktree"?"não commitado · vs HEAD":"vs base",footRight:f===0?void 0:`${f} ${f===1?"hunk":"hunks"}`,children:m()});function m(){return d.isPending?a.jsx("div",{className:"patch",children:"carregando…"}):d.isError?a.jsxs("div",{className:"refuse",role:"alert",children:[a.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"⚠"}),a.jsx("span",{className:"refuse__title",children:"não deu para ler o diff"}),a.jsx("span",{className:"refuse__why",children:d.error.message})]}):d.data.binary?a.jsxs("div",{className:"refuse",children:[a.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▦"}),a.jsx("span",{className:"refuse__title",children:"arquivo binário"}),a.jsx("span",{className:"refuse__why",children:"o git conta linhas, e aqui não há linhas para contar."})]}):h.length===0?a.jsxs("div",{className:"empty empty--right-panel",children:[a.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"✓"}),a.jsx("span",{className:"empty__title",children:"sem diferenças neste arquivo"})]}):a.jsx(qC,{lines:h,wrap:o})}}function V5(e){var n,o;const t=[];let s=!1;for(const l of e.split(`
|
|
93
|
+
`)){if(l.startsWith("@@")){s=!0,t.push({kind:"hunk",text:l});continue}s&&(l.startsWith("\\")||(l.startsWith("+")?t.push({kind:"add",text:l.slice(1)}):l.startsWith("-")?t.push({kind:"del",text:l.slice(1)}):(l!==""||t.length>0)&&t.push({kind:"context",text:l.slice(1)})))}return((n=t.at(-1))==null?void 0:n.kind)==="context"&&((o=t.at(-1))==null?void 0:o.text)===""&&t.pop(),t}const Y5=.2,G5=.8;function PC({children:e,viewer:t}){const[s,n]=j.useState(.5),o=j.useRef(null),[l,d]=j.useState(!1),h=j.useCallback(f=>{var v;const m=(v=o.current)==null?void 0:v.getBoundingClientRect();if(m===void 0||m.width===0||!Number.isFinite(f))return;const g=(f-m.left)/m.width;n(Math.min(G5,Math.max(Y5,g)))},[]);return j.useEffect(()=>{if(!l)return;const f=g=>{g.preventDefault(),h(g.clientX)},m=()=>d(!1);return window.addEventListener("pointermove",f),window.addEventListener("pointerup",m),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",m)}},[l,h]),t===null?a.jsx(a.Fragment,{children:e}):a.jsxs("div",{className:"split",ref:o,children:[a.jsx("div",{className:"split__side split__side--term",style:{flexGrow:s},children:e}),a.jsx("span",{className:"split__grip",role:"separator","aria-orientation":"vertical","aria-label":"largura do arquivo aberto",onPointerDown:f=>{f.preventDefault(),d(!0)}}),a.jsx("div",{className:"split__side split__side--viewer",style:{flexGrow:1-s},children:t})]})}function F_({scope:e,crumb:t,checkout:s,context:n,cwd:o}){const{tabs:l,drafts:d,activeId:h,select:f,close:m,reopen:g,continueIn:v,continuing:y,continueError:x,linkTo:S,resume:w,resuming:k,resumeError:E,sessions:D,addDraft:A,closeDraft:N}=k5(e),z=Gg(),V=Ug(),ee=vh(),{arrival:$,selection:ae}=Fo(),me=(ae==null?void 0:ae.projectId)??null,H=j.useRef(null);j.useEffect(()=>{$===null||H.current===$.sessionId||l.some(M=>M.sessionId===$.sessionId)&&(H.current=$.sessionId,f($.sessionId))},[$,l,f]);const B=sw(e.scopeType,e.scopeId,h);j.useEffect(()=>{V.setActiveTab(B)},[B,V.setActiveTab]);function O(M){const K=sw(e.scopeType,e.scopeId,M),fe=V.fileFor(K);return fe===null?null:fe.view==="patch"?a.jsx(W5,{scope:e,path:fe.path,changeRef:fe.ref??"worktree",onClose:()=>V.close(K)}):a.jsx(I5,{scope:e,path:fe.path,active:M===h,onClose:()=>V.close(K)})}const{close:se}=Po(e),re=D.data??[],q=new Set(l.map(M=>M.sessionId));return a.jsxs("section",{className:"scope",children:[a.jsx("div",{className:"scope__crumb",children:t}),a.jsxs(yO,{label:`sessões de ${o}`,lead:a.jsx(Qm,{label:s.name,glyph:s.glyph,active:h===null,onSelect:()=>f(null),...s.state!==void 0?{state:s.state}:{},...s.stateLabel!==void 0?{stateLabel:s.stateLabel}:{}}),action:a.jsx(o4,{scopeType:e.scopeType,scopeId:e.scopeId,onCreated:M=>f(M),onNewAgent:A}),end:a.jsx(bO,{label:"a coluna de arquivos",pressed:ee.open,onToggle:ee.toggle,children:"▤"}),children:[l.map(M=>a.jsx(Qm,{label:M.label,ordinal:M.ordinal,glyph:a.jsx(Be,{tone:M.kind==="agent"?"agent":"shell",children:M.kind==="agent"?"◆":"●"}),state:z.isWaiting(M.sessionId)?"asking":M.state==="running"?"running":M.exitCode===0?"exited":"failed",note:M.state==="running"?void 0:"registro",active:h===M.sessionId,onSelect:()=>f(M.sessionId),onClose:()=>{M.state==="running"?se.mutate(M.sessionId):m(M.sessionId)}},M.sessionId)),d.map(M=>a.jsx(Qm,{label:"rascunho",glyph:a.jsx(Be,{tone:"agent",children:"◆"}),active:h===M.id,onSelect:()=>f(M.id),onClose:()=>N(M.id)},M.id))]}),a.jsx("div",{className:"pane",role:"tabpanel",hidden:h!==null,"aria-label":s.name,children:a.jsxs(PC,{viewer:O(null),children:[se.isError&&a.jsx("div",{className:"detail__banner",children:a.jsx(Ce,{tone:"danger",children:se.error.message})}),n,a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"Sessões",count:re.length===0?0:`${re.length} · ${re.filter(M=>M.state==="running").length} rodando`}),re.length===0?a.jsx("p",{className:"detail__hint",children:"nenhuma sessão aberta aqui"}):re.map(M=>{const K=M.state==="running",fe=q.has(M.id),Ae=M.kind==="agent"&&M.transport!=="acp";return a.jsx(n1,{name:M.agentName??M.scriptName??"shell",glyph:a.jsx(Be,{tone:M.kind==="agent"?"agent":"shell",children:M.kind==="agent"?"◆":M.kind==="script"?"▶":"●"}),detail:M.command,state:K?{label:"running",tone:"running"}:{label:`exited (${M.exitCode??"?"})`,tone:M.exitCode===0?"exited":"failed"},age:pc(M.createdAt),onSelect:fe?()=>f(M.id):void 0,action:fe||Ae?void 0:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>g(M.id),children:M.transport==="acp"?"reabrir":"ver registro"})},M.id)})]})]})}),l.map(M=>a.jsx(zz,{tab:M,scope:e,cwd:o,onStarted:f,active:h===M.sessionId,viewer:O(M.sessionId),...M.transport==="acp"?{onResume:()=>w(M.sessionId)}:{},resuming:k===M.sessionId,...(E==null?void 0:E.sessionId)===M.sessionId?{resumeError:E.message}:{},...M.transport==="acp"?{onContinueIn:K=>v(M.sessionId,K)}:{},continuing:y===M.sessionId,...(x==null?void 0:x.sessionId)===M.sessionId?{continueError:x.message}:{},sessionLink:S},M.sessionId)),d.map(M=>a.jsx(Gz,{scope:e,projectId:me,worktreeName:s.name,active:h===M.id,initialText:M.initialText,onCreated:K=>{N(M.id),f(K)}},M.id))]})}function Q5({projectId:e}){var d,h;const[t,s]=j.useState("7d"),n=E6(e,t),o=(((d=n.data)==null?void 0:d.worktrees)??[]).map(f=>({id:f.worktreeId,name:f.name,tokens:f.tokens,cost:f.cost,currency:f.currency,turns:f.turns,kind:"worktree"})),l=(h=n.data)==null?void 0:h.outside;return l!==void 0&&(l.turns>0||o.length>0)&&o.push({id:"__outside__",name:"direto no projeto",tokens:l.tokens,cost:l.cost,currency:l.currency,turns:l.turns,kind:"project",outside:!0}),a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"Consumo por worktree",aside:a.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo do projeto",children:vk.map(f=>a.jsx("button",{type:"button",className:"seg__btn","aria-pressed":t===f.id,onClick:()=>s(f.id),children:f.label},f.id))})}),n.isError?a.jsx(Ce,{tone:"danger",children:n.error.message}):n.isPending?a.jsx("p",{className:"detail__hint",children:"somando o consumo…"}):o.length===0?a.jsx("p",{className:"detail__hint",children:"nada gasto ainda neste projeto"}):a.jsx(yk,{rows:o})]})}function Z5(e,t){const s=[];return e===null?s.push("as worktrees dele"):e>0&&s.push(e===1?"1 worktree":`${e} worktrees`),t>0&&s.push(t===1?"1 tarefa":`${t} tarefas`),s.join(" e ")}function X5(e,t,s){const n=Z5(t,s);return n===""?`remover ${e} da lista?`:`remover ${e} da lista, e o registro de ${n}?`}function J5({projectId:e,workspaceId:t,workspaceName:s,onRemoved:n,onOpenWorkspace:o,onSelectWorktree:l}){var D,A,N;const d={scopeType:"project",scopeId:e},h=t1(e),f=iv(e,{enabled:((D=h.data)==null?void 0:D.available)===!0}),m=jg(t,{projectId:e}),[g,v]=j.useState(!1),{remove:y}=xg(t);if(g&&h.data)return a.jsx(e4,{project:h.data,worktrees:((A=f.data)==null?void 0:A.length)??null,tasks:((N=m.data)==null?void 0:N.length)??0,pending:y.isPending,error:y.isError?y.error.message:null,onCancel:()=>{v(!1),y.reset()},onConfirm:()=>y.mutate(e,{onSuccess:n})});if(h.isPending)return a.jsx("div",{className:"pane",children:a.jsx(ss,{label:"carregando o projeto"})});if(!h.data)return a.jsx("div",{className:"pane",children:a.jsx("p",{role:"alert",children:"projeto não encontrado"})});const{name:x,path:S,defaultBranch:w,available:k}=h.data,E=f.data??[];return a.jsx(F_,{scope:d,cwd:S,crumb:a.jsxs("nav",{className:"crumb","aria-label":"Caminho",children:[a.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:o,children:s}),a.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),x,a.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),a.jsx("span",{className:"crumb__here",children:"local"})]}),checkout:{name:"local",glyph:a.jsx(Be,{tone:k?"project":"off",children:"▭"})},context:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"detail__title",children:[a.jsxs("h2",{children:[a.jsx(Be,{tone:k?"project":"off",children:"▭"})," local"]}),a.jsx("span",{className:"detail__kind",children:"checkout do projeto"}),a.jsx("span",{className:"actions__spacer"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(!0),disabled:y.isPending,children:y.isPending?"removendo…":"remover projeto"})]}),k?a.jsx("div",{className:"detail__banner",children:a.jsxs(Ce,{tone:"info",children:[a.jsx("strong",{children:"Este é o repositório em si, não uma worktree do Lumem."})," Remover o projeto tira o registro — o diretório e o que está dentro dele ficam no disco."]})}):a.jsx("div",{className:"detail__banner",children:a.jsxs(Ce,{tone:"danger",children:[a.jsxs("strong",{children:["O repositório não está mais em ",S,"."]})," As ações sobre ele ficam bloqueadas até que ele volte; o registro continua aqui."]})}),y.isError&&a.jsx("div",{className:"detail__banner",children:a.jsx(Ce,{tone:"danger",children:y.error.message})}),a.jsx(va,{entries:[{label:"branch base",value:a.jsxs(a.Fragment,{children:[a.jsx(kt,{tone:"branch",dot:!0,children:w})," ",a.jsx("span",{className:"dim",children:"resolvida na adição"})]})},{label:"caminho",value:a.jsx(i1,{path:S})},...k?[{label:"worktrees",value:a.jsxs("span",{className:"dim",children:[E.length," ",E.length===1?"worktree":"worktrees"]})}]:[]]}),k&&a.jsxs(a.Fragment,{children:[a.jsx(Q5,{projectId:e}),a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"Worktrees deste projeto",count:E.length}),E.length===0?a.jsx("p",{className:"detail__hint",children:"nenhuma worktree ainda"}):E.map(z=>a.jsx(n1,{name:z.name,glyph:a.jsx(Be,{tone:z.state==="missing"?"warn":"worktree",children:z.state==="missing"?"⚠":"◇"}),detail:z.path,state:z.state==="missing"?{label:"ausente",tone:"missing"}:void 0,onSelect:()=>l(z.id)},z.id))]})]})]})})}function e4({project:e,worktrees:t,tasks:s,pending:n,error:o,onCancel:l,onConfirm:d}){return a.jsx("div",{className:"pane",children:a.jsxs("div",{className:"remove-confirm",role:"alertdialog","aria-label":"confirmar remoção",children:[e.managed?a.jsxs(a.Fragment,{children:[a.jsxs("h2",{className:"remove-confirm__title",children:["apagar ",e.name," do disco?"]}),a.jsxs("p",{className:"remove-confirm__body",children:["Este projeto foi clonado pelo Lumem. Remover tira do registro ",a.jsx("strong",{children:"e apaga o diretório"}),". Não dá para desfazer."]}),a.jsx("p",{className:"remove-confirm__path",children:e.path})]}):a.jsxs(a.Fragment,{children:[a.jsx("h2",{className:"remove-confirm__title",children:X5(e.name,t,s)}),a.jsxs("p",{className:"remove-confirm__body",children:["Este projeto aponta para um repositório ",a.jsx("strong",{children:"seu"}),". Sai da lista; o diretório fica exatamente onde está — o dele e o de cada worktree, com trabalho não commitado e tudo."]})]}),o!==null&&a.jsx(Ce,{tone:"danger",children:o}),a.jsxs("div",{className:"remove-confirm__actions",children:[a.jsx(J,{variant:e.managed?"danger":"primary",onClick:d,disabled:n,children:n?"removendo…":e.managed?"apagar":"remover"}),a.jsx(J,{variant:"ghost",onClick:l,children:"cancelar"})]})]})})}function t4({worktreeId:e,projectId:t,workspaceName:s,onRemoved:n,onOpenWorkspace:o,onOpenProject:l}){var H,B;const d=$e(),[h,f]=j.useState(!1),m=p6(e),g=RO(e),v=(H=d.getQueryData(Do(t)))==null?void 0:H.find(O=>O.id===e),y=t1(t),{remove:x}=mk(t),S={scopeType:"worktree",scopeId:e};function w(O,se){var re;return a.jsxs("nav",{className:"crumb","aria-label":"Caminho",children:[a.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:o,children:s}),a.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),a.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:l,children:((re=y.data)==null?void 0:re.name)??"…"}),a.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),a.jsx("span",{className:"crumb__here",children:O}),se!==O&&a.jsx("span",{className:"crumb__branch",children:se})]})}if(m.isPending)return v===void 0?a.jsx("div",{className:"pane",children:a.jsx(ss,{label:"carregando a worktree"})}):a.jsx(F_,{scope:S,cwd:v.path,crumb:w(v.name,v.branch),checkout:{name:v.name,glyph:a.jsx(Be,{tone:"worktree",children:"◇"})},context:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"detail__title",children:[a.jsxs("h2",{children:[a.jsx(Be,{tone:"worktree",children:"◇"})," ",v.name]}),a.jsx("span",{className:"detail__kind",children:"worktree"})]}),a.jsx(ss,{label:"carregando a worktree"})]})});if(m.isError)return a.jsx("div",{className:"pane",children:a.jsx(Ce,{tone:"danger",children:m.error.message})});const{name:k,branch:E,path:D,state:A,present:N,status:z,aheadBehind:V,baseBranch:ee,createdAt:$}=m.data,ae=!N||A==="missing",me=ae||z===null||z.clean?null:z.changedFiles;return a.jsx(F_,{scope:S,cwd:D,crumb:w(k,E),checkout:{name:k,glyph:a.jsx(Be,{tone:ae?"warn":"worktree",children:ae?"⚠":"◇"}),...me===null?{}:{state:"dirty",stateLabel:`árvore suja · ${me} ${me===1?"arquivo":"arquivos"}`}},context:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"detail__title",children:[a.jsxs("h2",{children:[a.jsx(Be,{tone:ae?"warn":"worktree",children:ae?"⚠":"◇"})," ",k]}),a.jsx("span",{className:"detail__kind",children:ae?"worktree ausente":"worktree"}),a.jsx("span",{className:"actions__spacer"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>x.mutate({id:e,force:!1},{onSuccess:n,onError:()=>f(!0)}),disabled:x.isPending,children:x.isPending?"removendo…":"remover worktree"})]}),h&&a.jsx("div",{className:"detail__banner",children:a.jsx(Ce,{tone:"danger",actions:a.jsxs(a.Fragment,{children:[a.jsx(J,{size:"sm",variant:"danger",onClick:()=>x.mutate({id:e,force:!0},{onSuccess:n}),disabled:x.isPending,children:"remover mesmo assim"}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>f(!1),children:"cancelar"})]}),children:((B=x.error)==null?void 0:B.message)??"isso descarta as alterações não salvas."})}),ae&&a.jsx("div",{className:"detail__banner",children:a.jsxs(Ce,{tone:"warning",children:["O diretório não está em ",a.jsx("code",{children:D}),". Remover aqui só apaga o registro; a branch ",a.jsx("code",{children:E})," continua existindo."]})}),a.jsx(va,{entries:[{label:"branch",value:a.jsxs(a.Fragment,{children:[a.jsx(kt,{tone:"branch",dot:!0,children:E})," ",a.jsxs("span",{className:"dim",children:["nasceu de ",ee]})]})},{label:"tarefa",value:g.data==null?a.jsx("span",{className:"ctx-task--none",children:"sem tarefa"}):a.jsxs("span",{className:`ctx-task trow--${g.data.status}`,children:[a.jsx("span",{className:"task-status__dot","aria-hidden":"true"}),a.jsx("span",{className:"ctx-task__t",children:g.data.title})]})},...ae?[]:[{label:`em relação a ${ee}`,value:V===null?"desconhecido":a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"ahead",children:["↑",V.ahead]})," ",a.jsxs("span",{className:"behind",children:["↓",V.behind]})," ",a.jsxs("span",{className:"dim",children:[V.ahead," à frente, ",V.behind," atrás"]})]})}],{label:"estado",value:ae?a.jsx(kt,{tone:"missing",dot:!0,children:"ausente do disco"}):z===null?a.jsx(kt,{children:"estado desconhecido"}):z.clean?a.jsx(kt,{tone:"clean",dot:!0,children:"limpa"}):a.jsxs(kt,{tone:"dirty",dot:!0,children:["suja · ",z.changedFiles," ",z.changedFiles===1?"arquivo":"arquivos"]})},{label:"caminho",value:a.jsx(i1,{path:D})},...ae?[]:[{label:"criada",value:a.jsx("span",{className:"dim",children:pc($)})}]]}),a.jsx("p",{className:"detail__hint",children:"a branch não é apagada"})]})})}const IC="lumem.runDock",HC=96;function s4(e=window.innerHeight){return Zg(Math.round(e/2),e)}function i4(e=window.innerHeight){return Math.max(HC,e-160)}const _w=640;function Zg(e,t=window.innerHeight){return Math.min(i4(t),Math.max(HC,Math.round(e)))}function n4(){const e={open:!0,height:s4()};try{const t=window.localStorage.getItem(IC);if(t===null)return e;const s=JSON.parse(t);if(typeof s!="object"||s===null)return e;const{open:n,height:o}=s;return{open:typeof n=="boolean"?n:e.open,height:typeof o=="number"?Zg(o):e.height}}catch{return e}}function gw(e){try{window.localStorage.setItem(IC,JSON.stringify(e))}catch{}}function r4(e,t){return{...e,toggle:()=>{!e.open&&t.width<_w&&t.setWidth(_w),e.toggle()}}}function a4(){const[e,t]=j.useState(n4),[s,n]=j.useState(!1),o=j.useCallback(h=>{t(f=>{const m={...f,height:Zg(h)};return gw(m),m})},[]),l=j.useCallback(()=>{t(h=>{const f={...h,open:!h.open};return gw(f),f})},[]);j.useEffect(()=>{if(!s)return;const h=m=>{m.preventDefault(),o(window.innerHeight-m.clientY)},f=()=>n(!1);return window.addEventListener("pointermove",h),window.addEventListener("pointerup",f),()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",f)}},[s,o]);const d=j.useCallback(h=>{h.preventDefault(),n(!0)},[]);return{open:e.open,height:e.height,toggle:l,setHeight:o,beginResize:d}}function o4({scopeType:e,scopeId:t,onCreated:s,onNewAgent:n,newAgentBlocked:o=null}){const l=Bc(),{createShell:d}=Po({scopeType:e,scopeId:t});return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"new-session",children:[a.jsxs("button",{type:"button",ref:l.triggerRef,className:"tabs-new","aria-haspopup":"menu","aria-expanded":l.open,disabled:d.isPending,onClick:l.toggle,children:[a.jsx("span",{"aria-hidden":"true",children:"+"})," nova sessão"]}),l.open&&a.jsx("div",{className:"new-session__panel",ref:l.panelRef,children:a.jsxs(Oc,{label:"nova sessão",children:[a.jsx(Pi,{glyph:a.jsx(Be,{tone:"agent",children:"◆"}),disabled:o!==null,...o!==null?{hint:o}:{},onSelect:()=>{l.close(),n()},children:"novo agente"}),a.jsx(Pi,{glyph:a.jsx(Be,{tone:"shell",children:"●"}),hint:"shell de login",onSelect:()=>{l.close(),d.mutate(void 0,{onSuccess:h=>s(h.id)})},children:"terminal"})]})})]}),d.error&&a.jsx("div",{className:"new-session__error",children:a.jsx(Ce,{tone:"danger",children:d.error.message})})]})}const l4=1,c4="mensagem grande demais — o limite é 1 MiB",u4=new TextEncoder;function d4(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${CR}?${kR}=${encodeURIComponent(e)}`}function h4(e,t,s={}){const{createWebSocket:n=d=>new WebSocket(d),origin:o=window.location}=s,l=n(d4(e,o));return l.onmessage=d=>{var f;const h=UR(String(d.data));h.ok?t.onMessage(h.message):(f=t.onDecodeError)==null||f.call(t,h.error)},l.onclose=d=>{var h;(h=t.onClose)==null||h.call(t,{code:d.code,clean:d.wasClean,refused:d.code===NR})},l.onerror=()=>{},{send(d){var m,g,v;const h=IR.safeParse(d);if(!h.success)return(m=t.onSendRejected)==null||m.call(t,h.error.issues.map(y=>`${y.path.join(".")||"<root>"}: ${y.message}`).join("; ")),!1;const f=$R(h.data);return u4.encode(f).byteLength>ER?((g=t.onSendRejected)==null||g.call(t,c4),!1):l.readyState!==l4?((v=t.onSendRejected)==null||v.call(t,"o socket não está aberto"),!1):(l.send(f),!0)},close(){l.onmessage=null,l.onclose=null,l.onopen=null,l.close()}}}function f4(e){return e.type==="continued_in"?`continuada em ${e.label} →`:`continuação de ${e.label} — levou ${String(e.messages)} mensagens, ~${String(e.approxTokens)} tokens`}function m4(e){return{kind:"meta",text:f4(e),link:e.sessionId}}function p4(e,t){return e.type==="turn_failed"?{role:"agent",blocks:[{kind:"failure",text:`o turno falhou — ${e.message}`}],at:t}:{role:"agent",blocks:[{kind:"quota",text:`${e.accountLabel===null?`o ${e.agent} recusou por limite de uso`:`a conta ${e.accountLabel} bateu no limite do ${e.agent}`} — ${e.message}`}],at:t}}function _4(e){if(e.type==="account_default_unavailable")return`o modelo padrão da conta — ${e.requested} — não está mais na lista; abriu em ${e.got}`;const t=e.current===""?"no modelo padrão dele":`em ${e.current}`;return`o modelo ${e.model} não existe mais neste agente — a conversa continuou ${t}`}function FC(){return{turns:[],pendingPermission:null,streaming:!1,turnStartedAt:null,lastEventAt:null,lastStopReason:null,orphanUpdates:0,plan:null,usage:null,mode:"",configOptions:[],modeOwner:"agent",lumemMode:"ask",lumemModeDefault:"ask",commands:[],terminals:[],turnTally:{auto:0,asked:0}}}function g4(e){return e.reduce(UC,FC())}function UC(e,t){return v4(y4(e,t),t)}function v4(e,{at:t,event:s}){return e.streaming?s.type==="message"&&s.role==="user"?{...e,turnStartedAt:t,lastEventAt:t}:{...e,lastEventAt:t}:{...e,turnStartedAt:null,lastEventAt:null}}function y4(e,{at:t,event:s}){var n,o,l,d,h;switch(s.type){case"message":return vw(s.role==="user"?b4(e):e,s.role,{kind:"message",messageId:s.messageId,text:s.text});case"thought":{const{messageId:f,text:m}=s;return vw(e,"agent",{kind:"thought",messageId:f,text:m,startedAt:t,endedAt:t})}case"tool_call":return jd(e,"agent",{kind:"tool",call:{toolCallId:s.toolCallId,title:s.title,name:s.name??null,kind:s.kind,status:s.status,locations:s.locations,content:s.content??[],elapsedMs:null,added:null,removed:null,verdict:null,verdictBy:"user",verdictReason:null,askWithdrawn:!1,startedAt:t}});case"tool_call_update":return pp(e,s.toolCallId,f=>({...f,...s.status?{status:s.status}:{},...s.title?{title:s.title}:{},...s.locations?{locations:s.locations}:{},...s.content?j4(f,s.content):{},elapsedMs:t-f.startedAt}));case"permission_request":{const f={requestId:s.requestId,toolCallId:s.toolCallId,title:s.title,command:s.command??null,cwd:s.cwd,options:s.options,policyReason:s.policyReason},m=U_(e.turns,g=>g.kind==="permission"?null:g);return jd({...e,turns:m,pendingPermission:f,turnTally:{...e.turnTally,asked:e.turnTally.asked+1}},"agent",{kind:"permission",request:f})}case"permission_resolved":{const f=w4(e.turns,s.requestId);if(!f)return{...e,orphanUpdates:e.orphanUpdates+1};const m=s.outcome==="cancelled"?null:s.outcome.optionId,g=m===null?null:f.options.find(x=>x.optionId===m)??null,v=U_(e.turns,x=>x.kind==="permission"&&x.request.requestId===s.requestId?null:x),y={...e,turns:v,pendingPermission:((n=e.pendingPermission)==null?void 0:n.requestId)===s.requestId?null:e.pendingPermission,turnTally:s.by==="lumem"?{auto:e.turnTally.auto+1,asked:Math.max(0,e.turnTally.asked-1)}:e.turnTally};return g?pp(y,f.toolCallId,x=>({...x,verdict:g,verdictBy:s.by,verdictReason:s.reason})):S4(y.turns,f.toolCallId)?pp(y,f.toolCallId,x=>({...x,askWithdrawn:!0})):y}case"plan":return{...e,plan:s.entries};case"plan_removed":return{...e,plan:null};case"usage":{const f=((o=s.cost)==null?void 0:o.amount)??0;return{...e,usage:{used:s.used,size:s.size,cost:s.cost??null,rateLimit:s.rateLimit??null,totalCost:(((l=e.usage)==null?void 0:l.totalCost)??0)+f,currency:((d=s.cost)==null?void 0:d.currency)??((h=e.usage)==null?void 0:h.currency)??null}}}case"config":return{...e,mode:s.mode,configOptions:s.options,modeOwner:s.modeOwner,lumemMode:s.lumemMode,lumemModeDefault:s.lumemModeDefault};case"commands":return{...e,commands:s.commands};case"terminal":{const f=e.terminals.filter(m=>m.terminalId!==s.terminalId);return{...e,terminals:[...f,{terminalId:s.terminalId,ptySessionId:s.ptySessionId,command:s.command}]}}case"turn_end":{const f={...e,streaming:!1,lastStopReason:s.stopReason,turnTally:{auto:0,asked:0}};return e.turnTally.auto===0?f:jd(f,"agent",{kind:"meta",text:x4(e.turnTally)})}case"resumed":return{...e,turns:[...e.turns,{role:"resumed",blocks:[],at:t,fromSessionId:s.fromSessionId}]};case"model_unavailable":case"account_default_unavailable":return{...e,turns:[...e.turns,{role:"agent",blocks:[{kind:"meta",text:_4(s)}],at:t}]};case"continued_in":case"continued_from":return{...e,turns:[...e.turns,{role:"agent",blocks:[m4(s)],at:t}]};case"memory_core":return{...e,turns:[...e.turns,{role:"agent",blocks:[{kind:"meta",text:`memória do workspace: ${String(s.entries)} ${s.entries===1?"diretriz fixada":"diretrizes fixadas"} · ${s.chars.toLocaleString("pt-BR")} caracteres neste turno`}],at:t}]};case"budget":return{...e,turns:[...e.turns,{role:"agent",blocks:[{kind:"meta",text:s.message}],at:t}]};case"quota_refused":case"turn_failed":return{...e,streaming:!1,turns:[...e.turns,p4(s,t)]};case"unknown":return jd(e,"agent",{kind:"note",text:`evento não reconhecido: ${s.sessionUpdate}`})}}function vw(e,t,s){const n=t==="user"?!0:e.streaming,o=[...e.turns],l=o.at(-1);if((l==null?void 0:l.role)===t){const d=[...l.blocks],h=d.at(-1);if((h==null?void 0:h.kind)===s.kind&&h.messageId===s.messageId){const f="endedAt"in s?{endedAt:s.endedAt}:{};d[d.length-1]={...h,text:h.text+s.text,...f}}else d.push(s);return o[o.length-1]={...l,blocks:d},{...e,turns:o,streaming:n}}return o.push({role:t,blocks:[s]}),{...e,turns:o,streaming:n}}function b4(e){return{...e,turns:U_(e.turns,t=>t.kind==="meta"&&t.text.startsWith($C)?null:t)}}const $C="◈ ";function x4({auto:e,asked:t}){const s=e===1?"1 pedido aprovado":`${e} pedidos aprovados`,n=t===1?"1 subiu para você":`${t} subiram para você`;return`${$C}${s} pelo Lumem, ${n} neste turno`}function jd(e,t,s){const n=[...e.turns],o=n.at(-1);return(o==null?void 0:o.role)===t?n[n.length-1]={...o,blocks:[...o.blocks,s]}:n.push({role:t,blocks:[s]}),{...e,turns:n}}function pp(e,t,s){let n=!1;const o=e.turns.map(l=>({...l,blocks:l.blocks.map(d=>d.kind!=="tool"||d.call.toolCallId!==t?d:(n=!0,{...d,call:s(d.call)}))}));return n?{...e,turns:o}:{...e,orphanUpdates:e.orphanUpdates+1}}function U_(e,t){return e.map(s=>({...s,blocks:s.blocks.flatMap(n=>{const o=t(n);return o?[o]:[]})}))}function S4(e,t){return e.some(s=>s.blocks.some(n=>n.kind==="tool"&&n.call.toolCallId===t))}function w4(e,t){for(const s of e)for(const n of s.blocks)if(n.kind==="permission"&&n.request.requestId===t)return n.request;return null}function j4(e,t){let s=0,n=0,o=!1;for(const l of t){if(l.type!=="diff")continue;o=!0;const d=yw(l.oldText??""),h=yw(l.newText),f=C4(d,h);s+=h.length-f,n+=d.length-f}return{content:t,added:o?s:e.added,removed:o?n:e.removed}}function yw(e){if(e==="")return[];const t=e.split(`
|
|
94
|
+
`);return t.at(-1)===""&&t.pop(),t}function C4(e,t){const s=new Map;for(const o of e)s.set(o,(s.get(o)??0)+1);let n=0;for(const o of t){const l=s.get(o)??0;l>0&&(s.set(o,l-1),n+=1)}return n}function Xg(e){const t=/^\/([^\s]*)$/.exec(e);return t?t[1]:null}function KC(e,t){if(t==="")return e;const s=t.toLowerCase();return e.filter(n=>n.name.toLowerCase().startsWith(s))}function WC({commands:e,query:t,onChoose:s,onDismiss:n}){const o=KC(e,t),[l,d]=j.useState(0);j.useEffect(()=>d(0),[t,e]),j.useEffect(()=>{const f=m=>{if(o.length!==0){if(m.key==="ArrowDown"){m.preventDefault(),d(g=>(g+1)%o.length);return}if(m.key==="ArrowUp"){m.preventDefault(),d(g=>(g-1+o.length)%o.length);return}if(m.key==="Enter"&&!m.metaKey&&!m.ctrlKey){m.preventDefault(),m.stopPropagation(),h(o[l]);return}m.key==="Escape"&&(m.preventDefault(),n())}};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)});function h(f){s(`/${f.name}${f.takesInput?" ":""}`)}return o.length===0?null:a.jsx("div",{className:"slash",role:"listbox","aria-label":"comandos do agente",children:o.map((f,m)=>a.jsxs("button",{type:"button",role:"option","aria-selected":m===l,className:`slash__row focus-ring${m===l?" slash__row--on":""}`,onMouseDown:g=>{g.preventDefault(),h(f)},children:[a.jsxs("span",{className:"slash__cmd",children:["/",f.name]}),a.jsx("span",{className:"slash__desc",children:f.description})]},f.name))})}function VC({value:e,onChange:t,onSubmit:s,commands:n,placeholder:o,disabled:l=!1,label:d="mensagem para o agente",className:h,inputClassName:f,modalFocus:m=!1,children:g,action:v}){const y=Xg(e);return a.jsxs("div",{className:`composer__box${h===void 0?"":` ${h}`}`,children:[y!==null&&a.jsx(WC,{commands:n,query:y,onChoose:t,onDismiss:()=>t("")}),a.jsx("textarea",{className:`composer__in${f===void 0?"":` ${f}`}${e===""?" composer__in--empty":""}`,value:e,disabled:l,placeholder:o,"aria-label":d,"data-modal-focus":m?"":void 0,onChange:x=>t(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.shiftKey||x.nativeEvent.isComposing||(x.preventDefault(),s()))}}),a.jsxs("div",{className:"composer__bar",children:[g,v!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spacer"}),v]})]})]})}const k4={auto:"auto",plan:"plan",bypassPermissions:"bypass"};function YC({mode:e,options:t,disabled:s=!1,onSwitch:n}){const[o,l]=j.useState(null);return a.jsx(a.Fragment,{children:t.map(d=>{const h=d.id==="mode"?e:d.currentValue,f=N4(d,h);return a.jsxs("span",{className:"config",children:[a.jsxs("button",{type:"button",className:`pill${E4(d,h)} focus-ring`,"aria-haspopup":"menu","aria-expanded":o===d.id,"aria-label":`${d.name}: ${f}`,disabled:s,title:s?"não dá para trocar no meio de um turno":`${d.name}: ${f}`,onClick:()=>l(o===d.id?null:d.id),children:[f,a.jsx("span",{className:"pill__caret","aria-hidden":"true",children:"▾"})]}),o===d.id&&a.jsx("div",{className:"slash",role:"menu","aria-label":d.name,children:d.choices.map(m=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":m.value===h,className:`slash__row focus-ring${m.value===h?" slash__row--on":""}${m.value==="bypassPermissions"?" slash__row--danger":""}`,onClick:()=>{l(null),n(d.id,m.value)},children:[a.jsx("span",{className:"slash__cmd",children:m.value}),a.jsx("span",{className:"slash__desc",children:m.description??""})]},m.value))})]},d.id)})})}function N4(e,t){var s;return((s=e.choices.find(n=>n.value===t))==null?void 0:s.name)||t||e.name}function E4(e,t){if(e.id==="mode"){const s=k4[t];return s?` pill--${s}`:""}return e.id==="model"?" pill--model":""}function T4({cwd:e,onCancel:t,onConfirm:s}){const n=j.useRef(null);return j.useEffect(()=>{var o;return(o=n.current)==null?void 0:o.focus()},[]),a.jsxs("div",{className:"gate",role:"dialog","aria-modal":"true","aria-label":"liberar esta sessão",onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),t())},children:[a.jsxs("div",{className:"gate__t",children:[a.jsx("span",{className:"gate__g","aria-hidden":"true",children:"⚠"}),"Liberar esta sessão?"]}),a.jsxs("div",{className:"gate__b",children:["O Lumem vai ",a.jsx("b",{children:"parar de perguntar"})," e responder ",a.jsx("b",{children:"sim"})," a tudo que este agente pedir, até o fim desta conversa."]}),a.jsxs("ul",{className:"gate__list",children:[a.jsx("li",{children:"escrever e apagar arquivos"}),a.jsx("li",{children:"rodar qualquer comando de shell"}),a.jsx("li",{children:a.jsxs("span",{children:["tudo isso dentro de ",a.jsx("span",{className:"gate__scope",children:e})]})})]}),a.jsxs("div",{className:"gate__acts",children:[a.jsxs("button",{type:"button",className:"btn btn--ghost btn--sm focus-ring",ref:n,onClick:t,children:["cancelar ",a.jsx("span",{className:"kbd",children:"esc"})]}),a.jsx("span",{className:"spacer"}),a.jsx("button",{type:"button",className:"btn btn--danger btn--sm focus-ring",onClick:s,children:"liberar esta sessão"})]}),a.jsx("div",{className:"gate__note",children:"Vale só para esta conversa. Uma sessão nova volta a perguntar tudo."})]})}const $_=[{value:"ask",label:"Perguntar tudo",description:"Todo pedido para e espera por você. É o padrão, e nenhuma sessão nasce em outro.",tone:"pill--ask"},{value:"auto",label:"Automático",description:"Leitura de arquivo com caminho dentro do checkout passa sozinha, e aparece na conversa. Escrita e comando ainda perguntam.",tone:"pill--auto"},{value:"free",label:"Liberado",description:"Nada é perguntado dentro da worktree. Pede confirmação antes de valer.",tone:"pill--bypass"}],GC=e=>$_.find(t=>t.value===e)??$_[0];function A4({mode:e,disabled:t=!1,readOnly:s=!1,open:n=!1,onToggle:o}){const l=GC(e);return s?a.jsxs("span",{className:`pill ${l.tone}`,title:"conversa encerrada — o modo em que ela esteve",children:[a.jsx("span",{className:"pill__own","aria-hidden":"true",children:"◈"}),a.jsx("span",{className:"sr-only",children:"regra do Lumem, e a conversa terminou: "}),l.label]}):a.jsxs("button",{type:"button",className:`pill ${l.tone} focus-ring`,"aria-haspopup":"menu","aria-expanded":n,"aria-label":`regra do Lumem: ${l.label}`,disabled:t,title:t?"não dá para trocar no meio de um turno":"regra do Lumem — este agente não oferece modos",onClick:o,children:[a.jsx("span",{className:"pill__own","aria-hidden":"true",children:"◈"}),l.label,a.jsx("span",{className:"pill__caret","aria-hidden":"true",children:"▾"})]})}function O4({mode:e,workspaceDefault:t,onSwitch:s,onFreeRequested:n}){return a.jsxs("div",{className:"mode-menu",role:"menu","aria-label":"regra do Lumem",children:[a.jsxs("div",{className:"mode-menu__head",children:[a.jsxs("div",{className:"mode-menu__who",children:[a.jsx("span",{"aria-hidden":"true",children:"◈"}),"Regra do Lumem"]}),a.jsxs("div",{className:"mode-menu__why",children:["este agente não relatou modos. O que muda aqui é ",a.jsx("b",{children:"o que o daemon responde"})," a um pedido de permissão — o agente não fica sabendo."]})]}),$_.map(o=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":o.value===e,className:`mode-option focus-ring${o.value===e?" mode-option--on":""}${o.value==="auto"?" mode-option--auto":""}${o.value==="free"?" mode-option--free":""}`,onClick:()=>{if(o.value==="free"){n();return}s(o.value)},children:[a.jsxs("span",{className:"mode-option__t",children:[o.label,o.value===e&&a.jsx("span",{className:"mode-option__mark","aria-hidden":"true",children:"✓"})]}),a.jsx("span",{className:"mode-option__d",children:o.description})]},o.value)),a.jsxs("div",{className:"mode-menu__foot",children:["padrão do workspace: ",a.jsx("b",{children:GC(t).label.toLowerCase()})]})]})}function R4({mode:e,readOnly:t}){return e!=="plan"||t?null:a.jsx("div",{className:"plan-mode",role:"status",children:"modo plano — o agente não altera arquivos até você aprovar o plano"})}function bw(e,t){return t<=0?"0%":`${(Math.min(1,Math.max(0,e/t))*100).toFixed(2)}%`}function _c(e){if(e<1e3)return String(e);if(e<1e6){const s=e/1e3;return`${s>=100?Math.round(s):s.toFixed(1).replace(".",",")}k`}const t=e/1e6;return`${t>=10?Math.round(t):t.toFixed(1).replace(".",",").replace(",0","")}M`}function xw(e,t){return`${t==="USD"?"US$":`${t} `} ${e.toFixed(4).replace(".",",")}`}function D4(e,t){const s=e-Math.round(t/1e3);if(s<=0)return"resetou";const n=s/3600;if(n>=24)return`reseta em ${Math.round(n/24)} d`;if(n>=6)return`reseta em ${Math.round(n)} h`;const o=new Date(e*1e3);return`reseta ${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`}function M4(e){if(!e)return"quiet";if(e.isUsingOverage)return"over";const t=e.surpassedThreshold;return t!=null&&e.utilization>=t?"warn":"quiet"}function L4({usage:e,now:t=Date.now()}){var o;const{rateLimit:s}=e,n=M4(s);return a.jsxs(a.Fragment,{children:[n==="over"&&a.jsxs("div",{className:"overage",role:"status",children:[a.jsx("span",{"aria-hidden":"true",children:"⚠"}),a.jsxs("span",{children:["Você entrou no ",a.jsx("b",{children:"overage"})," do ciclo. A partir daqui a sessão cobra fora da assinatura."]})]}),a.jsxs("div",{className:"usage",children:[a.jsxs("span",{className:"usage-stat",children:[a.jsx("span",{className:"usage-stat__k",children:"janela"}),_c(e.used)," / ",_c(e.size),a.jsx(Sw,{fraction:bw(e.used,e.size)})]}),a.jsxs("span",{className:`usage-stat${e.cost?" usage-stat--cost":""}`,children:[a.jsx("span",{className:"usage-stat__k",children:"turno"}),e.cost?xw(e.cost.amount,e.cost.currency):"—",e.currency&&e.totalCost>(((o=e.cost)==null?void 0:o.amount)??0)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"usage-stat__k",children:"sessão"}),xw(e.totalCost,e.currency)]})]}),a.jsx("span",{className:"usage__spacer"}),s&&a.jsxs("span",{className:`usage-stat${n==="quiet"?"":` usage-stat--${n}`}`,children:[a.jsx("span",{className:"usage-stat__k",children:"assinatura"}),Math.round(s.utilization*100),"%",a.jsx(Sw,{fraction:bw(s.utilization,1)}),s.isUsingOverage?"em overage":s.resetsAt!==null&&s.resetsAt!==void 0?D4(s.resetsAt,t):null]})]})]})}function Sw({fraction:e}){return a.jsx("span",{className:"meter","data-fill":e,children:a.jsx("span",{className:"meter__f",style:{"--w":e}})})}function B4(e){var l;const{arrival:t}=Fo(),s=t!==null&&t.sessionId===e?t:null,n=j.useRef(void 0),o=j.useRef(null);return(n.current===void 0||n.current.sessionId!==e||s!==null&&s!==o.current&&s!==n.current.arrival)&&(n.current={sessionId:e,arrival:s}),j.useEffect(()=>{var h,f;const d=((h=n.current)==null?void 0:h.arrival)??null;((f=n.current)==null?void 0:f.sessionId)!==e||d===null||o.current===d||(o.current=d,w5(e))},[e,(l=n.current)==null?void 0:l.arrival]),n.current.arrival}function z4({sessionId:e,conversation:t,session:s,attached:n,readOnly:o,active:l,send:d,sendRefusal:h,cancel:f,setMode:m,setConfig:g}){const v=t.pendingPermission,y=B4(e),[x,S]=j.useState(()=>y!==null&&!y.send?y.text??"":""),[w,k]=j.useState(!1),[E,D]=j.useState(!1),A=!t.streaming&&n;j.useEffect(()=>{A||(D(!1),k(!1))},[A]);const N=j.useCallback(()=>{d(x)&&S("")},[x,d]),z=j.useRef(!1);j.useEffect(()=>{y===null||!y.send||z.current||!n||o||d(y.text??"")&&(z.current=!0)},[n,y,o,d]);const V=Xg(x),ee=t.streaming,$=V!==null&&KC(t.commands,V).length>0;return j.useEffect(()=>{if(!l||o||!ee||v!==null||$)return;const ae=me=>{me.key==="Escape"&&(me.preventDefault(),f())};return window.addEventListener("keydown",ae),()=>window.removeEventListener("keydown",ae)},[l,o,ee,v,$,f]),a.jsxs(a.Fragment,{children:[t.usage&&a.jsx(L4,{usage:t.usage}),a.jsxs("div",{className:"composer",children:[w&&A&&a.jsx(T4,{cwd:(s==null?void 0:s.cwd)??"",onCancel:()=>k(!1),onConfirm:()=>{k(!1),m("free")}}),a.jsx(R4,{mode:t.mode,readOnly:o}),a.jsxs(VC,{value:x,onChange:S,onSubmit:N,commands:t.commands,disabled:v!==null||o,placeholder:o?"esta conversa terminou — retome para continuar":v!==null?"responda o pedido de permissão para continuar":"escreva, ou / para comandos",action:a.jsxs(J,{variant:"primary",size:"sm",disabled:x.trim()===""||v!==null||o||!n,onClick:N,children:["enviar ",a.jsx("span",{className:"kbd",children:"⏎"})]}),children:[t.modeOwner==="lumem"&&a.jsxs("span",{className:"config",children:[a.jsx(A4,{mode:t.lumemMode,disabled:!A,readOnly:o,open:E,onToggle:()=>D(!E)}),E&&A&&a.jsx(O4,{mode:t.lumemMode,workspaceDefault:t.lumemModeDefault,onSwitch:ae=>{D(!1),m(ae)},onFreeRequested:()=>{D(!1),k(!0)}})]}),a.jsx(YC,{mode:t.mode,options:t.configOptions,disabled:t.streaming||o,onSwitch:(ae,me)=>g(ae,me)})]}),h!==null&&a.jsx("div",{className:"composer__refused",children:a.jsx(Ce,{tone:"danger",children:h})})]})]})}function QC({currentAccountId:e,onContinue:t,pending:s,empty:n}){const o=Bc(),d=(zc().data??[]).filter(m=>m.state==="connected");if(d.length<2)return null;const h=d.filter(m=>m.id!==e),f=n?"nada foi dito nesta conversa ainda — não há o que continuar":null;return a.jsxs("div",{className:"new-session",children:[a.jsx("button",{type:"button",ref:o.triggerRef,className:"btn btn--ghost btn--sm","aria-haspopup":"menu","aria-expanded":o.open,disabled:f!==null||s,...f===null?{}:{title:f},onClick:o.toggle,children:s?"continuando…":"⇄ continuar em outra conta"}),o.open&&a.jsx("div",{className:"new-session__panel",ref:o.panelRef,children:a.jsx(Oc,{label:"continuar em outra conta",children:h.map(m=>a.jsx(Pi,{onSelect:()=>{o.close(),t(m.id)},children:`${m.adapterId} · ${m.label}`},m.id))})})]})}const K_=/^\s{0,3}(?:```|~~~)\s*([\w+-]*)\s*$/,ZC=/^\s{0,3}(#{1,6})\s+(.*)$/,XC=/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/,W_=/^\s{0,3}>\s?(.*)$/,Jg=/^(\s*)[-*+]\s+(.*)$/,ih=/^(\s*)\d{1,9}[.)]\s+(.*)$/,nh=/^\s{0,3}\|(.+)\|\s*$/,q4=/^\s{0,3}\|[\s:|-]+\|\s*$/;function P4(e){const t=e.replace(/\r\n?/g,`
|
|
95
|
+
`).split(`
|
|
96
|
+
`),s=[];let n=0;for(;n<t.length;){const o=t[n];if(o.trim()===""){n+=1;continue}const l=K_.exec(o);if(l){const f=l[1]===""?null:l[1],m=[];for(n+=1;n<t.length&&!K_.test(t[n]);)m.push(t[n]),n+=1;n<t.length&&(n+=1),s.push({kind:"code",language:f,text:m.join(`
|
|
97
|
+
`)});continue}const d=ZC.exec(o);if(d){s.push({kind:"heading",level:d[1].length,content:Hi(d[2].trim())}),n+=1;continue}if(XC.test(o)){s.push({kind:"rule"}),n+=1;continue}if(W_.test(o)){const f=[];for(;n<t.length;){const m=W_.exec(t[n]);if(!m)break;f.push(m[1]),n+=1}s.push({kind:"quote",content:Hi(f.join(`
|
|
98
|
+
`))});continue}if(nh.test(o)&&n+1<t.length&&q4.test(t[n+1])){const f=ww(o);n+=2;const m=[];for(;n<t.length&&nh.test(t[n]);)m.push(ww(t[n])),n+=1;s.push({kind:"table",header:f,rows:m});continue}if(Jg.test(o)||ih.test(o)){const f=ih.test(o),{items:m,next:g}=H4(t,n,f);s.push({kind:"list",ordered:f,items:m}),n=g;continue}const h=[t[n].trim()];for(n+=1;n<t.length;){const f=t[n];if(f.trim()===""||I4(f))break;h.push(f.trim()),n+=1}s.push({kind:"paragraph",content:Hi(h.join(`
|
|
99
|
+
`))})}return s}function I4(e){return K_.test(e)||ZC.test(e)||XC.test(e)||W_.test(e)||Jg.test(e)||ih.test(e)||nh.test(e)}function ww(e){return nh.exec(e)[1].split("|").map(s=>Hi(s.trim()))}function H4(e,t,s){const n=[];let o=t,l=null;for(;o<e.length;){const d=e[o];if(d.trim()===""){if(o+1<e.length&&jw(e[o+1])!==null){o+=1;continue}break}const h=jw(d);if(h===null||h.ordered!==s&&h.indent===(l??h.indent))break;if(l??(l=h.indent),h.indent>l){const f=n[n.length-1];if(f===void 0)break;f.children.push({content:Hi(h.text),children:[]})}else n.push({content:Hi(h.text),children:[]});o+=1}return{items:n,next:o}}function jw(e){const t=Jg.exec(e);if(t)return{indent:t[1].length,text:t[2],ordered:!1};const s=ih.exec(e);return s?{indent:s[1].length,text:s[2],ordered:!0}:null}function Hi(e){const t=[];let s="";const n=()=>{if(s!==""){for(const[l,d]of s.split(`
|
|
100
|
+
`).entries())l>0&&t.push({kind:"break"}),d!==""&&t.push({kind:"text",text:d});s=""}};let o=0;for(;o<e.length;){const l=e.slice(o),d=/^(`+)([\s\S]*?)\1(?!`)/.exec(l);if(d){n(),t.push({kind:"code",text:d[2].trim()}),o+=d[0].length;continue}const h=/^\[([^\]]*)\]\(([^\s)]+)\)/.exec(l);if(h){n(),t.push({kind:"link",href:h[2],children:Hi(h[1])}),o+=h[0].length;continue}const f=/^(\*\*|__)(?=\S)([\s\S]*?\S)\1/.exec(l);if(f){n(),t.push({kind:"strong",children:Hi(f[2])}),o+=f[0].length;continue}const m=/^~~(?=\S)([\s\S]*?\S)~~/.exec(l);if(m){n(),t.push({kind:"strike",children:Hi(m[1])}),o+=m[0].length;continue}const g=/^(\*)(?=\S)([\s\S]*?\S)\1|^(_)(?=\S)([\s\S]*?\S)\3(?![\w])/.exec(l);if(g&&(g[1]==="*"||o===0||/[^\w]/.test(e[o-1]))){n(),t.push({kind:"em",children:Hi(g[2]??g[4])}),o+=g[0].length;continue}s+=e[o],o+=1}return n(),t}function ev({text:e,streaming:t=!1}){const s=P4(e),n=s.length-1,o=a.jsx("span",{className:"mcaret","aria-hidden":"true"});return s.length===0?t?a.jsx("p",{children:o}):null:a.jsx(a.Fragment,{children:s.map((l,d)=>a.jsx(j.Fragment,{children:F4(l,t&&d===n?o:null)},d))})}function F4(e,t){switch(e.kind){case"paragraph":return a.jsxs("p",{children:[a.jsx(zi,{nodes:e.content}),t]});case"heading":{const s=`h${String(Math.min(e.level,6))}`;return a.jsxs(s,{children:[a.jsx(zi,{nodes:e.content}),t]})}case"code":return a.jsxs(a.Fragment,{children:[a.jsx("pre",{children:a.jsx("code",{...e.language===null?{}:{"data-language":e.language},children:e.text})}),t]});case"quote":return a.jsxs("blockquote",{children:[a.jsx(zi,{nodes:e.content}),t]});case"list":{const s=e.ordered?"ol":"ul";return a.jsxs(a.Fragment,{children:[a.jsx(s,{children:e.items.map((n,o)=>a.jsx(JC,{item:n,ordered:e.ordered},o))}),t]})}case"table":return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"table-scroll",children:a.jsxs("table",{children:[a.jsx("thead",{children:a.jsx("tr",{children:e.header.map((s,n)=>a.jsx("th",{children:a.jsx(zi,{nodes:s})},n))})}),a.jsx("tbody",{children:e.rows.map((s,n)=>a.jsx("tr",{children:s.map((o,l)=>a.jsx("td",{children:a.jsx(zi,{nodes:o})},l))},n))})]})}),t]});case"rule":return a.jsxs(a.Fragment,{children:[a.jsx("hr",{}),t]})}}function JC({item:e,ordered:t}){const s=t?"ol":"ul";return a.jsxs("li",{children:[a.jsx(zi,{nodes:e.content}),e.children.length>0&&a.jsx(s,{children:e.children.map((n,o)=>a.jsx(JC,{item:n,ordered:t},o))})]})}function zi({nodes:e}){return a.jsx(a.Fragment,{children:e.map((t,s)=>a.jsx(j.Fragment,{children:U4(t)},s))})}function U4(e){switch(e.kind){case"text":return e.text;case"code":return a.jsx("code",{children:e.text});case"strong":return a.jsx("strong",{children:a.jsx(zi,{nodes:e.children})});case"em":return a.jsx("em",{children:a.jsx(zi,{nodes:e.children})});case"strike":return a.jsx("del",{children:a.jsx(zi,{nodes:e.children})});case"link":return a.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:a.jsx(zi,{nodes:e.children})});case"break":return a.jsx("br",{})}}const $4={read:"▤",search:"▤",edit:"▣",delete:"▣",move:"▣",execute:"❯",fetch:"↓",think:"◈",switch_mode:"◈",other:"◈"},K4={pending:"na fila",running:"rodando",ok:"ok",failed:"falhou",cancelled:"interrompido"},W4=12;function V4({call:e,terminals:t=[],defaultOpen:s=!1}){const[n,o]=j.useState(s),l=Y4(e),d=Q4(e),h=G4(e,t);return a.jsxs("div",{className:`tool-card tool-card--${e.status}`,children:[a.jsxs("div",{className:"tool-card__head",children:[a.jsx("span",{className:"tool-card__glyph","aria-hidden":"true",children:$4[e.kind]}),a.jsx("span",{className:"tool-card__verb",children:e.name??X4(e.title)}),d?a.jsxs("span",{className:"tool-card__target",title:d.full,children:[a.jsx("span",{className:"tool-card__dir",children:d.dir}),a.jsx("span",{className:"tool-card__name",children:d.name})]}):a.jsx("span",{className:"tool-card__arg",title:e.title,children:Z4(e)}),e.verdict&&a.jsx("span",{className:`verdict verdict--${e.verdictBy==="lumem"?"lumem":e.verdict.kind.startsWith("allow")?"allowed":"denied"}`,children:e.verdictBy==="lumem"?a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":"true",children:"◈"})," o Lumem aprovou"]}):a.jsxs(a.Fragment,{children:[e.verdict.kind.startsWith("allow")?"✓":"✕"," ",e.verdict.name]})}),(e.added!==null||e.removed!==null)&&a.jsxs("span",{className:"tool-card__delta",children:[e.added?a.jsxs("span",{className:"plus",children:["+",e.added]}):null,e.added&&e.removed?" ":null,e.removed?a.jsxs("span",{className:"minus",children:["−",e.removed]}):null]}),e.elapsedMs!==null&&a.jsx("span",{className:"tool-card__time",children:ek(e.elapsedMs)}),a.jsxs("span",{className:"tool-card__st",children:[a.jsx("span",{className:"tool-card__dot","aria-hidden":"true"}),K4[e.status]]}),(l||h)&&a.jsx("button",{type:"button",className:"tool-card__twist focus-ring","aria-expanded":n,"aria-label":n?"esconder o resultado":"mostrar o resultado",onClick:()=>o(!n),children:n?"▾":"▸"})]}),e.verdictBy==="lumem"&&e.verdictReason!==null&&a.jsx("div",{className:"tool-card__why",children:e.verdictReason}),n&&h&&a.jsx("div",{className:"tool-card__body",children:a.jsx("div",{className:"tool-card__term",children:a.jsx(gh,{sessionId:h.ptySessionId})})}),n&&!h&&l&&a.jsxs("div",{className:"tool-card__body",children:[l.kind==="diff"?a.jsx(qC,{lines:l.lines,wrap:!1}):a.jsx("div",{className:"out",children:l.lines.map((f,m)=>a.jsx("span",{className:"l",children:f},m))}),l.hidden>0&&a.jsxs("div",{className:"tool-card__more",children:["▾ mostrar as ",l.hidden.toLocaleString("pt-BR")," linhas"]})]})]})}function Y4(e){const t=e.content.find(l=>l.type==="diff");if((t==null?void 0:t.type)==="diff")return{kind:"diff",lines:K5(t.oldText,t.newText),hidden:0};const s=e.content.filter(l=>l.type==="content").map(l=>l.text).join("");if(s==="")return null;const n=s.split(`
|
|
101
|
+
`),o=n.slice(Math.max(0,n.length-W4));return{kind:"text",lines:o,hidden:n.length-o.length}}function G4(e,t){const s=e.content.find(n=>n.type==="terminal");return(s==null?void 0:s.type)!=="terminal"?null:t.find(n=>n.terminalId===s.terminalId)??null}function Q4(e){const t=e.locations[0];if(!t)return null;const s=t.path.lastIndexOf("/");return s===-1?{dir:"",name:t.path,full:t.path}:{dir:t.path.slice(0,s+1),name:t.path.slice(s+1),full:t.path}}function Z4(e){const t=e.name;return t&&e.title.startsWith(`${t} `)?e.title.slice(t.length+1):e.title}function X4(e){const t=e.indexOf(" ");return t===-1?e:e.slice(0,t)}function ek(e){if(e<1e3)return`${e} ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1).replace(".",",")} s`;const s=Math.floor(t/60),n=Math.round(t-s*60);return n===0?`${s} min`:`${s} min ${n} s`}function tv({role:e,children:t}){return a.jsxs("div",{className:`turn turn--${e}`,children:[a.jsx("span",{className:"turn__g",children:a.jsx(Be,{tone:e==="agent"?"agent":"none",children:e==="agent"?"◆":"❯"})}),a.jsx("div",{className:"turn__b",children:t})]})}function J4({text:e,streaming:t=!1}){return a.jsx("div",{className:"msg",children:a.jsx(ev,{text:e,streaming:t})})}function ez({text:e,open:t,onToggle:s,streaming:n=!1,elapsedMs:o=0}){const l=n?"pensando…":o>0?`pensou por ${ek(o)}`:"pensou";return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:n?"thought thought--live focus-ring":"thought focus-ring","aria-expanded":t,onClick:s,children:[a.jsx("span",{className:"thought__twist","aria-hidden":"true",children:t?"▾":"▸"}),l,!t&&e!==""&&a.jsxs("span",{className:"thought__peek",children:["· ",e]})]}),t&&a.jsx("div",{className:"thought__text",children:a.jsx(ev,{text:e,streaming:n})})]})}function tk({prompt:e,reason:t,detail:s=null,dead:n=!1,onShowSetup:o,onSendAnyway:l,onEdit:d,busy:h=!1}){const f=!n&&t==="setup_failed",[m,g]=j.useState(!1);return j.useEffect(()=>{if(!m)return;const v=setTimeout(()=>g(!1),1500);return()=>clearTimeout(v)},[m]),a.jsxs("div",{className:`pending${f?" pending--failed":""}`,children:[n?a.jsx("p",{className:"pending__head",role:"status",children:a.jsx("span",{className:"pending__what",children:"a sessão terminou antes de mandar este prompt"})}):f?a.jsxs("div",{className:"pending__head",role:"alert",children:[a.jsx("span",{className:"pending__glyph","aria-hidden":"true",children:"⚠"}),a.jsxs("span",{className:"pending__what",children:[s??"o setup não terminou bem",a.jsx("span",{className:"pending__why",children:" — o prompt não foi enviado"})]}),o!==void 0&&a.jsx("button",{type:"button",className:"pending__link focus-ring",onClick:o,children:"ver saída"})]}):a.jsxs("p",{className:"pending__head",role:"status",children:[a.jsx("span",{className:"draft__pulse","aria-hidden":"true"}),a.jsxs("span",{className:"pending__what",children:["preparando worktree… ",a.jsx("span",{className:"pending__why",children:"(setup)"})]}),o!==void 0&&a.jsx("button",{type:"button",className:"pending__link focus-ring",onClick:o,children:"acompanhar"})]}),a.jsx(tv,{role:"user",children:a.jsx("div",{className:"msg msg--queued",children:e})}),f&&a.jsxs("div",{className:"pending__acts",children:[a.jsx(J,{size:"sm",disabled:h,onClick:l,children:"mandar assim mesmo"}),a.jsx(J,{variant:"ghost",size:"sm",disabled:h,onClick:d,children:"editar"})]}),n&&navigator.clipboard!==void 0&&a.jsx("div",{className:"pending__acts",children:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(e).then(()=>g(!0),()=>g(!1))},children:m?"copiado":"copiar o prompt"})})]})}function tz(e){return be({queryKey:hg(e),queryFn:()=>Q.session.getDetail.query({id:e})})}function sz(e){const t=$e();return Se({mutationFn:()=>Q.session.sendPending.mutate({id:e}),onSuccess:s=>t.setQueryData(hg(e),s)})}function iz(e){const t=$e();return Se({mutationFn:()=>Q.session.discardPending.mutate({id:e}),onSuccess:s=>t.setQueryData(hg(e),s)})}function nz({sessionId:e,prompt:t,reason:s,detail:n}){const o=vh(),l=sz(e),d=iz(e),h=o.open?void 0:()=>o.toggle();return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"conv__scroll",children:a.jsx(tk,{prompt:t,reason:s,detail:n,onShowSetup:h,onSendAnyway:s==="setup_failed"?()=>l.mutate():void 0,onEdit:s==="setup_failed"?()=>d.mutate(void 0,{onSuccess:()=>Ho({sessionId:e,text:t,send:!1})}):void 0,busy:l.isPending||d.isPending})}),a.jsx("div",{className:"composer",children:a.jsx("div",{className:"composer__box",children:a.jsx("textarea",{className:"composer__in composer__in--empty",disabled:!0,"aria-label":"mensagem para o agente",placeholder:"o primeiro prompt espera o setup"})})})]})}function rz({request:e,onRespond:t}){const[s,n]=j.useState(!1),o=j.useRef(null),l=_p(e.options,"allow_once")??e.options[0],d=_p(e.options,"reject_once"),h=_p(e.options,"reject_always"),f=e.options.filter(g=>g!==l&&g!==d&&g!==h),m=g=>{s||(n(!0),t(g))};return j.useEffect(()=>{var g;(g=o.current)==null||g.focus()},[e.requestId]),j.useEffect(()=>{const g=v=>{if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),m(l.optionId);return}v.key==="Escape"&&d&&(v.preventDefault(),m(d.optionId))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)}),a.jsxs("div",{className:"perm",role:"group","aria-label":"pedido de permissão",children:[a.jsxs("div",{className:"perm__head",children:[a.jsx("span",{className:"perm__glyph","aria-hidden":"true",children:"⚠"}),"Permissão",a.jsx("span",{className:"spacer"}),a.jsx("span",{className:"kbd",children:s?"enviado":"o turno está parado aqui"})]}),a.jsxs("div",{className:"perm__body",children:[a.jsxs("div",{className:"perm__what",children:[a.jsx("div",{className:"perm__cmd",children:e.command??e.title}),a.jsxs("div",{className:"perm__where",children:["cwd ",e.cwd]})]}),e.policyReason!==null&&a.jsx("div",{className:"perm__why",children:e.policyReason}),a.jsxs("div",{className:"perm__opts",children:[a.jsxs(J,{ref:o,variant:"primary",size:"sm",disabled:s,onClick:()=>m(l.optionId),children:[l.name," ",a.jsx("span",{className:"kbd",children:"⏎"})]}),f.map(g=>a.jsx(J,{variant:"ghost",size:"sm",disabled:s,onClick:()=>m(g.optionId),children:g.name},g.optionId)),d&&a.jsxs(J,{variant:"ghost",size:"sm",disabled:s,onClick:()=>m(d.optionId),children:[d.name," ",a.jsx("span",{className:"kbd",children:"esc"})]}),h&&a.jsx(J,{variant:"danger",size:"sm",disabled:s,onClick:()=>m(h.optionId),children:h.name})]})]})]})}function _p(e,t){return e.find(s=>s.kind===t)}function az({call:e,request:t,onRespond:s}){const n=cz(e),[o,l]=j.useState(!1),d=lz(e),h=n===null||o;return a.jsxs("div",{className:"plan-approval",role:"group","aria-label":"aprovar o plano",children:[a.jsxs("div",{className:"plan-approval__head",children:[a.jsx("span",{className:"plan-approval__glyph","aria-hidden":"true",children:"◈"}),"plano do agente",a.jsx("span",{className:"spacer"}),t!==null&&a.jsx("span",{className:"kbd",children:"o turno está parado aqui"})]}),(t==null?void 0:t.policyReason)!=null&&a.jsx("div",{className:"plan-approval__why",children:t.policyReason}),h&&(d===""?a.jsx("div",{className:"plan-approval__none",children:"o agente não mandou o texto do plano"}):a.jsx("div",{className:"msg plan-approval__doc",children:a.jsx(ev,{text:d})})),t!==null&&a.jsx(oz,{request:t,onRespond:s}),n!==null&&a.jsxs("div",{className:"plan-approval__record",children:[n,a.jsx("span",{className:"spacer"}),a.jsx(J,{variant:"ghost",size:"sm","aria-expanded":o,onClick:()=>l(!o),children:o?"esconder o plano":"ver o plano"})]})]})}function oz({request:e,onRespond:t}){const[s,n]=j.useState(!1),o=j.useRef(null),l=e.options.filter(v=>v.kind.startsWith("allow")),d=e.options.filter(v=>v.kind.startsWith("reject")),h=Cw(e.options,"allow_once")??e.options[0],f=Cw(e.options,"reject_once"),m=v=>{s||(n(!0),t(v))};j.useEffect(()=>{var v;(v=o.current)==null||v.focus()},[e.requestId]),j.useEffect(()=>{const v=y=>{if(y.key==="Enter"&&!y.shiftKey){y.preventDefault(),m(h.optionId);return}y.key==="Escape"&&f&&(y.preventDefault(),m(f.optionId))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)});const g=v=>a.jsxs(J,{ref:v===h?o:void 0,variant:v===h?"primary":"ghost",size:"sm",disabled:s,onClick:()=>m(v.optionId),children:[v.name,v===h&&a.jsx("span",{className:"kbd","aria-hidden":"true",children:"⏎"}),v===f&&a.jsx("span",{className:"kbd","aria-hidden":"true",children:"esc"})]},v.optionId);return a.jsxs("div",{className:"plan-approval__opts",children:[a.jsx("div",{className:"plan-approval__allow",children:l.map(g)}),d.length>0&&a.jsxs("div",{className:"plan-approval__keep",children:[a.jsx("span",{children:"ou continuar planejando"}),d.map(g)]})]})}function lz(e){return e.content.flatMap(t=>t.type==="content"?[t.text]:[]).join(`
|
|
102
|
+
|
|
103
|
+
`).trim()}function cz(e){var t,s;return(t=e.verdict)!=null&&t.kind.startsWith("allow")?`plano aprovado — ${e.verdict.name}`:(s=e.verdict)!=null&&s.kind.startsWith("reject")?"você pediu para continuar planejando":e.askWithdrawn?"pedido cancelado":null}function Cw(e,t){return e.find(s=>s.kind===t)}const uz={pending:"○",in_progress:"◐",completed:"✓"},dz={pending:"pending",in_progress:"active",completed:"done"};function hz({entries:e,defaultOpen:t=!1}){const s=e.filter(h=>h.status==="completed").length,n=e.length>0&&s===e.length,[o,l]=j.useState(t),d=!n||o;return a.jsxs("div",{className:"plan",children:[a.jsxs("div",{className:"plan__head",children:[a.jsx("span",{className:`plan__glyph${n?" plan__glyph--done":""}`,"aria-hidden":"true",children:n?"✓":"☰"}),"Passos",a.jsx("span",{className:"spacer"}),a.jsxs("span",{className:"plan__count",children:[s," de ",e.length]}),n&&a.jsx("button",{type:"button",className:"tool-card__twist focus-ring","aria-expanded":o,"aria-label":o?"esconder os passos":"mostrar os passos",onClick:()=>l(!o),children:o?"▾":"▸"})]}),d&&e.map((h,f)=>a.jsxs("div",{className:`plan__row plan__row--${dz[h.status]}`,children:[a.jsx("span",{className:"plan__mark","aria-hidden":"true",children:uz[h.status]}),a.jsx("span",{className:"plan__what",children:h.content}),h.status==="in_progress"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spacer"}),a.jsx("span",{className:"plan__now",children:"agora"})]})]},f))]})}const sk="lumem.coach.permission";function fz(){try{return window.localStorage.getItem(sk)==="seen"}catch{return!1}}function mz(){try{window.localStorage.setItem(sk,"seen")}catch{}}function pz(e){const[t,s]=j.useState(fz),[n,o]=j.useState(!1),l=j.useCallback(()=>o(!0),[]),d=j.useCallback(()=>{mz(),s(!0)},[]);return{show:e&&!t&&!n,dismiss:l,never:d}}function _z({conversation:e,session:t,failure:s,readOnly:n,answer:o,sessionLink:l,continueIn:d}){const[h,f]=j.useState(new Map),m=pz(e.pendingPermission!==null),g=xz(),v=new Set(e.turns.flatMap(y=>y.blocks.flatMap(x=>x.kind==="tool"&&x.call.kind==="switch_mode"?[x.call.toolCallId]:[])));return a.jsxs("div",{className:"conv__scroll",ref:g,children:[(s==null?void 0:s.fatal)&&a.jsxs("div",{className:"fail",children:[a.jsxs("div",{className:"fail__title",children:[a.jsx("span",{"aria-hidden":"true",children:"⚠"}),s.remedy?"o adaptador ACP não subiu":"a sessão não está disponível"]}),a.jsx("div",{className:"fail__body",children:s.message}),s.remedy&&a.jsx("div",{className:"fail__cmd",children:s.remedy})]}),s&&!s.fatal&&a.jsx(Ce,{tone:"danger",children:s.message}),e.turns.length===0&&!s&&a.jsx(bz,{ready:t!==null}),e.plan&&a.jsx(hz,{entries:e.plan}),e.turns.map((y,x)=>y.role==="resumed"?a.jsx(gz,{at:y.at??null},x):a.jsx(tv,{role:y.role,children:y.blocks.map((S,w)=>{const k=e.streaming&&!n&&y.role==="agent"&&x===e.turns.length-1&&w===y.blocks.length-1,E=`${x}:${w}`,D=h.get(E)??k;return a.jsx(vz,{block:S,terminals:e.terminals,pending:e.pendingPermission,planCalls:v,streaming:k,thoughtOpen:D,onToggleThought:()=>f(A=>new Map(A).set(E,!D)),onRespond:A=>{const N=e.pendingPermission;N&&o(N.requestId,A)},coach:m,sessionLink:l,continueIn:x===e.turns.length-1?d:void 0},w)})},x)),n&&t&&a.jsx("div",{className:"daysep",children:"conversa encerrada"})]})}function gz({at:e}){return a.jsxs("div",{className:"daysep",children:["retomada",e===null?"":` · ${Fg(e,"short")}`]})}function vz({block:e,terminals:t,pending:s,planCalls:n,streaming:o,thoughtOpen:l,onToggleThought:d,onRespond:h,coach:f,sessionLink:m,continueIn:g}){switch(e.kind){case"message":return a.jsx(J4,{text:e.text,streaming:o});case"thought":return a.jsx(ez,{text:e.text,open:l,onToggle:d,streaming:o,elapsedMs:e.endedAt-e.startedAt});case"tool":if(e.call.kind==="switch_mode"){const v=(s==null?void 0:s.toolCallId)===e.call.toolCallId?s:null;return a.jsx(az,{call:e.call,request:v,onRespond:h})}return a.jsx(V4,{call:e.call,terminals:t});case"permission":return n.has(e.request.toolCallId)?null:a.jsxs(a.Fragment,{children:[a.jsx(rz,{request:e.request,onRespond:h}),f.show&&a.jsxs(gO,{title:"a primeira vez que isso aparece",onUnderstood:f.dismiss,onNever:f.never,children:["É assim que o Lumem te mantém no controle: o modo ",a.jsx("b",{children:"Auto"})," resolve sozinho o que é leitura e escrita dentro desta worktree, e para em tudo que sai disso — rede, comando global, arquivo fora dela. Para ver o plano antes de qualquer execução, troque para"," ",a.jsx("b",{children:"Plano"})," na barra acima."]})]});case"note":return a.jsx("div",{className:"unknown",children:e.text});case"meta":return a.jsx(yz,{text:e.text,open:e.link===void 0?null:(m==null?void 0:m(e.link))??null});case"quota":return a.jsx(Ce,{tone:"warning",...g===void 0?{}:{actions:a.jsx(QC,{...g,empty:!1})},children:e.text});case"failure":return a.jsx(Ce,{tone:"danger",children:e.text})}}function yz({text:e,open:t}){return t===null?a.jsx("div",{className:"meta--conversation",children:e}):a.jsx("button",{type:"button",className:"meta--conversation meta--link focus-ring",onClick:t,children:e})}function bz({ready:e}){return a.jsxs("div",{className:"empty empty--conversation",children:[a.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"◆"}),a.jsx("span",{className:"empty__title",children:e?"sessão aberta, nada pedido ainda":"conectando…"}),e&&a.jsxs("span",{className:"empty__sub",children:["O adaptador subiu e o handshake passou sem consumir nada. O primeiro turno já entra com"," ",a.jsx("b",{children:"39,2k"})," de contexto — system prompt e ferramentas do próprio Claude Code, não do Lumem."]})]})}function xz(){const e=j.useRef(!0),t=j.useRef(null);return j.useCallback(s=>{var d;if((d=t.current)==null||d.call(t),t.current=null,!s)return;const n=()=>{e.current&&(s.scrollTop=s.scrollHeight)},o=()=>{e.current=s.scrollHeight-s.scrollTop-s.clientHeight<24};s.addEventListener("scroll",o,{passive:!0});const l=new MutationObserver(n);l.observe(s,{childList:!0,subtree:!0,characterData:!0}),n(),t.current=()=>{s.removeEventListener("scroll",o),l.disconnect()}},[])}function Sz(e){if(e.pendingPermission!==null)return{kind:"waiting"};for(let t=e.turns.length-1;t>=0;t-=1){const s=e.turns[t];if(s.role==="user")break;if(s.role==="agent")for(let n=s.blocks.length-1;n>=0;n-=1){const o=wz(s.blocks[n]);if(o!==null)return o}}return{kind:"starting"}}function wz(e){switch(e.kind){case"thought":return{kind:"thinking"};case"message":return{kind:"writing"};case"permission":return{kind:"waiting"};case"tool":return e.call.status==="pending"||e.call.status==="running"?{kind:"tool",call:e.call}:{kind:"thinking"};default:return null}}function kw(e){switch(e.kind){case"starting":return"começando";case"thinking":return"pensando";case"writing":return"escrevendo";case"waiting":return"esperando sua resposta";case"tool":return`rodando ${e.call.title}`}}const jz=9e4;function Cz(e,t){const s=Sz(e);if(s.kind==="tool")return{tone:"normal",doing:`${kw(s)} há ${V_(t-s.call.startedAt)}`};const n=e.lastEventAt===null?0:t-e.lastEventAt;return s.kind!=="waiting"&&n>=jz?{tone:"warning",doing:`sem sinal do agente há ${V_(n)}`}:{tone:"normal",doing:kw(s)}}function V_(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${String(t)} s`;const s=Math.floor(t/60);return s<60?`${String(s)} min ${String(t%60)} s`:`${String(Math.floor(s/60))} h ${String(s%60).padStart(2,"0")} min`}function kz(e,t=Date.now){const[s,n]=j.useState(t),o=j.useRef(t);return o.current=t,j.useEffect(()=>{if(!e)return;n(o.current());const l=setInterval(()=>n(o.current()),1e3);return()=>clearInterval(l)},[e]),s}function Nz({conversation:e,readOnly:t,active:s=!0,clock:n=Date.now}){const o=e.streaming&&!t&&s,l=kz(o,n);if(!o||e.turnStartedAt===null)return null;const d=Cz(e,l),h=d.tone==="warning";return a.jsxs("div",{className:`turn-status${h?" turn-status--warning":""}`,children:[a.jsx("span",{className:"turn-status__pulse","aria-hidden":"true"}),a.jsx("span",{className:"turn-status__elapsed",children:`trabalhando · ${V_(l-e.turnStartedAt)}`}),a.jsx("span",{className:"turn-status__doing",children:d.doing}),h&&a.jsxs("span",{className:"turn-status__hint",children:[a.jsx("span",{className:"kbd",children:"esc"})," interromper"]})]})}const ik={conversation:FC(),session:null,failure:null};function Ez(e,t){if(t.kind==="reset")return ik;if(t.kind==="failure")return{...e,failure:t.failure};const s=t.message;switch(s.type){case"attached":return{conversation:{...g4(s.transcript),mode:s.mode,configOptions:s.configOptions,modeOwner:s.modeOwner,lumemMode:s.lumemMode,lumemModeDefault:s.lumemModeDefault},session:{acpSessionId:s.acpSessionId,model:s.model,mode:s.mode,state:s.state,cwd:s.cwd},failure:null};case"event":return{...e,conversation:UC(e.conversation,{at:s.at,event:s.event})};case"error":return{...e,failure:{message:s.message,remedy:s.remedy??null,fatal:s.code==="ADAPTER_UNAVAILABLE"||s.code==="SESSION_NOT_FOUND"}}}}const Tz=[500,1e3,2e3,4e3,8e3],Az=1e4,Oz="conexão com o daemon caiu — reconectando",Rz="esta sessão não existe mais no daemon",Dz="o daemon mandou algo que esta tela não entende — recarregue a página",Mz=e=>Q.session.transcript.query({id:e});function Lz(e,{live:t=!0,connect:s=h4,load:n=Mz}={}){var A;const[o,l]=j.useReducer(Ez,ik),[d,h]=j.useState(null),f=j.useRef(null),m=Gg(),g=o.conversation.pendingPermission;j.useEffect(()=>{if(l({kind:"reset"}),h(null),!t){let $=!0;return n(e).then(ae=>{$&&l({kind:"message",message:ae})}).catch(ae=>{$&&l({kind:"message",message:{type:"error",code:"INTERNAL",message:ae instanceof Error?ae.message:"não deu para ler a conversa"}})}),()=>{$=!1}}let N=!1,z=0,V;const ee=()=>{f.current=s(e,{onMessage:$=>{$.type==="attached"&&(z=0,h(null)),l({kind:"message",message:$})},onClose:({refused:$})=>{if(N)return;if($){l({kind:"failure",failure:{message:Rz,remedy:null,fatal:!0}});return}l({kind:"failure",failure:{message:Oz,remedy:null,fatal:!1}});const ae=Tz[z]??Az;z+=1,V=setTimeout(ee,ae)},onDecodeError:()=>l({kind:"failure",failure:{message:Dz,remedy:null,fatal:!1}}),onSendRejected:h})};return ee(),()=>{N=!0,clearTimeout(V);const $=f.current;f.current=null,$==null||$.close()}},[e,t,s,n]),j.useEffect(()=>{m.setWaiting(e,g!==null)},[m,e,g]);const v=j.useRef(m.setWaiting);v.current=m.setWaiting,j.useEffect(()=>()=>{v.current(e,!1)},[e]);const y=o.session!==null,x=!t||((A=o.session)==null?void 0:A.state)==="exited",S=j.useCallback(N=>{var V;const z=N.trim();return z===""||g!==null||x||!y?!1:(h(null),((V=f.current)==null?void 0:V.send({type:"prompt",text:z}))??!1)},[y,g,x]),w=j.useCallback(()=>{var N;(N=f.current)==null||N.send({type:"cancel"})},[]),k=j.useCallback((N,z)=>{var V;(V=f.current)==null||V.send({type:"permission_response",requestId:N,optionId:z})},[]),E=j.useCallback(N=>{var z;(z=f.current)==null||z.send({type:"set_lumem_mode",mode:N})},[]),D=j.useCallback((N,z)=>{var V;(V=f.current)==null||V.send({type:"set_config",optionId:N,value:z})},[]);return{state:o,attached:y,readOnly:x,send:S,sendRefusal:d,cancel:w,answer:k,setMode:E,setConfig:D}}function Bz({sessionId:e,agentName:t="agente",accountLabel:s=null,continueIn:n,sessionLink:o,live:l,connect:d,load:h,onResume:f,resuming:m=!1,resumeError:g=null,active:v=!0}){const{state:y,attached:x,readOnly:S,send:w,sendRefusal:k,cancel:E,answer:D,setMode:A,setConfig:N}=Lz(e,{live:l,connect:d,load:h}),{conversation:z,session:V,failure:ee}=y,$=tz(e),ae=z.turns.length===0?$.data:void 0,me=a.jsx(z4,{sessionId:e,conversation:z,session:V,attached:x,readOnly:S,active:v,send:w,sendRefusal:k,cancel:E,setMode:A,setConfig:N});return a.jsxs("div",{className:"conv",children:[a.jsxs("div",{className:"conv__head",children:[a.jsxs("span",{className:"conv__who",children:[a.jsx(Be,{tone:"agent",children:"◆"}),s===null?t:`${t} · ${s}`]}),V&&a.jsxs("span",{className:"conv__adapter",children:["sessão ",V.acpSessionId.slice(0,8)," · ",V.model," · ",V.mode]}),a.jsx("span",{className:"spacer"}),n&&a.jsx(QC,{...n,empty:z.turns.length===0}),S&&f&&a.jsx(J,{variant:"primary",size:"sm",disabled:m,onClick:f,children:m?"retomando…":"↻ retomar"}),z.streaming&&!S&&a.jsxs(J,{variant:"ghost",size:"sm",onClick:E,children:["■ interromper ",a.jsx("span",{className:"kbd",children:"esc"})]})]}),g&&a.jsx("div",{className:"conv__banner",children:a.jsx(Ce,{tone:"danger",children:g})}),(n==null?void 0:n.error)&&a.jsx("div",{className:"conv__banner",children:a.jsx(Ce,{tone:"danger",children:n.error})}),ae!==void 0&&ae.pendingPrompt!==null?S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"conv__scroll",children:a.jsx(tk,{prompt:ae.pendingPrompt,reason:ae.pendingReason,dead:!0})}),me]}):a.jsx(nz,{sessionId:e,prompt:ae.pendingPrompt,reason:ae.pendingReason,detail:ae.pendingDetail}):a.jsxs(a.Fragment,{children:[a.jsx(_z,{conversation:z,session:V,failure:ee,readOnly:S,answer:D,...o===void 0?{}:{sessionLink:o},...n===void 0?{}:{continueIn:n}}),a.jsx(Nz,{conversation:z,readOnly:S,active:v}),me]})]})}function zz({tab:e,scope:t,cwd:s,active:n,viewer:o=null,onResume:l,resuming:d=!1,resumeError:h=null,onStarted:f,onContinueIn:m,continuing:g=!1,continueError:v=null,sessionLink:y}){const x=e.kind==="agent",S=e.transport==="acp",w=!S&&e.state!=="running";return a.jsx("div",{className:`pane ${S?"pane--conv":"pane--term"}`,role:"tabpanel",hidden:!n,"aria-label":w?`registro de ${e.label}`:`sessão ${e.label}`,children:a.jsxs(PC,{viewer:o,children:[!S&&a.jsxs("div",{className:"term-head",children:[a.jsx(Be,{tone:x?"agent":"shell",children:x?"◆":"●"}),a.jsxs("span",{className:"term-head__cmd",title:`${e.command} · cwd ${s}`,children:[e.command," ",a.jsxs("span",{className:"dim",children:["· cwd ",s]})]}),w?a.jsxs(a.Fragment,{children:[a.jsx(kt,{tone:"neutral",children:"registro"}),a.jsxs(kt,{tone:e.exitCode===0?"exited":"failed",dot:!0,children:["exited (",e.exitCode??"?",")"]})]}):a.jsx(kt,{tone:"running",dot:!0,children:"running"})]}),w&&a.jsx(qz,{scope:t,onStarted:x?null:f}),S?a.jsx(Bz,{sessionId:e.sessionId,agentName:e.agentName,accountLabel:e.accountLabel,...m?{continueIn:{currentAccountId:e.accountId,onContinue:m,pending:g,error:v}}:{},...y?{sessionLink:y}:{},live:e.state==="running",active:n,...l?{onResume:l}:{},resuming:d,...h?{resumeError:h}:{}},e.sessionId):a.jsx(gh,{sessionId:e.sessionId,readOnly:w},e.sessionId)]})})}function qz({scope:e,onStarted:t}){const{createShell:s}=Po(e);return a.jsxs("div",{className:"term-note",children:[a.jsx(Ce,{tone:"info",...t!==null?{actions:a.jsx(J,{size:"sm",variant:"default",disabled:s.isPending,onClick:()=>s.mutate(void 0,{onSuccess:n=>t(n.id)}),children:"nova sessão igual"})}:{},children:"Esta sessão encerrou. O que está abaixo é o registro do que ela imprimiu, somente leitura — o processo não existe mais e não há o que digitar."}),s.isError&&a.jsx(Ce,{tone:"danger",children:s.error.message})]})}function nk(e,t){return e.filter(s=>s.adapterId===t&&(s.state==="connected"||s.identity===null))}function Pz(e,t,s){const n=ak(e,{adapterId:t.adapterId,accountId:t.id},s);return(n==null?void 0:n.authRequired)===!0}function rk(e,t,s){const n=nk(s,e).find(o=>o.isDefault);return n===void 0?{adapterId:e,config:t}:{adapterId:e,accountId:n.id,config:t}}function Iz(e,t){return{adapterId:e,accountId:t,config:{}}}function ak(e,t,s){const n=e.filter(h=>h.adapterId===t.adapterId),o=n[0];if(o===void 0)return null;if(t.accountId===void 0)return o;const l=n.find(h=>h.accountId===t.accountId);if(l!==void 0)return l;const d=s.find(h=>h.id===t.accountId);return d===void 0||d.isDefault?o:{...o,accountId:d.id,configOptions:[],optionsByModel:{},authRequired:d.state==="connected"?null:!0}}function ba(e){return e.find(t=>t.category==="model"||t.id==="model")??null}function ok(e){return e.find(t=>t.category==="thought_level"||t.category==="effort")??null}function lk(e,t){var n;const s=e.optionsByModel[t];return s!==void 0?s:((n=ba(e.configOptions))==null?void 0:n.currentValue)===t?e.configOptions:null}function Hz(e,t,s=null){const n=ba(e.configOptions);if(n===null)return null;const o=t.config[n.id];if(o!==void 0)return o;const l=(s==null?void 0:s.defaultModel)??null;return l!==null&&n.choices.some(d=>d.value===l)?l:n.currentValue}function Y_(e){return e.installed?e.authRequired===!0?"sem login":null:"não instalado"}function Fz(e,t=[]){const n=e.find(o=>o.adapterId===Xp&&Y_(o)===null)??e.find(o=>Y_(o)===null);return rk((n==null?void 0:n.adapterId)??Xp,{},t)}function Uz(e,t,s=null,n=[]){const o=ba(e.configOptions),l=o===null?{}:{[o.id]:t};return(s==null?void 0:s.adapterId)===e.adapterId&&s.accountId!==void 0?{adapterId:e.adapterId,accountId:s.accountId,config:l}:rk(e.adapterId,l,n)}const $z=[],ck=[];function uk(e){const t=Og(e).data??$z,s=zc().data??ck,[n,o]=j.useState(null);return{catalog:t,accounts:s,choice:n??Fz(t,s),choose:o}}function dk({catalog:e,accounts:t=ck,value:s,onChange:n,disabled:o=!1,defaultOpen:l=!1,onLogin:d}){var D,A;const[h,f]=j.useState(l),m=ak(e,s,t),g=t.find(N=>N.id===s.accountId)??null,v=m===null?null:Hz(m,s,g),y=m===null||v===null?null:((A=(D=ba(m.configOptions))==null?void 0:D.choices.find(N=>N.value===v))==null?void 0:A.name)??v,x=m===null?s.adapterId:m.label,S=m===null||v===null?null:Wz(m,v,s,g),w=nk(t,s.adapterId),k=w.length>1?(g==null?void 0:g.label)??null:null,E=k===null?x:`${x} · ${k}`;return a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"config",children:[a.jsxs("button",{type:"button",className:"pill pill--agent focus-ring","aria-haspopup":"menu","aria-expanded":h,"aria-label":`agente e modelo: ${E} · ${y??"carregando modelos"}`,disabled:o,onClick:()=>f(!h),children:[a.jsx("span",{className:"pill__who",children:x}),k!==null&&a.jsx("span",{className:"pill__acct",children:k}),a.jsx("span",{className:"pill__model",children:y??"carregando modelos…"}),a.jsx("span",{className:"pill__caret","aria-hidden":"true",children:"▾"})]}),h&&!o&&a.jsx("div",{className:"slash agent-menu",role:"menu","aria-label":"agente e modelo",children:Kz(e,s,m).map(N=>a.jsx(Vz,{view:N,chosen:N.adapterId===s.adapterId?v:null,accounts:N.adapterId===s.adapterId&&w.length>1?w:[],needsLogin:z=>Pz(e,z,t),chosenAccount:s.accountId??null,onLogin:d,onChooseAccount:z=>{f(!1),n(Iz(N.adapterId,z))},onChoose:z=>{f(!1),n(Uz(N,z,s,t))}},N.adapterId))})]}),S!==null&&a.jsx(YC,{mode:"",options:[S],disabled:o,onSwitch:(N,z)=>n({adapterId:s.adapterId,config:{...s.config,[N]:z}})})]})}function Kz(e,t,s){const n=[];for(const o of e)n.some(l=>l.adapterId===o.adapterId)||n.push(o.adapterId===t.adapterId&&s!==null?s:o);return n}function Wz(e,t,s,n){const o=lk(e,t),l=o===null?null:ok(o);if(l===null)return null;const d=m=>m!=null&&l.choices.some(g=>g.value===m),h=s.config[l.id];if(d(h))return{...l,currentValue:h};const f=n==null?void 0:n.defaultEffort;return d(f)?{...l,currentValue:f}:l}function Vz({view:e,chosen:t,accounts:s,chosenAccount:n,needsLogin:o,onChoose:l,onChooseAccount:d,onLogin:h}){const f=Y_(e),m=ba(e.configOptions),g=`agent-menu-${e.adapterId}`;return a.jsxs("div",{className:"agent-menu__group",role:"group","aria-labelledby":g,children:[a.jsxs("div",{className:"agent-menu__head",id:g,children:[e.label,f!==null&&a.jsx("span",{className:"agent-menu__why",children:f})]}),s.length>0&&a.jsx("div",{className:"agent-menu__accts",role:"group","aria-label":`conta do ${e.label}`,children:s.map(v=>{const y=o(v);return a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":v.id===n,className:`agent-menu__acct focus-ring${v.id===n?" agent-menu__acct--on":""}`,disabled:y,...y?{title:"entre em Configurações → Agentes"}:{},onClick:()=>d(v.id),children:y?`${v.label} · sem login`:v.label},v.id)})}),f!==null?a.jsxs("p",{className:"agent-menu__note",children:[e.installed?`entre na conta do ${e.label} para escolher um modelo dele`:`o ${e.label} não está instalado neste daemon`,e.installed&&h!==void 0&&a.jsx("button",{type:"button",className:"agent-menu__act focus-ring",onClick:()=>h(e.adapterId),children:"entrar ↓"})]}):m===null?a.jsx("p",{className:"agent-menu__note",children:"carregando modelos…"}):m.choices.map(v=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":v.value===t,className:`slash__row focus-ring${v.value===t?" slash__row--on":""}`,onClick:()=>l(v.value),children:[a.jsx("span",{className:"slash__cmd",children:v.value}),a.jsx("span",{className:"slash__desc",children:v.description??""})]},v.value))]})}function Yz({worktreeName:e,catalog:t,accounts:s,choice:n,onChoiceChange:o,draft:l,onDraftChange:d,onSend:h,opening:f=!1,error:m=null,onLogin:g}){const v=t.find(w=>w.adapterId===n.adapterId)??null,y=(v==null?void 0:v.label)??n.adapterId,x=(v==null?void 0:v.commands)??[],S=!f&&l.trim()!=="";return a.jsxs("div",{className:"conv",children:[a.jsxs("div",{className:"conv__head",children:[a.jsxs("span",{className:"conv__who",children:[a.jsx(Be,{tone:"agent",children:"◆"}),y]}),a.jsx("span",{className:"conv__adapter",children:"rascunho · nada aberto ainda"})]}),a.jsxs("div",{className:"conv__scroll",children:[m!==null&&a.jsx(Ce,{tone:"danger",children:m}),f?a.jsxs(a.Fragment,{children:[a.jsx(tv,{role:"user",children:a.jsx("div",{className:"msg msg--queued",children:l})}),a.jsxs("p",{className:"draft__opening",role:"status",children:[a.jsx("span",{className:"draft__pulse","aria-hidden":"true"}),"abrindo ",y,"…"]})]}):a.jsxs("div",{className:"empty empty--conversation",children:[a.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"◆"}),a.jsxs("span",{className:"empty__title",children:["Nova conversa em ",a.jsxs("code",{className:"draft__where",children:["/",e]})]}),a.jsx("span",{className:"empty__sub",children:x.length>0?`Nada sobe até você mandar. / abre os ${String(x.length)} comandos deste projeto.`:"Nada sobe até você mandar. Os comandos / deste projeto aparecem depois da primeira mensagem."})]})]}),a.jsx("div",{className:"composer",children:a.jsx(VC,{value:l,onChange:d,onSubmit:()=>{S&&h()},commands:f?[]:x,placeholder:f?`abrindo ${y}…`:"escreva, ou / para comandos",disabled:f,action:a.jsxs(J,{variant:"primary",size:"sm",disabled:!S,onClick:h,children:[f?"abrindo…":"enviar"," ",a.jsx("span",{className:"kbd",children:"⏎"})]}),children:a.jsx(dk,{catalog:t,...s===void 0?{}:{accounts:s},value:n,onChange:o,disabled:f,defaultOpen:m!==null,onLogin:g},m??"ok")})})]})}function Gz({scope:e,projectId:t,worktreeName:s,active:n,initialText:o="",onCreated:l}){var S;const{catalog:d,accounts:h,choice:f,choose:m}=uk(t),[g,v]=j.useState(o),{createAgent:y}=Po(e);function x(){const w=g;w.trim()===""||y.isPending||y.mutate({adapterId:f.adapterId,config:{...f.config},...f.accountId===void 0?{}:{agentAccountId:f.accountId}},{onSuccess:k=>{Ho({sessionId:k.id,text:w,send:!0}),l(k.id)}})}return a.jsx("div",{className:"pane pane--conv",role:"tabpanel",hidden:!n,"aria-label":"rascunho",children:a.jsx(Yz,{worktreeName:s,catalog:d,accounts:h,choice:f,onChoiceChange:m,draft:g,onDraftChange:v,onSend:x,opening:y.isPending,error:((S=y.error)==null?void 0:S.message)??null})})}const Nw=12;function Qz({ptySessionId:e,onFinished:t,connect:s=pC}){const[n,o]=j.useState([]),[l,d]=j.useState(null),[h,f]=j.useState(!1),m=j.useRef(t);return m.current=t,j.useEffect(()=>{if(e===null)return;o([]),d(null),f(!0);const g=s(e,{onMessage:v=>{if(v.type==="attached"||v.type==="output"){const y=v.type==="attached"?v.snapshot:v.data;o(x=>Ew([...x,...Zz(y)]));return}if(v.type==="exit"){f(!1),d(v.exitCode),m.current(v.exitCode);return}v.type==="error"&&o(y=>Ew([...y,v.message]))},onClose:()=>f(!1)});return()=>g.close()},[e,s]),{output:n,exitCode:l,running:h}}function Zz(e){return e.replace(/\u001B\[[0-9;?]*[A-Za-z]/g,"").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,"").split(/\r?\n/).map(t=>t.trim()).filter(t=>t!=="")}function Ew(e){return e.length<=Nw?e:e.slice(e.length-Nw)}function hk({target:e,methods:t,onDone:s}){var V,ee;const[n,o]=j.useState(null),[l,d]=j.useState(null),[h,f]=j.useState(""),[m,g]=j.useState(null),v=Qz({ptySessionId:n,onFinished:()=>{o(null),s()}}),y=cD(),x=uD(),S=dD(m),w=hD(),k=(V=S.data)==null?void 0:V.state;if(n!==null||v.running)return D();if(m!==null&&k==="ok")return N();if(m!==null&&(k==="running"||k===void 0))return A();if(l!==null)return z(l);const E=t.filter($=>$.type!=="terminal"||$.command!==null);if(E.length===0)return a.jsxs(a.Fragment,{children:[a.jsxs(Ce,{tone:"warning",children:["O adaptador não ofereceu nenhuma forma de entrar que o Lumem saiba executar",t.length>0&&a.jsxs(a.Fragment,{children:[" — ele listou ",t.length,", e nenhuma delas dá para rodar"]}),"."]}),a.jsx(J,{size:"sm",variant:"ghost",onClick:s,children:"verificar de novo"})]});return a.jsxs(a.Fragment,{children:[E.map(($,ae)=>a.jsxs("button",{type:"button",className:ae===0?"opt opt--primary":"opt",disabled:y.isPending||x.isPending,onClick:()=>{if($.type==="terminal"){y.mutate({methodId:$.id,target:e},{onSuccess:me=>o(me.ptySessionId)});return}if(pD($)){d($);return}x.mutate({methodId:$.id,target:e},{onSuccess:me=>g(me.id)})},children:[a.jsxs("span",{className:"opt__t",children:[a.jsx("span",{className:"opt__g","aria-hidden":"true",children:ae===0?"◆":"◇"}),$.name]}),a.jsx("span",{className:"opt__d",children:_D($)})]},$.id)),a.jsxs("span",{className:"setup__note",children:["Estas opções vieram ",a.jsx("b",{children:"do próprio adaptador"}),", no handshake. O Lumem não inventa método de login."]}),y.isError&&a.jsx(Ce,{tone:"danger",children:y.error.message}),x.isError&&a.jsx(Ce,{tone:"danger",children:x.error.message}),k==="failed"&&((ee=S.data)==null?void 0:ee.message)!=null&&a.jsx(Ce,{tone:"danger",children:S.data.message})]});function D(){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"prep",children:[a.jsxs("div",{className:"prep__r prep__r--done",children:[a.jsx("span",{className:"prep__m","aria-hidden":"true",children:"✓"}),"adaptador de pé"]}),a.jsxs("div",{className:"prep__r prep__r--now",children:[a.jsx("span",{className:"prep__m","aria-hidden":"true",children:"◐"}),"autorize no navegador e volte"]})]}),v.output.length>0&&a.jsx("div",{className:"out out--short",children:v.output.map(($,ae)=>a.jsx("span",{className:"l",children:$},ae))}),a.jsx("div",{className:"setup__acts",children:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>o(null),children:"cancelar"})}),a.jsx("span",{className:"setup__note",children:"Terminou lá? Este painel muda sozinho — quem confirma é o adaptador respondendo, não você dizendo que entrou."})]})}function A(){var ae;const $=((ae=S.data)==null?void 0:ae.elicitation)??null;return a.jsxs(a.Fragment,{children:[$!==null&&a.jsxs("div",{className:"dcode",children:[a.jsx("span",{className:"dcode__k",children:"abra em qualquer aparelho"}),a.jsx(Sg,{command:$.url}),$.code!==null&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"dcode__k",children:"e digite este código"}),a.jsx("span",{className:"dcode__v",children:$.code})]}),a.jsx("span",{className:"setup__note",children:$.message})]}),a.jsx("div",{className:"prep",children:a.jsxs("div",{className:"prep__r prep__r--now",children:[a.jsx("span",{className:"prep__m","aria-hidden":"true",children:"◐"}),$===null?"entrando…":"esperando você autorizar"]})}),a.jsx("div",{className:"setup__acts",children:a.jsx(J,{size:"sm",variant:"ghost",disabled:w.isPending,onClick:()=>w.mutate(m??"",{onSuccess:()=>g(null)}),children:"cancelar"})}),a.jsx("span",{className:"setup__note",children:$===null?"Terminou lá? Este painel muda sozinho — quem confirma é o adaptador respondendo.":"Nada abre aqui, e é de propósito: o daemon pode estar noutra máquina."})]})}function N(){return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"prep",children:a.jsxs("div",{className:"prep__r prep__r--done",children:[a.jsx("span",{className:"prep__m","aria-hidden":"true",children:"✓"}),"credencial aceita pelo adaptador"]})}),a.jsx("div",{className:"setup__acts",children:a.jsx(J,{size:"sm",variant:"primary",onClick:()=>{g(null),s()},children:"continuar"})})]})}function z($){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"key-in",children:[a.jsx(Ft,{type:"password","aria-label":"chave de API",placeholder:"sk-…",value:h,onChange:ae=>f(ae.target.value)}),a.jsx(J,{size:"sm",variant:"primary",disabled:h.trim()===""||x.isPending,onClick:()=>{x.mutate({methodId:$.id,apiKey:h.trim(),target:e},{onSuccess:ae=>g(ae.id)}),f(""),d(null)},children:"usar"})]}),a.jsxs("span",{className:"setup__note",children:["Ela ",a.jsx("b",{children:"atravessa"})," o daemon e vai para o adaptador. O Lumem não grava chave: não vai para o ",a.jsx("code",{children:"~/.lumem"}),", não vai para log, e não volta para esta tela."]}),a.jsx("button",{type:"button",className:"linkbtn",onClick:()=>d(null),children:"voltar aos jeitos de entrar"})]})}}function Xz({config:e,onClose:t,onCustom:s}){var x,S;const[n,o]=j.useState(!1),l=x1(e),d=S1(),h=((S=(x=l.data)==null?void 0:x.agentInfo)==null?void 0:S.title)??e.name;return a.jsxs("div",{className:"setup",role:"group","aria-label":`agente ${e.name}`,children:[a.jsxs("div",{className:"setup__head",children:[a.jsx("span",{className:"setup__t",children:f()}),a.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:t,children:"✕"})]}),m()]});function f(){var w;return n?"Adaptador":l.isError?"Não deu para conectar":((w=l.data)==null?void 0:w.authRequired)===!0?`Entrar no ${h}`:h}function m(){var w;return n?v():l.isError?y(l.error.message):((w=l.data)==null?void 0:w.authRequired)===!0?a.jsx(hk,{target:{command:e.command,args:e.args},methods:l.data.authMethods,onDone:()=>void d()}):g()}function g(){const w=l.data;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"acct",children:[a.jsxs("div",{className:"acct__r",children:[a.jsx("span",{className:"acct__k",children:"agente"}),a.jsxs("span",{className:"acct__v",children:[a.jsx("b",{children:h}),(w==null?void 0:w.agentInfo)!=null&&a.jsxs(a.Fragment,{children:[" · ",w.agentInfo.version]})]})]}),a.jsxs("div",{className:"acct__r",children:[a.jsx("span",{className:"acct__k",children:"entrada"}),a.jsx("span",{className:"acct__v",children:(w==null?void 0:w.loggedIn)===!0?"credencial local, já válida":"credencial local"})]}),a.jsxs("div",{className:"acct__r",children:[a.jsx("span",{className:"acct__k",children:"padrão"}),a.jsx("span",{className:"acct__v",children:(w==null?void 0:w.currentMode)??"o padrão do agente"})]})]}),a.jsxs("div",{className:"setup__acts",children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>void d(),children:"verificar de novo"}),a.jsx("button",{type:"button",className:"linkbtn",onClick:()=>o(!0),children:"avançado"})]}),a.jsxs("span",{className:"setup__note",children:["Trocar de conta é ",a.jsx("code",{children:"/logout"})," no seu agente: o Lumem ainda não chama a capacidade"," ",a.jsx("code",{children:"auth.logout"}),", então um botão aqui não faria nada."]})]})}function v(){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"acct",children:[a.jsxs("div",{className:"acct__r",children:[a.jsx("span",{className:"acct__k",children:"comando"}),a.jsx("span",{className:"acct__v",children:e.command})]}),a.jsxs("div",{className:"acct__r",children:[a.jsx("span",{className:"acct__k",children:"args"}),a.jsx("span",{className:"acct__v",children:e.args.length?e.args.join(" "):"nenhum"})]}),a.jsxs("div",{className:"acct__r",children:[a.jsx("span",{className:"acct__k",children:"versão"}),a.jsx("span",{className:"acct__v",children:e.adapterVersion??"não fixada"})]})]}),a.jsxs("span",{className:"setup__note",children:["Só para quem mantém o próprio adaptador. O Lumem usa o que instalou e a versão que fixou — para trocar, remova esta configuração em ",a.jsx("b",{children:"outro agente ACP…"})," e crie a sua."]}),a.jsx("button",{type:"button",className:"linkbtn",onClick:()=>o(!1),children:"voltar"})]})}function y(w){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fail",children:[a.jsxs("span",{className:"fail__title",children:[a.jsx("span",{"aria-hidden":"true",children:"✕"}),"não deu para conectar"]}),a.jsx("span",{className:"fail__body",children:"O adaptador não respondeu ao handshake. O que ele disse está abaixo."}),a.jsx("div",{className:"fail__cmd",children:w})]}),a.jsxs("div",{className:"setup__acts",children:[a.jsx(J,{size:"sm",variant:"primary",onClick:()=>void d(),children:"tentar de novo"}),a.jsx("button",{type:"button",className:"linkbtn",onClick:s,children:"outro agente ACP…"})]})]})}}function Jz(e){var t;return e.isPending?{tone:"off",word:"verificando"}:e.isError?{tone:"err",word:"falhou"}:((t=e.data)==null?void 0:t.authRequired)===!0?{tone:"warn",word:"entrar"}:{tone:"on",word:"conectado"}}function e6({config:e,open:t,onOpen:s}){const n=x1(e),{tone:o,word:l}=Jz(n);return a.jsxs("button",{type:"button",className:`foot-row foot-row--${o}${t?" is-open":""}`,"aria-label":`${e.name}: ${l}`,onClick:s,children:[a.jsx(Be,{tone:"agent",children:"◆"}),a.jsx("span",{className:"foot-row__label",children:e.name}),a.jsx("span",{className:"pip"}),a.jsx("span",{className:"foot-row__st",children:l})]})}function t6({configured:e,onClose:t,onCustom:s,onConnected:n}){const[o,l]=j.useState("idle"),[d,h]=j.useState(null),f=Ag(),m=w1(f.data,l),g=v=>{h(v),m.mutate(v,{onSuccess:y=>n(y),onSettled:()=>l("idle")})};return a.jsxs("div",{className:"setup",role:"group","aria-label":"conectar agente",children:[a.jsxs("div",{className:"setup__head",children:[a.jsx("span",{className:"setup__t",children:m.isPending?`Preparando o ${(d==null?void 0:d.label)??"agente"}`:"Conectar agente"}),!m.isPending&&a.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:t,children:"✕"})]}),m.isPending?a.jsx(s6,{spec:d,stage:o,entry:Jp(f.data,d==null?void 0:d.id)}):a.jsxs(a.Fragment,{children:[Tg.map((v,y)=>{const x=Jp(f.data,v.id),S=(x==null?void 0:x.adapter.path)!=null&&e.includes(x.adapter.path);return a.jsxs("button",{type:"button",className:y===0&&!S?"opt opt--primary":"opt",disabled:S||m.isPending||f.isPending,onClick:()=>g(v),children:[a.jsxs("span",{className:"opt__t",children:[a.jsx("span",{className:"opt__g","aria-hidden":"true",children:"◆"}),v.label]}),a.jsx("span",{className:"opt__d",children:mD(v,x,S===!0,f.isPending)})]},v.id)}),a.jsx("button",{type:"button",className:"linkbtn",onClick:s,children:"outro agente ACP…"}),a.jsxs("span",{className:"setup__note",children:["A lista é o ",a.jsx("b",{children:"catálogo do daemon"}),". O adaptador é instalado"," ",a.jsx("b",{children:"dentro da pasta do app"})," e fixado numa versão — nunca ",a.jsx("code",{children:"@latest"}),", para uma atualização de madrugada não mudar o comportamento do agente."]}),m.isError&&a.jsx(Ce,{tone:"danger",children:m.error.message})]})]})}function s6({spec:e,stage:t,entry:s}){var o;const n=[];return(e==null?void 0:e.cli)!=null&&n.push([`${e.cli.command} encontrado`,((o=s==null?void 0:s.cli)==null?void 0:o.path)==null?"wait":"done"]),n.push(["instalando o adaptador",t==="installing"?"now":t==="handshaking"?"done":"wait"]),n.push(["handshake",t==="handshaking"?"now":"wait"]),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"prep",children:n.map(([l,d])=>a.jsxs("div",{className:`prep__r prep__r--${d}`,children:[a.jsx("span",{className:"prep__m","aria-hidden":"true",children:d==="done"?"✓":d==="now"?"◐":"○"}),l]},l))}),a.jsx("span",{className:"setup__note",children:e!==null&&e.cli===null?a.jsxs(a.Fragment,{children:["Duas linhas, e não três: este adaptador ",a.jsx("b",{children:"não precisa de CLI no PATH"})," — ele traz o próprio. Não há o que procurar na sua máquina."]}):a.jsxs(a.Fragment,{children:["Nada para rodar no terminal: o adaptador é instalado ",a.jsx("b",{children:"dentro da pasta do app"})," e fixado numa versão."]})})]})}function fk(){return be({queryKey:Nj(),queryFn:()=>Q.secrets.list.query()})}function i6(){const e=$e();return{set:Se({mutationFn:s=>Q.secrets.set.mutate({id:s.id,value:s.value}),onSuccess:async()=>{await e.invalidateQueries({queryKey:Nj()})}})}}function n6({slot:e,onClose:t}){const[s,n]=j.useState(""),{set:o}=i6();return a.jsx(hh,{open:!0,title:e.label,onClose:t,footer:a.jsxs(a.Fragment,{children:[e.present?a.jsx(J,{variant:"danger",className:"modal__destructive",onClick:()=>o.mutate({id:e.id,value:""},{onSuccess:t}),disabled:o.isPending,children:"remover"}):null,a.jsx(J,{onClick:t,children:"cancelar"}),a.jsx(J,{variant:"primary",disabled:s.trim()===""||o.isPending,onClick:()=>o.mutate({id:e.id,value:s},{onSuccess:t}),children:"guardar"})]}),children:a.jsx(Ht,{id:`secret-${e.id}`,label:"chave de API",error:o.isError?"não deu para guardar":void 0,hint:a.jsxs(a.Fragment,{children:[e.hint,". O Lumem guarda ",a.jsx("b",{children:"cifrada"})," e ",a.jsx("b",{children:"nunca a mostra de volta"}),"."]}),children:a.jsx(Ft,{id:`secret-${e.id}`,type:"password",autoComplete:"off",placeholder:e.present?"há uma chave guardada — cole outra para trocar":"",value:s,onChange:l=>n(l.target.value)})})})}function r6(){const[e,t]=j.useState(null),n=fk().data??[];return n.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"foot-head",children:a.jsx("span",{className:"foot-head__label",children:"Credenciais"})}),n.map(o=>a.jsxs("button",{type:"button",className:`foot-row foot-row--${o.present?"on":"off"} focus-ring`,onClick:()=>t(o),children:[a.jsx("span",{className:"glyph glyph--key",children:"⚿"}),a.jsx("span",{className:"foot-row__label",children:o.label}),a.jsx("span",{className:"pip"}),a.jsx("span",{className:"foot-row__st",children:o.present?"guardada":"sem chave"})]},o.id)),e===null?null:a.jsx(n6,{slot:e,onClose:()=>t(null)})]})}function a6(){const[e,t]=j.useState(null),[s,n]=j.useState(!1),l=Bo().data??[],d=(e==null?void 0:e.kind)==="agent"?l.find(f=>f.id===e.id):void 0,h=j.useCallback(()=>t(null),[]);return a.jsxs(a.Fragment,{children:[s&&a.jsxs("div",{className:"setup",role:"group","aria-label":"outro agente ACP",children:[a.jsxs("div",{className:"setup__head",children:[a.jsx("span",{className:"setup__t",children:"Outro agente ACP"}),a.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:()=>n(!1),children:"✕"})]}),a.jsx(fD,{embedded:!0,onClose:()=>n(!1)})]}),!s&&(e==null?void 0:e.kind)==="connect"&&a.jsx(t6,{configured:l.map(f=>f.command),onClose:h,onCustom:()=>{n(!0),t(null)},onConnected:f=>t({kind:"agent",id:f})}),!s&&d!==void 0&&a.jsx(Xz,{config:d,onClose:h,onCustom:()=>n(!0)}),a.jsxs("div",{className:"foot-head",children:[a.jsx("span",{className:"foot-head__label",children:"Agentes"}),a.jsx("button",{type:"button",className:"act",title:"conectar um agente","aria-label":"conectar um agente",onClick:()=>t({kind:"connect"}),children:"+"})]}),l.length===0?a.jsx("span",{className:"foot-empty",children:"nenhum agente conectado"}):l.map(f=>a.jsx(e6,{config:f,open:(e==null?void 0:e.kind)==="agent"&&e.id===f.id,onOpen:()=>t({kind:"agent",id:f.id})},f.id)),a.jsx(r6,{})]})}function o6(e){return{id:e.id,adapterId:e.adapterId,label:e.label,kind:e.kind==="api_key"?"api_key":"subscription",state:e.state==="connected"?"connected":"disconnected",identity:e.identity===null?null:{email:e.identity.email??null,plan:e.identity.plan??null},defaultModel:e.defaultModel,defaultEffort:e.defaultEffort,isDefault:e.isDefault,bare:e.bare,sessionCount:e.sessionCount,defaultsUnavailable:e.defaultsUnavailable}}function zc(){return be({queryKey:ST(),queryFn:async()=>(await Q.agentAccount.list.query()).map(o6)})}function sv(){const e=$e(),t=async()=>{await e.invalidateQueries({queryKey:vg}),await e.invalidateQueries({queryKey:qd})},s=Se({mutationFn:f=>Q.agentAccount.connect.mutate(f),onSuccess:t}),n=Se({mutationFn:f=>Q.agentAccount.disconnect.mutate({accountId:f}),onSuccess:t}),o=Se({mutationFn:f=>Q.agentAccount.purge.mutate(f),onSuccess:t}),l=Se({mutationFn:f=>Q.agentAccount.setDefault.mutate({accountId:f}),onSuccess:t}),d=Se({mutationFn:f=>Q.agentAccount.setDefaults.mutate(f),onSuccess:t}),h=Se({mutationFn:f=>Q.agentAccount.rename.mutate(f),onSuccess:t});return{connect:s,disconnect:n,purge:o,setDefault:l,setDefaults:d,rename:h}}function l6(e){const t=$e(),s=w1(e);return Se({mutationFn:async n=>{await s.mutateAsync(n),await Q.setup.probe.query({adapterId:n.id})},onSettled:async()=>{await t.invalidateQueries({queryKey:vg}),await t.invalidateQueries({queryKey:qd})}})}function c6(e,t){return be({queryKey:jT(e.accountId),queryFn:()=>Q.setup.probe.query({adapterId:e.adapterId,accountId:e.accountId}),enabled:t,retry:!1,refetchOnWindowFocus:!1})}function u6({taskId:e,workspaceId:t,onBack:s,onWork:n}){const[o,l]=j.useState(!1),d=OO(e),h=l1(t,e);if(d.isError)return a.jsx(Ce,{tone:"danger",children:d.error.message});if(d.isPending)return a.jsx(ss,{label:"buscando a tarefa"});if(d.data===null)return a.jsx(Ce,{tone:"warning",children:"esta tarefa não existe mais"});const f=d.data,m=f.status==="done"||f.status==="dropped";return a.jsxs("div",{className:"task-detail",children:[a.jsxs("div",{className:"crumb",children:[a.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:s,children:"Tarefas"}),a.jsx("span",{className:"crumb__sep",children:"/"}),a.jsx("span",{className:"crumb__here",children:f.title})]}),a.jsxs("div",{className:"task-detail__head",children:[a.jsx("h2",{className:"task-detail__title",children:f.title}),a.jsxs("span",{className:"task-detail__acts",children:[!m&&a.jsx(J,{variant:"primary",onClick:()=>l(!0),children:"trabalhar nesta tarefa"}),!m&&a.jsx(J,{onClick:()=>h.mutate({status:"done"}),children:"marcar done"}),!m&&a.jsx(J,{variant:"ghost",onClick:()=>{const g=window.prompt("por que descartar esta tarefa?");g!==null&&g.trim()!==""&&h.mutate({status:"dropped",reason:g.trim()})},children:"descartar"}),m&&a.jsx(J,{onClick:()=>h.mutate({status:"open"}),children:"reabrir"})]})]}),h.isError&&a.jsx(Ce,{tone:"danger",children:h.error.message}),a.jsxs("div",{className:"chips",children:[a.jsx(kt,{children:f.status}),f.createdBy==="agent"&&a.jsx(kt,{children:"◆ proposta por agente"}),f.worktreeId===null?a.jsx(kt,{children:"sem checkout"}):a.jsx(kt,{tone:"branch",children:"◇ checkout"}),f.reason!==null&&f.reason!==""&&a.jsx(kt,{children:f.reason})]}),f.body!==""&&a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"O corpo"}),a.jsx("div",{className:"task-detail__body",children:f.body})]}),a.jsx(d6,{taskId:e}),o&&a.jsx(h6,{taskId:e,projectId:f.projectId,title:f.title,body:f.body,worktreeId:f.worktreeId,onClose:()=>l(!1),onOpened:g=>{l(!1),n(g)}})]})}function d6({taskId:e}){const t=l5(e),s=t.data??[];return a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"As sessões",count:s.length}),t.isError?a.jsx(Ce,{tone:"danger",children:t.error.message}):t.isPending?a.jsx(ss,{label:"buscando as sessões",widths:["80%"]}):s.length===0?a.jsx("p",{className:"detail__hint",children:"ninguém trabalhou nesta tarefa ainda"}):a.jsx("div",{className:"tlist",children:s.map(n=>a.jsxs("div",{className:"task-sessions",children:[a.jsxs("span",{className:"task-sessions__kind",children:[a.jsx("span",{className:`glyph glyph--${n.kind==="agent"?"agent":"shell"}`,"aria-hidden":"true",children:n.kind==="agent"?"◆":"●"}),n.agentName??n.kind]}),a.jsx("span",{className:"task-sessions__when",children:n.command}),a.jsxs("span",{className:`task-sessions__st task-sessions__st--${n.state}`,children:[a.jsx("span",{className:"task-sessions__dot","aria-hidden":"true"}),n.state==="running"?"viva":"encerrada"]})]},n.id))})]})}function h6({taskId:e,projectId:t,title:s,body:n,worktreeId:o,onClose:l,onOpened:d}){var N,z,V,ee;const[h,f]=j.useState(o===null?"new":"existing"),[m,g]=j.useState(()=>f6(s)),[v,y]=j.useState(o),x=iv(t),S=Bo(),[w,k]=j.useState(null),E=w??((z=(N=S.data)==null?void 0:N[0])==null?void 0:z.id)??null,D=DO(e,t,n),A=()=>{D.mutate({mode:h,name:m,checkout:v,agentConfigId:E},{onSuccess:$=>d({projectId:t,...$})})};return a.jsx(hh,{open:!0,title:"Trabalhar nesta tarefa",onClose:l,children:a.jsxs("div",{className:"work",children:[a.jsxs("div",{className:"seg",role:"group","aria-label":"onde trabalhar",children:[a.jsx("button",{type:"button",className:"seg__btn","aria-pressed":h==="new",onClick:()=>f("new"),children:"worktree nova"}),a.jsx("button",{type:"button",className:"seg__btn","aria-pressed":h==="existing",onClick:()=>f("existing"),children:"checkout existente"})]}),h==="new"?a.jsxs("label",{className:"field",children:[a.jsx("span",{className:"field__label",children:"Nome da worktree"}),a.jsx("input",{className:"input",value:m,onChange:$=>g($.target.value)}),a.jsx("span",{className:"field__help",children:"derivado do título — a sugestão é do Lumem, e o nome continua seu"})]}):a.jsx("div",{className:"work__list",role:"listbox","aria-label":"checkouts",children:(x.data??[]).map($=>a.jsxs("button",{type:"button",role:"option","aria-selected":v===$.id,className:`wopt${v===$.id?" is-selected":""}`,onClick:()=>y($.id),children:[a.jsx("span",{className:"glyph glyph--worktree","aria-hidden":"true",children:"◇"}),a.jsx("span",{className:"wopt__name",children:$.name})]},$.id))}),(((V=S.data)==null?void 0:V.length)??0)>1&&a.jsx("div",{className:"work__list",role:"listbox","aria-label":"agentes",children:(ee=S.data)==null?void 0:ee.map($=>a.jsxs("button",{type:"button",role:"option","aria-selected":E===$.id,className:`wopt${E===$.id?" is-selected":""}`,onClick:()=>k($.id),children:[a.jsx("span",{className:"glyph glyph--agent","aria-hidden":"true",children:"◆"}),a.jsx("span",{className:"wopt__name",children:$.name})]},$.id))}),D.isError&&a.jsx(Ce,{tone:"danger",children:D.error.message}),a.jsxs("div",{className:"modal__foot",children:[a.jsx(J,{variant:"primary",disabled:D.isPending,onClick:A,children:D.isPending?"abrindo…":"abrir"}),a.jsx(J,{variant:"ghost",onClick:l,children:"cancelar"})]})]})})}function f6(e){const t=e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").split("-").slice(0,5).join("-");return t===""?"tarefa":t}function m6({workspaceId:e,place:t,onHome:s,onBoard:n,onSettings:o}){const l=o1(e,void 0),d=Date.now(),h=(l.data??[]).reduce((f,m)=>f+m.cards.filter(g=>$p(g,m.status,d)).length,0);return a.jsxs("nav",{className:"nav","aria-label":"Telas",children:[a.jsx(ho,{depth:0,label:"Home",glyph:a.jsx(Be,{children:"◎"}),selected:t==="home",onSelect:s}),a.jsx(ho,{depth:0,label:"Tarefas",glyph:a.jsx(Be,{children:"▥"}),selected:t==="board",onSelect:n,meta:h===0?void 0:a.jsxs("span",{className:"row__n",children:[h,a.jsx("span",{className:"sr-only",children:h===1?" tarefa esperando você":" tarefas esperando você"})]})}),a.jsx(ho,{depth:0,label:"Configurações",glyph:a.jsx(Be,{children:"⚙"}),selected:t==="settings",onSelect:o})]})}function iv(e,t={}){return be({queryKey:Do(e),queryFn:()=>Q.worktree.listByProject.query({projectId:e}),enabled:t.enabled??!0})}function p6(e){return be({queryKey:dg(e),queryFn:()=>Q.worktree.getDetail.query({id:e})})}function _6(e,t={}){return be({queryKey:G2(e),queryFn:()=>Q.worktree.branches.query({projectId:e}),enabled:t.enabled??!0})}function g6(e,t={}){return be({queryKey:Q2(e),queryFn:()=>Q.worktree.hostOrigins.query({projectId:e}),enabled:t.enabled??!0})}function mk(e){const t=$e(),s=()=>t.invalidateQueries({queryKey:Do(e)}),n=Se({mutationFn:d=>Q.worktree.create.mutate({projectId:e,...d}),onSuccess:s}),o=Se({mutationFn:d=>Q.worktree.start.mutate({projectId:e,...d}),onSuccess:s}),l=Se({mutationFn:d=>Q.worktree.remove.mutate(d),onSuccess:s});return{create:n,start:o,remove:l}}function v6(e){const t=dh(e.workspaceId);return a.jsxs("div",{className:"tree","aria-label":"árvore de projetos",children:[a.jsxs("div",{className:"tree__head",children:[a.jsx("p",{className:"tree__label",children:"Projetos"}),a.jsx("button",{type:"button",className:"act","aria-label":"adicionar projeto",onClick:e.onAddProject,children:"+"})]}),s()]});function s(){if(t.isError)return a.jsx("p",{className:"tree__message",role:"alert",children:t.error.message});if(t.isPending)return a.jsx(ss,{label:"carregando os projetos",widths:["80%","60%","70%"]});const n=t.data??[];return n.length===0?a.jsx(hs,{title:"Nenhum projeto aqui",children:"Aponte para a raiz de um repositório git no disco, ou cole uma URL para clonar."}):n.map(o=>a.jsx(y6,{project:o,...e},o.id))}}function y6({project:e,expansion:t,selection:s,onSelect:n,onCreateWorktree:o}){const l=t.isExpanded(e.id),d={scopeType:"project",scopeId:e.id},h=iv(e.id,{enabled:e.available}),f=h.data??[],m=[d,...f.map(x=>({scopeType:"worktree",scopeId:x.id}))],g=Yg(m),v=q3(e.available&&l?e.id:null),y=x=>(v.data??[]).find(S=>S.worktreeId===x);return a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-kind":"project","data-state":e.available?"available":"missing",children:a.jsx(ho,{depth:0,emphasis:!0,label:e.name,glyph:a.jsx(Be,{tone:e.available?"project":"off",children:"■"}),muted:!e.available,meta:e.available?void 0:"sem disco",count:!l&&g>0?g:void 0,expanded:l,onToggle:()=>t.toggle(e.id),reserveAction:!0,...e.available?{action:a.jsx("button",{type:"button",className:"row__act","aria-label":`nova worktree em ${e.name}`,onClick:()=>o(e),children:"+"})}:{},selected:!1,onSelect:()=>n(e.id,d)})}),l&&e.available&&a.jsxs(a.Fragment,{children:[a.jsx(b6,{projectId:e.id,selected:s.scopeType==="project"&&s.scopeId===e.id,onSelect:()=>n(e.id,d)}),h.isError&&a.jsx("p",{className:"tree__message",role:"alert",children:h.error.message}),f.map(x=>a.jsx(j6,{projectId:e.id,worktree:x,mark:y(x.id),selected:s.scopeType==="worktree"&&s.scopeId===x.id,onSelect:n},x.id))]})]})}function b6({projectId:e,selected:t,onSelect:s}){const n={scopeType:"project",scopeId:e},o=Yg([n]);return a.jsx("div",{"data-kind":"local","data-state":"active",children:a.jsx(ho,{depth:1,label:"local",glyph:a.jsx(Be,{tone:"project",children:"▭"}),meta:a.jsx(pk,{scope:n}),count:o>0?o:void 0,selected:t,onSelect:s})})}function pk({scope:e}){var o,l,d;const t=OC(e),s=(o=t.data)==null?void 0:o.run.last,n=(l=t.data)==null?void 0:l.setup.last;if((s==null?void 0:s.running)===!0){const h=((d=t.data)==null?void 0:d.port)??null;return a.jsxs("span",{className:"runmark",children:[a.jsx("span",{className:"runmark__glyph",children:"▶"}),h===null?"run":`:${String(h.port)}`]})}return n&&!n.running&&n.exitCode!==0?a.jsx(a.Fragment,{children:"setup falhou"}):null}function x6(e){const t=[e.branch===e.name?null:e.branch,e.state==="missing"?"ausente":null].filter(s=>s!==null);return t.length===0?void 0:t.join(" · ")}function S6({mark:e}){return a.jsxs("span",{className:`prmark prmark--${e.verdict}`,children:[a.jsx("span",{className:"prmark__dot","aria-hidden":"true"}),"#",e.number,a.jsxs("span",{className:"sr-only",children:[" pull request ",w6[e.verdict]]})]})}const w6={ready:"pronta para merge",blocked:"bloqueada",pending:"verificando",draft:"em rascunho",merged:"mesclada",closed:"fechada sem merge"};function j6({projectId:e,worktree:t,mark:s,selected:n,onSelect:o}){const l=t.state==="missing",d={scopeType:"worktree",scopeId:t.id},h=Yg([d]),f=Gg(),m=Vg(d),g=f.countIn((m.data??[]).map(v=>v.id));return a.jsx("div",{"data-kind":"worktree","data-state":t.state,children:a.jsx(ho,{depth:1,label:t.name,glyph:a.jsx(Be,{tone:l?"warn":"worktree",children:l?"⚠":"◇"}),muted:l,meta:s!==void 0&&!l?a.jsx(S6,{mark:s}):x6(t)??(l?void 0:a.jsx(pk,{scope:d}))??void 0,count:g>0?g:h>0?h:void 0,countTone:g>0?"asking":"running",selected:n,onSelect:()=>o(e,d)})})}function C6(){return be({queryKey:aa,queryFn:()=>Q.workspace.list.query()})}function _k(){const e=$e();return j.useCallback(()=>e.invalidateQueries({queryKey:aa}),[e])}function gk(){const e=$e();return Se({mutationFn:t=>Q.workspace.create.mutate({name:t}),onSuccess:async()=>{await e.invalidateQueries({queryKey:aa})}})}function yh(e){const t=$e(),s=Se({mutationFn:m=>Q.workspace.rename.mutate({id:e,name:m}),onSuccess:async()=>{await t.invalidateQueries({queryKey:aa})}}),n=Se({mutationFn:()=>Q.workspace.remove.mutate({id:e}),onSuccess:async()=>{await t.invalidateQueries({queryKey:aa})}}),o=async()=>{await t.invalidateQueries({queryKey:jj(e)}),await t.invalidateQueries({queryKey:uh(e)})},l=Se({mutationFn:m=>Q.workspace.setAutonomy.mutate({id:e,...m}),onSettled:o}),d=Se({mutationFn:m=>Q.workspace.setCleanup.mutate({id:e,mergedAlwaysRemoves:m}),onSettled:o}),h=Se({mutationFn:m=>Q.workspace.setBudget.mutate({id:e,...m}),onSettled:o}),f=Se({mutationFn:m=>Q.workspace.setSlot.mutate({id:e,...m}),onSettled:async()=>{await t.invalidateQueries({queryKey:Sj(e)})}});return{rename:s,remove:n,setAutonomy:l,setCleanup:d,setBudget:h,setSlot:f}}function k6(e){return be({queryKey:Sj(e),queryFn:()=>Q.workspace.slots.query({id:e})})}const vk=[{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"1m",label:"1m"},{id:"6m",label:"6m"},{id:"1y",label:"1a"}];function N6(e,t){return be({queryKey:oT(e,t),queryFn:()=>Q.usage.byProject.query({workspaceId:e,period:t})})}function E6(e,t){return be({queryKey:lT(e,t),queryFn:()=>Q.usage.byWorktree.query({projectId:e,period:t})})}function T6(e,t,s){return be({queryKey:cT(e,t),queryFn:()=>Q.usage.byProjectAndAgent.query({workspaceId:e,period:t}),enabled:s})}function A6(e,t,s){return be({queryKey:uT(e,t),queryFn:()=>Q.usage.byProjectAndAccount.query({workspaceId:e,period:t}),enabled:s})}function O6(e,t){const s=N6(e,t),n=Bo(),o=zc().data??[],l=o.some(m=>o.filter(g=>g.adapterId===m.adapterId).length>1),d=T6(e,t,(n.data??[]).length>1||l),h=A6(e,t,l),f=(s.data??[]).map(m=>({id:m.projectId,name:m.name,tokens:m.tokens,cost:m.cost,currency:m.currency,turns:m.turns,kind:"project",...R6(d.data,h.data,m.projectId)}));return{usage:s,rows:f}}function R6(e,t,s){const n=(e??[]).filter(o=>o.projectId===s).map(o=>({id:o.agentConfigId??"sem-agente",name:o.name,tokens:o.tokens,cost:o.cost,currency:o.currency,turns:o.turns,...D6(t,s,o.agentConfigId)}));return n.length>0?{agents:n}:{}}function D6(e,t,s){const n=(e??[]).filter(o=>o.projectId===t&&o.agentConfigId===s).map(o=>({id:o.agentAccountId??"sem-conta",label:o.label,tokens:o.tokens,cost:o.cost,currency:o.currency,turns:o.turns}));return n.length>1?{accounts:n}:{}}function yk({rows:e}){const t=Math.max(...e.map(l=>l.tokens),0),s=e.some(l=>{var d;return(((d=l.agents)==null?void 0:d.length)??0)>0}),[n,o]=j.useState(new Set);return a.jsx("div",{className:`spend${s?" spend--split":""}`,children:e.map(l=>{const d=l.agents??[],h=d.length>0,f=n.has(l.id),m=h?"div":j.Fragment,g=h?{className:"spend__group"}:{};return a.jsxs(m,{...g,children:[a.jsxs("div",{className:`spend__row${l.tokens===0?" spend__row--idle":""}${l.outside===!0?" spend__row--outside":""}`,children:[s&&a.jsx(a.Fragment,{children:h?a.jsx("button",{type:"button",className:"spend__twist","aria-expanded":f,"aria-label":`${f?"fechar":"abrir"} a divisão por agente de ${l.name}`,onClick:()=>o(v=>{const y=new Set(v);return y.delete(l.id)||y.add(l.id),y}),children:f?"▾":"▸"}):a.jsx("span",{className:"spend__twist"})}),a.jsx(Be,{tone:l.tokens===0?"off":l.kind,children:l.kind==="worktree"?"◫":"▣"}),a.jsx("span",{className:"spend__name",children:l.name}),a.jsx("span",{className:"spend__bar",children:t>0&&l.tokens>0&&a.jsx("span",{className:"spend__fill",style:{"--w":`${String(Math.round(l.tokens/t*100))}%`}})}),a.jsx("span",{className:"spend__tok",children:_c(l.tokens)}),l.cost===null?a.jsx("span",{className:"spend__cost spend__cost--none",children:"sem custo reportado"}):a.jsx("span",{className:"spend__cost",children:xk(l.cost,l.currency)}),a.jsx("span",{className:"spend__turns",children:bk(l.turns)})]}),f&&d.map(v=>a.jsxs(j.Fragment,{children:[a.jsxs("div",{className:`spend__row spend__row--agent${v.name===null?" spend__row--idle":""}`,children:[a.jsx("span",{className:"spend__twist"}),a.jsx(Be,{tone:v.name===null?"off":"agent",children:"◆"}),a.jsx("span",{className:"spend__name",children:v.name??"antes desta versão"}),a.jsx(Tw,{part:v,whole:l.tokens})]}),(v.accounts??[]).map(y=>a.jsxs("div",{className:"spend__row spend__row--agent spend__row--account",children:[a.jsx("span",{className:"spend__twist"}),a.jsx("span",{"aria-hidden":"true"}),a.jsx("span",{className:"spend__name",children:y.label??"conta apagada"}),a.jsx(Tw,{part:y,whole:v.tokens})]},y.id))]},v.id))]},l.id)})})}function Tw({part:e,whole:t}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spend__bar",children:t>0&&e.tokens>0&&a.jsx("span",{className:"spend__fill",style:{"--w":`${String(Math.round(e.tokens/t*100))}%`}})}),a.jsx("span",{className:"spend__tok",children:_c(e.tokens)}),e.cost===null?a.jsx("span",{className:"spend__cost spend__cost--none",children:"sem custo reportado"}):a.jsx("span",{className:"spend__cost",children:xk(e.cost,e.currency)}),a.jsx("span",{className:"spend__turns",children:bk(e.turns)})]})}function bk(e){return e===0?"nenhum turno":e===1?"1 turno":`${String(e)} turnos`}function xk(e,t){const s=e.toFixed(4).replace(".",",");return t==="USD"||t===null?`US$ ${s}`:`${t} ${s}`}function M6({workspaceId:e,workspaceName:t,onRemoved:s,onWorkOnTask:n,view:o,onView:l}){const[d,h]=j.useState("7d"),[f,m]=j.useState(null),g=o==="board",v=k=>{l(k?"board":"home")},y=dh(e),{usage:x,rows:S}=O6(e,d),w=y.data??[];return g?a.jsxs("div",{className:"pane wsp wsp--board",children:[a.jsxs("div",{className:"crumb",children:[a.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:()=>v(!1),children:t}),a.jsx("span",{className:"crumb__sep",children:"/"}),a.jsx("span",{className:"crumb__here",children:"Quadro de tarefas"})]}),a.jsx(VO,{workspaceId:e,onOpen:k=>{v(!1),m(k)}})]}):f!==null?a.jsx("div",{className:"pane wsp",children:a.jsx(u6,{taskId:f,workspaceId:e,onBack:()=>m(null),onWork:k=>{m(null),n==null||n(k)}})}):a.jsxs("div",{className:"pane wsp",children:[a.jsxs("div",{className:"detail__title",children:[a.jsx("h2",{children:t}),a.jsx("span",{className:"wsp__kind",children:"workspace"}),a.jsx("span",{className:"actions__spacer"}),a.jsx(L6,{id:e,name:t}),a.jsx(B6,{id:e,projects:y.isPending?"unknown":w.length,onRemoved:s})]}),a.jsx("div",{className:"chips",children:a.jsxs(kt,{children:[w.length," ",w.length===1?"projeto":"projetos"]})}),y.isError&&a.jsx("div",{className:"detail__banner",children:a.jsx(Ce,{tone:"danger",children:y.error.message})}),y.isPending?a.jsx(ss,{label:"carregando os projetos",widths:["70%","50%"]}):w.length===0?a.jsx(hs,{title:"Nenhum projeto ainda",children:"Um workspace é um conjunto de projetos que se conhecem. Adicione o primeiro pela barra da esquerda — e o que você ensinar aqui já vale para todos eles."}):a.jsx(va,{entries:[{label:"projetos",value:String(w.length)},{label:"sem diretório",value:w.filter(k=>!k.available).length===0?a.jsx("span",{className:"dim",children:"nenhum"}):`${String(w.filter(k=>!k.available).length)} de ${String(w.length)}`}]}),a.jsx(HB,{workspaceId:e,projectName:k=>{var E;return((E=w.find(D=>D.id===k))==null?void 0:E.name)??""}}),a.jsx(XO,{workspaceId:e,onOpen:k=>m(k),onOpenBoard:()=>v(!0)}),a.jsxs("section",{className:"section",children:[a.jsx(xr,{title:"Consumo",aside:a.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo",children:vk.map(k=>a.jsx("button",{type:"button",className:"seg__btn","aria-pressed":d===k.id,onClick:()=>h(k.id),children:k.label},k.id))})}),x.isError?a.jsx(Ce,{tone:"danger",children:x.error.message}):x.isPending?a.jsx(ss,{label:"somando o consumo",widths:["90%","70%"]}):S.length===0?a.jsx("p",{className:"detail__hint",children:"nada gasto ainda neste workspace"}):a.jsx(yk,{rows:S})]}),a.jsx("section",{className:"section",children:a.jsx(kC,{workspaceId:e,projectId:null})})]})}function L6({id:e,name:t}){const[s,n]=j.useState(!1),[o,l]=j.useState(t),{rename:d}=yh(e);return s?a.jsxs("form",{className:"wsp__rename",onSubmit:h=>{h.preventDefault();const f=o.trim();if(f===""||f===t){n(!1);return}d.mutate(f,{onSuccess:()=>n(!1)})},children:[a.jsx("input",{className:"wsp__input focus-ring","aria-label":"Nome do workspace",value:o,autoFocus:!0,onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Escape"&&n(!1)}}),a.jsx(J,{variant:"primary",size:"sm",type:"submit",disabled:d.isPending,children:"salvar"}),d.isError&&a.jsx(Ce,{tone:"danger",children:d.error.message})]}):a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{l(t),n(!0)},children:"renomear"})}function B6({id:e,projects:t,onRemoved:s}){const{remove:n}=yh(e);return a.jsxs(a.Fragment,{children:[a.jsx(J,{variant:"ghost",size:"sm",disabled:t==="unknown"||t>0||n.isPending,onClick:()=>n.mutate(void 0,{onSuccess:s}),children:n.isPending?"removendo…":"remover workspace"}),typeof t=="number"&&t>0&&a.jsxs("span",{className:"wsp__why",children:[t," ",t===1?"projeto dentro":"projetos dentro"]}),n.isError&&a.jsx(Ce,{tone:"danger",children:n.error.message})]})}function z6({workspaces:e,activeId:t,onSelect:s}){const[n,o]=j.useState(!1),[l,d]=j.useState(""),h=gk(),f=m=>{m.preventDefault(),l.trim()!==""&&h.mutate(l,{onSuccess:g=>{s(g.id),o(!1),d("")}})};return a.jsxs("div",{className:"ws",children:[a.jsxs("div",{className:"ws__bar",children:[a.jsx("label",{className:"sr-only",htmlFor:"workspace-select",children:"Workspace"}),a.jsx("span",{className:"ws__glyph","aria-hidden":"true",children:"◈"}),a.jsx("select",{id:"workspace-select",className:"ws__select",value:t??"",onChange:m=>s(m.target.value),children:e.map(m=>a.jsx("option",{value:m.id,children:m.name},m.id))}),a.jsx("span",{className:"ws__caret","aria-hidden":"true",children:"▾"}),a.jsx(J,{size:"sm",variant:"ghost","aria-label":"novo workspace",title:"novo workspace",onClick:()=>o(!0),children:"+"})]}),n&&a.jsxs("form",{className:"ws__form",onSubmit:f,children:[a.jsx(Ht,{id:"new-workspace-name",label:"Nome do novo workspace",children:a.jsx(Ft,{id:"new-workspace-name",value:l,onChange:m=>d(m.target.value),placeholder:"trabalho",autoFocus:!0})}),a.jsxs("div",{className:"ws__actions",children:[a.jsx(J,{type:"submit",variant:"primary",size:"sm",disabled:h.isPending||l.trim()==="",children:"criar"}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>o(!1),children:"cancelar"})]})]}),h.isError&&a.jsx("p",{className:"ws__error",role:"alert",children:h.error.message})]})}const q6=new Set(["no-binary","no-auth","unsupported-host"]);function nv(e,t){const s=t.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60).replace(/-+$/g,"");return s===""?String(e):`${e}-${s}`}function P6(e,t){if(!(e==="default"||t===null)&&e===t.kind)return t}function I6(e,{open:t,onSuggestName:s}){var D,A,N;const[n,o]=j.useState("default"),[l,d]=j.useState(null),h=_6(e,{enabled:t}),f=g6(e,{enabled:t}),m=((D=f.data)==null?void 0:D.issues.failure)??((A=f.data)==null?void 0:A.pulls.failure)??null,g=f.data!==void 0&&(f.data.host===null||q6.has((m==null?void 0:m.kind)??"")),v=g?["default","branch"]:["default","branch","issue","pr"],y=v.includes(n)?n:"default",x=l!==null&&l.kind===y?l:null,S=(x==null?void 0:x.kind)==="pr"&&((N=f.data)==null?void 0:N.pulls.items.some(z=>z.number===x.number&&!z.onDisk))===!0?x.number:null;function w(z){o(z),d(null)}function k(z,V){d(z),s==null||s(V)}function E(){o("default"),d(null)}return{kinds:v,active:y,select:w,pick:l,chosen:x,choose:k,branches:h,host:f,hostOff:g,hostFailure:m,fetching:S,reset:E}}function H6({open:e,onClose:t,projects:s,projectId:n,onProjectChange:o,origin:l,onOriginClick:d,originOpen:h=!1,originPanel:f,prompt:m,onPromptChange:g,name:v,onNameChange:y,catalog:x,accounts:S,choice:w,onChoiceChange:k,onLogin:E,heldBy:D=null,creating:A=!1,error:N=null,blocked:z=!1,onCreate:V}){var M;const[ee,$]=j.useState(!1),[ae,me]=j.useState(!1),H=s.find(K=>K.id===n)??null,B=F6(l,m),O=v.trim()===""?B:v.trim(),se=((M=x.find(K=>K.adapterId===w.adapterId))==null?void 0:M.commands)??[],re=A?null:Xg(m),q=!A&&!z&&m.trim()!=="";return a.jsxs(hh,{open:e,size:"wide",title:"Nova worktree",onClose:t,header:a.jsxs("div",{className:"wtc__head",children:[a.jsxs("span",{className:"wtc__pick",children:[a.jsxs(J,{size:"sm","aria-haspopup":"menu","aria-expanded":ee,"aria-label":`projeto: ${(H==null?void 0:H.name)??"nenhum"}`,onClick:()=>$(!ee),children:[a.jsx(Be,{tone:"project",children:"■"}),(H==null?void 0:H.name)??"projeto"," ▾"]}),ee&&a.jsx(Oc,{label:"projetos",children:s.map(K=>a.jsx(Pi,{glyph:a.jsx(Be,{tone:"project",children:"■"}),onSelect:()=>{$(!1),o(K.id)},children:K.name},K.id))})]}),a.jsx(J,{size:"sm","aria-expanded":ae,"aria-label":"nome da worktree",title:`nome: ${O}`,onClick:()=>me(!ae),children:"…"}),a.jsx("span",{className:"wtc__push"}),a.jsxs("span",{className:"wtc__origin-anchor",children:[a.jsxs(J,{size:"sm","aria-haspopup":"menu","aria-expanded":h,"aria-label":`origem: ${Aw(l)}`,onClick:d,children:[a.jsx(K6,{origin:l}),a.jsx("span",{className:"wtc__origin",children:Aw(l)})," ▾"]}),h&&a.jsx("div",{className:"wtc__origin-panel",children:f})]})]}),footer:a.jsxs(a.Fragment,{children:[a.jsxs(J,{variant:"primary",disabled:!q,onClick:V,children:[A?"criando…":D===null?"Create":`abrir ${D}`," ",a.jsx("span",{className:"kbd",children:"↵"})]}),a.jsx("span",{className:"wtc__sum",children:D===null?a.jsxs(a.Fragment,{children:["cria ",a.jsx("code",{children:O})," ",U6(l)]}):a.jsxs(a.Fragment,{children:["abre ",a.jsx("code",{children:D})," com o texto num rascunho, sem enviar"]})})]}),children:[ae&&a.jsx(Ht,{id:"wtc-name",label:"Nome da worktree",children:a.jsx(Ft,{id:"wtc-name",value:v,placeholder:B,onChange:K=>y(K.target.value)})}),D!==null&&a.jsxs(Ce,{tone:"info",children:["a branch ",a.jsx("code",{children:$6(l)})," já está em checkout em ",a.jsx("b",{children:D})," — o Lumem abre lá em vez de criar outra"]}),N!==null&&a.jsx(Ce,{tone:"danger",children:N}),a.jsxs("div",{className:"composer__box wtc__box",children:[re!==null&&a.jsx(WC,{commands:se,query:re,onChoose:g,onDismiss:()=>g("")}),a.jsx("textarea",{className:`composer__in wtc__in${m===""?" composer__in--empty":""}`,value:m,disabled:A,placeholder:"No que você quer trabalhar?","aria-label":"No que você quer trabalhar?","data-modal-focus":"",onChange:K=>g(K.target.value),onKeyDown:K=>{K.key!=="Enter"||K.shiftKey||K.nativeEvent.isComposing||(K.preventDefault(),q&&V())}}),a.jsx("div",{className:"composer__bar",children:a.jsx(dk,{catalog:x,...S===void 0?{}:{accounts:S},value:w,onChange:k,disabled:A,onLogin:E})})]})]})}function F6(e,t){switch(e.kind){case"default":return nD(t);case"branch":return e.ref;case"issue":return nv(e.number,e.title);case"pr":return e.headRefName}}function Aw(e){switch(e.kind){case"default":return`de ${e.branch}`;case"branch":return e.ref;case"issue":return`#${String(e.number)} ${e.title}`;case"pr":return`PR #${String(e.number)}`}}function U6(e){switch(e.kind){case"default":return`a partir de ${e.branch}`;case"branch":return`na branch ${e.ref}`;case"issue":return`da issue #${String(e.number)}, a partir da default`;case"pr":return`da head da PR #${String(e.number)}`}}function $6(e){switch(e.kind){case"default":return e.branch;case"branch":return e.ref;case"issue":return nv(e.number,e.title);case"pr":return e.headRefName}}function K6({origin:e}){return e.kind==="branch"?a.jsx("span",{className:"wtc__g wtc__g--branch",children:"⑂"}):e.kind==="default"?a.jsx(Be,{tone:"worktree",children:"◇"}):a.jsx("span",{className:"wtc__g",children:"◈"})}const G_=new Map;function W6(e){return G_.get(e)??""}function gp(e,t){t===""?G_.delete(e):G_.set(e,t)}function V6({origin:e,onOpenExisting:t,onCreated:s,close:n}){var x,S,w,k,E;const{kinds:o,active:l,select:d,pick:h,choose:f,branches:m,host:g,hostOff:v,hostFailure:y}=e;return a.jsxs("div",{className:"origin",children:[a.jsx("div",{className:"seg",role:"group","aria-label":"de onde cortar",children:o.map(D=>a.jsx("button",{type:"button",className:"seg__btn","aria-pressed":l===D,onClick:()=>d(D),children:G6[D]},D))}),l==="default"?a.jsx("div",{className:"origin__list",children:a.jsx("div",{className:"origin__empty",children:a.jsx("p",{children:"corta da branch default deste projeto — sem ir à rede"})})}):l==="branch"?a.jsx(vp,{busy:m.isPending,label:"branches",empty:"nenhuma branch além da default",failure:m.isError?m.error.message:null,children:(m.data??[]).map(D=>{const A=D.worktreePath!==null;return a.jsxs("button",{type:"button",role:"option",className:`orow${A?" orow--held":""}`,"aria-selected":(h==null?void 0:h.kind)==="branch"&&h.ref===D.name,onClick:()=>{if(A){D.worktreeId!==null&&((t??s)(D.worktreeId),n());return}f({kind:"branch",ref:D.name,local:D.local},D.name)},children:[a.jsx("span",{className:"orow__ref",children:D.name}),a.jsx("span",{className:"orow__t"}),a.jsx("span",{className:"orow__note",children:A?D.worktreeName===null?"no checkout principal":`em ${D.worktreeName}`:Y6(D)}),A&&D.worktreeId!==null&&a.jsx("span",{className:"orow__go",children:"→"})]},D.name)})}):l==="issue"?a.jsx(vp,{busy:g.isPending,label:"issues abertas",empty:"nenhuma issue aberta neste repositório",failure:Ow(g,((x=g.data)==null?void 0:x.issues.failure)??null),children:(((S=g.data)==null?void 0:S.issues.items)??[]).map(D=>a.jsxs("button",{type:"button",role:"option",className:"orow","aria-selected":(h==null?void 0:h.kind)==="issue"&&h.number===D.number,onClick:()=>f({kind:"issue",number:D.number},nv(D.number,D.title)),children:[a.jsxs("span",{className:"orow__n",children:["#",D.number]}),a.jsx("span",{className:"orow__t",children:D.title})]},D.number))}):a.jsx(vp,{busy:g.isPending,label:"pull requests abertas",empty:"nenhuma PR aberta neste repositório",failure:Ow(g,((w=g.data)==null?void 0:w.pulls.failure)??null),children:(((k=g.data)==null?void 0:k.pulls.items)??[]).map(D=>a.jsxs("button",{type:"button",role:"option",className:"orow","aria-selected":(h==null?void 0:h.kind)==="pr"&&h.number===D.number,onClick:()=>f({kind:"pr",number:D.number},D.headRefName),children:[a.jsxs("span",{className:"orow__n",children:["#",D.number]}),a.jsx("span",{className:"orow__t",children:D.title}),!D.onDisk&&a.jsx("span",{className:"orow__note orow__note--wait",children:D.crossRepository?"de um fork · busca ao criar":"busca ao criar"})]},D.number))}),v&&a.jsxs("p",{className:"origin__off",children:[a.jsx(Be,{tone:"off",children:"◌"}),y===null||((E=g.data)==null?void 0:E.host)===null?"este projeto não tem remoto — issues e PRs vêm de um host":y.kind==="no-auth"?"o gh não está autenticado — rode gh auth login no terminal":y.message]})]})}function vp({busy:e,label:t,empty:s,failure:n,children:o}){return a.jsx("div",{className:"origin__list",role:"listbox","aria-label":t,"aria-busy":e||void 0,children:e?a.jsxs("div",{className:"origin__skel","aria-hidden":"true",children:[a.jsx("span",{}),a.jsx("span",{}),a.jsx("span",{})]}):n!==null?a.jsx("div",{className:"origin__empty",children:a.jsx("p",{children:n})}):o.length===0?a.jsx("div",{className:"origin__empty",children:a.jsx("p",{children:s})}):o})}function Y6(e){return[e.local?"local":null,...e.remotes].filter(t=>t!==null).join(" · ")}function Ow(e,t){var s;return e.isError?((s=e.error)==null?void 0:s.message)??"não deu para ler as origens deste projeto":t===null?null:t.message}const G6={default:"default",branch:"branch",issue:"issue",pr:"PR"};function Q6({workspaceId:e,projectId:t,onClose:s,onCreated:n,onOpenExisting:o}){var g;const l=dh(e),[d,h]=j.useState(t),f=j.useMemo(()=>(l.data??[]).map(v=>({id:v.id,name:v.name})),[l.data]),m=((g=l.data)==null?void 0:g.find(v=>v.id===d))??null;return a.jsx(Z6,{projectId:d,defaultBranch:(m==null?void 0:m.defaultBranch)??"main",hasCommits:(m==null?void 0:m.hasCommits)??null,projects:f,onProjectChange:h,onClose:s,onCreated:n,onOpenExisting:o},d)}function Z6({projectId:e,defaultBranch:t,hasCommits:s,projects:n,onProjectChange:o,onClose:l,onCreated:d,onOpenExisting:h}){var H;const[f,m]=j.useState(()=>W6(e)),[g,v]=j.useState(""),[y,x]=j.useState(!1),[S,w]=j.useState(null),k=I6(e,{open:!0,onSuggestName:v}),{catalog:E,accounts:D,choice:A,choose:N}=uk(e),{start:z}=mk(e);function V(B){m(B),gp(e,B)}const ee=S!==null?{kind:"branch",ref:S.ref}:X6(k,t),$=s===!1?"este repositório ainda não tem nenhum commit — faça o primeiro para poder cortar worktrees":null;function ae(){if(!(f.trim()===""||$!==null)){if(S!==null){const B=f;gp(e,""),xn({projectId:e,scope:{scopeType:"worktree",scopeId:S.worktreeId}}),j5({scopeType:"worktree",scopeId:S.worktreeId},B),h(S.worktreeId),l();return}z.mutate({prompt:f,adapterId:A.adapterId,config:{...A.config},...A.accountId===void 0?{}:{agentAccountId:A.accountId},name:g.trim()===""?void 0:g.trim(),from:P6(k.active,k.pick)},{onSuccess:({worktreeId:B,sessionId:O})=>{gp(e,""),xn({projectId:e,scope:{scopeType:"worktree",scopeId:B}}),Ho({sessionId:O,send:!1}),d(B),l()}})}}const me={...k,select:B=>{w(null),k.select(B)},choose:(B,O)=>{w(null),k.choose(B,O)}};return a.jsx(H6,{open:!0,onClose:l,projects:n,projectId:e,onProjectChange:o,origin:ee,onOriginClick:()=>x(B=>!B),originOpen:y,originPanel:a.jsx(V6,{origin:me,onOpenExisting:B=>{var se;const O=(se=k.branches.data)==null?void 0:se.find(re=>re.worktreeId===B);w({ref:(O==null?void 0:O.name)??B,worktreeId:B,worktreeName:(O==null?void 0:O.worktreeName)??(O==null?void 0:O.name)??B}),x(!1)},onCreated:()=>{},close:()=>x(!1)}),prompt:f,onPromptChange:V,name:g,onNameChange:v,catalog:E,accounts:D,choice:A,onChoiceChange:N,heldBy:(S==null?void 0:S.worktreeName)??null,creating:z.isPending,error:((H=z.error)==null?void 0:H.message)??$,blocked:$!==null,onCreate:ae})}function X6(e,t){var o,l,d;const s=e.chosen;if(e.active==="default"||s===null)return{kind:"default",branch:t};if(s.kind==="branch")return{kind:"branch",ref:s.ref};if(s.kind==="issue"){const h=((l=(o=e.host.data)==null?void 0:o.issues.items.find(f=>f.number===s.number))==null?void 0:l.title)??`issue #${String(s.number)}`;return{kind:"issue",number:s.number,title:h}}const n=(d=e.host.data)==null?void 0:d.pulls.items.find(h=>h.number===s.number);return{kind:"pr",number:s.number,title:(n==null?void 0:n.title)??`PR #${String(s.number)}`,headRefName:(n==null?void 0:n.headRefName)??""}}const Q_="lumem.activeWorkspaceId";function J6(){try{return window.localStorage.getItem(Q_)}catch{return null}}function Z_(e){try{e===null?window.localStorage.removeItem(Q_):window.localStorage.setItem(Q_,e)}catch{}}function eq(e){Z_(e)}function tq(e){var l,d;const[t,s]=j.useState(J6),n=((l=e.find(h=>h.id===t))==null?void 0:l.id)??((d=e[0])==null?void 0:d.id)??null;j.useEffect(()=>{n!==t&&Z_(n)},[n,t]);const o=j.useCallback(h=>{Z_(h),s(h)},[]);return{activeId:n,select:o}}const Sk="lumem.collapsedNodes";function sq(){try{const e=window.localStorage.getItem(Sk);if(e===null)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(s=>typeof s=="string")):new Set}catch{return new Set}}function Rw(e){try{window.localStorage.setItem(Sk,JSON.stringify([...e]))}catch{}}function iq(){const[e,t]=j.useState(sq),s=j.useCallback(l=>!e.has(l),[e]),n=j.useCallback(l=>{t(d=>{const h=new Set(d);return h.delete(l)||h.add(l),Rw(h),h})},[]),o=j.useCallback(l=>{t(d=>{if(!d.has(l))return d;const h=new Set(d);return h.delete(l),Rw(h),h})},[]);return{isExpanded:s,toggle:n,expand:o}}function nq(){return be({queryKey:pT,queryFn:()=>Q.health.query(),refetchInterval:5e3,retry:!1})}const X_="lumem:reloaded-for";function wk({served:e,bundled:t=VR,reload:s=()=>{window.location.reload()}}){const[n,o]=j.useState(null);j.useEffect(()=>{if(e===void 0)return;const d=rq();if(e===t){if(d==null)return;Dw(null),o(e);return}d===null&&Dw(e)&&s()},[e,t,s]);const l=j.useCallback(()=>{o(null)},[]);return{updatedTo:n,dismiss:l}}function rq(){try{return window.sessionStorage.getItem(X_)}catch{return}}function Dw(e){try{return e===null?window.sessionStorage.removeItem(X_):window.sessionStorage.setItem(X_,e),!0}catch{return!1}}function aq(e,t){switch(t.type){case"workspace.changed":e.invalidateQueries({queryKey:aa});return;case"project.changed":e.invalidateQueries({queryKey:Xl(t.workspaceId)}),e.invalidateQueries({queryKey:DT});return;case"worktree.changed":e.invalidateQueries({queryKey:Do(t.projectId)}),e.invalidateQueries({queryKey:Aj}),e.invalidateQueries({queryKey:Tj}),e.invalidateQueries({queryKey:Nc});return;case"pr.changed":e.invalidateQueries({queryKey:zd});return;case"session.changed":e.invalidateQueries({queryKey:oa(t.scopeType,t.scopeId)}),e.invalidateQueries({queryKey:Oj}),e.invalidateQueries({queryKey:fg(t.scopeType,t.scopeId)});return;case"task.changed":e.invalidateQueries({queryKey:uh(t.workspaceId)}),e.invalidateQueries({queryKey:MT}),e.invalidateQueries({queryKey:LT}),e.invalidateQueries({queryKey:BT});return;case"catalog.changed":e.invalidateQueries({queryKey:qd});return;case"account.changed":e.invalidateQueries({queryKey:vg}),e.invalidateQueries({queryKey:qd});return;default:{console.warn("evento sem tradução para invalidação; invalidando tudo",t),e.invalidateQueries();return}}}function oq(){const e=$e();j.useEffect(()=>{const t=Q.events.onChange.subscribe(void 0,{onData:s=>aq(e,s),onConnectionStateChange:s=>{s.state==="idle"&&e.invalidateQueries()}});return()=>t.unsubscribe()},[e])}const jk="lumem.errorLog.v1",lq=200,cq=new Set(["query","mutation","app"]);let Mw=0;const J_=new Set;function uq(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.at=="number"&&typeof t.firstAt=="number"&&typeof t.count=="number"&&typeof t.label=="string"&&typeof t.message=="string"&&(t.detail===null||typeof t.detail=="string")&&cq.has(t.kind)}function dq(){try{const e=window.localStorage.getItem(jk);if(e===null)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(uq):[]}catch{return[]}}let mi=dq();function rh(){try{window.localStorage.setItem(jk,JSON.stringify(mi))}catch{}}function ah(){for(const e of J_)e()}function hq(e){return J_.add(e),()=>{J_.delete(e)}}function Lw(){return mi}function oh(e){const t=Date.now(),s=mi.find(o=>o.kind===e.kind&&o.label===e.label&&o.message===e.message);if(s!==void 0){mi=[{...s,at:t,count:s.count+1,detail:e.detail??s.detail},...mi.filter(l=>l.id!==s.id)],rh(),ah();return}Mw+=1,mi=[{id:`${t}-${Mw}`,at:t,firstAt:t,count:1,kind:e.kind,label:e.label,message:e.message,detail:e.detail??null},...mi].slice(0,lq),rh(),ah()}function fq(e){const t=mi.filter(s=>s.id!==e);t.length!==mi.length&&(mi=t,rh(),ah())}function mq(){mi.length!==0&&(mi=[],rh(),ah())}const pq={query:"consulta",mutation:"ação",app:"app"};function Ck(e){return pq[e]}function _q(e){return new Date(e).toISOString()}function kk(e){const t=e.count>1?` ×${e.count}`:"",s=`[${_q(e.at)}] ${Ck(e.kind)} · ${e.label}${t}`,n=e.detail===null?e.message:`${e.message}
|
|
104
|
+
${e.detail}`;return`${s}
|
|
105
|
+
${n}`}function gq(e){return e.map(kk).join(`
|
|
106
|
+
|
|
107
|
+
`)}function lh(e){var n;const t=(n=e==null?void 0:e.data)==null?void 0:n.path,s=typeof t=="string"&&t.length>0?t:null;return e instanceof Error?{label:s,message:e.message,detail:e.stack??null}:{label:s,message:String(e),detail:null}}function Bw(e){const t=e==null?void 0:e.data;return t==null?!0:t.code==="INTERNAL_SERVER_ERROR"}function vq(){return j.useSyncExternalStore(hq,Lw,Lw)}function yq(){const e=vq(),t=Bc();return e.length===0?null:a.jsxs("div",{className:"errlog",children:[a.jsxs("button",{type:"button",ref:t.triggerRef,className:"errlog__trigger","aria-haspopup":"dialog","aria-expanded":t.open,"aria-label":`registro de erros (${e.length})`,onClick:t.toggle,children:[a.jsx("span",{"aria-hidden":"true",children:"⚠"})," erros",a.jsx("span",{className:"errlog__count",children:e.length})]}),t.open&&a.jsxs("div",{className:"errlog__panel",ref:t.panelRef,role:"dialog","aria-label":"registro de erros",children:[a.jsxs("div",{className:"errlog__head",children:[a.jsxs("span",{className:"errlog__title",children:["Erros (",e.length,")"]}),a.jsx("span",{className:"errlog__spacer"}),a.jsx(Nk,{text:gq([...e]),label:"copiar tudo"}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{mq(),t.close()},children:"limpar"})]}),a.jsx("ul",{className:"errlog__list",children:e.map(s=>a.jsx(bq,{entry:s},s.id))})]})]})}function bq({entry:e}){return a.jsxs("li",{className:"errlog__item",children:[a.jsxs("div",{className:"errlog__meta",children:[a.jsx(kt,{tone:"failed",children:Ck(e.kind)}),a.jsx("code",{className:"errlog__label",children:e.label}),e.count>1&&a.jsxs("span",{className:"errlog__times",children:["×",e.count]}),a.jsx("span",{className:"errlog__spacer"}),a.jsx("time",{className:"errlog__at",children:new Date(e.at).toLocaleTimeString()})]}),a.jsx("p",{className:"errlog__msg",children:e.message}),e.detail!==null&&a.jsx("pre",{className:"errlog__detail",children:e.detail}),a.jsxs("div",{className:"errlog__actions",children:[a.jsx(Nk,{text:kk(e),label:"copiar"}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>fq(e.id),children:"descartar"})]})]})}function Nk({text:e,label:t}){const[s,n]=j.useState(!1),o=navigator.clipboard;return o===void 0?null:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{o.writeText(e).then(()=>n(!0),()=>n(!1))},children:s?"copiado":t})}function xq({version:e,unreachable:t,update:s}){return a.jsxs("header",{className:"topbar",children:[a.jsxs("h1",{className:"wordmark",children:[a.jsx("span",{className:"wordmark__dot","aria-hidden":"true"}),"Lumem-OS"]}),a.jsx("span",{className:"topbar__spacer"}),a.jsx(yq,{}),s,t?a.jsxs("span",{className:"daemon daemon--off",role:"alert",children:[a.jsx("span",{className:"daemon__dot","aria-hidden":"true"}),"daemon inacessível"]}):e!==null&&a.jsxs("span",{className:"daemon",children:[a.jsx("span",{className:"daemon__dot","aria-hidden":"true"}),"daemon v",e]})]})}const Ek=["máquina","agente","workspace","projeto","tarefa"],Sq={welcome:null,machine:0,agent:1,handshake:1,workspace:2,project:3,task:4,done:null};function Tk(e){return Sq[e]}function Uo(e){const t=Tk(e);return t===null?null:`passo ${t+1} de ${Ek.length}`}function Sr({eyebrow:e,title:t,lede:s,narrow:n,children:o,primary:l,onSubmit:d,onBack:h,onSkip:f,extra:m,hint:g}){const v=y=>{y.preventDefault(),!((l==null?void 0:l.disabled)===!0||(l==null?void 0:l.isPending)===!0)&&(d==null||d())};return a.jsx("form",{className:"wizard__form",onSubmit:v,children:a.jsx(xO,{...e===void 0?{}:{eyebrow:e},title:t,...s===void 0?{}:{lede:s},...n===void 0?{}:{narrow:n},footer:a.jsxs(a.Fragment,{children:[l!==void 0&&a.jsxs(J,{type:"submit",variant:"primary",disabled:l.disabled===!0||l.isPending===!0,children:[l.isPending===!0&&l.pending!==void 0?l.pending:l.label,l.isPending!==!0&&a.jsxs(a.Fragment,{children:[" ",a.jsx("span",{className:"kbd",children:"⏎"})]})]}),m,a.jsx("span",{className:"spacer"}),f!==void 0&&a.jsx(J,{variant:"ghost",onClick:f,children:"pular este passo"}),h!==void 0&&a.jsx(J,{variant:"ghost",onClick:h,children:"Voltar"}),g!==void 0&&a.jsx("span",{className:"hint",children:g})]}),children:o})})}function wq({onNext:e,onBack:t,onSkip:s}){var v;const n=Ag(),o=oD(),l=(v=n.data)==null?void 0:v.adapters.find(y=>y.id===Xp),d=l==null?void 0:l.adapter,h=(l==null?void 0:l.cli)??void 0,f=(l==null?void 0:l.apiKeyEnv)!==null&&(l==null?void 0:l.apiKeyEnv)!==void 0,m=(d==null?void 0:d.path)!=null,g=(d==null?void 0:d.version)!=null&&d.version!==fo.pinnedVersion;return a.jsxs(Sr,{eyebrow:Uo("agent"),title:"Conecte o Claude Code",lede:a.jsxs(a.Fragment,{children:["O Lumem conversa com agentes por ",a.jsx("b",{children:"ACP"})," — o daemon sobe o adaptador como processo e troca mensagens por stdio. É o que faz ferramenta, plano e pedido de permissão chegarem como blocos, e não como texto rolando num terminal."]}),primary:{label:"Testar conexão",disabled:!m},onSubmit:e,onBack:t,onSkip:s,hint:m?void 0:a.jsx(a.Fragment,{children:"o botão libera quando o adaptador estiver no PATH"}),children:[n.isPending&&a.jsx(ss,{label:"procurando os binários"}),n.isError&&a.jsxs(Ce,{tone:"danger",children:[a.jsx("strong",{children:"Não deu para procurar os binários."})," ",n.error.message]}),n.data!==void 0&&d!==void 0&&a.jsxs(a.Fragment,{children:[a.jsxs(la,{title:"o que foi encontrado na sua máquina",children:[a.jsxs(cc,{label:"binários",children:[h!==void 0&&a.jsx(Zs,{state:h.path===null?"warn":"ok",what:h.command,value:h.path===null?"não está no PATH — o adaptador precisa dele para trabalhar":`${h.version??h.versionNote??"versão não lida"} · ${h.path}`,status:h.path===null?"falta":"ok"}),a.jsx(Zs,{state:d.path===null?"fail":"ok",what:d.command,value:d.path===null?"adaptador ACP não está no PATH":`${d.version??d.versionNote??"versão não lida"} · ${d.path}`,status:d.path===null?"falta":"ok"})]}),d.path===null&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"field__help",children:["Nada para rodar no terminal: o Lumem instala o adaptador ",a.jsx("b",{children:"dentro da pasta dele"}),", numa versão fixa — nunca ",a.jsx("code",{children:"@latest"}),", para uma atualização de madrugada não mudar o comportamento do agente."]}),a.jsxs("div",{className:"wizard__acts",children:[a.jsx(J,{variant:"primary",size:"sm",disabled:o.isPending,onClick:()=>o.mutate(void 0),children:o.isPending?"instalando…":"Instalar o adaptador"}),a.jsx(J,{variant:"ghost",size:"sm",disabled:n.isFetching,onClick:()=>void n.refetch(),children:n.isFetching?"verificando…":"Já instalei — verificar"})]}),o.isError&&a.jsxs(a.Fragment,{children:[a.jsx(Ce,{tone:"danger",children:o.error.message}),d.install!==null&&a.jsx(Sg,{command:d.install})]})]}),g&&a.jsxs("span",{className:"field__help",children:["A cópia encontrada é a ",a.jsx("b",{children:d.version}),", e o Lumem fixa a"," ",a.jsx("b",{children:fo.pinnedVersion})," — a versão que foi medida contra este daemon. O adaptador ",a.jsx("b",{children:"embute o próprio runtime"}),", então uma cópia velha responde a conversa mesmo com o ",a.jsx("code",{children:"claude"})," da sua máquina atualizado. Conectar o agente instala a versão fixa na pasta do Lumem."]}),d.managed&&a.jsxs("span",{className:"field__help",children:["Instalado pelo Lumem, na pasta dele — é esta cópia que o daemon executa, e não uma que esteja no seu ",a.jsx("code",{children:"PATH"}),"."]})]}),a.jsxs(la,{title:"como o Claude vai se autenticar — o que foi encontrado",children:[a.jsx(cc,{label:"credencial",children:a.jsx(Zs,{state:f?"ok":"warn",what:(l==null?void 0:l.apiKeyEnv)??fo.apiKeyEnv[0]??"",value:f?"presente no ambiente do daemon — cobrança por token":"ausente — o adaptador vai usar a credencial local do Claude",status:f?"chave":"assinatura"})}),a.jsxs("span",{className:"field__help",children:["Não é escolha sua nem do Lumem: o adaptador usa a credencial que ",a.jsx("b",{children:"encontrar"}),". É o passo seguinte que confirma se ela vale — e ele confirma sem gastar token."]})]}),a.jsxs("div",{className:"adv",children:[a.jsx("span",{className:"adv__k",children:"avançado"}),a.jsxs("span",{className:"adv__v",children:["comando: ",d.command," · args: nenhum · env herdado do daemon"]})]}),a.jsxs(Ce,{tone:"info",children:["Qualquer agente que fale ACP entra depois em ",a.jsx("b",{children:"agentes"}),", no rodapé da sidebar — o Lumem não é preso ao Claude. Pular este passo também é legítimo: sem agente ACP, a sessão é um terminal."]})]})]})}function jq({result:e,skipped:t,onOpen:s,onReview:n}){var x,S,w;const[o,l,d,h,f]=xj({queries:[{queryKey:aa,queryFn:()=>Q.workspace.list.query()},b1({enabled:e.agentConfigId!==void 0}),{queryKey:ug(e.projectId??""),queryFn:()=>Q.project.get.query({id:e.projectId??""}),enabled:e.projectId!==void 0},{queryKey:dg(e.worktreeId??""),queryFn:()=>Q.worktree.getDetail.query({id:e.worktreeId??""}),enabled:e.worktreeId!==void 0},{queryKey:oa("worktree",e.worktreeId??""),queryFn:()=>Q.session.listByScope.query({scopeType:"worktree",scopeId:e.worktreeId??""}),enabled:e.worktreeId!==void 0}]}),m=(x=o.data)==null?void 0:x.find(k=>k.id===e.workspaceId),g=(S=l.data)==null?void 0:S.find(k=>k.id===e.agentConfigId),v=(w=f.data)==null?void 0:w.find(k=>k.kind==="agent"),y=[{label:"workspace",value:(m==null?void 0:m.name)??a.jsx(Cq,{})},{label:"agente",value:g===void 0?a.jsx(yp,{step:"agent",skipped:t,onReview:n}):a.jsxs(a.Fragment,{children:[g.command,g.adapterVersion!==null&&` @${g.adapterVersion}`," ",a.jsxs("span",{className:"dim",children:["— conversa",g.available?"":" · fora do PATH"]})]})},{label:"projeto",value:d.data==null?a.jsx(yp,{step:"project",skipped:t,onReview:n}):a.jsxs(a.Fragment,{children:[d.data.path,!d.data.available&&a.jsx("span",{className:"dim",children:" — não está no disco"})]})},{label:"worktree",value:h.data==null?a.jsx(yp,{step:"task",skipped:t,onReview:n}):a.jsxs(a.Fragment,{children:[h.data.path,!h.data.present&&a.jsx("span",{className:"dim",children:" — não está no disco"})]})},{label:"sessão",value:v===void 0?a.jsx("span",{className:"dim",children:"nenhuma — abra uma quando quiser"}):a.jsxs(a.Fragment,{children:[v.agentName??"agente"," ",a.jsxs("span",{className:"dim",children:["— ",v.state]})]})}];return a.jsxs(Sr,{narrow:!0,eyebrow:"tudo configurado",title:"Pronto. O resto acontece dentro do produto.",lede:"Foi isto que passou a existir na sua máquina:",primary:{label:"Abrir o workspace"},onSubmit:s,extra:a.jsx(J,{variant:"ghost",onClick:n,children:"Revisar a configuração"}),children:[a.jsx(va,{variant:"recap",entries:y}),a.jsxs("div",{className:"keys",children:[a.jsxs("div",{className:"key",children:[a.jsx("span",{className:"key__k",children:"⏎"}),a.jsxs("span",{className:"key__d",children:["enviar o turno — ",a.jsx("span",{className:"dim",children:"⇧⏎ faz linha nova"})]})]}),a.jsxs("div",{className:"key",children:[a.jsx("span",{className:"key__k",children:"esquerda"}),a.jsx("span",{className:"key__d",children:"projetos e worktrees; o rodapé adiciona projeto e configura agente"})]}),a.jsxs("div",{className:"key",children:[a.jsx("span",{className:"key__k",children:"abas"}),a.jsxs("span",{className:"key__d",children:["uma por sessão viva, mais ",a.jsx("b",{children:"contexto"})," — a worktree em si"]})]}),a.jsxs("div",{className:"key",children:[a.jsx("span",{className:"key__k",children:"direita"}),a.jsx("span",{className:"key__d",children:"arquivos do checkout e o que mudou neles, ao lado da conversa"})]})]})]})}function Cq(){return a.jsx("span",{className:"dim",children:"lendo do daemon…"})}function yp({step:e,skipped:t,onReview:s}){const n={agent:"no rodapé da sidebar, em agentes",project:"na sidebar, no + ao lado de Projetos",task:"na sidebar, no + da linha do projeto"};return t.includes(e)?a.jsxs("span",{className:"dim",children:["pulado — dá para fazer ",n[e],","," ",a.jsx("button",{type:"button",className:"key__link",onClick:s,children:"ou voltar ao fluxo"})]}):a.jsx("span",{className:"dim",children:"nada foi criado"})}const zw="claude";function kq({onNext:e,onBack:t,onSkip:s}){var v;const n=aD(),o=Bo(),l=n.data,d=lD(o.data,zw),h=()=>{l!==void 0&&d.mutate(l,{onSuccess:y=>{e({agentConfigId:y.id,agentName:y.name,...y.adapterVersion===null?{}:{adapterVersion:y.adapterVersion}})}})},f=(l==null?void 0:l.loggedIn)===!0,m=((v=l==null?void 0:l.identity)==null?void 0:v.email)==null?null:[l.identity.email,l.identity.plan].filter(Boolean).join(" · "),g=l===void 0?"":f?m===null?"já tem login: usou a credencial local":`já tem login — ${m}`:`o adaptador pede autenticação: ${l.authMethods.map(y=>y.name??y.id).join(", ")}`;return a.jsxs(Sr,{eyebrow:`${Uo("handshake")??""} · conexão`,title:n.isError?"O adaptador não conectou":"Claude Code conectado",lede:n.isError?a.jsx(a.Fragment,{children:"Isto é o que o daemon tentou, e o que voltou."}):a.jsxs(a.Fragment,{children:["O daemon subiu o adaptador, trocou o ",a.jsx("code",{children:"initialize"})," e abriu uma sessão de teste. Isto é o que ele respondeu."]}),primary:{label:"Continuar",disabled:l===void 0,isPending:d.isPending,pending:"salvando…"},onSubmit:h,onBack:t,onSkip:s,extra:a.jsx(J,{variant:"ghost",disabled:n.isFetching,onClick:()=>void n.refetch(),children:n.isFetching?"testando…":"Testar de novo"}),hint:a.jsxs(a.Fragment,{children:["salvo como ",a.jsx("b",{children:zw})]}),children:[n.isPending&&a.jsx(ss,{label:"subindo o adaptador"}),n.isError&&a.jsxs(Ce,{tone:"danger",children:[a.jsx("strong",{children:"O handshake falhou."})," ",n.error.message]}),l!==void 0&&a.jsxs(a.Fragment,{children:[a.jsxs(cc,{label:"o que o adaptador respondeu",children:[a.jsx(Zs,{state:"ok",what:"processo",value:`${l.command} · subiu em ${l.timings.spawnMs} ms`,status:"ok"}),a.jsx(Zs,{state:"ok",what:"protocolo",value:`ACP v${l.protocolVersion}${l.agentInfo===null?" · o adaptador não declarou nome nem versão":` · ${l.agentInfo.name} ${l.agentInfo.version}`}`,status:"ok"}),a.jsx(Zs,{state:f?"ok":"warn",what:"autenticação",value:g,status:f?"ok":"pede"}),a.jsx(Zs,{state:"ok",what:"capacidades",value:l.capabilities.length===0?"nenhuma declarada":l.capabilities.join(" · "),status:"ok"}),a.jsx(Zs,{state:"ok",what:"sessão",value:`session/new devolveu ${l.acpSessionId} em ${l.timings.sessionMs} ms`,status:"ok"})]}),a.jsx(la,{title:"o que o daemon mandou e o que voltou",children:a.jsxs("div",{className:"wire",children:[a.jsxs("span",{className:"wire__l",children:[a.jsx("span",{className:"wire__d wire__d--out","aria-hidden":"true",children:"→"}),a.jsxs("span",{className:"wire__c",children:["initialize ","{"," protocolVersion: ",l.protocolVersion,", clientCapabilities:"," ","{"," fs: ","{"," readTextFile, writeTextFile ","}",", terminal ","}"," ","}"]})]}),a.jsxs("span",{className:"wire__l",children:[a.jsx("span",{className:"wire__d wire__d--in","aria-hidden":"true",children:"←"}),a.jsxs("span",{className:"wire__c",children:["{"," protocolVersion: ",l.protocolVersion,", agentInfo:"," ",l.agentInfo===null?"ausente":`${l.agentInfo.name}@${l.agentInfo.version}`,", authMethods: [",l.authMethods.map(y=>y.id).join(", "),"] ","}"]})]}),a.jsxs("span",{className:"wire__l",children:[a.jsx("span",{className:"wire__d wire__d--out","aria-hidden":"true",children:"→"}),a.jsxs("span",{className:"wire__c",children:["session/new ","{"," cwd: ~/.lumem/probe, mcpServers: [] ","}"]})]}),a.jsxs("span",{className:"wire__l",children:[a.jsx("span",{className:"wire__d wire__d--in","aria-hidden":"true",children:"←"}),a.jsxs("span",{className:"wire__c",children:["{"," sessionId: ",l.acpSessionId,", modes: [",l.modes.join(", "),"] ","}"]})]}),a.jsxs("span",{className:"wire__l",children:[a.jsx("span",{className:"wire__d","aria-hidden":"true",children:"·"}),a.jsx("span",{className:"wire__c",children:"sessão de teste encerrada. Nenhum token consumido — não houve session/prompt."})]})]})}),a.jsxs(la,{title:"como as próximas sessões nascem",children:[a.jsx(va,{variant:"recap",entries:[{label:"modelo",value:a.jsxs(a.Fragment,{children:["o que o agente oferecer ",a.jsx("span",{className:"dim",children:"— trocável em cada conversa"})]})},{label:"modo",value:l.currentMode===null?a.jsx("span",{className:"dim",children:"o padrão do agente"}):a.jsxs(a.Fragment,{children:[l.currentMode," ",a.jsx("span",{className:"dim",children:"— trocável em cada conversa"})]})},{label:"versão",value:l.agentInfo===null?a.jsx("span",{className:"dim",children:"o adaptador não declarou — vai pedir para digitar"}):l.agentInfo.version}]}),a.jsx("span",{className:"field__help",children:"Leitura, não escolha: o Lumem não tem onde guardar um padrão seu, e a conversa já escolhe modelo e modo por sessão — com o agente como autoridade sobre a lista."})]}),d.isError&&a.jsx(Ce,{tone:"danger",children:d.error.message})]})]})}function Ak(){return be({queryKey:CT,queryFn:()=>Q.setup.preflight.query(),refetchOnWindowFocus:!1})}function Nq(e,t={}){return be({queryKey:NT(e),queryFn:()=>Q.project.inspect.query({path:e}),enabled:t.enabled??!0,retry:!1})}function Eq(e,t,s={}){return be({queryKey:ET(e,t),queryFn:()=>Q.worktree.plan.query({projectId:e,name:t}),enabled:s.enabled??!0,retry:!1})}function Tq(){const e=$e();return Se({mutationFn:async t=>{const s=await Q.worktree.create.mutate({projectId:t.projectId,name:t.name});let n;return t.agentConfigId!==void 0&&(n=(await Q.session.createAgent.mutate({scopeType:"worktree",scopeId:s.id,agentConfigId:t.agentConfigId})).id),{worktree:s,sessionId:n}},onSuccess:async({worktree:t},s)=>{await e.invalidateQueries({queryKey:Do(s.projectId)}),await e.invalidateQueries({queryKey:oa("worktree",t.id)})}})}function Aq({onNext:e,onBack:t,onSkip:s}){var d;const n=Ak(),o=((d=n.data)==null?void 0:d.checks)??[],l=o.some(h=>h.id==="git"&&h.state==="fail");return a.jsxs(Sr,{eyebrow:Uo("machine"),title:"O que o Lumem precisa da sua máquina",lede:"Cinco verificações, todas locais. Nenhuma delas instala nada.",primary:{label:"Continuar"},onSubmit:e,onBack:t,onSkip:s,extra:a.jsx(J,{variant:"ghost",disabled:n.isFetching,onClick:()=>void n.refetch(),children:n.isFetching?"verificando…":"Verificar de novo"}),hint:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:"esc"})," volta"]}),children:[n.isPending&&a.jsx(ss,{label:"lendo a máquina"}),n.isError&&a.jsxs(Ce,{tone:"danger",children:[a.jsx("strong",{children:"O daemon não respondeu ao pré-voo."})," ",n.error.message]}),o.length>0&&a.jsx(cc,{label:"o que o Lumem encontrou nesta máquina",children:o.map(h=>a.jsx(Zs,{state:n.isFetching?"running":h.state,what:h.label,value:h.value,status:n.isFetching?"lendo":Oq(h.state),...h.fix===null?{}:{action:a.jsx(Sg,{command:h.fix})}},h.id))}),l&&a.jsxs(Ce,{tone:"warning",children:["Git abaixo de ",a.jsx("strong",{children:"2.30"})," não serve: o Lumem usa ",a.jsx("code",{children:"git worktree"})," com"," ",a.jsx("code",{children:"--orphan"}),", e o comportamento muda antes dessa versão. Dá para continuar — a falha aparece na primeira worktree, com esta mesma frase."]})]})}function Oq(e){return e==="ok"?"ok":e==="warn"?"atenção":"falha"}function Ok(e,t=400){const[s,n]=j.useState(e);return j.useEffect(()=>{const o=setTimeout(()=>n(e),t);return()=>clearTimeout(o)},[e,t]),s}function Rq({workspaceId:e,onNext:t,onBack:s,onSkip:n}){const[o,l]=j.useState(""),d=Ok(o.trim()),h=Nq(d,{enabled:d.startsWith("/")||d.startsWith("~")}),{add:f}=xg(e??""),m=Se({mutationFn:async()=>{if(e===void 0)throw new Error("sem workspace não há onde adicionar");return f.mutateAsync({path:d})},onSuccess:y=>t({projectId:y.id,projectPath:y.path})}),g=h.data,v=(g==null?void 0:g.alreadyRegistered)??null;return a.jsxs(Sr,{eyebrow:Uo("project"),title:"Adicione o primeiro projeto",lede:a.jsxs(a.Fragment,{children:["Projeto é um repositório git que ",a.jsx("b",{children:"já existe"})," na sua máquina. O Lumem não move nem reescreve nada dele — só passa a criar worktrees a partir dele. Clonar de uma URL é outra história: rede, credencial e progresso são feature, não um campo."]}),primary:{label:v===null?"Adicionar projeto":"Usar o que já está aqui",disabled:g===void 0,isPending:m.isPending,pending:"validando…"},onSubmit:()=>{if(v!==null){t({projectId:v.id,projectPath:d});return}m.mutate()},onBack:s,onSkip:n,children:[a.jsxs("div",{className:"wizard__body",children:[a.jsx(Ht,{id:"setup-project-path",label:"Pasta do projeto — caminho absoluto",error:m.isError?m.error.message:h.isError&&d!==""?h.error.message:void 0,children:a.jsx(Ft,{id:"setup-project-path",value:o,onChange:y=>l(y.target.value),placeholder:"/Users/voce/Documents/GitHub/lorebase",invalid:m.isError||h.isError,autoFocus:!0})}),a.jsxs("span",{className:"field__help",children:["Digitado, não escolhido: o daemon pode estar em outra máquina, e o seletor de arquivo do navegador entrega arquivo, não caminho de servidor. Ele valida na hora e diz"," ",a.jsx("b",{children:"qual"})," verificação falhou."]})]}),h.isFetching&&a.jsx(ss,{label:"lendo o repositório"}),g!==void 0&&a.jsxs(a.Fragment,{children:[a.jsxs(la,{title:"o que o Lumem leu daí",children:[a.jsxs(cc,{label:"o que o repositório é",children:[a.jsx(Zs,{state:"ok",what:"repositório",value:`git · ${g.commits} commit(s) · HEAD em ${g.head.branch??"HEAD destacado"}${g.head.shortSha===null?"":` · ${g.head.shortSha}`}`,status:"ok"}),a.jsx(Zs,{state:g.origin===null?"warn":"ok",what:"remoto",value:g.origin??"sem origin — worktree funciona igual, push é que não",status:g.origin===null?"sem":"ok"}),a.jsx(Zs,{state:g.clean?"ok":"warn",what:"árvore",value:g.clean?"limpa · nada por commitar":`${g.changedFiles} arquivo(s) por commitar — o Lumem não toca neles`,status:g.clean?"limpa":"suja"}),a.jsx(Zs,{state:g.worktrees.length===0?"ok":"warn",what:"worktrees",value:g.worktrees.length===0?"nenhuma além do checkout principal":`${g.worktrees.length} já registrada(s) neste repositório, criada(s) fora do Lumem`,status:g.worktrees.length===0?"ok":"atenção"})]}),g.worktrees.length>0&&a.jsx("span",{className:"field__help",children:"Elas continuam onde estão. O Lumem não mexe em nenhuma delas, e não passa a listá-las — ver e administrar worktree criada fora daqui é outra feature."})]}),v!==null&&a.jsxs(Ce,{tone:"info",children:["Este caminho já é o projeto ",a.jsx("strong",{children:v.name})," aqui. Nada será criado de novo — o fluxo segue com ele."]}),a.jsxs(Ce,{tone:"info",children:["Seu checkout em ",a.jsx("code",{children:g.root})," continua sendo seu. O agente trabalha nas worktrees irmãs, fora dele."]})]})]})}function Dq({projectId:e,agentConfigId:t,onNext:s,onBack:n,onSkip:o}){const[l,d]=j.useState("primeira-tarefa"),[h,f]=j.useState(!0),m=Ok(l.trim()),g=Eq(e??"",m,{enabled:e!==void 0&&m!==""}),v=Tq(),y=()=>{e!==void 0&&v.mutate({projectId:e,name:m,...h&&t!==void 0?{agentConfigId:t}:{}},{onSuccess:({worktree:S,sessionId:w})=>{s({worktreeId:S.id,worktreeName:S.name,sessionOpened:w!==void 0,...w===void 0?{}:{sessionId:w}})}})},x=g.data;return a.jsxs(Sr,{eyebrow:Uo("task"),title:"Toda tarefa vira uma worktree",lede:"É a ideia central: em vez de trocar de branch no seu checkout, cada tarefa ganha uma branch e uma pasta próprias. Você pode ter três agentes trabalhando ao mesmo tempo e nenhum encosta no que o outro está fazendo.",primary:{label:h&&t!==void 0?"Criar e abrir a conversa":"Criar a worktree",disabled:x===void 0||x.refusal!==null,isPending:v.isPending,pending:"criando…"},onSubmit:y,onBack:n,onSkip:o,children:[a.jsxs("div",{className:"wizard__body",children:[a.jsx(Ht,{id:"setup-task-name",label:"Nome da tarefa",error:v.isError?v.error.message:g.isError?g.error.message:(x==null?void 0:x.refusal)??void 0,children:a.jsx(Ft,{id:"setup-task-name",value:l,onChange:S=>d(S.target.value),placeholder:"primeira-tarefa",invalid:v.isError||g.isError||(x==null?void 0:x.refusal)!=null,autoFocus:!0})}),a.jsx("span",{className:"field__help",children:"Vira o nome da branch e o nome da pasta."}),x!==void 0&&a.jsx(va,{variant:"recap",entries:[{label:"branch",value:a.jsxs(a.Fragment,{children:[x.branch," ",a.jsxs("span",{className:"dim",children:["← ",x.baseBranch,x.baseSha===null?" · sem commit ainda":` · ${x.baseSha}`]})]})},{label:"pasta",value:x.path},{label:"comando",value:x.command}]})]}),a.jsx(la,{title:"o que abre junto",children:a.jsxs(_O,{label:"o que abre junto",children:[a.jsx(PS,{title:"Uma sessão do Claude",description:t===void 0?"Precisa de um agente ACP configurado — o passo 2 foi pulado.":"Abre a conversa já dentro da worktree.",glyph:a.jsx(Be,{tone:"agent",children:"◆"}),selected:h&&t!==void 0,onSelect:()=>f(!0),disabled:t===void 0}),a.jsx(PS,{title:"Só a worktree",description:"Cria a pasta e a branch. Você abre sessão quando quiser.",glyph:a.jsx(Be,{tone:"shell",children:"●"}),selected:!h||t===void 0,onSelect:()=>f(!1)})]})}),e===void 0&&a.jsxs(Ce,{tone:"warning",children:["O passo do projeto foi pulado, então não há de onde cortar uma worktree. Pule este também — a linha do projeto na sidebar ganha um ",a.jsx("b",{children:"+"})," quando você adicionar um."]})]})}function Mq({daemonVersion:e,daemonUnreachable:t,onStart:s}){return a.jsx(Sr,{title:t?"O daemon não está respondendo.":"O daemon já está rodando. Falta dizer com o que ele trabalha.",lede:t?a.jsxs(a.Fragment,{children:["O Lumem roda inteiro na sua máquina, e o daemon é a parte que tem os processos. Sem ele nada aqui responde — nem este fluxo. Suba ",a.jsx("code",{children:"pnpm dev"})," e volte."]}):a.jsxs(a.Fragment,{children:["O Lumem roda inteiro na sua máquina: um daemon local",e!==null&&a.jsxs(a.Fragment,{children:[" (v",e,")"]}),", seus repositórios onde já estão, e agentes que você mesmo instalou. Nada sai daqui — o que vai para a Anthropic é o que você escrever para o Claude, pela sua própria conta."]}),primary:{label:"Configurar em 5 passos",disabled:t},onSubmit:s,hint:a.jsx(a.Fragment,{children:"leva ~2 min"}),children:a.jsxs("div",{className:"tri",children:[a.jsxs("div",{className:"tri__i",children:[a.jsx("span",{className:"tri__g glyph glyph--worktree","aria-hidden":"true",children:"◇"}),a.jsx("span",{className:"tri__t",children:"Uma tarefa, uma worktree"}),a.jsx("span",{className:"tri__d",children:"Cada tarefa ganha branch e pasta próprias. O agente trabalha lá; seu checkout não é tocado."})]}),a.jsxs("div",{className:"tri__i",children:[a.jsx("span",{className:"tri__g glyph glyph--agent","aria-hidden":"true",children:"◆"}),a.jsx("span",{className:"tri__t",children:"Agente por ACP"}),a.jsx("span",{className:"tri__d",children:"Claude Code entra por protocolo, não por terminal simulado. Ferramenta, plano e permissão viram blocos."})]}),a.jsxs("div",{className:"tri__i",children:[a.jsx("span",{className:"tri__g glyph glyph--project","aria-hidden":"true",children:"■"}),a.jsx("span",{className:"tri__t",children:"Vários ao mesmo tempo"}),a.jsx("span",{className:"tri__d",children:"Sessões paralelas em worktrees diferentes, sem uma pisar na outra."})]})]})})}function Lq({onNext:e,onBack:t}){var f;const[s,n]=j.useState("pessoal"),o=Ak(),l=gk(),d=()=>{l.mutate(s.trim(),{onSuccess:m=>e({workspaceId:m.id,workspaceName:m.name})})},h=(f=o.data)==null?void 0:f.paths;return a.jsxs(Sr,{eyebrow:Uo("workspace"),title:"Crie seu primeiro workspace",lede:"Um workspace agrupa projetos e guarda as worktrees deles num lugar só. Quem trabalha em coisas separadas — pessoal e cliente, por exemplo — mantém dois, e eles nunca se veem.",primary:{label:"Criar workspace",disabled:s.trim()==="",isPending:l.isPending,pending:"criando…"},onSubmit:d,onBack:t,children:[a.jsxs("div",{className:"wizard__body",children:[a.jsx(Ht,{id:"setup-workspace-name",label:"Nome",error:l.isError?l.error.message:void 0,children:a.jsx(Ft,{id:"setup-workspace-name",value:s,onChange:m=>n(m.target.value),placeholder:"pessoal",invalid:l.isError,autoFocus:!0})}),a.jsx("span",{className:"field__help",children:"Aparece no topo da coluna da esquerda. Dá para renomear depois."}),h!==void 0&&a.jsx(Ht,{id:"setup-workspaces-dir",label:"Onde o Lumem escreve — leitura",children:a.jsx(Ft,{id:"setup-workspaces-dir",value:h.workspacesDir,readOnly:!0})}),a.jsxs("span",{className:"field__help",children:["Uma árvore por workspace, com o clone e as worktrees de cada projeto debaixo dele. Fora dos seus repositórios, de propósito: worktree dentro do checkout suja"," ",a.jsx("code",{children:"git status"})," e acaba commitada por acidente. Quem muda o lugar é a variável"," ",a.jsx("code",{children:"LUMEM_STATE_DIR"})," do daemon."]})]}),h!==void 0&&a.jsx(la,{title:"o que este passo escreve no disco",children:a.jsx(va,{variant:"recap",entries:[{label:"registro",value:h.databasePath},{label:"workspaces",value:h.workspacesDir},{label:"conversas",value:a.jsxs(a.Fragment,{children:[h.transcriptsDir," ",a.jsx("span",{className:"dim",children:"— só local"})]})}]})})]})}const bp=["welcome","machine","agent","handshake","workspace","project","task","done"];function Bq({daemonVersion:e,daemonUnreachable:t,onFinish:s}){const[n,o]=j.useState("welcome"),[l,d]=j.useState({}),[h,f]=j.useState([]),m=bp.indexOf(n),g=j.useCallback(E=>{o(E),window.scrollTo(0,0)},[]),v=j.useCallback(E=>{E!==void 0&&d(A=>({...A,...E}));const D=bp[m+1];D!==void 0&&g(D)},[g,m]),y=j.useCallback(()=>{const E=bp[m-1];E!==void 0&&g(E)},[g,m]),x=j.useCallback(()=>{if(f(E=>E.includes(n)?E:[...E,n]),n==="agent"){f(E=>E.includes("handshake")?E:[...E,"handshake"]),g("workspace");return}v()},[v,g,n]);j.useEffect(()=>{const E=D=>{D.key==="Escape"&&y()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[y]);const S=Tk(n),w=j.useMemo(()=>S===null?null:a.jsx(vO,{steps:Ek,current:S}),[S]);return a.jsx("div",{className:"flow",children:a.jsxs("div",{className:"wizard",children:[w,k()]})});function k(){switch(n){case"welcome":return a.jsx(Mq,{daemonVersion:e,daemonUnreachable:t,onStart:()=>v()});case"machine":return a.jsx(Aq,{onNext:()=>v(),onBack:y,onSkip:x});case"agent":return a.jsx(wq,{onNext:()=>v(),onBack:y,onSkip:x});case"handshake":return a.jsx(kq,{onNext:E=>v(E),onBack:y,onSkip:x});case"workspace":return a.jsx(Lq,{onNext:E=>v(E),onBack:y});case"project":return a.jsx(Rq,{workspaceId:l.workspaceId,onNext:E=>v(E),onBack:y,onSkip:x});case"task":return a.jsx(Dq,{projectId:l.projectId,agentConfigId:l.agentConfigId,onNext:E=>v(E),onBack:y,onSkip:x});case"done":return a.jsx(jq,{result:l,skipped:h,onOpen:()=>s(l),onReview:()=>g("welcome")})}}}function qc(){return be({queryKey:pg,queryFn:()=>Q.system.updateStatus.query(),refetchInterval:15e3,retry:!1})}function Rk(){const e=$e();return Se({mutationFn:()=>Q.system.update.mutate(),onSettled:()=>e.invalidateQueries({queryKey:pg})})}function zq(){return be({queryKey:kj,queryFn:()=>Q.system.settings.query()})}function qq(){const e=$e();return Se({mutationFn:t=>Q.system.setSettings.mutate(t),onSuccess:t=>(e.setQueryData(kj,t),e.invalidateQueries({queryKey:pg}))})}function Pq(){var l;const e=qc(),t=Rk(),s=e.data;if(s===void 0||!s.updateAvailable||s.latest===null)return null;const n=t.isPending||t.isSuccess&&s.lastError===null,o=((l=t.error)==null?void 0:l.message)??(s.lastError===null?null:`a atualização falhou: ${s.lastError}`);return a.jsxs("div",{className:"update",children:[a.jsx("span",{className:"update__jump",children:`v${s.current} → v${s.latest}`}),s.supervised?a.jsx(J,{size:"sm",variant:"primary",disabled:n,onClick:()=>{t.mutate()},children:n?"Atualizando…":"Atualizar"}):a.jsx("code",{className:"update__cmd",children:"lumem upgrade"}),o!==null&&a.jsx("span",{className:"update__err",role:"alert",children:o})]})}function Pc({label:e,quiet:t=!1,children:s}){return a.jsxs("section",{className:"menubar__block","aria-label":e,children:[!t&&a.jsx("h2",{className:"menubar__title",children:e}),s]})}function bh({what:e}){return a.jsxs("p",{className:"menubar__err",role:"alert",children:["não consegui ler ",e]})}function gc({what:e}){return a.jsx(ss,{label:`lendo ${e}`,widths:["60%","40%"]})}const xh={fast:3e3,normal:1e4,slow:3e4};function Iq(){return be({queryKey:_T,queryFn:()=>Q.agentAccount.rateLimits.query(),refetchInterval:xh.normal,retry:!1})}function Hq(){return be({queryKey:bT("1d"),queryFn:()=>Q.usage.total.query({period:"1d"}),refetchInterval:xh.normal,retry:!1})}function Dk(){return be({queryKey:vT,queryFn:()=>Q.system.live.query(),refetchInterval:xh.fast,retry:!1})}function Fq(){return be({queryKey:gT,queryFn:()=>Q.system.resources.query(),refetchInterval:5e3,retry:!1})}function Uq(){return be({queryKey:yT,queryFn:()=>Q.workspace.recent.query(),refetchInterval:xh.slow,retry:!1})}function $q(e){return`${String(Math.round(e*100))}%`}function Kq(e,t){if(e===null)return null;const s=e*1e3-t;return s<=0?"resetou":`reseta em ${SC(s)}`}function Mk(e,t){const s=pc(e,t);return s==="agora"||s===""?"agora":`há ${s}`}function Wq(e,t){return`${t==="USD"||t===null?"US$":t} ${e.toFixed(2).replace(".",",")}`}function qw(e){const t=e/1048576;return t<1024?`${String(Math.round(t))} MB`:`${(t/1024).toFixed(1).replace(".",",")} GB`}function Vq(e){return e===null?"—":`${e.toFixed(1).replace(".",",")}%`}function Yq(e){return e===1?"1 terminal aberto fecha ao atualizar":`${String(e)} terminais abertos fecham ao atualizar`}function Gq(){var m,g,v,y,x,S;const e=qc(),t=Dk(),s=Uq(),n=Rk(),o=((m=e.data)==null?void 0:m.updateAvailable)===!0,l=((g=e.data)==null?void 0:g.supervised)===!0,d=((v=t.data)==null?void 0:v.openTerminals)??0,h=n.isPending||n.isSuccess&&((y=e.data)==null?void 0:y.lastError)===null,f=((x=n.error)==null?void 0:x.message)??(((S=e.data)==null?void 0:S.lastError)==null?null:`a atualização falhou: ${e.data.lastError}`);return a.jsxs(Pc,{label:"Ações",children:[o&&d>0&&a.jsx("p",{className:"menubar__warn",children:Yq(d)}),a.jsxs("div",{className:"menubar__row",children:[a.jsx("a",{className:"btn btn--sm",href:"/",target:"_blank",rel:"noreferrer",children:"Abrir o Lumem"}),a.jsx(J,{size:"sm",variant:"primary",disabled:!o||!l||h,title:o&&!l?"precisa do Lumem rodando como serviço":void 0,onClick:()=>{n.mutate()},children:h?"Atualizando…":"Atualizar"})]}),f!==null&&a.jsx("p",{className:"menubar__err",role:"alert",children:f}),s.data!==void 0&&s.data.length>0&&a.jsx("div",{className:"menubar__row",children:s.data.map(w=>a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{eq(w.id),window.open("/","_blank")},children:w.name},w.id))})]})}function Qq({now:e}){const t=Iq(),s=Hq(),n=[...t.data??[]].sort((o,l)=>l.utilization-o.utilization)[0];return a.jsx(Pc,{label:"Consumo",quiet:!0,children:t.isPending?a.jsx(gc,{what:"o consumo"}):n!==void 0?a.jsxs("p",{className:"menubar__headline",children:[a.jsx("strong",{className:"menubar__big",children:$q(n.utilization)}),n.kind!==null&&a.jsx("span",{className:"menubar__kind",children:n.kind}),a.jsx("span",{className:"menubar__note",children:Kq(n.resetsAt,e)})]}):s.isPending?a.jsx(gc,{what:"o consumo"}):s.data===void 0?a.jsx(bh,{what:"o consumo"}):a.jsxs("p",{className:"menubar__headline",children:[a.jsx("strong",{className:"menubar__big",children:s.data.cost===null?`${_c(s.data.tokens)} tokens`:Wq(s.data.cost,s.data.currency)}),a.jsx("span",{className:"menubar__note",children:"hoje"})]})})}const Zq=[{key:"daemon",name:"Daemon"},{key:"agents",name:"Agentes"},{key:"terminals",name:"Terminais"}];function Xq(){const e=Fq();return a.jsx(Pc,{label:"Recursos",children:e.isPending?a.jsx(gc,{what:"os recursos"}):e.data===void 0?a.jsx(bh,{what:"os recursos"}):a.jsxs(a.Fragment,{children:[a.jsx("dl",{className:"menubar__groups",children:Zq.map(({key:t,name:s})=>a.jsxs("div",{className:"menubar__group",children:[a.jsx("dt",{children:s}),a.jsx("dd",{className:"menubar__num",children:Vq(e.data.groups[t].cpuPercent)}),a.jsx("dd",{className:"menubar__num",children:qw(e.data.groups[t].rssBytes)})]},t))}),e.data.top.length>0&&a.jsx("ol",{className:"menubar__list",children:e.data.top.map(t=>a.jsxs("li",{className:"menubar__item",children:[a.jsx("span",{className:"menubar__label",children:t.label}),a.jsx("span",{className:"menubar__num",children:qw(t.rssBytes)})]},t.pid))})]})})}function Jq({now:e}){const t=Dk();return a.jsx(Pc,{label:"Turnos em voo",children:t.isPending?a.jsx(gc,{what:"as sessões"}):t.data===void 0?a.jsx(bh,{what:"as sessões"}):t.data.turns.length===0?a.jsx("p",{className:"menubar__empty",children:"nenhuma sessão rodando"}):a.jsx("ul",{className:"menubar__list",children:t.data.turns.map(s=>a.jsxs("li",{className:"menubar__item",children:[a.jsx("span",{className:"menubar__label",children:s.label}),a.jsx("span",{className:"menubar__note",children:Mk(s.startedAt,e)})]},s.sessionId))})})}function eP(e=3e4){const[t,s]=j.useState(()=>Date.now());return j.useEffect(()=>{const n=setInterval(()=>{s(Date.now())},e);return()=>{clearInterval(n)}},[e]),t}function tP({now:e}){const t=qc(),s=t.data;return a.jsx(Pc,{label:"Versão",children:t.isPending?a.jsx(gc,{what:"a versão"}):s===void 0?a.jsx(bh,{what:"a versão"}):a.jsxs("p",{className:"menubar__item",children:[a.jsx("span",{className:"menubar__label",children:`v${s.current}`}),a.jsx("span",{className:"menubar__note",children:s.updateAvailable&&s.latest!==null?`atualização disponível: v${s.latest}`:s.checkedAt===null?"ainda não verificado":`em dia · verificado ${Mk(s.checkedAt,e)}`})]})})}function sP({now:e,reload:t}){var l;const s=eP(),n=e??s,o=qc();return wk({served:(l=o.data)==null?void 0:l.current,reload:t}),a.jsxs("main",{className:"menubar","aria-label":"Painel do Lumem",children:[a.jsx(Qq,{now:n}),a.jsx(Jq,{now:n}),a.jsx(Xq,{}),a.jsx(tP,{now:n}),a.jsx(Gq,{})]})}function iP({sidebar:e,children:t,fill:s=!1,right:n,rightWidth:o}){const l=n!==void 0&&o!==void 0?{"--right-width":`${o}px`}:void 0;return a.jsxs("div",{className:`app-shell${n!==void 0?" app-shell--right":""}`,style:l,children:[a.jsx("aside",{className:"app-shell__sidebar","aria-label":"navegação",children:e}),a.jsx("main",{className:`app-shell__main${s?" app-shell__main--fill":""}`,children:t}),n]})}function nP({account:e,onClose:t}){const s={adapterId:e.adapterId,accountId:e.id},n=c6(s,!0),o=S1();return a.jsxs("div",{className:"setup set__login",role:"group","aria-label":`entrar em ${e.label}`,children:[a.jsxs("div",{className:"setup__head",children:[a.jsxs("span",{className:"setup__t",children:["Entrar em ",e.label]}),a.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:t,children:"✕"})]}),l()]});function l(){return n.isPending?a.jsx("span",{className:"setup__note",children:"perguntando ao adaptador…"}):n.isError?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"set__err",role:"alert",children:n.error.message}),a.jsx("div",{className:"setup__acts",children:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>void o(),children:"tentar de novo"})})]}):n.data.authRequired?a.jsx(hk,{target:s,methods:n.data.authMethods,onDone:()=>void o()}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"setup__note",children:"O adaptador confirmou o login desta conta."}),a.jsx("div",{className:"setup__acts",children:a.jsx(J,{size:"sm",variant:"ghost",onClick:t,children:"fechar"})})]})}}function rP(e,t){return e.state==="disconnected"?e.identity===null?"needs-login":"disconnected":(t==null?void 0:t.authRequired)===!0?"needs-login":"connected"}function Lk(e,t){const s=e.find(n=>n.accountId===t.id);return s!==void 0?s:t.isDefault?e.find(n=>n.adapterId===t.adapterId&&n.accountId===null)??null:null}function aP(e){var s,n;const t=[(s=e.identity)==null?void 0:s.email,(n=e.identity)==null?void 0:n.plan].filter(o=>o!=null&&o!=="");return t.length===0?null:t.join(" · ")}function oP(e){return e===0?"apaga a conta — ela não tem conversa nenhuma":`apaga a conta e as ${String(e)} ${e===1?"conversa":"conversas"} dela`}function Bk(e){if(e===null)return null;const t=ba(e.configOptions);return t===null||t.choices.length===0?null:t}function ch(e,t){var o;if(e===null)return null;const s=t??((o=ba(e.configOptions))==null?void 0:o.currentValue)??null;if(s===null)return null;const n=lk(e,s);return n===null?null:ok(n)}function zk({state:e}){if(e.kind==="clean")return null;const t=e.kind==="saving"?"salvando…":e.kind==="saved"?"salvo":"não deu para salvar";return a.jsxs("span",{className:`set__save set__save--${e.kind}`,title:e.kind==="failed"?e.why:void 0,children:[a.jsx("span",{className:"set__save__dot","aria-hidden":"true"}),t]})}function lP({account:e,reading:t,onSave:s}){const[n,o]=j.useState({kind:"clean"}),l=Bk(t);if(l===null)return a.jsxs("span",{className:"set__trio",children:[a.jsx("span",{className:"set__trio__k",children:"conversa nova"}),a.jsx("span",{className:"set__d",children:"a lista de modelos chega na primeira conversa desta conta"})]});const d=e.defaultModel,h=ch(t,d),f=d===null||l.choices.some(g=>g.value===d);async function m(g){o({kind:"saving"});try{await s(g),o({kind:"saved"})}catch(v){o({kind:"failed",why:v instanceof Error?v.message:String(v)})}}return a.jsxs("span",{className:"set__trio",children:[a.jsx("span",{className:"set__trio__k",children:"conversa nova"}),a.jsx("span",{className:"set__trio__k",children:"modelo"}),a.jsxs("select",{className:"input set__sel","aria-label":`modelo padrão de ${e.label}`,value:d??"",onChange:g=>{const v=g.target.value===""?null:g.target.value,y=ch(t,v),x=(y==null?void 0:y.choices.some(S=>S.value===e.defaultEffort))??!1;m({model:v,effort:x?e.defaultEffort:null})},children:[a.jsx("option",{value:"",children:"padrão do adaptador"}),l.choices.map(g=>a.jsx("option",{value:g.value,children:g.name},g.value)),!f&&d!==null&&a.jsxs("option",{value:d,children:[d," (fora da lista)"]})]}),h!==null&&a.jsx("span",{className:"set__trio__k",children:"effort"}),h!==null&&a.jsxs("select",{className:"input set__sel","aria-label":`effort padrão de ${e.label}`,value:e.defaultEffort??"",onChange:g=>void m({model:d,effort:g.target.value===""?null:g.target.value}),children:[a.jsx("option",{value:"",children:"padrão do modelo"}),h.choices.map(g=>a.jsx("option",{value:g.value,children:g.name},g.value))]}),a.jsx(zk,{state:n}),e.defaultsUnavailable&&a.jsx("span",{className:"set__warn",children:"indisponível — o modelo padrão saiu da lista"})]})}const cP={connected:{tone:"on",word:"conectada"},"needs-login":{tone:"warn",word:"sem login"},disconnected:{tone:"off",word:"desconectada"}};function uP({account:e,reading:t,onLogin:s}){const[n,o]=j.useState(!1),{disconnect:l,purge:d,setDefault:h,setDefaults:f}=sv(),m=rP(e,t),g=aP(e),v=l.error??h.error??d.error??null;return a.jsxs("div",{className:"set__row set__row--sub",role:"group","aria-label":`conta ${e.label}`,children:[a.jsxs("span",{className:"set__what",children:[a.jsxs("span",{className:"set__lbl",children:[a.jsx(dP,{account:e}),e.isDefault&&a.jsx("span",{className:"set__mark",children:"padrão"})]}),g!==null&&a.jsx("span",{className:"set__d",children:g})]}),a.jsxs("span",{className:"set__ctl",children:[x(),y()]}),a.jsx("span",{className:"own",children:"máquina"}),m==="connected"&&a.jsx(lP,{account:e,reading:t,onSave:S=>f.mutateAsync({accountId:e.id,...S})}),n&&a.jsxs("span",{className:"set__confirm",children:[a.jsx("span",{children:oP(e.sessionCount)}),a.jsx(J,{size:"sm",variant:"danger",disabled:d.isPending,onClick:()=>d.mutate({accountId:e.id,sessionCount:e.sessionCount}),children:"apagar de vez"}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>o(!1),children:"cancelar"})]}),v!==null&&a.jsx("span",{className:"set__err set__wide",role:"alert",children:v.message})]});function y(){const{tone:S,word:w}=cP[m];return a.jsxs("span",{className:`set__st set__st--${S}`,children:[a.jsx("span",{className:"pip","aria-hidden":"true"}),w]})}function x(){const S=!e.bare&&e.state==="disconnected";return a.jsxs(a.Fragment,{children:[m==="connected"&&!e.isDefault&&a.jsx(J,{size:"sm",variant:"ghost",disabled:h.isPending,onClick:()=>h.mutate(e.id),children:"tornar padrão"}),m==="needs-login"&&a.jsx(J,{size:"sm",variant:"ghost",onClick:s,children:"entrar"}),m==="disconnected"&&a.jsx(J,{size:"sm",variant:"ghost",onClick:s,children:"reconectar"}),e.state==="connected"&&a.jsx(J,{size:"sm",variant:"ghost",disabled:l.isPending,onClick:()=>l.mutate(e.id),children:"desconectar"}),S&&!n&&a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>o(!0),children:"apagar de vez"})]})}}function dP({account:e}){const[t,s]=j.useState(null),{rename:n}=sv();if(t===null)return a.jsx("button",{type:"button",className:"set__name focus-ring","aria-label":`renomear ${e.label}`,title:"renomear",onClick:()=>s(e.label),children:e.label});const o=()=>{n.reset(),s(null)},l=()=>{const d=t.trim();if(d===""||d===e.label)return o();n.mutate({accountId:e.id,label:d},{onSuccess:()=>s(null)})};return a.jsxs(a.Fragment,{children:[a.jsx("input",{className:`input set__rename${n.error===null?"":" input--error"}`,"aria-label":`nome da conta ${e.label}`,"aria-invalid":n.error===null?void 0:!0,value:t,maxLength:80,autoFocus:!0,readOnly:n.isPending,onChange:d=>{s(d.target.value),n.reset()},onBlur:()=>{n.isPending||o()},onKeyDown:d=>{d.key==="Enter"&&l(),d.key==="Escape"&&o()}}),n.error!==null&&a.jsx("span",{className:"set__err set__rename__err",role:"alert",children:n.error.message})]})}function hP({spec:e,onClose:t,onConnected:s}){const[n,o]=j.useState(""),[l,d]=j.useState("subscription"),[h,f]=j.useState(""),{connect:m}=sv(),g=n.trim()!==""&&(l==="subscription"||h.trim()!=="")&&!m.isPending,v=`connect-${e.id}-label`,y=`connect-${e.id}-key`;function x(){g&&m.mutate({adapterId:e.id,label:n.trim(),kind:l,...l==="api_key"?{apiKey:h.trim()}:{}},{onSuccess:S=>{f(""),s({id:S.account.id,kind:l})}})}return a.jsxs("div",{className:"set__connect",role:"group","aria-label":`conectar conta do ${e.label}`,children:[a.jsxs("span",{className:"set__lbl",children:["Nova conta do ",e.label]}),a.jsx(Ht,{id:v,label:"nome da conta",hint:"O nome é seu — é ele que a pílula da conversa mostra.",children:a.jsx(Ft,{id:v,value:n,placeholder:"pessoal, trabalho…",onChange:S=>o(S.target.value),onKeyDown:S=>{S.key==="Enter"&&x()}})}),a.jsxs("span",{className:"seg",role:"group","aria-label":"tipo de conta",children:[a.jsx("button",{type:"button",className:"seg__btn focus-ring","aria-pressed":l==="subscription",onClick:()=>d("subscription"),children:"assinatura"}),a.jsx("button",{type:"button",className:"seg__btn focus-ring","aria-pressed":l==="api_key",onClick:()=>d("api_key"),children:"chave de API"})]}),l==="api_key"&&a.jsx(Ht,{id:y,label:"chave de API",hint:"Vai cifrada para o cofre do Lumem, e não volta para esta tela.",children:a.jsx(Ft,{id:y,type:"password",value:h,placeholder:"sk-…",onChange:S=>f(S.target.value)})}),a.jsxs("ul",{className:"set__inherit",children:[e.inheritLinks.length>0&&a.jsxs("li",{children:["liga da sua configuração de hoje (",a.jsxs("code",{children:["~/",e.defaultConfigDir]}),"):"," ",e.inheritLinks.map((S,w)=>a.jsxs("span",{children:[w>0&&", ",a.jsx("code",{children:S})]},S))]}),e.notInherited.map(S=>a.jsxs("li",{children:[a.jsx("b",{children:"não leva"})," ",S]},S)),a.jsx("li",{className:"set__terms",children:"usar duas assinaturas para somar limite pode ferir os termos do provedor"})]}),m.error!==null&&a.jsx("span",{className:"set__err",role:"alert",children:m.error.message}),a.jsxs("span",{className:"setup__acts",children:[a.jsx(J,{size:"sm",variant:"primary",disabled:!g,onClick:x,children:m.isPending?"conectando…":"conectar"}),a.jsx(J,{size:"sm",variant:"ghost",onClick:t,children:"cancelar"})]})]})}const fP=[],mP=[];function pP({defaultConnecting:e}={}){const t=Ag(),s=zc().data??fP,n=Og(null).data??mP;return a.jsx(wn,{title:"Agentes",description:a.jsxs(a.Fragment,{children:["O adaptador é a cópia que o daemon instalou, e o ",a.jsx("code",{children:"PATH"})," não decide. Cada agente pode ter mais de uma conta, e cada uma vale para ",a.jsx("b",{children:"todo workspace desta máquina"}),". A conversa nova nasce na conta ",a.jsx("b",{children:"padrão"})," — é dela que o rodapé da coluna fala."]}),children:a.jsx("div",{className:"set__rows",children:Tg.map(o=>{var l,d;return a.jsx(_P,{spec:o,installed:((d=(l=t.data)==null?void 0:l.adapters.find(h=>h.id===o.id))==null?void 0:d.adapter.version)??null,report:t.data,accounts:s.filter(h=>h.adapterId===o.id),catalog:n,defaultConnecting:e===o.id},o.id)})})})}function _P({spec:e,installed:t,report:s,accounts:n,catalog:o,defaultConnecting:l}){const[d,h]=j.useState(null),[f,m]=j.useState(l),g=n.find(v=>v.id===d)??null;return a.jsxs("div",{className:"set__agent",role:"group","aria-label":`agente ${e.label}`,children:[a.jsx(fi,{label:e.label,description:a.jsxs(a.Fragment,{children:[e.package??e.command," · pino ",a.jsx("code",{children:e.pinnedVersion})]}),owner:"máquina",readOnly:!0,children:a.jsx("span",{className:"set__val",children:t??"não instalado"})}),n.length===0&&a.jsx(gP,{spec:e,report:s}),n.map(v=>a.jsxs("div",{className:"set__acct",children:[a.jsx(uP,{account:v,reading:Lk(o,v),onLogin:()=>h(v.id)}),(g==null?void 0:g.id)===v.id&&a.jsx(nP,{account:g,onClose:()=>h(null)})]},v.id)),e.accountEnv!==null&&n.length>0&&(f?a.jsx(hP,{spec:e,onClose:()=>m(!1),onConnected:v=>{m(!1),v.kind==="subscription"&&h(v.id)}}):a.jsx("button",{type:"button",className:"set__add focus-ring",onClick:()=>m(!0),children:"+ conectar conta"}))]})}function gP({spec:e,report:t}){const s=l6(t);return a.jsx("div",{className:"set__acct",children:a.jsxs("div",{className:"set__row set__row--sub",role:"group","aria-label":`nenhuma conta do ${e.label}`,children:[a.jsx("span",{className:"set__d",children:"nenhuma conta ainda — o login que já existe nesta máquina entra como principal"}),a.jsx("span",{className:"set__ctl",children:a.jsx(J,{size:"sm",variant:"primary",disabled:s.isPending,onClick:()=>s.mutate(e),children:s.isPending?"conectando…":`conectar ${e.label}`})}),a.jsx("span",{className:"own",children:"máquina"}),s.error!==null&&a.jsx("span",{className:"set__err set__wide",role:"alert",children:s.error.message})]})})}const vP=[],yP=[],bP={implementador:"Implementador",revisor:"Revisor",testador:"Testador"};function xP({workspaceId:e}){const t=k6(e).data??[],s=zc().data??vP,n=Og(null).data??yP,{setSlot:o}=yh(e),l=j.useId();return t.length===0?null:a.jsxs("div",{className:"set__rows",role:"group","aria-labelledby":l,children:[a.jsx("h3",{className:"set__group",id:l,children:"Quem faz cada papel"}),t.map(d=>a.jsx(SP,{slot:d,accounts:s,catalog:n,onSave:h=>o.mutate({role:d.role,...h})},d.role)),o.error!==null&&a.jsx("span",{className:"set__err",role:"alert",children:o.error.message})]})}function SP({slot:e,accounts:t,catalog:s,onSave:n}){const o=e.role,l=t.find(g=>g.id===e.accountId)??t.find(g=>g.adapterId===e.adapter&&g.isDefault)??null,d=l===null?null:Lk(s,l),h=Bk(d),f=ch(d,e.model??(l==null?void 0:l.defaultModel)??null),m={adapter:e.adapter,accountId:e.accountId,model:e.model,effort:e.effort};return a.jsxs("div",{className:"set__row set__row--sub",role:"group","aria-label":`encaixe ${o}`,children:[a.jsxs("span",{className:"set__what",children:[a.jsx("span",{className:"set__lbl",children:bP[o]}),a.jsx("span",{className:"set__d",children:jP(e,l)})]}),a.jsx("span",{className:"set__ctl"}),a.jsx("span",{className:"own",children:"workspace"}),a.jsxs("span",{className:"set__trio",children:[a.jsx("span",{className:"set__trio__k",children:"conta"}),a.jsx("select",{className:"input set__sel","aria-label":`conta do ${o}`,value:`${e.adapter}:${e.accountId??""}`,onChange:g=>{const[v=e.adapter,y=""]=g.target.value.split(":");n({adapter:v,accountId:y===""?null:y,model:null,effort:null})},children:wP(t,e)}),h!==null&&a.jsx("span",{className:"set__trio__k",children:"modelo"}),h!==null&&a.jsxs("select",{className:"input set__sel","aria-label":`modelo do ${o}`,value:e.model??"",onChange:g=>{const v=g.target.value===""?null:g.target.value,y=ch(d,v??(l==null?void 0:l.defaultModel)??null),x=(y==null?void 0:y.choices.some(S=>S.value===e.effort))??!1;n({...m,model:v,effort:x?e.effort:null})},children:[a.jsx("option",{value:"",children:"padrão da conta"}),h.choices.map(g=>a.jsx("option",{value:g.value,children:g.name},g.value))]}),f!==null&&a.jsx("span",{className:"set__trio__k",children:"effort"}),f!==null&&a.jsxs("select",{className:"input set__sel","aria-label":`effort do ${o}`,value:e.effort??"",onChange:g=>n({...m,effort:g.target.value===""?null:g.target.value}),children:[a.jsx("option",{value:"",children:"padrão da conta"}),f.choices.map(g=>a.jsx("option",{value:g.value,children:g.name},g.value))]})]})]})}function wP(e,t){return[...new Set([t.adapter,...e.map(n=>n.adapterId)])].flatMap(n=>{var d;const o=((d=WR(n))==null?void 0:d.label)??n,l=e.filter(h=>h.adapterId===n&&(h.state==="connected"||h.id===t.accountId));return[a.jsxs("option",{value:`${n}:`,children:[o," · conta padrão"]},`${n}:`),...l.map(h=>a.jsxs("option",{value:`${n}:${h.id}`,children:[o," · ",h.label]},h.id))]})}function jP(e,t){return`${e.from==="workspace"?"deste workspace":"padrão do produto"} · ${(t==null?void 0:t.label)??"sem conta conectada"}`}function CP(){var g;const e=zq(),t=qc(),s=qq(),n=a.jsxs(a.Fragment,{children:["O daemon pergunta ao registry do npm, a cada 6 h, qual é a última versão. É um"," ",a.jsx("code",{children:"GET"})," sem identificador — nada de telemetria."]});if(e.isPending)return a.jsx(wn,{title:"Atualizações",description:n,children:a.jsx(ss,{label:"lendo as preferências do daemon"})});if(e.data===void 0)return a.jsx(wn,{title:"Atualizações",description:n,children:a.jsx("p",{className:"set__err",role:"alert",children:((g=e.error)==null?void 0:g.message)??"o daemon não respondeu"})});const{updateCheck:o,updateCheckForcedOff:l,autoUpdate:d}=e.data,h=o&&!l,f=t.data!==void 0&&!t.data.supervised,m=d==="idle";return a.jsx(wn,{title:"Atualizações",description:n,children:a.jsxs("div",{className:"set__rows",children:[a.jsx(fi,{label:"Procurar versão nova",description:a.jsxs(a.Fragment,{children:["Sem isto o Lumem só sabe da versão nova se você rodar ",a.jsx("code",{children:"lumem upgrade"}),"."]}),owner:"máquina",children:a.jsxs("label",{className:"set__switch",children:[a.jsx("input",{type:"checkbox","aria-label":"Procurar versão nova",checked:h,disabled:l,onChange:v=>{s.mutate({updateCheck:v.target.checked})}}),a.jsx("span",{children:l?"desligado por LUMEM_NO_UPDATE_CHECK":h?"ligado":"desligado"})]})}),a.jsx(fi,{label:"Atualizar sozinho quando ocioso",description:a.jsx(a.Fragment,{children:"Instala a versão nova e reinicia quando nenhum turno está em voo e nenhum script de projeto está rodando. Nunca atravessa uma versão maior depois da 1.0. Terminais abertos fecham."}),owner:"máquina",children:a.jsxs("label",{className:"set__switch",children:[a.jsx("input",{type:"checkbox","aria-label":"Atualizar sozinho quando ocioso",checked:m,disabled:t.data===void 0||f,onChange:v=>{s.mutate({autoUpdate:v.target.checked?"idle":"off"})}}),a.jsx("span",{children:f?"precisa do Lumem rodando como serviço":m?"ligado":"desligado"})]})})]})})}function fi({label:e,description:t,owner:s,readOnly:n=!1,children:o}){const l=["own",n?"own--ro":"",s==="repositório"?"own--wrap":""].filter(Boolean).join(" ");return a.jsxs("div",{className:"set__row",children:[a.jsxs("span",{className:"set__what",children:[a.jsx("span",{className:"set__lbl",children:e}),t!==void 0&&a.jsx("span",{className:"set__d",children:t})]}),a.jsx("span",{className:"set__ctl",children:o}),a.jsx("span",{className:l,children:s})]})}function wn({title:e,description:t,children:s}){return a.jsxs("section",{className:"set__sec",children:[a.jsx("div",{className:"set__sech",children:a.jsx("h2",{className:"set__sect",children:e})}),a.jsx("p",{className:"set__secd",children:t}),s]})}function Cd({id:e,value:t,nullable:s,unit:n,integer:o=!1,onCommit:l,ariaLabel:d}){const[h,f]=j.useState(null),[m,g]=j.useState({kind:"clean"}),[v,y]=j.useState(null),x=h??(t===null?"":kP(t,o)),S=x.trim()==="";async function w(){const E=x.trim();if(E===""){if(!s){y("este não pode ficar vazio");return}return k(null,h)}const D=Number(E.replace(",","."));if(!Number.isFinite(D)||D<0){y("negativo não é teto");return}if(o&&!Number.isInteger(D)){y("este conta inteiros");return}await k(D,h)}async function k(E,D){y(null),g({kind:"saving"});try{await l(E),f(A=>A===D?null:A),g({kind:"saved"})}catch(A){g({kind:"failed",why:A instanceof Error?A.message:String(A)})}}return a.jsxs(a.Fragment,{children:[a.jsx(zk,{state:m}),v!==null&&a.jsx("span",{className:"set__err",role:"alert",children:v}),n!==void 0&&!S&&a.jsx("span",{className:"set__pre",children:n}),a.jsx("input",{id:e,className:`input set__num${v===null?"":" input--error"}`,"aria-label":d,"aria-invalid":v===null?void 0:!0,inputMode:"decimal",value:x,placeholder:s?"sem teto":"",onChange:E=>{f(E.target.value),y(null),g({kind:"clean"})},onBlur:()=>void w(),onKeyDown:E=>{E.key==="Enter"&&w(),E.key==="Escape"&&(f(null),y(null))}})]})}function kP(e,t){return t?String(e):e.toFixed(2).replace(".",",")}const qk=[{value:"manual",label:"manual"},{value:"assistido",label:"assistido"},{value:"autonomo",label:"autônomo"}];function Pw(e){const t=qk.find(s=>s.value===e);return(t==null?void 0:t.value)??"manual"}function NP({workspaceId:e,workspaceName:t}){return a.jsxs("div",{className:"set",children:[a.jsxs("header",{className:"set__head",children:[a.jsx("div",{className:"crumb",children:a.jsx("span",{children:t})}),a.jsxs("div",{className:"set__title",children:[a.jsx("h1",{children:"Configurações"}),a.jsx("span",{className:"kind",children:"/settings"})]}),a.jsxs("p",{className:"set__lede",children:["Cada ajuste diz ",a.jsx("b",{children:"de quem ele é"}),". Mudar um teto muda para o workspace"," ",a.jsx("b",{children:t}),"; conectar um agente muda para ",a.jsx("b",{children:"esta máquina"}),", e para todo workspace dela."]})]}),a.jsx(EP,{workspaceId:e}),a.jsx(pP,{}),a.jsx(TP,{}),a.jsx(CP,{}),a.jsx(AP,{})]})}function EP({workspaceId:e}){var f;const t=c1(e),{setAutonomy:s,setCleanup:n,setBudget:o}=yh(e);if(t.isPending)return a.jsx(wn,{title:"Esteira e orçamento",description:"O que este workspace deixa a máquina gastar sozinha.",children:a.jsx(ss,{label:"lendo os tetos do workspace"})});if(t.data===void 0)return a.jsx(wn,{title:"Esteira e orçamento",description:"O que este workspace deixa a máquina gastar sozinha.",children:a.jsx("p",{className:"set__err",role:"alert",children:((f=t.error)==null?void 0:f.message)??"o daemon não respondeu"})});const l=t.data,d=l.caps;function h(m){return g=>o.mutateAsync({costPerTask:d.costPerTask,costPerDay:d.costPerDay,turnsPerSession:d.turnsPerSession,[m]:g})}return a.jsx(wn,{title:"Esteira e orçamento",description:a.jsxs(a.Fragment,{children:["O que este workspace deixa a máquina gastar sozinha. ",a.jsx("code",{children:"sem teto"})," e"," ",a.jsx("code",{children:"0"})," são coisas diferentes: o primeiro não segura nada, o segundo bloqueia tudo."]}),children:a.jsxs("div",{className:"set__rows",children:[a.jsx(fi,{label:"Autonomia",description:a.jsxs(a.Fragment,{children:["Quem puxa a fila. ",a.jsx("code",{children:"assistido"})," prepara tudo e para antes de enviar."]}),owner:"workspace",children:a.jsx("span",{className:"seg",role:"group","aria-label":"autonomia",children:qk.map(m=>a.jsx("button",{type:"button",className:"seg__btn focus-ring","aria-pressed":Pw(l.autonomy)===m.value,onClick:()=>{m.value!=="manual"&&MO(),s.mutate({autonomy:m.value,maxParallel:l.maxParallel})},children:m.label},m.value))})}),a.jsx(fi,{label:"Cartões em paralelo",description:"Quantos a esteira toca ao mesmo tempo. Zero a segura sem desligá-la.",owner:"workspace",children:a.jsx(Cd,{id:"set-max-parallel",ariaLabel:"cartões em paralelo",value:l.maxParallel,nullable:!1,integer:!0,onCommit:m=>s.mutateAsync({autonomy:Pw(l.autonomy),maxParallel:m??0})})}),a.jsx(fi,{label:"Teto por tarefa",description:"A esteira para ao cruzar; quem conduz é avisado e decide.",owner:"workspace",children:a.jsx(Cd,{id:"set-cost-task",ariaLabel:"teto por tarefa",value:d.costPerTask,nullable:!0,unit:"US$",onCommit:h("costPerTask")})}),a.jsx(fi,{label:"Teto por dia",description:"Somado no workspace inteiro, todos os agentes juntos.",owner:"workspace",children:a.jsx(Cd,{id:"set-cost-day",ariaLabel:"teto por dia",value:d.costPerDay,nullable:!0,unit:"US$",onCommit:h("costPerDay")})}),a.jsx(fi,{label:"Turnos por sessão",description:a.jsxs(a.Fragment,{children:["O teto que protege quem não relata dinheiro — o Codex responde ",a.jsx("code",{children:"cost: null"}),"."]}),owner:"workspace",children:a.jsx(Cd,{id:"set-turns",ariaLabel:"turnos por sessão",value:d.turnsPerSession,nullable:!0,integer:!0,onCommit:h("turnsPerSession")})}),a.jsx(fi,{label:"PR mesclada sempre remove a worktree",description:"Inclusive com arquivo não commitado.",owner:"workspace",children:a.jsxs("label",{className:"set__switch",children:[a.jsx("input",{type:"checkbox","aria-label":"PR mesclada sempre remove a worktree",checked:l.mergedAlwaysRemoves,onChange:m=>n.mutate(m.target.checked)}),a.jsx("span",{children:l.mergedAlwaysRemoves?"ligado":"desligado"})]})}),a.jsx(fi,{label:"Tarefas que um agente pode criar a partir de uma",description:a.jsxs(a.Fragment,{children:["Muda em ",a.jsx("code",{children:l.budgetEnv}),", no ambiente do daemon."]}),owner:"máquina",readOnly:!0,children:a.jsx("span",{className:"set__val",children:l.budget})}),a.jsx(xP,{workspaceId:e})]})})}function TP(){const t=fk().data??[];return a.jsx(wn,{title:"Integrações",description:a.jsx(a.Fragment,{children:"A chave é da máquina; o mapa de colunas do tracker é do repositório. Quem separa os dois é a etiqueta de cada linha, e não uma frase no topo."}),children:a.jsxs("div",{className:"set__rows",children:[t.map(s=>a.jsx(fi,{label:s.label,description:a.jsxs(a.Fragment,{children:["Cifrada em ",a.jsx("code",{children:"~/.lumem/_system"}),". Quem já lê o seu ",a.jsx("code",{children:"$HOME"})," como você decifra."]}),owner:"máquina",readOnly:!0,children:a.jsx("span",{className:"set__val",children:s.present?"guardada":"sem chave"})},s.id)),a.jsx(fi,{label:"GitHub e GitLab",description:a.jsxs(a.Fragment,{children:["Vêm do ",a.jsx("code",{children:"gh"})," e do ",a.jsx("code",{children:"glab"})," da sua máquina. O Lumem não vê, não pede e não grava token."]}),owner:"máquina",readOnly:!0,children:a.jsx("span",{className:"set__val",children:"fora do cofre"})})]})})}function AP(){return a.jsx(wn,{title:"Exibição",description:a.jsx(a.Fragment,{children:"O que é deste navegador, e não viaja com você para outra máquina — como a largura da coluna de arquivos e o estado do rodapé já não viajam."}),children:a.jsxs("div",{className:"set__todo",children:[a.jsx("span",{"aria-hidden":"true",children:"⚠"}),a.jsxs("span",{children:[a.jsx("b",{children:"Tamanho de fonte ainda não tem alavanca."})," O ",a.jsx("code",{children:"tokens.css"})," tem"," ",a.jsx("b",{children:"111 valores em px e zero rem"})," — então"," ",a.jsxs("code",{children:["html ","{ font-size }"]})," não move um pixel. O ",a.jsx("code",{children:"rem"})," nasce no sistema de design, e a preferência chega quando ele chegar."]})]})})}function OP({workspaceId:e,workspaceName:t}){const{selection:s}=Fo(),n=Qg(),o=_k();if(s===null&&n==="settings")return a.jsx(NP,{workspaceId:e,workspaceName:t},e);if(s===null)return a.jsx(M6,{workspaceId:e,workspaceName:t,view:n==="tasks"?"board":"home",onView:h=>sc(h==="board"?"tasks":"home"),onRemoved:()=>void o(),onWorkOnTask:h=>{Ho({sessionId:h.sessionId,text:h.draft,send:!1}),xn({projectId:h.projectId,scope:h.worktreeId===null?{scopeType:"project",scopeId:h.projectId}:{scopeType:"worktree",scopeId:h.worktreeId}})}},e);const{projectId:l,scope:d}=s;return d.scopeType==="worktree"?a.jsx(t4,{worktreeId:d.scopeId,projectId:l,workspaceName:t,onRemoved:()=>xn({projectId:l,scope:{scopeType:"project",scopeId:l}}),onOpenWorkspace:()=>Vr(),onOpenProject:()=>xn({projectId:l,scope:{scopeType:"project",scopeId:l}})},d.scopeId):a.jsx(J5,{projectId:l,workspaceId:e,workspaceName:t,onRemoved:()=>Vr(),onOpenWorkspace:()=>Vr(),onSelectWorktree:h=>xn({projectId:l,scope:{scopeType:"worktree",scopeId:h}})},l)}function RP(){const{selection:e}=Fo(),t=vh(),s=a4();return e===null?null:a.jsx(v5,{scope:e.scope,onClose:t.toggle,onResize:t.setWidth,onAskAgent:(n,o)=>{Ho({sessionId:n,text:o,send:!0})},dock:r4(s,t)},`${e.scope.scopeType}:${e.scope.scopeId}`)}function DP(e){return e==="tasks"?"board":e==="menubar"?"home":e}function MP({workspaceId:e,workspaceName:t,workspaces:s,select:n,expansion:o,addProjectOpen:l,onOpenAddProject:d,onCloseAddProject:h,worktreeFor:f,onCreateWorktree:m,onCloseCreateWorktree:g}){const{selection:v}=Fo(),y=Qg(),x=vh();return a.jsxs(a.Fragment,{children:[a.jsx(iP,{fill:!0,right:v!==null&&x.open?a.jsx(RP,{}):void 0,rightWidth:x.width,sidebar:a.jsxs(a.Fragment,{children:[a.jsx(z6,{workspaces:s,activeId:e,onSelect:S=>{n(S),Vr()}}),a.jsx(m6,{workspaceId:e,place:v!==null?"scope":DP(y),onHome:()=>{sc("home"),Vr()},onBoard:()=>{sc("tasks"),Vr()},onSettings:()=>{sc("settings"),Vr()}}),a.jsx(v6,{workspaceId:e,expansion:o,selection:{scopeType:(v==null?void 0:v.scope.scopeType)??null,scopeId:(v==null?void 0:v.scope.scopeId)??null},onSelect:(S,w)=>xn({projectId:S,scope:w}),onAddProject:d,onCreateWorktree:m}),a.jsx("div",{className:"sidebar__foot",children:a.jsx(a6,{})})]}),children:a.jsx(OP,{workspaceId:e,workspaceName:t})}),a.jsx(kO,{workspaceId:e,workspaceName:t,open:l,onClose:h,onRequestOpen:d,onAdded:S=>xn({projectId:S,scope:{scopeType:"project",scopeId:S}})}),f!==null&&a.jsx(Q6,{workspaceId:e,projectId:f.id,onClose:g,onOpenExisting:()=>o.expand(f.id),onCreated:()=>o.expand(f.id)},f.id)]})}function LP(){return Qg()==="menubar"?a.jsx(sP,{}):a.jsx(BP,{})}function BP(){var S,w;const e=_k(),[t,s]=j.useState(null),[n,o]=j.useState(!1),[l,d]=j.useState(null),h=iq(),f=nq(),m=wk({served:(S=f.data)==null?void 0:S.version}),g=C6(),{activeId:v,select:y}=tq(g.data??[]);return j.useEffect(()=>{t!==null||!g.isSuccess||s(g.data.length===0)},[t,g.isSuccess,g.data]),oq(),a.jsx(y5,{children:a.jsx(uB,{children:a.jsx(i5,{children:a.jsxs("div",{className:"app",children:[a.jsx(xq,{version:((w=f.data)==null?void 0:w.version)??null,unreachable:f.isError,update:a.jsx(Pq,{})}),m.updatedTo!==null&&a.jsx("div",{className:"app__banner",children:a.jsxs(Ce,{tone:"info",actions:a.jsx(J,{size:"sm",variant:"ghost",onClick:m.dismiss,children:"ok"}),children:["Lumem atualizado para v",m.updatedTo]})}),f.isError&&a.jsx("div",{className:"app__banner",children:a.jsxs(Ce,{tone:"danger",children:[a.jsx("strong",{children:"Daemon inacessível."})," Nada aqui responde até ele voltar. As sessões continuam rodando no servidor — o que caiu é a conexão com ele."]})}),x()]})})})});function x(){var D,A;if(g.isPending)return a.jsx("div",{className:"pane",children:a.jsx(ss,{label:"conectando ao daemon"})});if(g.isError)return a.jsx("div",{className:"pane",children:a.jsx("p",{role:"alert",children:g.error.message})});if(t===null)return a.jsx("div",{className:"pane",children:a.jsx(ss,{label:"conectando ao daemon"})});if(t||g.data.length===0||v===null)return a.jsx(Bq,{daemonVersion:((D=f.data)==null?void 0:D.version)??null,daemonUnreachable:f.isError,onFinish:N=>void(async()=>{await e(),N.workspaceId!==void 0&&y(N.workspaceId),N.sessionId!==void 0&&Ho({sessionId:N.sessionId,send:!1}),N.projectId!==void 0&&xn({projectId:N.projectId,scope:N.worktreeId===void 0?{scopeType:"project",scopeId:N.projectId}:{scopeType:"worktree",scopeId:N.worktreeId}}),s(!1)})()});const k=g.data,E=((A=k.find(N=>N.id===v))==null?void 0:A.name)??"";return a.jsx(MP,{workspaceId:v,workspaceName:E,workspaces:k,select:y,expansion:h,addProjectOpen:n,onOpenAddProject:()=>o(!0),onCloseAddProject:()=>o(!1),worktreeFor:l,onCreateWorktree:d,onCloseCreateWorktree:()=>d(null)})}}const zP={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};async function qP(e=zP){}function PP(e=window){const t=n=>{const o=lh(n.error??n.message);oh({kind:"app",label:o.label??"window.onerror",message:o.message,detail:o.detail})},s=n=>{const o=lh(n.reason);oh({kind:"app",label:o.label??"unhandledrejection",message:o.message,detail:o.detail})};return e.addEventListener("error",t),e.addEventListener("unhandledrejection",s),()=>{e.removeEventListener("error",t),e.removeEventListener("unhandledrejection",s)}}function IP(){return new L2({queryCache:new hj({onError:(e,t)=>{if(!Bw(e))return;const s=lh(e);oh({kind:"query",label:s.label??t.queryKey.join("."),message:s.message,detail:s.detail})}}),mutationCache:new uj({onError:(e,t,s,n)=>{var l;if(!Bw(e))return;const o=lh(e);oh({kind:"mutation",label:o.label??((l=n.options.mutationKey)==null?void 0:l.join("."))??"—",message:o.message,detail:o.detail})}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})}PP();const Pk=document.getElementById("root");if(!Pk)throw new Error("#root not found in index.html");const HP=Y2.createRoot(Pk);HP.render(a.jsx(j.StrictMode,{children:a.jsx(z2,{client:IP(),children:a.jsx(LP,{})})}));qP();export{VP as a,zt as c,WP as s};
|