runcastle 1.0.19 → 1.0.20

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.
@@ -1,11 +1,11 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=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(){}},u=new class extends l{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},d={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},f=new class{#e=d;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function p(e){setTimeout(e,0)}var m=typeof window>`u`||`Deno`in globalThis;function h(){}function g(e,t){return typeof e==`function`?e(t):e}function _(e){return typeof e==`number`&&e>=0&&e!==1/0}function v(e,t){return Math.max(e+(t||0)-Date.now(),0)}function y(e,t){return typeof e==`function`?e(t):e}function b(e,t){return typeof e==`function`?e(t):e}function x(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ee(o,t.options))return!1}else if(!w(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function S(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(C(t.options.mutationKey)!==C(a))return!1}else if(!w(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ee(e,t){return(t?.queryKeyHashFn||C)(e)}function C(e){return JSON.stringify(e,(e,t)=>ae(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function w(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>w(e[n],t[n])):!1}var te=Object.prototype.hasOwnProperty;function ne(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ie(e)&&ie(t);if(!r&&!(ae(e)&&ae(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:te.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ne(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function re(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ie(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ae(e){if(!oe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!oe(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function oe(e){return Object.prototype.toString.call(e)===`[object Object]`}function se(e){return new Promise(t=>{f.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ne(e,t)}function E(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ce(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var le=Symbol();function ue(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===le?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function de(e,t){return typeof e==`function`?e(...t):!!e}function fe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var D=(()=>{let e=()=>m;return{isServer(){return e()},setIsServer(t){e=t}}})();function pe(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var me=p;function he(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=me,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var O=he(),ge=new class extends l{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)!==`online`||ge.isOnline()}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=pe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ye(t);p(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>u.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),d=()=>ve(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(D.isServer()?0:3),o=e.retryDelay??_e,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),se(s).then(()=>l()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:d,start:()=>(d()?h():m().then(h),i)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_(this.gcTime)&&(this.#e=f.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(D.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(f.clearTimeout(this.#e),this.#e=void 0)}};function Se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{fe(e,()=>t.signal,()=>n=!0)},u=ue(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ce:E;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Te(e,t){return t?Ce(e,t)!=null:!1}function Ee(e,t){return!t||!e.getPreviousPageParam?!1:we(e,t)!=null}var De=class extends xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ae(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ae(this.options);e.data!==void 0&&(this.setState(ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(h).catch(h):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>b(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===le||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>y(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!v(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ue(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Oe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ke(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),O.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Oe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ae(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var je=class extends l{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=pe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ne(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof b(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!re(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Fe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||b(this.options.enabled,this.#t)!==b(t.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||b(this.options.enabled,this.#t)!==b(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Le(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(h)),t}#g(){this.#b();let e=y(this.options.staleTime,this.#t);if(D.isServer()||this.#r.isStale||!_(e))return;let t=v(this.#r.dataUpdatedAt,e)+1;this.#d=f.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(D.isServer()||b(this.options.enabled,this.#t)===!1||!_(this.#p)||this.#p===0)&&(this.#f=f.setInterval(()=>{(this.options.refetchIntervalInBackground||u.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(f.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(f.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ne(e,t),o=i&&Fe(e,n,t,r);(a||o)&&(l={...l,...Oe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=T(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&x,isStale:Ie(e,t),refetch:this.refetch,promise:this.#o,isEnabled:b(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=pe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!re(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){O.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Me(e,t){return b(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&b(t.retryOnMount,e)===!1)}function Ne(e,t){return Me(e,t)||e.state.data!==void 0&&Pe(e,t,t.refetchOnMount)}function Pe(e,t,n){if(b(t.enabled,e)!==!1&&y(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ie(e,t)}return!1}function Fe(e,t,n,r){return(e!==t||b(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ie(e,n)}function Ie(e,t){return b(t.enabled,e)!==!1&&e.isStaleByTime(y(t.staleTime,e))}function Le(e,t){return!re(e.getCurrentResult(),t)}var Re=class extends je{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Te(t,n.data),hasPreviousPage:Ee(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ze=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Be(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),O.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Be(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ve=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ze({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=He(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=He(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=He(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=He(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){O.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>S(t,e))}findAll(e={}){return this.getAll().filter(t=>S(e,t))}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return O.batch(()=>Promise.all(e.map(e=>e.continue().catch(h))))}};function He(e){return e.options.scope?.id}var Ue=class extends l{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),re(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&C(t.mutationKey)!==C(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Be();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){O.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function We(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Ge(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ke=class extends l{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,O.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!re(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(We(e,n).forEach(e=>{e.destroy()}),We(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ne(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new je(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Ge(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&O.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},qe=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new De({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){O.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>x(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>x(e,t)):t}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){O.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Je=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new qe,this.#t=e.mutationCache||new Ve,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=u.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(y(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return O.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;O.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return O.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=O.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(h).catch(h)}invalidateQueries(e,t={}){return O.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=O.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(h)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(h)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(y(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(h).catch(h)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(h).catch(h)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(C(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{w(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(C(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{w(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ee(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===le&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ye=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function ee(){}var C={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function te(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ne(e,t){return te(e.type,t,e.props)}function re(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ie(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ae=/\/+/g;function oe(e,t){return typeof e==`object`&&e&&e.key!=null?ie(``+e.key):t.toString(36)}function se(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ee,ee):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function T(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,T(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+oe(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ae,`$&/`)+`/`),T(o,r,i,``,function(e){return e})):o!=null&&(re(o)&&(o=ne(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ae,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+oe(a,u),c+=T(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+oe(a,u++),c+=T(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return T(se(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function E(e,t,n){if(e==null)return e;var r=[],i=0;return T(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ce(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var le=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ue={map:E,forEach:function(e,t,n){E(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return E(e,function(){t++}),t},toArray:function(e){return E(e,function(e){return e})||[]},only:function(e){if(!re(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ue,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!w.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return te(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)w.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return te(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=re,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ce}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=C.T,n={};C.T=n;try{var r=e(),i=C.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(ee,le)}catch(e){le(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),C.T=t}},e.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},e.use=function(e){return C.H.use(e)},e.useActionState=function(e,t,n){return C.H.useActionState(e,t,n)},e.useCallback=function(e,t){return C.H.useCallback(e,t)},e.useContext=function(e){return C.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return C.H.useEffect(e,t)},e.useEffectEvent=function(e){return C.H.useEffectEvent(e)},e.useId=function(){return C.H.useId()},e.useImperativeHandle=function(e,t,n){return C.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return C.H.useMemo(e,t)},e.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return C.H.useReducer(e,t,n)},e.useRef=function(e){return C.H.useRef(e)},e.useState=function(e){return C.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return C.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return C.H.useTransition()},e.version=`19.2.7`})),Xe=o(((e,t)=>{t.exports=Ye()})),Ze=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Qe=o(((e,t)=>{t.exports=Ze()})),k=c(Xe(),1),A=Qe(),$e=k.createContext(void 0),et=e=>{let t=k.useContext($e);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},tt=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,A.jsx)($e.Provider,{value:e,children:t})),nt=k.createContext(!1),rt=()=>k.useContext(nt);nt.Provider;function it(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var at=k.createContext(it()),ot=()=>k.useContext(at),st=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?de(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ct=e=>{k.useEffect(()=>{e.clearReset()},[e])},lt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||de(n,[e.error,r])),ut=(e,t)=>t.state.data===void 0,dt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ft=(e,t)=>e.isLoading&&e.isFetching&&!t,pt=(e,t)=>e?.suspense&&t.isPending,mt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ht({queries:e,...t},n){let r=et(n),i=rt(),a=ot(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{dt(e);let t=r.getQueryCache().get(e.queryHash);st(e,a,t)}),ct(a);let[s]=k.useState(()=>new Ke(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>d?s.subscribe(O.batchCalls(e)):h,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>pt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&pt(n,e)?mt(n,new je(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&lt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function gt(e,t,n){let r=rt(),i=ot(),a=et(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,dt(o),st(o,i,s),ct(i);let l=!a.getQueryCache().get(o.queryHash),[u]=k.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(k.useSyncExternalStore(k.useCallback(e=>{let t=f?u.subscribe(O.batchCalls(e)):h;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),k.useEffect(()=>{u.setOptions(o)},[o,u]),pt(o,d))throw mt(o,u,i);if(lt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!D.isServer()&&ft(d,r)&&(l?mt(o,u,i):s?.promise)?.catch(h).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function _t(e,t){return gt(e,je,t)}function vt(e,t){return gt({...e,enabled:!0,suspense:!0,throwOnError:ut,placeholderData:void 0},je,t)}function yt(e,t){return gt({...e,enabled:!0,suspense:!0,throwOnError:ut},Re,t)}function bt(e,t){return ht({...e,queries:e.queries.map(e=>({...e,suspense:!0,throwOnError:ut,enabled:!0,placeholderData:void 0}))},t)}function xt(e,t){let n=et(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function St(e,t){let n=et(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function Ct(e){return e}function wt(e){return e}function Tt(e,t){let n=et(t),[r]=k.useState(()=>new Ue(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);let i=k.useSyncExternalStore(k.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=k.useCallback((e,t)=>{r.mutate(e,t).catch(h)},[r]);if(i.error&&de(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Et(e,t){return gt(e,Re,t)}var Dt=Object.create,Ot=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,At=Object.getOwnPropertyNames,jt=Object.getPrototypeOf,Mt=Object.prototype.hasOwnProperty,Nt=(e,t)=>function(){return t||(0,e[At(e)[0]])((t={exports:{}}).exports,t),t.exports},Pt=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=At(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Mt.call(e,s)&&s!==n&&Ot(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=kt(t,s))||r.enumerable});return e},Ft=(e,t,n)=>(n=e==null?{}:Dt(jt(e)),Pt(t||!e||!e.__esModule?Ot(n,`default`,{value:e,enumerable:!0}):n,e)),It=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Lt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=It().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Rt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=It().default,r=Lt();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),zt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Rt();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Bt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=zt();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});function Vt(e){let t={subscribe(t){let n=null,r=!1,i=!1,a=!1;function o(){if(n===null){a=!0;return}i||(i=!0,typeof n==`function`?n():n&&n.unsubscribe())}return n=e({next(e){var n;r||(n=t.next)==null||n.call(t,e)},error(e){var n;r||(r=!0,(n=t.error)==null||n.call(t,e),o())},complete(){var e;r||(r=!0,(e=t.complete)==null||e.call(t),o())}}),a&&o(),{unsubscribe:o}},pipe(...e){return e.reduce(Ht,t)}};return t}function Ht(e,t){return t(e)}function Ut(e){let t=new AbortController;return new Promise((n,r)=>{let i=!1;function a(){i||(i=!0,o.unsubscribe())}t.signal.addEventListener(`abort`,()=>{r(t.signal.reason)});let o=e.subscribe({next(e){i=!0,n(e),a()},error(e){r(e)},complete(){t.abort(),a()}})})}function Wt(e){return e=>{let t=0,n=null,r=[];function i(){n||=e.subscribe({next(e){for(let n of r){var t;(t=n.next)==null||t.call(n,e)}},error(e){for(let n of r){var t;(t=n.error)==null||t.call(n,e)}},complete(){for(let t of r){var e;(e=t.complete)==null||e.call(t)}}})}function a(){if(t===0&&n){let e=n;n=null,e.unsubscribe()}}return Vt(e=>(t++,r.push(e),i(),{unsubscribe(){t--,a();let n=r.findIndex(t=>t===e);n>-1&&r.splice(n,1)}}))}}function Gt(e){let t=e,n=[],r=e=>{t!==void 0&&e.next(t),n.push(e)},i=e=>{n.splice(n.indexOf(e),1)},a=Vt(e=>(r(e),()=>{i(e)}));return a.next=e=>{if(t!==e){t=e;for(let t of n)t.next(e)}},a.get=()=>t,a}function Kt(e){return Vt(t=>{function n(t=0,r=e.op){let i=e.links[t];if(!i)throw Error(`No more links to execute - did you forget to add an ending link?`);return i({op:r,next(e){return n(t+1,e)}})}return n().subscribe(t)})}function qt(e){return!!e&&!Array.isArray(e)&&typeof e==`object`}function Jt(){return Object.create(null)}var Yt=typeof Symbol==`function`&&!!Symbol.asyncIterator;function Xt(e){return Yt&&qt(e)&&Symbol.asyncIterator in e}var Zt={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};Zt.BAD_GATEWAY,Zt.SERVICE_UNAVAILABLE,Zt.GATEWAY_TIMEOUT,Zt.INTERNAL_SERVER_ERROR;var Qt=Object.create,$t=Object.defineProperty,en=Object.getOwnPropertyDescriptor,tn=Object.getOwnPropertyNames,nn=Object.getPrototypeOf,rn=Object.prototype.hasOwnProperty,an=(e,t)=>function(){return t||(0,e[tn(e)[0]])((t={exports:{}}).exports,t),t.exports},on=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=tn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!rn.call(e,s)&&s!==n&&$t(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=en(t,s))||r.enumerable});return e},sn=(e,t,n)=>(n=e==null?{}:Qt(nn(e)),on(t||!e||!e.__esModule?$t(n,`default`,{value:e,enumerable:!0}):n,e)),cn=()=>{},ln=e=>{Object.freeze&&Object.freeze(e)};function un(e,t,n){let r=t.join(`.`);return n[r]??(n[r]=new Proxy(cn,{get(r,i){if(!(typeof i!=`string`||i===`then`))return un(e,[...t,i],n)},apply(n,r,i){let a=t[t.length-1];if(a===`valueOf`||a===`toString`||a===`toJSON`)return`tRPC.proxy(${t.slice(0,-1).join(`.`)})`;let o={args:i,path:t};return a===`call`?o={args:i.length>=2?[i[1]]:[],path:t.slice(0,-1)}:a===`apply`&&(o={args:i.length>=2?i[1]:[],path:t.slice(0,-1)}),ln(o.args),ln(o.path),e(o)}})),n[r]}var dn=e=>un(e,[],Jt()),fn=e=>new Proxy(cn,{get(t,n){if(n!==`then`)return e(n)}}),pn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),mn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=pn().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),hn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=pn().default,r=mn();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),gn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=hn();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),_n=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=gn();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});sn(_n(),1),sn(gn(),1);var vn=sn(_n(),1);function yn(e,t){if(`error`in e){let n=t.deserialize(e.error);return{ok:!1,error:(0,vn.default)((0,vn.default)({},e),{},{error:n})}}return{ok:!0,result:(0,vn.default)((0,vn.default)({},e.result),(!e.result.type||e.result.type===`data`)&&{type:`data`,data:t.deserialize(e.result.data)})}}var bn=class extends Error{constructor(){super(`Unable to transform response from server`)}};function xn(e,t){let n;try{n=yn(e,t)}catch{throw new bn}if(!n.ok&&(!qt(n.error.error)||typeof n.error.error.code!=`number`)||n.ok&&!qt(n.result))throw new bn;return n}sn(_n(),1);var Sn=Ft(zt(),1),Cn=Ft(Bt(),1);function wn(e){return e instanceof Dn}function Tn(e){return qt(e)&&qt(e.error)&&typeof e.error.code==`number`&&typeof e.error.message==`string`}function En(e,t){return typeof e==`string`?e:qt(e)&&typeof e.message==`string`?e.message:t}var Dn=class e extends Error{constructor(t,n){var r,i;let a=n?.cause;super(t,{cause:a}),(0,Sn.default)(this,`cause`,void 0),(0,Sn.default)(this,`shape`,void 0),(0,Sn.default)(this,`data`,void 0),(0,Sn.default)(this,`meta`,void 0),this.meta=n?.meta,this.cause=a,this.shape=n==null||(r=n.result)==null?void 0:r.error,this.data=n==null||(i=n.result)==null?void 0:i.error.data,this.name=`TRPCClientError`,Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){let r=t;return wn(r)?(n.meta&&(r.meta=(0,Cn.default)((0,Cn.default)({},r.meta),n.meta)),r):Tn(r)?new e(r.error.message,(0,Cn.default)((0,Cn.default)({},n),{},{result:r,cause:n.cause})):new e(En(r,`Unknown error`),(0,Cn.default)((0,Cn.default)({},n),{},{cause:r}))}};function On(e){let t=e;return t?`input`in t?t:{input:t,output:t}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}var kn=e=>typeof e==`function`;function An(e){if(e)return e;if(typeof window<`u`&&kn(window.fetch))return window.fetch;if(typeof globalThis<`u`&&kn(globalThis.fetch))return globalThis.fetch;throw Error(`No fetch implementation found`)}var jn=Ft(Bt());function Mn(e){return{url:e.url.toString(),fetch:e.fetch,transformer:On(e.transformer),methodOverride:e.methodOverride}}function Nn(e){let t={};for(let n=0;n<e.length;n++)t[n]=e[n];return t}var Pn={query:`GET`,mutation:`POST`,subscription:`PATCH`};function Fn(e){return`input`in e?e.transformer.input.serialize(e.input):Nn(e.inputs.map(t=>e.transformer.input.serialize(t)))}var In=e=>{let t=e.url.split(`?`),n=t[0].replace(/\/$/,``)+`/`+e.path,r=[];if(t[1]&&r.push(t[1]),`inputs`in e&&r.push(`batch=1`),e.type===`query`||e.type===`subscription`){let t=Fn(e);t!==void 0&&e.methodOverride!==`POST`&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(n+=`?`+r.join(`&`)),n},Ln=e=>{if(e.type===`query`&&e.methodOverride!==`POST`)return;let t=Fn(e);return t===void 0?void 0:JSON.stringify(t)},Rn=e=>Hn((0,jn.default)((0,jn.default)({},e),{},{contentTypeHeader:`application/json`,getUrl:In,getBody:Ln})),zn=class extends Error{constructor(){let e=`AbortError`;super(e),this.name=e,this.message=e}},Bn=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<`u`?new DOMException(`AbortError`,`AbortError`):new zn};async function Vn(e){Bn(e.signal);let t=e.getUrl(e),n=e.getBody(e),r=e.methodOverride??Pn[e.type],i=await(async()=>{let t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),a=(0,jn.default)((0,jn.default)((0,jn.default)({},e.contentTypeHeader&&r!==`GET`?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[e.trpcAcceptHeaderKey??`trpc-accept`]:e.trpcAcceptHeader}:void 0),i);return An(e.fetch)(t,{method:r,signal:e.signal,body:n,headers:a})}async function Hn(e){let t={},n=await Vn(e);t.response=n;let r=await n.json();return t.responseJSON=r,{json:r,meta:t}}Ft(Bt(),1);var Un=()=>{throw Error(`Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new`)};function Wn(e){let t=null,n=null,r=()=>{clearTimeout(n),n=null,t=null};function i(t){let n=[[]],r=0;for(;;){let o=t[r];if(!o)break;let s=n[n.length-1];if(o.aborted){var i;(i=o.reject)==null||i.call(o,Error(`Aborted`)),r++;continue}if(e.validate(s.concat(o).map(e=>e.key))){s.push(o),r++;continue}if(s.length===0){var a;(a=o.reject)==null||a.call(o,Error(`Input is too big for a single dispatch`)),r++;continue}n.push([])}return n}function a(){let n=i(t);r();for(let t of n){if(!t.length)continue;let n={items:t};for(let e of t)e.batch=n;e.fetch(n.items.map(e=>e.key)).then(async e=>{await Promise.all(e.map(async(e,t)=>{let r=n.items[t];try{var i;let t=await Promise.resolve(e);(i=r.resolve)==null||i.call(r,t)}catch(e){var a;(a=r.reject)==null||a.call(r,e)}r.batch=null,r.reject=null,r.resolve=null}));for(let e of n.items){var t;(t=e.reject)==null||t.call(e,Error(`Missing result`)),e.batch=null}}).catch(e=>{for(let r of n.items){var t;(t=r.reject)==null||t.call(r,e),r.batch=null}})}}function o(e){let r={aborted:!1,key:e,batch:null,resolve:Un,reject:Un},i=new Promise((e,n)=>{r.reject=n,r.resolve=e,t??=[],t.push(r)});return n??=setTimeout(a),i}return{load:o}}function Gn(...e){let t=new AbortController,n=e.length,r=0,i=()=>{++r===n&&t.abort()};for(let t of e)t?.aborted?i():t?.addEventListener(`abort`,i,{once:!0});return t.signal}var Kn=Ft(Bt(),1);function qn(e){let t=Mn(e),n=e.maxURLLength??1/0,r=e.maxItems??1/0;return()=>{let i=i=>({validate(e){if(n===1/0&&r===1/0)return!0;if(e.length>r)return!1;let a=e.map(e=>e.path).join(`,`),o=e.map(e=>e.input);return In((0,Kn.default)((0,Kn.default)({},t),{},{type:i,path:a,inputs:o,signal:null})).length<=n},async fetch(n){let r=n.map(e=>e.path).join(`,`),a=n.map(e=>e.input),o=Gn(...n.map(e=>e.signal)),s=await Rn((0,Kn.default)((0,Kn.default)({},t),{},{path:r,inputs:a,type:i,headers(){return e.headers?typeof e.headers==`function`?e.headers({opList:n}):e.headers:{}},signal:o}));return(Array.isArray(s.json)?s.json:n.map(()=>s.json)).map(e=>({meta:s.meta,json:e}))}}),a={query:Wn(i(`query`)),mutation:Wn(i(`mutation`))};return({op:e})=>Vt(n=>{if(e.type===`subscription`)throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let r=a[e.type].load(e),i;return r.then(e=>{i=e;let r=xn(e.json,t.transformer.output);if(!r.ok){n.error(Dn.from(r.error,{meta:e.meta}));return}n.next({context:e.meta,result:r.result}),n.complete()}).catch(e=>{n.error(Dn.from(e,{meta:i?.meta}))}),()=>{}})}}Ft(Bt(),1);var Jn=(e,...t)=>typeof e==`function`?e(...t):e;Ft(zt(),1);function Yn(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Xn(e){let t=await Jn(e.url);return e.connectionParams?t+`${t.includes(`?`)?`&`:`?`}connectionParams=1`:t}async function Zn(e,t){let n={method:`connectionParams`,data:await Jn(e)};return t.encode(n)}Ft(zt(),1);var Qn=Ft(zt(),1);function $n(e){let{promise:t,resolve:n,reject:r}=Yn();return e.addEventListener(`open`,()=>{e.removeEventListener(`error`,r),n()}),e.addEventListener(`error`,r),t}function er(e,{intervalMs:t,pongTimeoutMs:n}){let r,i;function a(){r=setTimeout(()=>{e.send(`PING`),i=setTimeout(()=>{e.close()},n)},t)}function o(){clearTimeout(r),a()}function s(){clearTimeout(i),o()}e.addEventListener(`open`,a),e.addEventListener(`message`,({data:e})=>{clearTimeout(r),a(),e===`PONG`&&s()}),e.addEventListener(`close`,()=>{clearTimeout(r),clearTimeout(i)})}var tr=class e{constructor(t){if((0,Qn.default)(this,`id`,++e.connectCount),(0,Qn.default)(this,`WebSocketPonyfill`,void 0),(0,Qn.default)(this,`urlOptions`,void 0),(0,Qn.default)(this,`keepAliveOpts`,void 0),(0,Qn.default)(this,`encoder`,void 0),(0,Qn.default)(this,`wsObservable`,Gt(null)),(0,Qn.default)(this,`openPromise`,null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw 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(e){this.wsObservable.next(e)}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=++e.connectCount,t.openPromise=Xn(t.urlOptions).then(e=>new t.WebSocketPonyfill(e)).then(async e=>{t.ws=e,e.binaryType=`arraybuffer`,e.addEventListener(`message`,function({data:e}){e===`PING`&&this.send(`PONG`)}),t.keepAliveOpts.enabled&&er(e,t.keepAliveOpts),e.addEventListener(`close`,()=>{t.ws===e&&(t.ws=null)}),await $n(e),t.urlOptions.connectionParams&&e.send(await Zn(t.urlOptions.connectionParams,t.encoder))});try{await t.openPromise}finally{t.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var t;(t=e.ws)==null||t.close()}}};(0,Qn.default)(tr,`connectCount`,0),Ft(zt(),1),Ft(Bt(),1);var nr=Ft(zt(),1),rr=Ft(Bt(),1),ir=class{constructor(e){(0,nr.default)(this,`links`,void 0),(0,nr.default)(this,`runtime`,void 0),(0,nr.default)(this,`requestId`,void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){return Kt({links:this.links,op:(0,rr.default)((0,rr.default)({},e),{},{context:e.context??{},id:++this.requestId})}).pipe(Wt())}async requestAsPromise(e){var t=this;try{return(await Ut(t.$request(e))).result.data}catch(e){throw Dn.from(e)}}query(e,t,n){return this.requestAsPromise({type:`query`,path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:`mutation`,path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:`subscription`,path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case`state`:var t;(t=n.onConnectionStateChange)==null||t.call(n,e.result);break;case`started`:var r;(r=n.onStarted)==null||r.call(n,{context:e.context});break;case`stopped`:var i;(i=n.onStopped)==null||i.call(n);break;case`data`:case void 0:var a;(a=n.onData)==null||a.call(n,e.result.data);break}},error(e){var t;(t=n.onError)==null||t.call(n,e)},complete(){var e;(e=n.onComplete)==null||e.call(n)}})}},ar=Symbol.for(`trpc_untypedClient`),or={query:`query`,mutate:`mutation`,subscribe:`subscription`},sr=e=>or[e];function cr(e){let t=dn(({path:t,args:n})=>{let r=[...t],i=sr(r.pop()),a=r.join(`.`);return e[i](a,...n)});return fn(n=>n===ar?e:t[n])}function lr(e){return cr(new ir(e))}function ur(e){return e[ar]}Ft(Bt(),1),Ft(Bt(),1),Ft(Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){var t,n,i,a=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,i=Symbol.iterator);a--;){if(n&&(t=e[n])!=null)return t.call(e);if(i&&(t=e[i])!=null)return new r(t.call(e));n=`@@asyncIterator`,i=`@@iterator`}throw TypeError(`Object is not async iterable`)}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new r(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),Ft(Bt(),1);var dr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function n(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),fr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function n(e,t){this.v=e,this.k=t}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),pr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=fr();function r(e){return new n(e,0)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),mr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=fr();function r(e){return function(){return new i(e.apply(this,arguments))}}function i(e){var t,r;function i(t,r){try{var o=e[t](r),s=o.value,c=s instanceof n;Promise.resolve(c?s.v:s).then(function(n){if(c){var r=t===`return`?`return`:`next`;if(!s.k||n.done)return i(r,n);n=e[r](n).value}a(o.done?`return`:`normal`,n)},function(e){i(`throw`,e)})}catch(e){a(`throw`,e)}}function a(e,n){switch(e){case`return`:t.resolve({value:n,done:!0});break;case`throw`:t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?i(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise(function(a,o){var s={key:e,arg:n,resolve:a,reject:o,next:null};r?r=r.next=s:(t=r=s,i(e,n))})},typeof e.return!=`function`&&(this.return=void 0)}i.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},i.prototype.next=function(e){return this._invoke(`next`,e)},i.prototype.throw=function(e){return this._invoke(`throw`,e)},i.prototype.return=function(e){return this._invoke(`return`,e)},t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}});Ft(dr(),1),Ft(pr(),1),Ft(mr(),1),Ft(Bt(),1);var hr=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,re());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,ee=-1,C=5,w=-1;function te(){return g?!0:!(e.unstable_now()-w<C)}function ne(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&te());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():S=!1}}}var re;if(typeof y==`function`)re=function(){y(ne)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=ne,re=function(){ae.postMessage(null)}}else re=function(){_(ne,0)};function oe(t,n){ee=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):C=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ee),ee=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,re()))),r},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),gr=o(((e,t)=>{t.exports=hr()})),_r=o((e=>{var t=Xe();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),vr=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=_r()})),yr=o((e=>{var t=gr(),n=Xe(),r=vr();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),ee=Symbol.for(`react.suspense_list`),C=Symbol.for(`react.memo`),w=Symbol.for(`react.lazy`),te=Symbol.for(`react.activity`),ne=Symbol.for(`react.memo_cache_sentinel`),re=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=re&&e[re]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function oe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case ee:return`SuspenseList`;case te:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case C:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case w:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,T=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function de(e){return{current:e}}function fe(e){0>ue||(e.current=le[ue],le[ue]=null,ue--)}function D(e,t){ue++,le[ue]=e.current,e.current=t}var pe=de(null),me=de(null),he=de(null),O=de(null);function ge(e,t){switch(D(he,t),D(me,e),D(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jd(t),e=Yd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}fe(pe),D(pe,e)}function _e(){fe(pe),fe(me),fe(he)}function ve(e){e.memoizedState!==null&&D(O,e);var t=pe.current,n=Yd(t,e.type);t!==n&&(D(me,e),D(pe,n))}function ye(e){me.current===e&&(fe(pe),fe(me)),O.current===e&&(fe(O),ip._currentValue=ce)}var be,xe;function Se(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=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(){}},u=new class extends l{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},d={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},f=new class{#e=d;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function p(e){setTimeout(e,0)}var m=typeof window>`u`||`Deno`in globalThis;function h(){}function g(e,t){return typeof e==`function`?e(t):e}function _(e){return typeof e==`number`&&e>=0&&e!==1/0}function v(e,t){return Math.max(e+(t||0)-Date.now(),0)}function y(e,t){return typeof e==`function`?e(t):e}function b(e,t){return typeof e==`function`?e(t):e}function x(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ee(o,t.options))return!1}else if(!te(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function S(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(C(t.options.mutationKey)!==C(a))return!1}else if(!te(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ee(e,t){return(t?.queryKeyHashFn||C)(e)}function C(e){return JSON.stringify(e,(e,t)=>ae(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function te(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>te(e[n],t[n])):!1}var ne=Object.prototype.hasOwnProperty;function w(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ie(e)&&ie(t);if(!r&&!(ae(e)&&ae(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ne.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=w(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function re(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ie(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ae(e){if(!oe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!oe(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function oe(e){return Object.prototype.toString.call(e)===`[object Object]`}function se(e){return new Promise(t=>{f.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:w(e,t)}function E(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ce(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var le=Symbol();function ue(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===le?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function de(e,t){return typeof e==`function`?e(...t):!!e}function fe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var D=(()=>{let e=()=>m;return{isServer(){return e()},setIsServer(t){e=t}}})();function pe(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var me=p;function he(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=me,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var O=he(),ge=new class extends l{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)!==`online`||ge.isOnline()}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=pe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ye(t);p(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>u.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),d=()=>ve(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(D.isServer()?0:3),o=e.retryDelay??_e,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),se(s).then(()=>l()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:d,start:()=>(d()?h():m().then(h),i)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_(this.gcTime)&&(this.#e=f.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(D.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(f.clearTimeout(this.#e),this.#e=void 0)}};function Se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{fe(e,()=>t.signal,()=>n=!0)},u=ue(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ce:E;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Te(e,t){return t?Ce(e,t)!=null:!1}function Ee(e,t){return!t||!e.getPreviousPageParam?!1:we(e,t)!=null}var De=class extends xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ae(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ae(this.options);e.data!==void 0&&(this.setState(ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(h).catch(h):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>b(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===le||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>y(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!v(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ue(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Oe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ke(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),O.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Oe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ae(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var je=class extends l{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=pe(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ne(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof b(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!re(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Fe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||b(this.options.enabled,this.#t)!==b(t.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||b(this.options.enabled,this.#t)!==b(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Le(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(h)),t}#g(){this.#b();let e=y(this.options.staleTime,this.#t);if(D.isServer()||this.#r.isStale||!_(e))return;let t=v(this.#r.dataUpdatedAt,e)+1;this.#d=f.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(D.isServer()||b(this.options.enabled,this.#t)===!1||!_(this.#p)||this.#p===0)&&(this.#f=f.setInterval(()=>{(this.options.refetchIntervalInBackground||u.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(f.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(f.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ne(e,t),o=i&&Fe(e,n,t,r);(a||o)&&(l={...l,...Oe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=T(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&x,isStale:Ie(e,t),refetch:this.refetch,promise:this.#o,isEnabled:b(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=pe();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!re(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){O.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Me(e,t){return b(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&b(t.retryOnMount,e)===!1)}function Ne(e,t){return Me(e,t)||e.state.data!==void 0&&Pe(e,t,t.refetchOnMount)}function Pe(e,t,n){if(b(t.enabled,e)!==!1&&y(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ie(e,t)}return!1}function Fe(e,t,n,r){return(e!==t||b(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ie(e,n)}function Ie(e,t){return b(t.enabled,e)!==!1&&e.isStaleByTime(y(t.staleTime,e))}function Le(e,t){return!re(e.getCurrentResult(),t)}var Re=class extends je{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Te(t,n.data),hasPreviousPage:Ee(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ze=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Be(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),O.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Be(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ve=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ze({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=He(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=He(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=He(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=He(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){O.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>S(t,e))}findAll(e={}){return this.getAll().filter(t=>S(e,t))}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return O.batch(()=>Promise.all(e.map(e=>e.continue().catch(h))))}};function He(e){return e.options.scope?.id}var Ue=class extends l{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),re(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&C(t.mutationKey)!==C(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Be();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){O.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function We(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Ge(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ke=class extends l{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,O.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!re(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(We(e,n).forEach(e=>{e.destroy()}),We(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=w(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new je(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Ge(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&O.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},qe=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new De({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){O.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>x(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>x(e,t)):t}notify(e){O.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){O.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Je=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new qe,this.#t=e.mutationCache||new Ve,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=u.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(y(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return O.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;O.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return O.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=O.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(h).catch(h)}invalidateQueries(e,t={}){return O.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=O.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(h)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(h)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(y(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(h).catch(h)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(h).catch(h)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(C(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(C(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ee(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===le&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ye=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function ee(){}var C={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function ne(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function w(e,t){return ne(e.type,t,e.props)}function re(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ie(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ae=/\/+/g;function oe(e,t){return typeof e==`object`&&e&&e.key!=null?ie(``+e.key):t.toString(36)}function se(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ee,ee):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function T(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,T(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+oe(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ae,`$&/`)+`/`),T(o,r,i,``,function(e){return e})):o!=null&&(re(o)&&(o=w(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ae,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+oe(a,u),c+=T(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+oe(a,u++),c+=T(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return T(se(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function E(e,t,n){if(e==null)return e;var r=[],i=0;return T(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ce(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var le=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ue={map:E,forEach:function(e,t,n){E(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return E(e,function(){t++}),t},toArray:function(e){return E(e,function(e){return e})||[]},only:function(e){if(!re(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ue,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!te.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return ne(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)te.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return ne(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=re,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ce}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=C.T,n={};C.T=n;try{var r=e(),i=C.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(ee,le)}catch(e){le(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),C.T=t}},e.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},e.use=function(e){return C.H.use(e)},e.useActionState=function(e,t,n){return C.H.useActionState(e,t,n)},e.useCallback=function(e,t){return C.H.useCallback(e,t)},e.useContext=function(e){return C.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return C.H.useEffect(e,t)},e.useEffectEvent=function(e){return C.H.useEffectEvent(e)},e.useId=function(){return C.H.useId()},e.useImperativeHandle=function(e,t,n){return C.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return C.H.useMemo(e,t)},e.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return C.H.useReducer(e,t,n)},e.useRef=function(e){return C.H.useRef(e)},e.useState=function(e){return C.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return C.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return C.H.useTransition()},e.version=`19.2.7`})),Xe=o(((e,t)=>{t.exports=Ye()})),Ze=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Qe=o(((e,t)=>{t.exports=Ze()})),k=c(Xe(),1),A=Qe(),$e=k.createContext(void 0),et=e=>{let t=k.useContext($e);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},tt=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,A.jsx)($e.Provider,{value:e,children:t})),nt=k.createContext(!1),rt=()=>k.useContext(nt);nt.Provider;function it(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var at=k.createContext(it()),ot=()=>k.useContext(at),st=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?de(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ct=e=>{k.useEffect(()=>{e.clearReset()},[e])},lt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||de(n,[e.error,r])),ut=(e,t)=>t.state.data===void 0,dt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ft=(e,t)=>e.isLoading&&e.isFetching&&!t,pt=(e,t)=>e?.suspense&&t.isPending,mt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ht({queries:e,...t},n){let r=et(n),i=rt(),a=ot(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{dt(e);let t=r.getQueryCache().get(e.queryHash);st(e,a,t)}),ct(a);let[s]=k.useState(()=>new Ke(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>d?s.subscribe(O.batchCalls(e)):h,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>pt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&pt(n,e)?mt(n,new je(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&lt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function gt(e,t,n){let r=rt(),i=ot(),a=et(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,dt(o),st(o,i,s),ct(i);let l=!a.getQueryCache().get(o.queryHash),[u]=k.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(k.useSyncExternalStore(k.useCallback(e=>{let t=f?u.subscribe(O.batchCalls(e)):h;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),k.useEffect(()=>{u.setOptions(o)},[o,u]),pt(o,d))throw mt(o,u,i);if(lt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!D.isServer()&&ft(d,r)&&(l?mt(o,u,i):s?.promise)?.catch(h).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function _t(e,t){return gt(e,je,t)}function vt(e,t){return gt({...e,enabled:!0,suspense:!0,throwOnError:ut,placeholderData:void 0},je,t)}function yt(e,t){return gt({...e,enabled:!0,suspense:!0,throwOnError:ut},Re,t)}function bt(e,t){return ht({...e,queries:e.queries.map(e=>({...e,suspense:!0,throwOnError:ut,enabled:!0,placeholderData:void 0}))},t)}function xt(e,t){let n=et(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function St(e,t){let n=et(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function Ct(e){return e}function wt(e){return e}function Tt(e,t){let n=et(t),[r]=k.useState(()=>new Ue(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);let i=k.useSyncExternalStore(k.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=k.useCallback((e,t)=>{r.mutate(e,t).catch(h)},[r]);if(i.error&&de(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Et(e,t){return gt(e,Re,t)}var Dt=Object.create,Ot=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,At=Object.getOwnPropertyNames,jt=Object.getPrototypeOf,Mt=Object.prototype.hasOwnProperty,Nt=(e,t)=>function(){return t||(0,e[At(e)[0]])((t={exports:{}}).exports,t),t.exports},Pt=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=At(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Mt.call(e,s)&&s!==n&&Ot(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=kt(t,s))||r.enumerable});return e},Ft=(e,t,n)=>(n=e==null?{}:Dt(jt(e)),Pt(t||!e||!e.__esModule?Ot(n,`default`,{value:e,enumerable:!0}):n,e)),It=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Lt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=It().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Rt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=It().default,r=Lt();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),zt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Rt();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Bt=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=zt();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});function Vt(e){let t={subscribe(t){let n=null,r=!1,i=!1,a=!1;function o(){if(n===null){a=!0;return}i||(i=!0,typeof n==`function`?n():n&&n.unsubscribe())}return n=e({next(e){var n;r||(n=t.next)==null||n.call(t,e)},error(e){var n;r||(r=!0,(n=t.error)==null||n.call(t,e),o())},complete(){var e;r||(r=!0,(e=t.complete)==null||e.call(t),o())}}),a&&o(),{unsubscribe:o}},pipe(...e){return e.reduce(Ht,t)}};return t}function Ht(e,t){return t(e)}function Ut(e){let t=new AbortController;return new Promise((n,r)=>{let i=!1;function a(){i||(i=!0,o.unsubscribe())}t.signal.addEventListener(`abort`,()=>{r(t.signal.reason)});let o=e.subscribe({next(e){i=!0,n(e),a()},error(e){r(e)},complete(){t.abort(),a()}})})}function Wt(e){return e=>{let t=0,n=null,r=[];function i(){n||=e.subscribe({next(e){for(let n of r){var t;(t=n.next)==null||t.call(n,e)}},error(e){for(let n of r){var t;(t=n.error)==null||t.call(n,e)}},complete(){for(let t of r){var e;(e=t.complete)==null||e.call(t)}}})}function a(){if(t===0&&n){let e=n;n=null,e.unsubscribe()}}return Vt(e=>(t++,r.push(e),i(),{unsubscribe(){t--,a();let n=r.findIndex(t=>t===e);n>-1&&r.splice(n,1)}}))}}function Gt(e){let t=e,n=[],r=e=>{t!==void 0&&e.next(t),n.push(e)},i=e=>{n.splice(n.indexOf(e),1)},a=Vt(e=>(r(e),()=>{i(e)}));return a.next=e=>{if(t!==e){t=e;for(let t of n)t.next(e)}},a.get=()=>t,a}function Kt(e){return Vt(t=>{function n(t=0,r=e.op){let i=e.links[t];if(!i)throw Error(`No more links to execute - did you forget to add an ending link?`);return i({op:r,next(e){return n(t+1,e)}})}return n().subscribe(t)})}function qt(e){return!!e&&!Array.isArray(e)&&typeof e==`object`}function Jt(){return Object.create(null)}var Yt=typeof Symbol==`function`&&!!Symbol.asyncIterator;function Xt(e){return Yt&&qt(e)&&Symbol.asyncIterator in e}var Zt={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};Zt.BAD_GATEWAY,Zt.SERVICE_UNAVAILABLE,Zt.GATEWAY_TIMEOUT,Zt.INTERNAL_SERVER_ERROR;var Qt=Object.create,$t=Object.defineProperty,en=Object.getOwnPropertyDescriptor,tn=Object.getOwnPropertyNames,nn=Object.getPrototypeOf,rn=Object.prototype.hasOwnProperty,an=(e,t)=>function(){return t||(0,e[tn(e)[0]])((t={exports:{}}).exports,t),t.exports},on=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=tn(t),a=0,o=i.length,s;a<o;a++)s=i[a],!rn.call(e,s)&&s!==n&&$t(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=en(t,s))||r.enumerable});return e},sn=(e,t,n)=>(n=e==null?{}:Qt(nn(e)),on(t||!e||!e.__esModule?$t(n,`default`,{value:e,enumerable:!0}):n,e)),cn=()=>{},ln=e=>{Object.freeze&&Object.freeze(e)};function un(e,t,n){let r=t.join(`.`);return n[r]??(n[r]=new Proxy(cn,{get(r,i){if(!(typeof i!=`string`||i===`then`))return un(e,[...t,i],n)},apply(n,r,i){let a=t[t.length-1];if(a===`valueOf`||a===`toString`||a===`toJSON`)return`tRPC.proxy(${t.slice(0,-1).join(`.`)})`;let o={args:i,path:t};return a===`call`?o={args:i.length>=2?[i[1]]:[],path:t.slice(0,-1)}:a===`apply`&&(o={args:i.length>=2?i[1]:[],path:t.slice(0,-1)}),ln(o.args),ln(o.path),e(o)}})),n[r]}var dn=e=>un(e,[],Jt()),fn=e=>new Proxy(cn,{get(t,n){if(n!==`then`)return e(n)}}),pn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),mn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=pn().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),hn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=pn().default,r=mn();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),gn=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=hn();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),_n=an({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=gn();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});sn(_n(),1),sn(gn(),1);var vn=sn(_n(),1);function yn(e,t){if(`error`in e){let n=t.deserialize(e.error);return{ok:!1,error:(0,vn.default)((0,vn.default)({},e),{},{error:n})}}return{ok:!0,result:(0,vn.default)((0,vn.default)({},e.result),(!e.result.type||e.result.type===`data`)&&{type:`data`,data:t.deserialize(e.result.data)})}}var bn=class extends Error{constructor(){super(`Unable to transform response from server`)}};function xn(e,t){let n;try{n=yn(e,t)}catch{throw new bn}if(!n.ok&&(!qt(n.error.error)||typeof n.error.error.code!=`number`)||n.ok&&!qt(n.result))throw new bn;return n}sn(_n(),1);var Sn=Ft(zt(),1),Cn=Ft(Bt(),1);function wn(e){return e instanceof Dn}function Tn(e){return qt(e)&&qt(e.error)&&typeof e.error.code==`number`&&typeof e.error.message==`string`}function En(e,t){return typeof e==`string`?e:qt(e)&&typeof e.message==`string`?e.message:t}var Dn=class e extends Error{constructor(t,n){var r,i;let a=n?.cause;super(t,{cause:a}),(0,Sn.default)(this,`cause`,void 0),(0,Sn.default)(this,`shape`,void 0),(0,Sn.default)(this,`data`,void 0),(0,Sn.default)(this,`meta`,void 0),this.meta=n?.meta,this.cause=a,this.shape=n==null||(r=n.result)==null?void 0:r.error,this.data=n==null||(i=n.result)==null?void 0:i.error.data,this.name=`TRPCClientError`,Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){let r=t;return wn(r)?(n.meta&&(r.meta=(0,Cn.default)((0,Cn.default)({},r.meta),n.meta)),r):Tn(r)?new e(r.error.message,(0,Cn.default)((0,Cn.default)({},n),{},{result:r,cause:n.cause})):new e(En(r,`Unknown error`),(0,Cn.default)((0,Cn.default)({},n),{},{cause:r}))}};function On(e){let t=e;return t?`input`in t?t:{input:t,output:t}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}var kn=e=>typeof e==`function`;function An(e){if(e)return e;if(typeof window<`u`&&kn(window.fetch))return window.fetch;if(typeof globalThis<`u`&&kn(globalThis.fetch))return globalThis.fetch;throw Error(`No fetch implementation found`)}var jn=Ft(Bt());function Mn(e){return{url:e.url.toString(),fetch:e.fetch,transformer:On(e.transformer),methodOverride:e.methodOverride}}function Nn(e){let t={};for(let n=0;n<e.length;n++)t[n]=e[n];return t}var Pn={query:`GET`,mutation:`POST`,subscription:`PATCH`};function Fn(e){return`input`in e?e.transformer.input.serialize(e.input):Nn(e.inputs.map(t=>e.transformer.input.serialize(t)))}var In=e=>{let t=e.url.split(`?`),n=t[0].replace(/\/$/,``)+`/`+e.path,r=[];if(t[1]&&r.push(t[1]),`inputs`in e&&r.push(`batch=1`),e.type===`query`||e.type===`subscription`){let t=Fn(e);t!==void 0&&e.methodOverride!==`POST`&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(n+=`?`+r.join(`&`)),n},Ln=e=>{if(e.type===`query`&&e.methodOverride!==`POST`)return;let t=Fn(e);return t===void 0?void 0:JSON.stringify(t)},Rn=e=>Hn((0,jn.default)((0,jn.default)({},e),{},{contentTypeHeader:`application/json`,getUrl:In,getBody:Ln})),zn=class extends Error{constructor(){let e=`AbortError`;super(e),this.name=e,this.message=e}},Bn=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<`u`?new DOMException(`AbortError`,`AbortError`):new zn};async function Vn(e){Bn(e.signal);let t=e.getUrl(e),n=e.getBody(e),r=e.methodOverride??Pn[e.type],i=await(async()=>{let t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),a=(0,jn.default)((0,jn.default)((0,jn.default)({},e.contentTypeHeader&&r!==`GET`?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[e.trpcAcceptHeaderKey??`trpc-accept`]:e.trpcAcceptHeader}:void 0),i);return An(e.fetch)(t,{method:r,signal:e.signal,body:n,headers:a})}async function Hn(e){let t={},n=await Vn(e);t.response=n;let r=await n.json();return t.responseJSON=r,{json:r,meta:t}}Ft(Bt(),1);var Un=()=>{throw Error(`Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new`)};function Wn(e){let t=null,n=null,r=()=>{clearTimeout(n),n=null,t=null};function i(t){let n=[[]],r=0;for(;;){let o=t[r];if(!o)break;let s=n[n.length-1];if(o.aborted){var i;(i=o.reject)==null||i.call(o,Error(`Aborted`)),r++;continue}if(e.validate(s.concat(o).map(e=>e.key))){s.push(o),r++;continue}if(s.length===0){var a;(a=o.reject)==null||a.call(o,Error(`Input is too big for a single dispatch`)),r++;continue}n.push([])}return n}function a(){let n=i(t);r();for(let t of n){if(!t.length)continue;let n={items:t};for(let e of t)e.batch=n;e.fetch(n.items.map(e=>e.key)).then(async e=>{await Promise.all(e.map(async(e,t)=>{let r=n.items[t];try{var i;let t=await Promise.resolve(e);(i=r.resolve)==null||i.call(r,t)}catch(e){var a;(a=r.reject)==null||a.call(r,e)}r.batch=null,r.reject=null,r.resolve=null}));for(let e of n.items){var t;(t=e.reject)==null||t.call(e,Error(`Missing result`)),e.batch=null}}).catch(e=>{for(let r of n.items){var t;(t=r.reject)==null||t.call(r,e),r.batch=null}})}}function o(e){let r={aborted:!1,key:e,batch:null,resolve:Un,reject:Un},i=new Promise((e,n)=>{r.reject=n,r.resolve=e,t??=[],t.push(r)});return n??=setTimeout(a),i}return{load:o}}function Gn(...e){let t=new AbortController,n=e.length,r=0,i=()=>{++r===n&&t.abort()};for(let t of e)t?.aborted?i():t?.addEventListener(`abort`,i,{once:!0});return t.signal}var Kn=Ft(Bt(),1);function qn(e){let t=Mn(e),n=e.maxURLLength??1/0,r=e.maxItems??1/0;return()=>{let i=i=>({validate(e){if(n===1/0&&r===1/0)return!0;if(e.length>r)return!1;let a=e.map(e=>e.path).join(`,`),o=e.map(e=>e.input);return In((0,Kn.default)((0,Kn.default)({},t),{},{type:i,path:a,inputs:o,signal:null})).length<=n},async fetch(n){let r=n.map(e=>e.path).join(`,`),a=n.map(e=>e.input),o=Gn(...n.map(e=>e.signal)),s=await Rn((0,Kn.default)((0,Kn.default)({},t),{},{path:r,inputs:a,type:i,headers(){return e.headers?typeof e.headers==`function`?e.headers({opList:n}):e.headers:{}},signal:o}));return(Array.isArray(s.json)?s.json:n.map(()=>s.json)).map(e=>({meta:s.meta,json:e}))}}),a={query:Wn(i(`query`)),mutation:Wn(i(`mutation`))};return({op:e})=>Vt(n=>{if(e.type===`subscription`)throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let r=a[e.type].load(e),i;return r.then(e=>{i=e;let r=xn(e.json,t.transformer.output);if(!r.ok){n.error(Dn.from(r.error,{meta:e.meta}));return}n.next({context:e.meta,result:r.result}),n.complete()}).catch(e=>{n.error(Dn.from(e,{meta:i?.meta}))}),()=>{}})}}Ft(Bt(),1);var Jn=(e,...t)=>typeof e==`function`?e(...t):e;Ft(zt(),1);function Yn(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Xn(e){let t=await Jn(e.url);return e.connectionParams?t+`${t.includes(`?`)?`&`:`?`}connectionParams=1`:t}async function Zn(e,t){let n={method:`connectionParams`,data:await Jn(e)};return t.encode(n)}Ft(zt(),1);var Qn=Ft(zt(),1);function $n(e){let{promise:t,resolve:n,reject:r}=Yn();return e.addEventListener(`open`,()=>{e.removeEventListener(`error`,r),n()}),e.addEventListener(`error`,r),t}function er(e,{intervalMs:t,pongTimeoutMs:n}){let r,i;function a(){r=setTimeout(()=>{e.send(`PING`),i=setTimeout(()=>{e.close()},n)},t)}function o(){clearTimeout(r),a()}function s(){clearTimeout(i),o()}e.addEventListener(`open`,a),e.addEventListener(`message`,({data:e})=>{clearTimeout(r),a(),e===`PONG`&&s()}),e.addEventListener(`close`,()=>{clearTimeout(r),clearTimeout(i)})}var tr=class e{constructor(t){if((0,Qn.default)(this,`id`,++e.connectCount),(0,Qn.default)(this,`WebSocketPonyfill`,void 0),(0,Qn.default)(this,`urlOptions`,void 0),(0,Qn.default)(this,`keepAliveOpts`,void 0),(0,Qn.default)(this,`encoder`,void 0),(0,Qn.default)(this,`wsObservable`,Gt(null)),(0,Qn.default)(this,`openPromise`,null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw 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(e){this.wsObservable.next(e)}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=++e.connectCount,t.openPromise=Xn(t.urlOptions).then(e=>new t.WebSocketPonyfill(e)).then(async e=>{t.ws=e,e.binaryType=`arraybuffer`,e.addEventListener(`message`,function({data:e}){e===`PING`&&this.send(`PONG`)}),t.keepAliveOpts.enabled&&er(e,t.keepAliveOpts),e.addEventListener(`close`,()=>{t.ws===e&&(t.ws=null)}),await $n(e),t.urlOptions.connectionParams&&e.send(await Zn(t.urlOptions.connectionParams,t.encoder))});try{await t.openPromise}finally{t.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var t;(t=e.ws)==null||t.close()}}};(0,Qn.default)(tr,`connectCount`,0),Ft(zt(),1),Ft(Bt(),1);var nr=Ft(zt(),1),rr=Ft(Bt(),1),ir=class{constructor(e){(0,nr.default)(this,`links`,void 0),(0,nr.default)(this,`runtime`,void 0),(0,nr.default)(this,`requestId`,void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){return Kt({links:this.links,op:(0,rr.default)((0,rr.default)({},e),{},{context:e.context??{},id:++this.requestId})}).pipe(Wt())}async requestAsPromise(e){var t=this;try{return(await Ut(t.$request(e))).result.data}catch(e){throw Dn.from(e)}}query(e,t,n){return this.requestAsPromise({type:`query`,path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:`mutation`,path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:`subscription`,path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case`state`:var t;(t=n.onConnectionStateChange)==null||t.call(n,e.result);break;case`started`:var r;(r=n.onStarted)==null||r.call(n,{context:e.context});break;case`stopped`:var i;(i=n.onStopped)==null||i.call(n);break;case`data`:case void 0:var a;(a=n.onData)==null||a.call(n,e.result.data);break}},error(e){var t;(t=n.onError)==null||t.call(n,e)},complete(){var e;(e=n.onComplete)==null||e.call(n)}})}},ar=Symbol.for(`trpc_untypedClient`),or={query:`query`,mutate:`mutation`,subscribe:`subscription`},sr=e=>or[e];function cr(e){let t=dn(({path:t,args:n})=>{let r=[...t],i=sr(r.pop()),a=r.join(`.`);return e[i](a,...n)});return fn(n=>n===ar?e:t[n])}function lr(e){return cr(new ir(e))}function ur(e){return e[ar]}Ft(Bt(),1),Ft(Bt(),1),Ft(Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){var t,n,i,a=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,i=Symbol.iterator);a--;){if(n&&(t=e[n])!=null)return t.call(e);if(i&&(t=e[i])!=null)return new r(t.call(e));n=`@@asyncIterator`,i=`@@iterator`}throw TypeError(`Object is not async iterable`)}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new r(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),Ft(Bt(),1);var dr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function n(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),fr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function n(e,t){this.v=e,this.k=t}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),pr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=fr();function r(e){return new n(e,0)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),mr=Nt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=fr();function r(e){return function(){return new i(e.apply(this,arguments))}}function i(e){var t,r;function i(t,r){try{var o=e[t](r),s=o.value,c=s instanceof n;Promise.resolve(c?s.v:s).then(function(n){if(c){var r=t===`return`?`return`:`next`;if(!s.k||n.done)return i(r,n);n=e[r](n).value}a(o.done?`return`:`normal`,n)},function(e){i(`throw`,e)})}catch(e){a(`throw`,e)}}function a(e,n){switch(e){case`return`:t.resolve({value:n,done:!0});break;case`throw`:t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?i(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise(function(a,o){var s={key:e,arg:n,resolve:a,reject:o,next:null};r?r=r.next=s:(t=r=s,i(e,n))})},typeof e.return!=`function`&&(this.return=void 0)}i.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},i.prototype.next=function(e){return this._invoke(`next`,e)},i.prototype.throw=function(e){return this._invoke(`throw`,e)},i.prototype.return=function(e){return this._invoke(`return`,e)},t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}});Ft(dr(),1),Ft(pr(),1),Ft(mr(),1),Ft(Bt(),1);var hr=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,re());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,ee=-1,C=5,te=-1;function ne(){return g?!0:!(e.unstable_now()-te<C)}function w(){if(g=!1,S){var t=e.unstable_now();te=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():S=!1}}}var re;if(typeof y==`function`)re=function(){y(w)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=w,re=function(){ae.postMessage(null)}}else re=function(){_(w,0)};function oe(t,n){ee=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):C=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ee),ee=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,re()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),gr=o(((e,t)=>{t.exports=hr()})),_r=o((e=>{var t=Xe();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),vr=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=_r()})),yr=o((e=>{var t=gr(),n=Xe(),r=vr();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),ee=Symbol.for(`react.suspense_list`),C=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),w=Symbol.for(`react.memo_cache_sentinel`),re=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=re&&e[re]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function oe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case ee:return`SuspenseList`;case ne:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case C:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,T=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function de(e){return{current:e}}function fe(e){0>ue||(e.current=le[ue],le[ue]=null,ue--)}function D(e,t){ue++,le[ue]=e.current,e.current=t}var pe=de(null),me=de(null),he=de(null),O=de(null);function ge(e,t){switch(D(he,t),D(me,e),D(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jd(t),e=Yd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}fe(pe),D(pe,e)}function _e(){fe(pe),fe(me),fe(he)}function ve(e){e.memoizedState!==null&&D(O,e);var t=pe.current,n=Yd(t,e.type);t!==n&&(D(me,e),D(pe,n))}function ye(e){me.current===e&&(fe(pe),fe(me)),O.current===e&&(fe(O),ip._currentValue=ce)}var be,xe;function Se(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
2
2
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
3
  `+be+e+xe}var Ce=!1;function we(e,t){if(!e||Ce)return``;Ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
4
  `),l=s.split(`
5
5
  `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
6
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ce=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Se(n):``}function Te(e,t){switch(e.tag){case 26:case 27:case 5:return Se(e.type);case 16:return Se(`Lazy`);case 13:return e.child!==t&&t!==null?Se(`Suspense Fallback`):Se(`Suspense`);case 19:return Se(`SuspenseList`);case 0:case 15:return we(e.type,!1);case 11:return we(e.type.render,!1);case 1:return we(e.type,!0);case 31:return Se(`Activity`);default:return``}}function Ee(e){try{var t=``,n=null;do t+=Te(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
7
  Error generating stack: `+e.message+`
8
- `+e.stack}}var De=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,ke=t.unstable_cancelCallback,Ae=t.unstable_shouldYield,je=t.unstable_requestPaint,Me=t.unstable_now,Ne=t.unstable_getCurrentPriorityLevel,Pe=t.unstable_ImmediatePriority,Fe=t.unstable_UserBlockingPriority,Ie=t.unstable_NormalPriority,Le=t.unstable_LowPriority,Re=t.unstable_IdlePriority,ze=t.log,Be=t.unstable_setDisableYieldValue,Ve=null,He=null;function Ue(e){if(typeof ze==`function`&&Be(e),He&&typeof He.setStrictMode==`function`)try{He.setStrictMode(Ve,e)}catch{}}var We=Math.clz32?Math.clz32:qe,Ge=Math.log,Ke=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(Ge(e)/Ke|0)|0}var Je=256,Ye=262144,Ze=4194304;function Qe(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function k(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Qe(n))):i=Qe(o):i=Qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Qe(n))):i=Qe(o)):i=Qe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function A(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $e(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 et(){var e=Ze;return Ze<<=1,!(Ze&62914560)&&(Ze=4194304),e}function tt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-We(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&it(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function it(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-We(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function at(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-We(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ot(e,t){var n=t&-t;return n=n&42?1:st(n),(n&(e.suspendedLanes|t))===0?n:0}function st(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ct(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function lt(){var e=E.p;return e===0?(e=window.event,e===void 0?32:bp(e.type)):e}function ut(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var dt=Math.random().toString(36).slice(2),ft=`__reactFiber$`+dt,pt=`__reactProps$`+dt,mt=`__reactContainer$`+dt,ht=`__reactEvents$`+dt,gt=`__reactListeners$`+dt,_t=`__reactHandles$`+dt,vt=`__reactResources$`+dt,yt=`__reactMarker$`+dt;function bt(e){delete e[ft],delete e[pt],delete e[ht],delete e[gt],delete e[_t]}function xt(e){var t=e[ft];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mt]||n[ft]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vf(e);e!==null;){if(n=e[ft])return n;e=vf(e)}return t}e=n,n=e.parentNode}return null}function St(e){if(e=e[ft]||e[mt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function wt(e){var t=e[vt];return t||=e[vt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Tt(e){e[yt]=!0}var Et=new Set,Dt={};function Ot(e,t){kt(e,t),kt(e+`Capture`,t)}function kt(e,t){for(Dt[e]=t,e=0;e<t.length;e++)Et.add(t[e])}var At=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]*$`),jt={},Mt={};function Nt(e){return De.call(Mt,e)?!0:De.call(jt,e)?!1:At.test(e)?Mt[e]=!0:(jt[e]=!0,!1)}function Pt(e,t,n){if(Nt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ft(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function It(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Lt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Rt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function zt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Bt(e){if(!e._valueTracker){var t=Rt(e)?`checked`:`value`;e._valueTracker=zt(e,t,``+e[t])}}function Vt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Rt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ht(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ut=/[\n"\\]/g;function Wt(e){return e.replace(Ut,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Gt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Lt(t)):e.value!==``+Lt(t)&&(e.value=``+Lt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):qt(e,o,Lt(n)):qt(e,o,Lt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Lt(s):e.removeAttribute(`name`)}function Kt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Bt(e);return}n=n==null?``:``+Lt(n),t=t==null?n:``+Lt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Bt(e)}function qt(e,t,n){t===`number`&&Ht(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Jt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Lt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Yt(e,t,n){if(t!=null&&(t=``+Lt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Lt(n)}function Xt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(se(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Lt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Bt(e)}function Zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Qt=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 $t(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Qt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function en(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&$t(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&$t(e,o,t[o])}function tn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){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 nn=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`]]),rn=/^[\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 an(e){return rn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function on(){}var sn=null;function cn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ln=null,un=null;function dn(e){var t=St(e);if(t&&(e=t.stateNode)){var n=e[pt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Gt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Wt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[pt]||null;if(!a)throw Error(i(90));Gt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Vt(r)}break a;case`textarea`:Yt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Jt(e,!!n.multiple,t,!1)}}}var fn=!1;function pn(e,t,n){if(fn)return e(t,n);fn=!0;try{return e(t)}finally{if(fn=!1,(ln!==null||un!==null)&&(Du(),ln&&(t=ln,e=un,un=ln=null,dn(t),e)))for(t=0;t<e.length;t++)dn(e[t])}}function mn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[pt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var hn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),gn=!1;if(hn)try{var _n={};Object.defineProperty(_n,"passive",{get:function(){gn=!0}}),window.addEventListener(`test`,_n,_n),window.removeEventListener(`test`,_n,_n)}catch{gn=!1}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Cn(){return!0}function wn(){return!1}function Tn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Cn:wn,this.isPropagationStopped=wn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Cn)},persist:function(){},isPersistent:Cn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=Tn(En),On=f({},En,{view:0,detail:0}),kn=Tn(On),An,jn,Mn,Nn=f({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=Tn(Nn),Fn=Tn(f({},Nn,{dataTransfer:0})),In=Tn(f({},On,{relatedTarget:0})),Ln=Tn(f({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Rn=Tn(f({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),zn=Tn(f({},En,{data:0})),Bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Vn={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`},Hn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Un(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hn[e])?!!t[e]:!1}function Wn(){return Un}var Gn=Tn(f({},On,{key:function(e){if(e.key){var t=Bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Vn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wn,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Kn=Tn(f({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qn=Tn(f({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wn})),Jn=Tn(f({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),Yn=Tn(f({},Nn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Xn=Tn(f({},En,{newState:0,oldState:0})),Zn=[9,13,27,32],Qn=hn&&`CompositionEvent`in window,$n=null;hn&&`documentMode`in document&&($n=document.documentMode);var er=hn&&`TextEvent`in window&&!$n,tr=hn&&(!Qn||$n&&8<$n&&11>=$n),nr=` `,rr=!1;function ir(e,t){switch(e){case`keyup`:return Zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ar(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var or=!1;function sr(e,t){switch(e){case`compositionend`:return ar(t);case`keypress`:return t.which===32?(rr=!0,nr):null;case`textInput`:return e=t.data,e===nr&&rr?null:e;default:return null}}function cr(e,t){if(or)return e===`compositionend`||!Qn&&ir(e,t)?(e=xn(),bn=yn=vn=null,or=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return tr&&t.locale!==`ko`?null:t.data;default:return null}}var lr={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 ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!lr[e.type]:t===`textarea`}function dr(e,t,n,r){ln?un?un.push(r):un=[r]:ln=r,t=Nd(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var fr=null,pr=null;function mr(e){Ed(e,0)}function hr(e){if(Vt(Ct(e)))return e}function _r(e,t){if(e===`change`)return t}var yr=!1;if(hn){var br;if(hn){var xr=`oninput`in document;if(!xr){var Sr=document.createElement(`div`);Sr.setAttribute(`oninput`,`return;`),xr=typeof Sr.oninput==`function`}br=xr}else br=!1;yr=br&&(!document.documentMode||9<document.documentMode)}function Cr(){fr&&(fr.detachEvent(`onpropertychange`,wr),pr=fr=null)}function wr(e){if(e.propertyName===`value`&&hr(pr)){var t=[];dr(t,pr,e,cn(e)),pn(mr,t)}}function Tr(e,t,n){e===`focusin`?(Cr(),fr=t,pr=n,fr.attachEvent(`onpropertychange`,wr)):e===`focusout`&&Cr()}function Er(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return hr(pr)}function Dr(e,t){if(e===`click`)return hr(t)}function Or(e,t){if(e===`input`||e===`change`)return hr(t)}function kr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ar=typeof Object.is==`function`?Object.is:kr;function jr(e,t){if(Ar(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!De.call(t,i)||!Ar(e[i],t[i]))return!1}return!0}function Mr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nr(e,t){var n=Mr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Mr(n)}}function Pr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ht(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ht(e.document)}return t}function Ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Lr=hn&&`documentMode`in document&&11>=document.documentMode,Rr=null,zr=null,Br=null,Vr=!1;function Hr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vr||Rr==null||Rr!==Ht(r)||(r=Rr,`selectionStart`in r&&Ir(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Br&&jr(Br,r)||(Br=r,r=Nd(zr,`onSelect`),0<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Rr)))}function Ur(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Wr={animationend:Ur(`Animation`,`AnimationEnd`),animationiteration:Ur(`Animation`,`AnimationIteration`),animationstart:Ur(`Animation`,`AnimationStart`),transitionrun:Ur(`Transition`,`TransitionRun`),transitionstart:Ur(`Transition`,`TransitionStart`),transitioncancel:Ur(`Transition`,`TransitionCancel`),transitionend:Ur(`Transition`,`TransitionEnd`)},Gr={},Kr={};hn&&(Kr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),`TransitionEvent`in window||delete Wr.transitionend.transition);function qr(e){if(Gr[e])return Gr[e];if(!Wr[e])return e;var t=Wr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Kr)return Gr[e]=t[n];return e}var Jr=qr(`animationend`),Yr=qr(`animationiteration`),Xr=qr(`animationstart`),Zr=qr(`transitionrun`),Qr=qr(`transitionstart`),$r=qr(`transitioncancel`),ei=qr(`transitionend`),ti=new Map,j=`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(` `);j.push(`scrollEnd`);function ni(e,t){ti.set(e,t),Ot(t,[e])}var M=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ri=[],ii=0,ai=0;function oi(){for(var e=ii,t=ai=ii=0;t<e;){var n=ri[t];ri[t++]=null;var r=ri[t];ri[t++]=null;var i=ri[t];ri[t++]=null;var a=ri[t];if(ri[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&li(n,i,a)}}function N(e,t,n,r){ri[ii++]=e,ri[ii++]=t,ri[ii++]=n,ri[ii++]=r,ai|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function si(e,t,n,r){return N(e,t,n,r),ui(e)}function ci(e,t){return N(e,null,null,t),ui(e)}function li(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-We(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ui(e){if(50<vu)throw vu=0,yu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var di={};function fi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pi(e,t,n,r){return new fi(e,t,n,r)}function mi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hi(e,t){var n=e.alternate;return n===null?(n=pi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function gi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function _i(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)mi(e)&&(s=1);else if(typeof e==`string`)s=Xf(e,n,pe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case te:return e=pi(31,n,t,a),e.elementType=te,e.lanes=o,e;case g:return vi(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=pi(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=pi(13,n,t,a),e.elementType=S,e.lanes=o,e;case ee:return e=pi(19,n,t,a),e.elementType=ee,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case C:s=14;break a;case w:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=pi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function vi(e,t,n,r){return e=pi(7,e,r,t),e.lanes=n,e}function yi(e,t,n){return e=pi(6,e,null,t),e.lanes=n,e}function bi(e){var t=pi(18,null,null,0);return t.stateNode=e,t}function xi(e,t,n){return t=pi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Si=new WeakMap;function Ci(e,t){if(typeof e==`object`&&e){var n=Si.get(e);return n===void 0?(t={value:e,source:t,stack:Ee(t)},Si.set(e,t),t):n}return{value:e,source:t,stack:Ee(t)}}var wi=[],Ti=0,Ei=null,Di=0,Oi=[],ki=0,Ai=null,ji=1,Mi=``;function Ni(e,t){wi[Ti++]=Di,wi[Ti++]=Ei,Ei=e,Di=t}function Pi(e,t,n){Oi[ki++]=ji,Oi[ki++]=Mi,Oi[ki++]=Ai,Ai=e;var r=ji;e=Mi;var i=32-We(r)-1;r&=~(1<<i),n+=1;var a=32-We(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ji=1<<32-We(t)+i|n<<i|r,Mi=a+e}else ji=1<<a|n<<i|r,Mi=e}function Fi(e){e.return!==null&&(Ni(e,1),Pi(e,1,0))}function Ii(e){for(;e===Ei;)Ei=wi[--Ti],wi[Ti]=null,Di=wi[--Ti],wi[Ti]=null;for(;e===Ai;)Ai=Oi[--ki],Oi[ki]=null,Mi=Oi[--ki],Oi[ki]=null,ji=Oi[--ki],Oi[ki]=null}function Li(e,t){Oi[ki++]=ji,Oi[ki++]=Mi,Oi[ki++]=Ai,ji=t.id,Mi=t.overflow,Ai=e}var Ri=null,zi=null,P=!1,Bi=null,F=!1,Vi=Error(i(519));function Hi(e){throw Ji(Ci(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Vi}function Ui(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ft]=e,t[pt]=r,n){case`dialog`:G(`cancel`,t),G(`close`,t);break;case`iframe`:case`object`:case`embed`:G(`load`,t);break;case`video`:case`audio`:for(n=0;n<wd.length;n++)G(wd[n],t);break;case`source`:G(`error`,t);break;case`img`:case`image`:case`link`:G(`error`,t),G(`load`,t);break;case`details`:G(`toggle`,t);break;case`input`:G(`invalid`,t),Kt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:G(`invalid`,t);break;case`textarea`:G(`invalid`,t),Xt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||zd(t.textContent,n)?(r.popover!=null&&(G(`beforetoggle`,t),G(`toggle`,t)),r.onScroll!=null&&G(`scroll`,t),r.onScrollEnd!=null&&G(`scrollend`,t),r.onClick!=null&&(t.onclick=on),t=!0):t=!1,t||Hi(e,!0)}function Wi(e){for(Ri=e.return;Ri;)switch(Ri.tag){case 5:case 31:case 13:F=!1;return;case 27:case 3:F=!0;return;default:Ri=Ri.return}}function Gi(e){if(e!==Ri)return!1;if(!P)return Wi(e),P=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Xd(e.type,e.memoizedProps)),n=!n),n&&zi&&Hi(e),Wi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));zi=_f(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));zi=_f(e)}else t===27?(t=zi,af(e.type)?(e=gf,gf=null,zi=e):zi=t):zi=Ri?hf(e.stateNode.nextSibling):null;return!0}function Ki(){zi=Ri=null,P=!1}function qi(){var e=Bi;return e!==null&&(ou===null?ou=e:ou.push.apply(ou,e),Bi=null),e}function Ji(e){Bi===null?Bi=[e]:Bi.push(e)}var Yi=de(null),I=null,Xi=null;function Zi(e,t,n){D(Yi,t._currentValue),t._currentValue=n}function Qi(e){e._currentValue=Yi.current,fe(Yi)}function $i(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ea(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),$i(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),$i(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ta(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Ar(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===O.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ip]:e.push(ip))}a=a.return}e!==null&&ea(t,e,n,r),t.flags|=262144}function na(e){for(e=e.firstContext;e!==null;){if(!Ar(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ra(e){I=e,Xi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ia(e){return oa(I,e)}function aa(e,t){return I===null&&ra(e),oa(e,t)}function oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Xi===null){if(e===null)throw Error(i(308));Xi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xi=Xi.next=t;return n}var sa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ca=t.unstable_scheduleCallback,la=t.unstable_NormalPriority,ua={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function da(){return{controller:new sa,data:new Map,refCount:0}}function fa(e){e.refCount--,e.refCount===0&&ca(la,function(){e.controller.abort()})}var pa=null,ma=0,ha=0,ga=null;function _a(e,t){if(pa===null){var n=pa=[];ma=0,ha=vd(),ga={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ma++,t.then(va,va),t}function va(){if(--ma===0&&pa!==null){ga!==null&&(ga.status=`fulfilled`);var e=pa;pa=null,ha=0,ga=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ya(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var L=T.S;T.S=function(e,t){lu=Me(),typeof t==`object`&&t&&typeof t.then==`function`&&_a(e,t),L!==null&&L(e,t)};var ba=de(null);function xa(){var e=ba.current;return e===null?Kl.pooledCache:e}function Sa(e,t){t===null?D(ba,ba.current):D(ba,t.pool)}function Ca(){var e=xa();return e===null?null:{parent:ua._currentValue,pool:e}}var wa=Error(i(460)),Ta=Error(i(474)),Ea=Error(i(542)),Da={then:function(){}};function Oa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ka(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(on,on),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Na(e),e;default:if(typeof t.status==`string`)t.then(on,on);else{if(e=Kl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Na(e),e}throw ja=t,wa}}function Aa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ja=e,wa):e}}var ja=null;function Ma(){if(ja===null)throw Error(i(459));var e=ja;return ja=null,e}function Na(e){if(e===wa||e===Ea)throw Error(i(483))}var Pa=null,Fa=0;function Ia(e){var t=Fa;return Fa+=1,Pa===null&&(Pa=[]),ka(Pa,e,t)}function La(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ra(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function za(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=hi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=yi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===w&&Aa(i)===t.type)?(t=a(t,n.props),La(t,n),t.return=e,t):(t=_i(n.type,n.key,n.props,null,e.mode,r),La(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=xi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=vi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=yi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=_i(t.type,t.key,t.props,null,e.mode,n),La(n,t),n.return=e,n;case h:return t=xi(t,e.mode,n),t.return=e,t;case w:return t=Aa(t),f(e,t,n)}if(se(t)||ie(t))return t=vi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ia(t),n);if(t.$$typeof===b)return f(e,aa(e,t),n);Ra(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case w:return n=Aa(n),p(e,t,n,r)}if(se(n)||ie(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ia(n),r);if(n.$$typeof===b)return p(e,t,aa(e,n),r);Ra(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case w:return r=Aa(r),_(e,t,n,r,i)}if(se(r)||ie(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Ia(r),i);if(r.$$typeof===b)return _(e,t,n,aa(t,r),i);Ra(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),P&&Ni(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return P&&Ni(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),P&&Ni(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),P&&Ni(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return P&&Ni(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),P&&Ni(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===w&&Aa(l)===r.type){n(e,r.sibling),c=a(r,o.props),La(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=vi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=_i(o.type,o.key,o.props,null,e.mode,c),La(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=xi(o,e.mode,c),c.return=e,e=c}return s(e);case w:return o=Aa(o),x(e,r,o,c)}if(se(o))return v(e,r,o,c);if(ie(o)){if(l=ie(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Ia(o),c);if(o.$$typeof===b)return x(e,r,aa(e,o),c);Ra(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=yi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Fa=0;var i=x(e,t,n,r);return Pa=null,i}catch(t){if(t===wa||t===Ea)throw t;var a=pi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ba=za(!0),Va=za(!1),Ha=!1;function Ua(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ga(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ka(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,z&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ui(e),li(e,null,n),t}return N(e,r,t,n),ui(e)}function qa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}function Ja(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ya=!1;function Xa(){if(Ya){var e=ga;if(e!==null)throw e}}function Za(e,t,n,r){Ya=!1;var i=e.updateQueue;Ha=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(V&p)===p:(r&p)===p){p!==0&&p===ha&&(Ya=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ha=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),eu|=o,e.lanes=o,e.memoizedState=d}}function Qa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function $a(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Qa(n[e],t)}var eo=de(null),to=de(0);function no(e,t){e=Ql,D(to,e),D(eo,t),Ql=e|t.baseLanes}function ro(){D(to,Ql),D(eo,eo.current)}function io(){Ql=to.current,fe(eo),fe(to)}var ao=de(null),oo=null;function so(e){var t=e.alternate;D(po,po.current&1),D(ao,e),oo===null&&(t===null||eo.current!==null||t.memoizedState!==null)&&(oo=e)}function co(e){D(po,po.current),D(ao,e),oo===null&&(oo=e)}function lo(e){e.tag===22?(D(po,po.current),D(ao,e),oo===null&&(oo=e)):uo(e)}function uo(){D(po,po.current),D(ao,ao.current)}function fo(e){fe(ao),oo===e&&(oo=null),fe(po)}var po=de(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ff(n)||pf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=0,R=null,go=null,_o=null,vo=!1,yo=!1,bo=!1,xo=0,So=0,Co=null,wo=0;function To(){throw Error(i(321))}function Eo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ar(e[n],t[n]))return!1;return!0}function Do(e,t,n,r,i,a){return ho=a,R=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?Ws:Gs,bo=!1,a=n(r,i),bo=!1,yo&&(a=ko(t,n,r,i)),Oo(e),a}function Oo(e){T.H=Us;var t=go!==null&&go.next!==null;if(ho=0,_o=go=R=null,vo=!1,So=0,Co=null,t)throw Error(i(300));e===null||cc||(e=e.dependencies,e!==null&&na(e)&&(cc=!0))}function ko(e,t,n,r){R=e;var a=0;do{if(yo&&(Co=null),So=0,yo=!1,25<=a)throw Error(i(301));if(a+=1,_o=go=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}T.H=Ks,o=t(n,r)}while(yo);return o}function Ao(){var e=T.H,t=e.useState()[0];return t=typeof t.then==`function`?Lo(t):t,e=e.useState()[0],(go===null?null:go.memoizedState)!==e&&(R.flags|=1024),t}function jo(){var e=xo!==0;return xo=0,e}function Mo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function No(e){if(vo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}vo=!1}ho=0,_o=go=R=null,yo=!1,So=xo=0,Co=null}function Po(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _o===null?R.memoizedState=_o=e:_o=_o.next=e,_o}function Fo(){if(go===null){var e=R.alternate;e=e===null?null:e.memoizedState}else e=go.next;var t=_o===null?R.memoizedState:_o.next;if(t!==null)_o=t,go=e;else{if(e===null)throw R.alternate===null?Error(i(467)):Error(i(310));go=e,e={memoizedState:go.memoizedState,baseState:go.baseState,baseQueue:go.baseQueue,queue:go.queue,next:null},_o===null?R.memoizedState=_o=e:_o=_o.next=e}return _o}function Io(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lo(e){var t=So;return So+=1,Co===null&&(Co=[]),e=ka(Co,e,t),t=R,(_o===null?t.memoizedState:_o.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?Ws:Gs),e}function Ro(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Lo(e);if(e.$$typeof===b)return ia(e)}throw Error(i(438,String(e)))}function zo(e){var t=null,n=R.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=R.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Io(),R.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ne;return t.index++,n}function Bo(e,t){return typeof t==`function`?t(e):t}function Vo(e){return Ho(Fo(),go,e)}function Ho(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ho&f)===f:(V&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ha&&(d=!0);else if((ho&p)===p){u=u.next,p===ha&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,R.lanes|=p,eu|=p;f=u.action,bo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,R.lanes|=f,eu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Ar(o,e.memoizedState)&&(cc=!0,d&&(n=ga,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Uo(e){var t=Fo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Ar(o,t.memoizedState)||(cc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Wo(e,t,n){var r=R,a=Fo(),o=P;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Ar((go||a).memoizedState,n);if(s&&(a.memoizedState=n,cc=!0),a=a.queue,hs(qo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||_o!==null&&_o.memoizedState.tag&1){if(r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,a,n,t),null),Kl===null)throw Error(i(349));o||ho&127||Go(r,t,n)}return n}function Go(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=R.updateQueue,t===null?(t=Io(),R.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ko(e,t,n,r){t.value=n,t.getSnapshot=r,Jo(t)&&Yo(e)}function qo(e,t,n){return n(function(){Jo(t)&&Yo(e)})}function Jo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ar(e,n)}catch{return!0}}function Yo(e){var t=ci(e,2);t!==null&&Su(t,e,2)}function Xo(e){var t=Po();if(typeof e==`function`){var n=e;if(e=n(),bo){Ue(!0);try{n()}finally{Ue(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:e},t}function Zo(e,t,n,r){return e.baseState=n,Ho(e,go,typeof r==`function`?r:Bo)}function Qo(e,t,n,r,a){if(Bs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};T.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,$o(t,o)):(o.next=n.next,t.pending=n.next=o)}}function $o(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=T.T,o={};T.T=o;try{var s=n(i,r),c=T.S;c!==null&&c(o,s),es(e,t,s)}catch(n){ns(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),T.T=a}}else try{a=n(i,r),es(e,t,a)}catch(n){ns(e,t,n)}}function es(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ts(e,t,n)},function(n){return ns(e,t,n)}):ts(e,t,n)}function ts(e,t,n){t.status=`fulfilled`,t.value=n,rs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$o(e,n)))}function ns(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,rs(t),t=t.next;while(t!==r)}e.action=null}function rs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function is(e,t){return t}function as(e,t){if(P){var n=Kl.formState;if(n!==null){a:{var r=R;if(P){if(zi){b:{for(var i=zi,a=F;i.nodeType!==8;){if(!a){i=null;break b}if(i=hf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){zi=hf(i.nextSibling),r=i.data===`F!`;break a}}Hi(r)}r=!1}r&&(t=n[0])}}return n=Po(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:t},n.queue=r,n=Ls.bind(null,R,r),r.dispatch=n,r=Xo(!1),a=zs.bind(null,R,!1,r.queue),r=Po(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Qo.bind(null,R,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function os(e){return ss(Fo(),go,e)}function ss(e,t,n){if(t=Ho(e,t,is)[0],e=Vo(Bo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Lo(t)}catch(e){throw e===wa?Ea:e}else r=t;t=Fo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(R.flags|=2048,us(9,{destroy:void 0},cs.bind(null,i,n),null)),[r,a,e]}function cs(e,t){e.action=t}function ls(e){var t=Fo(),n=go;if(n!==null)return ss(t,n,e);Fo(),t=t.memoizedState,n=Fo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function us(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=R.updateQueue,t===null&&(t=Io(),R.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ds(){return Fo().memoizedState}function fs(e,t,n,r){var i=Po();R.flags|=e,i.memoizedState=us(1|t,{destroy:void 0},n,r===void 0?null:r)}function ps(e,t,n,r){var i=Fo();r=r===void 0?null:r;var a=i.memoizedState.inst;go!==null&&r!==null&&Eo(r,go.memoizedState.deps)?i.memoizedState=us(t,a,n,r):(R.flags|=e,i.memoizedState=us(1|t,a,n,r))}function ms(e,t){fs(8390656,8,e,t)}function hs(e,t){ps(2048,8,e,t)}function gs(e){R.flags|=4;var t=R.updateQueue;if(t===null)t=Io(),R.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function _s(e){var t=Fo().memoizedState;return gs({ref:t,nextImpl:e}),function(){if(z&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function vs(e,t){return ps(4,2,e,t)}function ys(e,t){return ps(4,4,e,t)}function bs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xs(e,t,n){n=n==null?null:n.concat([e]),ps(4,4,bs.bind(null,t,e),n)}function Ss(){}function Cs(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Eo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ws(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Eo(t,r[1]))return r[0];if(r=e(),bo){Ue(!0);try{e()}finally{Ue(!1)}}return n.memoizedState=[r,t],r}function Ts(e,t,n){return n===void 0||ho&1073741824&&!(V&261930)?e.memoizedState=t:(e.memoizedState=n,e=xu(),R.lanes|=e,eu|=e,n)}function Es(e,t,n,r){return Ar(n,t)?n:eo.current===null?!(ho&42)||ho&1073741824&&!(V&261930)?(cc=!0,e.memoizedState=n):(e=xu(),R.lanes|=e,eu|=e,t):(e=Ts(e,n,r),Ar(e,t)||(cc=!0),e)}function Ds(e,t,n,r,i){var a=E.p;E.p=a!==0&&8>a?a:8;var o=T.T,s={};T.T=s,zs(e,!1,t,n);try{var c=i(),l=T.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Rs(e,t,ya(c,r),bu(e)):Rs(e,t,r,bu(e))}catch(n){Rs(e,t,{then:function(){},status:`rejected`,reason:n},bu())}finally{E.p=a,o!==null&&s.types!==null&&(o.types=s.types),T.T=o}}function Os(){}function ks(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=As(e).queue;Ds(e,a,t,ce,n===null?Os:function(){return js(e),n(r)})}function As(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:ce},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function js(e){var t=As(e);t.next===null&&(t=e.alternate.memoizedState),Rs(e,t.next.queue,{},bu())}function Ms(){return ia(ip)}function Ns(){return Fo().memoizedState}function Ps(){return Fo().memoizedState}function Fs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bu();e=Ga(n);var r=Ka(t,e,n);r!==null&&(Su(r,t,n),qa(r,t,n)),t={cache:da()},e.payload=t;return}t=t.return}}function Is(e,t,n){var r=bu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bs(e)?Vs(t,n):(n=si(e,t,n,r),n!==null&&(Su(n,e,r),Hs(n,t,r)))}function Ls(e,t,n){Rs(e,t,n,bu())}function Rs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bs(e))Vs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Ar(s,o))return N(e,t,i,0),Kl===null&&oi(),!1}catch{}if(n=si(e,t,i,r),n!==null)return Su(n,e,r),Hs(n,t,r),!0}return!1}function zs(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Bs(e)){if(t)throw Error(i(479))}else t=si(e,n,r,2),t!==null&&Su(t,e,2)}function Bs(e){var t=e.alternate;return e===R||t!==null&&t===R}function Vs(e,t){yo=vo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}var Us={readContext:ia,use:Ro,useCallback:To,useContext:To,useEffect:To,useImperativeHandle:To,useLayoutEffect:To,useInsertionEffect:To,useMemo:To,useReducer:To,useRef:To,useState:To,useDebugValue:To,useDeferredValue:To,useTransition:To,useSyncExternalStore:To,useId:To,useHostTransitionStatus:To,useFormState:To,useActionState:To,useOptimistic:To,useMemoCache:To,useCacheRefresh:To};Us.useEffectEvent=To;var Ws={readContext:ia,use:Ro,useCallback:function(e,t){return Po().memoizedState=[e,t===void 0?null:t],e},useContext:ia,useEffect:ms,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),fs(4194308,4,bs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fs(4194308,4,e,t)},useInsertionEffect:function(e,t){fs(4,2,e,t)},useMemo:function(e,t){var n=Po();t=t===void 0?null:t;var r=e();if(bo){Ue(!0);try{e()}finally{Ue(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Po();if(n!==void 0){var i=n(t);if(bo){Ue(!0);try{n(t)}finally{Ue(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Is.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=Po();return e={current:e},t.memoizedState=e},useState:function(e){e=Xo(e);var t=e.queue,n=Ls.bind(null,R,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ss,useDeferredValue:function(e,t){return Ts(Po(),e,t)},useTransition:function(){var e=Xo(!1);return e=Ds.bind(null,R,e.queue,!0,!1),Po().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=R,a=Po();if(P){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Kl===null)throw Error(i(349));V&127||Go(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ms(qo.bind(null,r,o,e),[e]),r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,o,n,t),null),n},useId:function(){var e=Po(),t=Kl.identifierPrefix;if(P){var n=Mi,r=ji;n=(r&~(1<<32-We(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=wo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ms,useFormState:as,useActionState:as,useOptimistic:function(e){var t=Po();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=zs.bind(null,R,!0,n),n.dispatch=t,[e,t]},useMemoCache:zo,useCacheRefresh:function(){return Po().memoizedState=Fs.bind(null,R)},useEffectEvent:function(e){var t=Po(),n={impl:e};return t.memoizedState=n,function(){if(z&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Gs={readContext:ia,use:Ro,useCallback:Cs,useContext:ia,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Vo,useRef:ds,useState:function(){return Vo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){return Es(Fo(),go.memoizedState,e,t)},useTransition:function(){var e=Vo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:os,useActionState:os,useOptimistic:function(e,t){return Zo(Fo(),go,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Gs.useEffectEvent=_s;var Ks={readContext:ia,use:Ro,useCallback:Cs,useContext:ia,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Uo,useRef:ds,useState:function(){return Uo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){var n=Fo();return go===null?Ts(n,e,t):Es(n,go.memoizedState,e,t)},useTransition:function(){var e=Uo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:ls,useActionState:ls,useOptimistic:function(e,t){var n=Fo();return go===null?(n.baseState=e,[e,n.queue.dispatch]):Zo(n,go,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Ks.useEffectEvent=_s;function qs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Js={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ga(r);i.payload=t,n!=null&&(i.callback=n),t=Ka(e,i,r),t!==null&&(Su(t,e,r),qa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ga(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ka(e,i,r),t!==null&&(Su(t,e,r),qa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bu(),r=Ga(n);r.tag=2,t!=null&&(r.callback=t),t=Ka(e,r,n),t!==null&&(Su(t,e,n),qa(t,e,n))}};function Ys(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!jr(n,r)||!jr(i,a):!0}function Xs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Js.enqueueReplaceState(t,t.state,null)}function Zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Qs(e){M(e)}function $s(e){console.error(e)}function ec(e){M(e)}function tc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function nc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function rc(e,t,n){return n=Ga(n),n.tag=3,n.payload={element:null},n.callback=function(){tc(e,t)},n}function ic(e){return e=Ga(e),e.tag=3,e}function ac(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){nc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){nc(t,n,r),typeof i!=`function`&&(fu===null?fu=new Set([this]):fu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function oc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ta(t,n,a,!0),n=ao.current,n!==null){switch(n.tag){case 31:case 13:return oo===null?Pu():n.alternate===null&&$l===0&&($l=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Da?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Qu(e,r,a)),!1;case 22:return n.flags|=65536,r===Da?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Qu(e,r,a)),!1}throw Error(i(435,n.tag))}return Qu(e,r,a),Pu(),!1}if(P)return t=ao.current,t===null?(r!==Vi&&(t=Error(i(423),{cause:r}),Ji(Ci(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ci(r,n),a=rc(e.stateNode,r,a),Ja(e,a),$l!==4&&($l=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Vi&&(e=Error(i(422),{cause:r}),Ji(Ci(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ci(o,n),au===null?au=[o]:au.push(o),$l!==4&&($l=2),t===null)return!0;r=Ci(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=rc(n.stateNode,r,e),Ja(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(fu===null||!fu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ic(a),ac(a,e,n,r),Ja(n,a),!1}n=n.return}while(n!==null);return!1}var sc=Error(i(461)),cc=!1;function lc(e,t,n,r){t.child=e===null?Va(t,null,n,r):Ba(t,e.child,n,r)}function uc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ra(t),r=Do(e,t,n,o,a,i),s=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(P&&s&&Fi(t),t.flags|=1,lc(e,t,r,i),t.child)}function dc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!mi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,fc(e,t,a,r,i)):(e=_i(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Fc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?jr:n,n(o,r)&&e.ref===t.ref)return Pc(e,t,i)}return t.flags|=1,e=hi(a,r),e.ref=t.ref,e.return=t,t.child=e}function fc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(jr(a,r)&&e.ref===t.ref)if(cc=!1,t.pendingProps=r=a,Fc(e,i))e.flags&131072&&(cc=!0);else return t.lanes=e.lanes,Pc(e,t,i)}return bc(e,t,n,r,i)}function pc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Sa(t,a===null?null:a.cachePool),a===null?ro():no(t,a),lo(t);else return r=t.lanes=536870912,hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Sa(t,null),ro(),uo(t)):(Sa(t,a.cachePool),no(t,a),uo(t),t.memoizedState=null);return lc(e,t,i,n),t.child}function mc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function hc(e,t,n,r,i){var a=xa();return a=a===null?null:{parent:ua._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Sa(t,null),ro(),lo(t),e!==null&&ta(e,t,r,!0),t.childLanes=i,null}function gc(e,t){return t=kc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function _c(e,t,n){return Ba(t,e.child,null,n),e=gc(t,t.pendingProps),e.flags|=2,fo(t),t.memoizedState=null,e}function vc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(P){if(r.mode===`hidden`)return e=gc(t,r),t.lanes=536870912,mc(null,e);if(co(t),(e=zi)?(e=df(e,F),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ai===null?null:{id:ji,overflow:Mi},retryLane:536870912,hydrationErrors:null},n=bi(e),n.return=t,t.child=n,Ri=t,zi=null)):e=null,e===null)throw Hi(t);return t.lanes=536870912,null}return gc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(co(t),a)if(t.flags&256)t.flags&=-257,t=_c(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(cc||ta(e,t,n,!1),a=(n&e.childLanes)!==0,cc||a){if(r=Kl,r!==null&&(s=ot(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ci(e,s),Su(r,e,s),sc;Pu(),t=_c(e,t,n)}else e=o.treeContext,zi=hf(s.nextSibling),Ri=t,P=!0,Bi=null,F=!1,e!==null&&Li(t,e),t=gc(t,r),t.flags|=4096;return t}return e=hi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function yc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function bc(e,t,n,r,i){return ra(t),n=Do(e,t,n,r,void 0,i),r=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(P&&r&&Fi(t),t.flags|=1,lc(e,t,n,i),t.child)}function xc(e,t,n,r,i,a){return ra(t),t.updateQueue=null,n=ko(t,r,n,i),Oo(e),r=jo(),e!==null&&!cc?(Mo(e,t,a),Pc(e,t,a)):(P&&r&&Fi(t),t.flags|=1,lc(e,t,n,a),t.child)}function Sc(e,t,n,r,i){if(ra(t),t.stateNode===null){var a=di,o=n.contextType;typeof o==`object`&&o&&(a=ia(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Js,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ua(t),o=n.contextType,a.context=typeof o==`object`&&o?ia(o):di,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(qs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Js.enqueueReplaceState(a,a.state,null),Za(t,r,a,i),Xa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=di,typeof u==`object`&&u&&(o=ia(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Xs(t,a,r,o),Ha=!1;var f=t.memoizedState;a.state=f,Za(t,r,a,i),Xa(),l=t.memoizedState,s||f!==l||Ha?(typeof d==`function`&&(qs(t,n,d,r),l=t.memoizedState),(c=Ha||Ys(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Wa(e,t),o=t.memoizedProps,u=Zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=di,typeof l==`object`&&l&&(c=ia(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Xs(t,a,r,c),Ha=!1,f=t.memoizedState,a.state=f,Za(t,r,a,i),Xa();var p=t.memoizedState;o!==d||f!==p||Ha||e!==null&&e.dependencies!==null&&na(e.dependencies)?(typeof s==`function`&&(qs(t,n,s,r),p=t.memoizedState),(u=Ha||Ys(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&na(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,yc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ba(t,e.child,null,i),t.child=Ba(t,null,n,i)):lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Pc(e,t,i),e}function Cc(e,t,n,r){return Ki(),t.flags|=256,lc(e,t,n,r),t.child}var wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tc(e){return{baseLanes:e,cachePool:Ca()}}function Ec(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ru),e}function Dc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(po.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(P){if(a?so(t):uo(t),(e=zi)?(e=df(e,F),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ai===null?null:{id:ji,overflow:Mi},retryLane:536870912,hydrationErrors:null},n=bi(e),n.return=t,t.child=n,Ri=t,zi=null)):e=null,e===null)throw Hi(t);return pf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(uo(t),a=t.mode,c=kc({mode:`hidden`,children:c},a),r=vi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(null,r)):(so(t),Oc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(so(t),t.flags&=-257,t=Ac(e,t,n)):t.memoizedState===null?(uo(t),c=r.fallback,a=t.mode,r=kc({mode:`visible`,children:r.children},a),c=vi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ba(t,e.child,null,n),r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,t=mc(null,r)):(uo(t),t.child=e.child,t.flags|=128,t=null);else if(so(t),pf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ji({value:r,source:null,stack:null}),t=Ac(e,t,n)}else if(cc||ta(e,t,n,!1),s=(n&e.childLanes)!==0,cc||s){if(s=Kl,s!==null&&(r=ot(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ci(e,r),Su(s,e,r),sc;ff(c)||Pu(),t=Ac(e,t,n)}else ff(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,zi=hf(c.nextSibling),Ri=t,P=!0,Bi=null,F=!1,e!==null&&Li(t,e),t=Oc(t,r.children),t.flags|=4096);return t}return a?(uo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=hi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=vi(c,a,n,null),c.flags|=2):c=hi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,mc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Tc(n):(a=c.cachePool,a===null?a=Ca():(l=ua._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(e.child,r)):(so(t),n=e.child,e=n.sibling,n=hi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Oc(e,t){return t=kc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function kc(e,t){return e=pi(22,e,null,t),e.lanes=0,e}function Ac(e,t,n){return Ba(t,e.child,null,n),e=Oc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$i(e.return,t,n)}function Mc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Nc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=po.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,D(po,o),lc(e,t,r,n),r=P?Di:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jc(e,n,t);else if(e.tag===19)jc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Mc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Mc(t,!0,n,null,a,r);break;case`together`:Mc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Pc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),eu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ta(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=hi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=hi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&na(e))):!0}function Ic(e,t,n){switch(t.tag){case 3:ge(t,t.stateNode.containerInfo),Zi(t,ua,e.memoizedState.cache),Ki();break;case 27:case 5:ve(t);break;case 4:ge(t,t.stateNode.containerInfo);break;case 10:Zi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,co(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(so(t),e=Pc(e,t,n),e===null?null:e.sibling):Dc(e,t,n):(so(t),t.flags|=128,null);so(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(ta(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Nc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),D(po,po.current),r)break;return null;case 22:return t.lanes=0,pc(e,t,n,t.pendingProps);case 24:Zi(t,ua,e.memoizedState.cache)}return Pc(e,t,n)}function Lc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)cc=!0;else{if(!Fc(e,n)&&!(t.flags&128))return cc=!1,Ic(e,t,n);cc=!!(e.flags&131072)}else cc=!1,P&&t.flags&1048576&&Pi(t,Di,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Aa(t.elementType),t.type=e,typeof e==`function`)mi(e)?(r=Zs(e,r),t.tag=1,t=Sc(null,t,e,r,n)):(t.tag=0,t=bc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=uc(null,t,e,r,n);break a}else if(a===C){t.tag=14,t=dc(null,t,e,r,n);break a}}throw t=oe(e)||e,Error(i(306,t,``))}}return t;case 0:return bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Zs(r,t.pendingProps),Sc(e,t,r,a,n);case 3:a:{if(ge(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Wa(e,t),Za(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Zi(t,ua,r),r!==o.cache&&ea(t,[ua],n,!0),Xa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Cc(e,t,r,n);break a}else if(r!==a){a=Ci(Error(i(424)),t),Ji(a),t=Cc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(zi=hf(e.firstChild),Ri=t,P=!0,Bi=null,F=!0,n=Va(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ki(),r===a){t=Pc(e,t,n);break a}lc(e,t,r,n)}t=t.child}return t;case 26:return yc(e,t),e===null?(n=If(t.type,null,t.pendingProps,null))?t.memoizedState=n:P||(n=t.type,e=t.pendingProps,r=qd(he.current).createElement(n),r[ft]=t,r[pt]=e,Vd(r,n,e),Tt(r),t.stateNode=r):t.memoizedState=If(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ve(t),e===null&&P&&(r=t.stateNode=yf(t.type,t.pendingProps,he.current),Ri=t,F=!0,a=zi,af(t.type)?(gf=a,zi=hf(r.firstChild)):zi=a),lc(e,t,t.pendingProps.children,n),yc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&P&&((a=r=zi)&&(r=lf(r,t.type,t.pendingProps,F),r===null?a=!1:(t.stateNode=r,Ri=t,zi=hf(r.firstChild),F=!1,a=!0)),a||Hi(t)),ve(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Xd(a,o)?r=null:s!==null&&Xd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Do(e,t,Ao,null,null,n),ip._currentValue=a),yc(e,t),lc(e,t,r,n),t.child;case 6:return e===null&&P&&((e=n=zi)&&(n=uf(n,t.pendingProps,F),n===null?e=!1:(t.stateNode=n,Ri=t,zi=null,e=!0)),e||Hi(t)),null;case 13:return Dc(e,t,n);case 4:return ge(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ba(t,null,r,n):lc(e,t,r,n),t.child;case 11:return uc(e,t,t.type,t.pendingProps,n);case 7:return lc(e,t,t.pendingProps,n),t.child;case 8:return lc(e,t,t.pendingProps.children,n),t.child;case 12:return lc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Zi(t,t.type,r.value),lc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ra(t),a=ia(a),r=r(a),t.flags|=1,lc(e,t,r,n),t.child;case 14:return dc(e,t,t.type,t.pendingProps,n);case 15:return fc(e,t,t.type,t.pendingProps,n);case 19:return Nc(e,t,n);case 31:return vc(e,t,n);case 22:return pc(e,t,n,t.pendingProps);case 24:return ra(t),r=ia(ua),e===null?(a=xa(),a===null&&(a=Kl,o=da(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ua(t),Zi(t,ua,a)):((e.lanes&n)!==0&&(Wa(e,t),Za(t,null,null,n),Xa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Zi(t,ua,r),r!==a.cache&&ea(t,[ua],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Zi(t,ua,r))),lc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Rc(e){e.flags|=4}function zc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(ju())e.flags|=8192;else throw ja=Da,Ta}else e.flags&=-16777217}function Bc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Zf(t))if(ju())e.flags|=8192;else throw ja=Da,Ta}function Vc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:et(),e.lanes|=t,iu|=t)}function Hc(e,t){if(!P)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Uc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Wc(e,t,n){var r=t.pendingProps;switch(Ii(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Uc(t),null;case 1:return Uc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Qi(ua),_e(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Gi(t)?Rc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,qi())),Uc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Rc(t),o===null?(Uc(t),zc(t,a,null,r,n)):(Uc(t),Bc(t,o))):o?o===e.memoizedState?(Uc(t),t.flags&=-16777217):(Rc(t),Uc(t),Bc(t,o)):(e=e.memoizedProps,e!==r&&Rc(t),Uc(t),zc(t,a,e,r,n)),null;case 27:if(ye(t),n=he.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}e=pe.current,Gi(t)?Ui(t,e):(e=yf(a,r,n),t.stateNode=e,Rc(t))}return Uc(t),null;case 5:if(ye(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}if(o=pe.current,Gi(t))Ui(t,o);else{var s=qd(he.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ft]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Vd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Rc(t)}}return Uc(t),zc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=he.current,Gi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ri,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Hi(t,!0)}else e=qd(e).createTextNode(r),e[ft]=t,t.stateNode=e}return Uc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Gi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ft]=t}else Ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),e=!1}else n=qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(fo(t),t):(fo(t),null);if(t.flags&128)throw Error(i(558))}return Uc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Gi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ft]=t}else Ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),a=!1}else a=qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(fo(t),t):(fo(t),null)}return fo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Vc(t,t.updateQueue),Uc(t),null);case 4:return _e(),e===null&&kd(t.stateNode.containerInfo),Uc(t),null;case 10:return Qi(t.type),Uc(t),null;case 19:if(fe(po),r=t.memoizedState,r===null)return Uc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Hc(r,!1);else{if($l!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=mo(e),o!==null){for(t.flags|=128,Hc(r,!1),e=o.updateQueue,t.updateQueue=e,Vc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)gi(n,e),n=n.sibling;return D(po,po.current&1|2),P&&Ni(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Me()>uu&&(t.flags|=128,a=!0,Hc(r,!1),t.lanes=4194304)}else{if(!a)if(e=mo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Vc(t,e),Hc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!P)return Uc(t),null}else 2*Me()-r.renderingStartTime>uu&&n!==536870912&&(t.flags|=128,a=!0,Hc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Uc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Me(),e.sibling=null,n=po.current,D(po,a?n&1|2:n&1),P&&Ni(t,r.treeForkCount),e);case 22:case 23:return fo(t),io(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Uc(t),t.subtreeFlags&6&&(t.flags|=8192)):Uc(t),n=t.updateQueue,n!==null&&Vc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&fe(ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Qi(ua),Uc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Gc(e,t){switch(Ii(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(ua),_e(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ye(t),null;case 31:if(t.memoizedState!==null){if(fo(t),t.alternate===null)throw Error(i(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(fo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(po),null;case 4:return _e(),null;case 10:return Qi(t.type),null;case 22:case 23:return fo(t),io(),e!==null&&fe(ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qi(ua),null;case 25:return null;default:return null}}function Kc(e,t){switch(Ii(t),t.tag){case 3:Qi(ua),_e();break;case 26:case 27:case 5:ye(t);break;case 4:_e();break;case 31:t.memoizedState!==null&&fo(t);break;case 13:fo(t);break;case 19:fe(po);break;case 10:Qi(t.type);break;case 22:case 23:fo(t),io(),e!==null&&fe(ba);break;case 24:Qi(ua)}}function qc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){W(t,t.return,e)}}function Jc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){W(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){W(t,t.return,e)}}function Yc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{$a(t,n)}catch(t){W(e,e.return,t)}}}function Xc(e,t,n){n.props=Zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){W(e,t,n)}}function Zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){W(e,t,n)}}function Qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){W(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){W(e,t,n)}else n.current=null}function $c(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){W(e,e.return,t)}}function el(e,t,n){try{var r=e.stateNode;Hd(r,e.type,n,t),r[pt]=t}catch(t){W(e,e.return,t)}}function tl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&af(e.type)||e.tag===4}function nl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||tl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&af(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function rl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=on));else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(rl(e,t,n),e=e.sibling;e!==null;)rl(e,t,n),e=e.sibling}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Vd(t,r,n),t[ft]=e,t[pt]=n}catch(t){W(e,e.return,t)}}var ol=!1,sl=!1,cl=!1,ll=typeof WeakSet==`function`?WeakSet:Set,ul=null;function dl(e,t){if(e=e.containerInfo,Gd=pp,e=Fr(e),Ir(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Kd={focusedElem:e,selectionRange:n},pp=!1,ul=t;ul!==null;)if(t=ul,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ul=e;else for(;ul!==null;){switch(t=ul,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){W(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)cf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:cf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ul=e;break}ul=t.return}}function fl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Dl(e,n),r&4&&qc(5,n);break;case 1:if(Dl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){W(n,n.return,e)}else{var i=Zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){W(n,n.return,e)}}r&64&&Yc(n),r&512&&Zc(n,n.return);break;case 3:if(Dl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{$a(e,t)}catch(e){W(n,n.return,e)}}break;case 27:t===null&&r&4&&al(n);case 26:case 5:Dl(e,n),t===null&&r&4&&$c(n),r&512&&Zc(n,n.return);break;case 12:Dl(e,n);break;case 31:Dl(e,n),r&4&&vl(e,n);break;case 13:Dl(e,n),r&4&&yl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=td.bind(null,n),mf(e,n))));break;case 22:if(r=n.memoizedState!==null||ol,!r){t=t!==null&&t.memoizedState!==null||sl,i=ol;var a=sl;ol=r,(sl=t)&&!a?kl(e,n,(n.subtreeFlags&8772)!=0):Dl(e,n),ol=i,sl=a}break;case 30:break;default:Dl(e,n)}}function pl(e){var t=e.alternate;t!==null&&(e.alternate=null,pl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&bt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ml=null,hl=!1;function gl(e,t,n){for(n=n.child;n!==null;)_l(e,t,n),n=n.sibling}function _l(e,t,n){if(He&&typeof He.onCommitFiberUnmount==`function`)try{He.onCommitFiberUnmount(Ve,n)}catch{}switch(n.tag){case 26:sl||Qc(n,t),gl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:sl||Qc(n,t);var r=ml,i=hl;af(n.type)&&(ml=n.stateNode,hl=!1),gl(e,t,n),bf(n.stateNode),ml=r,hl=i;break;case 5:sl||Qc(n,t);case 6:if(r=ml,i=hl,ml=null,gl(e,t,n),ml=r,hl=i,ml!==null)if(hl)try{(ml.nodeType===9?ml.body:ml.nodeName===`HTML`?ml.ownerDocument.body:ml).removeChild(n.stateNode)}catch(e){W(n,t,e)}else try{ml.removeChild(n.stateNode)}catch(e){W(n,t,e)}break;case 18:ml!==null&&(hl?(e=ml,of(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),zp(e)):of(ml,n.stateNode));break;case 4:r=ml,i=hl,ml=n.stateNode.containerInfo,hl=!0,gl(e,t,n),ml=r,hl=i;break;case 0:case 11:case 14:case 15:Jc(2,n,t),sl||Jc(4,n,t),gl(e,t,n);break;case 1:sl||(Qc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Xc(n,t,r)),gl(e,t,n);break;case 21:gl(e,t,n);break;case 22:sl=(r=sl)||n.memoizedState!==null,gl(e,t,n),sl=r;break;default:gl(e,t,n)}}function vl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{zp(e)}catch(e){W(t,t.return,e)}}}function yl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{zp(e)}catch(e){W(t,t.return,e)}}function bl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ll),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ll),t;default:throw Error(i(435,e.tag))}}function xl(e,t){var n=bl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=nd.bind(null,e,t);t.then(r,r)}})}function Sl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(af(c.type)){ml=c.stateNode,hl=!1;break a}break;case 5:ml=c.stateNode,hl=!1;break a;case 3:case 4:ml=c.stateNode.containerInfo,hl=!0;break a}c=c.return}if(ml===null)throw Error(i(160));_l(o,s,a),ml=null,hl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wl(t,e),t=t.sibling}var Cl=null;function wl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sl(t,e),Tl(e),r&4&&(Jc(3,e,e.return),qc(3,e),Jc(5,e,e.return));break;case 1:Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&64&&ol&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=Cl;if(Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[yt]||o[ft]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Vd(o,r,n),o[ft]=e,Tt(o),r=o;break a;case`link`:var s=Jf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Vd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Jf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Vd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ft]=e,Tt(o),r=o}e.stateNode=r}else Yf(a,e.type,e.stateNode);else e.stateNode=Uf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&el(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Yf(a,e.type,e.stateNode):Uf(a,r,e.memoizedProps))}break;case 27:Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),n!==null&&r&4&&el(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),e.flags&32){a=e.stateNode;try{Zt(a,``)}catch(t){W(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,el(e,a,n===null?a:n.memoizedProps)),r&1024&&(cl=!0);break;case 6:if(Sl(t,e),Tl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){W(e,e.return,t)}}break;case 3:if(qf=null,a=Cl,Cl=Cf(t.containerInfo),Sl(t,e),Cl=a,Tl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zp(t.containerInfo)}catch(t){W(e,e.return,t)}cl&&(cl=!1,El(e));break;case 4:r=Cl,Cl=Cf(e.stateNode.containerInfo),Sl(t,e),Tl(e),Cl=r;break;case 12:Sl(t,e),Tl(e);break;case 31:Sl(t,e),Tl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 13:Sl(t,e),Tl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(cu=Me()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=ol,d=sl;if(ol=u||a,sl=d||l,Sl(t,e),sl=d,ol=u,Tl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||ol||sl||Ol(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){W(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){W(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?sf(m,!0):sf(l.stateNode,!1)}catch(e){W(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,xl(e,n))));break;case 19:Sl(t,e),Tl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 30:break;case 21:break;default:Sl(t,e),Tl(e)}}function Tl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(tl(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;il(e,nl(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Zt(o,``),n.flags&=-33),il(e,nl(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;rl(e,nl(e),s);break;default:throw Error(i(161))}}catch(t){W(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function El(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;El(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Dl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fl(e,t.alternate,t),t=t.sibling}function Ol(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jc(4,t,t.return),Ol(t);break;case 1:Qc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Xc(t,t.return,n),Ol(t);break;case 27:bf(t.stateNode);case 26:case 5:Qc(t,t.return),Ol(t);break;case 22:t.memoizedState===null&&Ol(t);break;case 30:Ol(t);break;default:Ol(t)}e=e.sibling}}function kl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:kl(i,a,n),qc(4,a);break;case 1:if(kl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){W(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Qa(c[i],s)}catch(e){W(r,r.return,e)}}n&&o&64&&Yc(a),Zc(a,a.return);break;case 27:al(a);case 26:case 5:kl(i,a,n),n&&r===null&&o&4&&$c(a),Zc(a,a.return);break;case 12:kl(i,a,n);break;case 31:kl(i,a,n),n&&o&4&&vl(i,a);break;case 13:kl(i,a,n),n&&o&4&&yl(i,a);break;case 22:a.memoizedState===null&&kl(i,a,n),Zc(a,a.return);break;case 30:break;default:kl(i,a,n)}t=t.sibling}}function Al(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&fa(n))}function jl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e))}function Ml(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Nl(e,t,n,r),t=t.sibling}function Nl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ml(e,t,n,r),i&2048&&qc(9,t);break;case 1:Ml(e,t,n,r);break;case 3:Ml(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e)));break;case 12:if(i&2048){Ml(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){W(t,t.return,e)}}else Ml(e,t,n,r);break;case 31:Ml(e,t,n,r);break;case 13:Ml(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Ml(e,t,n,r):(a._visibility|=2,Pl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Ml(e,t,n,r):Fl(e,t),i&2048&&Al(o,t);break;case 24:Ml(e,t,n,r),i&2048&&jl(t.alternate,t);break;default:Ml(e,t,n,r)}}function Pl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Pl(a,o,s,c,i),qc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Pl(a,o,s,c,i)):u._visibility&2?Pl(a,o,s,c,i):Fl(a,o),i&&l&2048&&Al(o.alternate,o);break;case 24:Pl(a,o,s,c,i),i&&l&2048&&jl(o.alternate,o);break;default:Pl(a,o,s,c,i)}t=t.sibling}}function Fl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Fl(n,r),i&2048&&Al(r.alternate,r);break;case 24:Fl(n,r),i&2048&&jl(r.alternate,r);break;default:Fl(n,r)}t=t.sibling}}var Il=8192;function Ll(e,t,n){if(e.subtreeFlags&Il)for(e=e.child;e!==null;)Rl(e,t,n),e=e.sibling}function Rl(e,t,n){switch(e.tag){case 26:Ll(e,t,n),e.flags&Il&&e.memoizedState!==null&&Qf(n,Cl,e.memoizedState,e.memoizedProps);break;case 5:Ll(e,t,n);break;case 3:case 4:var r=Cl;Cl=Cf(e.stateNode.containerInfo),Ll(e,t,n),Cl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Il,Il=16777216,Ll(e,t,n),Il=r):Ll(e,t,n));break;default:Ll(e,t,n)}}function zl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Ul(r,e)}zl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vl(e),e=e.sibling}function Vl(e){switch(e.tag){case 0:case 11:case 15:Bl(e),e.flags&2048&&Jc(9,e,e.return);break;case 3:Bl(e);break;case 12:Bl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):Bl(e);break;default:Bl(e)}}function Hl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Ul(r,e)}zl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jc(8,t,t.return),Hl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function Ul(e,t){for(;ul!==null;){var n=ul;switch(n.tag){case 0:case 11:case 15:Jc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:fa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ul=r;else a:for(n=e;ul!==null;){r=ul;var i=r.sibling,a=r.return;if(pl(r),r===n){ul=null;break a}if(i!==null){i.return=a,ul=i;break a}ul=a}}}var Wl={getCacheForType:function(e){var t=ia(ua),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ia(ua).controller.signal}},Gl=typeof WeakMap==`function`?WeakMap:Map,z=0,Kl=null,B=null,V=0,ql=0,Jl=null,Yl=!1,Xl=!1,Zl=!1,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=null,ou=null,su=!1,cu=0,lu=0,uu=1/0,du=null,fu=null,H=0,pu=null,mu=null,U=0,hu=0,gu=null,_u=null,vu=0,yu=null;function bu(){return z&2&&V!==0?V&-V:T.T===null?lt():vd()}function xu(){if(ru===0)if(!(V&536870912)||P){var e=Ye;Ye<<=1,!(Ye&3932160)&&(Ye=262144),ru=e}else ru=536870912;return e=ao.current,e!==null&&(e.flags|=32),ru}function Su(e,t,n){(e===Kl&&(ql===2||ql===9)||e.cancelPendingCommit!==null)&&(ku(e,0),Eu(e,V,ru,!1)),nt(e,n),(!(z&2)||e!==Kl)&&(e===Kl&&(!(z&2)&&(tu|=n),$l===4&&Eu(e,V,ru,!1)),ud(e))}function Cu(e,t,n){if(z&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||A(e,t),a=r?Lu(e,t):Fu(e,t,!0),o=r;do{if(a===0){Xl&&!r&&Eu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Tu(n)){a=Fu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=au;var l=c.current.memoizedState.isDehydrated;if(l&&(ku(c,s).flags|=256),s=Fu(c,s,!1),s!==2){if(Zl&&!l){c.errorRecoveryDisabledLanes|=o,tu|=o,a=4;break a}o=ou,ou=a,o!==null&&(ou===null?ou=o:ou.push.apply(ou,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ku(e,0),Eu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Eu(r,t,ru,!Yl);break a;case 2:ou=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=cu+300-Me(),10<a)){if(Eu(r,t,ru,!Yl),k(r,0,!0)!==0)break a;U=t,r.timeoutHandle=$d(wu.bind(null,r,n,ou,du,su,t,ru,tu,iu,Yl,o,`Throttled`,-0,0),a);break a}wu(r,n,ou,du,su,t,ru,tu,iu,Yl,o,null,-0,0)}}break}while(1);ud(e)}function wu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:on},Rl(t,a,d);var m=(a&62914560)===a?cu-Me():(a&4194048)===a?lu-Me():0;if(m=ep(d,m),m!==null){U=a,e.cancelPendingCommit=m(Wu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Eu(e,a,o,!l);return}}Wu(e,t,a,n,r,i,o,s,c)}function Tu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Ar(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Eu(e,t,n,r){t&=~nu,t&=~tu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-We(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&it(e,n,t)}function Du(){return z&6?!0:(dd(0,!1),!1)}function Ou(){if(B!==null){if(ql===0)var e=B.return;else e=B,Xi=I=null,No(e),Pa=null,Fa=0,e=B;for(;e!==null;)Kc(e.alternate,e),e=e.return;B=null}}function ku(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,ef(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),U=0,Ou(),Kl=e,B=n=hi(e.current,null),V=t,ql=0,Jl=null,Yl=!1,Xl=A(e,t),Zl=!1,iu=ru=nu=tu=eu=$l=0,ou=au=null,su=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-We(r),a=1<<i;t|=e[i],r&=~a}return Ql=t,oi(),n}function Au(e,t){R=null,T.H=Us,t===wa||t===Ea?(t=Ma(),ql=3):t===Ta?(t=Ma(),ql=4):ql=t===sc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Jl=t,B===null&&($l=1,tc(e,Ci(t,e.current)))}function ju(){var e=ao.current;return e===null?!0:(V&4194048)===V?oo===null:(V&62914560)===V||V&536870912?e===oo:!1}function Mu(){var e=T.H;return T.H=Us,e===null?Us:e}function Nu(){var e=T.A;return T.A=Wl,e}function Pu(){$l=4,Yl||(V&4194048)!==V&&ao.current!==null||(Xl=!0),!(eu&134217727)&&!(tu&134217727)||Kl===null||Eu(Kl,V,ru,!1)}function Fu(e,t,n){var r=z;z|=2;var i=Mu(),a=Nu();(Kl!==e||V!==t)&&(du=null,ku(e,t)),t=!1;var o=$l;a:do try{if(ql!==0&&B!==null){var s=B,c=Jl;switch(ql){case 8:Ou(),o=6;break a;case 3:case 2:case 9:case 6:ao.current===null&&(t=!0);var l=ql;if(ql=0,Jl=null,Vu(e,s,c,l),n&&Xl){o=0;break a}break;default:l=ql,ql=0,Jl=null,Vu(e,s,c,l)}}Iu(),o=$l;break}catch(t){Au(e,t)}while(1);return t&&e.shellSuspendCounter++,Xi=I=null,z=r,T.H=i,T.A=a,B===null&&(Kl=null,V=0,oi()),o}function Iu(){for(;B!==null;)zu(B)}function Lu(e,t){var n=z;z|=2;var r=Mu(),a=Nu();Kl!==e||V!==t?(du=null,uu=Me()+500,ku(e,t)):Xl=A(e,t);a:do try{if(ql!==0&&B!==null){t=B;var o=Jl;b:switch(ql){case 1:ql=0,Jl=null,Vu(e,t,o,1);break;case 2:case 9:if(Oa(o)){ql=0,Jl=null,Bu(t);break}t=function(){ql!==2&&ql!==9||Kl!==e||(ql=7),ud(e)},o.then(t,t);break a;case 3:ql=7;break a;case 4:ql=5;break a;case 7:Oa(o)?(ql=0,Jl=null,Bu(t)):(ql=0,Jl=null,Vu(e,t,o,7));break;case 5:var s=null;switch(B.tag){case 26:s=B.memoizedState;case 5:case 27:var c=B;if(s?Zf(s):c.stateNode.complete){ql=0,Jl=null;var l=c.sibling;if(l!==null)B=l;else{var u=c.return;u===null?B=null:(B=u,Hu(u))}break b}}ql=0,Jl=null,Vu(e,t,o,5);break;case 6:ql=0,Jl=null,Vu(e,t,o,6);break;case 8:Ou(),$l=6;break a;default:throw Error(i(462))}}Ru();break}catch(t){Au(e,t)}while(1);return Xi=I=null,T.H=r,T.A=a,z=n,B===null?(Kl=null,V=0,oi(),$l):0}function Ru(){for(;B!==null&&!Ae();)zu(B)}function zu(e){var t=Lc(e.alternate,e,Ql);e.memoizedProps=e.pendingProps,t===null?Hu(e):B=t}function Bu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=xc(n,t,t.pendingProps,t.type,void 0,V);break;case 11:t=xc(n,t,t.pendingProps,t.type.render,t.ref,V);break;case 5:No(t);default:Kc(n,t),t=B=gi(t,Ql),t=Lc(n,t,Ql)}e.memoizedProps=e.pendingProps,t===null?Hu(e):B=t}function Vu(e,t,n,r){Xi=I=null,No(t),Pa=null,Fa=0;var i=t.return;try{if(oc(e,i,t,n,V)){$l=1,tc(e,Ci(n,e.current)),B=null;return}}catch(t){if(i!==null)throw B=i,t;$l=1,tc(e,Ci(n,e.current)),B=null;return}t.flags&32768?(P||r===1?e=!0:Xl||V&536870912?e=!1:(Yl=e=!0,(r===2||r===9||r===3||r===6)&&(r=ao.current,r!==null&&r.tag===13&&(r.flags|=16384))),Uu(t,e)):Hu(t)}function Hu(e){var t=e;do{if(t.flags&32768){Uu(t,Yl);return}e=t.return;var n=Wc(t.alternate,t,Ql);if(n!==null){B=n;return}if(t=t.sibling,t!==null){B=t;return}B=t=e}while(t!==null);$l===0&&($l=5)}function Uu(e,t){do{var n=Gc(e.alternate,e);if(n!==null){n.flags&=32767,B=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){B=e;return}B=e=n}while(e!==null);$l=6,B=null}function Wu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Yu();while(H!==0);if(z&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=ai,rt(e,n,o,s,c,l),e===Kl&&(B=Kl=null,V=0),mu=t,pu=e,U=n,hu=o,gu=a,_u=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,rd(Ie,function(){return Xu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=T.T,T.T=null,a=E.p,E.p=2,s=z,z|=4;try{dl(e,t,n)}finally{z=s,E.p=a,T.T=r}}H=1,Gu(),Ku(),qu()}}function Gu(){if(H===1){H=0;var e=pu,t=mu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=T.T,T.T=null;var r=E.p;E.p=2;var i=z;z|=4;try{wl(t,e);var a=Kd,o=Fr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Pr(s.ownerDocument.documentElement,s)){if(c!==null&&Ir(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Nr(s,h),v=Nr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}pp=!!Gd,Kd=Gd=null}finally{z=i,E.p=r,T.T=n}}e.current=t,H=2}}function Ku(){if(H===2){H=0;var e=pu,t=mu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=T.T,T.T=null;var r=E.p;E.p=2;var i=z;z|=4;try{fl(e,t.alternate,t)}finally{z=i,E.p=r,T.T=n}}H=3}}function qu(){if(H===4||H===3){H=0,je();var e=pu,t=mu,n=U,r=_u;t.subtreeFlags&10256||t.flags&10256?H=5:(H=0,mu=pu=null,Ju(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(fu=null),ct(n),t=t.stateNode,He&&typeof He.onCommitFiberRoot==`function`)try{He.onCommitFiberRoot(Ve,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=T.T,i=E.p,E.p=2,T.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{T.T=t,E.p=i}}U&3&&Yu(),ud(e),i=e.pendingLanes,n&261930&&i&42?e===yu?vu++:(vu=0,yu=e):vu=0,dd(0,!1)}}function Ju(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,fa(t)))}function Yu(){return Gu(),Ku(),qu(),Xu()}function Xu(){if(H!==5)return!1;var e=pu,t=hu;hu=0;var n=ct(U),r=T.T,a=E.p;try{E.p=32>n?32:n,T.T=null,n=gu,gu=null;var o=pu,s=U;if(H=0,mu=pu=null,U=0,z&6)throw Error(i(331));var c=z;if(z|=4,Vl(o.current),Nl(o,o.current,s,n),z=c,dd(0,!1),He&&typeof He.onPostCommitFiberRoot==`function`)try{He.onPostCommitFiberRoot(Ve,o)}catch{}return!0}finally{E.p=a,T.T=r,Ju(e,t)}}function Zu(e,t,n){t=Ci(n,t),t=rc(e.stateNode,t,2),e=Ka(e,t,2),e!==null&&(nt(e,2),ud(e))}function W(e,t,n){if(e.tag===3)Zu(e,e,n);else for(;t!==null;){if(t.tag===3){Zu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(fu===null||!fu.has(r))){e=Ci(n,e),n=ic(2),r=Ka(t,n,2),r!==null&&(ac(n,r,t,e),nt(r,2),ud(r));break}}t=t.return}}function Qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Zl=!0,i.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Kl===e&&(V&n)===n&&($l===4||$l===3&&(V&62914560)===V&&300>Me()-cu?!(z&2)&&ku(e,0):nu|=n,iu===V&&(iu=0)),ud(e)}function ed(e,t){t===0&&(t=et()),e=ci(e,t),e!==null&&(nt(e,t),ud(e))}function td(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ed(e,n)}function nd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),ed(e,n)}function rd(e,t){return Oe(e,t)}var id=null,ad=null,od=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==ad&&e.next===null&&(ad===null?id=ad=e:ad=ad.next=e),sd=!0,od||(od=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=id;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-We(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=V,a=k(r,r===Kl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||A(r,a)||(n=!0,gd(r,a));r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=od=!1;var e=0;ld!==0&&Qd()&&(e=ld);for(var t=Me(),n=null,r=id;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?id=i:n.next=i,i===null&&(ad=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}H!==0&&H!==5||dd(e,!1),ld!==0&&(ld=0)}function md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-We(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=$e(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Kl,n=V,n=k(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ql===2||ql===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ke(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||A(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ke(r),ct(n)){case 2:case 8:n=Fe;break;case 32:n=Ie;break;case 268435456:n=Re;break;default:n=Ie}return r=hd.bind(null,e),n=Oe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ke(r),e.callbackPriority=2,e.callbackNode=null,2}function hd(e,t){if(H!==0&&H!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Yu()&&e.callbackNode!==n)return null;var r=V;return r=k(e,e===Kl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Cu(e,r,t),md(e,Me()),e.callbackNode!=null&&e.callbackNode===n?hd.bind(null,e):null)}function gd(e,t){if(Yu())return null;Cu(e,t,!0)}function _d(){nf(function(){z&6?Oe(Pe,fd):pd()})}function vd(){if(ld===0){var e=ha;e===0&&(e=Je,Je<<=1,!(Je&261888)&&(Je=256)),ld=e}return ld}function yd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:an(``+e)}function bd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function xd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=yd((i[pt]||null).action),o=r.submitter;o&&(t=(t=o[pt]||null)?yd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Dn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ld!==0){var e=o?bd(i,o):new FormData(i);ks(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?bd(i,o):new FormData(i),ks(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Sd=0;Sd<j.length;Sd++){var Cd=j[Sd];ni(Cd.toLowerCase(),`on`+(Cd[0].toUpperCase()+Cd.slice(1)))}ni(Jr,`onAnimationEnd`),ni(Yr,`onAnimationIteration`),ni(Xr,`onAnimationStart`),ni(`dblclick`,`onDoubleClick`),ni(`focusin`,`onFocus`),ni(`focusout`,`onBlur`),ni(Zr,`onTransitionRun`),ni(Qr,`onTransitionStart`),ni($r,`onTransitionCancel`),ni(ei,`onTransitionEnd`),kt(`onMouseEnter`,[`mouseout`,`mouseover`]),kt(`onMouseLeave`,[`mouseout`,`mouseover`]),kt(`onPointerEnter`,[`pointerout`,`pointerover`]),kt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ot(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ot(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ot(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ot(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var wd=`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(` `),Td=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(wd));function Ed(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){M(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){M(e)}i.currentTarget=null,a=c}}}}function G(e,t){var n=t[ht];n===void 0&&(n=t[ht]=new Set);var r=e+`__bubble`;n.has(r)||(Ad(t,e,2,!1),n.add(r))}function Dd(e,t,n){var r=0;t&&(r|=4),Ad(n,e,r,t)}var Od=`_reactListening`+Math.random().toString(36).slice(2);function kd(e){if(!e[Od]){e[Od]=!0,Et.forEach(function(t){t!==`selectionchange`&&(Td.has(t)||Dd(t,!1,e),Dd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Od]||(t[Od]=!0,Dd(`selectionchange`,!1,t))}}function Ad(e,t,n,r){switch(bp(t)){case 2:var i=mp;break;case 8:i=hp;break;default:i=gp}n=i.bind(null,t,n,e),i=void 0,!gn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function jd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=xt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}pn(function(){var r=a,i=cn(n),s=[];a:{var c=ti.get(e);if(c!==void 0){var l=Dn,u=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:l=Gn;break;case`focusin`:u=`focus`,l=In;break;case`focusout`:u=`blur`,l=In;break;case`beforeblur`:case`afterblur`:l=In;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=qn;break;case Jr:case Yr:case Xr:l=Ln;break;case ei:l=Jn;break;case`scroll`:case`scrollend`:l=kn;break;case`wheel`:l=Yn;break;case`copy`:case`cut`:case`paste`:l=Rn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Kn;break;case`toggle`:case`beforetoggle`:l=Xn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=mn(m,p),g!=null&&d.push(Md(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==sn&&(u=n.relatedTarget||n.fromElement)&&(xt(u)||u[mt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?xt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Pn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Kn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:Ct(l),h=u==null?c:Ct(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,xt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Pd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?Ct(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=_r;else if(ur(c))if(yr)v=Or;else{v=Er;var y=Tr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&tn(r.elementType)&&(v=_r):v=Dr;if(v&&=v(e,r)){dr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&qt(c,`number`,c.value)}switch(y=r?Ct(r):window,e){case`focusin`:(ur(y)||y.contentEditable===`true`)&&(Rr=y,zr=r,Br=null);break;case`focusout`:Br=zr=Rr=null;break;case`mousedown`:Vr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Vr=!1,Hr(s,n,i);break;case`selectionchange`:if(Lr)break;case`keydown`:case`keyup`:Hr(s,n,i)}var b;if(Qn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else or?ir(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(tr&&n.locale!==`ko`&&(or||x!==`onCompositionStart`?x===`onCompositionEnd`&&or&&(b=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,or=!0)),y=Nd(r,x),0<y.length&&(x=new zn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=ar(n),b!==null&&(x.data=b)))),(b=er?sr(e,n):cr(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),xd(s,e,r,n,i)}Ed(s,t)})}function Md(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=mn(e,n),i!=null&&r.unshift(Md(e,i,a)),i=mn(e,t),i!=null&&r.push(Md(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=mn(n,a),l!=null&&o.unshift(Md(n,l,c))):i||(l=mn(n,a),l!=null&&o.push(Md(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
8
+ `+e.stack}}var De=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,ke=t.unstable_cancelCallback,Ae=t.unstable_shouldYield,je=t.unstable_requestPaint,Me=t.unstable_now,Ne=t.unstable_getCurrentPriorityLevel,Pe=t.unstable_ImmediatePriority,Fe=t.unstable_UserBlockingPriority,Ie=t.unstable_NormalPriority,Le=t.unstable_LowPriority,Re=t.unstable_IdlePriority,ze=t.log,Be=t.unstable_setDisableYieldValue,Ve=null,He=null;function Ue(e){if(typeof ze==`function`&&Be(e),He&&typeof He.setStrictMode==`function`)try{He.setStrictMode(Ve,e)}catch{}}var We=Math.clz32?Math.clz32:qe,Ge=Math.log,Ke=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(Ge(e)/Ke|0)|0}var Je=256,Ye=262144,Ze=4194304;function Qe(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function k(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Qe(n))):i=Qe(o):i=Qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Qe(n))):i=Qe(o)):i=Qe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function A(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $e(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 et(){var e=Ze;return Ze<<=1,!(Ze&62914560)&&(Ze=4194304),e}function tt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-We(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&it(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function it(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-We(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function at(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-We(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ot(e,t){var n=t&-t;return n=n&42?1:st(n),(n&(e.suspendedLanes|t))===0?n:0}function st(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ct(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function lt(){var e=E.p;return e===0?(e=window.event,e===void 0?32:bp(e.type)):e}function ut(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var dt=Math.random().toString(36).slice(2),ft=`__reactFiber$`+dt,pt=`__reactProps$`+dt,mt=`__reactContainer$`+dt,ht=`__reactEvents$`+dt,gt=`__reactListeners$`+dt,_t=`__reactHandles$`+dt,vt=`__reactResources$`+dt,yt=`__reactMarker$`+dt;function bt(e){delete e[ft],delete e[pt],delete e[ht],delete e[gt],delete e[_t]}function xt(e){var t=e[ft];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mt]||n[ft]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vf(e);e!==null;){if(n=e[ft])return n;e=vf(e)}return t}e=n,n=e.parentNode}return null}function St(e){if(e=e[ft]||e[mt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function wt(e){var t=e[vt];return t||=e[vt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Tt(e){e[yt]=!0}var Et=new Set,Dt={};function Ot(e,t){kt(e,t),kt(e+`Capture`,t)}function kt(e,t){for(Dt[e]=t,e=0;e<t.length;e++)Et.add(t[e])}var At=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]*$`),jt={},Mt={};function Nt(e){return De.call(Mt,e)?!0:De.call(jt,e)?!1:At.test(e)?Mt[e]=!0:(jt[e]=!0,!1)}function Pt(e,t,n){if(Nt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ft(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function It(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Lt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Rt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function zt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Bt(e){if(!e._valueTracker){var t=Rt(e)?`checked`:`value`;e._valueTracker=zt(e,t,``+e[t])}}function Vt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Rt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ht(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ut=/[\n"\\]/g;function Wt(e){return e.replace(Ut,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Gt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Lt(t)):e.value!==``+Lt(t)&&(e.value=``+Lt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):qt(e,o,Lt(n)):qt(e,o,Lt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Lt(s):e.removeAttribute(`name`)}function Kt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Bt(e);return}n=n==null?``:``+Lt(n),t=t==null?n:``+Lt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Bt(e)}function qt(e,t,n){t===`number`&&Ht(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Jt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Lt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Yt(e,t,n){if(t!=null&&(t=``+Lt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Lt(n)}function Xt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(se(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Lt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Bt(e)}function Zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Qt=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 $t(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Qt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function en(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&$t(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&$t(e,o,t[o])}function tn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){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 nn=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`]]),rn=/^[\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 an(e){return rn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function on(){}var sn=null;function cn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ln=null,un=null;function dn(e){var t=St(e);if(t&&(e=t.stateNode)){var n=e[pt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Gt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Wt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[pt]||null;if(!a)throw Error(i(90));Gt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Vt(r)}break a;case`textarea`:Yt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Jt(e,!!n.multiple,t,!1)}}}var fn=!1;function pn(e,t,n){if(fn)return e(t,n);fn=!0;try{return e(t)}finally{if(fn=!1,(ln!==null||un!==null)&&(Du(),ln&&(t=ln,e=un,un=ln=null,dn(t),e)))for(t=0;t<e.length;t++)dn(e[t])}}function mn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[pt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var hn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),gn=!1;if(hn)try{var _n={};Object.defineProperty(_n,"passive",{get:function(){gn=!0}}),window.addEventListener(`test`,_n,_n),window.removeEventListener(`test`,_n,_n)}catch{gn=!1}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Cn(){return!0}function wn(){return!1}function Tn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Cn:wn,this.isPropagationStopped=wn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Cn)},persist:function(){},isPersistent:Cn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=Tn(En),On=f({},En,{view:0,detail:0}),kn=Tn(On),An,jn,Mn,Nn=f({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=Tn(Nn),Fn=Tn(f({},Nn,{dataTransfer:0})),In=Tn(f({},On,{relatedTarget:0})),Ln=Tn(f({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Rn=Tn(f({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),zn=Tn(f({},En,{data:0})),Bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Vn={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`},Hn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Un(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hn[e])?!!t[e]:!1}function Wn(){return Un}var Gn=Tn(f({},On,{key:function(e){if(e.key){var t=Bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Vn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wn,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Kn=Tn(f({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qn=Tn(f({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wn})),Jn=Tn(f({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),Yn=Tn(f({},Nn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Xn=Tn(f({},En,{newState:0,oldState:0})),Zn=[9,13,27,32],Qn=hn&&`CompositionEvent`in window,$n=null;hn&&`documentMode`in document&&($n=document.documentMode);var er=hn&&`TextEvent`in window&&!$n,tr=hn&&(!Qn||$n&&8<$n&&11>=$n),nr=` `,rr=!1;function ir(e,t){switch(e){case`keyup`:return Zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ar(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var or=!1;function sr(e,t){switch(e){case`compositionend`:return ar(t);case`keypress`:return t.which===32?(rr=!0,nr):null;case`textInput`:return e=t.data,e===nr&&rr?null:e;default:return null}}function cr(e,t){if(or)return e===`compositionend`||!Qn&&ir(e,t)?(e=xn(),bn=yn=vn=null,or=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return tr&&t.locale!==`ko`?null:t.data;default:return null}}var lr={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 ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!lr[e.type]:t===`textarea`}function dr(e,t,n,r){ln?un?un.push(r):un=[r]:ln=r,t=Nd(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var fr=null,pr=null;function mr(e){Ed(e,0)}function hr(e){if(Vt(Ct(e)))return e}function _r(e,t){if(e===`change`)return t}var yr=!1;if(hn){var br;if(hn){var xr=`oninput`in document;if(!xr){var Sr=document.createElement(`div`);Sr.setAttribute(`oninput`,`return;`),xr=typeof Sr.oninput==`function`}br=xr}else br=!1;yr=br&&(!document.documentMode||9<document.documentMode)}function Cr(){fr&&(fr.detachEvent(`onpropertychange`,wr),pr=fr=null)}function wr(e){if(e.propertyName===`value`&&hr(pr)){var t=[];dr(t,pr,e,cn(e)),pn(mr,t)}}function Tr(e,t,n){e===`focusin`?(Cr(),fr=t,pr=n,fr.attachEvent(`onpropertychange`,wr)):e===`focusout`&&Cr()}function Er(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return hr(pr)}function Dr(e,t){if(e===`click`)return hr(t)}function Or(e,t){if(e===`input`||e===`change`)return hr(t)}function kr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ar=typeof Object.is==`function`?Object.is:kr;function jr(e,t){if(Ar(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!De.call(t,i)||!Ar(e[i],t[i]))return!1}return!0}function Mr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nr(e,t){var n=Mr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Mr(n)}}function Pr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ht(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ht(e.document)}return t}function Ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Lr=hn&&`documentMode`in document&&11>=document.documentMode,Rr=null,zr=null,Br=null,Vr=!1;function Hr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vr||Rr==null||Rr!==Ht(r)||(r=Rr,`selectionStart`in r&&Ir(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Br&&jr(Br,r)||(Br=r,r=Nd(zr,`onSelect`),0<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Rr)))}function Ur(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Wr={animationend:Ur(`Animation`,`AnimationEnd`),animationiteration:Ur(`Animation`,`AnimationIteration`),animationstart:Ur(`Animation`,`AnimationStart`),transitionrun:Ur(`Transition`,`TransitionRun`),transitionstart:Ur(`Transition`,`TransitionStart`),transitioncancel:Ur(`Transition`,`TransitionCancel`),transitionend:Ur(`Transition`,`TransitionEnd`)},Gr={},Kr={};hn&&(Kr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),`TransitionEvent`in window||delete Wr.transitionend.transition);function qr(e){if(Gr[e])return Gr[e];if(!Wr[e])return e;var t=Wr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Kr)return Gr[e]=t[n];return e}var Jr=qr(`animationend`),Yr=qr(`animationiteration`),Xr=qr(`animationstart`),Zr=qr(`transitionrun`),Qr=qr(`transitionstart`),$r=qr(`transitioncancel`),ei=qr(`transitionend`),ti=new Map,j=`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(` `);j.push(`scrollEnd`);function ni(e,t){ti.set(e,t),Ot(t,[e])}var M=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ri=[],ii=0,ai=0;function oi(){for(var e=ii,t=ai=ii=0;t<e;){var n=ri[t];ri[t++]=null;var r=ri[t];ri[t++]=null;var i=ri[t];ri[t++]=null;var a=ri[t];if(ri[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&li(n,i,a)}}function N(e,t,n,r){ri[ii++]=e,ri[ii++]=t,ri[ii++]=n,ri[ii++]=r,ai|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function si(e,t,n,r){return N(e,t,n,r),ui(e)}function ci(e,t){return N(e,null,null,t),ui(e)}function li(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-We(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ui(e){if(50<vu)throw vu=0,yu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var di={};function fi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pi(e,t,n,r){return new fi(e,t,n,r)}function mi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hi(e,t){var n=e.alternate;return n===null?(n=pi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function gi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function _i(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)mi(e)&&(s=1);else if(typeof e==`string`)s=Xf(e,n,pe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ne:return e=pi(31,n,t,a),e.elementType=ne,e.lanes=o,e;case g:return vi(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=pi(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=pi(13,n,t,a),e.elementType=S,e.lanes=o,e;case ee:return e=pi(19,n,t,a),e.elementType=ee,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case C:s=14;break a;case te:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=pi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function vi(e,t,n,r){return e=pi(7,e,r,t),e.lanes=n,e}function yi(e,t,n){return e=pi(6,e,null,t),e.lanes=n,e}function bi(e){var t=pi(18,null,null,0);return t.stateNode=e,t}function xi(e,t,n){return t=pi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Si=new WeakMap;function Ci(e,t){if(typeof e==`object`&&e){var n=Si.get(e);return n===void 0?(t={value:e,source:t,stack:Ee(t)},Si.set(e,t),t):n}return{value:e,source:t,stack:Ee(t)}}var wi=[],Ti=0,Ei=null,Di=0,Oi=[],ki=0,Ai=null,ji=1,Mi=``;function Ni(e,t){wi[Ti++]=Di,wi[Ti++]=Ei,Ei=e,Di=t}function Pi(e,t,n){Oi[ki++]=ji,Oi[ki++]=Mi,Oi[ki++]=Ai,Ai=e;var r=ji;e=Mi;var i=32-We(r)-1;r&=~(1<<i),n+=1;var a=32-We(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ji=1<<32-We(t)+i|n<<i|r,Mi=a+e}else ji=1<<a|n<<i|r,Mi=e}function Fi(e){e.return!==null&&(Ni(e,1),Pi(e,1,0))}function Ii(e){for(;e===Ei;)Ei=wi[--Ti],wi[Ti]=null,Di=wi[--Ti],wi[Ti]=null;for(;e===Ai;)Ai=Oi[--ki],Oi[ki]=null,Mi=Oi[--ki],Oi[ki]=null,ji=Oi[--ki],Oi[ki]=null}function Li(e,t){Oi[ki++]=ji,Oi[ki++]=Mi,Oi[ki++]=Ai,ji=t.id,Mi=t.overflow,Ai=e}var Ri=null,zi=null,P=!1,Bi=null,F=!1,Vi=Error(i(519));function Hi(e){throw Ji(Ci(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Vi}function Ui(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ft]=e,t[pt]=r,n){case`dialog`:G(`cancel`,t),G(`close`,t);break;case`iframe`:case`object`:case`embed`:G(`load`,t);break;case`video`:case`audio`:for(n=0;n<wd.length;n++)G(wd[n],t);break;case`source`:G(`error`,t);break;case`img`:case`image`:case`link`:G(`error`,t),G(`load`,t);break;case`details`:G(`toggle`,t);break;case`input`:G(`invalid`,t),Kt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:G(`invalid`,t);break;case`textarea`:G(`invalid`,t),Xt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||zd(t.textContent,n)?(r.popover!=null&&(G(`beforetoggle`,t),G(`toggle`,t)),r.onScroll!=null&&G(`scroll`,t),r.onScrollEnd!=null&&G(`scrollend`,t),r.onClick!=null&&(t.onclick=on),t=!0):t=!1,t||Hi(e,!0)}function Wi(e){for(Ri=e.return;Ri;)switch(Ri.tag){case 5:case 31:case 13:F=!1;return;case 27:case 3:F=!0;return;default:Ri=Ri.return}}function Gi(e){if(e!==Ri)return!1;if(!P)return Wi(e),P=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Xd(e.type,e.memoizedProps)),n=!n),n&&zi&&Hi(e),Wi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));zi=_f(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));zi=_f(e)}else t===27?(t=zi,af(e.type)?(e=gf,gf=null,zi=e):zi=t):zi=Ri?hf(e.stateNode.nextSibling):null;return!0}function Ki(){zi=Ri=null,P=!1}function qi(){var e=Bi;return e!==null&&(ou===null?ou=e:ou.push.apply(ou,e),Bi=null),e}function Ji(e){Bi===null?Bi=[e]:Bi.push(e)}var Yi=de(null),I=null,Xi=null;function Zi(e,t,n){D(Yi,t._currentValue),t._currentValue=n}function Qi(e){e._currentValue=Yi.current,fe(Yi)}function $i(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ea(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),$i(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),$i(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ta(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Ar(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===O.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ip]:e.push(ip))}a=a.return}e!==null&&ea(t,e,n,r),t.flags|=262144}function na(e){for(e=e.firstContext;e!==null;){if(!Ar(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ra(e){I=e,Xi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ia(e){return oa(I,e)}function aa(e,t){return I===null&&ra(e),oa(e,t)}function oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Xi===null){if(e===null)throw Error(i(308));Xi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xi=Xi.next=t;return n}var sa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ca=t.unstable_scheduleCallback,la=t.unstable_NormalPriority,ua={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function da(){return{controller:new sa,data:new Map,refCount:0}}function fa(e){e.refCount--,e.refCount===0&&ca(la,function(){e.controller.abort()})}var pa=null,ma=0,ha=0,ga=null;function _a(e,t){if(pa===null){var n=pa=[];ma=0,ha=vd(),ga={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ma++,t.then(va,va),t}function va(){if(--ma===0&&pa!==null){ga!==null&&(ga.status=`fulfilled`);var e=pa;pa=null,ha=0,ga=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ya(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var L=T.S;T.S=function(e,t){lu=Me(),typeof t==`object`&&t&&typeof t.then==`function`&&_a(e,t),L!==null&&L(e,t)};var ba=de(null);function xa(){var e=ba.current;return e===null?Kl.pooledCache:e}function Sa(e,t){t===null?D(ba,ba.current):D(ba,t.pool)}function Ca(){var e=xa();return e===null?null:{parent:ua._currentValue,pool:e}}var wa=Error(i(460)),Ta=Error(i(474)),Ea=Error(i(542)),Da={then:function(){}};function Oa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ka(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(on,on),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Na(e),e;default:if(typeof t.status==`string`)t.then(on,on);else{if(e=Kl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Na(e),e}throw ja=t,wa}}function Aa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ja=e,wa):e}}var ja=null;function Ma(){if(ja===null)throw Error(i(459));var e=ja;return ja=null,e}function Na(e){if(e===wa||e===Ea)throw Error(i(483))}var Pa=null,Fa=0;function Ia(e){var t=Fa;return Fa+=1,Pa===null&&(Pa=[]),ka(Pa,e,t)}function La(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ra(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function za(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=hi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=yi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===te&&Aa(i)===t.type)?(t=a(t,n.props),La(t,n),t.return=e,t):(t=_i(n.type,n.key,n.props,null,e.mode,r),La(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=xi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=vi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=yi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=_i(t.type,t.key,t.props,null,e.mode,n),La(n,t),n.return=e,n;case h:return t=xi(t,e.mode,n),t.return=e,t;case te:return t=Aa(t),f(e,t,n)}if(se(t)||ie(t))return t=vi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ia(t),n);if(t.$$typeof===b)return f(e,aa(e,t),n);Ra(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case te:return n=Aa(n),p(e,t,n,r)}if(se(n)||ie(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ia(n),r);if(n.$$typeof===b)return p(e,t,aa(e,n),r);Ra(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case te:return r=Aa(r),_(e,t,n,r,i)}if(se(r)||ie(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Ia(r),i);if(r.$$typeof===b)return _(e,t,n,aa(t,r),i);Ra(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),P&&Ni(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return P&&Ni(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),P&&Ni(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),P&&Ni(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return P&&Ni(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),P&&Ni(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===te&&Aa(l)===r.type){n(e,r.sibling),c=a(r,o.props),La(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=vi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=_i(o.type,o.key,o.props,null,e.mode,c),La(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=xi(o,e.mode,c),c.return=e,e=c}return s(e);case te:return o=Aa(o),x(e,r,o,c)}if(se(o))return v(e,r,o,c);if(ie(o)){if(l=ie(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Ia(o),c);if(o.$$typeof===b)return x(e,r,aa(e,o),c);Ra(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=yi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Fa=0;var i=x(e,t,n,r);return Pa=null,i}catch(t){if(t===wa||t===Ea)throw t;var a=pi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ba=za(!0),Va=za(!1),Ha=!1;function Ua(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ga(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ka(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,z&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ui(e),li(e,null,n),t}return N(e,r,t,n),ui(e)}function qa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}function Ja(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ya=!1;function Xa(){if(Ya){var e=ga;if(e!==null)throw e}}function Za(e,t,n,r){Ya=!1;var i=e.updateQueue;Ha=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(V&p)===p:(r&p)===p){p!==0&&p===ha&&(Ya=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ha=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),eu|=o,e.lanes=o,e.memoizedState=d}}function Qa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function $a(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Qa(n[e],t)}var eo=de(null),to=de(0);function no(e,t){e=Ql,D(to,e),D(eo,t),Ql=e|t.baseLanes}function ro(){D(to,Ql),D(eo,eo.current)}function io(){Ql=to.current,fe(eo),fe(to)}var ao=de(null),oo=null;function so(e){var t=e.alternate;D(po,po.current&1),D(ao,e),oo===null&&(t===null||eo.current!==null||t.memoizedState!==null)&&(oo=e)}function co(e){D(po,po.current),D(ao,e),oo===null&&(oo=e)}function lo(e){e.tag===22?(D(po,po.current),D(ao,e),oo===null&&(oo=e)):uo(e)}function uo(){D(po,po.current),D(ao,ao.current)}function fo(e){fe(ao),oo===e&&(oo=null),fe(po)}var po=de(0);function mo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ff(n)||pf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=0,R=null,go=null,_o=null,vo=!1,yo=!1,bo=!1,xo=0,So=0,Co=null,wo=0;function To(){throw Error(i(321))}function Eo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ar(e[n],t[n]))return!1;return!0}function Do(e,t,n,r,i,a){return ho=a,R=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?Ws:Gs,bo=!1,a=n(r,i),bo=!1,yo&&(a=ko(t,n,r,i)),Oo(e),a}function Oo(e){T.H=Us;var t=go!==null&&go.next!==null;if(ho=0,_o=go=R=null,vo=!1,So=0,Co=null,t)throw Error(i(300));e===null||cc||(e=e.dependencies,e!==null&&na(e)&&(cc=!0))}function ko(e,t,n,r){R=e;var a=0;do{if(yo&&(Co=null),So=0,yo=!1,25<=a)throw Error(i(301));if(a+=1,_o=go=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}T.H=Ks,o=t(n,r)}while(yo);return o}function Ao(){var e=T.H,t=e.useState()[0];return t=typeof t.then==`function`?Lo(t):t,e=e.useState()[0],(go===null?null:go.memoizedState)!==e&&(R.flags|=1024),t}function jo(){var e=xo!==0;return xo=0,e}function Mo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function No(e){if(vo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}vo=!1}ho=0,_o=go=R=null,yo=!1,So=xo=0,Co=null}function Po(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _o===null?R.memoizedState=_o=e:_o=_o.next=e,_o}function Fo(){if(go===null){var e=R.alternate;e=e===null?null:e.memoizedState}else e=go.next;var t=_o===null?R.memoizedState:_o.next;if(t!==null)_o=t,go=e;else{if(e===null)throw R.alternate===null?Error(i(467)):Error(i(310));go=e,e={memoizedState:go.memoizedState,baseState:go.baseState,baseQueue:go.baseQueue,queue:go.queue,next:null},_o===null?R.memoizedState=_o=e:_o=_o.next=e}return _o}function Io(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lo(e){var t=So;return So+=1,Co===null&&(Co=[]),e=ka(Co,e,t),t=R,(_o===null?t.memoizedState:_o.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?Ws:Gs),e}function Ro(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Lo(e);if(e.$$typeof===b)return ia(e)}throw Error(i(438,String(e)))}function zo(e){var t=null,n=R.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=R.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Io(),R.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=w;return t.index++,n}function Bo(e,t){return typeof t==`function`?t(e):t}function Vo(e){return Ho(Fo(),go,e)}function Ho(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ho&f)===f:(V&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ha&&(d=!0);else if((ho&p)===p){u=u.next,p===ha&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,R.lanes|=p,eu|=p;f=u.action,bo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,R.lanes|=f,eu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Ar(o,e.memoizedState)&&(cc=!0,d&&(n=ga,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Uo(e){var t=Fo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Ar(o,t.memoizedState)||(cc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Wo(e,t,n){var r=R,a=Fo(),o=P;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Ar((go||a).memoizedState,n);if(s&&(a.memoizedState=n,cc=!0),a=a.queue,hs(qo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||_o!==null&&_o.memoizedState.tag&1){if(r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,a,n,t),null),Kl===null)throw Error(i(349));o||ho&127||Go(r,t,n)}return n}function Go(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=R.updateQueue,t===null?(t=Io(),R.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ko(e,t,n,r){t.value=n,t.getSnapshot=r,Jo(t)&&Yo(e)}function qo(e,t,n){return n(function(){Jo(t)&&Yo(e)})}function Jo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ar(e,n)}catch{return!0}}function Yo(e){var t=ci(e,2);t!==null&&Su(t,e,2)}function Xo(e){var t=Po();if(typeof e==`function`){var n=e;if(e=n(),bo){Ue(!0);try{n()}finally{Ue(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:e},t}function Zo(e,t,n,r){return e.baseState=n,Ho(e,go,typeof r==`function`?r:Bo)}function Qo(e,t,n,r,a){if(Bs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};T.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,$o(t,o)):(o.next=n.next,t.pending=n.next=o)}}function $o(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=T.T,o={};T.T=o;try{var s=n(i,r),c=T.S;c!==null&&c(o,s),es(e,t,s)}catch(n){ns(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),T.T=a}}else try{a=n(i,r),es(e,t,a)}catch(n){ns(e,t,n)}}function es(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ts(e,t,n)},function(n){return ns(e,t,n)}):ts(e,t,n)}function ts(e,t,n){t.status=`fulfilled`,t.value=n,rs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$o(e,n)))}function ns(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,rs(t),t=t.next;while(t!==r)}e.action=null}function rs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function is(e,t){return t}function as(e,t){if(P){var n=Kl.formState;if(n!==null){a:{var r=R;if(P){if(zi){b:{for(var i=zi,a=F;i.nodeType!==8;){if(!a){i=null;break b}if(i=hf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){zi=hf(i.nextSibling),r=i.data===`F!`;break a}}Hi(r)}r=!1}r&&(t=n[0])}}return n=Po(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:t},n.queue=r,n=Ls.bind(null,R,r),r.dispatch=n,r=Xo(!1),a=zs.bind(null,R,!1,r.queue),r=Po(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Qo.bind(null,R,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function os(e){return ss(Fo(),go,e)}function ss(e,t,n){if(t=Ho(e,t,is)[0],e=Vo(Bo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Lo(t)}catch(e){throw e===wa?Ea:e}else r=t;t=Fo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(R.flags|=2048,us(9,{destroy:void 0},cs.bind(null,i,n),null)),[r,a,e]}function cs(e,t){e.action=t}function ls(e){var t=Fo(),n=go;if(n!==null)return ss(t,n,e);Fo(),t=t.memoizedState,n=Fo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function us(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=R.updateQueue,t===null&&(t=Io(),R.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ds(){return Fo().memoizedState}function fs(e,t,n,r){var i=Po();R.flags|=e,i.memoizedState=us(1|t,{destroy:void 0},n,r===void 0?null:r)}function ps(e,t,n,r){var i=Fo();r=r===void 0?null:r;var a=i.memoizedState.inst;go!==null&&r!==null&&Eo(r,go.memoizedState.deps)?i.memoizedState=us(t,a,n,r):(R.flags|=e,i.memoizedState=us(1|t,a,n,r))}function ms(e,t){fs(8390656,8,e,t)}function hs(e,t){ps(2048,8,e,t)}function gs(e){R.flags|=4;var t=R.updateQueue;if(t===null)t=Io(),R.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function _s(e){var t=Fo().memoizedState;return gs({ref:t,nextImpl:e}),function(){if(z&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function vs(e,t){return ps(4,2,e,t)}function ys(e,t){return ps(4,4,e,t)}function bs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xs(e,t,n){n=n==null?null:n.concat([e]),ps(4,4,bs.bind(null,t,e),n)}function Ss(){}function Cs(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Eo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ws(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Eo(t,r[1]))return r[0];if(r=e(),bo){Ue(!0);try{e()}finally{Ue(!1)}}return n.memoizedState=[r,t],r}function Ts(e,t,n){return n===void 0||ho&1073741824&&!(V&261930)?e.memoizedState=t:(e.memoizedState=n,e=xu(),R.lanes|=e,eu|=e,n)}function Es(e,t,n,r){return Ar(n,t)?n:eo.current===null?!(ho&42)||ho&1073741824&&!(V&261930)?(cc=!0,e.memoizedState=n):(e=xu(),R.lanes|=e,eu|=e,t):(e=Ts(e,n,r),Ar(e,t)||(cc=!0),e)}function Ds(e,t,n,r,i){var a=E.p;E.p=a!==0&&8>a?a:8;var o=T.T,s={};T.T=s,zs(e,!1,t,n);try{var c=i(),l=T.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Rs(e,t,ya(c,r),bu(e)):Rs(e,t,r,bu(e))}catch(n){Rs(e,t,{then:function(){},status:`rejected`,reason:n},bu())}finally{E.p=a,o!==null&&s.types!==null&&(o.types=s.types),T.T=o}}function Os(){}function ks(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=As(e).queue;Ds(e,a,t,ce,n===null?Os:function(){return js(e),n(r)})}function As(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:ce},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function js(e){var t=As(e);t.next===null&&(t=e.alternate.memoizedState),Rs(e,t.next.queue,{},bu())}function Ms(){return ia(ip)}function Ns(){return Fo().memoizedState}function Ps(){return Fo().memoizedState}function Fs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bu();e=Ga(n);var r=Ka(t,e,n);r!==null&&(Su(r,t,n),qa(r,t,n)),t={cache:da()},e.payload=t;return}t=t.return}}function Is(e,t,n){var r=bu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bs(e)?Vs(t,n):(n=si(e,t,n,r),n!==null&&(Su(n,e,r),Hs(n,t,r)))}function Ls(e,t,n){Rs(e,t,n,bu())}function Rs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bs(e))Vs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Ar(s,o))return N(e,t,i,0),Kl===null&&oi(),!1}catch{}if(n=si(e,t,i,r),n!==null)return Su(n,e,r),Hs(n,t,r),!0}return!1}function zs(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Bs(e)){if(t)throw Error(i(479))}else t=si(e,n,r,2),t!==null&&Su(t,e,2)}function Bs(e){var t=e.alternate;return e===R||t!==null&&t===R}function Vs(e,t){yo=vo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}var Us={readContext:ia,use:Ro,useCallback:To,useContext:To,useEffect:To,useImperativeHandle:To,useLayoutEffect:To,useInsertionEffect:To,useMemo:To,useReducer:To,useRef:To,useState:To,useDebugValue:To,useDeferredValue:To,useTransition:To,useSyncExternalStore:To,useId:To,useHostTransitionStatus:To,useFormState:To,useActionState:To,useOptimistic:To,useMemoCache:To,useCacheRefresh:To};Us.useEffectEvent=To;var Ws={readContext:ia,use:Ro,useCallback:function(e,t){return Po().memoizedState=[e,t===void 0?null:t],e},useContext:ia,useEffect:ms,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),fs(4194308,4,bs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fs(4194308,4,e,t)},useInsertionEffect:function(e,t){fs(4,2,e,t)},useMemo:function(e,t){var n=Po();t=t===void 0?null:t;var r=e();if(bo){Ue(!0);try{e()}finally{Ue(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Po();if(n!==void 0){var i=n(t);if(bo){Ue(!0);try{n(t)}finally{Ue(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Is.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=Po();return e={current:e},t.memoizedState=e},useState:function(e){e=Xo(e);var t=e.queue,n=Ls.bind(null,R,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ss,useDeferredValue:function(e,t){return Ts(Po(),e,t)},useTransition:function(){var e=Xo(!1);return e=Ds.bind(null,R,e.queue,!0,!1),Po().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=R,a=Po();if(P){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Kl===null)throw Error(i(349));V&127||Go(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ms(qo.bind(null,r,o,e),[e]),r.flags|=2048,us(9,{destroy:void 0},Ko.bind(null,r,o,n,t),null),n},useId:function(){var e=Po(),t=Kl.identifierPrefix;if(P){var n=Mi,r=ji;n=(r&~(1<<32-We(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=wo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ms,useFormState:as,useActionState:as,useOptimistic:function(e){var t=Po();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=zs.bind(null,R,!0,n),n.dispatch=t,[e,t]},useMemoCache:zo,useCacheRefresh:function(){return Po().memoizedState=Fs.bind(null,R)},useEffectEvent:function(e){var t=Po(),n={impl:e};return t.memoizedState=n,function(){if(z&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Gs={readContext:ia,use:Ro,useCallback:Cs,useContext:ia,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Vo,useRef:ds,useState:function(){return Vo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){return Es(Fo(),go.memoizedState,e,t)},useTransition:function(){var e=Vo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:os,useActionState:os,useOptimistic:function(e,t){return Zo(Fo(),go,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Gs.useEffectEvent=_s;var Ks={readContext:ia,use:Ro,useCallback:Cs,useContext:ia,useEffect:hs,useImperativeHandle:xs,useInsertionEffect:vs,useLayoutEffect:ys,useMemo:ws,useReducer:Uo,useRef:ds,useState:function(){return Uo(Bo)},useDebugValue:Ss,useDeferredValue:function(e,t){var n=Fo();return go===null?Ts(n,e,t):Es(n,go.memoizedState,e,t)},useTransition:function(){var e=Uo(Bo)[0],t=Fo().memoizedState;return[typeof e==`boolean`?e:Lo(e),t]},useSyncExternalStore:Wo,useId:Ns,useHostTransitionStatus:Ms,useFormState:ls,useActionState:ls,useOptimistic:function(e,t){var n=Fo();return go===null?(n.baseState=e,[e,n.queue.dispatch]):Zo(n,go,e,t)},useMemoCache:zo,useCacheRefresh:Ps};Ks.useEffectEvent=_s;function qs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Js={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ga(r);i.payload=t,n!=null&&(i.callback=n),t=Ka(e,i,r),t!==null&&(Su(t,e,r),qa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ga(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ka(e,i,r),t!==null&&(Su(t,e,r),qa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bu(),r=Ga(n);r.tag=2,t!=null&&(r.callback=t),t=Ka(e,r,n),t!==null&&(Su(t,e,n),qa(t,e,n))}};function Ys(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!jr(n,r)||!jr(i,a):!0}function Xs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Js.enqueueReplaceState(t,t.state,null)}function Zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Qs(e){M(e)}function $s(e){console.error(e)}function ec(e){M(e)}function tc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function nc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function rc(e,t,n){return n=Ga(n),n.tag=3,n.payload={element:null},n.callback=function(){tc(e,t)},n}function ic(e){return e=Ga(e),e.tag=3,e}function ac(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){nc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){nc(t,n,r),typeof i!=`function`&&(fu===null?fu=new Set([this]):fu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function oc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ta(t,n,a,!0),n=ao.current,n!==null){switch(n.tag){case 31:case 13:return oo===null?Pu():n.alternate===null&&$l===0&&($l=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Da?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Qu(e,r,a)),!1;case 22:return n.flags|=65536,r===Da?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Qu(e,r,a)),!1}throw Error(i(435,n.tag))}return Qu(e,r,a),Pu(),!1}if(P)return t=ao.current,t===null?(r!==Vi&&(t=Error(i(423),{cause:r}),Ji(Ci(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ci(r,n),a=rc(e.stateNode,r,a),Ja(e,a),$l!==4&&($l=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Vi&&(e=Error(i(422),{cause:r}),Ji(Ci(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ci(o,n),au===null?au=[o]:au.push(o),$l!==4&&($l=2),t===null)return!0;r=Ci(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=rc(n.stateNode,r,e),Ja(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(fu===null||!fu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ic(a),ac(a,e,n,r),Ja(n,a),!1}n=n.return}while(n!==null);return!1}var sc=Error(i(461)),cc=!1;function lc(e,t,n,r){t.child=e===null?Va(t,null,n,r):Ba(t,e.child,n,r)}function uc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ra(t),r=Do(e,t,n,o,a,i),s=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(P&&s&&Fi(t),t.flags|=1,lc(e,t,r,i),t.child)}function dc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!mi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,fc(e,t,a,r,i)):(e=_i(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Fc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?jr:n,n(o,r)&&e.ref===t.ref)return Pc(e,t,i)}return t.flags|=1,e=hi(a,r),e.ref=t.ref,e.return=t,t.child=e}function fc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(jr(a,r)&&e.ref===t.ref)if(cc=!1,t.pendingProps=r=a,Fc(e,i))e.flags&131072&&(cc=!0);else return t.lanes=e.lanes,Pc(e,t,i)}return bc(e,t,n,r,i)}function pc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Sa(t,a===null?null:a.cachePool),a===null?ro():no(t,a),lo(t);else return r=t.lanes=536870912,hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Sa(t,null),ro(),uo(t)):(Sa(t,a.cachePool),no(t,a),uo(t),t.memoizedState=null);return lc(e,t,i,n),t.child}function mc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function hc(e,t,n,r,i){var a=xa();return a=a===null?null:{parent:ua._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Sa(t,null),ro(),lo(t),e!==null&&ta(e,t,r,!0),t.childLanes=i,null}function gc(e,t){return t=kc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function _c(e,t,n){return Ba(t,e.child,null,n),e=gc(t,t.pendingProps),e.flags|=2,fo(t),t.memoizedState=null,e}function vc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(P){if(r.mode===`hidden`)return e=gc(t,r),t.lanes=536870912,mc(null,e);if(co(t),(e=zi)?(e=df(e,F),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ai===null?null:{id:ji,overflow:Mi},retryLane:536870912,hydrationErrors:null},n=bi(e),n.return=t,t.child=n,Ri=t,zi=null)):e=null,e===null)throw Hi(t);return t.lanes=536870912,null}return gc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(co(t),a)if(t.flags&256)t.flags&=-257,t=_c(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(cc||ta(e,t,n,!1),a=(n&e.childLanes)!==0,cc||a){if(r=Kl,r!==null&&(s=ot(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ci(e,s),Su(r,e,s),sc;Pu(),t=_c(e,t,n)}else e=o.treeContext,zi=hf(s.nextSibling),Ri=t,P=!0,Bi=null,F=!1,e!==null&&Li(t,e),t=gc(t,r),t.flags|=4096;return t}return e=hi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function yc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function bc(e,t,n,r,i){return ra(t),n=Do(e,t,n,r,void 0,i),r=jo(),e!==null&&!cc?(Mo(e,t,i),Pc(e,t,i)):(P&&r&&Fi(t),t.flags|=1,lc(e,t,n,i),t.child)}function xc(e,t,n,r,i,a){return ra(t),t.updateQueue=null,n=ko(t,r,n,i),Oo(e),r=jo(),e!==null&&!cc?(Mo(e,t,a),Pc(e,t,a)):(P&&r&&Fi(t),t.flags|=1,lc(e,t,n,a),t.child)}function Sc(e,t,n,r,i){if(ra(t),t.stateNode===null){var a=di,o=n.contextType;typeof o==`object`&&o&&(a=ia(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Js,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ua(t),o=n.contextType,a.context=typeof o==`object`&&o?ia(o):di,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(qs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Js.enqueueReplaceState(a,a.state,null),Za(t,r,a,i),Xa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=di,typeof u==`object`&&u&&(o=ia(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Xs(t,a,r,o),Ha=!1;var f=t.memoizedState;a.state=f,Za(t,r,a,i),Xa(),l=t.memoizedState,s||f!==l||Ha?(typeof d==`function`&&(qs(t,n,d,r),l=t.memoizedState),(c=Ha||Ys(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Wa(e,t),o=t.memoizedProps,u=Zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=di,typeof l==`object`&&l&&(c=ia(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Xs(t,a,r,c),Ha=!1,f=t.memoizedState,a.state=f,Za(t,r,a,i),Xa();var p=t.memoizedState;o!==d||f!==p||Ha||e!==null&&e.dependencies!==null&&na(e.dependencies)?(typeof s==`function`&&(qs(t,n,s,r),p=t.memoizedState),(u=Ha||Ys(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&na(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,yc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ba(t,e.child,null,i),t.child=Ba(t,null,n,i)):lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Pc(e,t,i),e}function Cc(e,t,n,r){return Ki(),t.flags|=256,lc(e,t,n,r),t.child}var wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tc(e){return{baseLanes:e,cachePool:Ca()}}function Ec(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ru),e}function Dc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(po.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(P){if(a?so(t):uo(t),(e=zi)?(e=df(e,F),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ai===null?null:{id:ji,overflow:Mi},retryLane:536870912,hydrationErrors:null},n=bi(e),n.return=t,t.child=n,Ri=t,zi=null)):e=null,e===null)throw Hi(t);return pf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(uo(t),a=t.mode,c=kc({mode:`hidden`,children:c},a),r=vi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(null,r)):(so(t),Oc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(so(t),t.flags&=-257,t=Ac(e,t,n)):t.memoizedState===null?(uo(t),c=r.fallback,a=t.mode,r=kc({mode:`visible`,children:r.children},a),c=vi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ba(t,e.child,null,n),r=t.child,r.memoizedState=Tc(n),r.childLanes=Ec(e,s,n),t.memoizedState=wc,t=mc(null,r)):(uo(t),t.child=e.child,t.flags|=128,t=null);else if(so(t),pf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ji({value:r,source:null,stack:null}),t=Ac(e,t,n)}else if(cc||ta(e,t,n,!1),s=(n&e.childLanes)!==0,cc||s){if(s=Kl,s!==null&&(r=ot(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ci(e,r),Su(s,e,r),sc;ff(c)||Pu(),t=Ac(e,t,n)}else ff(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,zi=hf(c.nextSibling),Ri=t,P=!0,Bi=null,F=!1,e!==null&&Li(t,e),t=Oc(t,r.children),t.flags|=4096);return t}return a?(uo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=hi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=vi(c,a,n,null),c.flags|=2):c=hi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,mc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Tc(n):(a=c.cachePool,a===null?a=Ca():(l=ua._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Ec(e,s,n),t.memoizedState=wc,mc(e.child,r)):(so(t),n=e.child,e=n.sibling,n=hi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Oc(e,t){return t=kc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function kc(e,t){return e=pi(22,e,null,t),e.lanes=0,e}function Ac(e,t,n){return Ba(t,e.child,null,n),e=Oc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$i(e.return,t,n)}function Mc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Nc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=po.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,D(po,o),lc(e,t,r,n),r=P?Di:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jc(e,n,t);else if(e.tag===19)jc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&mo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Mc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&mo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Mc(t,!0,n,null,a,r);break;case`together`:Mc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Pc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),eu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ta(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=hi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=hi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&na(e))):!0}function Ic(e,t,n){switch(t.tag){case 3:ge(t,t.stateNode.containerInfo),Zi(t,ua,e.memoizedState.cache),Ki();break;case 27:case 5:ve(t);break;case 4:ge(t,t.stateNode.containerInfo);break;case 10:Zi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,co(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(so(t),e=Pc(e,t,n),e===null?null:e.sibling):Dc(e,t,n):(so(t),t.flags|=128,null);so(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(ta(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Nc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),D(po,po.current),r)break;return null;case 22:return t.lanes=0,pc(e,t,n,t.pendingProps);case 24:Zi(t,ua,e.memoizedState.cache)}return Pc(e,t,n)}function Lc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)cc=!0;else{if(!Fc(e,n)&&!(t.flags&128))return cc=!1,Ic(e,t,n);cc=!!(e.flags&131072)}else cc=!1,P&&t.flags&1048576&&Pi(t,Di,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Aa(t.elementType),t.type=e,typeof e==`function`)mi(e)?(r=Zs(e,r),t.tag=1,t=Sc(null,t,e,r,n)):(t.tag=0,t=bc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=uc(null,t,e,r,n);break a}else if(a===C){t.tag=14,t=dc(null,t,e,r,n);break a}}throw t=oe(e)||e,Error(i(306,t,``))}}return t;case 0:return bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Zs(r,t.pendingProps),Sc(e,t,r,a,n);case 3:a:{if(ge(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Wa(e,t),Za(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Zi(t,ua,r),r!==o.cache&&ea(t,[ua],n,!0),Xa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Cc(e,t,r,n);break a}else if(r!==a){a=Ci(Error(i(424)),t),Ji(a),t=Cc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(zi=hf(e.firstChild),Ri=t,P=!0,Bi=null,F=!0,n=Va(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ki(),r===a){t=Pc(e,t,n);break a}lc(e,t,r,n)}t=t.child}return t;case 26:return yc(e,t),e===null?(n=If(t.type,null,t.pendingProps,null))?t.memoizedState=n:P||(n=t.type,e=t.pendingProps,r=qd(he.current).createElement(n),r[ft]=t,r[pt]=e,Vd(r,n,e),Tt(r),t.stateNode=r):t.memoizedState=If(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ve(t),e===null&&P&&(r=t.stateNode=yf(t.type,t.pendingProps,he.current),Ri=t,F=!0,a=zi,af(t.type)?(gf=a,zi=hf(r.firstChild)):zi=a),lc(e,t,t.pendingProps.children,n),yc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&P&&((a=r=zi)&&(r=lf(r,t.type,t.pendingProps,F),r===null?a=!1:(t.stateNode=r,Ri=t,zi=hf(r.firstChild),F=!1,a=!0)),a||Hi(t)),ve(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Xd(a,o)?r=null:s!==null&&Xd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Do(e,t,Ao,null,null,n),ip._currentValue=a),yc(e,t),lc(e,t,r,n),t.child;case 6:return e===null&&P&&((e=n=zi)&&(n=uf(n,t.pendingProps,F),n===null?e=!1:(t.stateNode=n,Ri=t,zi=null,e=!0)),e||Hi(t)),null;case 13:return Dc(e,t,n);case 4:return ge(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ba(t,null,r,n):lc(e,t,r,n),t.child;case 11:return uc(e,t,t.type,t.pendingProps,n);case 7:return lc(e,t,t.pendingProps,n),t.child;case 8:return lc(e,t,t.pendingProps.children,n),t.child;case 12:return lc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Zi(t,t.type,r.value),lc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ra(t),a=ia(a),r=r(a),t.flags|=1,lc(e,t,r,n),t.child;case 14:return dc(e,t,t.type,t.pendingProps,n);case 15:return fc(e,t,t.type,t.pendingProps,n);case 19:return Nc(e,t,n);case 31:return vc(e,t,n);case 22:return pc(e,t,n,t.pendingProps);case 24:return ra(t),r=ia(ua),e===null?(a=xa(),a===null&&(a=Kl,o=da(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ua(t),Zi(t,ua,a)):((e.lanes&n)!==0&&(Wa(e,t),Za(t,null,null,n),Xa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Zi(t,ua,r),r!==a.cache&&ea(t,[ua],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Zi(t,ua,r))),lc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Rc(e){e.flags|=4}function zc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(ju())e.flags|=8192;else throw ja=Da,Ta}else e.flags&=-16777217}function Bc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Zf(t))if(ju())e.flags|=8192;else throw ja=Da,Ta}function Vc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:et(),e.lanes|=t,iu|=t)}function Hc(e,t){if(!P)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Uc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Wc(e,t,n){var r=t.pendingProps;switch(Ii(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Uc(t),null;case 1:return Uc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Qi(ua),_e(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Gi(t)?Rc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,qi())),Uc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Rc(t),o===null?(Uc(t),zc(t,a,null,r,n)):(Uc(t),Bc(t,o))):o?o===e.memoizedState?(Uc(t),t.flags&=-16777217):(Rc(t),Uc(t),Bc(t,o)):(e=e.memoizedProps,e!==r&&Rc(t),Uc(t),zc(t,a,e,r,n)),null;case 27:if(ye(t),n=he.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}e=pe.current,Gi(t)?Ui(t,e):(e=yf(a,r,n),t.stateNode=e,Rc(t))}return Uc(t),null;case 5:if(ye(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Uc(t),null}if(o=pe.current,Gi(t))Ui(t,o);else{var s=qd(he.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ft]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Vd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Rc(t)}}return Uc(t),zc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Rc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=he.current,Gi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ri,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Hi(t,!0)}else e=qd(e).createTextNode(r),e[ft]=t,t.stateNode=e}return Uc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Gi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ft]=t}else Ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),e=!1}else n=qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(fo(t),t):(fo(t),null);if(t.flags&128)throw Error(i(558))}return Uc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Gi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ft]=t}else Ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Uc(t),a=!1}else a=qi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(fo(t),t):(fo(t),null)}return fo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Vc(t,t.updateQueue),Uc(t),null);case 4:return _e(),e===null&&kd(t.stateNode.containerInfo),Uc(t),null;case 10:return Qi(t.type),Uc(t),null;case 19:if(fe(po),r=t.memoizedState,r===null)return Uc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Hc(r,!1);else{if($l!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=mo(e),o!==null){for(t.flags|=128,Hc(r,!1),e=o.updateQueue,t.updateQueue=e,Vc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)gi(n,e),n=n.sibling;return D(po,po.current&1|2),P&&Ni(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Me()>uu&&(t.flags|=128,a=!0,Hc(r,!1),t.lanes=4194304)}else{if(!a)if(e=mo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Vc(t,e),Hc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!P)return Uc(t),null}else 2*Me()-r.renderingStartTime>uu&&n!==536870912&&(t.flags|=128,a=!0,Hc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Uc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Me(),e.sibling=null,n=po.current,D(po,a?n&1|2:n&1),P&&Ni(t,r.treeForkCount),e);case 22:case 23:return fo(t),io(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Uc(t),t.subtreeFlags&6&&(t.flags|=8192)):Uc(t),n=t.updateQueue,n!==null&&Vc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&fe(ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Qi(ua),Uc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Gc(e,t){switch(Ii(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(ua),_e(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ye(t),null;case 31:if(t.memoizedState!==null){if(fo(t),t.alternate===null)throw Error(i(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(fo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(po),null;case 4:return _e(),null;case 10:return Qi(t.type),null;case 22:case 23:return fo(t),io(),e!==null&&fe(ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qi(ua),null;case 25:return null;default:return null}}function Kc(e,t){switch(Ii(t),t.tag){case 3:Qi(ua),_e();break;case 26:case 27:case 5:ye(t);break;case 4:_e();break;case 31:t.memoizedState!==null&&fo(t);break;case 13:fo(t);break;case 19:fe(po);break;case 10:Qi(t.type);break;case 22:case 23:fo(t),io(),e!==null&&fe(ba);break;case 24:Qi(ua)}}function qc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){W(t,t.return,e)}}function Jc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){W(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){W(t,t.return,e)}}function Yc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{$a(t,n)}catch(t){W(e,e.return,t)}}}function Xc(e,t,n){n.props=Zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){W(e,t,n)}}function Zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){W(e,t,n)}}function Qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){W(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){W(e,t,n)}else n.current=null}function $c(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){W(e,e.return,t)}}function el(e,t,n){try{var r=e.stateNode;Hd(r,e.type,n,t),r[pt]=t}catch(t){W(e,e.return,t)}}function tl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&af(e.type)||e.tag===4}function nl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||tl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&af(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function rl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=on));else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(rl(e,t,n),e=e.sibling;e!==null;)rl(e,t,n),e=e.sibling}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Vd(t,r,n),t[ft]=e,t[pt]=n}catch(t){W(e,e.return,t)}}var ol=!1,sl=!1,cl=!1,ll=typeof WeakSet==`function`?WeakSet:Set,ul=null;function dl(e,t){if(e=e.containerInfo,Gd=pp,e=Fr(e),Ir(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Kd={focusedElem:e,selectionRange:n},pp=!1,ul=t;ul!==null;)if(t=ul,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ul=e;else for(;ul!==null;){switch(t=ul,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){W(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)cf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:cf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ul=e;break}ul=t.return}}function fl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Dl(e,n),r&4&&qc(5,n);break;case 1:if(Dl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){W(n,n.return,e)}else{var i=Zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){W(n,n.return,e)}}r&64&&Yc(n),r&512&&Zc(n,n.return);break;case 3:if(Dl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{$a(e,t)}catch(e){W(n,n.return,e)}}break;case 27:t===null&&r&4&&al(n);case 26:case 5:Dl(e,n),t===null&&r&4&&$c(n),r&512&&Zc(n,n.return);break;case 12:Dl(e,n);break;case 31:Dl(e,n),r&4&&vl(e,n);break;case 13:Dl(e,n),r&4&&yl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=td.bind(null,n),mf(e,n))));break;case 22:if(r=n.memoizedState!==null||ol,!r){t=t!==null&&t.memoizedState!==null||sl,i=ol;var a=sl;ol=r,(sl=t)&&!a?kl(e,n,(n.subtreeFlags&8772)!=0):Dl(e,n),ol=i,sl=a}break;case 30:break;default:Dl(e,n)}}function pl(e){var t=e.alternate;t!==null&&(e.alternate=null,pl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&bt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ml=null,hl=!1;function gl(e,t,n){for(n=n.child;n!==null;)_l(e,t,n),n=n.sibling}function _l(e,t,n){if(He&&typeof He.onCommitFiberUnmount==`function`)try{He.onCommitFiberUnmount(Ve,n)}catch{}switch(n.tag){case 26:sl||Qc(n,t),gl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:sl||Qc(n,t);var r=ml,i=hl;af(n.type)&&(ml=n.stateNode,hl=!1),gl(e,t,n),bf(n.stateNode),ml=r,hl=i;break;case 5:sl||Qc(n,t);case 6:if(r=ml,i=hl,ml=null,gl(e,t,n),ml=r,hl=i,ml!==null)if(hl)try{(ml.nodeType===9?ml.body:ml.nodeName===`HTML`?ml.ownerDocument.body:ml).removeChild(n.stateNode)}catch(e){W(n,t,e)}else try{ml.removeChild(n.stateNode)}catch(e){W(n,t,e)}break;case 18:ml!==null&&(hl?(e=ml,of(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),zp(e)):of(ml,n.stateNode));break;case 4:r=ml,i=hl,ml=n.stateNode.containerInfo,hl=!0,gl(e,t,n),ml=r,hl=i;break;case 0:case 11:case 14:case 15:Jc(2,n,t),sl||Jc(4,n,t),gl(e,t,n);break;case 1:sl||(Qc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Xc(n,t,r)),gl(e,t,n);break;case 21:gl(e,t,n);break;case 22:sl=(r=sl)||n.memoizedState!==null,gl(e,t,n),sl=r;break;default:gl(e,t,n)}}function vl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{zp(e)}catch(e){W(t,t.return,e)}}}function yl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{zp(e)}catch(e){W(t,t.return,e)}}function bl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ll),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ll),t;default:throw Error(i(435,e.tag))}}function xl(e,t){var n=bl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=nd.bind(null,e,t);t.then(r,r)}})}function Sl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(af(c.type)){ml=c.stateNode,hl=!1;break a}break;case 5:ml=c.stateNode,hl=!1;break a;case 3:case 4:ml=c.stateNode.containerInfo,hl=!0;break a}c=c.return}if(ml===null)throw Error(i(160));_l(o,s,a),ml=null,hl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wl(t,e),t=t.sibling}var Cl=null;function wl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sl(t,e),Tl(e),r&4&&(Jc(3,e,e.return),qc(3,e),Jc(5,e,e.return));break;case 1:Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&64&&ol&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=Cl;if(Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[yt]||o[ft]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Vd(o,r,n),o[ft]=e,Tt(o),r=o;break a;case`link`:var s=Jf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Vd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Jf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Vd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ft]=e,Tt(o),r=o}e.stateNode=r}else Yf(a,e.type,e.stateNode);else e.stateNode=Uf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&el(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Yf(a,e.type,e.stateNode):Uf(a,r,e.memoizedProps))}break;case 27:Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),n!==null&&r&4&&el(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Sl(t,e),Tl(e),r&512&&(sl||n===null||Qc(n,n.return)),e.flags&32){a=e.stateNode;try{Zt(a,``)}catch(t){W(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,el(e,a,n===null?a:n.memoizedProps)),r&1024&&(cl=!0);break;case 6:if(Sl(t,e),Tl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){W(e,e.return,t)}}break;case 3:if(qf=null,a=Cl,Cl=Cf(t.containerInfo),Sl(t,e),Cl=a,Tl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zp(t.containerInfo)}catch(t){W(e,e.return,t)}cl&&(cl=!1,El(e));break;case 4:r=Cl,Cl=Cf(e.stateNode.containerInfo),Sl(t,e),Tl(e),Cl=r;break;case 12:Sl(t,e),Tl(e);break;case 31:Sl(t,e),Tl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 13:Sl(t,e),Tl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(cu=Me()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=ol,d=sl;if(ol=u||a,sl=d||l,Sl(t,e),sl=d,ol=u,Tl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||ol||sl||Ol(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){W(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){W(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?sf(m,!0):sf(l.stateNode,!1)}catch(e){W(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,xl(e,n))));break;case 19:Sl(t,e),Tl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,xl(e,r)));break;case 30:break;case 21:break;default:Sl(t,e),Tl(e)}}function Tl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(tl(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;il(e,nl(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Zt(o,``),n.flags&=-33),il(e,nl(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;rl(e,nl(e),s);break;default:throw Error(i(161))}}catch(t){W(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function El(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;El(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Dl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fl(e,t.alternate,t),t=t.sibling}function Ol(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Jc(4,t,t.return),Ol(t);break;case 1:Qc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Xc(t,t.return,n),Ol(t);break;case 27:bf(t.stateNode);case 26:case 5:Qc(t,t.return),Ol(t);break;case 22:t.memoizedState===null&&Ol(t);break;case 30:Ol(t);break;default:Ol(t)}e=e.sibling}}function kl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:kl(i,a,n),qc(4,a);break;case 1:if(kl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){W(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Qa(c[i],s)}catch(e){W(r,r.return,e)}}n&&o&64&&Yc(a),Zc(a,a.return);break;case 27:al(a);case 26:case 5:kl(i,a,n),n&&r===null&&o&4&&$c(a),Zc(a,a.return);break;case 12:kl(i,a,n);break;case 31:kl(i,a,n),n&&o&4&&vl(i,a);break;case 13:kl(i,a,n),n&&o&4&&yl(i,a);break;case 22:a.memoizedState===null&&kl(i,a,n),Zc(a,a.return);break;case 30:break;default:kl(i,a,n)}t=t.sibling}}function Al(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&fa(n))}function jl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e))}function Ml(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Nl(e,t,n,r),t=t.sibling}function Nl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ml(e,t,n,r),i&2048&&qc(9,t);break;case 1:Ml(e,t,n,r);break;case 3:Ml(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e)));break;case 12:if(i&2048){Ml(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){W(t,t.return,e)}}else Ml(e,t,n,r);break;case 31:Ml(e,t,n,r);break;case 13:Ml(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Ml(e,t,n,r):(a._visibility|=2,Pl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Ml(e,t,n,r):Fl(e,t),i&2048&&Al(o,t);break;case 24:Ml(e,t,n,r),i&2048&&jl(t.alternate,t);break;default:Ml(e,t,n,r)}}function Pl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Pl(a,o,s,c,i),qc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Pl(a,o,s,c,i)):u._visibility&2?Pl(a,o,s,c,i):Fl(a,o),i&&l&2048&&Al(o.alternate,o);break;case 24:Pl(a,o,s,c,i),i&&l&2048&&jl(o.alternate,o);break;default:Pl(a,o,s,c,i)}t=t.sibling}}function Fl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Fl(n,r),i&2048&&Al(r.alternate,r);break;case 24:Fl(n,r),i&2048&&jl(r.alternate,r);break;default:Fl(n,r)}t=t.sibling}}var Il=8192;function Ll(e,t,n){if(e.subtreeFlags&Il)for(e=e.child;e!==null;)Rl(e,t,n),e=e.sibling}function Rl(e,t,n){switch(e.tag){case 26:Ll(e,t,n),e.flags&Il&&e.memoizedState!==null&&Qf(n,Cl,e.memoizedState,e.memoizedProps);break;case 5:Ll(e,t,n);break;case 3:case 4:var r=Cl;Cl=Cf(e.stateNode.containerInfo),Ll(e,t,n),Cl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Il,Il=16777216,Ll(e,t,n),Il=r):Ll(e,t,n));break;default:Ll(e,t,n)}}function zl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Ul(r,e)}zl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vl(e),e=e.sibling}function Vl(e){switch(e.tag){case 0:case 11:case 15:Bl(e),e.flags&2048&&Jc(9,e,e.return);break;case 3:Bl(e);break;case 12:Bl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hl(e)):Bl(e);break;default:Bl(e)}}function Hl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ul=r,Ul(r,e)}zl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Jc(8,t,t.return),Hl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hl(t));break;default:Hl(t)}e=e.sibling}}function Ul(e,t){for(;ul!==null;){var n=ul;switch(n.tag){case 0:case 11:case 15:Jc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:fa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ul=r;else a:for(n=e;ul!==null;){r=ul;var i=r.sibling,a=r.return;if(pl(r),r===n){ul=null;break a}if(i!==null){i.return=a,ul=i;break a}ul=a}}}var Wl={getCacheForType:function(e){var t=ia(ua),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ia(ua).controller.signal}},Gl=typeof WeakMap==`function`?WeakMap:Map,z=0,Kl=null,B=null,V=0,ql=0,Jl=null,Yl=!1,Xl=!1,Zl=!1,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=null,ou=null,su=!1,cu=0,lu=0,uu=1/0,du=null,fu=null,H=0,pu=null,mu=null,U=0,hu=0,gu=null,_u=null,vu=0,yu=null;function bu(){return z&2&&V!==0?V&-V:T.T===null?lt():vd()}function xu(){if(ru===0)if(!(V&536870912)||P){var e=Ye;Ye<<=1,!(Ye&3932160)&&(Ye=262144),ru=e}else ru=536870912;return e=ao.current,e!==null&&(e.flags|=32),ru}function Su(e,t,n){(e===Kl&&(ql===2||ql===9)||e.cancelPendingCommit!==null)&&(ku(e,0),Eu(e,V,ru,!1)),nt(e,n),(!(z&2)||e!==Kl)&&(e===Kl&&(!(z&2)&&(tu|=n),$l===4&&Eu(e,V,ru,!1)),ud(e))}function Cu(e,t,n){if(z&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||A(e,t),a=r?Lu(e,t):Fu(e,t,!0),o=r;do{if(a===0){Xl&&!r&&Eu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Tu(n)){a=Fu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=au;var l=c.current.memoizedState.isDehydrated;if(l&&(ku(c,s).flags|=256),s=Fu(c,s,!1),s!==2){if(Zl&&!l){c.errorRecoveryDisabledLanes|=o,tu|=o,a=4;break a}o=ou,ou=a,o!==null&&(ou===null?ou=o:ou.push.apply(ou,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ku(e,0),Eu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Eu(r,t,ru,!Yl);break a;case 2:ou=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=cu+300-Me(),10<a)){if(Eu(r,t,ru,!Yl),k(r,0,!0)!==0)break a;U=t,r.timeoutHandle=$d(wu.bind(null,r,n,ou,du,su,t,ru,tu,iu,Yl,o,`Throttled`,-0,0),a);break a}wu(r,n,ou,du,su,t,ru,tu,iu,Yl,o,null,-0,0)}}break}while(1);ud(e)}function wu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:on},Rl(t,a,d);var m=(a&62914560)===a?cu-Me():(a&4194048)===a?lu-Me():0;if(m=ep(d,m),m!==null){U=a,e.cancelPendingCommit=m(Wu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Eu(e,a,o,!l);return}}Wu(e,t,a,n,r,i,o,s,c)}function Tu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Ar(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Eu(e,t,n,r){t&=~nu,t&=~tu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-We(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&it(e,n,t)}function Du(){return z&6?!0:(dd(0,!1),!1)}function Ou(){if(B!==null){if(ql===0)var e=B.return;else e=B,Xi=I=null,No(e),Pa=null,Fa=0,e=B;for(;e!==null;)Kc(e.alternate,e),e=e.return;B=null}}function ku(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,ef(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),U=0,Ou(),Kl=e,B=n=hi(e.current,null),V=t,ql=0,Jl=null,Yl=!1,Xl=A(e,t),Zl=!1,iu=ru=nu=tu=eu=$l=0,ou=au=null,su=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-We(r),a=1<<i;t|=e[i],r&=~a}return Ql=t,oi(),n}function Au(e,t){R=null,T.H=Us,t===wa||t===Ea?(t=Ma(),ql=3):t===Ta?(t=Ma(),ql=4):ql=t===sc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Jl=t,B===null&&($l=1,tc(e,Ci(t,e.current)))}function ju(){var e=ao.current;return e===null?!0:(V&4194048)===V?oo===null:(V&62914560)===V||V&536870912?e===oo:!1}function Mu(){var e=T.H;return T.H=Us,e===null?Us:e}function Nu(){var e=T.A;return T.A=Wl,e}function Pu(){$l=4,Yl||(V&4194048)!==V&&ao.current!==null||(Xl=!0),!(eu&134217727)&&!(tu&134217727)||Kl===null||Eu(Kl,V,ru,!1)}function Fu(e,t,n){var r=z;z|=2;var i=Mu(),a=Nu();(Kl!==e||V!==t)&&(du=null,ku(e,t)),t=!1;var o=$l;a:do try{if(ql!==0&&B!==null){var s=B,c=Jl;switch(ql){case 8:Ou(),o=6;break a;case 3:case 2:case 9:case 6:ao.current===null&&(t=!0);var l=ql;if(ql=0,Jl=null,Vu(e,s,c,l),n&&Xl){o=0;break a}break;default:l=ql,ql=0,Jl=null,Vu(e,s,c,l)}}Iu(),o=$l;break}catch(t){Au(e,t)}while(1);return t&&e.shellSuspendCounter++,Xi=I=null,z=r,T.H=i,T.A=a,B===null&&(Kl=null,V=0,oi()),o}function Iu(){for(;B!==null;)zu(B)}function Lu(e,t){var n=z;z|=2;var r=Mu(),a=Nu();Kl!==e||V!==t?(du=null,uu=Me()+500,ku(e,t)):Xl=A(e,t);a:do try{if(ql!==0&&B!==null){t=B;var o=Jl;b:switch(ql){case 1:ql=0,Jl=null,Vu(e,t,o,1);break;case 2:case 9:if(Oa(o)){ql=0,Jl=null,Bu(t);break}t=function(){ql!==2&&ql!==9||Kl!==e||(ql=7),ud(e)},o.then(t,t);break a;case 3:ql=7;break a;case 4:ql=5;break a;case 7:Oa(o)?(ql=0,Jl=null,Bu(t)):(ql=0,Jl=null,Vu(e,t,o,7));break;case 5:var s=null;switch(B.tag){case 26:s=B.memoizedState;case 5:case 27:var c=B;if(s?Zf(s):c.stateNode.complete){ql=0,Jl=null;var l=c.sibling;if(l!==null)B=l;else{var u=c.return;u===null?B=null:(B=u,Hu(u))}break b}}ql=0,Jl=null,Vu(e,t,o,5);break;case 6:ql=0,Jl=null,Vu(e,t,o,6);break;case 8:Ou(),$l=6;break a;default:throw Error(i(462))}}Ru();break}catch(t){Au(e,t)}while(1);return Xi=I=null,T.H=r,T.A=a,z=n,B===null?(Kl=null,V=0,oi(),$l):0}function Ru(){for(;B!==null&&!Ae();)zu(B)}function zu(e){var t=Lc(e.alternate,e,Ql);e.memoizedProps=e.pendingProps,t===null?Hu(e):B=t}function Bu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=xc(n,t,t.pendingProps,t.type,void 0,V);break;case 11:t=xc(n,t,t.pendingProps,t.type.render,t.ref,V);break;case 5:No(t);default:Kc(n,t),t=B=gi(t,Ql),t=Lc(n,t,Ql)}e.memoizedProps=e.pendingProps,t===null?Hu(e):B=t}function Vu(e,t,n,r){Xi=I=null,No(t),Pa=null,Fa=0;var i=t.return;try{if(oc(e,i,t,n,V)){$l=1,tc(e,Ci(n,e.current)),B=null;return}}catch(t){if(i!==null)throw B=i,t;$l=1,tc(e,Ci(n,e.current)),B=null;return}t.flags&32768?(P||r===1?e=!0:Xl||V&536870912?e=!1:(Yl=e=!0,(r===2||r===9||r===3||r===6)&&(r=ao.current,r!==null&&r.tag===13&&(r.flags|=16384))),Uu(t,e)):Hu(t)}function Hu(e){var t=e;do{if(t.flags&32768){Uu(t,Yl);return}e=t.return;var n=Wc(t.alternate,t,Ql);if(n!==null){B=n;return}if(t=t.sibling,t!==null){B=t;return}B=t=e}while(t!==null);$l===0&&($l=5)}function Uu(e,t){do{var n=Gc(e.alternate,e);if(n!==null){n.flags&=32767,B=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){B=e;return}B=e=n}while(e!==null);$l=6,B=null}function Wu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Yu();while(H!==0);if(z&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=ai,rt(e,n,o,s,c,l),e===Kl&&(B=Kl=null,V=0),mu=t,pu=e,U=n,hu=o,gu=a,_u=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,rd(Ie,function(){return Xu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=T.T,T.T=null,a=E.p,E.p=2,s=z,z|=4;try{dl(e,t,n)}finally{z=s,E.p=a,T.T=r}}H=1,Gu(),Ku(),qu()}}function Gu(){if(H===1){H=0;var e=pu,t=mu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=T.T,T.T=null;var r=E.p;E.p=2;var i=z;z|=4;try{wl(t,e);var a=Kd,o=Fr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Pr(s.ownerDocument.documentElement,s)){if(c!==null&&Ir(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Nr(s,h),v=Nr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}pp=!!Gd,Kd=Gd=null}finally{z=i,E.p=r,T.T=n}}e.current=t,H=2}}function Ku(){if(H===2){H=0;var e=pu,t=mu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=T.T,T.T=null;var r=E.p;E.p=2;var i=z;z|=4;try{fl(e,t.alternate,t)}finally{z=i,E.p=r,T.T=n}}H=3}}function qu(){if(H===4||H===3){H=0,je();var e=pu,t=mu,n=U,r=_u;t.subtreeFlags&10256||t.flags&10256?H=5:(H=0,mu=pu=null,Ju(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(fu=null),ct(n),t=t.stateNode,He&&typeof He.onCommitFiberRoot==`function`)try{He.onCommitFiberRoot(Ve,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=T.T,i=E.p,E.p=2,T.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{T.T=t,E.p=i}}U&3&&Yu(),ud(e),i=e.pendingLanes,n&261930&&i&42?e===yu?vu++:(vu=0,yu=e):vu=0,dd(0,!1)}}function Ju(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,fa(t)))}function Yu(){return Gu(),Ku(),qu(),Xu()}function Xu(){if(H!==5)return!1;var e=pu,t=hu;hu=0;var n=ct(U),r=T.T,a=E.p;try{E.p=32>n?32:n,T.T=null,n=gu,gu=null;var o=pu,s=U;if(H=0,mu=pu=null,U=0,z&6)throw Error(i(331));var c=z;if(z|=4,Vl(o.current),Nl(o,o.current,s,n),z=c,dd(0,!1),He&&typeof He.onPostCommitFiberRoot==`function`)try{He.onPostCommitFiberRoot(Ve,o)}catch{}return!0}finally{E.p=a,T.T=r,Ju(e,t)}}function Zu(e,t,n){t=Ci(n,t),t=rc(e.stateNode,t,2),e=Ka(e,t,2),e!==null&&(nt(e,2),ud(e))}function W(e,t,n){if(e.tag===3)Zu(e,e,n);else for(;t!==null;){if(t.tag===3){Zu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(fu===null||!fu.has(r))){e=Ci(n,e),n=ic(2),r=Ka(t,n,2),r!==null&&(ac(n,r,t,e),nt(r,2),ud(r));break}}t=t.return}}function Qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Zl=!0,i.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Kl===e&&(V&n)===n&&($l===4||$l===3&&(V&62914560)===V&&300>Me()-cu?!(z&2)&&ku(e,0):nu|=n,iu===V&&(iu=0)),ud(e)}function ed(e,t){t===0&&(t=et()),e=ci(e,t),e!==null&&(nt(e,t),ud(e))}function td(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ed(e,n)}function nd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),ed(e,n)}function rd(e,t){return Oe(e,t)}var id=null,ad=null,od=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==ad&&e.next===null&&(ad===null?id=ad=e:ad=ad.next=e),sd=!0,od||(od=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=id;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-We(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=V,a=k(r,r===Kl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||A(r,a)||(n=!0,gd(r,a));r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=od=!1;var e=0;ld!==0&&Qd()&&(e=ld);for(var t=Me(),n=null,r=id;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?id=i:n.next=i,i===null&&(ad=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}H!==0&&H!==5||dd(e,!1),ld!==0&&(ld=0)}function md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-We(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=$e(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Kl,n=V,n=k(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ql===2||ql===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ke(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||A(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ke(r),ct(n)){case 2:case 8:n=Fe;break;case 32:n=Ie;break;case 268435456:n=Re;break;default:n=Ie}return r=hd.bind(null,e),n=Oe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ke(r),e.callbackPriority=2,e.callbackNode=null,2}function hd(e,t){if(H!==0&&H!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Yu()&&e.callbackNode!==n)return null;var r=V;return r=k(e,e===Kl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Cu(e,r,t),md(e,Me()),e.callbackNode!=null&&e.callbackNode===n?hd.bind(null,e):null)}function gd(e,t){if(Yu())return null;Cu(e,t,!0)}function _d(){nf(function(){z&6?Oe(Pe,fd):pd()})}function vd(){if(ld===0){var e=ha;e===0&&(e=Je,Je<<=1,!(Je&261888)&&(Je=256)),ld=e}return ld}function yd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:an(``+e)}function bd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function xd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=yd((i[pt]||null).action),o=r.submitter;o&&(t=(t=o[pt]||null)?yd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Dn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ld!==0){var e=o?bd(i,o):new FormData(i);ks(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?bd(i,o):new FormData(i),ks(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Sd=0;Sd<j.length;Sd++){var Cd=j[Sd];ni(Cd.toLowerCase(),`on`+(Cd[0].toUpperCase()+Cd.slice(1)))}ni(Jr,`onAnimationEnd`),ni(Yr,`onAnimationIteration`),ni(Xr,`onAnimationStart`),ni(`dblclick`,`onDoubleClick`),ni(`focusin`,`onFocus`),ni(`focusout`,`onBlur`),ni(Zr,`onTransitionRun`),ni(Qr,`onTransitionStart`),ni($r,`onTransitionCancel`),ni(ei,`onTransitionEnd`),kt(`onMouseEnter`,[`mouseout`,`mouseover`]),kt(`onMouseLeave`,[`mouseout`,`mouseover`]),kt(`onPointerEnter`,[`pointerout`,`pointerover`]),kt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ot(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ot(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ot(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ot(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var wd=`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(` `),Td=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(wd));function Ed(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){M(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){M(e)}i.currentTarget=null,a=c}}}}function G(e,t){var n=t[ht];n===void 0&&(n=t[ht]=new Set);var r=e+`__bubble`;n.has(r)||(Ad(t,e,2,!1),n.add(r))}function Dd(e,t,n){var r=0;t&&(r|=4),Ad(n,e,r,t)}var Od=`_reactListening`+Math.random().toString(36).slice(2);function kd(e){if(!e[Od]){e[Od]=!0,Et.forEach(function(t){t!==`selectionchange`&&(Td.has(t)||Dd(t,!1,e),Dd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Od]||(t[Od]=!0,Dd(`selectionchange`,!1,t))}}function Ad(e,t,n,r){switch(bp(t)){case 2:var i=mp;break;case 8:i=hp;break;default:i=gp}n=i.bind(null,t,n,e),i=void 0,!gn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function jd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=xt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}pn(function(){var r=a,i=cn(n),s=[];a:{var c=ti.get(e);if(c!==void 0){var l=Dn,u=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:l=Gn;break;case`focusin`:u=`focus`,l=In;break;case`focusout`:u=`blur`,l=In;break;case`beforeblur`:case`afterblur`:l=In;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=qn;break;case Jr:case Yr:case Xr:l=Ln;break;case ei:l=Jn;break;case`scroll`:case`scrollend`:l=kn;break;case`wheel`:l=Yn;break;case`copy`:case`cut`:case`paste`:l=Rn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Kn;break;case`toggle`:case`beforetoggle`:l=Xn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=mn(m,p),g!=null&&d.push(Md(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==sn&&(u=n.relatedTarget||n.fromElement)&&(xt(u)||u[mt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?xt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Pn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Kn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:Ct(l),h=u==null?c:Ct(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,xt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Pd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?Ct(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=_r;else if(ur(c))if(yr)v=Or;else{v=Er;var y=Tr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&tn(r.elementType)&&(v=_r):v=Dr;if(v&&=v(e,r)){dr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&qt(c,`number`,c.value)}switch(y=r?Ct(r):window,e){case`focusin`:(ur(y)||y.contentEditable===`true`)&&(Rr=y,zr=r,Br=null);break;case`focusout`:Br=zr=Rr=null;break;case`mousedown`:Vr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Vr=!1,Hr(s,n,i);break;case`selectionchange`:if(Lr)break;case`keydown`:case`keyup`:Hr(s,n,i)}var b;if(Qn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else or?ir(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(tr&&n.locale!==`ko`&&(or||x!==`onCompositionStart`?x===`onCompositionEnd`&&or&&(b=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,or=!0)),y=Nd(r,x),0<y.length&&(x=new zn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=ar(n),b!==null&&(x.data=b)))),(b=er?sr(e,n):cr(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),xd(s,e,r,n,i)}Ed(s,t)})}function Md(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=mn(e,n),i!=null&&r.unshift(Md(e,i,a)),i=mn(e,t),i!=null&&r.push(Md(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=mn(n,a),l!=null&&o.unshift(Md(n,l,c))):i||(l=mn(n,a),l!=null&&o.push(Md(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
9
9
  `).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Zt(e,``+r);break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:en(e,r,o);break;case`data`:if(t!==`object`){Ft(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=on);break;case`onScroll`:r!=null&&G(`scroll`,e);break;case`onScrollEnd`:r!=null&&G(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=an(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:G(`beforetoggle`,e),G(`toggle`,e),Pt(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Pt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=nn.get(n)||n,Pt(e,n,r))}}function K(e,t,n,r,a,o){switch(n){case`style`:en(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Zt(e,``+r);break;case`onScroll`:r!=null&&G(`scroll`,e);break;case`onScrollEnd`:r!=null&&G(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=on);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[pt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Pt(e,n,r)}}}function Vd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:G(`error`,e),G(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:G(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Bd(e,t,r,d,n,null)}}Kt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in G(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Jt(e,!!r,n,!0):Jt(e,!!r,t,!1);return;case`textarea`:for(s in G(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Bd(e,t,s,c,n,null)}Xt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Bd(e,t,l,r,n,null)}return;case`dialog`:G(`beforetoggle`,e),G(`toggle`,e),G(`cancel`,e),G(`close`,e);break;case`iframe`:case`object`:G(`load`,e);break;case`video`:case`audio`:for(r=0;r<wd.length;r++)G(wd[r],e);break;case`image`:G(`error`,e),G(`load`,e);break;case`details`:G(`toggle`,e);break;case`embed`:case`source`:case`link`:G(`error`,e),G(`load`,e);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 n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,u,r,n,null)}return;default:if(tn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&K(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Hd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Bd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Bd(e,t,p,m,r,f)}}Gt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Jt(e,!!n,n?[]:``,!1):Jt(e,!!n,t,!0)):Jt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Bd(e,t,s,a,r,o)}Yt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Bd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Bd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Bd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Bd(e,t,u,p,r,m)}return;default:if(tn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&K(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||K(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Bd(e,t,f,p,r,m)}function Ud(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Wd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Ud(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Ud(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Gd=null,Kd=null;function qd(e){return e.nodeType===9?e:e.ownerDocument}function Jd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Yd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Xd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Zd=null;function Qd(){var e=window.event;return e&&e.type===`popstate`?e===Zd?!1:(Zd=e,!0):(Zd=null,!1)}var $d=typeof setTimeout==`function`?setTimeout:void 0,ef=typeof clearTimeout==`function`?clearTimeout:void 0,tf=typeof Promise==`function`?Promise:void 0,nf=typeof queueMicrotask==`function`?queueMicrotask:tf===void 0?$d:function(e){return tf.resolve(null).then(e).catch(rf)};function rf(e){setTimeout(function(){throw e})}function af(e){return e===`head`}function of(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),zp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)bf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,bf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[yt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&bf(e.ownerDocument.body);n=i}while(n);zp(t)}function sf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function cf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:cf(n),bt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function lf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[yt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=hf(e.nextSibling),e===null)break}return null}function uf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=hf(e.nextSibling),e===null))return null;return e}function df(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=hf(e.nextSibling),e===null))return null;return e}function ff(e){return e.data===`$?`||e.data===`$~`}function pf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function mf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function hf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var gf=null;function _f(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return hf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function vf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function yf(e,t,n){switch(t=qd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function bf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);bt(e)}var xf=new Map,Sf=new Set;function Cf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wf=E.d;E.d={f:Tf,r:Ef,D:kf,C:Af,L:jf,m:Mf,X:Pf,S:Nf,M:Ff};function Tf(){var e=wf.f(),t=Du();return e||t}function Ef(e){var t=St(e);t!==null&&t.tag===5&&t.type===`form`?js(t):wf.r(e)}var Df=typeof document>`u`?null:document;function Of(e,t,n){var r=Df;if(r&&typeof t==`string`&&t){var i=Wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sf.has(i)||(Sf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Vd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function kf(e){wf.D(e),Of(`dns-prefetch`,e,null)}function Af(e,t){wf.C(e,t),Of(`preconnect`,e,t)}function jf(e,t,n){wf.L(e,t,n);var r=Df;if(r&&e&&t){var i=`link[rel="preload"][as="`+Wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Wt(n.imageSizes)+`"]`)):i+=`[href="`+Wt(e)+`"]`;var a=i;switch(t){case`style`:a=Lf(e);break;case`script`:a=Vf(e)}xf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),xf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Rf(a))||t===`script`&&r.querySelector(Hf(a))||(t=r.createElement(`link`),Vd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Mf(e,t){wf.m(e,t);var n=Df;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Wt(r)+`"][href="`+Wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Vf(e)}if(!xf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),xf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Hf(a)))return}r=n.createElement(`link`),Vd(r,`link`,e),Tt(r),n.head.appendChild(r)}}}function Nf(e,t,n){wf.S(e,t,n);var r=Df;if(r&&e){var i=wt(r).hoistableStyles,a=Lf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Rf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=xf.get(a))&&Gf(e,n);var c=o=r.createElement(`link`);Tt(c),Vd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Wf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Pf(e,t){wf.X(e,t);var n=Df;if(n&&e){var r=wt(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=f({src:e,async:!0},t),(t=xf.get(i))&&Kf(e,t),a=n.createElement(`script`),Tt(a),Vd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t){wf.M(e,t);var n=Df;if(n&&e){var r=wt(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=xf.get(i))&&Kf(e,t),a=n.createElement(`script`),Tt(a),Vd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t,n,r){var a=(a=he.current)?Cf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Lf(n.href),n=wt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Lf(n.href);var o=wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Rf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),xf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},xf.set(e,n),o||Bf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Vf(n),n=wt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Lf(e){return`href="`+Wt(e)+`"`}function Rf(e){return`link[rel="stylesheet"][`+e+`]`}function zf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Bf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Vd(t,`link`,n),Tt(t),e.head.appendChild(t))}function Vf(e){return`[src="`+Wt(e)+`"]`}function Hf(e){return`script[async]`+e}function Uf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Wt(n.href)+`"]`);if(r)return t.instance=r,Tt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Tt(r),Vd(r,`style`,a),Wf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Lf(n.href);var o=e.querySelector(Rf(a));if(o)return t.state.loading|=4,t.instance=o,Tt(o),o;r=zf(n),(a=xf.get(a))&&Gf(r,a),o=(e.ownerDocument||e).createElement(`link`),Tt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Vd(o,`link`,r),t.state.loading|=4,Wf(o,n.precedence,e),t.instance=o;case`script`:return o=Vf(n.src),(a=e.querySelector(Hf(o)))?(t.instance=a,Tt(a),a):(r=n,(a=xf.get(o))&&(r=f({},n),Kf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Tt(a),Vd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Wf(r,n.precedence,e));return t.instance}function Wf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Gf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var qf=null;function Jf(e,t,n){if(qf===null){var r=new Map,i=qf=new Map;i.set(n,r)}else i=qf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[yt]||a[ft]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Yf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Xf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Zf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Lf(r.href),a=t.querySelector(Rf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=tp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Tt(a);return}a=t.ownerDocument||t,r=zf(r),(i=xf.get(i))&&Gf(r,i),a=a.createElement(`link`),Tt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Vd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=tp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $f=0;function ep(e,t){return e.stylesheets&&e.count===0&&rp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&rp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$f===0&&($f=62500*Wd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&rp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$f?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function tp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var np=null;function rp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,np=new Map,t.forEach(q,e),np=null,tp.call(e))}function q(e,t){if(!(t.state.loading&4)){var n=np.get(e);if(n)var r=n.get(null);else{n=new Map,np.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=tp.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ip={$$typeof:b,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function ap(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function op(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ap(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=pi(3,null,null,t),e.current=a,a.stateNode=e,t=da(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ua(a),e}function sp(e){return e?(e=di,e):di}function cp(e,t,n,r,i,a){i=sp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ga(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ka(e,r,t),n!==null&&(Su(n,e,t),qa(n,e,t))}function lp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function up(e,t){lp(e,t),(e=e.alternate)&&lp(e,t)}function dp(e){if(e.tag===13||e.tag===31){var t=ci(e,67108864);t!==null&&Su(t,e,67108864),up(e,67108864)}}function fp(e){if(e.tag===13||e.tag===31){var t=bu();t=st(t);var n=ci(e,t);n!==null&&Su(n,e,t),up(e,t)}}var pp=!0;function mp(e,t,n,r){var i=T.T;T.T=null;var a=E.p;try{E.p=2,gp(e,t,n,r)}finally{E.p=a,T.T=i}}function hp(e,t,n,r){var i=T.T;T.T=null;var a=E.p;try{E.p=8,gp(e,t,n,r)}finally{E.p=a,T.T=i}}function gp(e,t,n,r){if(pp){var i=_p(r);if(i===null)jd(e,t,r,vp,n),kp(e,r);else if(jp(i,e,t,n,r))r.stopPropagation();else if(kp(e,r),t&4&&-1<Op.indexOf(e)){for(;i!==null;){var a=St(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-We(o);s.entanglements[1]|=c,o&=~c}ud(a),!(z&6)&&(uu=Me()+500,dd(0,!1))}}break;case 31:case 13:s=ci(a,2),s!==null&&Su(s,a,2),Du(),up(a,2)}if(a=_p(r),a===null&&jd(e,t,r,vp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else jd(e,t,r,null,n)}}function _p(e){return e=cn(e),yp(e)}var vp=null;function yp(e){if(vp=null,e=xt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return vp=e,null}function bp(e){switch(e){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(Ne()){case Pe:return 2;case Fe:return 8;case Ie:case Le:return 32;case Re:return 268435456;default:return 32}default:return 32}}var xp=!1,Sp=null,Cp=null,wp=null,Tp=new Map,Ep=new Map,Dp=[],Op=`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 kp(e,t){switch(e){case`focusin`:case`focusout`:Sp=null;break;case`dragenter`:case`dragleave`:Cp=null;break;case`mouseover`:case`mouseout`:wp=null;break;case`pointerover`:case`pointerout`:Tp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ep.delete(t.pointerId)}}function Ap(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=St(t),t!==null&&dp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function jp(e,t,n,r,i){switch(t){case`focusin`:return Sp=Ap(Sp,e,t,n,r,i),!0;case`dragenter`:return Cp=Ap(Cp,e,t,n,r,i),!0;case`mouseover`:return wp=Ap(wp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Tp.set(a,Ap(Tp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ep.set(a,Ap(Ep.get(a)||null,e,t,n,r,i)),!0}return!1}function Mp(e){var t=xt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ut(e.priority,function(){fp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ut(e.priority,function(){fp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Np(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_p(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sn=r,n.target.dispatchEvent(r),sn=null}else return t=St(n),t!==null&&dp(t),e.blockedOn=n,!1;t.shift()}return!0}function Pp(e,t,n){Np(e)&&n.delete(t)}function Fp(){xp=!1,Sp!==null&&Np(Sp)&&(Sp=null),Cp!==null&&Np(Cp)&&(Cp=null),wp!==null&&Np(wp)&&(wp=null),Tp.forEach(Pp),Ep.forEach(Pp)}function Ip(e,n){e.blockedOn===n&&(e.blockedOn=null,xp||(xp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Fp)))}var Lp=null;function Rp(e){Lp!==e&&(Lp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Lp===e&&(Lp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(yp(r||n)===null)continue;break}var a=St(n);a!==null&&(e.splice(t,3),t-=3,ks(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function zp(e){function t(t){return Ip(t,e)}Sp!==null&&Ip(Sp,e),Cp!==null&&Ip(Cp,e),wp!==null&&Ip(wp,e),Tp.forEach(t),Ep.forEach(t);for(var n=0;n<Dp.length;n++){var r=Dp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Dp.length&&(n=Dp[0],n.blockedOn===null);)Mp(n),n.blockedOn===null&&Dp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Rp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(yp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Rp(n)}}}function Bp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Vp(e){this._internalRoot=e}Hp.prototype.render=Vp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;cp(n,bu(),e,t,null,null)},Hp.prototype.unmount=Vp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cp(e.current,2,null,e,null,null),Du(),t[mt]=null}};function Hp(e){this._internalRoot=e}Hp.prototype.unstable_scheduleHydration=function(e){if(e){var t=lt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Dp.length&&t!==0&&t<Dp[n].priority;n++);Dp.splice(n,0,e),n===0&&Mp(e)}};var Up=n.version;if(Up!==`19.2.7`)throw Error(i(527,Up,`19.2.7`));E.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Wp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:T,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Gp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gp.isDisabled&&Gp.supportsFiber)try{Ve=Gp.inject(Wp),He=Gp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Qs,s=$s,c=ec;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=op(e,1,!1,null,null,n,r,null,o,s,c,Bp),e[mt]=t.current,kd(e),new Vp(t)}})),br=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=yr()}))(),xr=Object.create,Sr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,wr=Object.getOwnPropertyNames,Tr=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty,Dr=(e,t)=>function(){return t||(0,e[wr(e)[0]])((t={exports:{}}).exports,t),t.exports},Or=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=wr(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Er.call(e,s)&&s!==n&&Sr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Cr(t,s))||r.enumerable});return e},kr=(e,t,n)=>(n=e==null?{}:xr(Tr(e)),Or(t||!e||!e.__esModule?Sr(n,`default`,{value:e,enumerable:!0}):n,e)),Ar=Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(e,t){function n(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),jr=Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(e,t){var n=Ar();function r(e,t){if(e==null)return{};var r,i,a=n(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Mr=Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Nr=Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Mr().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Pr=Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Mr().default,r=Nr();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Fr=Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Pr();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ir=Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Fr();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]==null?{}:arguments[t];t%2?r(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Lr=kr(jr(),1),Rr=kr(Ir(),1),zr=[`cursor`,`direction`];function Br(e,t,n){let r=e.flatMap(e=>e.split(`.`));if(!t&&(!n||n===`any`))return r.length?[r]:[];if(n===`infinite`&&qt(t)&&(`direction`in t||`cursor`in t)){let{cursor:e,direction:n}=t;return[r,{input:(0,Lr.default)(t,zr),type:`infinite`}]}return[r,(0,Rr.default)((0,Rr.default)({},t!==void 0&&t!==le&&{input:t}),n&&n!==`any`&&{type:n})]}function Vr(e){return Br(e,void 0,`any`)}function Hr(e){return dn(({path:t,args:n})=>{let r=[...t],i=r.pop();if(i===`useMutation`)return e[i](r,...n);if(i===`_def`)return{path:r};let[a,...o]=n,s=o[0]??{};return e[i](r,a,s)})}var Ur=[`client`,`ssrContext`,`ssrState`,`abortOnUnmount`],Wr=k.createContext?.call(k,null),Gr=e=>{switch(e){case`queryOptions`:case`fetch`:case`ensureData`:case`prefetch`:case`getData`:case`setData`:case`setQueriesData`:return`query`;case`infiniteQueryOptions`:case`fetchInfinite`:case`prefetchInfinite`:case`getInfiniteData`:case`setInfiniteData`:return`infinite`;case`setMutationDefaults`:case`getMutationDefaults`:case`isMutating`:case`cancel`:case`invalidate`:case`refetch`:case`reset`:return`any`}};function Kr(e){return dn(t=>{let n=[...t.path],r=n.pop(),i=[...t.args],a=i.shift(),o=Br(n,a,Gr(r));return{infiniteQueryOptions:()=>e.infiniteQueryOptions(n,o,i[0]),queryOptions:()=>e.queryOptions(n,o,...i),fetch:()=>e.fetchQuery(o,...i),fetchInfinite:()=>e.fetchInfiniteQuery(o,i[0]),prefetch:()=>e.prefetchQuery(o,...i),prefetchInfinite:()=>e.prefetchInfiniteQuery(o,i[0]),ensureData:()=>e.ensureQueryData(o,...i),invalidate:()=>e.invalidateQueries(o,...i),reset:()=>e.resetQueries(o,...i),refetch:()=>e.refetchQueries(o,...i),cancel:()=>e.cancelQuery(o,...i),setData:()=>{e.setQueryData(o,i[0],i[1])},setQueriesData:()=>e.setQueriesData(o,i[0],i[1],i[2]),setInfiniteData:()=>{e.setInfiniteQueryData(o,i[0],i[1])},getData:()=>e.getQueryData(o),getInfiniteData:()=>e.getInfiniteQueryData(o),setMutationDefaults:()=>e.setMutationDefaults(Vr(n),a),getMutationDefaults:()=>e.getMutationDefaults(Vr(n)),isMutating:()=>e.isMutating({mutationKey:Vr(n)})}[r]()})}function qr(e){let t=cr(e.client),n=Kr(e);return fn(r=>{let i=r;return i===`client`?t:Ur.includes(i)?e[i]:n[r]})}var Jr=kr(Ir(),1);function Yr(e){let t=e instanceof ir?e:ur(e);return dn(e=>{let n=e.path,r=n.join(`.`),[i,a]=e.args;return(0,Jr.default)({queryKey:Br(n,i,`query`),queryFn:()=>t.query(r,i,a?.trpc)},a)})}var Xr=kr(Ir(),1);function Zr(e,t,n){let r=e[0],i=e[1]?.input;return n&&(i=(0,Xr.default)((0,Xr.default)((0,Xr.default)({},i??{}),n.pageParam?{cursor:n.pageParam}:{}),{},{direction:n.direction})),[r.join(`.`),i,t?.trpc]}var Qr=kr(Dr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){var t,n,i,a=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,i=Symbol.iterator);a--;){if(n&&(t=e[n])!=null)return t.call(e);if(i&&(t=e[i])!=null)return new r(t.call(e));n=`@@asyncIterator`,i=`@@iterator`}throw TypeError(`Object is not async iterable`)}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return r=function(e){this.s=e,this.n=e.next},r.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new r(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}})(),1);function $r(e){return{path:e.path.join(`.`)}}function ei(e){let t=$r(e);return k.useMemo(()=>t,[t])}async function ti(e,t,n){let r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:`success`});let i=[];var a=!1,o=!1,s;try{for(var c=(0,Qr.default)(e),l;a=!(l=await c.next()).done;a=!1){let e=l.value;i.push(e),r.setState({data:[...i]})}}catch(e){o=!0,s=e}finally{try{a&&c.return!=null&&await c.return()}finally{if(o)throw s}}return i}var j=kr(Ir(),1);function ni(e){let{client:t,queryClient:n}=e,r=t instanceof ir?t:ur(t);return{infiniteQueryOptions:(e,t,n)=>{let i=t[1]?.input===le;return Object.assign(wt((0,j.default)((0,j.default)({},n),{},{initialData:n?.initialData,queryKey:t,queryFn:i?le:async e=>{var i;let a=(0,j.default)((0,j.default)({},n),{},{trpc:(0,j.default)((0,j.default)({},n?.trpc),!(n==null||(i=n.trpc)==null)&&i.abortOnUnmount?{signal:e.signal}:{signal:null})});return await r.query(...Zr(t,a,{direction:e.direction,pageParam:e.pageParam}))},initialPageParam:n?.initialCursor??null})),{trpc:$r({path:e})})},queryOptions:(e,t,i)=>{let a=t[1]?.input===le;return Object.assign(Ct((0,j.default)((0,j.default)({},i),{},{initialData:i?.initialData,queryKey:t,queryFn:a?le:async e=>{var a;let o=(0,j.default)((0,j.default)({},i),{},{trpc:(0,j.default)((0,j.default)({},i?.trpc),!(i==null||(a=i.trpc)==null)&&a.abortOnUnmount?{signal:e.signal}:{signal:null})}),s=await r.query(...Zr(t,o));return Xt(s)?ti(s,n,t):s}})),{trpc:$r({path:e})})},fetchQuery:(e,t)=>n.fetchQuery((0,j.default)((0,j.default)({},t),{},{queryKey:e,queryFn:()=>r.query(...Zr(e,t))})),fetchInfiniteQuery:(e,t)=>n.fetchInfiniteQuery((0,j.default)((0,j.default)({},t),{},{queryKey:e,queryFn:({pageParam:n,direction:i})=>r.query(...Zr(e,t,{pageParam:n,direction:i})),initialPageParam:t?.initialCursor??null})),prefetchQuery:(e,t)=>n.prefetchQuery((0,j.default)((0,j.default)({},t),{},{queryKey:e,queryFn:()=>r.query(...Zr(e,t))})),prefetchInfiniteQuery:(e,t)=>n.prefetchInfiniteQuery((0,j.default)((0,j.default)({},t),{},{queryKey:e,queryFn:({pageParam:n,direction:i})=>r.query(...Zr(e,t,{pageParam:n,direction:i})),initialPageParam:t?.initialCursor??null})),ensureQueryData:(e,t)=>n.ensureQueryData((0,j.default)((0,j.default)({},t),{},{queryKey:e,queryFn:()=>r.query(...Zr(e,t))})),invalidateQueries:(e,t,r)=>n.invalidateQueries((0,j.default)((0,j.default)({},t),{},{queryKey:e}),r),resetQueries:(e,t,r)=>n.resetQueries((0,j.default)((0,j.default)({},t),{},{queryKey:e}),r),refetchQueries:(e,t,r)=>n.refetchQueries((0,j.default)((0,j.default)({},t),{},{queryKey:e}),r),cancelQuery:(e,t)=>n.cancelQueries({queryKey:e},t),setQueryData:(e,t,r)=>n.setQueryData(e,t,r),setQueriesData:(e,t,r,i)=>n.setQueriesData((0,j.default)((0,j.default)({},t),{},{queryKey:e}),r,i),getQueryData:e=>n.getQueryData(e),setInfiniteQueryData:(e,t,r)=>n.setQueryData(e,t,r),getInfiniteQueryData:e=>n.getQueryData(e),setMutationDefaults:(t,i)=>{let a=t[0];return n.setMutationDefaults(t,typeof i==`function`?i({canonicalMutationFn:t=>r.mutation(...Zr([a,{input:t}],e))}):i)},getMutationDefaults:e=>n.getMutationDefaults(e),isMutating:e=>n.isMutating((0,j.default)((0,j.default)({},e),{},{exact:!0}))}}var M=kr(Ir()),ri=(e,t)=>new Proxy(e,{get(e,n){return t(n),e[n]}});function ii(e){var t;let n=(e==null||(t=e.overrides)==null||(t=t.useMutation)==null?void 0:t.onSuccess)??(e=>e.originalFn()),r=e?.context??Wr,i=lr,a=e=>{let{abortOnUnmount:t=!1,queryClient:n,ssrContext:i}=e,[a,o]=k.useState(e.ssrState??!1),s=e.client instanceof ir?e.client:ur(e.client),c=k.useMemo(()=>ni({client:s,queryClient:n}),[s,n]),l=k.useMemo(()=>(0,M.default)({abortOnUnmount:t,queryClient:n,client:s,ssrContext:i??null,ssrState:a},c),[t,s,c,n,i,a]);return k.useEffect(()=>{o(e=>e?`mounted`:!1)},[]),(0,A.jsx)(r.Provider,{value:l,children:e.children})};function o(){let e=k.useContext(r);if(!e)throw Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return e}function s(e,t){let{queryClient:n,ssrState:r}=o();return r&&r!==`mounted`&&n.getQueryCache().find({queryKey:e})?.state.status===`error`?(0,M.default)({retryOnMount:!1},t):t}function c(t,n,r){var i,a;let{abortOnUnmount:c,client:l,ssrState:u,queryClient:d,prefetchQuery:f}=o(),p=Br(t,n,`query`),m=d.getQueryDefaults(p),h=n===le;typeof window>`u`&&u===`prepass`&&(r==null||(i=r.trpc)==null?void 0:i.ssr)!==!1&&(r?.enabled??m?.enabled)!==!1&&!h&&!d.getQueryCache().find({queryKey:p})&&f(p,r);let g=s(p,(0,M.default)((0,M.default)({},m),r)),_=(r==null||(a=r.trpc)==null?void 0:a.abortOnUnmount)??e?.abortOnUnmount??c,v=_t((0,M.default)((0,M.default)({},g),{},{queryKey:p,queryFn:h?n:async e=>{let t=(0,M.default)((0,M.default)({},g),{},{trpc:(0,M.default)((0,M.default)({},g?.trpc),_?{signal:e.signal}:{signal:null})}),n=await l.query(...Zr(p,t));return Xt(n)?ti(n,d,p):n}}),d);return v.trpc=ei({path:t}),v}function l(t,n,r){var i;let a=o(),s=Br(t,n,`query`),c=n===le,l=(r==null||(i=r.trpc)==null?void 0:i.abortOnUnmount)??e?.abortOnUnmount??a.abortOnUnmount;xt((0,M.default)((0,M.default)({},r),{},{queryKey:s,queryFn:c?n:e=>{let t={trpc:(0,M.default)((0,M.default)({},r?.trpc),l?{signal:e.signal}:{})};return a.client.query(...Zr(s,t))}}))}function u(t,n,r){var i;let a=o(),s=Br(t,n,`query`),c=(r==null||(i=r.trpc)==null?void 0:i.abortOnUnmount)??e?.abortOnUnmount??a.abortOnUnmount,l=vt((0,M.default)((0,M.default)({},r),{},{queryKey:s,queryFn:e=>{let t=(0,M.default)((0,M.default)({},r),{},{trpc:(0,M.default)((0,M.default)({},r?.trpc),c?{signal:e.signal}:{signal:null})});return a.client.query(...Zr(s,t))}}),a.queryClient);return l.trpc=ei({path:t}),[l.data,l]}function d(e,t){let{client:r,queryClient:i}=o(),a=Vr(e),s=i.defaultMutationOptions(i.getMutationDefaults(a)),c=Tt((0,M.default)((0,M.default)({},t),{},{mutationKey:a,mutationFn:n=>r.mutation(...Zr([e,{input:n}],t)),onSuccess(...e){return n({originalFn:()=>{var n,r;return(t==null||(n=t.onSuccess)==null?void 0:n.call(t,...e))??(s==null||(r=s.onSuccess)==null?void 0:r.call(s,...e))},queryClient:i,meta:t?.meta??s?.meta??{}})}}),i);return c.trpc=ei({path:e}),c}let f={data:void 0,error:null,status:`idle`},p={data:void 0,error:null,status:`connecting`};function m(e,t,n){let r=n?.enabled??t!==le,i=C(Br(e,t,`any`)),{client:a}=o(),s=k.useRef(n);k.useEffect(()=>{s.current=n});let[c]=k.useState(new Set([])),l=k.useCallback(e=>{c.add(e)},[c]),u=k.useRef(null),d=k.useCallback(e=>{let t=h.current,n=h.current=e(t),r=!1;for(let e of c)if(t[e]!==n[e]){r=!0;break}r&&_(ri(n,l))},[l,c]),m=k.useCallback(()=>{var n;if((n=u.current)==null||n.unsubscribe(),!r){d(()=>(0,M.default)((0,M.default)({},f),{},{reset:m}));return}d(()=>(0,M.default)((0,M.default)({},p),{},{reset:m}));let i=a.subscription(e.join(`.`),t??void 0,{onStarted:()=>{var e,t;(e=(t=s.current).onStarted)==null||e.call(t),d(e=>(0,M.default)((0,M.default)({},e),{},{status:`pending`,error:null}))},onData:e=>{var t,n;(t=(n=s.current).onData)==null||t.call(n,e),d(t=>(0,M.default)((0,M.default)({},t),{},{status:`pending`,data:e,error:null}))},onError:e=>{var t,n;(t=(n=s.current).onError)==null||t.call(n,e),d(t=>(0,M.default)((0,M.default)({},t),{},{status:`error`,error:e}))},onConnectionStateChange:e=>{d(t=>{switch(e.state){case`idle`:return(0,M.default)((0,M.default)({},t),{},{status:e.state,error:null,data:void 0});case`connecting`:return(0,M.default)((0,M.default)({},t),{},{error:e.error,status:e.state});case`pending`:return t}})},onComplete:()=>{var e,t;(e=(t=s.current).onComplete)==null||e.call(t),d(e=>(0,M.default)((0,M.default)({},e),{},{status:`idle`,error:null,data:void 0}))}});u.current=i},[a,i,r,d]);k.useEffect(()=>(m(),()=>{var e;(e=u.current)==null||e.unsubscribe()}),[m]);let h=k.useRef(r?(0,M.default)((0,M.default)({},p),{},{reset:m}):(0,M.default)((0,M.default)({},f),{},{reset:m})),[g,_]=k.useState(ri(h.current,l));return g}function h(e,t,n){var r,i;let{client:a,ssrState:c,prefetchInfiniteQuery:l,queryClient:u,abortOnUnmount:d}=o(),f=Br(e,t,`infinite`),p=u.getQueryDefaults(f),m=t===le;typeof window>`u`&&c===`prepass`&&(n==null||(r=n.trpc)==null?void 0:r.ssr)!==!1&&(n?.enabled??p?.enabled)!==!1&&!m&&!u.getQueryCache().find({queryKey:f})&&l(f,(0,M.default)((0,M.default)({},p),n));let h=s(f,(0,M.default)((0,M.default)({},p),n)),g=(n==null||(i=n.trpc)==null?void 0:i.abortOnUnmount)??d,_=Et((0,M.default)((0,M.default)({},h),{},{initialPageParam:n.initialCursor??null,persister:n.persister,queryKey:f,queryFn:m?t:e=>{let t=(0,M.default)((0,M.default)({},h),{},{trpc:(0,M.default)((0,M.default)({},h?.trpc),g?{signal:e.signal}:{signal:null})});return a.query(...Zr(f,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}),u);return _.trpc=ei({path:e}),_}function g(e,t,n){var r;let i=o(),a=Br(e,t,`infinite`),c=i.queryClient.getQueryDefaults(a),l=t===le,u=s(a,(0,M.default)((0,M.default)({},c),n)),d=(n==null||(r=n.trpc)==null?void 0:r.abortOnUnmount)??i.abortOnUnmount;St((0,M.default)((0,M.default)({},n),{},{initialPageParam:n.initialCursor??null,queryKey:a,queryFn:l?t:e=>{let t=(0,M.default)((0,M.default)({},u),{},{trpc:(0,M.default)((0,M.default)({},u?.trpc),d?{signal:e.signal}:{})});return i.client.query(...Zr(a,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}))}function _(e,t,n){var r;let i=o(),a=Br(e,t,`infinite`),c=i.queryClient.getQueryDefaults(a),l=s(a,(0,M.default)((0,M.default)({},c),n)),u=(n==null||(r=n.trpc)==null?void 0:r.abortOnUnmount)??i.abortOnUnmount,d=yt((0,M.default)((0,M.default)({},n),{},{initialPageParam:n.initialCursor??null,queryKey:a,queryFn:e=>{let t=(0,M.default)((0,M.default)({},l),{},{trpc:(0,M.default)((0,M.default)({},l?.trpc),u?{signal:e.signal}:{})});return i.client.query(...Zr(a,t,{pageParam:e.pageParam??n.initialCursor,direction:e.direction}))}}),i.queryClient);return d.trpc=ei({path:e}),[d.data,d]}return{Provider:a,createClient:i,useContext:o,useUtils:o,useQuery:c,usePrefetchQuery:l,useSuspenseQuery:u,useQueries:(e,t)=>{let{ssrState:n,queryClient:r,prefetchQuery:i,client:a}=o(),s=e(Yr(a));if(typeof window>`u`&&n===`prepass`)for(let e of s){let t=e;t.trpc?.ssr!==!1&&!r.getQueryCache().find({queryKey:t.queryKey})&&i(t.queryKey,t)}return ht({queries:s.map(e=>(0,M.default)((0,M.default)({},e),{},{queryKey:e.queryKey})),combine:t?.combine},r)},useSuspenseQueries:e=>{let{queryClient:t,client:n}=o(),r=bt({queries:e(Yr(n)).map(e=>(0,M.default)((0,M.default)({},e),{},{queryFn:e.queryFn,queryKey:e.queryKey}))},t);return[r.map(e=>e.data),r]},useMutation:d,useSubscription:m,useInfiniteQuery:h,usePrefetchInfiniteQuery:g,useSuspenseInfiniteQuery:_}}function ai(e){let t=Hr(e);return fn(n=>n===`useContext`||n===`useUtils`?()=>{let t=e.useUtils();return k.useMemo(()=>qr(t),[t])}:e.hasOwnProperty(n)?e[n]:t[n])}function oi(e){return ai(ii(e))}var N=oi();function si(e){return e.length===0?{view:`open`,projectId:null}:e.length===1?{view:`project`,projectId:e[0].id}:{view:`home`,projectId:null}}function ci(e){return e.status===`shipped`||e.activeRun?!1:e.ticketCounts.failed>0||e.phase===`ideation`||e.phase===`tickets`&&e.ticketCounts.total>0||e.phase===`review`}function li(e){let t=e.filter(e=>e.activeRun).length,n=e.filter(ci).length,r=e.filter(e=>e.status===`shipped`).length,i=e.length;return{total:i,needsYou:n,activeRuns:t,shipped:r,health:i===0?`empty`:n>0?`attention`:t>0?`working`:`steady`}}function ui(e){return e.reduce((e,t)=>e+t.activeRuns,0)}function di(){let e=N.project.list.useQuery(void 0,{refetchInterval:5e3}),t=e.data,[n,r]=(0,k.useState)(`home`),[i,a]=(0,k.useState)(null),o=(0,k.useRef)(!1);(0,k.useEffect)(()=>{if(o.current||!t)return;o.current=!0;let e=si(t);r(e.view),a(e.projectId)},[t]),(0,k.useEffect)(()=>{if(!(!t||!o.current)&&n===`project`&&!t.some(e=>e.id===i)){let e=si(t);r(e.view),a(e.projectId)}},[t,n,i]);let s=(0,k.useCallback)(()=>r(`home`),[]),c=(0,k.useCallback)(e=>{a(e),r(`project`)},[]),l=(0,k.useCallback)(()=>r(`open`),[]),u=(0,k.useCallback)(()=>{r(e=>e===`open`?i?`project`:`home`:e)},[i]),d=t?.find(e=>e.id===i);return{projects:t,loading:e.isLoading,view:n,currentProjectId:i,currentProject:d,goHome:s,enterProject:c,showOpen:l,cancelOpen:u}}function fi({size:e=16,...t}){return{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,...t}}function pi(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`}),(0,A.jsx)(`path`,{d:`M10.5 10.5 L14 14`})]})}function mi(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2`}),(0,A.jsx)(`path`,{d:`M8 1.8v2M8 12.2v2M1.8 8h2M12.2 8h2M3.6 3.6l1.4 1.4M11 11l1.4 1.4M12.4 3.6 11 5M5 11l-1.4 1.4`})]})}function hi(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`rect`,{x:`1.8`,y:`2.8`,width:`12.4`,height:`10.4`,rx:`1.6`}),(0,A.jsx)(`path`,{d:`M10.2 2.8v10.4`})]})}function gi(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`circle`,{cx:`4.5`,cy:`3.8`,r:`1.7`}),(0,A.jsx)(`circle`,{cx:`4.5`,cy:`12.2`,r:`1.7`}),(0,A.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.7`}),(0,A.jsx)(`path`,{d:`M4.5 5.5v5M11.5 6.7c0 2.6-3 3-5.4 3.6`})]})}function _i(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`path`,{d:`M8 2a4 4 0 0 0-4 4v2.6L2.8 11h10.4L12 8.6V6a4 4 0 0 0-4-4Z`}),(0,A.jsx)(`path`,{d:`M6.5 13.4a1.6 1.6 0 0 0 3 0`})]})}function vi(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`path`,{d:`M5.2 3.2A4 4 0 0 1 12 6v2.6L13.2 11H6.5M4 6.5V8.6L2.8 11h2.4`}),(0,A.jsx)(`path`,{d:`M6.5 13.4a1.6 1.6 0 0 0 3 0`}),(0,A.jsx)(`path`,{d:`M2 2l12 12`})]})}function yi(e){return(0,A.jsx)(`svg`,{...fi(e),children:(0,A.jsx)(`path`,{d:`M8 3.2v9.6M3.2 8h9.6`})})}function bi(e){return(0,A.jsx)(`svg`,{...fi(e),children:(0,A.jsx)(`path`,{d:`m3 8.4 3.2 3.2L13 5`})})}function xi(e){return(0,A.jsx)(`svg`,{...fi(e),children:(0,A.jsx)(`path`,{d:`m4 6 4 4 4-4`})})}function Si(e){return(0,A.jsx)(`svg`,{...fi(e),children:(0,A.jsx)(`path`,{d:`m6 4 4 4-4 4`})})}function Ci(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`circle`,{cx:`3.2`,cy:`8`,r:`1.1`,fill:`currentColor`,stroke:`none`}),(0,A.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.1`,fill:`currentColor`,stroke:`none`}),(0,A.jsx)(`circle`,{cx:`12.8`,cy:`8`,r:`1.1`,fill:`currentColor`,stroke:`none`})]})}function wi(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`rect`,{x:`1.8`,y:`2.8`,width:`12.4`,height:`10.4`,rx:`1.6`}),(0,A.jsx)(`path`,{d:`m4.5 6.2 2.3 2-2.3 2M8.5 10.4h3`})]})}function Ti(e){return(0,A.jsxs)(`svg`,{...fi(e),children:[(0,A.jsx)(`path`,{d:`M4 1.8h5.2L13 5.6v8.6H4z`}),(0,A.jsx)(`path`,{d:`M9 2v3.8h3.8M6 8.4h4M6 10.8h4`})]})}function Ei(e){return(0,A.jsx)(`svg`,{...fi(e),children:(0,A.jsx)(`path`,{d:`M1.8 4.2c0-.8.6-1.4 1.4-1.4h3l1.4 1.7h5.2c.8 0 1.4.6 1.4 1.4v6.5c0 .8-.6 1.4-1.4 1.4H3.2c-.8 0-1.4-.6-1.4-1.4z`})})}function Di(e){return(0,A.jsx)(`svg`,{...fi(e),children:(0,A.jsx)(`path`,{d:`M8 1.8 13 3.6v4.2c0 3.2-2.1 5.3-5 6.4-2.9-1.1-5-3.2-5-6.4V3.6z`})})}var Oi=`M4 29 V6 H10 V11 H13 V6 H19 V11 H22 V6 H28 V29 H4 Z M12.5 15 L21.5 20 L12.5 25 Z`;function ki({size:e=16,variant:t=`solid`,...n}){let r=t===`solid`?`var(--accent)`:t===`mono`?`currentColor`:t===`ink`?`var(--accent-ink)`:`none`;return(0,A.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 32 32`,fill:`none`,"aria-hidden":!0,...n,children:(0,A.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:Oi,fill:r,stroke:t===`outline`?`var(--accent-hi)`:`none`,strokeWidth:t===`outline`?1.5:0,strokeLinejoin:`miter`})})}function Ai({large:e}){return(0,A.jsxs)(`span`,{className:`wordmark${e?` is-lg`:``}`,children:[(0,A.jsx)(`span`,{className:`wordmark-run`,children:`run`}),(0,A.jsx)(`span`,{className:`wordmark-castle`,children:`castle`})]})}var ji=`runcastle.selected.v1`,Mi=`runcastle.inspector.collapsed`,Ni=`runcastle.guidance`;function Pi(e){return`${ji}:${e}`}function Fi(e){try{return localStorage.getItem(e)}catch{return null}}function Ii(e,t){try{localStorage.setItem(e,t)}catch{}}function Li(e){let t=Pi(e),[n,r]=(0,k.useState)(()=>Fi(t)),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(()=>Fi(Mi)===`1`),[u,d]=(0,k.useState)(!1),[f,p]=(0,k.useState)(!1),[m,h]=(0,k.useState)(()=>Fi(Ni)!==`0`);(0,k.useEffect)(()=>{n&&Ii(t,n)},[n,t]),(0,k.useEffect)(()=>{Ii(Mi,c?`1`:`0`)},[c]),(0,k.useEffect)(()=>{Ii(Ni,m?`1`:`0`)},[m]);let g=(0,k.useCallback)(e=>{r(e),a(null),s(!1),d(!1)},[]),_=(0,k.useCallback)(e=>a(e),[]),v=(0,k.useCallback)(()=>{s(!0),d(!1)},[]),y=(0,k.useCallback)(e=>{p(e),e&&d(!1)},[]);return{selectedFeatureId:n,viewedPhase:i,creating:o,inspectorCollapsed:c,cmdkOpen:u,settingsOpen:f,guidance:m,select:g,viewPhase:_,startCreate:v,cancelCreate:(0,k.useCallback)(()=>s(!1),[]),toggleInspector:(0,k.useCallback)(()=>l(e=>!e),[]),setCmdk:d,setSettings:y,toggleGuidance:(0,k.useCallback)(()=>h(e=>!e),[])}}function Ri({nav:e}){let[t,n]=(0,k.useState)(!1),r=(0,k.useRef)(null),i=e.projects??[];return(0,k.useEffect)(()=>{if(!t)return;let e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,i)}},[t]),(0,A.jsxs)(`div`,{className:`tb-switcher`,ref:r,children:[(0,A.jsxs)(`button`,{className:`tb-switcher-btn`,onClick:()=>n(e=>!e),title:`Switch project`,"aria-haspopup":`menu`,"aria-expanded":t,children:[(0,A.jsx)(`span`,{className:`tb-project`,children:e.currentProject?.name??`…`}),(0,A.jsx)(`span`,{className:`tb-switcher-caret`,children:(0,A.jsx)(xi,{size:11})})]}),t&&(0,A.jsxs)(`div`,{className:`tb-menu`,role:`menu`,children:[(0,A.jsx)(`div`,{className:`tb-menu-label`,children:`Projects`}),i.map(t=>(0,A.jsxs)(`button`,{className:`tb-menu-item${t.id===e.currentProjectId?` is-current`:``}`,role:`menuitem`,onClick:()=>{e.enterProject(t.id),n(!1)},children:[(0,A.jsx)(`span`,{className:`tb-menu-name`,children:t.name}),(0,A.jsx)(`span`,{className:`tb-menu-branch mono`,children:t.mainBranch}),t.id===e.currentProjectId&&(0,A.jsx)(`span`,{className:`tb-menu-check`,children:(0,A.jsx)(bi,{size:11})})]},t.id)),(0,A.jsx)(`div`,{className:`tb-menu-sep`}),(0,A.jsx)(`button`,{className:`tb-menu-item`,role:`menuitem`,onClick:()=>{e.goHome(),n(!1)},children:(0,A.jsx)(`span`,{className:`tb-menu-name`,children:`All projects`})}),(0,A.jsx)(`button`,{className:`tb-menu-item`,role:`menuitem`,onClick:()=>{e.showOpen(),n(!1)},children:(0,A.jsx)(`span`,{className:`tb-menu-name`,children:`Open a project…`})})]})]})}function zi({nav:e,onOpenCmdk:t,onOpenSettings:n,onToggleInspector:r,inspectorCollapsed:i}){let a=e.projects??[],o=N.useQueries(e=>a.map(t=>e.feature.list({projectId:t.id},{refetchInterval:1500}))),s=ui(o.map(e=>li(e.data??[]))),c=!o.some(e=>e.isError);return(0,A.jsxs)(`header`,{className:`titlebar`,children:[(0,A.jsxs)(`button`,{className:`tb-home`,onClick:e.goHome,title:a.length>1?`All projects`:`runcastle`,children:[(0,A.jsx)(`span`,{className:`tb-logo`,children:(0,A.jsx)(ki,{size:17})}),(0,A.jsx)(Ai,{})]}),(0,A.jsx)(`span`,{className:`tb-arrow`,children:`/`}),(0,A.jsx)(Ri,{nav:e}),(0,A.jsxs)(`span`,{className:`tb-branch`,children:[(0,A.jsx)(gi,{size:12}),e.currentProject?.mainBranch??`main`]}),(0,A.jsx)(`span`,{className:`tb-spacer`}),(0,A.jsxs)(`button`,{className:`tb-search`,onClick:t,title:`Search or jump to (⌘K)`,children:[(0,A.jsx)(pi,{size:13}),(0,A.jsx)(`span`,{children:`Search or jump to…`}),(0,A.jsx)(`span`,{className:`tb-search-spacer`}),(0,A.jsx)(`span`,{className:`kbd`,children:`⌘K`})]}),s>0&&(0,A.jsxs)(`button`,{className:`tb-runs`,onClick:e.goHome,title:`Runs in flight across all projects — open the portfolio`,children:[(0,A.jsx)(`span`,{className:`spin-ring`}),s,` run`,s===1?``:`s`]}),(0,A.jsx)(`span`,{className:`tb-health ${c?`is-ok`:`is-down`}`,title:c?`server healthy`:`server down`,children:(0,A.jsx)(`span`,{className:`health-dot`})}),(0,A.jsx)(`button`,{className:`tb-icon-btn`,title:`Settings`,"aria-label":`Settings`,onClick:n,children:(0,A.jsx)(mi,{size:14})}),(0,A.jsx)(`button`,{className:`tb-icon-btn${i?``:` is-on`}`,title:i?`Show details panel`:`Hide details panel`,"aria-label":i?`Show details panel`:`Hide details panel`,onClick:r,children:(0,A.jsx)(hi,{size:14})})]})}function P({variant:e=`ghost`,className:t,children:n,...r}){return(0,A.jsx)(`button`,{className:`btn btn-${e}${t?` ${t}`:``}`,...r,children:n})}function Bi({children:e}){return(0,A.jsx)(`div`,{className:`section-title`,children:e})}function F({children:e}){return(0,A.jsx)(`div`,{className:`dim-line mono`,children:e})}function Vi({icon:e,title:t,hint:n,action:r,compact:i}){return(0,A.jsxs)(`div`,{className:`empty-state${i?` is-compact`:``}`,children:[e&&(0,A.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,A.jsx)(`div`,{className:`empty-state-title`,children:t}),n&&(0,A.jsx)(`div`,{className:`empty-state-hint`,children:n}),r&&(0,A.jsx)(`div`,{className:`empty-state-action`,children:r})]})}function Hi({phase:e}){return(0,A.jsx)(`span`,{className:`tag phase-fg-${e}`,children:e})}function Ui({status:e}){return(0,A.jsx)(`span`,{className:`chip chip-ticket-${e}`,children:e})}function Wi({status:e}){return(0,A.jsx)(`span`,{className:`chip chip-run-${e}`,children:e})}function Gi({status:e}){return(0,A.jsx)(`span`,{className:`status-dot sess-dot-${e}`,title:e})}var Ki=(0,k.createContext)(null);function qi({children:e}){let[t,n]=(0,k.useState)([]),r=(0,k.useCallback)((e,t=`error`)=>{let r=Date.now()+Math.random();n(n=>[...n,{id:r,kind:t,message:e}]),setTimeout(()=>n(e=>e.filter(e=>e.id!==r)),6e3)},[]);return(0,A.jsxs)(Ki.Provider,{value:{push:r},children:[e,(0,A.jsx)(`div`,{className:`toasts`,children:t.map(e=>(0,A.jsx)(`div`,{className:`toast toast-${e.kind}`,onClick:()=>n(t=>t.filter(t=>t.id!==e.id)),children:e.message},e.id))})]})}function Ji(){let e=(0,k.useContext)(Ki);if(!e)throw Error(`useToast used outside ToastProvider`);return e}var Yi;function I(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Xi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Zi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Yi=globalThis).__zod_globalConfig??(Yi.__zod_globalConfig={});var Qi=globalThis.__zod_globalConfig;function $i(e){return e&&Object.assign(Qi,e),Qi}function ea(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ta(e,t){return typeof t==`bigint`?t.toString():t}function na(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function ra(e){return e==null}function ia(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function aa(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var oa=Symbol(`evaluating`);function sa(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==oa)return r===void 0&&(r=oa,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ca(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function la(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ua(e){return JSON.stringify(e)}function da(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var fa=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function pa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ma=na(()=>{if(Qi.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ha(e){if(pa(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(pa(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ga(e){return ha(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _a=new Set([`string`,`number`,`symbol`]);function va(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ya(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ba(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var xa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Sa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ya(e,la(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ca(this,`shape`,e),e},checks:[]}))}function Ca(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ya(e,la(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ca(this,`shape`,r),r},checks:[]}))}function wa(e,t){if(!ha(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ya(e,la(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ca(this,`shape`,n),n}}))}function Ta(e,t){if(!ha(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ya(e,la(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ca(this,`shape`,n),n}}))}function Ea(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ya(e,la(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ca(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Da(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return ya(t,la(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ca(this,`shape`,i),i},checks:[]}))}function Oa(e,t,n){return ya(t,la(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ca(this,`shape`,i),i}}))}function ka(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Aa(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ja(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ma(e){return typeof e==`string`?e:e?.message}function Na(e,t,n){let r=e.message?e.message:Ma(e.inst?._zod.def?.error?.(e))??Ma(t?.error?.(e))??Ma(n.customError?.(e))??Ma(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Pa(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Fa(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ia=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ta,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},La=I(`$ZodError`,Ia),Ra=I(`$ZodError`,Ia,{Parent:Error});function za(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ba(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Va=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Xi;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Na(e,a,$i())));throw fa(t,i?.callee),t}return o.value},Ha=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Na(e,a,$i())));throw fa(t,i?.callee),t}return o.value},Ua=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Xi;return a.issues.length?{success:!1,error:new(e??La)(a.issues.map(e=>Na(e,i,$i())))}:{success:!0,data:a.value}},Wa=Ua(Ra),Ga=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Na(e,i,$i())))}:{success:!0,data:a.value}},Ka=Ga(Ra),qa=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Va(e)(t,n,i)},Ja=e=>(t,n,r)=>Va(e)(t,n,r),Ya=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ha(e)(t,n,i)},Xa=e=>async(t,n,r)=>Ha(e)(t,n,r),Za=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ua(e)(t,n,i)},Qa=e=>(t,n,r)=>Ua(e)(t,n,r),$a=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ga(e)(t,n,i)},eo=e=>async(t,n,r)=>Ga(e)(t,n,r),to=/^[cC][0-9a-z]{6,}$/,no=/^[0-9a-z]+$/,ro=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,io=/^[0-9a-vA-V]{20}$/,ao=/^[A-Za-z0-9]{27}$/,oo=/^[a-zA-Z0-9_-]{21}$/,so=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,co=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lo=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,uo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function po(){return new RegExp(fo,`u`)}var mo=/^(?:(?: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])$/,ho=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){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}|:))$/,R=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,go=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_o=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vo=/^[A-Za-z0-9_-]*$/,yo=/^https?$/,bo=/^\+[1-9]\d{6,14}$/,xo=`(?:(?:\\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])))`,So=RegExp(`^${xo}$`);function Co(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function wo(e){return RegExp(`^${Co(e)}$`)}function To(e){let t=Co({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${xo}T(?:${r})$`)}var Eo=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Do=/^-?\d+$/,Oo=/^-?\d+(?:\.\d+)?$/,ko=/^(?:true|false)$/i,Ao=/^null$/i,jo=/^[^A-Z]*$/,Mo=/^[^a-z]*$/,No=I(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Po={number:`number`,bigint:`bigint`,object:`date`},Fo=I(`$ZodCheckLessThan`,(e,t)=>{No.init(e,t);let n=Po[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Io=I(`$ZodCheckGreaterThan`,(e,t)=>{No.init(e,t);let n=Po[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lo=I(`$ZodCheckMultipleOf`,(e,t)=>{No.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):aa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ro=I(`$ZodCheckNumberFormat`,(e,t)=>{No.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=xa[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Do)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),zo=I(`$ZodCheckMaxLength`,(e,t)=>{var n;No.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ra(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Pa(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bo=I(`$ZodCheckMinLength`,(e,t)=>{var n;No.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ra(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Pa(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vo=I(`$ZodCheckLengthEquals`,(e,t)=>{var n;No.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ra(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Pa(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ho=I(`$ZodCheckStringFormat`,(e,t)=>{var n,r;No.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Uo=I(`$ZodCheckRegex`,(e,t)=>{Ho.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Wo=I(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=jo,Ho.init(e,t)}),Go=I(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Mo,Ho.init(e,t)}),Ko=I(`$ZodCheckIncludes`,(e,t)=>{No.init(e,t);let n=va(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),qo=I(`$ZodCheckStartsWith`,(e,t)=>{No.init(e,t);let n=RegExp(`^${va(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Jo=I(`$ZodCheckEndsWith`,(e,t)=>{No.init(e,t);let n=RegExp(`.*${va(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Yo=I(`$ZodCheckOverwrite`,(e,t)=>{No.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Xo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
10
10
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
11
11
  `))}},Zo={major:4,minor:4,patch:3},Qo=I(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zo;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ka(e),i;for(let a of t){if(a._zod.def.when){if(Aa(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Xi;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ka(e,t))});else{if(e.issues.length===t)continue;r||=ka(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ka(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Xi;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Xi;return o.then(e=>t(e,r,a))}return t(o,r,a)}}sa(e,`~standard`,()=>({validate:t=>{try{let n=Wa(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ka(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),$o=I(`$ZodString`,(e,t)=>{Qo.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Eo(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),es=I(`$ZodStringFormat`,(e,t)=>{Ho.init(e,t),$o.init(e,t)}),ts=I(`$ZodGUID`,(e,t)=>{t.pattern??=co,es.init(e,t)}),ns=I(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=lo(e)}else t.pattern??=lo();es.init(e,t)}),rs=I(`$ZodEmail`,(e,t)=>{t.pattern??=uo,es.init(e,t)}),is=I(`$ZodURL`,(e,t)=>{es.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===yo.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),as=I(`$ZodEmoji`,(e,t)=>{t.pattern??=po(),es.init(e,t)}),os=I(`$ZodNanoID`,(e,t)=>{t.pattern??=oo,es.init(e,t)}),ss=I(`$ZodCUID`,(e,t)=>{t.pattern??=to,es.init(e,t)}),cs=I(`$ZodCUID2`,(e,t)=>{t.pattern??=no,es.init(e,t)}),ls=I(`$ZodULID`,(e,t)=>{t.pattern??=ro,es.init(e,t)}),us=I(`$ZodXID`,(e,t)=>{t.pattern??=io,es.init(e,t)}),ds=I(`$ZodKSUID`,(e,t)=>{t.pattern??=ao,es.init(e,t)}),fs=I(`$ZodISODateTime`,(e,t)=>{t.pattern??=To(t),es.init(e,t)}),ps=I(`$ZodISODate`,(e,t)=>{t.pattern??=So,es.init(e,t)}),ms=I(`$ZodISOTime`,(e,t)=>{t.pattern??=wo(t),es.init(e,t)}),hs=I(`$ZodISODuration`,(e,t)=>{t.pattern??=so,es.init(e,t)}),gs=I(`$ZodIPv4`,(e,t)=>{t.pattern??=mo,es.init(e,t),e._zod.bag.format=`ipv4`}),_s=I(`$ZodIPv6`,(e,t)=>{t.pattern??=ho,es.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),vs=I(`$ZodCIDRv4`,(e,t)=>{t.pattern??=R,es.init(e,t)}),ys=I(`$ZodCIDRv6`,(e,t)=>{t.pattern??=go,es.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function bs(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var xs=I(`$ZodBase64`,(e,t)=>{t.pattern??=_o,es.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{bs(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Ss(e){if(!vo.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return bs(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Cs=I(`$ZodBase64URL`,(e,t)=>{t.pattern??=vo,es.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Ss(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ws=I(`$ZodE164`,(e,t)=>{t.pattern??=bo,es.init(e,t)});function Ts(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Es=I(`$ZodJWT`,(e,t)=>{es.init(e,t),e._zod.check=n=>{Ts(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ds=I(`$ZodNumber`,(e,t)=>{Qo.init(e,t),e._zod.pattern=e._zod.bag.pattern??Oo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Os=I(`$ZodNumberFormat`,(e,t)=>{Ro.init(e,t),Ds.init(e,t)}),ks=I(`$ZodBoolean`,(e,t)=>{Qo.init(e,t),e._zod.pattern=ko,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),As=I(`$ZodNull`,(e,t)=>{Qo.init(e,t),e._zod.pattern=Ao,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),js=I(`$ZodUnknown`,(e,t)=>{Qo.init(e,t),e._zod.parse=e=>e}),Ms=I(`$ZodNever`,(e,t)=>{Qo.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ns(e,t,n){e.issues.length&&t.issues.push(...ja(n,e.issues)),t.value[n]=e.value}var Ps=I(`$ZodArray`,(e,t)=>{Qo.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Ns(t,n,e))):Ns(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Fs(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...ja(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Is(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ba(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ls(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Fs(e,n,i,t,u,d))):Fs(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Rs=I(`$ZodObject`,(e,t)=>{if(Qo.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=na(()=>Is(t));sa(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=pa,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Fs(n,t,e,s,r,i))):Fs(a,t,e,s,r,i)}return i?Ls(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),zs=I(`$ZodObjectJIT`,(e,t)=>{Rs.init(e,t);let n=e._zod.parse,r=na(()=>Is(t)),i=e=>{let t=new Xo([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ua(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ua(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
@@ -69,17 +69,17 @@ Error generating stack: `+e.message+`
69
69
 
70
70
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=pa,s=!Qi.jitless,c=s&&ma.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Ls([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Bs(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ka(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Na(e,r,$i())))}),t)}var Vs=I(`$ZodUnion`,(e,t)=>{Qo.init(e,t),sa(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),sa(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),sa(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),sa(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ia(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Bs(t,r,e,i)):Bs(o,r,e,i)}}),Hs=I(`$ZodIntersection`,(e,t)=>{Qo.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ws(e,t,n)):Ws(e,i,a)}});function Us(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ha(e)&&ha(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Us(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Us(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ws(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ka(e))return e;let o=Us(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Gs=I(`$ZodRecord`,(e,t)=>{Qo.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ha(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Na(e,r,$i())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...ja(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...ja(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Oo.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Na(e,r,$i())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...ja(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...ja(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ks=I(`$ZodEnum`,(e,t)=>{Qo.init(e,t);let n=ea(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>_a.has(typeof e)).map(e=>typeof e==`string`?va(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),qs=I(`$ZodTransform`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zi(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Xi;return n.value=i,n.fallback=!0,n}});function Js(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ys=I(`$ZodOptional`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,sa(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),sa(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ia(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Js(e,r)):Js(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Xs=I(`$ZodExactOptional`,(e,t)=>{Ys.init(e,t),sa(e._zod,`values`,()=>t.innerType._zod.values),sa(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Zs=I(`$ZodNullable`,(e,t)=>{Qo.init(e,t),sa(e._zod,`optin`,()=>t.innerType._zod.optin),sa(e._zod,`optout`,()=>t.innerType._zod.optout),sa(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ia(e.source)}|null)$`):void 0}),sa(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Qs=I(`$ZodDefault`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,sa(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>$s(e,t)):$s(r,t)}});function $s(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ec=I(`$ZodPrefault`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,sa(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),tc=I(`$ZodNonOptional`,(e,t)=>{Qo.init(e,t),sa(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>nc(t,e)):nc(i,e)}});function nc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var rc=I(`$ZodCatch`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,sa(e._zod,`optout`,()=>t.innerType._zod.optout),sa(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Na(e,n,$i()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Na(e,n,$i()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),ic=I(`$ZodPipe`,(e,t)=>{Qo.init(e,t),sa(e._zod,`values`,()=>t.in._zod.values),sa(e._zod,`optin`,()=>t.in._zod.optin),sa(e._zod,`optout`,()=>t.out._zod.optout),sa(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ac(e,t.in,n)):ac(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ac(e,t.out,n)):ac(r,t.out,n)}});function ac(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var oc=I(`$ZodPreprocess`,(e,t)=>{ic.init(e,t)}),sc=I(`$ZodReadonly`,(e,t)=>{Qo.init(e,t),sa(e._zod,`propValues`,()=>t.innerType._zod.propValues),sa(e._zod,`values`,()=>t.innerType._zod.values),sa(e._zod,`optin`,()=>t.innerType?._zod?.optin),sa(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(cc):cc(r)}});function cc(e){return e.value=Object.freeze(e.value),e}var lc=I(`$ZodCustom`,(e,t)=>{No.init(e,t),Qo.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>uc(t,n,r,e));uc(i,n,r,e)}});function uc(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Fa(e))}}var dc,fc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function pc(){return new fc}(dc=globalThis).__zod_globalRegistry??(dc.__zod_globalRegistry=pc());var mc=globalThis.__zod_globalRegistry;function hc(e,t){return new e({type:`string`,...L(t)})}function gc(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function _c(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function vc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function yc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function bc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function xc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function Sc(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function Cc(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function wc(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function Tc(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function Ec(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function Dc(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function Oc(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function kc(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function Ac(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function jc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function Mc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function Nc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function Pc(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function Fc(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function Ic(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function Lc(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function Rc(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function zc(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function Bc(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function Vc(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function Hc(e,t){return new e({type:`number`,checks:[],...L(t)})}function Uc(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function Wc(e,t){return new e({type:`boolean`,...L(t)})}function Gc(e,t){return new e({type:`null`,...L(t)})}function Kc(e){return new e({type:`unknown`})}function qc(e,t){return new e({type:`never`,...L(t)})}function Jc(e,t){return new Fo({check:`less_than`,...L(t),value:e,inclusive:!1})}function Yc(e,t){return new Fo({check:`less_than`,...L(t),value:e,inclusive:!0})}function Xc(e,t){return new Io({check:`greater_than`,...L(t),value:e,inclusive:!1})}function Zc(e,t){return new Io({check:`greater_than`,...L(t),value:e,inclusive:!0})}function Qc(e,t){return new Lo({check:`multiple_of`,...L(t),value:e})}function $c(e,t){return new zo({check:`max_length`,...L(t),maximum:e})}function el(e,t){return new Bo({check:`min_length`,...L(t),minimum:e})}function tl(e,t){return new Vo({check:`length_equals`,...L(t),length:e})}function nl(e,t){return new Uo({check:`string_format`,format:`regex`,...L(t),pattern:e})}function rl(e){return new Wo({check:`string_format`,format:`lowercase`,...L(e)})}function il(e){return new Go({check:`string_format`,format:`uppercase`,...L(e)})}function al(e,t){return new Ko({check:`string_format`,format:`includes`,...L(t),includes:e})}function ol(e,t){return new qo({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function sl(e,t){return new Jo({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function cl(e){return new Yo({check:`overwrite`,tx:e})}function ll(e){return cl(t=>t.normalize(e))}function ul(){return cl(e=>e.trim())}function dl(){return cl(e=>e.toLowerCase())}function fl(){return cl(e=>e.toUpperCase())}function pl(){return cl(e=>da(e))}function ml(e,t,n){return new e({type:`array`,element:t,...L(n)})}function hl(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function gl(e,t){let n=_l(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Fa(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Fa(r))}},e(t.value,t)),t);return n}function _l(e,t){let n=new No({check:`custom`,...L(t)});return n._zod.check=e,n}function vl(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??mc,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function yl(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,yl(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Sl(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function bl(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
71
71
 
72
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function xl(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:wl(t,`input`,e.processors),output:wl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Sl(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Sl(r.element,n);if(r.type===`set`)return Sl(r.valueType,n);if(r.type===`lazy`)return Sl(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Sl(r.innerType,n);if(r.type===`intersection`)return Sl(r.left,n)||Sl(r.right,n);if(r.type===`record`||r.type===`map`)return Sl(r.keyType,n)||Sl(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Sl(r.in,n)||Sl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Sl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Sl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Sl(e,n))return!0;return!!(r.rest&&Sl(r.rest,n))}return!1}var Cl=(e,t={})=>n=>{let r=vl({...n,processors:t});return yl(e,r),bl(r,e),xl(r,e)},wl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=vl({...i??{},target:a,io:t,processors:n});return yl(e,o),bl(o,e),xl(o,e)},Tl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},El=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Tl[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Dl=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ol=(e,t,n,r)=>{n.type=`boolean`},kl=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Al=(e,t,n,r)=>{n.not={}},jl=(e,t,n,r)=>{let i=e._zod.def,a=ea(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ml=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Nl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Pl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=yl(a.element,t,{...r,path:[...r.path,`items`]})},Fl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=yl(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=yl(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Il=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>yl(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ll=(e,t,n,r)=>{let i=e._zod.def,a=yl(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=yl(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Rl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=yl(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=yl(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=yl(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},zl=(e,t,n,r)=>{let i=e._zod.def,a=yl(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Bl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Hl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ul=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Wl=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;yl(o,t,r);let s=t.seen.get(e);s.ref=o},Gl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},z=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Kl=I(`ZodISODateTime`,(e,t)=>{fs.init(e,t),hu.init(e,t)});function B(e){return Rc(Kl,e)}var V=I(`ZodISODate`,(e,t)=>{ps.init(e,t),hu.init(e,t)});function ql(e){return zc(V,e)}var Jl=I(`ZodISOTime`,(e,t)=>{ms.init(e,t),hu.init(e,t)});function Yl(e){return Bc(Jl,e)}var Xl=I(`ZodISODuration`,(e,t)=>{hs.init(e,t),hu.init(e,t)});function Zl(e){return Vc(Xl,e)}var Ql=I(`ZodError`,(e,t)=>{La.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ba(e,t)},flatten:{value:t=>za(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ta,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ta,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),$l=Va(Ql),eu=Ha(Ql),tu=Ua(Ql),nu=Ga(Ql),ru=qa(Ql),iu=Ja(Ql),au=Ya(Ql),ou=Xa(Ql),su=Za(Ql),cu=Qa(Ql),lu=$a(Ql),uu=eo(Ql),du=new WeakMap;function fu(e,t,n){let r=Object.getPrototypeOf(e),i=du.get(r);if(i||(i=new Set,du.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var H=I(`ZodType`,(e,t)=>(Qo.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:wl(e,`input`),output:wl(e,`output`)}}),e.toJSONSchema=Cl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>$l(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>tu(e,t,n),e.parseAsync=async(t,n)=>eu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>nu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ru(e,t,n),e.decode=(t,n)=>iu(e,t,n),e.encodeAsync=async(t,n)=>au(e,t,n),e.decodeAsync=async(t,n)=>ou(e,t,n),e.safeEncode=(t,n)=>su(e,t,n),e.safeDecode=(t,n)=>cu(e,t,n),e.safeEncodeAsync=async(t,n)=>lu(e,t,n),e.safeDecodeAsync=async(t,n)=>uu(e,t,n),fu(e,`ZodType`,{check(...e){let t=this.def;return this.clone(la(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ya(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ed(e,t))},superRefine(e,t){return this.check(G(e,t))},overwrite(e){return this.check(cl(e))},optional(){return sd(this)},exactOptional(){return ld(this)},nullable(){return dd(this)},nullish(){return sd(dd(this))},nonoptional(e){return _d(this,e)},array(){return Ju(this)},or(e){return W([this,e])},and(e){return $u(this,e)},transform(e){return xd(this,ad(e))},default(e){return pd(this,e)},prefault(e){return hd(this,e)},catch(e){return yd(this,e)},pipe(e){return xd(this,e)},readonly(){return wd(this)},describe(e){let t=this.clone();return mc.add(t,{description:e}),t},meta(...e){if(e.length===0)return mc.get(this);let t=this.clone();return mc.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return mc.get(e)?.description},configurable:!0}),e)),pu=I(`_ZodString`,(e,t)=>{$o.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fu(e,`_ZodString`,{regex(...e){return this.check(nl(...e))},includes(...e){return this.check(al(...e))},startsWith(...e){return this.check(ol(...e))},endsWith(...e){return this.check(sl(...e))},min(...e){return this.check(el(...e))},max(...e){return this.check($c(...e))},length(...e){return this.check(tl(...e))},nonempty(...e){return this.check(el(1,...e))},lowercase(e){return this.check(rl(e))},uppercase(e){return this.check(il(e))},trim(){return this.check(ul())},normalize(...e){return this.check(ll(...e))},toLowerCase(){return this.check(dl())},toUpperCase(){return this.check(fl())},slugify(){return this.check(pl())}})}),mu=I(`ZodString`,(e,t)=>{$o.init(e,t),pu.init(e,t),e.email=t=>e.check(gc(gu,t)),e.url=t=>e.check(Sc(yu,t)),e.jwt=t=>e.check(Lc(Pu,t)),e.emoji=t=>e.check(Cc(bu,t)),e.guid=t=>e.check(_c(_u,t)),e.uuid=t=>e.check(vc(vu,t)),e.uuidv4=t=>e.check(yc(vu,t)),e.uuidv6=t=>e.check(bc(vu,t)),e.uuidv7=t=>e.check(xc(vu,t)),e.nanoid=t=>e.check(wc(xu,t)),e.guid=t=>e.check(_c(_u,t)),e.cuid=t=>e.check(Tc(Su,t)),e.cuid2=t=>e.check(Ec(Cu,t)),e.ulid=t=>e.check(Dc(wu,t)),e.base64=t=>e.check(Pc(ju,t)),e.base64url=t=>e.check(Fc(Mu,t)),e.xid=t=>e.check(Oc(Tu,t)),e.ksuid=t=>e.check(kc(Eu,t)),e.ipv4=t=>e.check(Ac(Du,t)),e.ipv6=t=>e.check(jc(Ou,t)),e.cidrv4=t=>e.check(Mc(ku,t)),e.cidrv6=t=>e.check(Nc(Au,t)),e.e164=t=>e.check(Ic(Nu,t)),e.datetime=t=>e.check(B(t)),e.date=t=>e.check(ql(t)),e.time=t=>e.check(Yl(t)),e.duration=t=>e.check(Zl(t))});function U(e){return hc(mu,e)}var hu=I(`ZodStringFormat`,(e,t)=>{es.init(e,t),pu.init(e,t)}),gu=I(`ZodEmail`,(e,t)=>{rs.init(e,t),hu.init(e,t)}),_u=I(`ZodGUID`,(e,t)=>{ts.init(e,t),hu.init(e,t)}),vu=I(`ZodUUID`,(e,t)=>{ns.init(e,t),hu.init(e,t)}),yu=I(`ZodURL`,(e,t)=>{is.init(e,t),hu.init(e,t)}),bu=I(`ZodEmoji`,(e,t)=>{as.init(e,t),hu.init(e,t)}),xu=I(`ZodNanoID`,(e,t)=>{os.init(e,t),hu.init(e,t)}),Su=I(`ZodCUID`,(e,t)=>{ss.init(e,t),hu.init(e,t)}),Cu=I(`ZodCUID2`,(e,t)=>{cs.init(e,t),hu.init(e,t)}),wu=I(`ZodULID`,(e,t)=>{ls.init(e,t),hu.init(e,t)}),Tu=I(`ZodXID`,(e,t)=>{us.init(e,t),hu.init(e,t)}),Eu=I(`ZodKSUID`,(e,t)=>{ds.init(e,t),hu.init(e,t)}),Du=I(`ZodIPv4`,(e,t)=>{gs.init(e,t),hu.init(e,t)}),Ou=I(`ZodIPv6`,(e,t)=>{_s.init(e,t),hu.init(e,t)}),ku=I(`ZodCIDRv4`,(e,t)=>{vs.init(e,t),hu.init(e,t)}),Au=I(`ZodCIDRv6`,(e,t)=>{ys.init(e,t),hu.init(e,t)}),ju=I(`ZodBase64`,(e,t)=>{xs.init(e,t),hu.init(e,t)}),Mu=I(`ZodBase64URL`,(e,t)=>{Cs.init(e,t),hu.init(e,t)}),Nu=I(`ZodE164`,(e,t)=>{ws.init(e,t),hu.init(e,t)}),Pu=I(`ZodJWT`,(e,t)=>{Es.init(e,t),hu.init(e,t)}),Fu=I(`ZodNumber`,(e,t)=>{Ds.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),fu(e,`ZodNumber`,{gt(e,t){return this.check(Xc(e,t))},gte(e,t){return this.check(Zc(e,t))},min(e,t){return this.check(Zc(e,t))},lt(e,t){return this.check(Jc(e,t))},lte(e,t){return this.check(Yc(e,t))},max(e,t){return this.check(Yc(e,t))},int(e){return this.check(Ru(e))},safe(e){return this.check(Ru(e))},positive(e){return this.check(Xc(0,e))},nonnegative(e){return this.check(Zc(0,e))},negative(e){return this.check(Jc(0,e))},nonpositive(e){return this.check(Yc(0,e))},multipleOf(e,t){return this.check(Qc(e,t))},step(e,t){return this.check(Qc(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Iu(e){return Hc(Fu,e)}var Lu=I(`ZodNumberFormat`,(e,t)=>{Os.init(e,t),Fu.init(e,t)});function Ru(e){return Uc(Lu,e)}var zu=I(`ZodBoolean`,(e,t)=>{ks.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r)});function Bu(e){return Wc(zu,e)}var Vu=I(`ZodNull`,(e,t)=>{As.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r)});function Hu(e){return Gc(Vu,e)}var Uu=I(`ZodUnknown`,(e,t)=>{js.init(e,t),H.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Wu(){return Kc(Uu)}var Gu=I(`ZodNever`,(e,t)=>{Ms.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r)});function Ku(e){return qc(Gu,e)}var qu=I(`ZodArray`,(e,t)=>{Ps.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.element=t.element,fu(e,`ZodArray`,{min(e,t){return this.check(el(e,t))},nonempty(e){return this.check(el(1,e))},max(e,t){return this.check($c(e,t))},length(e,t){return this.check(tl(e,t))},unwrap(){return this.element}})});function Ju(e,t){return ml(qu,e,t)}var Yu=I(`ZodObject`,(e,t)=>{zs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fl(e,t,n,r),sa(e,`shape`,()=>t.shape),fu(e,`ZodObject`,{keyof(){return rd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Wu()})},loose(){return this.clone({...this._zod.def,catchall:Wu()})},strict(){return this.clone({...this._zod.def,catchall:Ku()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return wa(this,e)},safeExtend(e){return Ta(this,e)},merge(e){return Ea(this,e)},pick(e){return Sa(this,e)},omit(e){return Ca(this,e)},partial(...e){return Da(od,this,e[0])},required(...e){return Oa(gd,this,e[0])}})});function Xu(e,t){return new Yu({type:`object`,shape:e??{},...L(t)})}var Zu=I(`ZodUnion`,(e,t)=>{Vs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Il(e,t,n,r),e.options=t.options});function W(e,t){return new Zu({type:`union`,options:e,...L(t)})}var Qu=I(`ZodIntersection`,(e,t)=>{Hs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ll(e,t,n,r)});function $u(e,t){return new Qu({type:`intersection`,left:e,right:t})}var ed=I(`ZodRecord`,(e,t)=>{Gs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function td(e,t,n){let r=ya(e);return r._zod.values=void 0,new ed({type:`record`,keyType:r,valueType:t,...L(n)})}var nd=I(`ZodEnum`,(e,t)=>{Ks.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new nd({...t,checks:[],...L(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nd({...t,checks:[],...L(r),entries:i})}});function rd(e,t){return new nd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var id=I(`ZodTransform`,(e,t)=>{qs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Fa(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Fa(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ad(e){return new id({type:`transform`,transform:e})}var od=I(`ZodOptional`,(e,t)=>{Ys.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sd(e){return new od({type:`optional`,innerType:e})}var cd=I(`ZodExactOptional`,(e,t)=>{Xs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ld(e){return new cd({type:`optional`,innerType:e})}var ud=I(`ZodNullable`,(e,t)=>{Zs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dd(e){return new ud({type:`nullable`,innerType:e})}var fd=I(`ZodDefault`,(e,t)=>{Qs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pd(e,t){return new fd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ga(t)}})}var md=I(`ZodPrefault`,(e,t)=>{ec.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hd(e,t){return new md({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ga(t)}})}var gd=I(`ZodNonOptional`,(e,t)=>{tc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _d(e,t){return new gd({type:`nonoptional`,innerType:e,...L(t)})}var vd=I(`ZodCatch`,(e,t)=>{rc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ul(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yd(e,t){return new vd({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var bd=I(`ZodPipe`,(e,t)=>{ic.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wl(e,t,n,r),e.in=t.in,e.out=t.out});function xd(e,t){return new bd({type:`pipe`,in:e,out:t})}var Sd=I(`ZodPreprocess`,(e,t)=>{bd.init(e,t),oc.init(e,t)}),Cd=I(`ZodReadonly`,(e,t)=>{sc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wd(e){return new Cd({type:`readonly`,innerType:e})}var Td=I(`ZodCustom`,(e,t)=>{lc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r)});function Ed(e,t={}){return hl(Td,e,t)}function G(e,t){return gl(e,t)}function Dd(e,t){return new Sd({type:`pipe`,in:ad(e),out:t})}var Od=rd([`ideation`,`spec`,`tickets`,`implementation`,`review`,`shipped`]),kd=rd([`pending`,`burning`,`done`,`failed`,`cancelled`]),Ad=rd([`ideation`,`qa`,`waypoint`,`converge`,`revisit`]),jd=rd([`running`,`succeeded`,`failed`,`cancelled`]),Md=rd([`active`,`shipped`,`archived`]),Nd=rd([`launching`,`live`,`ended`]);Xu({title:U(),goal:U(),context:U(),acceptanceCriteria:Ju(U()),seams:Ju(U()),blockedBy:Ju(Iu())}).extend({id:U(),featureId:U(),seq:Iu(),status:kd,commits:Ju(U()),error:U().optional(),attemptBranch:U().optional()});var Pd=rd([`grilling`,`research`,`prototype`,`task`]),Fd=rd([`open`,`claimed`,`resolved`,`dropped`]);rd([`resolved`,`dropped`]),Xu({title:U(),type:Pd,question:U(),blockedBy:Ju(W([Iu(),U()])),originWaypointId:U().optional()}).extend({id:U(),featureId:U(),seq:Iu(),blockedBy:Ju(Iu()),status:Fd,claimedBy:U().optional(),lastSessionId:U().optional(),summary:U().optional()}),Xu({id:U(),name:U(),repoPath:U(),mainBranch:U(),devCommand:U().optional(),model:U().optional()}),Xu({id:U(),projectId:U(),slug:U(),title:U(),oneLiner:U(),mapped:Bu(),phase:Od,branch:U(),baseBranch:U().optional(),status:Md,createdAt:Iu()}),Xu({id:U(),featureId:U(),kind:Ad,ccSessionId:U().optional(),transcriptPath:U().optional(),status:Nd,worktreePath:U()}),Xu({id:U(),featureId:U(),workflow:U(),status:jd,startedAt:Iu(),endedAt:Iu().optional(),summary:U().optional()});var Id=rd([`env`,`project`,`file`,`default`]),Ld=rd([`global`,`project`]),Rd=Xu({key:U(),value:Wu(),source:Id,editable:Bu(),restartRequired:Bu(),scope:Ld});Xu({projectId:U().optional(),fields:Ju(Rd)}),Xu({projectId:U().optional(),key:U(),value:W([U(),Iu(),Bu(),Hu()])}),Xu({id:Iu(),projectId:U(),featureId:U().optional(),runId:U().optional(),ticketId:U().optional(),ts:Iu(),type:U(),message:U(),data:Wu().optional()});var zd=[{phase:`ideation`},{phase:`spec`,gateToEnter:{id:`G1`,description:`Decisions captured before writing a spec`,check:`decisions-file-exists`}},{phase:`tickets`,gateToEnter:{id:`G2`,description:`Spec written before breaking into tickets`,check:`spec-file-exists`}},{phase:`implementation`,gateToEnter:{id:`G3`,description:`Tickets approved by a human (the Burn click)`,check:`tickets-approved`}},{phase:`review`,gateToEnter:{id:`G4`,description:`Every ticket reached a terminal state`,check:`all-tickets-terminal`}},{phase:`shipped`,gateToEnter:{id:`G5`,description:`Human merged the feature branch (the Merge click)`,check:`human-merge`}}].map(e=>e.phase);function Bd(e){let t=zd.indexOf(e.phase);return t<0||t>=zd.length-1?null:zd[t+1]}var K=Symbol.for(`drizzle:entityKind`);function Vd(e,t){if(!e||typeof e!=`object`)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,K))throw Error(`Class "${t.name??`<unknown>`}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(K in n&&n[K]===t[K])return!0;n=Object.getPrototypeOf(n)}return!1}var Hd=class{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[K]=`Column`;name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!==`byDefault`}},Ud=class{static[K]=`ColumnBuilder`;config;constructor(e,t,n){this.config={name:e,keyAsName:e===``,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===``&&(this.config.name=e)}},Wd=Symbol.for(`drizzle:Name`),Gd=Symbol.for(`drizzle:isPgEnum`);function Kd(e){return!!e&&typeof e==`function`&&Gd in e&&e[Gd]===!0}var qd=class{static[K]=`Subquery`;constructor(e,t,n,r=!1,i=[]){this._={brand:`Subquery`,sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}},Jd={startActiveSpan(e,t){return t()}},Yd=Symbol.for(`drizzle:ViewBaseConfig`),Xd=Symbol.for(`drizzle:Schema`),Zd=Symbol.for(`drizzle:Columns`),Qd=Symbol.for(`drizzle:ExtraConfigColumns`),$d=Symbol.for(`drizzle:OriginalName`),ef=Symbol.for(`drizzle:BaseName`),tf=Symbol.for(`drizzle:IsAlias`),nf=Symbol.for(`drizzle:ExtraConfigBuilder`),rf=Symbol.for(`drizzle:IsDrizzleTable`),af=class{static[K]=`Table`;static Symbol={Name:Wd,Schema:Xd,OriginalName:$d,Columns:Zd,ExtraConfigColumns:Qd,BaseName:ef,IsAlias:tf,ExtraConfigBuilder:nf};[Wd];[$d];[Xd];[Zd];[Qd];[ef];[tf]=!1;[rf]=!0;[nf]=void 0;constructor(e,t,n){this[Wd]=this[$d]=e,this[Xd]=t,this[ef]=n}};function of(e){return e!=null&&typeof e.getSQL==`function`}function sf(e){let t={sql:``,params:[]};for(let n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||=[],t.typings.push(...n.typings));return t}var cf=class{static[K]=`StringChunk`;value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new lf([this])}},lf=class e{constructor(e){this.queryChunks=e;for(let t of e)if(Vd(t,af)){let e=t[af.Symbol.Schema];this.usedTables.push(e===void 0?t[af.Symbol.Name]:e+`.`+t[af.Symbol.Name])}}static[K]=`SQL`;decoder=df;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return Jd.startActiveSpan(`drizzle.buildSQL`,t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(t,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:o,prepareTyping:s,inlineParams:c,paramStartIndex:l}=r;return sf(t.map(t=>{if(Vd(t,cf))return{sql:t.value.join(``),params:[]};if(Vd(t,uf))return{sql:a(t.value),params:[]};if(t===void 0)return{sql:``,params:[]};if(Array.isArray(t)){let e=[new cf(`(`)];for(let[n,r]of t.entries())e.push(r),n<t.length-1&&e.push(new cf(`, `));return e.push(new cf(`)`)),this.buildQueryFromSourceParams(e,r)}if(Vd(t,e))return this.buildQueryFromSourceParams(t.queryChunks,{...r,inlineParams:c||t.shouldInlineParams});if(Vd(t,af)){let e=t[af.Symbol.Schema],n=t[af.Symbol.Name];return{sql:e===void 0||t[tf]?a(n):a(e)+`.`+a(n),params:[]}}if(Vd(t,Hd)){let e=i.getColumnCasing(t);if(n.invokeSource===`indexes`)return{sql:a(e),params:[]};let r=t.table[af.Symbol.Schema];return{sql:t.table[tf]||r===void 0?a(t.table[af.Symbol.Name])+`.`+a(e):a(r)+`.`+a(t.table[af.Symbol.Name])+`.`+a(e),params:[]}}if(Vd(t,_f)){let e=t[Yd].schema,n=t[Yd].name;return{sql:e===void 0||t[Yd].isAlias?a(n):a(e)+`.`+a(n),params:[]}}if(Vd(t,pf)){if(Vd(t.value,hf))return{sql:o(l.value++,t),params:[t],typings:[`none`]};let n=t.value===null?null:t.encoder.mapToDriverValue(t.value);if(Vd(n,e))return this.buildQueryFromSourceParams([n],r);if(c)return{sql:this.mapInlineParam(n,r),params:[]};let i=[`none`];return s&&(i=[s(t.encoder)]),{sql:o(l.value++,n),params:[n],typings:i}}return Vd(t,hf)?{sql:o(l.value++,t),params:[t],typings:[`none`]}:Vd(t,e.Aliased)&&t.fieldAlias!==void 0?{sql:a(t.fieldAlias),params:[]}:Vd(t,qd)?t._.isWith?{sql:a(t._.alias),params:[]}:this.buildQueryFromSourceParams([new cf(`(`),t._.sql,new cf(`) `),new uf(t._.alias)],r):Kd(t)?t.schema?{sql:a(t.schema)+`.`+a(t.enumName),params:[]}:{sql:a(t.enumName),params:[]}:of(t)?t.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([t.getSQL()],r):this.buildQueryFromSourceParams([new cf(`(`),t.getSQL(),new cf(`)`)],r):c?{sql:this.mapInlineParam(t,r),params:[]}:{sql:o(l.value++,t),params:[t],typings:[`none`]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return`null`;if(typeof e==`number`||typeof e==`boolean`)return e.toString();if(typeof e==`string`)return t(e);if(typeof e==`object`){let n=e.toString();return t(n===`[object Object]`?JSON.stringify(e):n)}throw Error(`Unexpected param value: `+e)}getSQL(){return this}as(t){return t===void 0?this:new e.Aliased(this,t)}mapWith(e){return this.decoder=typeof e==`function`?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}},uf=class{constructor(e){this.value=e}static[K]=`Name`;brand;getSQL(){return new lf([this])}},df={mapFromDriverValue:e=>e},ff={mapToDriverValue:e=>e};({...df,...ff});var pf=class{constructor(e,t=ff){this.value=e,this.encoder=t}static[K]=`Param`;brand;getSQL(){return new lf([this])}};function mf(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!==``)&&n.push(new cf(e[0]));for(let[r,i]of t.entries())n.push(i,new cf(e[r+1]));return new lf(n)}(e=>{function t(){return new lf([])}e.empty=t;function n(e){return new lf(e)}e.fromList=n;function r(e){return new lf([new cf(e)])}e.raw=r;function i(e,t){let n=[];for(let[r,i]of e.entries())r>0&&t!==void 0&&n.push(t),n.push(i);return new lf(n)}e.join=i;function a(e){return new uf(e)}e.identifier=a;function o(e){return new hf(e)}e.placeholder=o;function s(e,t){return new pf(e,t)}e.param=s})(mf||={}),(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static[K]=`SQL.Aliased`;isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(lf||={});var hf=class{constructor(e){this.name=e}static[K]=`Placeholder`;getSQL(){return new lf([this])}},gf=Symbol.for(`drizzle:IsDrizzleView`),_f=class{static[K]=`View`;[Yd];[gf]=!0;constructor({name:e,schema:t,selectedFields:n,query:r}){this[Yd]={name:e,originalName:e,schema:t,selectedFields:n,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new lf([this])}};Hd.prototype.getSQL=function(){return new lf([this])},af.prototype.getSQL=function(){return new lf([this])},qd.prototype.getSQL=function(){return new lf([this])};function vf(e,t){return{name:typeof e==`string`&&e.length>0?e:``,config:typeof e==`object`?e:t}}var yf=typeof TextDecoder>`u`?null:new TextDecoder,bf=class{static[K]=`SQLiteForeignKeyBuilder`;reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:n,foreignColumns:r}=e();return{name:t,columns:n,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new xf(e,this)}},xf=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[K]=`SQLiteForeignKey`;reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[Wd],...r,n[0].table[Wd],...i];return e??`${a.join(`_`)}_fk`}};function Sf(e,t){return`${e[Wd]}_${t.join(`_`)}_unique`}var Cf=class extends Ud{static[K]=`SQLiteColumnBuilder`;foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:`always`,mode:t?.mode??`virtual`},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>((n,r)=>{let i=new bf(()=>{let t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)})(n,r))}},wf=class extends Hd{constructor(e,t){t.uniqueName||=Sf(e,[t.name]),super(e,t),this.table=e}static[K]=`SQLiteColumn`},Tf=class extends Cf{static[K]=`SQLiteBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteBigInt`)}build(e){return new Ef(e,this.config)}},Ef=class extends wf{static[K]=`SQLiteBigInt`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString(`utf8`))}return BigInt(yf.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}},Df=class extends Cf{static[K]=`SQLiteBlobJsonBuilder`;constructor(e){super(e,`json`,`SQLiteBlobJson`)}build(e){return new Of(e,this.config)}},Of=class extends wf{static[K]=`SQLiteBlobJson`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString(`utf8`))}return JSON.parse(yf.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}},kf=class extends Cf{static[K]=`SQLiteBlobBufferBuilder`;constructor(e){super(e,`buffer`,`SQLiteBlobBuffer`)}build(e){return new Af(e,this.config)}},Af=class extends wf{static[K]=`SQLiteBlobBuffer`;mapFromDriverValue(e){return Buffer.isBuffer(e)?e:Buffer.from(e)}getSQLType(){return`blob`}};function jf(e,t){let{name:n,config:r}=vf(e,t);return r?.mode===`json`?new Df(n):r?.mode===`bigint`?new Tf(n):new kf(n)}var Mf=class extends Cf{static[K]=`SQLiteCustomColumnBuilder`;constructor(e,t,n){super(e,`custom`,`SQLiteCustomColumn`),this.config.fieldConfig=t,this.config.customTypeParams=n}build(e){return new Nf(e,this.config)}},Nf=class extends wf{static[K]=`SQLiteCustomColumn`;sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom==`function`?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo==`function`?this.mapTo(e):e}};function Pf(e){return(t,n)=>{let{name:r,config:i}=vf(t,n);return new Mf(r,i,e)}}var Ff=class extends Cf{static[K]=`SQLiteBaseIntegerBuilder`;constructor(e,t,n){super(e,t,n),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}},If=class extends wf{static[K]=`SQLiteBaseInteger`;autoIncrement=this.config.autoIncrement;getSQLType(){return`integer`}},Lf=class extends Ff{static[K]=`SQLiteIntegerBuilder`;constructor(e){super(e,`number`,`SQLiteInteger`)}build(e){return new Rf(e,this.config)}},Rf=class extends If{static[K]=`SQLiteInteger`},zf=class extends Ff{static[K]=`SQLiteTimestampBuilder`;constructor(e,t){super(e,`date`,`SQLiteTimestamp`),this.config.mode=t}defaultNow(){return this.default(mf`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new Bf(e,this.config)}},Bf=class extends If{static[K]=`SQLiteTimestamp`;mode=this.config.mode;mapFromDriverValue(e){return this.config.mode===`timestamp`?new Date(e*1e3):new Date(e)}mapToDriverValue(e){let t=e.getTime();return this.config.mode===`timestamp`?Math.floor(t/1e3):t}},Vf=class extends Ff{static[K]=`SQLiteBooleanBuilder`;constructor(e,t){super(e,`boolean`,`SQLiteBoolean`),this.config.mode=t}build(e){return new Hf(e,this.config)}},Hf=class extends If{static[K]=`SQLiteBoolean`;mode=this.config.mode;mapFromDriverValue(e){return Number(e)===1}mapToDriverValue(e){return+!!e}};function Uf(e,t){let{name:n,config:r}=vf(e,t);return r?.mode===`timestamp`||r?.mode===`timestamp_ms`?new zf(n,r.mode):r?.mode===`boolean`?new Vf(n,r.mode):new Lf(n)}var Wf=class extends Cf{static[K]=`SQLiteNumericBuilder`;constructor(e){super(e,`string`,`SQLiteNumeric`)}build(e){return new Gf(e,this.config)}},Gf=class extends wf{static[K]=`SQLiteNumeric`;mapFromDriverValue(e){return typeof e==`string`?e:String(e)}getSQLType(){return`numeric`}},Kf=class extends Cf{static[K]=`SQLiteNumericNumberBuilder`;constructor(e){super(e,`number`,`SQLiteNumericNumber`)}build(e){return new qf(e,this.config)}},qf=class extends wf{static[K]=`SQLiteNumericNumber`;mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}mapToDriverValue=String;getSQLType(){return`numeric`}},Jf=class extends Cf{static[K]=`SQLiteNumericBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteNumericBigInt`)}build(e){return new Yf(e,this.config)}},Yf=class extends wf{static[K]=`SQLiteNumericBigInt`;mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return`numeric`}};function Xf(e,t){let{name:n,config:r}=vf(e,t),i=r?.mode;return i===`number`?new Kf(n):i===`bigint`?new Jf(n):new Wf(n)}var Zf=class extends Cf{static[K]=`SQLiteRealBuilder`;constructor(e){super(e,`number`,`SQLiteReal`)}build(e){return new Qf(e,this.config)}},Qf=class extends wf{static[K]=`SQLiteReal`;getSQLType(){return`real`}};function $f(e){return new Zf(e??``)}var ep=class extends Cf{static[K]=`SQLiteTextBuilder`;constructor(e,t){super(e,`string`,`SQLiteText`),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new tp(e,this.config)}},tp=class extends wf{static[K]=`SQLiteText`;enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:``}`}},np=class extends Cf{static[K]=`SQLiteTextJsonBuilder`;constructor(e){super(e,`json`,`SQLiteTextJson`)}build(e){return new rp(e,this.config)}},rp=class extends wf{static[K]=`SQLiteTextJson`;getSQLType(){return`text`}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}};function q(e,t={}){let{name:n,config:r}=vf(e,t);return r.mode===`json`?new np(n):new ep(n,r)}function ip(){return{blob:jf,customType:Pf,integer:Uf,numeric:Xf,real:$f,text:q}}var ap=Symbol.for(`drizzle:SQLiteInlineForeignKeys`),op=class extends af{static[K]=`SQLiteTable`;static Symbol=Object.assign({},af.Symbol,{InlineForeignKeys:ap});[af.Symbol.Columns];[ap]=[];[af.Symbol.ExtraConfigBuilder]=void 0};function sp(e,t,n,r,i=e){let a=new op(e,r,i),o=typeof t==`function`?t(ip()):t,s=Object.fromEntries(Object.entries(o).map(([e,t])=>{let n=t;n.setName(e);let r=n.build(a);return a[ap].push(...n.buildForeignKeys(r,a)),[e,r]})),c=Object.assign(a,s);return c[af.Symbol.Columns]=s,c[af.Symbol.ExtraConfigColumns]=s,n&&(c[op.Symbol.ExtraConfigBuilder]=n),c}var cp=(e,t,n)=>sp(e,t,n);cp(`projects`,{id:q(`id`).primaryKey(),name:q(`name`).notNull(),repoPath:q(`repo_path`).notNull(),mainBranch:q(`main_branch`).notNull(),devCommand:q(`dev_command`),model:q(`model`),sandbox:q(`sandbox`),closedAt:Uf(`closed_at`)}),cp(`features`,{id:q(`id`).primaryKey(),projectId:q(`project_id`).notNull(),slug:q(`slug`).notNull(),title:q(`title`).notNull(),oneLiner:q(`one_liner`).notNull(),mapped:Uf(`mapped`,{mode:`boolean`}).notNull().default(!1),phase:q(`phase`).notNull().$type(),branch:q(`branch`).notNull(),baseBranch:q(`base_branch`),status:q(`status`).notNull().$type(),createdAt:Uf(`created_at`).notNull()}),cp(`sessions`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),kind:q(`kind`).notNull().$type(),ccSessionId:q(`cc_session_id`),transcriptPath:q(`transcript_path`),status:q(`status`).notNull().$type(),worktreePath:q(`worktree_path`).notNull()}),cp(`tickets`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),seq:Uf(`seq`).notNull(),title:q(`title`).notNull(),goal:q(`goal`).notNull(),context:q(`context`).notNull(),acceptanceCriteria:q(`acceptance_criteria`,{mode:`json`}).notNull().$type(),seams:q(`seams`,{mode:`json`}).notNull().$type(),blockedBy:q(`blocked_by`,{mode:`json`}).notNull().$type(),status:q(`status`).notNull().$type(),commits:q(`commits`,{mode:`json`}).notNull().$type(),error:q(`error`),attemptBranch:q(`attempt_branch`)}),cp(`waypoints`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),seq:Uf(`seq`).notNull(),title:q(`title`).notNull(),type:q(`type`).notNull().$type(),question:q(`question`).notNull(),blockedBy:q(`blocked_by`,{mode:`json`}).notNull().$type(),originWaypointId:q(`origin_waypoint_id`),status:q(`status`).notNull().$type(),claimedBy:q(`claimed_by`),lastSessionId:q(`last_session_id`),summary:q(`summary`)}),cp(`runs`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),workflow:q(`workflow`).notNull(),status:q(`status`).notNull().$type(),startedAt:Uf(`started_at`).notNull(),endedAt:Uf(`ended_at`),summary:q(`summary`)}),cp(`events`,{id:Uf(`id`).primaryKey({autoIncrement:!0}),projectId:q(`project_id`).notNull(),featureId:q(`feature_id`),runId:q(`run_id`),ticketId:q(`ticket_id`),ts:Uf(`ts`).notNull(),type:q(`type`).notNull(),message:q(`message`).notNull(),data:q(`data`,{mode:`json`})}),cp(`gate_overrides`,{id:Uf(`id`).primaryKey({autoIncrement:!0}),featureId:q(`feature_id`).notNull(),gate:q(`gate`).notNull(),reason:q(`reason`).notNull(),ts:Uf(`ts`).notNull()});var lp=[`ideation`,`qa`,`waypoint`,`converge`,`revisit`,`research`,`implement`,`smoke`],up=rd(lp),dp=[{id:`claude-opus-4-8`,label:`Opus 4.8`},{id:`claude-sonnet-5`,label:`Sonnet 5`},{id:`claude-haiku-4-5-20251001`,label:`Haiku 4.5`},{id:`claude-fable-5`,label:`Fable 5`}];Dd(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e},n=t.smokeModel;if(typeof n==`string`&&n.length>0){let e=typeof t.stepModels==`object`&&t.stepModels!==null&&!Array.isArray(t.stepModels)?t.stepModels:{};e.smoke===void 0&&(t.stepModels={...e,smoke:n})}return delete t.smokeModel,t},Xu({serverPort:Iu().default(4512),model:U().default(`claude-opus-4-8`),stepModels:td(up,U()).default({smoke:`claude-haiku-4-5-20251001`}),sandbox:rd([`docker`,`podman`,`noSandbox`]).default(`docker`),mainBranch:U().default(`main`),sandboxImage:U().optional(),burnConcurrency:Iu().int().min(1).max(8).default(3),burnMaxIterations:Iu().int().min(1).max(10).default(3),burnAttempts:Iu().int().min(1).max(5).default(3),setupCommand:U().optional(),burnWorkspace:rd([`auto`,`mounted`,`isolated`]).default(`auto`)}));function fp(e){return e.branches.includes(e.current)?e.current:e.mainBranch}var pp=[`ideation`,`spec`,`tickets`,`implementation`,`review`,`shipped`];function mp(e){return e.status===`shipped`||e.status===`archived`||e.activeRun?null:e.ticketCounts.failed>0?{kind:`attention`,label:`run failed — needs attention`}:e.phase===`ideation`?{kind:`grill`,label:`needs grilling`}:e.phase===`tickets`&&e.ticketCounts.total>0?{kind:`burn`,label:`review & burn tickets`}:e.phase===`review`?{kind:`ship`,label:`test & merge`}:null}function hp(e){if(e.length!==0)return[...e].sort((e,t)=>t.startedAt-e.startedAt)[0]}var gp={ideation:`ideation`,spec:`spec`,tickets:`tickets`,implementation:`build`,review:`review`,shipped:`shipped`},_p={ideation:`Shape the idea in a grill session`,spec:`Write it up as a spec`,tickets:`Break the work into atomic tickets`,implementation:`Burn the tickets into commits`,review:`Test-drive the branch, then merge`,shipped:`Merged to the main branch`};function vp(e){return pp.indexOf(e)}function yp(e){return e.status===`archived`?`archived`:e.status===`shipped`?`shipped`:e.activeRun?`agentWorking`:mp(e)?`needsYou`:`inProgress`}function bp(e,t={}){let n={needsYou:[],agentWorking:[],inProgress:[],shipped:[],archived:[]};for(let t of e)n[yp(t)].push(t);let r=[{key:`needsYou`,label:`Needs you`},{key:`agentWorking`,label:`Agent working`},{key:`inProgress`,label:`In progress`},{key:`shipped`,label:`Shipped`}];return t.showArchived&&r.push({key:`archived`,label:`Archived`}),r.map(({key:e,label:t})=>({key:e,label:t,features:n[e]})).filter(e=>e.features.length>0)}function xp(e,t){let n=vp(e.phase),r=vp(t);return r<n?`done`:r===n?`current`:`upcoming`}function Sp(e){return pp.map(t=>({phase:t,state:xp(e,t)}))}function Cp(e,t){return t??e.phase}function wp(e,t){return vp(t)<vp(e.phase)}function Tp(e,t){return pp.map(n=>{let r=xp(e,n);return{phase:n,label:gp[n],state:r,isViewed:n===t,clickable:r===`done`||r===`current`,tip:_p[n]}})}var Ep=`Proceed with your task: invoke the /runcastle:revisit skill for a REVIEW ITERATION. Call get_feature_context to read the latest run outcome and every ticket’s state, then interview me about what the test drive surfaced — bugs, rough edges, tweaks. Turn what we settle on into fix tickets with emit_tickets, and use update_ticket / cancel_ticket on any stale pending tickets. Never call complete_phase — leave the phase at review. When the tickets are ready, tell me to review the cards and click Burn.`;function Dp(e,t,n){return`Proceed with your task: RESOLVE A MERGE CONFLICT. Merging ${e} into ${t} conflicts on: ${n.length?n.join(`, `):`(run git status to see the conflicts)`}. Your working directory IS the talk worktree, already checked out on ${t}. Run \`git merge ${e}\`, then resolve every conflict using this feature’s spec.md and decisions.md for intent, and commit the merge. Do NOT push and do NOT advance the phase (never call complete_phase). When the merge commit is in, tell me to click “Merge & ship” again for a clean retry.`}function Op(e){let t=null;for(let n of e)if(n.type===`merge.conflict`){let e=n.data??{},r=Array.isArray(e.files)?e.files.filter(e=>typeof e==`string`):[];t={base:typeof e.base==`string`?e.base:``,files:r}}else n.type===`burn.started`&&(t=null);return t}function kp(e,t){let{feature:n,tickets:r,sessions:i,runs:a,gate:o}=e,s=i.find(e=>e.status===`live`),c=r.length,l=r.filter(e=>e.status===`done`).length,u=r.filter(e=>e.status===`failed`).length,d=r.filter(e=>e.status!==`done`&&e.status!==`failed`&&e.status!==`cancelled`).length,f=hp(a),p=f?.status===`running`,m=Bd(n);if(n.status===`archived`)return{kick:`ARCHIVED`,title:`Feature archived`,desc:`This feature is archived and out of the pipeline. Unarchive it to pick the work back up.`,primary:{label:`Unarchive`,kind:`unarchive`},secondary:[],busy:!1};let h=!!o.next&&o.satisfied&&o.next.id!==`G3`&&o.next.id!==`G5`,g=m?`Promote to ${gp[m]}`:`Promote`;switch(n.phase){case`ideation`:return n.mapped?{kick:`MAP`,title:o.satisfied?`Converge the map`:`Work the frontier`,desc:o.satisfied?`Every waypoint is resolved — converge to draft the spec and tickets.`:o.reason??`Resolve the open waypoints; converge once the frontier clears.`,primary:s?{label:`Jump to grill`,kind:`openGrill`}:void 0,secondary:[],busy:!1}:h?{kick:`NEXT STEP`,title:`Promote the idea`,desc:`Decisions are captured — promote the idea when it feels concrete.`,primary:{label:g,kind:`advance`},secondary:s?[{label:`Back to grill`,kind:`openGrill`}]:[],busy:!1}:s?{kick:`GRILL LIVE`,title:`Grill session in progress`,desc:`Shape the idea with Claude — decisions accumulate in Knowledge.`,primary:{label:`Jump to grill`,kind:`openGrill`},secondary:[],busy:!1}:{kick:`NEXT STEP`,title:`Shape the idea with Claude`,desc:`Launch a grill session to shape the idea before any code is written.`,primary:{label:`Start grill session`,kind:`startGrill`},secondary:[],busy:!1};case`spec`:return h?{kick:`NEXT STEP`,title:`Approve the spec`,desc:`The spec is written — approve it to move into tickets.`,primary:{label:`Approve spec → tickets`,kind:`advance`},secondary:s?[{label:`Back to grill`,kind:`openGrill`}]:[],busy:!1}:s?{kick:`GRILL LIVE`,title:`Writing the spec`,desc:`The spec takes shape beside the conversation.`,primary:{label:`Jump to grill`,kind:`openGrill`},secondary:[],busy:!1}:{kick:`NEXT STEP`,title:`Write the spec`,desc:`No spec yet — resume the grill to draft it.`,primary:{label:`Resume grill`,kind:`startGrill`},secondary:[],busy:!1};case`tickets`:return c>0?{kick:`NEXT STEP`,title:`Review & burn the tickets`,desc:`Each ticket is one atomic task Claude will implement. Review them, then burn.`,primary:{label:`Burn ${c} ticket${c===1?``:`s`}`,kind:`burn`},secondary:s?[{label:`Back to grill`,kind:`openGrill`}]:[{label:`Revisit`,kind:`revisit`}],busy:!1}:{kick:`WAITING`,title:`Waiting for tickets`,desc:`No tickets yet — a grill session emits them. Open a session to shape the work.`,primary:s?{label:`Jump to grill`,kind:`openGrill`}:{label:`Open grill to emit tickets`,kind:`startGrill`},secondary:[],busy:!1};case`implementation`:return p?{kick:`IN PROGRESS`,title:`Burning tickets`,desc:`Burning ${c} ticket${c===1?``:`s`} — ${l} done${u?`, ${u} failed`:``}.`,primary:{label:`Cancel run`,kind:`cancelRun`,danger:!0},secondary:[],busy:!0}:{kick:`NEXT STEP`,title:`Resume the burn`,desc:f?.status===`failed`?`The run failed — resume the burn to retry.`:f?.status===`cancelled`?`The run was cancelled — resume the burn to continue.`:`The burn has not started — resume to run the tickets.`,primary:{label:`Resume burn`,kind:`burn`},secondary:s?[]:[{label:`Revisit`,kind:`revisit`}],busy:!1};case`review`:{let e=t.driving?{label:`Stop test drive`,kind:`testDriveStop`}:{label:`Start test drive`,kind:`testDriveStart`},n=s?[]:[{label:`Iterate`,kind:`revisit`}];if(d>0)return{kick:`NEXT STEP`,title:`Burn the fix tickets`,desc:t.driving?`Test-driving the branch — burn the fix tickets when you’re ready.`:`${d} fix ticket${d===1?``:`s`} ready — burn to run them, then review again.`,primary:{label:`Burn ${d} ticket${d===1?``:`s`}`,kind:`burn`},secondary:[{label:`Merge & ship`,kind:`merge`},e,...n],busy:!1};let r=t.driving?`Test-driving the branch — merge when it looks right.`:u>0?`Run finished with ${u} failed ticket${u===1?``:`s`} — review, then ship.`:`Checks are in. Test-drive the branch, then merge to ship.`;return{kick:`NEXT STEP`,title:t.driving?`Merge when it looks right`:`Test drive, then ship`,desc:r,primary:{label:`Merge & ship`,kind:`merge`},secondary:[e,...n],busy:!1}}case`shipped`:return{kick:`SHIPPED`,title:`Shipped to main`,desc:`The branch is merged and the pipeline is complete. Ask a question anytime.`,primary:void 0,secondary:[{label:`Ask a question`,kind:`askQuestions`}],busy:!1}}}function Ap({actions:e}){let[t,n]=(0,k.useState)(!1),r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{if(!t)return;let e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),e.length===0?null:(0,A.jsxs)(`div`,{className:`row-actions`,ref:r,children:[(0,A.jsx)(`button`,{className:`row-actions-btn`,"aria-label":`feature actions`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:e=>{e.stopPropagation(),n(e=>!e)},children:(0,A.jsx)(Ci,{size:14})}),t&&(0,A.jsx)(`div`,{className:`row-actions-menu`,role:`menu`,children:e.map(e=>(0,A.jsx)(`button`,{role:`menuitem`,className:`row-actions-item${e.danger?` is-danger`:``}`,onClick:t=>{t.stopPropagation(),n(!1),e.onSelect()},children:e.label},e.key))})]})}function jp({title:e,slug:t,busy:n,onConfirm:r,onCancel:i}){let[a,o]=(0,k.useState)(``),s=a.trim()===t;return(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:i,children:(0,A.jsxs)(`div`,{className:`peek delete-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Delete feature ${t}`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`delete-dialog-title`,children:`Delete feature`}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:i,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`peek-body delete-dialog-body`,children:[(0,A.jsxs)(`p`,{className:`delete-dialog-lead`,children:[`Permanently delete `,(0,A.jsx)(`strong`,{children:e}),`? This stops any running agent, removes its worktree and branches, and erases all of its runcastle data. Committed docs stay in git history. `,(0,A.jsx)(`strong`,{children:`This cannot be undone.`})]}),(0,A.jsxs)(`label`,{className:`delete-dialog-field`,children:[(0,A.jsxs)(`span`,{children:[`Type `,(0,A.jsx)(`code`,{className:`mono`,children:t}),` to confirm`]}),(0,A.jsx)(`input`,{className:`settings-input mono`,value:a,onChange:e=>o(e.target.value),autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:t})]}),(0,A.jsxs)(`div`,{className:`delete-dialog-actions`,children:[(0,A.jsx)(P,{variant:`ghost`,onClick:i,disabled:n,children:`Cancel`}),(0,A.jsx)(P,{variant:`danger`,onClick:r,disabled:!s||n,children:n?`Deleting…`:`Delete feature`})]})]})]})})}var Mp=`runcastle.sidebar.showArchived`;function Np(){try{return localStorage.getItem(Mp)===`1`}catch{return!1}}function Pp({projectId:e,selectedFeatureId:t,onSelect:n,onNewFeature:r}){let i=N.useUtils(),a=Ji(),[o,s]=(0,k.useState)(Np),[c,l]=(0,k.useState)(null),u=N.feature.list.useQuery({projectId:e},{refetchInterval:1500}),d=bp(u.data??[],{showArchived:o}),f=(u.data??[]).filter(e=>e.status===`archived`).length,p=()=>void i.feature.list.invalidate(),m=N.feature.archive.useMutation({onSuccess:p,onError:e=>a.push(e.message)}),h=N.feature.unarchive.useMutation({onSuccess:p,onError:e=>a.push(e.message)}),g=N.feature.delete.useMutation({onSuccess:(e,r)=>{if(p(),r.featureId===t){let e=(u.data??[]).find(e=>e.id!==r.featureId);e&&n(e.id)}l(null)},onError:e=>a.push(e.message)}),_=()=>{s(e=>{let t=!e;try{localStorage.setItem(Mp,t?`1`:`0`)}catch{}return t})},v=e=>{let t=e.status===`archived`?[{key:`unarchive`,label:`Unarchive`,onSelect:()=>h.mutate({featureId:e.id})}]:[{key:`archive`,label:`Archive`,onSelect:()=>m.mutate({featureId:e.id})}];return e.status!==`shipped`&&t.push({key:`delete`,label:`Delete…`,danger:!0,onSelect:()=>l(e)}),t};return(0,A.jsxs)(`nav`,{className:`sidebar`,children:[(0,A.jsxs)(`div`,{className:`sidebar-head`,children:[(0,A.jsx)(`span`,{className:`pane-title`,children:`Features`}),(0,A.jsxs)(`button`,{className:`new-btn`,onClick:r,children:[(0,A.jsx)(yi,{size:11}),`New`]})]}),(0,A.jsxs)(`div`,{className:`sidebar-list`,children:[u.isLoading&&(0,A.jsx)(`div`,{style:{padding:`10px 8px`},children:(0,A.jsx)(F,{children:`loading features…`})}),u.data&&u.data.length===0&&(0,A.jsxs)(`div`,{className:`sidebar-empty`,children:[`No features yet.`,(0,A.jsx)(`br`,{}),`Create one to start the pipeline.`]}),d.map(e=>(0,A.jsxs)(`div`,{className:`triage-group triage-${e.key}`,children:[(0,A.jsxs)(`div`,{className:`triage-label`,children:[(0,A.jsx)(`span`,{className:`triage-name`,children:e.label}),(0,A.jsx)(`span`,{className:`triage-count`,children:e.features.length})]}),e.features.map(e=>(0,A.jsx)(Fp,{f:e,active:e.id===t,onSelect:n,actions:v(e)},e.id))]},e.key)),f>0&&(0,A.jsxs)(`button`,{className:`show-archived-toggle`,onClick:_,children:[o?`Hide`:`Show`,` archived (`,f,`)`]})]}),c&&(0,A.jsx)(jp,{title:c.title,slug:c.slug,busy:g.isPending,onConfirm:()=>g.mutate({featureId:c.id}),onCancel:()=>l(null)})]})}function Fp({f:e,active:t,onSelect:n,actions:r}){let i=mp(e),a=Sp(e),o=e.status===`shipped`||e.status===`archived`;return(0,A.jsxs)(`div`,{className:`feature-row${t?` is-active`:``}${o?` is-dim`:``}`,children:[(0,A.jsxs)(`button`,{className:`feature-row-main`,onClick:()=>n(e.id),title:`${e.title} — ${e.slug}`,children:[(0,A.jsx)(`span`,{className:`feature-dot phase-bg-${e.phase}`}),(0,A.jsx)(`span`,{className:`feature-slug`,children:e.title}),(0,A.jsx)(`span`,{className:`feature-flag`,children:e.activeRun?(0,A.jsx)(`span`,{className:`spin-ring`,title:`agent working`}):e.status===`shipped`?(0,A.jsx)(`span`,{className:`mini-check`,children:(0,A.jsx)(bi,{size:10})}):(0,A.jsxs)(A.Fragment,{children:[i&&(0,A.jsx)(`span`,{className:`needs-dot needs-${i.kind}`,title:i.label}),(0,A.jsx)(`span`,{className:`mini-map`,children:a.map((e,t)=>(0,A.jsx)(`span`,{className:`mini-seg is-${e.state}`},t))})]})})]}),(0,A.jsx)(Ap,{actions:r})]})}function Ip(e){let[t,n]=(0,k.useState)([]),r=t.length?t[t.length-1].id:void 0,i=N.events.list.useQuery({featureId:e,afterId:r},{refetchInterval:1500});return(0,k.useEffect)(()=>{let e=i.data;!e||e.length===0||n(t=>{let n=new Set(t.map(e=>e.id)),r=e.filter(e=>!n.has(e.id));return r.length===0?t:[...t,...r].sort((e,t)=>e.id-t.id)})},[i.data]),t}function Lp(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function Rp(e){return e.slice(0,7)}function zp(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<5)return`now`;if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Bp(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60;return r>0?`${r}h ${String(i).padStart(2,`0`)}m`:i>0?`${i}m ${String(a).padStart(2,`0`)}s`:`${a}s`}function Vp({featureId:e,relPath:t,title:n,onClose:r}){let i=N.docs.read.useQuery({featureId:e,relPath:t});return(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:r,children:(0,A.jsxs)(`div`,{className:`peek`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`mono peek-path`,children:t}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:r,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`peek-body mono`,children:[i.isLoading&&(0,A.jsxs)(F,{children:[`loading `,n,`…`]}),i.error&&(0,A.jsxs)(F,{children:[`could not read `,t,`: `,i.error.message]}),i.data&&(0,A.jsx)(`pre`,{className:`peek-pre`,children:i.data.content})]})]})})}function Hp({featureId:e}){let[t,n]=(0,k.useState)(`details`),r=N.feature.get.useQuery({id:e},{refetchInterval:1500});return r.isLoading?(0,A.jsx)(`aside`,{className:`inspector`,children:(0,A.jsx)(F,{children:`loading…`})}):r.data?(0,A.jsxs)(`aside`,{className:`inspector`,children:[(0,A.jsxs)(`div`,{className:`insp-tabs`,role:`tablist`,children:[(0,A.jsx)(`button`,{role:`tab`,"aria-selected":t===`details`,className:`insp-tab${t===`details`?` is-active`:``}`,onClick:()=>n(`details`),children:`Details`}),(0,A.jsx)(`button`,{role:`tab`,"aria-selected":t===`activity`,className:`insp-tab${t===`activity`?` is-active`:``}`,onClick:()=>n(`activity`),children:`Activity`})]}),t===`details`?(0,A.jsxs)(`div`,{className:`insp-pane`,children:[(0,A.jsx)(Gp,{featureId:e,gate:r.data.gate}),(0,A.jsx)(Jp,{featureId:e,docs:r.data.docs})]},`details`):(0,A.jsx)(`div`,{className:`insp-pane insp-pane-activity`,children:(0,A.jsx)(Zp,{featureId:e})},`activity`)]}):(0,A.jsx)(`aside`,{className:`inspector`,children:(0,A.jsx)(F,{children:r.error?.message??`could not load inspector`})})}var Up={G1:`Decisions captured`,G2:`Spec written`,G3:`Tickets approved`,G4:`Run clean`,G5:`Merged`};function Wp(e){return e.check===`all-waypoints-terminal`?`Waypoints resolved`:Up[e.id]??e.id}function Gp({featureId:e,gate:t}){let n=Ji(),r=N.useUtils(),[i,a]=(0,k.useState)(!1),[o,s]=(0,k.useState)(``),c=N.feature.overrideGate.useMutation({onSuccess:()=>{s(``),a(!1),r.feature.get.invalidate({id:e}),r.feature.list.invalidate()},onError:e=>n.push(e.message)});return(0,A.jsxs)(`section`,{className:`insp-section`,children:[(0,A.jsx)(`div`,{className:`insp-cap`,children:`Current gate`}),t.next===null?(0,A.jsxs)(`div`,{className:`gate-shipped`,children:[(0,A.jsx)(bi,{size:13}),`Shipped — no gates left.`]}):(0,A.jsx)(Kp,{gateId:t.next.id,name:Wp(t.next),description:t.next.description,satisfied:t.satisfied,reason:t.reason,open:i,reasonValue:o,pending:c.isPending,onOpen:()=>a(!0),onCancel:()=>{a(!1),s(``)},onReasonChange:s,onApply:()=>c.mutate({featureId:e,gate:t.next.id,reason:o.trim()})})]})}function Kp({gateId:e,name:t,description:n,satisfied:r,reason:i,open:a,reasonValue:o,pending:s,onOpen:c,onCancel:l,onReasonChange:u,onApply:d}){return(0,A.jsxs)(`div`,{className:`gate-card`,children:[(0,A.jsxs)(`div`,{className:`gate-idrow`,children:[(0,A.jsx)(`span`,{className:`gate-id`,children:e}),(0,A.jsx)(`span`,{className:`gate-name`,children:t})]}),(0,A.jsx)(`div`,{className:`gate-req`,children:n}),(0,A.jsxs)(`div`,{className:`gate-state ${r?`is-ok`:`is-block`}`,children:[(0,A.jsx)(`span`,{className:`gate-state-dot`}),(0,A.jsx)(`span`,{children:r?`Ready to advance`:i??`Blocked`})]}),a?(0,A.jsxs)(`div`,{className:`override-form`,children:[(0,A.jsx)(`input`,{className:`override-input`,placeholder:`Reason for override`,value:o,autoFocus:!0,onChange:e=>u(e.target.value)}),(0,A.jsxs)(`div`,{className:`override-actions`,children:[(0,A.jsx)(P,{variant:`solid`,className:`btn-xs`,disabled:!o.trim()||s,onClick:d,children:`Apply`}),(0,A.jsx)(P,{variant:`ghost`,className:`btn-xs`,onClick:l,children:`Cancel`})]})]}):(0,A.jsx)(`button`,{className:`gate-override-link`,onClick:c,children:`Override with reason…`})]})}function qp(e){return e.split(/[\\/]/).pop()??e}function Jp({featureId:e,docs:t}){let[n,r]=(0,k.useState)(null);return(0,A.jsxs)(`section`,{className:`insp-section`,children:[(0,A.jsx)(`div`,{className:`insp-cap`,children:`Knowledge`}),t.length===0?(0,A.jsx)(`div`,{className:`insp-empty`,children:`Docs the sessions write — decisions, the spec, the map — collect here.`}):(0,A.jsx)(`ul`,{className:`doc-list`,children:t.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{className:`doc-link`,onClick:()=>r({relPath:e.relPath,title:e.title}),children:[(0,A.jsx)(`span`,{className:`doc-link-icon`,children:(0,A.jsx)(Ti,{size:13})}),(0,A.jsx)(`span`,{className:`doc-title`,children:e.title}),(0,A.jsx)(`span`,{className:`doc-meta`,children:qp(e.relPath)})]})},e.relPath))}),n&&(0,A.jsx)(Vp,{featureId:e,relPath:n.relPath,title:n.title,onClose:()=>r(null)})]})}function Yp(e){return e.includes(`failed`)||e.includes(`error`)||e.includes(`blocked`)?`is-danger`:e.includes(`done`)||e.includes(`shipped`)||e.includes(`merged`)?`is-ok`:e.startsWith(`phase`)||e.startsWith(`gate`)?`is-accent`:``}function Xp(e){return e.replace(/_/g,` `).replace(`.`,` · `)}function Zp({featureId:e}){let t=Ip(e).slice(-50).reverse();return(0,A.jsx)(`section`,{className:`insp-section`,children:t.length===0?(0,A.jsx)(`div`,{className:`insp-empty`,children:`Everything that happens to this feature shows up here.`}):(0,A.jsx)(`div`,{className:`activity-log`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`act-line`,children:[(0,A.jsx)(`span`,{className:`act-dot ${Yp(e.type)}`}),(0,A.jsxs)(`div`,{className:`act-body`,children:[(0,A.jsx)(`div`,{className:`act-msg`,children:e.message}),(0,A.jsxs)(`div`,{className:`act-sub`,children:[(0,A.jsx)(`span`,{className:`act-type`,children:Xp(e.type)}),(0,A.jsx)(`span`,{className:`act-time`,children:zp(e.ts)})]})]})]},e.id))})})}function Qp(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.status!=`string`||typeof t.summary!=`string`||t.status!==`succeeded`&&t.status!==`failed`&&t.status!==`cancelled`?null:{status:t.status,summary:t.summary}}function $p(e){let t=e.split(`
73
- `)[0].trim();return t.length>140?`${t.slice(0,139)}…`:t}function em(e,t){if(e.type!==`run.finished`)return null;let n=Qp(e.data);if(!n)return null;let r=t??`your feature`;return n.status===`succeeded`?{title:`Burn complete — review is ready`,body:r}:n.status===`failed`?{title:`Burn failed`,body:`${r}: ${$p(n.summary)}`}:null}var tm=`runcastle:notifications`,nm=typeof Notification<`u`;function rm(){try{return localStorage.getItem(tm)===`on`}catch{return!1}}function im(e){try{localStorage.setItem(tm,e?`on`:`off`)}catch{}}function am({title:e,body:t}){try{let n=new Notification(e,{body:t});n.onclick=()=>{window.focus(),n.close()}}catch{}}function om(e,t){let[n,r]=(0,k.useState)(()=>nm&&rm()),[i,a]=(0,k.useState)(void 0),o=(0,k.useRef)(!1),s=(0,k.useRef)(new Map);s.current=new Map(t.map(e=>[e.id,e.title]));let c=N.events.listByProject.useQuery({projectId:e,afterId:i},{refetchInterval:1500,enabled:nm&&n});return(0,k.useEffect)(()=>{let e=c.data;if(!e||e.length===0)return;let t=e[e.length-1].id,n=document.hidden||!document.hasFocus();if(o.current&&Notification.permission===`granted`&&n)for(let t of e){let e=em(t,t.featureId?s.current.get(t.featureId):void 0);e&&am(e)}o.current=!0,a(t)},[c.data]),{supported:nm,enabled:n,toggle:(0,k.useCallback)(()=>{if(nm){if(n){r(!1),im(!1);return}o.current=!1,a(void 0),r(!0),im(!0),Notification.permission==="default"&&Notification.requestPermission().then(e=>{e!==`granted`&&(r(!1),im(!1))})}},[n])}}var sm=`docker`,cm=4512;function lm({projectId:e,activeFeatureId:t,driving:n,onDriveChange:r}){let i=Ji(),a=N.useUtils(),o=N.feature.list.useQuery({projectId:e},{refetchInterval:1500}),s=!o.isError&&o.data!==void 0,c=o.data?.find(e=>e.id===t),l=o.data?.filter(e=>e.activeRun).length??0,u=om(e,o.data??[]),d=N.feature.testDrive.useMutation({onSuccess:()=>{r(null),n&&a.feature.get.invalidate({id:n.featureId}),a.feature.list.invalidate()},onError:e=>i.push(e.message)});return(0,A.jsxs)(`footer`,{className:`statusbar`,children:[c&&(0,A.jsxs)(`button`,{className:`sb-branch`,onClick:()=>{c&&navigator.clipboard.writeText(c.branch).then(()=>i.push(`copied ${c.branch}`,`info`),()=>i.push(`copy failed`))},title:`Copy branch name`,children:[(0,A.jsx)(gi,{size:11}),c.branch]}),(0,A.jsxs)(`span`,{className:`sb-item`,title:`Agent sessions run sandboxed via ${sm}`,children:[(0,A.jsx)(Di,{size:11}),sm]}),n&&(0,A.jsxs)(`span`,{className:`sb-driving`,children:[(0,A.jsx)(`span`,{className:`sb-driving-dot`}),`driving `,(0,A.jsx)(`span`,{className:`mono`,children:n.branch}),(0,A.jsx)(`button`,{className:`sb-stop`,disabled:d.isPending,onClick:()=>d.mutate({featureId:n.featureId,action:`stop`}),children:`stop`})]}),(0,A.jsx)(`span`,{className:`sb-spacer`}),u.supported&&(0,A.jsxs)(`button`,{className:`sb-notify${u.enabled?` is-on`:``}`,onClick:u.toggle,title:u.enabled?`Desktop notifications on — click to disable`:`Notify me when a burn finishes`,children:[u.enabled?(0,A.jsx)(_i,{size:12}):(0,A.jsx)(vi,{size:12}),`notify`]}),(0,A.jsxs)(`span`,{className:`sb-item`,children:[l,` run`,l===1?``:`s`]}),(0,A.jsxs)(`span`,{className:`sb-item sb-health ${s?`is-ok`:`is-down`}`,children:[(0,A.jsx)(`span`,{className:`health-dot`}),`:`,cm,` `,s?`ok`:`down`]})]})}function um({featureId:e,sessionId:t}){let n=N.useUtils(),r=Ji(),i=N.feature.endSession.useMutation({onSuccess:()=>{n.feature.get.invalidate({id:e}),n.feature.list.invalidate(),r.push(`session ended`,`info`)},onError:e=>r.push(e.message)});return(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost sess-end`,disabled:i.isPending,title:`end this session — recoverable, you can relaunch it`,onClick:()=>i.mutate({sessionId:t}),children:i.isPending?`Ending…`:`End session`})}var dm=class extends k.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[runcastle] boundary caught`,e,t)}render(){return this.state.error?(0,A.jsx)(`div`,{className:`boundary-fallback`,children:(0,A.jsxs)(`span`,{className:`dim-line mono`,children:[this.props.label??`component`,` failed: `,this.state.error.message]})}):this.props.children}},fm=2,pm=1,mm=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(){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:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(fm,Math.floor(u/e.css.cell.width)),rows:Math.max(pm,Math.floor(l/e.css.cell.height))}}},hm=Object.defineProperty,gm=Object.getOwnPropertyDescriptor,_m=(e,t)=>{for(var n in t)hm(e,n,{get:t[n],enumerable:!0})},vm=(e,t,n,r)=>{for(var i=r>1?void 0:r?gm(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&hm(t,n,i),i},J=(e,t)=>(n,r)=>t(n,r,e),ym=`Terminal input`,bm={get:()=>ym,set:e=>ym=e},xm=`Too much output to announce, navigate to rows manually to read`,Sm={get:()=>xm,set:e=>xm=e};function Cm(e){return e.replace(/\r?\n/g,`\r`)}function wm(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Tm(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function Em(e,t,n,r){e.stopPropagation(),e.clipboardData&&Dm(e.clipboardData.getData(`text/plain`),t,n,r)}function Dm(e,t,n,r){e=Cm(e),e=wm(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Om(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function km(e,t,n,r,i){Om(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Am(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function jm(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Mm=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Nm=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Pm=``,Fm=` `,Im=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Lm}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;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}},Lm=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Rm=class e extends Im{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Lm,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Am(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},zm=`di$target`,Bm=`di$dependencies`,Vm=new Map;function Hm(e){return e[Bm]||[]}function Um(e){if(Vm.has(e))return Vm.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Wm(t,e,r)};return t._id=e,Vm.set(e,t),t}function Wm(e,t,n){t[zm]===t?t[Bm].push({id:e,index:n}):(t[Bm]=[{id:e,index:n}],t[zm]=t)}var Gm=Um(`BufferService`),Km=Um(`CoreMouseService`),qm=Um(`CoreService`),Jm=Um(`CharsetService`),Ym=Um(`InstantiationService`),Xm=Um(`LogService`),Zm=Um(`OptionsService`),Qm=Um(`OscLinkService`),$m=Um(`UnicodeService`),eh=Um(`DecorationService`),th=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Rm,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):nh(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};th=vm([J(0,Gm),J(1,Zm),J(2,Qm)],th);function nh(e,t){if(confirm(`Do you want to navigate to ${t}?
72
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function xl(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:wl(t,`input`,e.processors),output:wl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Sl(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Sl(r.element,n);if(r.type===`set`)return Sl(r.valueType,n);if(r.type===`lazy`)return Sl(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Sl(r.innerType,n);if(r.type===`intersection`)return Sl(r.left,n)||Sl(r.right,n);if(r.type===`record`||r.type===`map`)return Sl(r.keyType,n)||Sl(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Sl(r.in,n)||Sl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Sl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Sl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Sl(e,n))return!0;return!!(r.rest&&Sl(r.rest,n))}return!1}var Cl=(e,t={})=>n=>{let r=vl({...n,processors:t});return yl(e,r),bl(r,e),xl(r,e)},wl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=vl({...i??{},target:a,io:t,processors:n});return yl(e,o),bl(o,e),xl(o,e)},Tl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},El=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Tl[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Dl=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ol=(e,t,n,r)=>{n.type=`boolean`},kl=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Al=(e,t,n,r)=>{n.not={}},jl=(e,t,n,r)=>{let i=e._zod.def,a=ea(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ml=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Nl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Pl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=yl(a.element,t,{...r,path:[...r.path,`items`]})},Fl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=yl(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=yl(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Il=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>yl(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ll=(e,t,n,r)=>{let i=e._zod.def,a=yl(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=yl(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Rl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=yl(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=yl(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=yl(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},zl=(e,t,n,r)=>{let i=e._zod.def,a=yl(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Bl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Hl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ul=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Wl=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;yl(o,t,r);let s=t.seen.get(e);s.ref=o},Gl=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},z=(e,t,n,r)=>{let i=e._zod.def;yl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Kl=I(`ZodISODateTime`,(e,t)=>{fs.init(e,t),hu.init(e,t)});function B(e){return Rc(Kl,e)}var V=I(`ZodISODate`,(e,t)=>{ps.init(e,t),hu.init(e,t)});function ql(e){return zc(V,e)}var Jl=I(`ZodISOTime`,(e,t)=>{ms.init(e,t),hu.init(e,t)});function Yl(e){return Bc(Jl,e)}var Xl=I(`ZodISODuration`,(e,t)=>{hs.init(e,t),hu.init(e,t)});function Zl(e){return Vc(Xl,e)}var Ql=I(`ZodError`,(e,t)=>{La.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ba(e,t)},flatten:{value:t=>za(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ta,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ta,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),$l=Va(Ql),eu=Ha(Ql),tu=Ua(Ql),nu=Ga(Ql),ru=qa(Ql),iu=Ja(Ql),au=Ya(Ql),ou=Xa(Ql),su=Za(Ql),cu=Qa(Ql),lu=$a(Ql),uu=eo(Ql),du=new WeakMap;function fu(e,t,n){let r=Object.getPrototypeOf(e),i=du.get(r);if(i||(i=new Set,du.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var H=I(`ZodType`,(e,t)=>(Qo.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:wl(e,`input`),output:wl(e,`output`)}}),e.toJSONSchema=Cl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>$l(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>tu(e,t,n),e.parseAsync=async(t,n)=>eu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>nu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ru(e,t,n),e.decode=(t,n)=>iu(e,t,n),e.encodeAsync=async(t,n)=>au(e,t,n),e.decodeAsync=async(t,n)=>ou(e,t,n),e.safeEncode=(t,n)=>su(e,t,n),e.safeDecode=(t,n)=>cu(e,t,n),e.safeEncodeAsync=async(t,n)=>lu(e,t,n),e.safeDecodeAsync=async(t,n)=>uu(e,t,n),fu(e,`ZodType`,{check(...e){let t=this.def;return this.clone(la(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ya(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ed(e,t))},superRefine(e,t){return this.check(G(e,t))},overwrite(e){return this.check(cl(e))},optional(){return sd(this)},exactOptional(){return ld(this)},nullable(){return dd(this)},nullish(){return sd(dd(this))},nonoptional(e){return _d(this,e)},array(){return Ju(this)},or(e){return W([this,e])},and(e){return $u(this,e)},transform(e){return xd(this,ad(e))},default(e){return pd(this,e)},prefault(e){return hd(this,e)},catch(e){return yd(this,e)},pipe(e){return xd(this,e)},readonly(){return wd(this)},describe(e){let t=this.clone();return mc.add(t,{description:e}),t},meta(...e){if(e.length===0)return mc.get(this);let t=this.clone();return mc.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return mc.get(e)?.description},configurable:!0}),e)),pu=I(`_ZodString`,(e,t)=>{$o.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fu(e,`_ZodString`,{regex(...e){return this.check(nl(...e))},includes(...e){return this.check(al(...e))},startsWith(...e){return this.check(ol(...e))},endsWith(...e){return this.check(sl(...e))},min(...e){return this.check(el(...e))},max(...e){return this.check($c(...e))},length(...e){return this.check(tl(...e))},nonempty(...e){return this.check(el(1,...e))},lowercase(e){return this.check(rl(e))},uppercase(e){return this.check(il(e))},trim(){return this.check(ul())},normalize(...e){return this.check(ll(...e))},toLowerCase(){return this.check(dl())},toUpperCase(){return this.check(fl())},slugify(){return this.check(pl())}})}),mu=I(`ZodString`,(e,t)=>{$o.init(e,t),pu.init(e,t),e.email=t=>e.check(gc(gu,t)),e.url=t=>e.check(Sc(yu,t)),e.jwt=t=>e.check(Lc(Pu,t)),e.emoji=t=>e.check(Cc(bu,t)),e.guid=t=>e.check(_c(_u,t)),e.uuid=t=>e.check(vc(vu,t)),e.uuidv4=t=>e.check(yc(vu,t)),e.uuidv6=t=>e.check(bc(vu,t)),e.uuidv7=t=>e.check(xc(vu,t)),e.nanoid=t=>e.check(wc(xu,t)),e.guid=t=>e.check(_c(_u,t)),e.cuid=t=>e.check(Tc(Su,t)),e.cuid2=t=>e.check(Ec(Cu,t)),e.ulid=t=>e.check(Dc(wu,t)),e.base64=t=>e.check(Pc(ju,t)),e.base64url=t=>e.check(Fc(Mu,t)),e.xid=t=>e.check(Oc(Tu,t)),e.ksuid=t=>e.check(kc(Eu,t)),e.ipv4=t=>e.check(Ac(Du,t)),e.ipv6=t=>e.check(jc(Ou,t)),e.cidrv4=t=>e.check(Mc(ku,t)),e.cidrv6=t=>e.check(Nc(Au,t)),e.e164=t=>e.check(Ic(Nu,t)),e.datetime=t=>e.check(B(t)),e.date=t=>e.check(ql(t)),e.time=t=>e.check(Yl(t)),e.duration=t=>e.check(Zl(t))});function U(e){return hc(mu,e)}var hu=I(`ZodStringFormat`,(e,t)=>{es.init(e,t),pu.init(e,t)}),gu=I(`ZodEmail`,(e,t)=>{rs.init(e,t),hu.init(e,t)}),_u=I(`ZodGUID`,(e,t)=>{ts.init(e,t),hu.init(e,t)}),vu=I(`ZodUUID`,(e,t)=>{ns.init(e,t),hu.init(e,t)}),yu=I(`ZodURL`,(e,t)=>{is.init(e,t),hu.init(e,t)}),bu=I(`ZodEmoji`,(e,t)=>{as.init(e,t),hu.init(e,t)}),xu=I(`ZodNanoID`,(e,t)=>{os.init(e,t),hu.init(e,t)}),Su=I(`ZodCUID`,(e,t)=>{ss.init(e,t),hu.init(e,t)}),Cu=I(`ZodCUID2`,(e,t)=>{cs.init(e,t),hu.init(e,t)}),wu=I(`ZodULID`,(e,t)=>{ls.init(e,t),hu.init(e,t)}),Tu=I(`ZodXID`,(e,t)=>{us.init(e,t),hu.init(e,t)}),Eu=I(`ZodKSUID`,(e,t)=>{ds.init(e,t),hu.init(e,t)}),Du=I(`ZodIPv4`,(e,t)=>{gs.init(e,t),hu.init(e,t)}),Ou=I(`ZodIPv6`,(e,t)=>{_s.init(e,t),hu.init(e,t)}),ku=I(`ZodCIDRv4`,(e,t)=>{vs.init(e,t),hu.init(e,t)}),Au=I(`ZodCIDRv6`,(e,t)=>{ys.init(e,t),hu.init(e,t)}),ju=I(`ZodBase64`,(e,t)=>{xs.init(e,t),hu.init(e,t)}),Mu=I(`ZodBase64URL`,(e,t)=>{Cs.init(e,t),hu.init(e,t)}),Nu=I(`ZodE164`,(e,t)=>{ws.init(e,t),hu.init(e,t)}),Pu=I(`ZodJWT`,(e,t)=>{Es.init(e,t),hu.init(e,t)}),Fu=I(`ZodNumber`,(e,t)=>{Ds.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),fu(e,`ZodNumber`,{gt(e,t){return this.check(Xc(e,t))},gte(e,t){return this.check(Zc(e,t))},min(e,t){return this.check(Zc(e,t))},lt(e,t){return this.check(Jc(e,t))},lte(e,t){return this.check(Yc(e,t))},max(e,t){return this.check(Yc(e,t))},int(e){return this.check(Ru(e))},safe(e){return this.check(Ru(e))},positive(e){return this.check(Xc(0,e))},nonnegative(e){return this.check(Zc(0,e))},negative(e){return this.check(Jc(0,e))},nonpositive(e){return this.check(Yc(0,e))},multipleOf(e,t){return this.check(Qc(e,t))},step(e,t){return this.check(Qc(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Iu(e){return Hc(Fu,e)}var Lu=I(`ZodNumberFormat`,(e,t)=>{Os.init(e,t),Fu.init(e,t)});function Ru(e){return Uc(Lu,e)}var zu=I(`ZodBoolean`,(e,t)=>{ks.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r)});function Bu(e){return Wc(zu,e)}var Vu=I(`ZodNull`,(e,t)=>{As.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r)});function Hu(e){return Gc(Vu,e)}var Uu=I(`ZodUnknown`,(e,t)=>{js.init(e,t),H.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Wu(){return Kc(Uu)}var Gu=I(`ZodNever`,(e,t)=>{Ms.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r)});function Ku(e){return qc(Gu,e)}var qu=I(`ZodArray`,(e,t)=>{Ps.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.element=t.element,fu(e,`ZodArray`,{min(e,t){return this.check(el(e,t))},nonempty(e){return this.check(el(1,e))},max(e,t){return this.check($c(e,t))},length(e,t){return this.check(tl(e,t))},unwrap(){return this.element}})});function Ju(e,t){return ml(qu,e,t)}var Yu=I(`ZodObject`,(e,t)=>{zs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fl(e,t,n,r),sa(e,`shape`,()=>t.shape),fu(e,`ZodObject`,{keyof(){return rd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Wu()})},loose(){return this.clone({...this._zod.def,catchall:Wu()})},strict(){return this.clone({...this._zod.def,catchall:Ku()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return wa(this,e)},safeExtend(e){return Ta(this,e)},merge(e){return Ea(this,e)},pick(e){return Sa(this,e)},omit(e){return Ca(this,e)},partial(...e){return Da(od,this,e[0])},required(...e){return Oa(gd,this,e[0])}})});function Xu(e,t){return new Yu({type:`object`,shape:e??{},...L(t)})}var Zu=I(`ZodUnion`,(e,t)=>{Vs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Il(e,t,n,r),e.options=t.options});function W(e,t){return new Zu({type:`union`,options:e,...L(t)})}var Qu=I(`ZodIntersection`,(e,t)=>{Hs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ll(e,t,n,r)});function $u(e,t){return new Qu({type:`intersection`,left:e,right:t})}var ed=I(`ZodRecord`,(e,t)=>{Gs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rl(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function td(e,t,n){let r=ya(e);return r._zod.values=void 0,new ed({type:`record`,keyType:r,valueType:t,...L(n)})}var nd=I(`ZodEnum`,(e,t)=>{Ks.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new nd({...t,checks:[],...L(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nd({...t,checks:[],...L(r),entries:i})}});function rd(e,t){return new nd({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var id=I(`ZodTransform`,(e,t)=>{qs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Zi(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Fa(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Fa(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ad(e){return new id({type:`transform`,transform:e})}var od=I(`ZodOptional`,(e,t)=>{Ys.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sd(e){return new od({type:`optional`,innerType:e})}var cd=I(`ZodExactOptional`,(e,t)=>{Xs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ld(e){return new cd({type:`optional`,innerType:e})}var ud=I(`ZodNullable`,(e,t)=>{Zs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dd(e){return new ud({type:`nullable`,innerType:e})}var fd=I(`ZodDefault`,(e,t)=>{Qs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pd(e,t){return new fd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ga(t)}})}var md=I(`ZodPrefault`,(e,t)=>{ec.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hd(e,t){return new md({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ga(t)}})}var gd=I(`ZodNonOptional`,(e,t)=>{tc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _d(e,t){return new gd({type:`nonoptional`,innerType:e,...L(t)})}var vd=I(`ZodCatch`,(e,t)=>{rc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ul(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yd(e,t){return new vd({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var bd=I(`ZodPipe`,(e,t)=>{ic.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wl(e,t,n,r),e.in=t.in,e.out=t.out});function xd(e,t){return new bd({type:`pipe`,in:e,out:t})}var Sd=I(`ZodPreprocess`,(e,t)=>{bd.init(e,t),oc.init(e,t)}),Cd=I(`ZodReadonly`,(e,t)=>{sc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wd(e){return new Cd({type:`readonly`,innerType:e})}var Td=I(`ZodCustom`,(e,t)=>{lc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r)});function Ed(e,t={}){return hl(Td,e,t)}function G(e,t){return gl(e,t)}function Dd(e,t){return new Sd({type:`pipe`,in:ad(e),out:t})}var Od=rd([`ideation`,`spec`,`tickets`,`implementation`,`review`,`shipped`]),kd=rd([`pending`,`burning`,`done`,`failed`,`cancelled`]),Ad=rd([`ideation`,`qa`,`waypoint`,`converge`,`revisit`]),jd=rd([`running`,`succeeded`,`failed`,`cancelled`]),Md=rd([`active`,`shipped`,`archived`]),Nd=rd([`launching`,`live`,`ended`]);Xu({title:U(),goal:U(),context:U(),acceptanceCriteria:Ju(U()),seams:Ju(U()),blockedBy:Ju(Iu())}).extend({id:U(),featureId:U(),seq:Iu(),status:kd,commits:Ju(U()),error:U().optional(),attemptBranch:U().optional()});var Pd=rd([`grilling`,`research`,`prototype`,`task`]),Fd=rd([`open`,`claimed`,`resolved`,`dropped`]);rd([`resolved`,`dropped`]),Xu({title:U(),type:Pd,question:U(),blockedBy:Ju(W([Iu(),U()])),originWaypointId:U().optional()}).extend({id:U(),featureId:U(),seq:Iu(),blockedBy:Ju(Iu()),status:Fd,claimedBy:U().optional(),lastSessionId:U().optional(),summary:U().optional()}),Xu({id:U(),name:U(),repoPath:U(),mainBranch:U(),devCommand:U().optional(),model:U().optional()}),Xu({id:U(),projectId:U(),slug:U(),title:U(),oneLiner:U(),mapped:Bu(),phase:Od,branch:U(),baseBranch:U().optional(),status:Md,createdAt:Iu()}),Xu({id:U(),featureId:U(),kind:Ad,ccSessionId:U().optional(),transcriptPath:U().optional(),status:Nd,worktreePath:U()}),Xu({id:U(),featureId:U(),workflow:U(),status:jd,startedAt:Iu(),endedAt:Iu().optional(),summary:U().optional()});var Id=rd([`env`,`project`,`file`,`default`]),Ld=rd([`global`,`project`]),Rd=Xu({key:U(),value:Wu(),source:Id,editable:Bu(),restartRequired:Bu(),scope:Ld});Xu({projectId:U().optional(),fields:Ju(Rd)}),Xu({projectId:U().optional(),key:U(),value:W([U(),Iu(),Bu(),Hu()])}),Xu({id:Iu(),projectId:U(),featureId:U().optional(),runId:U().optional(),ticketId:U().optional(),ts:Iu(),type:U(),message:U(),data:Wu().optional()});var zd=[{phase:`ideation`},{phase:`spec`,gateToEnter:{id:`G1`,description:`Decisions captured before writing a spec`,check:`decisions-file-exists`}},{phase:`tickets`,gateToEnter:{id:`G2`,description:`Spec written before breaking into tickets`,check:`spec-file-exists`}},{phase:`implementation`,gateToEnter:{id:`G3`,description:`Tickets approved by a human (the Burn click)`,check:`tickets-approved`}},{phase:`review`,gateToEnter:{id:`G4`,description:`Every ticket reached a terminal state`,check:`all-tickets-terminal`}},{phase:`shipped`,gateToEnter:{id:`G5`,description:`Human merged the feature branch (the Merge click)`,check:`human-merge`}}].map(e=>e.phase);function Bd(e){let t=zd.indexOf(e.phase);return t<0||t>=zd.length-1?null:zd[t+1]}var K=Symbol.for(`drizzle:entityKind`);function Vd(e,t){if(!e||typeof e!=`object`)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,K))throw Error(`Class "${t.name??`<unknown>`}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(K in n&&n[K]===t[K])return!0;n=Object.getPrototypeOf(n)}return!1}var Hd=class{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[K]=`Column`;name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!==`byDefault`}},Ud=class{static[K]=`ColumnBuilder`;config;constructor(e,t,n){this.config={name:e,keyAsName:e===``,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===``&&(this.config.name=e)}},Wd=Symbol.for(`drizzle:Name`),Gd=Symbol.for(`drizzle:isPgEnum`);function Kd(e){return!!e&&typeof e==`function`&&Gd in e&&e[Gd]===!0}var qd=class{static[K]=`Subquery`;constructor(e,t,n,r=!1,i=[]){this._={brand:`Subquery`,sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}},Jd={startActiveSpan(e,t){return t()}},Yd=Symbol.for(`drizzle:ViewBaseConfig`),Xd=Symbol.for(`drizzle:Schema`),Zd=Symbol.for(`drizzle:Columns`),Qd=Symbol.for(`drizzle:ExtraConfigColumns`),$d=Symbol.for(`drizzle:OriginalName`),ef=Symbol.for(`drizzle:BaseName`),tf=Symbol.for(`drizzle:IsAlias`),nf=Symbol.for(`drizzle:ExtraConfigBuilder`),rf=Symbol.for(`drizzle:IsDrizzleTable`),af=class{static[K]=`Table`;static Symbol={Name:Wd,Schema:Xd,OriginalName:$d,Columns:Zd,ExtraConfigColumns:Qd,BaseName:ef,IsAlias:tf,ExtraConfigBuilder:nf};[Wd];[$d];[Xd];[Zd];[Qd];[ef];[tf]=!1;[rf]=!0;[nf]=void 0;constructor(e,t,n){this[Wd]=this[$d]=e,this[Xd]=t,this[ef]=n}};function of(e){return e!=null&&typeof e.getSQL==`function`}function sf(e){let t={sql:``,params:[]};for(let n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||=[],t.typings.push(...n.typings));return t}var cf=class{static[K]=`StringChunk`;value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new lf([this])}},lf=class e{constructor(e){this.queryChunks=e;for(let t of e)if(Vd(t,af)){let e=t[af.Symbol.Schema];this.usedTables.push(e===void 0?t[af.Symbol.Name]:e+`.`+t[af.Symbol.Name])}}static[K]=`SQL`;decoder=df;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return Jd.startActiveSpan(`drizzle.buildSQL`,t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(t,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:o,prepareTyping:s,inlineParams:c,paramStartIndex:l}=r;return sf(t.map(t=>{if(Vd(t,cf))return{sql:t.value.join(``),params:[]};if(Vd(t,uf))return{sql:a(t.value),params:[]};if(t===void 0)return{sql:``,params:[]};if(Array.isArray(t)){let e=[new cf(`(`)];for(let[n,r]of t.entries())e.push(r),n<t.length-1&&e.push(new cf(`, `));return e.push(new cf(`)`)),this.buildQueryFromSourceParams(e,r)}if(Vd(t,e))return this.buildQueryFromSourceParams(t.queryChunks,{...r,inlineParams:c||t.shouldInlineParams});if(Vd(t,af)){let e=t[af.Symbol.Schema],n=t[af.Symbol.Name];return{sql:e===void 0||t[tf]?a(n):a(e)+`.`+a(n),params:[]}}if(Vd(t,Hd)){let e=i.getColumnCasing(t);if(n.invokeSource===`indexes`)return{sql:a(e),params:[]};let r=t.table[af.Symbol.Schema];return{sql:t.table[tf]||r===void 0?a(t.table[af.Symbol.Name])+`.`+a(e):a(r)+`.`+a(t.table[af.Symbol.Name])+`.`+a(e),params:[]}}if(Vd(t,_f)){let e=t[Yd].schema,n=t[Yd].name;return{sql:e===void 0||t[Yd].isAlias?a(n):a(e)+`.`+a(n),params:[]}}if(Vd(t,pf)){if(Vd(t.value,hf))return{sql:o(l.value++,t),params:[t],typings:[`none`]};let n=t.value===null?null:t.encoder.mapToDriverValue(t.value);if(Vd(n,e))return this.buildQueryFromSourceParams([n],r);if(c)return{sql:this.mapInlineParam(n,r),params:[]};let i=[`none`];return s&&(i=[s(t.encoder)]),{sql:o(l.value++,n),params:[n],typings:i}}return Vd(t,hf)?{sql:o(l.value++,t),params:[t],typings:[`none`]}:Vd(t,e.Aliased)&&t.fieldAlias!==void 0?{sql:a(t.fieldAlias),params:[]}:Vd(t,qd)?t._.isWith?{sql:a(t._.alias),params:[]}:this.buildQueryFromSourceParams([new cf(`(`),t._.sql,new cf(`) `),new uf(t._.alias)],r):Kd(t)?t.schema?{sql:a(t.schema)+`.`+a(t.enumName),params:[]}:{sql:a(t.enumName),params:[]}:of(t)?t.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([t.getSQL()],r):this.buildQueryFromSourceParams([new cf(`(`),t.getSQL(),new cf(`)`)],r):c?{sql:this.mapInlineParam(t,r),params:[]}:{sql:o(l.value++,t),params:[t],typings:[`none`]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return`null`;if(typeof e==`number`||typeof e==`boolean`)return e.toString();if(typeof e==`string`)return t(e);if(typeof e==`object`){let n=e.toString();return t(n===`[object Object]`?JSON.stringify(e):n)}throw Error(`Unexpected param value: `+e)}getSQL(){return this}as(t){return t===void 0?this:new e.Aliased(this,t)}mapWith(e){return this.decoder=typeof e==`function`?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}},uf=class{constructor(e){this.value=e}static[K]=`Name`;brand;getSQL(){return new lf([this])}},df={mapFromDriverValue:e=>e},ff={mapToDriverValue:e=>e};({...df,...ff});var pf=class{constructor(e,t=ff){this.value=e,this.encoder=t}static[K]=`Param`;brand;getSQL(){return new lf([this])}};function mf(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!==``)&&n.push(new cf(e[0]));for(let[r,i]of t.entries())n.push(i,new cf(e[r+1]));return new lf(n)}(e=>{function t(){return new lf([])}e.empty=t;function n(e){return new lf(e)}e.fromList=n;function r(e){return new lf([new cf(e)])}e.raw=r;function i(e,t){let n=[];for(let[r,i]of e.entries())r>0&&t!==void 0&&n.push(t),n.push(i);return new lf(n)}e.join=i;function a(e){return new uf(e)}e.identifier=a;function o(e){return new hf(e)}e.placeholder=o;function s(e,t){return new pf(e,t)}e.param=s})(mf||={}),(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static[K]=`SQL.Aliased`;isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(lf||={});var hf=class{constructor(e){this.name=e}static[K]=`Placeholder`;getSQL(){return new lf([this])}},gf=Symbol.for(`drizzle:IsDrizzleView`),_f=class{static[K]=`View`;[Yd];[gf]=!0;constructor({name:e,schema:t,selectedFields:n,query:r}){this[Yd]={name:e,originalName:e,schema:t,selectedFields:n,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new lf([this])}};Hd.prototype.getSQL=function(){return new lf([this])},af.prototype.getSQL=function(){return new lf([this])},qd.prototype.getSQL=function(){return new lf([this])};function vf(e,t){return{name:typeof e==`string`&&e.length>0?e:``,config:typeof e==`object`?e:t}}var yf=typeof TextDecoder>`u`?null:new TextDecoder,bf=class{static[K]=`SQLiteForeignKeyBuilder`;reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:n,foreignColumns:r}=e();return{name:t,columns:n,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new xf(e,this)}},xf=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[K]=`SQLiteForeignKey`;reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[Wd],...r,n[0].table[Wd],...i];return e??`${a.join(`_`)}_fk`}};function Sf(e,t){return`${e[Wd]}_${t.join(`_`)}_unique`}var Cf=class extends Ud{static[K]=`SQLiteColumnBuilder`;foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:`always`,mode:t?.mode??`virtual`},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>((n,r)=>{let i=new bf(()=>{let t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)})(n,r))}},wf=class extends Hd{constructor(e,t){t.uniqueName||=Sf(e,[t.name]),super(e,t),this.table=e}static[K]=`SQLiteColumn`},Tf=class extends Cf{static[K]=`SQLiteBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteBigInt`)}build(e){return new Ef(e,this.config)}},Ef=class extends wf{static[K]=`SQLiteBigInt`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString(`utf8`))}return BigInt(yf.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}},Df=class extends Cf{static[K]=`SQLiteBlobJsonBuilder`;constructor(e){super(e,`json`,`SQLiteBlobJson`)}build(e){return new Of(e,this.config)}},Of=class extends wf{static[K]=`SQLiteBlobJson`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString(`utf8`))}return JSON.parse(yf.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}},kf=class extends Cf{static[K]=`SQLiteBlobBufferBuilder`;constructor(e){super(e,`buffer`,`SQLiteBlobBuffer`)}build(e){return new Af(e,this.config)}},Af=class extends wf{static[K]=`SQLiteBlobBuffer`;mapFromDriverValue(e){return Buffer.isBuffer(e)?e:Buffer.from(e)}getSQLType(){return`blob`}};function jf(e,t){let{name:n,config:r}=vf(e,t);return r?.mode===`json`?new Df(n):r?.mode===`bigint`?new Tf(n):new kf(n)}var Mf=class extends Cf{static[K]=`SQLiteCustomColumnBuilder`;constructor(e,t,n){super(e,`custom`,`SQLiteCustomColumn`),this.config.fieldConfig=t,this.config.customTypeParams=n}build(e){return new Nf(e,this.config)}},Nf=class extends wf{static[K]=`SQLiteCustomColumn`;sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom==`function`?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo==`function`?this.mapTo(e):e}};function Pf(e){return(t,n)=>{let{name:r,config:i}=vf(t,n);return new Mf(r,i,e)}}var Ff=class extends Cf{static[K]=`SQLiteBaseIntegerBuilder`;constructor(e,t,n){super(e,t,n),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}},If=class extends wf{static[K]=`SQLiteBaseInteger`;autoIncrement=this.config.autoIncrement;getSQLType(){return`integer`}},Lf=class extends Ff{static[K]=`SQLiteIntegerBuilder`;constructor(e){super(e,`number`,`SQLiteInteger`)}build(e){return new Rf(e,this.config)}},Rf=class extends If{static[K]=`SQLiteInteger`},zf=class extends Ff{static[K]=`SQLiteTimestampBuilder`;constructor(e,t){super(e,`date`,`SQLiteTimestamp`),this.config.mode=t}defaultNow(){return this.default(mf`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new Bf(e,this.config)}},Bf=class extends If{static[K]=`SQLiteTimestamp`;mode=this.config.mode;mapFromDriverValue(e){return this.config.mode===`timestamp`?new Date(e*1e3):new Date(e)}mapToDriverValue(e){let t=e.getTime();return this.config.mode===`timestamp`?Math.floor(t/1e3):t}},Vf=class extends Ff{static[K]=`SQLiteBooleanBuilder`;constructor(e,t){super(e,`boolean`,`SQLiteBoolean`),this.config.mode=t}build(e){return new Hf(e,this.config)}},Hf=class extends If{static[K]=`SQLiteBoolean`;mode=this.config.mode;mapFromDriverValue(e){return Number(e)===1}mapToDriverValue(e){return+!!e}};function Uf(e,t){let{name:n,config:r}=vf(e,t);return r?.mode===`timestamp`||r?.mode===`timestamp_ms`?new zf(n,r.mode):r?.mode===`boolean`?new Vf(n,r.mode):new Lf(n)}var Wf=class extends Cf{static[K]=`SQLiteNumericBuilder`;constructor(e){super(e,`string`,`SQLiteNumeric`)}build(e){return new Gf(e,this.config)}},Gf=class extends wf{static[K]=`SQLiteNumeric`;mapFromDriverValue(e){return typeof e==`string`?e:String(e)}getSQLType(){return`numeric`}},Kf=class extends Cf{static[K]=`SQLiteNumericNumberBuilder`;constructor(e){super(e,`number`,`SQLiteNumericNumber`)}build(e){return new qf(e,this.config)}},qf=class extends wf{static[K]=`SQLiteNumericNumber`;mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}mapToDriverValue=String;getSQLType(){return`numeric`}},Jf=class extends Cf{static[K]=`SQLiteNumericBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteNumericBigInt`)}build(e){return new Yf(e,this.config)}},Yf=class extends wf{static[K]=`SQLiteNumericBigInt`;mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return`numeric`}};function Xf(e,t){let{name:n,config:r}=vf(e,t),i=r?.mode;return i===`number`?new Kf(n):i===`bigint`?new Jf(n):new Wf(n)}var Zf=class extends Cf{static[K]=`SQLiteRealBuilder`;constructor(e){super(e,`number`,`SQLiteReal`)}build(e){return new Qf(e,this.config)}},Qf=class extends wf{static[K]=`SQLiteReal`;getSQLType(){return`real`}};function $f(e){return new Zf(e??``)}var ep=class extends Cf{static[K]=`SQLiteTextBuilder`;constructor(e,t){super(e,`string`,`SQLiteText`),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new tp(e,this.config)}},tp=class extends wf{static[K]=`SQLiteText`;enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:``}`}},np=class extends Cf{static[K]=`SQLiteTextJsonBuilder`;constructor(e){super(e,`json`,`SQLiteTextJson`)}build(e){return new rp(e,this.config)}},rp=class extends wf{static[K]=`SQLiteTextJson`;getSQLType(){return`text`}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}};function q(e,t={}){let{name:n,config:r}=vf(e,t);return r.mode===`json`?new np(n):new ep(n,r)}function ip(){return{blob:jf,customType:Pf,integer:Uf,numeric:Xf,real:$f,text:q}}var ap=Symbol.for(`drizzle:SQLiteInlineForeignKeys`),op=class extends af{static[K]=`SQLiteTable`;static Symbol=Object.assign({},af.Symbol,{InlineForeignKeys:ap});[af.Symbol.Columns];[ap]=[];[af.Symbol.ExtraConfigBuilder]=void 0};function sp(e,t,n,r,i=e){let a=new op(e,r,i),o=typeof t==`function`?t(ip()):t,s=Object.fromEntries(Object.entries(o).map(([e,t])=>{let n=t;n.setName(e);let r=n.build(a);return a[ap].push(...n.buildForeignKeys(r,a)),[e,r]})),c=Object.assign(a,s);return c[af.Symbol.Columns]=s,c[af.Symbol.ExtraConfigColumns]=s,n&&(c[op.Symbol.ExtraConfigBuilder]=n),c}var cp=(e,t,n)=>sp(e,t,n);cp(`projects`,{id:q(`id`).primaryKey(),name:q(`name`).notNull(),repoPath:q(`repo_path`).notNull(),mainBranch:q(`main_branch`).notNull(),devCommand:q(`dev_command`),model:q(`model`),sandbox:q(`sandbox`),closedAt:Uf(`closed_at`)}),cp(`features`,{id:q(`id`).primaryKey(),projectId:q(`project_id`).notNull(),slug:q(`slug`).notNull(),title:q(`title`).notNull(),oneLiner:q(`one_liner`).notNull(),mapped:Uf(`mapped`,{mode:`boolean`}).notNull().default(!1),phase:q(`phase`).notNull().$type(),branch:q(`branch`).notNull(),baseBranch:q(`base_branch`),status:q(`status`).notNull().$type(),createdAt:Uf(`created_at`).notNull()}),cp(`sessions`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),kind:q(`kind`).notNull().$type(),ccSessionId:q(`cc_session_id`),transcriptPath:q(`transcript_path`),status:q(`status`).notNull().$type(),worktreePath:q(`worktree_path`).notNull()}),cp(`tickets`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),seq:Uf(`seq`).notNull(),title:q(`title`).notNull(),goal:q(`goal`).notNull(),context:q(`context`).notNull(),acceptanceCriteria:q(`acceptance_criteria`,{mode:`json`}).notNull().$type(),seams:q(`seams`,{mode:`json`}).notNull().$type(),blockedBy:q(`blocked_by`,{mode:`json`}).notNull().$type(),status:q(`status`).notNull().$type(),commits:q(`commits`,{mode:`json`}).notNull().$type(),error:q(`error`),attemptBranch:q(`attempt_branch`)}),cp(`waypoints`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),seq:Uf(`seq`).notNull(),title:q(`title`).notNull(),type:q(`type`).notNull().$type(),question:q(`question`).notNull(),blockedBy:q(`blocked_by`,{mode:`json`}).notNull().$type(),originWaypointId:q(`origin_waypoint_id`),status:q(`status`).notNull().$type(),claimedBy:q(`claimed_by`),lastSessionId:q(`last_session_id`),summary:q(`summary`)}),cp(`runs`,{id:q(`id`).primaryKey(),featureId:q(`feature_id`).notNull(),workflow:q(`workflow`).notNull(),status:q(`status`).notNull().$type(),startedAt:Uf(`started_at`).notNull(),endedAt:Uf(`ended_at`),summary:q(`summary`)}),cp(`events`,{id:Uf(`id`).primaryKey({autoIncrement:!0}),projectId:q(`project_id`).notNull(),featureId:q(`feature_id`),runId:q(`run_id`),ticketId:q(`ticket_id`),ts:Uf(`ts`).notNull(),type:q(`type`).notNull(),message:q(`message`).notNull(),data:q(`data`,{mode:`json`})}),cp(`gate_overrides`,{id:Uf(`id`).primaryKey({autoIncrement:!0}),featureId:q(`feature_id`).notNull(),gate:q(`gate`).notNull(),reason:q(`reason`).notNull(),ts:Uf(`ts`).notNull()});var lp=[`ideation`,`qa`,`waypoint`,`converge`,`revisit`,`research`,`implement`,`smoke`],up=rd(lp),dp=[{id:`claude-opus-4-8`,label:`Opus 4.8`},{id:`claude-sonnet-5`,label:`Sonnet 5`},{id:`claude-haiku-4-5-20251001`,label:`Haiku 4.5`},{id:`claude-fable-5`,label:`Fable 5`}];Dd(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e},n=t.smokeModel;if(typeof n==`string`&&n.length>0){let e=typeof t.stepModels==`object`&&t.stepModels!==null&&!Array.isArray(t.stepModels)?t.stepModels:{};e.smoke===void 0&&(t.stepModels={...e,smoke:n})}return delete t.smokeModel,t},Xu({serverPort:Iu().default(4512),model:U().default(`claude-opus-4-8`),stepModels:td(up,U()).default({smoke:`claude-haiku-4-5-20251001`}),sandbox:rd([`docker`,`podman`,`noSandbox`]).default(`docker`),mainBranch:U().default(`main`),sandboxImage:U().optional(),burnConcurrency:Iu().int().min(1).max(8).default(3),burnMaxIterations:Iu().int().min(1).max(10).default(3),burnAttempts:Iu().int().min(1).max(5).default(3),setupCommand:U().optional(),burnWorkspace:rd([`auto`,`mounted`,`isolated`]).default(`auto`)}));function fp(e){return e.branches.includes(e.current)?e.current:e.mainBranch}var pp=[`ideation`,`spec`,`tickets`,`implementation`,`review`,`shipped`];function mp(e){return e.status===`shipped`||e.status===`archived`||e.activeRun?null:e.ticketCounts.failed>0?{kind:`attention`,label:`run failed — needs attention`}:e.phase===`ideation`?{kind:`grill`,label:`needs grilling`}:e.phase===`tickets`&&e.ticketCounts.total>0?{kind:`burn`,label:`review & burn tickets`}:e.phase===`review`?{kind:`ship`,label:`test & merge`}:null}function hp(e){if(e.length!==0)return[...e].sort((e,t)=>t.startedAt-e.startedAt)[0]}var gp={ideation:`ideation`,spec:`spec`,tickets:`tickets`,implementation:`build`,review:`review`,shipped:`shipped`},_p={ideation:`Shape the idea in a grill session`,spec:`Write it up as a spec`,tickets:`Break the work into atomic tickets`,implementation:`Burn the tickets into commits`,review:`Test-drive the branch, then merge`,shipped:`Merged to the main branch`};function vp(e){return pp.indexOf(e)}function yp(e){return e.status===`archived`?`archived`:e.status===`shipped`?`shipped`:e.activeRun?`agentWorking`:mp(e)?`needsYou`:`inProgress`}function bp(e,t={}){let n={needsYou:[],agentWorking:[],inProgress:[],shipped:[],archived:[]};for(let t of e)n[yp(t)].push(t);let r=[{key:`needsYou`,label:`Needs you`},{key:`agentWorking`,label:`Agent working`},{key:`inProgress`,label:`In progress`},{key:`shipped`,label:`Shipped`}];return t.showArchived&&r.push({key:`archived`,label:`Archived`}),r.map(({key:e,label:t})=>({key:e,label:t,features:n[e]})).filter(e=>e.features.length>0)}function xp(e,t){let n=vp(e.phase),r=vp(t);return r<n?`done`:r===n?`current`:`upcoming`}function Sp(e){return pp.map(t=>({phase:t,state:xp(e,t)}))}function Cp(e,t){return t??e.phase}function wp(e,t){return vp(t)<vp(e.phase)}function Tp(e,t){return pp.map(n=>{let r=xp(e,n);return{phase:n,label:gp[n],state:r,isViewed:n===t,clickable:r===`done`||r===`current`,tip:_p[n]}})}var Ep=`Proceed with your task: invoke the /runcastle:revisit skill for a REVIEW ITERATION. Call get_feature_context to read the latest run outcome and every ticket’s state, then interview me about what the test drive surfaced — bugs, rough edges, tweaks. Turn what we settle on into fix tickets with emit_tickets, and use update_ticket / cancel_ticket on any stale pending tickets. Never call complete_phase — leave the phase at review. When the tickets are ready, tell me to review the cards and click Burn.`;function Dp(e,t,n){return`Proceed with your task: RESOLVE A MERGE CONFLICT. Merging ${e} into ${t} conflicts on: ${n.length?n.join(`, `):`(run git status to see the conflicts)`}. Your working directory IS the talk worktree, already checked out on ${t}. Run \`git merge ${e}\`, then resolve every conflict using this feature’s spec.md and decisions.md for intent, and commit the merge. Do NOT push and do NOT advance the phase (never call complete_phase). When the merge commit is in, tell me to click “Merge & ship” again for a clean retry.`}function Op(e){let t=null;for(let n of e)if(n.type===`merge.conflict`){let e=n.data??{},r=Array.isArray(e.files)?e.files.filter(e=>typeof e==`string`):[];t={base:typeof e.base==`string`?e.base:``,files:r}}else n.type===`burn.started`&&(t=null);return t}function kp(e,t){return e.some(e=>e.kind===t&&e.status===`ended`&&!!e.ccSessionId)}function Ap(e,t){let{feature:n,tickets:r,sessions:i,runs:a,gate:o}=e,s=i.find(e=>e.status===`live`),c=kp(i,`ideation`),l=r.length,u=r.filter(e=>e.status===`done`).length,d=r.filter(e=>e.status===`failed`).length,f=r.filter(e=>e.status!==`done`&&e.status!==`failed`&&e.status!==`cancelled`).length,p=hp(a),m=p?.status===`running`,h=Bd(n);if(n.status===`archived`)return{kick:`ARCHIVED`,title:`Feature archived`,desc:`This feature is archived and out of the pipeline. Unarchive it to pick the work back up.`,primary:{label:`Unarchive`,kind:`unarchive`},secondary:[],busy:!1};let g=!!o.next&&o.satisfied&&o.next.id!==`G3`&&o.next.id!==`G5`,_=h?`Promote to ${gp[h]}`:`Promote`;switch(n.phase){case`ideation`:return n.mapped?{kick:`MAP`,title:o.satisfied?`Converge the map`:`Work the frontier`,desc:o.satisfied?`Every waypoint is resolved — converge to draft the spec and tickets.`:o.reason??`Resolve the open waypoints; converge once the frontier clears.`,primary:s?{label:`Jump to grill`,kind:`openGrill`}:void 0,secondary:[],busy:!1}:g?{kick:`NEXT STEP`,title:`Promote the idea`,desc:`Decisions are captured — promote the idea when it feels concrete.`,primary:{label:_,kind:`advance`},secondary:s?[{label:`Back to grill`,kind:`openGrill`}]:[],busy:!1}:s?{kick:`GRILL LIVE`,title:`Grill session in progress`,desc:`Shape the idea with Claude — decisions accumulate in Knowledge.`,primary:{label:`Jump to grill`,kind:`openGrill`},secondary:[],busy:!1}:c?{kick:`NEXT STEP`,title:`Pick the conversation back up`,desc:`The grill session ended, but its conversation is still on disk — resume it to carry on where you left off.`,primary:{label:`Resume grill session`,kind:`startGrill`},secondary:[],busy:!1}:{kick:`NEXT STEP`,title:`Shape the idea with Claude`,desc:`Launch a grill session to shape the idea before any code is written.`,primary:{label:`Start grill session`,kind:`startGrill`},secondary:[],busy:!1};case`spec`:return g?{kick:`NEXT STEP`,title:`Approve the spec`,desc:`The spec is written — approve it to move into tickets.`,primary:{label:`Approve spec → tickets`,kind:`advance`},secondary:s?[{label:`Back to grill`,kind:`openGrill`}]:[],busy:!1}:s?{kick:`GRILL LIVE`,title:`Writing the spec`,desc:`The spec takes shape beside the conversation.`,primary:{label:`Jump to grill`,kind:`openGrill`},secondary:[],busy:!1}:{kick:`NEXT STEP`,title:`Write the spec`,desc:c?`No spec yet — resume the grill conversation to draft it.`:`No spec yet — open a grill session to draft it.`,primary:{label:c?`Resume grill`:`Open grill`,kind:`startGrill`},secondary:[],busy:!1};case`tickets`:return l>0?{kick:`NEXT STEP`,title:`Review & burn the tickets`,desc:`Each ticket is one atomic task Claude will implement. Review them, then burn.`,primary:{label:`Burn ${l} ticket${l===1?``:`s`}`,kind:`burn`},secondary:s?[{label:`Back to grill`,kind:`openGrill`}]:[{label:`Revisit`,kind:`revisit`}],busy:!1}:{kick:`WAITING`,title:`Waiting for tickets`,desc:`No tickets yet — a grill session emits them. Open a session to shape the work.`,primary:s?{label:`Jump to grill`,kind:`openGrill`}:{label:c?`Resume grill to emit tickets`:`Open grill to emit tickets`,kind:`startGrill`},secondary:[],busy:!1};case`implementation`:return m?{kick:`IN PROGRESS`,title:`Burning tickets`,desc:`Burning ${l} ticket${l===1?``:`s`} — ${u} done${d?`, ${d} failed`:``}.`,primary:{label:`Cancel run`,kind:`cancelRun`,danger:!0},secondary:[],busy:!0}:{kick:`NEXT STEP`,title:`Resume the burn`,desc:p?.status===`failed`?`The run failed — resume the burn to retry.`:p?.status===`cancelled`?`The run was cancelled — resume the burn to continue.`:`The burn has not started — resume to run the tickets.`,primary:{label:`Resume burn`,kind:`burn`},secondary:s?[]:[{label:`Revisit`,kind:`revisit`}],busy:!1};case`review`:{let e=t.driving?{label:`Stop test drive`,kind:`testDriveStop`}:{label:`Start test drive`,kind:`testDriveStart`},n=s?[]:[{label:`Iterate`,kind:`revisit`}];if(f>0)return{kick:`NEXT STEP`,title:`Burn the fix tickets`,desc:t.driving?`Test-driving the branch — burn the fix tickets when you’re ready.`:`${f} fix ticket${f===1?``:`s`} ready — burn to run them, then review again.`,primary:{label:`Burn ${f} ticket${f===1?``:`s`}`,kind:`burn`},secondary:[{label:`Merge & ship`,kind:`merge`},e,...n],busy:!1};let r=t.driving?`Test-driving the branch — merge when it looks right.`:d>0?`Run finished with ${d} failed ticket${d===1?``:`s`} — review, then ship.`:`Checks are in. Test-drive the branch, then merge to ship.`;return{kick:`NEXT STEP`,title:t.driving?`Merge when it looks right`:`Test drive, then ship`,desc:r,primary:{label:`Merge & ship`,kind:`merge`},secondary:[e,...n],busy:!1}}case`shipped`:return{kick:`SHIPPED`,title:`Shipped to main`,desc:`The branch is merged and the pipeline is complete. Ask a question anytime.`,primary:void 0,secondary:[{label:`Ask a question`,kind:`askQuestions`}],busy:!1}}}function jp({actions:e}){let[t,n]=(0,k.useState)(!1),r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{if(!t)return;let e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),e.length===0?null:(0,A.jsxs)(`div`,{className:`row-actions`,ref:r,children:[(0,A.jsx)(`button`,{className:`row-actions-btn`,"aria-label":`feature actions`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:e=>{e.stopPropagation(),n(e=>!e)},children:(0,A.jsx)(Ci,{size:14})}),t&&(0,A.jsx)(`div`,{className:`row-actions-menu`,role:`menu`,children:e.map(e=>(0,A.jsx)(`button`,{role:`menuitem`,className:`row-actions-item${e.danger?` is-danger`:``}`,onClick:t=>{t.stopPropagation(),n(!1),e.onSelect()},children:e.label},e.key))})]})}function Mp({title:e,slug:t,busy:n,onConfirm:r,onCancel:i}){let[a,o]=(0,k.useState)(``),s=a.trim()===t;return(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:i,children:(0,A.jsxs)(`div`,{className:`peek delete-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Delete feature ${t}`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`delete-dialog-title`,children:`Delete feature`}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:i,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`peek-body delete-dialog-body`,children:[(0,A.jsxs)(`p`,{className:`delete-dialog-lead`,children:[`Permanently delete `,(0,A.jsx)(`strong`,{children:e}),`? This stops any running agent, removes its worktree and branches, and erases all of its runcastle data. Committed docs stay in git history. `,(0,A.jsx)(`strong`,{children:`This cannot be undone.`})]}),(0,A.jsxs)(`label`,{className:`delete-dialog-field`,children:[(0,A.jsxs)(`span`,{children:[`Type `,(0,A.jsx)(`code`,{className:`mono`,children:t}),` to confirm`]}),(0,A.jsx)(`input`,{className:`settings-input mono`,value:a,onChange:e=>o(e.target.value),autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:t})]}),(0,A.jsxs)(`div`,{className:`delete-dialog-actions`,children:[(0,A.jsx)(P,{variant:`ghost`,onClick:i,disabled:n,children:`Cancel`}),(0,A.jsx)(P,{variant:`danger`,onClick:r,disabled:!s||n,children:n?`Deleting…`:`Delete feature`})]})]})]})})}var Np=`runcastle.sidebar.showArchived`;function Pp(){try{return localStorage.getItem(Np)===`1`}catch{return!1}}function Fp({projectId:e,selectedFeatureId:t,onSelect:n,onNewFeature:r}){let i=N.useUtils(),a=Ji(),[o,s]=(0,k.useState)(Pp),[c,l]=(0,k.useState)(null),u=N.feature.list.useQuery({projectId:e},{refetchInterval:1500}),d=bp(u.data??[],{showArchived:o}),f=(u.data??[]).filter(e=>e.status===`archived`).length,p=()=>void i.feature.list.invalidate(),m=N.feature.archive.useMutation({onSuccess:p,onError:e=>a.push(e.message)}),h=N.feature.unarchive.useMutation({onSuccess:p,onError:e=>a.push(e.message)}),g=N.feature.delete.useMutation({onSuccess:(e,r)=>{if(p(),r.featureId===t){let e=(u.data??[]).find(e=>e.id!==r.featureId);e&&n(e.id)}l(null)},onError:e=>a.push(e.message)}),_=()=>{s(e=>{let t=!e;try{localStorage.setItem(Np,t?`1`:`0`)}catch{}return t})},v=e=>{let t=e.status===`archived`?[{key:`unarchive`,label:`Unarchive`,onSelect:()=>h.mutate({featureId:e.id})}]:[{key:`archive`,label:`Archive`,onSelect:()=>m.mutate({featureId:e.id})}];return e.status!==`shipped`&&t.push({key:`delete`,label:`Delete…`,danger:!0,onSelect:()=>l(e)}),t};return(0,A.jsxs)(`nav`,{className:`sidebar`,children:[(0,A.jsxs)(`div`,{className:`sidebar-head`,children:[(0,A.jsx)(`span`,{className:`pane-title`,children:`Features`}),(0,A.jsxs)(`button`,{className:`new-btn`,onClick:r,children:[(0,A.jsx)(yi,{size:11}),`New`]})]}),(0,A.jsxs)(`div`,{className:`sidebar-list`,children:[u.isLoading&&(0,A.jsx)(`div`,{style:{padding:`10px 8px`},children:(0,A.jsx)(F,{children:`loading features…`})}),u.data&&u.data.length===0&&(0,A.jsxs)(`div`,{className:`sidebar-empty`,children:[`No features yet.`,(0,A.jsx)(`br`,{}),`Create one to start the pipeline.`]}),d.map(e=>(0,A.jsxs)(`div`,{className:`triage-group triage-${e.key}`,children:[(0,A.jsxs)(`div`,{className:`triage-label`,children:[(0,A.jsx)(`span`,{className:`triage-name`,children:e.label}),(0,A.jsx)(`span`,{className:`triage-count`,children:e.features.length})]}),e.features.map(e=>(0,A.jsx)(Ip,{f:e,active:e.id===t,onSelect:n,actions:v(e)},e.id))]},e.key)),f>0&&(0,A.jsxs)(`button`,{className:`show-archived-toggle`,onClick:_,children:[o?`Hide`:`Show`,` archived (`,f,`)`]})]}),c&&(0,A.jsx)(Mp,{title:c.title,slug:c.slug,busy:g.isPending,onConfirm:()=>g.mutate({featureId:c.id}),onCancel:()=>l(null)})]})}function Ip({f:e,active:t,onSelect:n,actions:r}){let i=mp(e),a=Sp(e),o=e.status===`shipped`||e.status===`archived`;return(0,A.jsxs)(`div`,{className:`feature-row${t?` is-active`:``}${o?` is-dim`:``}`,children:[(0,A.jsxs)(`button`,{className:`feature-row-main`,onClick:()=>n(e.id),title:`${e.title} — ${e.slug}`,children:[(0,A.jsx)(`span`,{className:`feature-dot phase-bg-${e.phase}`}),(0,A.jsx)(`span`,{className:`feature-slug`,children:e.title}),(0,A.jsx)(`span`,{className:`feature-flag`,children:e.activeRun?(0,A.jsx)(`span`,{className:`spin-ring`,title:`agent working`}):e.status===`shipped`?(0,A.jsx)(`span`,{className:`mini-check`,children:(0,A.jsx)(bi,{size:10})}):(0,A.jsxs)(A.Fragment,{children:[i&&(0,A.jsx)(`span`,{className:`needs-dot needs-${i.kind}`,title:i.label}),(0,A.jsx)(`span`,{className:`mini-map`,children:a.map((e,t)=>(0,A.jsx)(`span`,{className:`mini-seg is-${e.state}`},t))})]})})]}),(0,A.jsx)(jp,{actions:r})]})}function Lp(e){let[t,n]=(0,k.useState)([]),r=t.length?t[t.length-1].id:void 0,i=N.events.list.useQuery({featureId:e,afterId:r},{refetchInterval:1500});return(0,k.useEffect)(()=>{let e=i.data;!e||e.length===0||n(t=>{let n=new Set(t.map(e=>e.id)),r=e.filter(e=>!n.has(e.id));return r.length===0?t:[...t,...r].sort((e,t)=>e.id-t.id)})},[i.data]),t}function Rp(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function zp(e){return e.slice(0,7)}function Bp(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<5)return`now`;if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Vp(e,t){let n=Math.max(0,Math.floor((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60;return r>0?`${r}h ${String(i).padStart(2,`0`)}m`:i>0?`${i}m ${String(a).padStart(2,`0`)}s`:`${a}s`}function Hp({featureId:e,relPath:t,title:n,onClose:r}){let i=N.docs.read.useQuery({featureId:e,relPath:t});return(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:r,children:(0,A.jsxs)(`div`,{className:`peek`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`mono peek-path`,children:t}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:r,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`peek-body mono`,children:[i.isLoading&&(0,A.jsxs)(F,{children:[`loading `,n,`…`]}),i.error&&(0,A.jsxs)(F,{children:[`could not read `,t,`: `,i.error.message]}),i.data&&(0,A.jsx)(`pre`,{className:`peek-pre`,children:i.data.content})]})]})})}function Up({featureId:e}){let[t,n]=(0,k.useState)(`details`),r=N.feature.get.useQuery({id:e},{refetchInterval:1500});return r.isLoading?(0,A.jsx)(`aside`,{className:`inspector`,children:(0,A.jsx)(F,{children:`loading…`})}):r.data?(0,A.jsxs)(`aside`,{className:`inspector`,children:[(0,A.jsxs)(`div`,{className:`insp-tabs`,role:`tablist`,children:[(0,A.jsx)(`button`,{role:`tab`,"aria-selected":t===`details`,className:`insp-tab${t===`details`?` is-active`:``}`,onClick:()=>n(`details`),children:`Details`}),(0,A.jsx)(`button`,{role:`tab`,"aria-selected":t===`activity`,className:`insp-tab${t===`activity`?` is-active`:``}`,onClick:()=>n(`activity`),children:`Activity`})]}),t===`details`?(0,A.jsxs)(`div`,{className:`insp-pane`,children:[(0,A.jsx)(Kp,{featureId:e,gate:r.data.gate}),(0,A.jsx)(Yp,{featureId:e,docs:r.data.docs})]},`details`):(0,A.jsx)(`div`,{className:`insp-pane insp-pane-activity`,children:(0,A.jsx)(Qp,{featureId:e})},`activity`)]}):(0,A.jsx)(`aside`,{className:`inspector`,children:(0,A.jsx)(F,{children:r.error?.message??`could not load inspector`})})}var Wp={G1:`Decisions captured`,G2:`Spec written`,G3:`Tickets approved`,G4:`Run clean`,G5:`Merged`};function Gp(e){return e.check===`all-waypoints-terminal`?`Waypoints resolved`:Wp[e.id]??e.id}function Kp({featureId:e,gate:t}){let n=Ji(),r=N.useUtils(),[i,a]=(0,k.useState)(!1),[o,s]=(0,k.useState)(``),c=N.feature.overrideGate.useMutation({onSuccess:()=>{s(``),a(!1),r.feature.get.invalidate({id:e}),r.feature.list.invalidate()},onError:e=>n.push(e.message)});return(0,A.jsxs)(`section`,{className:`insp-section`,children:[(0,A.jsx)(`div`,{className:`insp-cap`,children:`Current gate`}),t.next===null?(0,A.jsxs)(`div`,{className:`gate-shipped`,children:[(0,A.jsx)(bi,{size:13}),`Shipped — no gates left.`]}):(0,A.jsx)(qp,{gateId:t.next.id,name:Gp(t.next),description:t.next.description,satisfied:t.satisfied,reason:t.reason,open:i,reasonValue:o,pending:c.isPending,onOpen:()=>a(!0),onCancel:()=>{a(!1),s(``)},onReasonChange:s,onApply:()=>c.mutate({featureId:e,gate:t.next.id,reason:o.trim()})})]})}function qp({gateId:e,name:t,description:n,satisfied:r,reason:i,open:a,reasonValue:o,pending:s,onOpen:c,onCancel:l,onReasonChange:u,onApply:d}){return(0,A.jsxs)(`div`,{className:`gate-card`,children:[(0,A.jsxs)(`div`,{className:`gate-idrow`,children:[(0,A.jsx)(`span`,{className:`gate-id`,children:e}),(0,A.jsx)(`span`,{className:`gate-name`,children:t})]}),(0,A.jsx)(`div`,{className:`gate-req`,children:n}),(0,A.jsxs)(`div`,{className:`gate-state ${r?`is-ok`:`is-block`}`,children:[(0,A.jsx)(`span`,{className:`gate-state-dot`}),(0,A.jsx)(`span`,{children:r?`Ready to advance`:i??`Blocked`})]}),a?(0,A.jsxs)(`div`,{className:`override-form`,children:[(0,A.jsx)(`input`,{className:`override-input`,placeholder:`Reason for override`,value:o,autoFocus:!0,onChange:e=>u(e.target.value)}),(0,A.jsxs)(`div`,{className:`override-actions`,children:[(0,A.jsx)(P,{variant:`solid`,className:`btn-xs`,disabled:!o.trim()||s,onClick:d,children:`Apply`}),(0,A.jsx)(P,{variant:`ghost`,className:`btn-xs`,onClick:l,children:`Cancel`})]})]}):(0,A.jsx)(`button`,{className:`gate-override-link`,onClick:c,children:`Override with reason…`})]})}function Jp(e){return e.split(/[\\/]/).pop()??e}function Yp({featureId:e,docs:t}){let[n,r]=(0,k.useState)(null);return(0,A.jsxs)(`section`,{className:`insp-section`,children:[(0,A.jsx)(`div`,{className:`insp-cap`,children:`Knowledge`}),t.length===0?(0,A.jsx)(`div`,{className:`insp-empty`,children:`Docs the sessions write — decisions, the spec, the map — collect here.`}):(0,A.jsx)(`ul`,{className:`doc-list`,children:t.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{className:`doc-link`,onClick:()=>r({relPath:e.relPath,title:e.title}),children:[(0,A.jsx)(`span`,{className:`doc-link-icon`,children:(0,A.jsx)(Ti,{size:13})}),(0,A.jsx)(`span`,{className:`doc-title`,children:e.title}),(0,A.jsx)(`span`,{className:`doc-meta`,children:Jp(e.relPath)})]})},e.relPath))}),n&&(0,A.jsx)(Hp,{featureId:e,relPath:n.relPath,title:n.title,onClose:()=>r(null)})]})}function Xp(e){return e.includes(`failed`)||e.includes(`error`)||e.includes(`blocked`)?`is-danger`:e.includes(`done`)||e.includes(`shipped`)||e.includes(`merged`)?`is-ok`:e.startsWith(`phase`)||e.startsWith(`gate`)?`is-accent`:``}function Zp(e){return e.replace(/_/g,` `).replace(`.`,` · `)}function Qp({featureId:e}){let t=Lp(e).slice(-50).reverse();return(0,A.jsx)(`section`,{className:`insp-section`,children:t.length===0?(0,A.jsx)(`div`,{className:`insp-empty`,children:`Everything that happens to this feature shows up here.`}):(0,A.jsx)(`div`,{className:`activity-log`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`act-line`,children:[(0,A.jsx)(`span`,{className:`act-dot ${Xp(e.type)}`}),(0,A.jsxs)(`div`,{className:`act-body`,children:[(0,A.jsx)(`div`,{className:`act-msg`,children:e.message}),(0,A.jsxs)(`div`,{className:`act-sub`,children:[(0,A.jsx)(`span`,{className:`act-type`,children:Zp(e.type)}),(0,A.jsx)(`span`,{className:`act-time`,children:Bp(e.ts)})]})]})]},e.id))})})}function $p(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.status!=`string`||typeof t.summary!=`string`||t.status!==`succeeded`&&t.status!==`failed`&&t.status!==`cancelled`?null:{status:t.status,summary:t.summary}}function em(e){let t=e.split(`
73
+ `)[0].trim();return t.length>140?`${t.slice(0,139)}…`:t}function tm(e,t){if(e.type!==`run.finished`)return null;let n=$p(e.data);if(!n)return null;let r=t??`your feature`;return n.status===`succeeded`?{title:`Burn complete — review is ready`,body:r}:n.status===`failed`?{title:`Burn failed`,body:`${r}: ${em(n.summary)}`}:null}var nm=`runcastle:notifications`,rm=typeof Notification<`u`;function im(){try{return localStorage.getItem(nm)===`on`}catch{return!1}}function am(e){try{localStorage.setItem(nm,e?`on`:`off`)}catch{}}function om({title:e,body:t}){try{let n=new Notification(e,{body:t});n.onclick=()=>{window.focus(),n.close()}}catch{}}function sm(e,t){let[n,r]=(0,k.useState)(()=>rm&&im()),[i,a]=(0,k.useState)(void 0),o=(0,k.useRef)(!1),s=(0,k.useRef)(new Map);s.current=new Map(t.map(e=>[e.id,e.title]));let c=N.events.listByProject.useQuery({projectId:e,afterId:i},{refetchInterval:1500,enabled:rm&&n});return(0,k.useEffect)(()=>{let e=c.data;if(!e||e.length===0)return;let t=e[e.length-1].id,n=document.hidden||!document.hasFocus();if(o.current&&Notification.permission===`granted`&&n)for(let t of e){let e=tm(t,t.featureId?s.current.get(t.featureId):void 0);e&&om(e)}o.current=!0,a(t)},[c.data]),{supported:rm,enabled:n,toggle:(0,k.useCallback)(()=>{if(rm){if(n){r(!1),am(!1);return}o.current=!1,a(void 0),r(!0),am(!0),Notification.permission==="default"&&Notification.requestPermission().then(e=>{e!==`granted`&&(r(!1),am(!1))})}},[n])}}var cm=`docker`,lm=4512;function um({projectId:e,activeFeatureId:t,driving:n,onDriveChange:r}){let i=Ji(),a=N.useUtils(),o=N.feature.list.useQuery({projectId:e},{refetchInterval:1500}),s=!o.isError&&o.data!==void 0,c=o.data?.find(e=>e.id===t),l=o.data?.filter(e=>e.activeRun).length??0,u=sm(e,o.data??[]),d=N.feature.testDrive.useMutation({onSuccess:()=>{r(null),n&&a.feature.get.invalidate({id:n.featureId}),a.feature.list.invalidate()},onError:e=>i.push(e.message)});return(0,A.jsxs)(`footer`,{className:`statusbar`,children:[c&&(0,A.jsxs)(`button`,{className:`sb-branch`,onClick:()=>{c&&navigator.clipboard.writeText(c.branch).then(()=>i.push(`copied ${c.branch}`,`info`),()=>i.push(`copy failed`))},title:`Copy branch name`,children:[(0,A.jsx)(gi,{size:11}),c.branch]}),(0,A.jsxs)(`span`,{className:`sb-item`,title:`Agent sessions run sandboxed via ${cm}`,children:[(0,A.jsx)(Di,{size:11}),cm]}),n&&(0,A.jsxs)(`span`,{className:`sb-driving`,children:[(0,A.jsx)(`span`,{className:`sb-driving-dot`}),`driving `,(0,A.jsx)(`span`,{className:`mono`,children:n.branch}),(0,A.jsx)(`button`,{className:`sb-stop`,disabled:d.isPending,onClick:()=>d.mutate({featureId:n.featureId,action:`stop`}),children:`stop`})]}),(0,A.jsx)(`span`,{className:`sb-spacer`}),u.supported&&(0,A.jsxs)(`button`,{className:`sb-notify${u.enabled?` is-on`:``}`,onClick:u.toggle,title:u.enabled?`Desktop notifications on — click to disable`:`Notify me when a burn finishes`,children:[u.enabled?(0,A.jsx)(_i,{size:12}):(0,A.jsx)(vi,{size:12}),`notify`]}),(0,A.jsxs)(`span`,{className:`sb-item`,children:[l,` run`,l===1?``:`s`]}),(0,A.jsxs)(`span`,{className:`sb-item sb-health ${s?`is-ok`:`is-down`}`,children:[(0,A.jsx)(`span`,{className:`health-dot`}),`:`,lm,` `,s?`ok`:`down`]})]})}function dm({featureId:e,sessionId:t}){let n=N.useUtils(),r=Ji(),i=N.feature.endSession.useMutation({onSuccess:()=>{n.feature.get.invalidate({id:e}),n.feature.list.invalidate(),r.push(`session ended`,`info`)},onError:e=>r.push(e.message)});return(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost sess-end`,disabled:i.isPending,title:`end this session — recoverable, you can relaunch it`,onClick:()=>i.mutate({sessionId:t}),children:i.isPending?`Ending…`:`End session`})}var fm=class extends k.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[runcastle] boundary caught`,e,t)}render(){return this.state.error?(0,A.jsx)(`div`,{className:`boundary-fallback`,children:(0,A.jsxs)(`span`,{className:`dim-line mono`,children:[this.props.label??`component`,` failed: `,this.state.error.message]})}):this.props.children}},pm=2,mm=1,hm=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(){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:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(pm,Math.floor(u/e.css.cell.width)),rows:Math.max(mm,Math.floor(l/e.css.cell.height))}}},gm=Object.defineProperty,_m=Object.getOwnPropertyDescriptor,vm=(e,t)=>{for(var n in t)gm(e,n,{get:t[n],enumerable:!0})},ym=(e,t,n,r)=>{for(var i=r>1?void 0:r?_m(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&gm(t,n,i),i},J=(e,t)=>(n,r)=>t(n,r,e),bm=`Terminal input`,xm={get:()=>bm,set:e=>bm=e},Sm=`Too much output to announce, navigate to rows manually to read`,Cm={get:()=>Sm,set:e=>Sm=e};function wm(e){return e.replace(/\r?\n/g,`\r`)}function Tm(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Em(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function Dm(e,t,n,r){e.stopPropagation(),e.clipboardData&&Om(e.clipboardData.getData(`text/plain`),t,n,r)}function Om(e,t,n,r){e=wm(e),e=Tm(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function km(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function Am(e,t,n,r,i){km(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function jm(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Mm(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Nm=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Pm=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Fm=``,Im=` `,Lm=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Rm}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;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}},Rm=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},zm=class e extends Lm{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Rm,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?jm(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Bm=`di$target`,Vm=`di$dependencies`,Hm=new Map;function Um(e){return e[Vm]||[]}function Wm(e){if(Hm.has(e))return Hm.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Gm(t,e,r)};return t._id=e,Hm.set(e,t),t}function Gm(e,t,n){t[Bm]===t?t[Vm].push({id:e,index:n}):(t[Vm]=[{id:e,index:n}],t[Bm]=t)}var Km=Wm(`BufferService`),qm=Wm(`CoreMouseService`),Jm=Wm(`CoreService`),Ym=Wm(`CharsetService`),Xm=Wm(`InstantiationService`),Zm=Wm(`LogService`),Qm=Wm(`OptionsService`),$m=Wm(`OscLinkService`),eh=Wm(`UnicodeService`),th=Wm(`DecorationService`),nh=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new zm,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):rh(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};nh=ym([J(0,Km),J(1,Qm),J(2,$m)],nh);function rh(e,t){if(confirm(`Do you want to navigate to ${t}?
74
74
 
75
- WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var rh=Um(`CharSizeService`),ih=Um(`CoreBrowserService`),ah=Um(`MouseService`),oh=Um(`RenderService`),sh=Um(`SelectionService`),ch=Um(`CharacterJoinerService`),lh=Um(`ThemeService`),uh=Um(`LinkProviderService`),dh=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?_h.isErrorNoTelemetry(e)?new _h(e.message+`
75
+ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var ih=Wm(`CharSizeService`),ah=Wm(`CoreBrowserService`),oh=Wm(`MouseService`),sh=Wm(`RenderService`),ch=Wm(`SelectionService`),lh=Wm(`CharacterJoinerService`),uh=Wm(`ThemeService`),dh=Wm(`LinkProviderService`),fh=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?vh.isErrorNoTelemetry(e)?new vh(e.message+`
76
76
 
77
77
  `+e.stack):Error(e.message+`
78
78
 
79
- `+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)}};function fh(e){mh(e)||dh.onUnexpectedError(e)}var ph=`Canceled`;function mh(e){return e instanceof hh||e instanceof Error&&e.name===ph&&e.message===ph}var hh=class extends Error{constructor(){super(ph),this.name=this.message}};function gh(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var _h=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},vh=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function yh(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var bh=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=yh(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};bh.assertInvariants=!1;function xh(e,t=0){return e[e.length-(1+t)]}var Sh;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Sh||={});function Ch(e,t){return(n,r)=>t(e(n),e(r))}var wh=(e,t)=>e-t,Th=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Sh.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Th.empty=new Th(e=>{});function Eh(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Dh=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function Oh(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var kh;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(kh||={});var Ah=null,jh=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
80
- `).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Dh;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
81
- `),e)}n.sort(Ch(e=>e.idx,wh));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
82
- `)).size}/${n.length} leaks) at ${a}`;let o=Eh([...i.get(e.slice(0,t).join(`
79
+ `+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)}};function ph(e){hh(e)||fh.onUnexpectedError(e)}var mh=`Canceled`;function hh(e){return e instanceof gh||e instanceof Error&&e.name===mh&&e.message===mh}var gh=class extends Error{constructor(){super(mh),this.name=this.message}};function _h(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var vh=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},yh=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function bh(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var xh=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=bh(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};xh.assertInvariants=!1;function Sh(e,t=0){return e[e.length-(1+t)]}var Ch;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ch||={});function wh(e,t){return(n,r)=>t(e(n),e(r))}var Th=(e,t)=>e-t,Eh=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Ch.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Eh.empty=new Eh(e=>{});function Dh(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Oh=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function kh(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Ah;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(Ah||={});var jh=null,Mh=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
80
+ `).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Oh;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
81
+ `),e)}n.sort(wh(e=>e.idx,Th));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
82
+ `)).size}/${n.length} leaks) at ${a}`;let o=Dh([...i.get(e.slice(0,t).join(`
83
83
  `))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
84
84
 
85
85
 
@@ -93,18 +93,18 @@ ${s.join(`
93
93
 
94
94
  ... and ${n.length-e} more leaking disposables
95
95
 
96
- `),{leaks:n,details:a}}};jh.idx=0;function Mh(e){return Ah?.trackDisposable(e),e}function Nh(e){Ah?.markAsDisposed(e)}function Ph(e,t){Ah?.setParent(e,t)}function Fh(e){return Ah?.markAsSingleton(e),e}function Ih(e){if(kh.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Lh(...e){return Rh(()=>Ih(e))}function Rh(e){let t=Mh({dispose:Oh(()=>{Nh(t),e()})});return t}var zh=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Mh(this)}dispose(){this._isDisposed||(Nh(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ih(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Ph(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Ph(e,null))}};zh.DISABLE_DISPOSED_WARNING=!1;var Bh=zh,Y=class{constructor(){this._store=new Bh,Mh(this),Ph(this._store,this)}dispose(){Nh(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Y.None=Object.freeze({dispose(){}});var Vh=class{constructor(){this._isDisposed=!1,Mh(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ph(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Nh(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ph(e,null),e}},Hh=typeof window==`object`?window:globalThis,Uh=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Uh.Undefined=new Uh(void 0);var Wh=Uh,Gh=class{constructor(){this._first=Wh.Undefined,this._last=Wh.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Wh.Undefined}clear(){let e=this._first;for(;e!==Wh.Undefined;){let t=e.next;e.prev=Wh.Undefined,e.next=Wh.Undefined,e=t}this._first=Wh.Undefined,this._last=Wh.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Wh(e);if(this._first===Wh.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Wh.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Wh.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Wh.Undefined&&e.next!==Wh.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Wh.Undefined&&e.next===Wh.Undefined?(this._first=Wh.Undefined,this._last=Wh.Undefined):e.next===Wh.Undefined?(this._last=this._last.prev,this._last.next=Wh.Undefined):e.prev===Wh.Undefined&&(this._first=this._first.next,this._first.prev=Wh.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==Wh.Undefined;)yield e.element,e=e.next}},Kh=globalThis.performance&&typeof globalThis.performance.now==`function`,qh=class e{static create(t){return new e(t)}constructor(e){this._now=Kh&&e===!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._now()-this._startTime:this._stopTime-this._startTime}},Jh;(e=>{e.None=()=>Y.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(Lh(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new X({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new X({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new X({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new X;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function ee(e,t){return e(e=>t.fire(e))}e.forward=ee;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new X(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(e,t){return new w(e,t).emitter.event}e.fromObservable=te;function ne(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Bh?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=ne})(Jh||={});var Yh=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new qh,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Yh.all=new Set,Yh._idPool=0;var Xh=Yh,Zh=-1,Qh=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new tg(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};Qh._idPool=1;var $h=Qh,eg=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
96
+ `),{leaks:n,details:a}}};Mh.idx=0;function Nh(e){return jh?.trackDisposable(e),e}function Ph(e){jh?.markAsDisposed(e)}function Fh(e,t){jh?.setParent(e,t)}function Ih(e){return jh?.markAsSingleton(e),e}function Lh(e){if(Ah.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Rh(...e){return zh(()=>Lh(e))}function zh(e){let t=Nh({dispose:kh(()=>{Ph(t),e()})});return t}var Bh=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Nh(this)}dispose(){this._isDisposed||(Ph(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Lh(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Fh(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Fh(e,null))}};Bh.DISABLE_DISPOSED_WARNING=!1;var Vh=Bh,Y=class{constructor(){this._store=new Vh,Nh(this),Fh(this._store,this)}dispose(){Ph(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Y.None=Object.freeze({dispose(){}});var Hh=class{constructor(){this._isDisposed=!1,Nh(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Fh(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Ph(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Fh(e,null),e}},Uh=typeof window==`object`?window:globalThis,Wh=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Wh.Undefined=new Wh(void 0);var Gh=Wh,Kh=class{constructor(){this._first=Gh.Undefined,this._last=Gh.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Gh.Undefined}clear(){let e=this._first;for(;e!==Gh.Undefined;){let t=e.next;e.prev=Gh.Undefined,e.next=Gh.Undefined,e=t}this._first=Gh.Undefined,this._last=Gh.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Gh(e);if(this._first===Gh.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Gh.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Gh.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Gh.Undefined&&e.next!==Gh.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Gh.Undefined&&e.next===Gh.Undefined?(this._first=Gh.Undefined,this._last=Gh.Undefined):e.next===Gh.Undefined?(this._last=this._last.prev,this._last.next=Gh.Undefined):e.prev===Gh.Undefined&&(this._first=this._first.next,this._first.prev=Gh.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==Gh.Undefined;)yield e.element,e=e.next}},qh=globalThis.performance&&typeof globalThis.performance.now==`function`,Jh=class e{static create(t){return new e(t)}constructor(e){this._now=qh&&e===!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._now()-this._startTime:this._stopTime-this._startTime}},Yh;(e=>{e.None=()=>Y.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(Rh(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new X({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new X({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new X({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new X({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new X;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function ee(e,t){return e(e=>t.fire(e))}e.forward=ee;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class te{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new X(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ne(e,t){return new te(e,t).emitter.event}e.fromObservable=ne;function w(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Vh?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=w})(Yh||={});var Xh=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Jh,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Xh.all=new Set,Xh._idPool=0;var Zh=Xh,Qh=-1,$h=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new ng(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};$h._idPool=1;var eg=$h,tg=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
97
97
  `).slice(2).join(`
98
- `))}},tg=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},ng=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},rg=0,ig=class{constructor(e){this.value=e,this.id=rg++}},ag=2,og,X=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Zh>0||this._options?.leakWarningThreshold?new $h(e?.onListenerError??fh,this._options?.leakWarningThreshold??Zh):void 0,this._perfMon=this._options?._profName?new Xh(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new ng(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||fh)(n),Y.None}if(this._disposed)return Y.None;t&&(e=e.bind(t));let r=new ig(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=eg.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ig?(this._deliveryQueue??=new sg,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Rh(()=>{og?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Bh?n.add(a):Array.isArray(n)&&n.push(a),og){let e=Error().stack.split(`
98
+ `))}},ng=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},rg=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},ig=0,ag=class{constructor(e){this.value=e,this.id=ig++}},og=2,sg,X=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Qh>0||this._options?.leakWarningThreshold?new eg(e?.onListenerError??ph,this._options?.leakWarningThreshold??Qh):void 0,this._perfMon=this._options?._profName?new Zh(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new rg(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||ph)(n),Y.None}if(this._disposed)return Y.None;t&&(e=e.bind(t));let r=new ag(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=tg.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ag?(this._deliveryQueue??=new cg,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=zh(()=>{sg?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Vh?n.add(a):Array.isArray(n)&&n.push(a),sg){let e=Error().stack.split(`
99
99
  `).slice(2,3).join(`
100
- `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);og.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ag<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||fh;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ig)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},sg=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},cg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new X,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new X,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};cg.INSTANCE=new cg;var lg=cg;function ug(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}lg.INSTANCE.onDidChangeZoomLevel;function dg(e){return lg.INSTANCE.getZoomFactor(e)}lg.INSTANCE.onDidChangeFullscreen;var fg=typeof navigator==`object`?navigator.userAgent:``,pg=fg.indexOf(`Firefox`)>=0,mg=fg.indexOf(`AppleWebKit`)>=0,hg=fg.indexOf(`Chrome`)>=0,gg=!hg&&fg.indexOf(`Safari`)>=0;fg.indexOf(`Electron/`),fg.indexOf(`Android`);var _g=!1;if(typeof Hh.matchMedia==`function`){let e=Hh.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Hh.matchMedia(`(display-mode: fullscreen)`);_g=e.matches,ug(Hh,e,({matches:e})=>{_g&&t.matches||(_g=e)})}function vg(){return _g}var yg=`en`,bg=!1,xg=!1,Sg=!1,Cg=!1,wg=!1,Tg=yg,Eg,Dg=globalThis,Og;typeof Dg.vscode<`u`&&typeof Dg.vscode.process<`u`?Og=Dg.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Og=process);var kg=typeof Og?.versions?.electron==`string`&&Og?.type===`renderer`;if(typeof Og==`object`){bg=Og.platform===`win32`,xg=Og.platform===`darwin`,Sg=Og.platform===`linux`,Sg&&Og.env.SNAP&&Og.env.SNAP_REVISION,Og.env.CI||Og.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Tg=yg;let e=Og.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Tg=t.resolvedLanguage||yg,t.languagePack?.translationsConfigFile}catch{}Cg=!0}else typeof navigator==`object`&&!kg?(Eg=navigator.userAgent,bg=Eg.indexOf(`Windows`)>=0,xg=Eg.indexOf(`Macintosh`)>=0,(Eg.indexOf(`Macintosh`)>=0||Eg.indexOf(`iPad`)>=0||Eg.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Sg=Eg.indexOf(`Linux`)>=0,Eg?.indexOf(`Mobi`),wg=!0,Tg=globalThis._VSCODE_NLS_LANGUAGE||yg,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var Ag=bg,jg=xg,Mg=Sg,Ng=Cg;wg&&typeof Dg.importScripts==`function`&&Dg.origin;var Pg=Eg,Fg=Tg,Ig;(e=>{function t(){return Fg}e.value=t;function n(){return Fg.length===2?Fg===`en`:Fg.length>=3&&Fg[0]===`e`&&Fg[1]===`n`&&Fg[2]===`-`}e.isDefaultVariant=n;function r(){return Fg===`en`}e.isDefault=r})(Ig||={});var Lg=typeof Dg.postMessage==`function`&&!Dg.importScripts;(()=>{if(Lg){let e=[];Dg.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Dg.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Rg=!!(Pg&&Pg.indexOf(`Chrome`)>=0);Pg&&Pg.indexOf(`Firefox`),!Rg&&Pg&&Pg.indexOf(`Safari`),Pg&&Pg.indexOf(`Edg/`),Pg&&Pg.indexOf(`Android`);var zg=typeof navigator==`object`?navigator:{};Ng||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||zg&&zg.clipboard&&zg.clipboard.writeText,Ng||zg&&zg.clipboard&&zg.clipboard.readText,Ng||vg()||zg.keyboard,`ontouchstart`in Hh||zg.maxTouchPoints,Hh.PointerEvent&&(`ontouchstart`in Hh||navigator.maxTouchPoints);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}},Vg=new Bg,Hg=new Bg,Ug=new Bg,Wg=Array(230),Gg;(e=>{function t(e){return Vg.keyCodeToStr(e)}e.toString=t;function n(e){return Vg.strToKeyCode(e)}e.fromString=n;function r(e){return Hg.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Ug.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Hg.strToKeyCode(e)||Ug.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Vg.keyCodeToStr(e)}e.toElectronAccelerator=o})(Gg||={});var Kg=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new qg([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},qg=class{constructor(e){if(e.length===0)throw gh(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;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 Jg(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Gg.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(pg)switch(t){case 59:return 85;case 60:if(Mg)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(jg)return 57;break}else if(mg&&(jg&&t===93||!jg&&t===92))return 57;return Wg[t]||0}var Yg=jg?256:2048,Xg=512,Zg=1024,Qg=jg?2048:256,$g=class{constructor(e){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=t.getModifierState?.(`AltGraph`),this.keyCode=Jg(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|=Yg),this.altKey&&(t|=Xg),this.shiftKey&&(t|=Zg),this.metaKey&&(t|=Qg),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Kg(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},e_=new WeakMap;function t_(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var n_=class{static getSameOriginWindowChain(e){let t=e_.get(e);if(!t){t=[],e_.set(e,t);let n=e,r;do r=t_(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},r_=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 n=n_.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},i_=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(hg){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?pg&&!jg?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)gg&&Ag?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?pg&&!jg?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},a_=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),o_;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof s_?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Jh.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:a_})})(o_||={});var s_=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?a_:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},c_=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 vh(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new vh(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},l_=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new vh(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Rh(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var u_;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(u_||={});var d_=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new X,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Jh.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};d_.EMPTY=d_.fromArray([]);function f_(e){return 55296<=e&&e<=56319}function p_(e){return 56320<=e&&e<=57343}function m_(e,t){return(e-55296<<10)+(t-56320)+65536}function h_(e){return g_(e,0)}function g_(e,t){switch(typeof e){case`object`:return e===null?__(349,t):Array.isArray(e)?b_(e,t):x_(e,t);case`string`:return y_(e,t);case`boolean`:return v_(e,t);case`number`:return __(e,t);case`undefined`:return __(937,t);default:return __(617,t)}}function __(e,t){return(t<<5)-t+e|0}function v_(e,t){return __(e?433:863,t)}function y_(e,t){t=__(149417,t);for(let n=0,r=e.length;n<r;n++)t=__(e.charCodeAt(n),t);return t}function b_(e,t){return t=__(104579,t),e.reduce((e,t)=>g_(t,e),t)}function x_(e,t){return t=__(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=y_(n,t),g_(e[n],t)),t)}function S_(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function C_(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function w_(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function T_(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):w_((e>>>0).toString(16),t/4)}var E_=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(f_(a))if(o+1<t){let t=e.charCodeAt(o+1);p_(t)?(o++,s=m_(a,t)):s=65533}else{i=a;break}else p_(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),T_(this._h0)+T_(this._h1)+T_(this._h2)+T_(this._h3)+T_(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,C_(this._buff,this._buffLen),this._buffLen>56&&(this._step(),C_(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,S_(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=S_(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=S_(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};E_._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:D_,getWindow:O_,getDocument:k_,getWindows:A_,getWindowsCount:j_,getWindowId:M_,getWindowById:N_,hasWindow:P_,onDidRegisterWindow:F_,onWillUnregisterWindow:I_,onDidUnregisterWindow:L_}=function(){let e=new Map,t={window:Hh,disposables:new Bh};e.set(Hh.vscodeWindowId,t);let n=new X,r=new X,i=new X;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Y.None;let a=new Bh,o={window:t,disposables:a.add(new Bh)};return e.set(t.vscodeWindowId,o),a.add(Rh(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Z(t,q_.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:Hh},getDocument(e){return O_(e).document}}}(),R_=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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,null)}};function Z(e,t,n,r){return new R_(e,t,n,r)}function z_(e,t){return function(n){return t(new r_(e,n))}}function B_(e){return function(t){return e(new $g(t))}}var V_=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=z_(O_(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=B_(n)),Z(e,t,i,r)},H_,U_=class extends l_{constructor(e){super(),this.defaultTarget=e&&O_(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},W_=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){fh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(W_.sort),a.shift().execute();r.set(i,!1)};H_=(t,r,a=0)=>{let o=M_(t),s=new W_(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var G_=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};G_.None=new G_(0,0);function K_(e){let t=e.getBoundingClientRect(),n=O_(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=h_(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Rh(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var q_={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:mg?`webkitAnimationStart`:`animationstart`,ANIMATION_END:mg?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:mg?`webkitAnimationIteration`:`animationiteration`},J_=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Y_(e,t,n,...r){let i=J_.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function X_(e,t,...n){return Y_(`http://www.w3.org/1999/xhtml`,e,t,...n)}X_.SVG=function(e,t,...n){return Y_(`http://www.w3.org/2000/svg`,e,t,...n)};var Z_=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=Q_(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Q_(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Q_(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Q_(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Q_(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Q_(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Q_(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Q_(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Q_(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Q_(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Q_(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=Q_(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=Q_(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Q_(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 Q_(e){return typeof e==`number`?`${e}px`:e}function $_(e){return new Z_(e)}var ev=class{constructor(){this._hooks=new Bh,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(Rh(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=O_(e)}this._hooks.add(Z(a,q_.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(Z(a,q_.POINTER_UP,e=>this.stopMonitoring(!0)))}};function tv(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var nv;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(nv||={});var rv=class e extends Y{constructor(){super(),this.dispatched=!1,this.targets=new Gh,this.ignoreTargets=new Gh,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Jh.runAndSubscribe(F_,({window:e,disposables:t})=>{t.add(Z(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(Z(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(Z(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:Hh,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Fh(new e),Rh(e.INSTANCE.targets.push(t))):Y.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Fh(new e),Rh(e.INSTANCE.ignoreTargets.push(t))):Y.None}static isTouchDevice(){return`ontouchstart`in Hh||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(nv.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-xh(s.rollingPageX))<30&&Math.abs(s.initialPageY-xh(s.rollingPageY))<30){let e=this.newGestureEvent(nv.Tap,s.initialTarget);e.pageX=xh(s.rollingPageX),e.pageY=xh(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-xh(s.rollingPageX))<30&&Math.abs(s.initialPageY-xh(s.rollingPageY))<30){let e=this.newGestureEvent(nv.Contextmenu,s.initialTarget);e.pageX=xh(s.rollingPageX),e.pageY=xh(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=xh(s.rollingPageX),n=xh(s.rollingPageY),i=xh(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(nv.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===nv.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===nv.Change||t.type===nv.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=H_(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(nv.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(nv.Change,i.initialTarget);a.translationX=r.pageX-xh(i.rollingPageX),a.translationY=r.pageY-xh(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};rv.SCROLL_FRICTION=-.005,rv.HOLD_DELAY=700,rv.CLEAR_TAP_COUNT_TIME=400,vm([tv],rv,`isTouchDevice`,1);var iv=rv,av=class extends Y{onclick(e,t){this._register(Z(e,q_.CLICK,n=>t(new r_(O_(e),n))))}onmousedown(e,t){this._register(Z(e,q_.MOUSE_DOWN,n=>t(new r_(O_(e),n))))}onmouseover(e,t){this._register(Z(e,q_.MOUSE_OVER,n=>t(new r_(O_(e),n))))}onmouseleave(e,t){this._register(Z(e,q_.MOUSE_LEAVE,n=>t(new r_(O_(e),n))))}onkeydown(e,t){this._register(Z(e,q_.KEY_DOWN,e=>t(new $g(e))))}onkeyup(e,t){this._register(Z(e,q_.KEY_UP,e=>t(new $g(e))))}oninput(e,t){this._register(Z(e,q_.INPUT,t))}onblur(e,t){this._register(Z(e,q_.BLUR,t))}onfocus(e,t){this._register(Z(e,q_.FOCUS,t))}onchange(e,t){this._register(Z(e,q_.CHANGE,t))}ignoreGesture(e){return iv.ignoreTarget(e)}},ov=11,sv=class extends av{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=ov+`px`,this.domNode.style.height=ov+`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 ev),this._register(V_(this.bgDomNode,q_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(V_(this.domNode,q_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new U_),this._pointerdownScheduleRepeatTimer=this._register(new c_)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,O_(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},cv=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(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(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},lv=class extends Y{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new cv(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.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(),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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new pv(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=pv.start(this._state,t,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},uv=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function dv(e,t){let n=t-e;return function(t){return e+n*hv(t)}}function fv(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var pv=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,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(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),fv(dv(e,r),dv(i,t),.33)}return dv(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new uv(this.scrollLeft(t),this.scrollTop(t),!1):new uv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function mv(e){return e**3}function hv(e){return 1-mv(1-e)}var gv=class extends Y{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new c_)}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||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(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},_v=140,vv=class extends av{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 gv(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ev),this._shouldRender=!0,this.domNode=$_(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(Z(this.domNode.domNode,q_.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new sv(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=$_(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Z(this.slider.domNode,q_.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.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,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=K_(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(Ag&&a>_v){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{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()}},yv=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},bv=class extends vv{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new yv(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw 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}},xv=class extends vv{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new yv(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw 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}},Sv=500,Cv=50,wv=!0,Tv=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Ev=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(hg){let t=dg(O_(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Tv(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Ev.INSTANCE=new Ev;var Dv=Ev,Ov=class extends av{constructor(e,t,n){super(),this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new X),this.onWillScroll=this._onWillScroll.event,this._options=Av(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new xv(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new bv(this._scrollable,this._options,r)),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=$_(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=$_(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=$_(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new c_),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ih(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,jg&&(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 i_(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ih(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(Z(this._listenOnDomNode,q_.MOUSE_WHEEL,e=>{this._onMouseWheel(new i_(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Dv.INSTANCE;wv&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!jg&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Cv*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Cv*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(wv&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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 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,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_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(),Sv)}},kv=class extends Ov{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Av(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,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,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,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,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,jg&&(t.className+=` mac`),t}var jv=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new lv({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>H_(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new kv(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Jh.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Rh(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(Rh(()=>this._styleElement.remove())),this._register(Jh.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
101
- `)})),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(e=>this._handleScroll(e)))}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(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};jv=vm([J(2,Gm),J(3,ih),J(4,Km),J(5,lh),J(6,Zm),J(7,oh)],jv);var Mv=class extends Y{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(e=>this._removeDecoration(e))),this._register(Rh(()=>{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){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Mv=vm([J(1,Gm),J(2,ih),J(3,eh),J(4,oh)],Mv);var Nv=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,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Pv={full:0,left:0,center:0,right:0},Fv={full:0,left:0,center:0,right:0},Iv={full:0,left:0,center:0,right:0},Lv=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Nv,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Rh(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw 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(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Fv.full=this._canvas.width,Fv.left=e,Fv.center=t,Fv.right=e,this._refreshDrawHeightConstants(),Iv.full=1,Iv.left=1,Iv.center=1+Fv.left,Iv.right=1+Fv.left+Fv.center}_refreshDrawHeightConstants(){Pv.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);Pv.left=t,Pv.center=t,Pv.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pv.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pv.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pv.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pv.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 e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);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(Iv[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Pv[e.position||`full`]/2),Fv[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Pv[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}))}};Lv=vm([J(2,Gm),J(3,eh),J(4,oh),J(5,Zm),J(6,lh),J(7,ih)],Lv);var Q;(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=`
102
- `,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=``))(Q||={});var Rv;(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=`Ÿ`))(Rv||={});var zv;(e=>e.ST=`${Q.ESC}\\`)(zv||={});var Bv=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,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 e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Q.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 e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Bv=vm([J(2,Gm),J(3,Zm),J(4,qm),J(5,oh)],Bv);var Vv=0,Hv=0,Uv=0,Wv=0,Gv={css:`#00000000`,rgba:0},Kv;(e=>{function t(e,t,n,r){return r===void 0?`#${Zv(e)}${Zv(t)}${Zv(n)}`:`#${Zv(e)}${Zv(t)}${Zv(n)}${Zv(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Kv||={});var qv;(e=>{function t(e,t){if(Wv=(t.rgba&255)/255,Wv===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Vv=a+Math.round((n-a)*Wv),Hv=o+Math.round((r-o)*Wv),Uv=s+Math.round((i-s)*Wv),{css:Kv.toCss(Vv,Hv,Uv),rgba:Kv.toRgba(Vv,Hv,Uv)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Xv.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Kv.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Vv,Hv,Uv]=Xv.toChannels(t),{css:Kv.toCss(Vv,Hv,Uv),rgba:t}}e.opaque=i;function a(e,t){return Wv=Math.round(t*255),[Vv,Hv,Uv]=Xv.toChannels(e.rgba),{css:Kv.toCss(Vv,Hv,Uv,Wv),rgba:Kv.toRgba(Vv,Hv,Uv,Wv)}}e.opacity=a;function o(e,t){return Wv=e.rgba&255,a(e,Wv*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(qv||={});var Jv;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Vv=parseInt(e.slice(1,2).repeat(2),16),Hv=parseInt(e.slice(2,3).repeat(2),16),Uv=parseInt(e.slice(3,4).repeat(2),16),Kv.toColor(Vv,Hv,Uv);case 5:return Vv=parseInt(e.slice(1,2).repeat(2),16),Hv=parseInt(e.slice(2,3).repeat(2),16),Uv=parseInt(e.slice(3,4).repeat(2),16),Wv=parseInt(e.slice(4,5).repeat(2),16),Kv.toColor(Vv,Hv,Uv,Wv);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Vv=parseInt(r[1]),Hv=parseInt(r[2]),Uv=parseInt(r[3]),Wv=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Kv.toColor(Vv,Hv,Uv,Wv);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Vv,Hv,Uv,Wv]=t.getImageData(0,0,1,1).data,Wv!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Kv.toRgba(Vv,Hv,Uv,Wv),css:e}}e.toColor=r})(Jv||={});var Yv;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Yv||={});var Xv;(e=>{function t(e,t){if(Wv=(t&255)/255,Wv===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Vv=a+Math.round((n-a)*Wv),Hv=o+Math.round((r-o)*Wv),Uv=s+Math.round((i-s)*Wv),Kv.toRgba(Vv,Hv,Uv)}e.blend=t;function n(e,t,n){let a=Yv.relativeLuminance(e>>8),o=Yv.relativeLuminance(t>>8);if(Qv(a,o)<n){if(o<a){let o=r(e,t,n),s=Qv(a,Yv.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Qv(a,Yv.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Qv(a,Yv.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Qv(a,Yv.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Qv(Yv.relativeLuminance2(o,s,c),Yv.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Qv(Yv.relativeLuminance2(o,s,c),Yv.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Qv(Yv.relativeLuminance2(o,s,c),Yv.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=Qv(Yv.relativeLuminance2(o,s,c),Yv.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Xv||={});function Zv(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Qv(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var $v=class extends Im{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ey=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Rm}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 n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||Fm.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)ey._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||Fm.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};ey=vm([J(0,Gm)],ey);function ty(e){return 57508<=e&&e<=57558}function ny(e){return 9472<=e&&e<=9631}function ry(e){return ty(e)||ny(e)}function iy(){return{css:{canvas:ay(),cell:ay()},device:{canvas:ay(),cell:ay(),char:{width:0,height:0,left:0,top:0}}}}function ay(){return{width:0,height:0}}var oy=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new Rm,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,ee=0,C=!1,w=0,te=0,ne=[],re=l!==-1&&u!==-1;for(let ie=0;ie<m;ie++){e.loadCell(ie,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ae=!1,oe=ie>=te,se=ie,T=this._workCell;if(f.length>0&&ie===f[0][0]&&oe){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)oe&&=i===this._isCellInSelection(v,t);oe&&=!n||a<r[0]||a>=r[1],oe?(ae=!0,T=new $v(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),se=r[1]-1,m=T.getWidth()):te=r[1]}let E=this._isCellInSelection(ie,t),ce=n&&ie===a,le=re&&ie>=l&&ie<=u,ue=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{ue=!0});let de=T.getChars()||Fm;if(de===` `&&(T.isUnderline()||T.isOverline())&&(de=`\xA0`),w=m*s-c.get(de,T.isBold(),T.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(E&&C||!E&&!C&&T.bg===y)&&(E&&C&&p.selectionForeground||T.fg===b)&&T.extended.ext===x&&le===S&&w===ee&&!ce&&!ae&&!ue&&oe){T.isInvisible()?_+=Fm:_+=de,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=T.bg,b=T.fg,x=T.extended.ext,S=le,ee=w,C=E,ae&&a>=ie&&a<=se&&(a=ie),!this._coreService.isCursorHidden&&ce&&this._coreService.isCursorInitialized){if(ne.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&ne.push(`xterm-cursor-blink`),ne.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:ne.push(`xterm-cursor-outline`);break;case`block`:ne.push(`xterm-cursor-block`);break;case`bar`:ne.push(`xterm-cursor-bar`);break;case`underline`:ne.push(`xterm-cursor-underline`);break;default:break}}if(T.isBold()&&ne.push(`xterm-bold`),T.isItalic()&&ne.push(`xterm-italic`),T.isDim()&&ne.push(`xterm-dim`),_=T.isInvisible()?Fm:T.getChars()||Fm,T.isUnderline()&&(ne.push(`xterm-underline-${T.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!T.isUnderlineColorDefault()))if(T.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Im.toColorRGB(T.getUnderlineColor()).join(`,`)})`;else{let e=T.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&T.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}T.isOverline()&&(ne.push(`xterm-overline`),_===` `&&(_=`\xA0`)),T.isStrikethrough()&&ne.push(`xterm-strikethrough`),le&&(h.style.textDecoration=`underline`);let fe=T.getFgColor(),D=T.getFgColorMode(),pe=T.getBgColor(),me=T.getBgColorMode(),he=!!T.isInverse();if(he){let e=fe;fe=pe,pe=e;let t=D;D=me,me=t}let O,ge,_e=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{e.options.layer!==`top`&&_e||(e.backgroundColorRGB&&(me=50331648,pe=e.backgroundColorRGB.rgba>>8&16777215,O=e.backgroundColorRGB),e.foregroundColorRGB&&(D=50331648,fe=e.foregroundColorRGB.rgba>>8&16777215,ge=e.foregroundColorRGB),_e=e.options.layer===`top`)}),!_e&&E&&(O=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,pe=O.rgba>>8&16777215,me=50331648,_e=!0,p.selectionForeground&&(D=50331648,fe=p.selectionForeground.rgba>>8&16777215,ge=p.selectionForeground)),_e&&ne.push(`xterm-decoration-top`);let ve;switch(me){case 16777216:case 33554432:ve=p.ansi[pe],ne.push(`xterm-bg-${pe}`);break;case 50331648:ve=Kv.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(h,`background-color:#${sy((pe>>>0).toString(16),`0`,6)}`);break;default:he?(ve=p.foreground,ne.push(`xterm-bg-257`)):ve=p.background}switch(O||T.isDim()&&(O=qv.multiplyOpacity(ve,.5)),D){case 16777216:case 33554432:T.isBold()&&fe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(fe+=8),this._applyMinimumContrast(h,ve,p.ansi[fe],T,O,void 0)||ne.push(`xterm-fg-${fe}`);break;case 50331648:let e=Kv.toColor(fe>>16&255,fe>>8&255,fe&255);this._applyMinimumContrast(h,ve,e,T,O,ge)||this._addStyle(h,`color:#${sy(fe.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ve,p.foreground,T,O,ge)||he&&ne.push(`xterm-fg-257`)}ne.length&&=(h.className=ne.join(` `),0),!ce&&!ae&&!ue&&oe?g++:h.textContent=_,w!==this.defaultSpacing&&(h.style.letterSpacing=`${w}px`),d.push(h),ie=se}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||ry(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=qv.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};oy=vm([J(1,ch),J(2,Zm),J(3,ih),J(4,qm),J(5,eh),J(6,lh)],oy);function sy(e,t,n){for(;e.length<n;)e=t+e;return e}var cy=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 n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),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,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},ly=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function uy(){return new ly}var dy=`xterm-dom-renderer-owner-`,fy=`xterm-rows`,py=`xterm-fg-`,my=`xterm-bg-`,hy=`xterm-focus`,gy=`xterm-selection`,_y=1,vy=class extends Y{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=_y++,this._rowElements=[],this._selectionRenderModel=uy(),this.onRequestRedraw=this._register(new X).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(fy),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(gy),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=iy(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(oy,document),this._element.classList.add(dy+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(Rh(()=>{this._element.classList.remove(dy+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new cy(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 e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${fy} 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} .${fy} { 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} .${fy} .xterm-dim { color: ${qv.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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${fy}.${hy} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${fy}.${hy} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${fy}.${hy} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${fy} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${fy} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${fy} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${fy} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${fy} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${gy} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${gy} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${gy} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${py}${n} { color: ${r.css}; }${this._terminalSelector} .${py}${n}.xterm-dim { color: ${qv.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${my}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${py}257 { color: ${qv.opaque(e.background).css}; }${this._terminalSelector} .${py}257.xterm-dim { color: ${qv.multiplyOpacity(qv.opaque(e.background),.5).css}; }${this._terminalSelector} .${my}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 e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}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(hy),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(hy),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}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 n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${dy}${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,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};vy=vm([J(7,Ym),J(8,rh),J(9,Zm),J(10,Gm),J(11,qm),J(12,ih),J(13,lh)],vy);var yy=class extends Y{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new X),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Sy(this._optionsService))}catch{this._measureStrategy=this._register(new xy(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())}};yy=vm([J(2,Zm)],yy);var by=class extends Y{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)}},xy=class extends by{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},Sy=class extends by{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 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}},Cy=class extends Y{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new wy(this._window)),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new X),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Jh.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Z(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(Z(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}},wy=class extends Y{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Vh),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Rh(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Z(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},Ty=class extends Y{constructor(){super(),this.linkProviders=[],this._register(Rh(()=>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 Ey(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Dy(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Ey(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var Oy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Dy(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Ey(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Oy=vm([J(0,oh),J(1,rh)],Oy);var ky=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,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=[]}},Ay={};_m(Ay,{getSafariVersion:()=>Ly,isChromeOS:()=>Uy,isFirefox:()=>Py,isIpad:()=>zy,isIphone:()=>By,isLegacyEdge:()=>Fy,isLinux:()=>Hy,isMac:()=>Ry,isNode:()=>jy,isSafari:()=>Iy,isWindows:()=>Vy});var jy=typeof process<`u`&&`title`in process,My=jy?`node`:navigator.userAgent,Ny=jy?`node`:navigator.platform,Py=My.includes(`Firefox`),Fy=My.includes(`Edge`),Iy=/^((?!chrome|android).)*safari/i.test(My);function Ly(){if(!Iy)return 0;let e=My.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ry=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Ny),zy=Ny===`iPad`,By=Ny===`iPhone`,Vy=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Ny),Hy=Ny.indexOf(`Linux`)>=0,Uy=/\bCrOS\b/.test(My),Wy=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),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},Gy=class extends Wy{_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())}}},Ky=class extends Wy{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},qy=!jy&&`requestIdleCallback`in window?Ky:Gy,Jy=class{constructor(){this._queue=new qy}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Yy=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new Vh),this._pausedResizeTask=new Jy,this._observerDisposable=this._register(new Vh),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 X),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new X),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new X),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new ky((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Xy(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Rh(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Rh(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(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),!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(e=>this.refreshRows(e.start,e.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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),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(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Yy=vm([J(2,Zm),J(3,rh),J(4,qm),J(5,eh),J(6,Gm),J(7,ih),J(8,lh)],Yy);var Xy=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,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 Zy(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return eb(i,a,e,t,n,r)+tb(a,t,n,r)+nb(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,lb(Math.abs(i-e),cb(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return lb($y(a>t?e:i,n)+(s-1)*n.cols+1+Qy(a>t?i:e,n),cb(o,r))}function Qy(e,t){return e-1}function $y(e,t){return t.cols-e}function eb(e,t,n,r,i,a){return tb(t,r,i,a).length===0?``:lb(sb(e,t,e,t-ib(t,i),!1,i).length,cb(`D`,a))}function tb(e,t,n,r){let i=e-ib(e,n),a=t-ib(t,n);return lb(Math.abs(i-a)-rb(e,t,n),cb(ob(e,t),r))}function nb(e,t,n,r,i,a){let o;o=tb(t,r,i,a).length>0?r-ib(r,i):t;let s=r,c=ab(e,t,n,r,i,a);return lb(sb(e,o,n,s,c===`C`,i).length,cb(c,a))}function rb(e,t,n){let r=0,i=e-ib(e,n),a=t-ib(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=ob(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function ib(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function ab(e,t,n,r,i,a){let o;return o=tb(n,r,i,a).length>0?r-ib(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function ob(e,t){return e>t?`A`:`B`}function sb(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function cb(e,t){let n=t?`O`:`[`;return Q.ESC+n+e}function lb(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var ub=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 db(e,t){if(e.start.y>e.end.y)throw 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 fb=50,pb=15,mb=50,hb=500,gb=RegExp(`\xA0`,`g`),_b=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Rm,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new X),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new X),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new ub(this._bufferService),this._activeSelectionMode=0,this._register(Rh(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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 n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(gb,` `)).join(Vy?`\r
100
+ `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);sg.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*og<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||ph;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ag)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},cg=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},lg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new X,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new X,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};lg.INSTANCE=new lg;var ug=lg;function dg(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}ug.INSTANCE.onDidChangeZoomLevel;function fg(e){return ug.INSTANCE.getZoomFactor(e)}ug.INSTANCE.onDidChangeFullscreen;var pg=typeof navigator==`object`?navigator.userAgent:``,mg=pg.indexOf(`Firefox`)>=0,hg=pg.indexOf(`AppleWebKit`)>=0,gg=pg.indexOf(`Chrome`)>=0,_g=!gg&&pg.indexOf(`Safari`)>=0;pg.indexOf(`Electron/`),pg.indexOf(`Android`);var vg=!1;if(typeof Uh.matchMedia==`function`){let e=Uh.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Uh.matchMedia(`(display-mode: fullscreen)`);vg=e.matches,dg(Uh,e,({matches:e})=>{vg&&t.matches||(vg=e)})}function yg(){return vg}var bg=`en`,xg=!1,Sg=!1,Cg=!1,wg=!1,Tg=!1,Eg=bg,Dg,Og=globalThis,kg;typeof Og.vscode<`u`&&typeof Og.vscode.process<`u`?kg=Og.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(kg=process);var Ag=typeof kg?.versions?.electron==`string`&&kg?.type===`renderer`;if(typeof kg==`object`){xg=kg.platform===`win32`,Sg=kg.platform===`darwin`,Cg=kg.platform===`linux`,Cg&&kg.env.SNAP&&kg.env.SNAP_REVISION,kg.env.CI||kg.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Eg=bg;let e=kg.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Eg=t.resolvedLanguage||bg,t.languagePack?.translationsConfigFile}catch{}wg=!0}else typeof navigator==`object`&&!Ag?(Dg=navigator.userAgent,xg=Dg.indexOf(`Windows`)>=0,Sg=Dg.indexOf(`Macintosh`)>=0,(Dg.indexOf(`Macintosh`)>=0||Dg.indexOf(`iPad`)>=0||Dg.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Cg=Dg.indexOf(`Linux`)>=0,Dg?.indexOf(`Mobi`),Tg=!0,Eg=globalThis._VSCODE_NLS_LANGUAGE||bg,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var jg=xg,Mg=Sg,Ng=Cg,Pg=wg;Tg&&typeof Og.importScripts==`function`&&Og.origin;var Fg=Dg,Ig=Eg,Lg;(e=>{function t(){return Ig}e.value=t;function n(){return Ig.length===2?Ig===`en`:Ig.length>=3&&Ig[0]===`e`&&Ig[1]===`n`&&Ig[2]===`-`}e.isDefaultVariant=n;function r(){return Ig===`en`}e.isDefault=r})(Lg||={});var Rg=typeof Og.postMessage==`function`&&!Og.importScripts;(()=>{if(Rg){let e=[];Og.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Og.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var zg=!!(Fg&&Fg.indexOf(`Chrome`)>=0);Fg&&Fg.indexOf(`Firefox`),!zg&&Fg&&Fg.indexOf(`Safari`),Fg&&Fg.indexOf(`Edg/`),Fg&&Fg.indexOf(`Android`);var Bg=typeof navigator==`object`?navigator:{};Pg||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Bg&&Bg.clipboard&&Bg.clipboard.writeText,Pg||Bg&&Bg.clipboard&&Bg.clipboard.readText,Pg||yg()||Bg.keyboard,`ontouchstart`in Uh||Bg.maxTouchPoints,Uh.PointerEvent&&(`ontouchstart`in Uh||navigator.maxTouchPoints);var Vg=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}},Hg=new Vg,Ug=new Vg,Wg=new Vg,Gg=Array(230),Kg;(e=>{function t(e){return Hg.keyCodeToStr(e)}e.toString=t;function n(e){return Hg.strToKeyCode(e)}e.fromString=n;function r(e){return Ug.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Wg.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Ug.strToKeyCode(e)||Wg.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Hg.keyCodeToStr(e)}e.toElectronAccelerator=o})(Kg||={});var qg=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Jg([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Jg=class{constructor(e){if(e.length===0)throw _h(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;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 Yg(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Kg.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(mg)switch(t){case 59:return 85;case 60:if(Ng)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Mg)return 57;break}else if(hg&&(Mg&&t===93||!Mg&&t===92))return 57;return Gg[t]||0}var Xg=Mg?256:2048,Zg=512,Qg=1024,$g=Mg?2048:256,e_=class{constructor(e){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=t.getModifierState?.(`AltGraph`),this.keyCode=Yg(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|=Xg),this.altKey&&(t|=Zg),this.shiftKey&&(t|=Qg),this.metaKey&&(t|=$g),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new qg(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},t_=new WeakMap;function n_(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var r_=class{static getSameOriginWindowChain(e){let t=t_.get(e);if(!t){t=[],t_.set(e,t);let n=e,r;do r=n_(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},i_=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 n=r_.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},a_=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(gg){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?mg&&!Mg?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)_g&&jg?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?mg&&!Mg?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},o_=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),s_;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof c_?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Yh.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:o_})})(s_||={});var c_=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?o_:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},l_=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 yh(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new yh(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},u_=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new yh(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=zh(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var d_;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(d_||={});var f_=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new X,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Yh.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};f_.EMPTY=f_.fromArray([]);function p_(e){return 55296<=e&&e<=56319}function m_(e){return 56320<=e&&e<=57343}function h_(e,t){return(e-55296<<10)+(t-56320)+65536}function g_(e){return __(e,0)}function __(e,t){switch(typeof e){case`object`:return e===null?v_(349,t):Array.isArray(e)?x_(e,t):S_(e,t);case`string`:return b_(e,t);case`boolean`:return y_(e,t);case`number`:return v_(e,t);case`undefined`:return v_(937,t);default:return v_(617,t)}}function v_(e,t){return(t<<5)-t+e|0}function y_(e,t){return v_(e?433:863,t)}function b_(e,t){t=v_(149417,t);for(let n=0,r=e.length;n<r;n++)t=v_(e.charCodeAt(n),t);return t}function x_(e,t){return t=v_(104579,t),e.reduce((e,t)=>__(t,e),t)}function S_(e,t){return t=v_(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=b_(n,t),__(e[n],t)),t)}function C_(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function w_(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function T_(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function E_(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):T_((e>>>0).toString(16),t/4)}var D_=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(p_(a))if(o+1<t){let t=e.charCodeAt(o+1);m_(t)?(o++,s=h_(a,t)):s=65533}else{i=a;break}else m_(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),E_(this._h0)+E_(this._h1)+E_(this._h2)+E_(this._h3)+E_(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,w_(this._buff,this._buffLen),this._buffLen>56&&(this._step(),w_(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,C_(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=C_(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=C_(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};D_._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:O_,getWindow:k_,getDocument:A_,getWindows:j_,getWindowsCount:M_,getWindowId:N_,getWindowById:P_,hasWindow:F_,onDidRegisterWindow:I_,onWillUnregisterWindow:L_,onDidUnregisterWindow:R_}=function(){let e=new Map,t={window:Uh,disposables:new Vh};e.set(Uh.vscodeWindowId,t);let n=new X,r=new X,i=new X;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Y.None;let a=new Vh,o={window:t,disposables:a.add(new Vh)};return e.set(t.vscodeWindowId,o),a.add(zh(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Z(t,J_.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:Uh},getDocument(e){return k_(e).document}}}(),z_=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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,null)}};function Z(e,t,n,r){return new z_(e,t,n,r)}function B_(e,t){return function(n){return t(new i_(e,n))}}function V_(e){return function(t){return e(new e_(t))}}var H_=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=B_(k_(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=V_(n)),Z(e,t,i,r)},U_,W_=class extends u_{constructor(e){super(),this.defaultTarget=e&&k_(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},G_=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){ph(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(G_.sort),a.shift().execute();r.set(i,!1)};U_=(t,r,a=0)=>{let o=N_(t),s=new G_(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var K_=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};K_.None=new K_(0,0);function q_(e){let t=e.getBoundingClientRect(),n=k_(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=g_(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(zh(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var J_={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:hg?`webkitAnimationStart`:`animationstart`,ANIMATION_END:hg?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:hg?`webkitAnimationIteration`:`animationiteration`},Y_=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function X_(e,t,n,...r){let i=Y_.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function Z_(e,t,...n){return X_(`http://www.w3.org/1999/xhtml`,e,t,...n)}Z_.SVG=function(e,t,...n){return X_(`http://www.w3.org/2000/svg`,e,t,...n)};var Q_=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=$_(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=$_(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=$_(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=$_(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=$_(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=$_(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=$_(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=$_(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=$_(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=$_(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=$_(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=$_(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=$_(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=$_(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 $_(e){return typeof e==`number`?`${e}px`:e}function ev(e){return new Q_(e)}var tv=class{constructor(){this._hooks=new Vh,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(zh(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=k_(e)}this._hooks.add(Z(a,J_.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(Z(a,J_.POINTER_UP,e=>this.stopMonitoring(!0)))}};function nv(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var rv;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(rv||={});var iv=class e extends Y{constructor(){super(),this.dispatched=!1,this.targets=new Kh,this.ignoreTargets=new Kh,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Yh.runAndSubscribe(I_,({window:e,disposables:t})=>{t.add(Z(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(Z(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(Z(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:Uh,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Ih(new e),zh(e.INSTANCE.targets.push(t))):Y.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Ih(new e),zh(e.INSTANCE.ignoreTargets.push(t))):Y.None}static isTouchDevice(){return`ontouchstart`in Uh||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(rv.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-Sh(s.rollingPageX))<30&&Math.abs(s.initialPageY-Sh(s.rollingPageY))<30){let e=this.newGestureEvent(rv.Tap,s.initialTarget);e.pageX=Sh(s.rollingPageX),e.pageY=Sh(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-Sh(s.rollingPageX))<30&&Math.abs(s.initialPageY-Sh(s.rollingPageY))<30){let e=this.newGestureEvent(rv.Contextmenu,s.initialTarget);e.pageX=Sh(s.rollingPageX),e.pageY=Sh(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Sh(s.rollingPageX),n=Sh(s.rollingPageY),i=Sh(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(rv.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===rv.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===rv.Change||t.type===rv.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=U_(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(rv.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(rv.Change,i.initialTarget);a.translationX=r.pageX-Sh(i.rollingPageX),a.translationY=r.pageY-Sh(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};iv.SCROLL_FRICTION=-.005,iv.HOLD_DELAY=700,iv.CLEAR_TAP_COUNT_TIME=400,ym([nv],iv,`isTouchDevice`,1);var av=iv,ov=class extends Y{onclick(e,t){this._register(Z(e,J_.CLICK,n=>t(new i_(k_(e),n))))}onmousedown(e,t){this._register(Z(e,J_.MOUSE_DOWN,n=>t(new i_(k_(e),n))))}onmouseover(e,t){this._register(Z(e,J_.MOUSE_OVER,n=>t(new i_(k_(e),n))))}onmouseleave(e,t){this._register(Z(e,J_.MOUSE_LEAVE,n=>t(new i_(k_(e),n))))}onkeydown(e,t){this._register(Z(e,J_.KEY_DOWN,e=>t(new e_(e))))}onkeyup(e,t){this._register(Z(e,J_.KEY_UP,e=>t(new e_(e))))}oninput(e,t){this._register(Z(e,J_.INPUT,t))}onblur(e,t){this._register(Z(e,J_.BLUR,t))}onfocus(e,t){this._register(Z(e,J_.FOCUS,t))}onchange(e,t){this._register(Z(e,J_.CHANGE,t))}ignoreGesture(e){return av.ignoreTarget(e)}},sv=11,cv=class extends ov{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=sv+`px`,this.domNode.style.height=sv+`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 tv),this._register(H_(this.bgDomNode,J_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(H_(this.domNode,J_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new W_),this._pointerdownScheduleRepeatTimer=this._register(new l_)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,k_(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},lv=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(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(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},uv=class extends Y{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new lv(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.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(),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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new mv(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=mv.start(this._state,t,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},dv=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function fv(e,t){let n=t-e;return function(t){return e+n*gv(t)}}function pv(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var mv=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,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(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),pv(fv(e,r),fv(i,t),.33)}return fv(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new dv(this.scrollLeft(t),this.scrollTop(t),!1):new dv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function hv(e){return e**3}function gv(e){return 1-hv(1-e)}var _v=class extends Y{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new l_)}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||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(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},vv=140,yv=class extends ov{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 _v(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new tv),this._shouldRender=!0,this.domNode=ev(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(Z(this.domNode.domNode,J_.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new cv(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=ev(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Z(this.slider.domNode,J_.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.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,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=q_(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(jg&&a>vv){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{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()}},bv=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},xv=class extends yv{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new bv(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw 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}},Sv=class extends yv{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new bv(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw 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}},Cv=500,wv=50,Tv=!0,Ev=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Dv=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(gg){let t=fg(k_(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Ev(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Dv.INSTANCE=new Dv;var Ov=Dv,kv=class extends ov{constructor(e,t,n){super(),this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new X),this.onWillScroll=this._onWillScroll.event,this._options=jv(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Sv(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new xv(this._scrollable,this._options,r)),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=ev(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ev(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ev(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new l_),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Lh(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,Mg&&(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 a_(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Lh(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(Z(this._listenOnDomNode,J_.MOUSE_WHEEL,e=>{this._onMouseWheel(new a_(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Ov.INSTANCE;Tv&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!Mg&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=wv*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=wv*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Tv&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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 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,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_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(),Cv)}},Av=class extends kv{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function jv(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,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,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,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,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,Mg&&(t.className+=` mac`),t}var Mv=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new uv({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>U_(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Av(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Yh.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(zh(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(zh(()=>this._styleElement.remove())),this._register(Yh.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
101
+ `)})),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(e=>this._handleScroll(e)))}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(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Mv=ym([J(2,Km),J(3,ah),J(4,qm),J(5,uh),J(6,Qm),J(7,sh)],Mv);var Nv=class extends Y{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(e=>this._removeDecoration(e))),this._register(zh(()=>{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){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Nv=ym([J(1,Km),J(2,ah),J(3,th),J(4,sh)],Nv);var Pv=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,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Fv={full:0,left:0,center:0,right:0},Iv={full:0,left:0,center:0,right:0},Lv={full:0,left:0,center:0,right:0},Rv=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Pv,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(zh(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw 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(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Iv.full=this._canvas.width,Iv.left=e,Iv.center=t,Iv.right=e,this._refreshDrawHeightConstants(),Lv.full=1,Lv.left=1,Lv.center=1+Iv.left,Lv.right=1+Iv.left+Iv.center}_refreshDrawHeightConstants(){Fv.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);Fv.left=t,Fv.center=t,Fv.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fv.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fv.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fv.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fv.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 e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);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(Lv[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Fv[e.position||`full`]/2),Iv[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Fv[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}))}};Rv=ym([J(2,Km),J(3,th),J(4,sh),J(5,Qm),J(6,uh),J(7,ah)],Rv);var Q;(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=`
102
+ `,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=``))(Q||={});var zv;(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=`Ÿ`))(zv||={});var Bv;(e=>e.ST=`${Q.ESC}\\`)(Bv||={});var Vv=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,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 e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Q.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 e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Vv=ym([J(2,Km),J(3,Qm),J(4,Jm),J(5,sh)],Vv);var Hv=0,Uv=0,Wv=0,Gv=0,Kv={css:`#00000000`,rgba:0},qv;(e=>{function t(e,t,n,r){return r===void 0?`#${Qv(e)}${Qv(t)}${Qv(n)}`:`#${Qv(e)}${Qv(t)}${Qv(n)}${Qv(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(qv||={});var Jv;(e=>{function t(e,t){if(Gv=(t.rgba&255)/255,Gv===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Hv=a+Math.round((n-a)*Gv),Uv=o+Math.round((r-o)*Gv),Wv=s+Math.round((i-s)*Gv),{css:qv.toCss(Hv,Uv,Wv),rgba:qv.toRgba(Hv,Uv,Wv)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Zv.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return qv.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Hv,Uv,Wv]=Zv.toChannels(t),{css:qv.toCss(Hv,Uv,Wv),rgba:t}}e.opaque=i;function a(e,t){return Gv=Math.round(t*255),[Hv,Uv,Wv]=Zv.toChannels(e.rgba),{css:qv.toCss(Hv,Uv,Wv,Gv),rgba:qv.toRgba(Hv,Uv,Wv,Gv)}}e.opacity=a;function o(e,t){return Gv=e.rgba&255,a(e,Gv*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Jv||={});var Yv;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Hv=parseInt(e.slice(1,2).repeat(2),16),Uv=parseInt(e.slice(2,3).repeat(2),16),Wv=parseInt(e.slice(3,4).repeat(2),16),qv.toColor(Hv,Uv,Wv);case 5:return Hv=parseInt(e.slice(1,2).repeat(2),16),Uv=parseInt(e.slice(2,3).repeat(2),16),Wv=parseInt(e.slice(3,4).repeat(2),16),Gv=parseInt(e.slice(4,5).repeat(2),16),qv.toColor(Hv,Uv,Wv,Gv);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Hv=parseInt(r[1]),Uv=parseInt(r[2]),Wv=parseInt(r[3]),Gv=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),qv.toColor(Hv,Uv,Wv,Gv);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Hv,Uv,Wv,Gv]=t.getImageData(0,0,1,1).data,Gv!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:qv.toRgba(Hv,Uv,Wv,Gv),css:e}}e.toColor=r})(Yv||={});var Xv;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Xv||={});var Zv;(e=>{function t(e,t){if(Gv=(t&255)/255,Gv===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Hv=a+Math.round((n-a)*Gv),Uv=o+Math.round((r-o)*Gv),Wv=s+Math.round((i-s)*Gv),qv.toRgba(Hv,Uv,Wv)}e.blend=t;function n(e,t,n){let a=Xv.relativeLuminance(e>>8),o=Xv.relativeLuminance(t>>8);if($v(a,o)<n){if(o<a){let o=r(e,t,n),s=$v(a,Xv.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>$v(a,Xv.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=$v(a,Xv.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>$v(a,Xv.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=$v(Xv.relativeLuminance2(o,s,c),Xv.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=$v(Xv.relativeLuminance2(o,s,c),Xv.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=$v(Xv.relativeLuminance2(o,s,c),Xv.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=$v(Xv.relativeLuminance2(o,s,c),Xv.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Zv||={});function Qv(e){let t=e.toString(16);return t.length<2?`0`+t:t}function $v(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ey=class extends Lm{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ty=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new zm}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 n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||Im.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)ty._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||Im.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};ty=ym([J(0,Km)],ty);function ny(e){return 57508<=e&&e<=57558}function ry(e){return 9472<=e&&e<=9631}function iy(e){return ny(e)||ry(e)}function ay(){return{css:{canvas:oy(),cell:oy()},device:{canvas:oy(),cell:oy(),char:{width:0,height:0,left:0,top:0}}}}function oy(){return{width:0,height:0}}var sy=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new zm,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,ee=0,C=!1,te=0,ne=0,w=[],re=l!==-1&&u!==-1;for(let ie=0;ie<m;ie++){e.loadCell(ie,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ae=!1,oe=ie>=ne,se=ie,T=this._workCell;if(f.length>0&&ie===f[0][0]&&oe){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)oe&&=i===this._isCellInSelection(v,t);oe&&=!n||a<r[0]||a>=r[1],oe?(ae=!0,T=new ey(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),se=r[1]-1,m=T.getWidth()):ne=r[1]}let E=this._isCellInSelection(ie,t),ce=n&&ie===a,le=re&&ie>=l&&ie<=u,ue=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{ue=!0});let de=T.getChars()||Im;if(de===` `&&(T.isUnderline()||T.isOverline())&&(de=`\xA0`),te=m*s-c.get(de,T.isBold(),T.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(E&&C||!E&&!C&&T.bg===y)&&(E&&C&&p.selectionForeground||T.fg===b)&&T.extended.ext===x&&le===S&&te===ee&&!ce&&!ae&&!ue&&oe){T.isInvisible()?_+=Im:_+=de,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=T.bg,b=T.fg,x=T.extended.ext,S=le,ee=te,C=E,ae&&a>=ie&&a<=se&&(a=ie),!this._coreService.isCursorHidden&&ce&&this._coreService.isCursorInitialized){if(w.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&w.push(`xterm-cursor-blink`),w.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:w.push(`xterm-cursor-outline`);break;case`block`:w.push(`xterm-cursor-block`);break;case`bar`:w.push(`xterm-cursor-bar`);break;case`underline`:w.push(`xterm-cursor-underline`);break;default:break}}if(T.isBold()&&w.push(`xterm-bold`),T.isItalic()&&w.push(`xterm-italic`),T.isDim()&&w.push(`xterm-dim`),_=T.isInvisible()?Im:T.getChars()||Im,T.isUnderline()&&(w.push(`xterm-underline-${T.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!T.isUnderlineColorDefault()))if(T.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Lm.toColorRGB(T.getUnderlineColor()).join(`,`)})`;else{let e=T.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&T.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}T.isOverline()&&(w.push(`xterm-overline`),_===` `&&(_=`\xA0`)),T.isStrikethrough()&&w.push(`xterm-strikethrough`),le&&(h.style.textDecoration=`underline`);let fe=T.getFgColor(),D=T.getFgColorMode(),pe=T.getBgColor(),me=T.getBgColorMode(),he=!!T.isInverse();if(he){let e=fe;fe=pe,pe=e;let t=D;D=me,me=t}let O,ge,_e=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{e.options.layer!==`top`&&_e||(e.backgroundColorRGB&&(me=50331648,pe=e.backgroundColorRGB.rgba>>8&16777215,O=e.backgroundColorRGB),e.foregroundColorRGB&&(D=50331648,fe=e.foregroundColorRGB.rgba>>8&16777215,ge=e.foregroundColorRGB),_e=e.options.layer===`top`)}),!_e&&E&&(O=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,pe=O.rgba>>8&16777215,me=50331648,_e=!0,p.selectionForeground&&(D=50331648,fe=p.selectionForeground.rgba>>8&16777215,ge=p.selectionForeground)),_e&&w.push(`xterm-decoration-top`);let ve;switch(me){case 16777216:case 33554432:ve=p.ansi[pe],w.push(`xterm-bg-${pe}`);break;case 50331648:ve=qv.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(h,`background-color:#${cy((pe>>>0).toString(16),`0`,6)}`);break;default:he?(ve=p.foreground,w.push(`xterm-bg-257`)):ve=p.background}switch(O||T.isDim()&&(O=Jv.multiplyOpacity(ve,.5)),D){case 16777216:case 33554432:T.isBold()&&fe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(fe+=8),this._applyMinimumContrast(h,ve,p.ansi[fe],T,O,void 0)||w.push(`xterm-fg-${fe}`);break;case 50331648:let e=qv.toColor(fe>>16&255,fe>>8&255,fe&255);this._applyMinimumContrast(h,ve,e,T,O,ge)||this._addStyle(h,`color:#${cy(fe.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ve,p.foreground,T,O,ge)||he&&w.push(`xterm-fg-257`)}w.length&&=(h.className=w.join(` `),0),!ce&&!ae&&!ue&&oe?g++:h.textContent=_,te!==this.defaultSpacing&&(h.style.letterSpacing=`${te}px`),d.push(h),ie=se}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||iy(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=Jv.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};sy=ym([J(1,lh),J(2,Qm),J(3,ah),J(4,Jm),J(5,th),J(6,uh)],sy);function cy(e,t,n){for(;e.length<n;)e=t+e;return e}var ly=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 n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),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,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},uy=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function dy(){return new uy}var fy=`xterm-dom-renderer-owner-`,py=`xterm-rows`,my=`xterm-fg-`,hy=`xterm-bg-`,gy=`xterm-focus`,_y=`xterm-selection`,vy=1,yy=class extends Y{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=vy++,this._rowElements=[],this._selectionRenderModel=dy(),this.onRequestRedraw=this._register(new X).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(py),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(_y),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=ay(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(sy,document),this._element.classList.add(fy+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(zh(()=>{this._element.classList.remove(fy+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ly(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 e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${py} 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} .${py} { 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} .${py} .xterm-dim { color: ${Jv.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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${py}.${gy} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${py}.${gy} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${py}.${gy} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${py} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${py} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${py} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${py} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${py} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${_y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${_y} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${_y} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${my}${n} { color: ${r.css}; }${this._terminalSelector} .${my}${n}.xterm-dim { color: ${Jv.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${hy}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${my}257 { color: ${Jv.opaque(e.background).css}; }${this._terminalSelector} .${my}257.xterm-dim { color: ${Jv.multiplyOpacity(Jv.opaque(e.background),.5).css}; }${this._terminalSelector} .${hy}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 e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}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(gy),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(gy),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}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 n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${fy}${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,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};yy=ym([J(7,Xm),J(8,ih),J(9,Qm),J(10,Km),J(11,Jm),J(12,ah),J(13,uh)],yy);var by=class extends Y{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new X),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Cy(this._optionsService))}catch{this._measureStrategy=this._register(new Sy(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())}};by=ym([J(2,Qm)],by);var xy=class extends Y{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)}},Sy=class extends xy{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},Cy=class extends xy{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 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}},wy=class extends Y{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Ty(this._window)),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new X),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Yh.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Z(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(Z(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}},Ty=class extends Y{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Hh),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(zh(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Z(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},Ey=class extends Y{constructor(){super(),this.linkProviders=[],this._register(zh(()=>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 Dy(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Oy(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Dy(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var ky=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Oy(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Dy(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ky=ym([J(0,sh),J(1,ih)],ky);var Ay=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,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=[]}},jy={};vm(jy,{getSafariVersion:()=>Ry,isChromeOS:()=>Wy,isFirefox:()=>Fy,isIpad:()=>By,isIphone:()=>Vy,isLegacyEdge:()=>Iy,isLinux:()=>Uy,isMac:()=>zy,isNode:()=>My,isSafari:()=>Ly,isWindows:()=>Hy});var My=typeof process<`u`&&`title`in process,Ny=My?`node`:navigator.userAgent,Py=My?`node`:navigator.platform,Fy=Ny.includes(`Firefox`),Iy=Ny.includes(`Edge`),Ly=/^((?!chrome|android).)*safari/i.test(Ny);function Ry(){if(!Ly)return 0;let e=Ny.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var zy=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Py),By=Py===`iPad`,Vy=Py===`iPhone`,Hy=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Py),Uy=Py.indexOf(`Linux`)>=0,Wy=/\bCrOS\b/.test(Ny),Gy=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),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},Ky=class extends Gy{_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())}}},qy=class extends Gy{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Jy=!My&&`requestIdleCallback`in window?qy:Ky,Yy=class{constructor(){this._queue=new Jy}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Xy=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new Hh),this._pausedResizeTask=new Yy,this._observerDisposable=this._register(new Hh),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 X),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new X),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new X),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Ay((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Zy(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(zh(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=zh(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(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),!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(e=>this.refreshRows(e.start,e.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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),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(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Xy=ym([J(2,Qm),J(3,ih),J(4,Jm),J(5,th),J(6,Km),J(7,ah),J(8,uh)],Xy);var Zy=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,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 Qy(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return tb(i,a,e,t,n,r)+nb(a,t,n,r)+rb(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,ub(Math.abs(i-e),lb(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return ub(eb(a>t?e:i,n)+(s-1)*n.cols+1+$y(a>t?i:e,n),lb(o,r))}function $y(e,t){return e-1}function eb(e,t){return t.cols-e}function tb(e,t,n,r,i,a){return nb(t,r,i,a).length===0?``:ub(cb(e,t,e,t-ab(t,i),!1,i).length,lb(`D`,a))}function nb(e,t,n,r){let i=e-ab(e,n),a=t-ab(t,n);return ub(Math.abs(i-a)-ib(e,t,n),lb(sb(e,t),r))}function rb(e,t,n,r,i,a){let o;o=nb(t,r,i,a).length>0?r-ab(r,i):t;let s=r,c=ob(e,t,n,r,i,a);return ub(cb(e,o,n,s,c===`C`,i).length,lb(c,a))}function ib(e,t,n){let r=0,i=e-ab(e,n),a=t-ab(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=sb(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function ab(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function ob(e,t,n,r,i,a){let o;return o=nb(n,r,i,a).length>0?r-ab(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function sb(e,t){return e>t?`A`:`B`}function cb(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function lb(e,t){let n=t?`O`:`[`;return Q.ESC+n+e}function ub(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var db=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 fb(e,t){if(e.start.y>e.end.y)throw 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 pb=50,mb=15,hb=50,gb=500,_b=RegExp(`\xA0`,`g`),vb=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new zm,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new X),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new X),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new db(this._bufferService),this._activeSelectionMode=0,this._register(zh(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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 n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(_b,` `)).join(Hy?`\r
103
103
  `:`
104
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),Hy&&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),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=db(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=Ey(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-fb),fb),t/=fb,t/Math.abs(t)+Math.round(t*(pb-1)))}shouldForceSelection(e){return Ry?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(),mb)}_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&&!(Ry&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.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<hb&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=Zy(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={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=db(n,this._bufferService.cols)}};_b=vm([J(3,Gm),J(4,qm),J(5,ah),J(6,Zm),J(7,oh),J(8,ih)],_b);var vb=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},yb=class{constructor(){this._color=new vb,this._css=new vb}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},bb=Object.freeze((()=>{let e=[Jv.toColor(`#2e3436`),Jv.toColor(`#cc0000`),Jv.toColor(`#4e9a06`),Jv.toColor(`#c4a000`),Jv.toColor(`#3465a4`),Jv.toColor(`#75507b`),Jv.toColor(`#06989a`),Jv.toColor(`#d3d7cf`),Jv.toColor(`#555753`),Jv.toColor(`#ef2929`),Jv.toColor(`#8ae234`),Jv.toColor(`#fce94f`),Jv.toColor(`#729fcf`),Jv.toColor(`#ad7fa8`),Jv.toColor(`#34e2e2`),Jv.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:Kv.toCss(r,i,a),rgba:Kv.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Kv.toCss(n,n,n),rgba:Kv.toRgba(n,n,n)})}return e})()),xb=Jv.toColor(`#ffffff`),Sb=Jv.toColor(`#000000`),Cb=Jv.toColor(`#ffffff`),wb=Sb,Tb={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Eb=xb,Db=class extends Y{constructor(e){super(),this._optionsService=e,this._contrastCache=new yb,this._halfContrastCache=new yb,this._onChangeColors=this._register(new X),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xb,background:Sb,cursor:Cb,cursorAccent:wb,selectionForeground:void 0,selectionBackgroundTransparent:Tb,selectionBackgroundOpaque:qv.blend(Sb,Tb),selectionInactiveBackgroundTransparent:Tb,selectionInactiveBackgroundOpaque:qv.blend(Sb,Tb),scrollbarSliderBackground:qv.opacity(xb,.2),scrollbarSliderHoverBackground:qv.opacity(xb,.4),scrollbarSliderActiveBackground:qv.opacity(xb,.5),overviewRulerBorder:xb,ansi:bb.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=Ob(e.foreground,xb),t.background=Ob(e.background,Sb),t.cursor=qv.blend(t.background,Ob(e.cursor,Cb)),t.cursorAccent=qv.blend(t.background,Ob(e.cursorAccent,wb)),t.selectionBackgroundTransparent=Ob(e.selectionBackground,Tb),t.selectionBackgroundOpaque=qv.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ob(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=qv.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ob(e.selectionForeground,Gv):void 0,t.selectionForeground===Gv&&(t.selectionForeground=void 0),qv.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=qv.opacity(t.selectionBackgroundTransparent,.3)),qv.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=qv.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ob(e.scrollbarSliderBackground,qv.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ob(e.scrollbarSliderHoverBackground,qv.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ob(e.scrollbarSliderActiveBackground,qv.opacity(t.foreground,.5)),t.overviewRulerBorder=Ob(e.overviewRulerBorder,Eb),t.ansi=bb.slice(),t.ansi[0]=Ob(e.black,bb[0]),t.ansi[1]=Ob(e.red,bb[1]),t.ansi[2]=Ob(e.green,bb[2]),t.ansi[3]=Ob(e.yellow,bb[3]),t.ansi[4]=Ob(e.blue,bb[4]),t.ansi[5]=Ob(e.magenta,bb[5]),t.ansi[6]=Ob(e.cyan,bb[6]),t.ansi[7]=Ob(e.white,bb[7]),t.ansi[8]=Ob(e.brightBlack,bb[8]),t.ansi[9]=Ob(e.brightRed,bb[9]),t.ansi[10]=Ob(e.brightGreen,bb[10]),t.ansi[11]=Ob(e.brightYellow,bb[11]),t.ansi[12]=Ob(e.brightBlue,bb[12]),t.ansi[13]=Ob(e.brightMagenta,bb[13]),t.ansi[14]=Ob(e.brightCyan,bb[14]),t.ansi[15]=Ob(e.brightWhite,bb[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Ob(e.extendedAnsi[r],bb[r+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 e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];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()}}};Db=vm([J(0,Zm)],Db);function Ob(e,t){if(e!==void 0)try{return Jv.toColor(e)}catch{}return t}var kb=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Ab=class{constructor(){this._services=new kb,this._services.set(Ym,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Hm(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},jb={trace:0,debug:1,info:2,warn:3,error:4,off:5},Mb=`xterm.js: `,Nb=class extends Y{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Pb=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=jb[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Mb)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Nb=vm([J(0,Zm)],Nb);var Pb,Fb=class extends Y{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new X),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new X),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new X),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];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 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,...n){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 t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},$=3,Ib=Object.freeze(new Im),Lb=0,Rb=2,zb=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*$);let r=t||Rm.fromCharData([0,Pm,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*$+0],n=t&2097151;return[this._data[e*$+1],t&2097152?this._combined[e]:n?Am(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*$+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*$+0]=e|2097152|t[2]<<22):this._data[e*$+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*$+0]>>22}hasWidth(e){return this._data[e*$+0]&12582912}getFg(e){return this._data[e*$+1]}getBg(e){return this._data[e*$+2]}hasContent(e){return this._data[e*$+0]&4194303}getCodePoint(e){let t=this._data[e*$+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*$+0]&2097152}getString(e){let t=this._data[e*$+0];return t&2097152?this._combined[e]:t&2097151?Am(t&2097151):``}isProtected(e){return this._data[e*$+2]&536870912}loadCell(e,t){return Lb=e*$,t.content=this._data[Lb+0],t.fg=this._data[Lb+1],t.bg=this._data[Lb+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*$+0]=t.content,this._data[e*$+1]=t.fg,this._data[e*$+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*$+0]=t|n<<22,this._data[e*$+1]=r.fg,this._data[e*$+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*$+0];r&2097152?this._combined[e]+=Am(t):r&2097151?(this._combined[e]=Am(r&2097151)+Am(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*$+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Rm;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new Rm;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*Rb<this._data.buffer.byteLength;let n=e*$;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*Rb<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Rb<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303)return e+(this._data[e*$+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303||this._data[e*$+2]&50331648)return e+(this._data[e*$+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*$+0],n=e&2097151,a=e&2097152?this._combined[t]:n?Am(n):Fm;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function Bb(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=Wb(u,d,t),p=1,m=0;for(;p<u.length;){let e=Wb(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function Vb(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function Hb(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function Ub(e,t,n){let r=[],i=e.map((n,r)=>Wb(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=Wb(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function Wb(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var Gb=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new X),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ih(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Gb._nextId=1;var Kb=Gb,qb={},Jb=qb.B;qb[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},qb.A={"#":`£`},qb.B=void 0,qb[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},qb.C=qb[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},qb.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},qb.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},qb.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},qb.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},qb.E=qb[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},qb.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},qb.H=qb[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},qb[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var Yb=4294967295,Xb=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ib.clone(),this.savedCharset=Jb,this.markers=[],this._nullCell=Rm.fromCharData([0,Pm,1,0]),this._whitespaceCell=Rm.fromCharData([0,Fm,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new qy,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Fb(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 Lm),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 Lm),this._whitespaceCell}getBlankLine(e,t){return new zb(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>Yb?Yb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Ib);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 Fb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Ib),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)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 zb(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new zb(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),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 t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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 n=this._optionsService.rawOptions.reflowCursorLine,r=Bb(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Ib),n);if(r.length>0){let n=Vb(this.lines,r);Hb(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Ib),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new zb(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Ib),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=Ub(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(Ib,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=Wb(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->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+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(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 Kb(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Zb=class extends Y{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new X),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 Xb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Xb(!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)}},Qb=2,$b=1,ex=class extends Y{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Qb),this.rows=Math.max(e.rawOptions.rows||0,$b),this.buffers=this._register(new Zb(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};ex=vm([J(0,Zm)],ex);var tx={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:Ry,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},nx=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],rx=class extends Y{constructor(e){super(),this._onOptionChange=this._register(new X),this.onOptionChange=this._onOptionChange.event;let t={...tx};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Rh(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in tx))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in tx))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=tx[e],!ix(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=tx[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=nx.includes(t)?t:tx[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw 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 Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function ix(e){return e===`block`||e===`underline`||e===`bar`}function ax(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&ax(e[r],t-1);return n}var ox=Object.freeze({insertMode:!1}),sx=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),cx=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new X),this.onData=this._onData.event,this._onUserInput=this._register(new X),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new X),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ax(ox),this.decPrivateModes=ax(sx)}reset(){this.modes=ax(ox),this.decPrivateModes=ax(sx)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};cx=vm([J(0,Gm),J(1,Xm),J(2,Zm)],cx);var lx={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 ux(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var dx=String.fromCharCode,fx={DEFAULT:e=>{let t=[ux(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${dx(t[0])}${dx(t[1])}${dx(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${ux(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${ux(e,!0)};${e.x};${e.y}${t}`}},px=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new X),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(lx))this.addProtocol(e,lx[e]);for(let e of Object.keys(fx))this.addEncoding(e,fx[e]);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 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 Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_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,n){if(n){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)}};px=vm([J(0,Gm),J(1,qm),J(2,Zm)],px);var mx=[[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]],hx=[[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]],gx;function _x(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var vx=class{constructor(){if(this.version=`6`,!gx){gx=new Uint8Array(65536),gx.fill(1),gx[0]=0,gx.fill(0,1,32),gx.fill(0,127,160),gx.fill(2,4352,4448),gx[9001]=2,gx[9002]=2,gx.fill(2,11904,42192),gx[12351]=1,gx.fill(2,44032,55204),gx.fill(2,63744,64256),gx.fill(2,65040,65050),gx.fill(2,65072,65136),gx.fill(2,65280,65377),gx.fill(2,65504,65511);for(let e=0;e<mx.length;++e)gx.fill(0,mx[e][0],mx[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?gx[e]:_x(e,hx)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=yx.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return yx.createPropertyValue(0,n,r)}},yx=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new X,this.onChange=this._onChange.event;let e=new vx;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},bx=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 xx(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Sx=2147483647,Cx=256,wx=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>Cx)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(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 e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Sx?Sx:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>Sx?Sx:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,Sx):e}},Tx=[],Ex=class{constructor(){this._state=0,this._active=Tx,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=Tx}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=Tx,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Tx,!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,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,jm(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){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&&n-t>0&&this._put(e,t,n)}}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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Tx,this._id=-1,this._state=0}}},Dx=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=jm(e,t,n),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(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},Ox=[],kx=class{constructor(){this._handlers=Object.create(null),this._active=Ox,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ox}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=Ox,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ox,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,jm(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Ox,this._ident=0}},Ax=new wx;Ax.addParam(0);var jx=class{constructor(e){this._handler=e,this._data=``,this._params=Ax,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ax,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=jm(e,t,n),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(e=>(this._params=Ax,this._data=``,this._hitLimit=!1,e));return this._params=Ax,this._data=``,this._hitLimit=!1,t}},Mx=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},Nx=160,Px=function(){let e=new Mx(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Nx,0,2,0),e.add(Nx,8,5,8),e.add(Nx,6,0,6),e.add(Nx,11,0,11),e.add(Nx,13,13,13),e}(),Fx=class extends Y{constructor(e=Px){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 wx,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Rh(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Ex),this._dcsParser=this._register(new kx),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}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 n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:Nx)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<Nx){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Nx){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Nx){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Nx){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<Nx){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=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 i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<Nx){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},Ix=/^([\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})$/,Lx=/^[\da-f]+$/;function Rx(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=Ix.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),Lx.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function zx(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function Bx(e,t=16){let[n,r,i]=e;return`rgb:${zx(n,t)}/${zx(r,t)}/${zx(i,t)}`}var Vx={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Hx=131072,Ux=10;function Wx(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 Gx=5e3,Kx=0,qx=class extends Y{constructor(e,t,n,r,i,a,o,s,c=new Fx){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Mm,this._utf8Decoder=new Nm,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ib.clone(),this._eraseAttrDataInternal=Ib.clone(),this._onRequestBell=this._register(new X),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new X),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new X),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new X),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new X),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new X),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new X),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new X),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new X),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 Jx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Q.BEL,()=>this.bell()),this._parser.setExecuteHandler(Q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Q.BS,()=>this.backspace()),this._parser.setExecuteHandler(Q.HT,()=>this.tab()),this._parser.setExecuteHandler(Q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Rv.IND,()=>this.index()),this._parser.setExecuteHandler(Rv.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Rv.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Dx(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Dx(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Dx(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Dx(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Dx(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Dx(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Dx(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Dx(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Dx(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Dx(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Dx(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Dx(e=>this.restoreCursorColor(e))),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 e in qb)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new jx((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),Gx))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${Gx} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Hx&&(a=this._parseStack.position+Hx)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Hx&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Hx))),o||this._dirtyRowTracker.clearRange(),e.length>Hx)for(let t=a;t<e.length;t+=Hx){let a=t+Hx<e.length?t+Hx:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=yx.extractWidth(t);let n=yx.extractShouldJoin(t),m=n?yx.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(Am(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof zb&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!Wx(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new jx(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Dx(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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.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,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,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 n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,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}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 n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,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(Ib));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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 n=e.params[0]||1,r=yx.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Q.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Q.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Q.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Q.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Q.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,Jb),this._charsetService.setgCharset(1,Jb),this._charsetService.setgCharset(2,Jb),this._charsetService.setgCharset(3,Jb);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){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Q.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Im.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_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=Ib.fg,e.bg=Ib.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,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Ib.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Ib.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Ib.fg&16777215,r.bg&=-67108864,r.bg|=Ib.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Q.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53: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=Ib.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 e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Wx(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(`${Q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Ux&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Ux&&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=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(Yx(n))if(r===`?`)t.push({type:0,index:n});else{let e=Rx(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Rx(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);Yx(r)&&t.push({type:2,index:r})}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,Jb),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(Vx[e[0]],qb[e[1]]||Jb),!0):(this.selectDefaultCharset(),!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=Ib.clone(),this._eraseAttrDataInternal=Ib.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 Rm;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Q.ESC}${e}${Q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Jx=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&&(Kx=e,e=t,t=Kx),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Jx=vm([J(0,Gm)],Jx);function Yx(e){return 0<=e&&e<256}var Xx=5e7,Zx=12,Qx=50,$x=class extends Y{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 X),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 n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Xx)throw 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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=Zx?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=Zx)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Qx&&(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()}},eS=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 n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};eS=vm([J(0,Gm)],eS);var tS=!1,nS=class extends Y{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Vh),this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onData=this._register(new X),this.onData=this._onData.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new X),this._instantiationService=new Ab,this.optionsService=this._register(new rx(e)),this._instantiationService.setService(Zm,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ex)),this._instantiationService.setService(Gm,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Nb)),this._instantiationService.setService(Xm,this._logService),this.coreService=this._register(this._instantiationService.createInstance(cx)),this._instantiationService.setService(qm,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(px)),this._instantiationService.setService(Km,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(yx)),this._instantiationService.setService($m,this.unicodeService),this._charsetService=this._instantiationService.createInstance(bx),this._instantiationService.setService(Jm,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(eS),this._instantiationService.setService(Qm,this._oscLinkService),this._inputHandler=this._register(new qx(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Jh.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Jh.forward(this._bufferService.onResize,this._onResize)),this._register(Jh.forward(this.coreService.onData,this._onData)),this._register(Jh.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 $x((e,t)=>this._inputHandler.parse(e,t))),this._register(Jh.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new X),this._onScroll.event(e=>{this._onScrollApi?.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&&!tS&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),tS=!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,Qb),t=Math.max(t,$b),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(xx.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(xx(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Rh(()=>{for(let t of e)t.dispose()})}}},rS={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 iS(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=Q.ESC+`OA`:i.key=Q.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=Q.ESC+`OD`:i.key=Q.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=Q.ESC+`OC`:i.key=Q.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=Q.ESC+`OB`:i.key=Q.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Q.DEL,e.altKey&&(i.key=Q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Q.ESC+`[Z`;break}i.key=Q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Q.ESC+Q.CR:Q.CR,i.cancel=!0;break;case 27:i.key=Q.ESC,e.altKey&&(i.key=Q.ESC+Q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`D`:t?i.key=Q.ESC+`OD`:i.key=Q.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`C`:t?i.key=Q.ESC+`OC`:i.key=Q.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`A`:t?i.key=Q.ESC+`OA`:i.key=Q.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`B`:t?i.key=Q.ESC+`OB`:i.key=Q.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Q.ESC+`[2~`);break;case 46:a?i.key=Q.ESC+`[3;`+(a+1)+`~`:i.key=Q.ESC+`[3~`;break;case 36:a?i.key=Q.ESC+`[1;`+(a+1)+`H`:t?i.key=Q.ESC+`OH`:i.key=Q.ESC+`[H`;break;case 35:a?i.key=Q.ESC+`[1;`+(a+1)+`F`:t?i.key=Q.ESC+`OF`:i.key=Q.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Q.ESC+`[5;`+(a+1)+`~`:i.key=Q.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Q.ESC+`[6;`+(a+1)+`~`:i.key=Q.ESC+`[6~`;break;case 112:a?i.key=Q.ESC+`[1;`+(a+1)+`P`:i.key=Q.ESC+`OP`;break;case 113:a?i.key=Q.ESC+`[1;`+(a+1)+`Q`:i.key=Q.ESC+`OQ`;break;case 114:a?i.key=Q.ESC+`[1;`+(a+1)+`R`:i.key=Q.ESC+`OR`;break;case 115:a?i.key=Q.ESC+`[1;`+(a+1)+`S`:i.key=Q.ESC+`OS`;break;case 116:a?i.key=Q.ESC+`[15;`+(a+1)+`~`:i.key=Q.ESC+`[15~`;break;case 117:a?i.key=Q.ESC+`[17;`+(a+1)+`~`:i.key=Q.ESC+`[17~`;break;case 118:a?i.key=Q.ESC+`[18;`+(a+1)+`~`:i.key=Q.ESC+`[18~`;break;case 119:a?i.key=Q.ESC+`[19;`+(a+1)+`~`:i.key=Q.ESC+`[19~`;break;case 120:a?i.key=Q.ESC+`[20;`+(a+1)+`~`:i.key=Q.ESC+`[20~`;break;case 121:a?i.key=Q.ESC+`[21;`+(a+1)+`~`:i.key=Q.ESC+`[21~`;break;case 122:a?i.key=Q.ESC+`[23;`+(a+1)+`~`:i.key=Q.ESC+`[23~`;break;case 123:a?i.key=Q.ESC+`[24;`+(a+1)+`~`:i.key=Q.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Q.DEL:e.keyCode===219?i.key=Q.ESC:e.keyCode===220?i.key=Q.FS:e.keyCode===221&&(i.key=Q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=rS[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Q.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Q.ESC+n}else if(e.keyCode===32)i.key=Q.ESC+(e.ctrlKey?Q.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Q.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Q.US),e.key===`@`&&(i.key=Q.NUL));break}return i}var aS=0,oS=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new qy,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new qy,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((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,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||(aS=this._search(t),aS===-1)||this._getKey(this._array[aS])!==t)return!1;do if(this._array[aS]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(aS),!0;while(++aS<this._array.length&&this._getKey(this._array[aS])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,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&&(aS=this._search(e),!(aS<0||aS>=this._array.length)&&this._getKey(this._array[aS])===e))do yield this._array[aS];while(++aS<this._array.length&&this._getKey(this._array[aS])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(aS=this._search(e),!(aS<0||aS>=this._array.length)&&this._getKey(this._array[aS])===e))do t(this._array[aS]);while(++aS<this._array.length&&this._getKey(this._array[aS])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},sS=0,cS=0,lS=class extends Y{constructor(){super(),this._decorations=new oS(e=>e?.marker.line),this._onDecorationRegistered=this._register(new X),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new X),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Rh(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new uS(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.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,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{sS=t.options.x??0,cS=sS+(t.options.width??1),e>=sS&&e<cS&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},uS=class extends Bh{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new X),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new X),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=Jv.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Jv.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},dS=1e3,fS=class{constructor(e,t=dS){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_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)}},pS=20,mS=class extends Y{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new fS(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
105
- `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Z(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Rh(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<pS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
106
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===pS+1&&(this._liveRegion.textContent+=Sm.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}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(){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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);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){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};mS=vm([J(1,Ym),J(2,ih),J(3,oh)],mS);var hS=class extends Y{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new X),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new X),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Rh(()=>{Ih(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Z(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Z(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(Z(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(Z(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 n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.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){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&gS(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,Ih(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||e.link.decorations.underline,pointerCursor:e.link.decorations===void 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:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.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(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.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(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};hS=vm([J(1,ah),J(2,oh),J(3,Gm),J(4,uh)],hS);function gS(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 _S=class extends nS{constructor(e={}){super(e),this._linkifier=this._register(new Vh),this.browser=Ay,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Vh),this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new X),this.onKey=this._onKey.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new X),this.onBell=this._onBell.event,this._onFocus=this._register(new X),this._onBlur=this._register(new X),this._onA11yCharEmitter=this._register(new X),this._onA11yTabEmitter=this._register(new X),this._onWillOpen=this._register(new X),this._setup(),this._decorationService=this._instantiationService.createInstance(lS),this._instantiationService.setService(eh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Ty),this._instantiationService.setService(uh,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(th)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Jh.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Jh.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Jh.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Jh.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Rh(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.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 e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=qv.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Q.ESC}]${n};${Bx(r)}${zv.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=Kv.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=Kv.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(mS,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.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 n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(Z(this.element,`copy`,e=>{this.hasSelection()&&Tm(e,this._selectionService)}));let e=e=>Em(e,this.textarea,this.coreService,this.optionsService);this._register(Z(this.textarea,`paste`,e)),this._register(Z(this.element,`paste`,e)),Py?this._register(Z(this.element,`mousedown`,e=>{e.button===2&&km(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Z(this.element,`contextmenu`,e=>{km(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Hy&&this._register(Z(this.element,`auxclick`,e=>{e.button===1&&Om(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Z(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(Z(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(Z(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(Z(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(Z(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(Z(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(Z(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw 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`),this.element?.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(Z(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,bm.get()),Uy||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`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Cy,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(ih,this._coreBrowserService),this._register(Z(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(Z(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(yy,this._document,this._helperContainer),this._instantiationService.setService(rh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Db),this._instantiationService.setService(lh,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ey),this._instantiationService.setService(ch,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Yy,this.rows,this.screenElement)),this._instantiationService.setService(oh,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(Bv,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Oy),this._instantiationService.setService(ah,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(hS,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(jv,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(_b,this.element,this.screenElement,r)),this._instantiationService.setService(sh,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Jh.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Mv,this.screenElement)),this._register(Z(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(mS,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lv,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lv,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(vy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Z(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(Z(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.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){Dm(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 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 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,n){this._selectionService.setSelection(e,t,n)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.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 n=iS(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===Q.ETX||n.key===Q.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=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`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(vS(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){this._charSizeService?.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(Ib));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Q.ESC+`[I`):this.coreService.triggerDataEvent(Q.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function vS(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var yS=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},bS=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 Rm)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},xS=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 bS(t)}getNullCell(){return new Rm}},SS=class extends Y{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new X),this.onBufferChange=this._onBufferChange.event,this._normal=new xS(this._core.buffers.normal,`normal`),this._alternate=new xS(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 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)}},CS=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,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)}},wS=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}},TS=[`cols`,`rows`],ES=0,DS=class extends Y{constructor(e){super(),this._core=this._register(new _S(e)),this._addonManager=this._register(new yS),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(TS.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new CS(this._core),this._parser}get unicode(){return this._checkProposedApi(),new wS(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._register(new SS(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}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
107
- `,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 bm.get()},set promptLabel(e){bm.set(e)},get tooMuchOutput(){return Sm.get()},set tooMuchOutput(e){Sm.set(e)}}}_verifyIntegers(...e){for(ES of e)if(ES===1/0||isNaN(ES)||ES%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(ES of e)if(ES&&(ES===1/0||isNaN(ES)||ES%1!=0||ES<0))throw Error(`This API only accepts positive integers`)}},OS=250,kS=5e3,AS=8e3,jS=3e3;function MS(e){return`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}`}function NS(){return MS(window.location)}var PS=class{opts;ws=null;backoff=OS;reconnectTimer=null;connectTimer=null;stallTimer=null;disposed=!1;ended=!1;receivedData=!1;url;constructor(e){this.opts=e;let t=e.wsBase??NS();this.url=`${t.replace(/\/$/,``)}/ws/terminal/${encodeURIComponent(e.sessionId)}`}connect(){if(this.disposed||this.ended)return;this.clearTimer(),this.opts.onStatus(this.backoff===OS?`connecting`:`reconnecting`);let e=new WebSocket(this.url);e.binaryType=`arraybuffer`,this.ws=e,this.connectTimer=setTimeout(()=>{e.readyState===WebSocket.CONNECTING&&this.forceClose(e)},AS),e.onopen=()=>{this.clearConnectTimer(),this.receivedData&&(this.receivedData=!1,this.opts.onReset?.())},e.onmessage=e=>{typeof e.data==`string`?this.handleControl(e.data):(this.receivedData=!0,this.opts.onData(new Uint8Array(e.data)))},e.onclose=()=>{this.ws=null,this.clearConnectTimer(),this.clearStallTimer(),!(this.disposed||this.ended)&&(this.opts.onStatus(`reconnecting`),this.scheduleReconnect())},e.onerror=()=>{this.forceClose(e)}}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(new TextEncoder().encode(e)),this.watchForStall())}resize(e,t){this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(JSON.stringify({t:`resize`,cols:e,rows:t})),this.watchForStall())}dispose(){if(this.disposed=!0,this.clearTimer(),this.clearConnectTimer(),this.clearStallTimer(),this.ws){this.ws.onopen=null,this.ws.onclose=null,this.ws.onerror=null,this.ws.onmessage=null;try{this.ws.close()}catch{}this.ws=null}}handleControl(e){let t;try{t=JSON.parse(e)}catch{return}t.t===`status`&&(t.status===`live`?(this.backoff=OS,this.opts.onStatus(`live`)):t.status===`ended`&&(this.ended=!0,this.opts.onStatus(`ended`)))}watchForStall(){this.stallTimer===null&&(this.stallTimer=setTimeout(()=>{this.stallTimer=null;let e=this.ws;!e||e.readyState!==WebSocket.OPEN||e.bufferedAmount>0&&this.forceClose(e)},jS))}forceClose(e){try{e.close()}catch{}if(this.ws===e&&e.readyState===WebSocket.CLOSED){if(e.onclose=null,this.ws=null,this.disposed||this.ended)return;this.opts.onStatus(`reconnecting`),this.scheduleReconnect()}}scheduleReconnect(){this.clearTimer();let e=this.backoff;this.backoff=Math.min(this.backoff*2,kS),this.reconnectTimer=setTimeout(()=>this.connect(),e)}clearTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}clearConnectTimer(){this.connectTimer!==null&&(clearTimeout(this.connectTimer),this.connectTimer=null)}clearStallTimer(){this.stallTimer!==null&&(clearTimeout(this.stallTimer),this.stallTimer=null)}};function FS(e){if(e.key===`Enter`&&(e.shiftKey||e.ctrlKey)){if(e.type===`keydown`)return{intercept:!0,bytes:`\x1B\r`};if(e.type===`keypress`)return{intercept:!0,bytes:``}}return{intercept:!1}}var IS={background:`#07080b`,foreground:`#C9D1D9`,cursor:`#7c6cf6`,cursorAccent:`#07080b`,selectionBackground:`rgba(124,108,246,0.25)`};function LS({sessionId:e,wsBase:t}){let n=(0,k.useRef)(null),[r,i]=(0,k.useState)(`connecting`);(0,k.useEffect)(()=>{let r=n.current;if(!r)return;let a=new DS({theme:IS,fontFamily:`"JetBrains Mono Variable", "Cascadia Code", Consolas, monospace`,fontSize:12.5,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3}),o=new mm;a.loadAddon(o),a.open(r);let s=()=>{try{o.fit()}catch{}};s();let c=requestAnimationFrame(s),l;l=new PS({sessionId:e,wsBase:t,onData:e=>a.write(e),onReset:()=>a.reset(),onStatus:e=>{i(e),e===`live`&&l.resize(a.cols,a.rows)}});let u=a.onData(e=>l.send(e)),d=a.onResize(({cols:e,rows:t})=>l.resize(e,t));a.attachCustomKeyEventHandler(e=>{let t=FS(e);return t.intercept?(t.bytes&&l.send(t.bytes),!1):!0}),l.connect();let f=new ResizeObserver(()=>s());return f.observe(r),()=>{cancelAnimationFrame(c),f.disconnect(),u.dispose(),d.dispose(),l.dispose(),a.dispose()}},[e,t]);let a=r===`connecting`?{text:`connecting…`,tone:`dim`}:r===`reconnecting`?{text:`disconnected — reconnecting… keystrokes are dropped until the stream is back`,tone:`down`}:r===`ended`?{text:`session stream ended — relaunch or end the session above`,tone:`dim`}:null;return(0,A.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,background:`#07080b`,overflow:`hidden`,boxSizing:`border-box`,padding:`8px 2px 6px 10px`},children:[(0,A.jsx)(`div`,{ref:n,style:{width:`100%`,height:`100%`},"data-session-id":e}),a&&(0,A.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,fontFamily:`"Cascadia Code", "JetBrains Mono", Consolas, monospace`,fontSize:11,padding:`4px 10px`,pointerEvents:`none`,color:a.tone===`down`?`#F4594E`:`#8B949E`,background:a.tone===`down`?`rgba(244,89,78,0.10)`:`rgba(14,17,22,0.85)`,borderBottom:`1px solid ${a.tone===`down`?`rgba(244,89,78,0.4)`:`#1A2028`}`},children:a.text})]})}function RS({full:e,effective:t}){let{feature:n,sessions:r,docs:i}=e,a=[...r].reverse(),o=a.find(e=>e.status===`live`||e.status===`launching`)??a[0],s=i.find(e=>e.relPath.endsWith(`spec.md`)),c=n.mapped?i.find(e=>e.relPath.endsWith(`map.md`)):void 0,l=r.some(e=>e.status===`live`||e.status===`launching`),u=n.mapped&&n.phase===`spec`&&t===`spec`&&!l&&e.tickets.length===0,d=o&&o.status!==`ended`,f=n.mapped||t===`spec`;return(0,A.jsxs)(`div`,{className:`grill${f?` has-context`:``}`,children:[n.mapped&&(0,A.jsx)(HS,{full:e,relPath:c?.relPath}),t===`spec`&&(0,A.jsx)(zS,{featureId:n.id,relPath:s?.relPath}),(0,A.jsxs)(`div`,{className:`body-title`,style:{marginTop:f?18:0},children:[(0,A.jsx)(Bi,{children:`Session`}),(0,A.jsx)(`span`,{className:`body-hint`,children:`shape the idea with Claude — promote it when it feels concrete`})]}),d?(0,A.jsxs)(`div`,{className:`grill-panel`,children:[(0,A.jsxs)(`div`,{className:`grill-strip`,children:[(0,A.jsx)(`span`,{className:`grill-kind`,children:o.kind}),(0,A.jsx)(Gi,{status:o.status}),(0,A.jsx)(`span`,{className:`grill-live-label`,children:o.status===`launching`?`launching…`:`live`}),(0,A.jsx)(`span`,{className:`grill-strip-spacer`}),(0,A.jsx)(`span`,{className:`grill-sid`,title:o.ccSessionId??o.id,children:(o.ccSessionId??o.id).slice(0,8)}),(0,A.jsx)(um,{featureId:n.id,sessionId:o.id})]}),(0,A.jsx)(`div`,{className:`grill-term`,id:`grill-term`,children:(0,A.jsx)(dm,{label:`terminal`,children:(0,A.jsx)(LS,{sessionId:o.id})})})]}):o?(0,A.jsxs)(`div`,{className:`session-ended-card`,id:`grill-term`,children:[(0,A.jsx)(`span`,{className:`session-ended-dot`}),(0,A.jsxs)(`div`,{className:`session-ended-main`,children:[(0,A.jsx)(`div`,{className:`session-ended-title`,children:`Session ended`}),(0,A.jsx)(`div`,{className:`session-ended-sub`,children:`Decisions from this conversation were captured to Knowledge.`})]})]}):(0,A.jsx)(`div`,{className:`grill-panel`,children:(0,A.jsx)(Vi,{icon:(0,A.jsx)(wi,{size:16}),title:`No session yet`,hint:`Start a session from the bar above — you and Claude shape the idea here before any code is written.`})}),u&&(0,A.jsx)(BS,{featureId:n.id})]})}function zS({featureId:e,relPath:t}){let[n,r]=(0,k.useState)(!1);return t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`doc-card`,onClick:()=>r(!0),title:`View the spec`,children:[(0,A.jsx)(Ti,{size:14}),(0,A.jsx)(`span`,{className:`doc-card-title`,children:`Specification`}),(0,A.jsx)(`span`,{className:`doc-card-meta`,children:t.split(/[\\/]/).pop()}),(0,A.jsxs)(`span`,{className:`doc-card-open`,children:[`View`,(0,A.jsx)(Si,{size:11})]})]}),n&&(0,A.jsx)(Vp,{featureId:e,relPath:t,title:`Specification`,onClose:()=>r(!1)})]}):(0,A.jsxs)(`div`,{className:`doc-card is-empty`,children:[(0,A.jsx)(Ti,{size:14}),(0,A.jsx)(`span`,{className:`doc-card-title`,children:`Spec not written yet`}),(0,A.jsx)(`span`,{className:`doc-card-hint`,children:`continue the session to draft it`})]})}function BS({featureId:e}){let t=N.useUtils(),n=Ji(),r=N.feature.converge.useMutation({onSuccess:()=>{t.feature.get.invalidate({id:e}),t.feature.list.invalidate()},onError:e=>n.push(e.message)});return(0,A.jsxs)(`div`,{className:`converge-resume`,children:[(0,A.jsx)(`span`,{className:`converge-resume-text`,children:`The converge session ended before tickets were emitted.`}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,disabled:r.isPending,title:`Restart the converge session over map.md + decisions.md`,onClick:()=>r.mutate({featureId:e}),children:r.isPending?`Resuming…`:`Resume converge`})]})}var VS=[`Destination`,`Notes`,`Not yet specified`,`Out of scope`];function HS({full:e,relPath:t}){let n=e.feature.id,r=N.docs.read.useQuery({featureId:n,relPath:t??`map.md`},{enabled:!!t}),i=r.data?GS(r.data.content):{};return!t&&e.waypoints.length===0?(0,A.jsxs)(`div`,{className:`map-panel`,children:[(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(Bi,{children:`Map`}),(0,A.jsx)(`span`,{className:`body-hint`,children:`the destination and open questions, charted before diving in`})]}),(0,A.jsxs)(`div`,{className:`doc-card is-empty`,children:[(0,A.jsx)(Ti,{size:14}),(0,A.jsx)(`span`,{className:`doc-card-title`,children:`Not charted yet`}),(0,A.jsx)(`span`,{className:`doc-card-hint`,children:`the session writes the map as you explore the idea`})]})]}):(0,A.jsxs)(`div`,{className:`map-panel`,children:[(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(Bi,{children:`Map`}),(0,A.jsx)(`span`,{className:`body-hint`,children:`the destination and open questions, charted before diving in`})]}),r.isLoading&&(0,A.jsx)(F,{children:`loading map…`}),t&&(0,A.jsx)(`div`,{className:`map-sections`,children:VS.map(e=>{let t=i[e]?.trim();return(0,A.jsxs)(`section`,{className:`map-section`,children:[(0,A.jsx)(`div`,{className:`map-section-title`,children:e}),t?(0,A.jsx)(`div`,{className:`map-section-body`,children:t}):(0,A.jsx)(F,{children:`—`})]},e)})}),(0,A.jsx)(WS,{featureId:n,waypoints:e.waypoints,frontierIds:e.frontierIds,sessions:e.sessions}),(0,A.jsx)(US,{full:e,fog:i[`Not yet specified`]?.trim()})]})}function US({full:e,fog:t}){let{feature:n,gate:r}=e,i=N.useUtils(),a=Ji(),[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(``),u=N.feature.converge.useMutation({onSuccess:()=>{s(!1),l(``),i.feature.get.invalidate({id:n.id}),i.feature.list.invalidate()},onError:e=>a.push(e.message)});return n.phase!==`ideation`||r.next?.id!==`G1`?null:(0,A.jsxs)(`section`,{className:`converge-bar`,children:[t&&(0,A.jsxs)(`div`,{className:`converge-fog`,role:`note`,children:[(0,A.jsx)(`span`,{className:`converge-fog-icon`,"aria-hidden":`true`,children:`⚑`}),(0,A.jsxs)(`span`,{className:`converge-fog-text`,children:[`Fog remains — still not specified: `,t,`. You can converge anyway.`]})]}),r.satisfied?(0,A.jsx)(`button`,{type:`button`,className:`btn btn-solid converge-btn`,disabled:u.isPending,onClick:()=>u.mutate({featureId:n.id}),children:u.isPending?`Converging…`:`Converge`}):o?(0,A.jsxs)(`div`,{className:`converge-override`,children:[(0,A.jsx)(`input`,{className:`override-input`,placeholder:`reason to converge past open waypoints`,value:c,autoFocus:!0,onChange:e=>l(e.target.value)}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-solid`,disabled:!c.trim()||u.isPending,onClick:()=>u.mutate({featureId:n.id,overrideReason:c.trim()}),children:`Converge anyway`}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,onClick:()=>{s(!1),l(``)},children:`Cancel`})]}):(0,A.jsxs)(`div`,{className:`converge-blocked`,children:[(0,A.jsx)(F,{children:r.reason??`resolve the open waypoints to converge`}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,onClick:()=>s(!0),children:`Override & converge…`})]})]})}function WS({featureId:e,waypoints:t,frontierIds:n,sessions:r}){let i=N.useUtils(),a=Ji(),o=N.feature.workWaypoint.useMutation({onSuccess:()=>{i.feature.get.invalidate({id:e}),i.feature.list.invalidate()},onError:e=>a.push(e.message)}),s=r.some(e=>e.status===`live`||e.status===`launching`);if(t.length===0)return(0,A.jsx)(`div`,{className:`map-waypoints`,children:(0,A.jsx)(F,{children:`No waypoints yet — they appear here as the map takes shape.`})});let c=new Set(n),l=new Map(t.map(e=>[e.id,e])),u=new Map(t.map(e=>[e.seq,e])),d=e=>e.title,f=e=>e.originWaypointId?l.get(e.originWaypointId)?.title:void 0,p=e=>e.status===`resolved`||e.status===`dropped`,m=t.filter(e=>c.has(e.id)),h=t.filter(e=>e.status===`open`&&!c.has(e.id)),g=t.filter(e=>e.status===`claimed`),_=t.filter(p),v=({w:e})=>{let t=f(e);return t?(0,A.jsxs)(`div`,{className:`wp-lineage`,children:[`surfaced by `,t]}):null};return(0,A.jsxs)(`div`,{className:`map-waypoints`,children:[m.length>0&&(0,A.jsxs)(`section`,{className:`wp-group wp-group-frontier`,children:[(0,A.jsxs)(`div`,{className:`wp-group-title`,children:[`Frontier · `,m.length]}),m.map(t=>{let n=t.type===`research`,r=!n&&!!t.lastSessionId,i=!n&&s;return(0,A.jsxs)(`div`,{className:`wp wp-frontier`,children:[(0,A.jsx)(`span`,{className:`wp-type`,children:t.type}),(0,A.jsx)(`span`,{className:`wp-title`,children:t.title}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-solid wp-work`,disabled:i||o.isPending,title:n?`start an AFK research run on this waypoint`:i?`a session is already live on this feature — end or finish it before starting another`:r?`resume the previous session on this waypoint`:`claim this waypoint and open a session`,onClick:()=>o.mutate({featureId:e,waypointId:t.id}),children:r?`Resume`:`Work`}),(0,A.jsx)(v,{w:t})]},t.id)})]}),h.length>0&&(0,A.jsxs)(`section`,{className:`wp-group wp-group-blocked`,children:[(0,A.jsxs)(`div`,{className:`wp-group-title`,children:[`Blocked · `,h.length]}),h.map(e=>{let t=e.blockedBy.map(e=>u.get(e)).filter(e=>!!e&&!p(e)).map(d);return(0,A.jsxs)(`div`,{className:`wp wp-blocked`,children:[(0,A.jsx)(`span`,{className:`wp-type`,children:e.type}),(0,A.jsx)(`span`,{className:`wp-title`,children:e.title}),t.length>0&&(0,A.jsxs)(`span`,{className:`wp-blockers`,children:[`blocked by `,t.join(`, `)]}),(0,A.jsx)(v,{w:e})]},e.id)})]}),g.length>0&&(0,A.jsxs)(`section`,{className:`wp-group wp-group-claimed`,children:[(0,A.jsxs)(`div`,{className:`wp-group-title`,children:[`Claimed · `,g.length]}),g.map(e=>{let t=e.claimedBy?.startsWith(`run_`)??!1;return(0,A.jsxs)(`div`,{className:`wp wp-claimed`,children:[(0,A.jsx)(`span`,{className:`wp-pulse`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`wp-type`,children:e.type}),(0,A.jsx)(`span`,{className:`wp-title`,children:e.title}),t&&(0,A.jsx)(`span`,{className:`wp-run-note`,children:`researching…`}),(0,A.jsx)(v,{w:e})]},e.id)})]}),_.length>0&&(0,A.jsxs)(`details`,{className:`wp-group wp-group-done`,children:[(0,A.jsxs)(`summary`,{className:`wp-group-title`,children:[`Resolved / dropped · `,_.length]}),_.map(e=>(0,A.jsxs)(`div`,{className:`wp wp-done wp-${e.status}`,children:[(0,A.jsx)(`span`,{className:`wp-type`,children:e.status}),(0,A.jsx)(`span`,{className:`wp-title`,children:e.title}),e.summary&&(0,A.jsx)(`span`,{className:`wp-summary`,children:e.summary})]},e.id))]})]})}function GS(e){let t={},n=null,r=[],i=()=>{n!==null&&(t[n]=r.join(`
104
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),Uy&&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),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=fb(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=Dy(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-pb),pb),t/=pb,t/Math.abs(t)+Math.round(t*(mb-1)))}shouldForceSelection(e){return zy?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(),hb)}_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&&!(zy&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.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<gb&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=Qy(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={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=fb(n,this._bufferService.cols)}};vb=ym([J(3,Km),J(4,Jm),J(5,oh),J(6,Qm),J(7,sh),J(8,ah)],vb);var yb=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},bb=class{constructor(){this._color=new yb,this._css=new yb}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},xb=Object.freeze((()=>{let e=[Yv.toColor(`#2e3436`),Yv.toColor(`#cc0000`),Yv.toColor(`#4e9a06`),Yv.toColor(`#c4a000`),Yv.toColor(`#3465a4`),Yv.toColor(`#75507b`),Yv.toColor(`#06989a`),Yv.toColor(`#d3d7cf`),Yv.toColor(`#555753`),Yv.toColor(`#ef2929`),Yv.toColor(`#8ae234`),Yv.toColor(`#fce94f`),Yv.toColor(`#729fcf`),Yv.toColor(`#ad7fa8`),Yv.toColor(`#34e2e2`),Yv.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:qv.toCss(r,i,a),rgba:qv.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:qv.toCss(n,n,n),rgba:qv.toRgba(n,n,n)})}return e})()),Sb=Yv.toColor(`#ffffff`),Cb=Yv.toColor(`#000000`),wb=Yv.toColor(`#ffffff`),Tb=Cb,Eb={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Db=Sb,Ob=class extends Y{constructor(e){super(),this._optionsService=e,this._contrastCache=new bb,this._halfContrastCache=new bb,this._onChangeColors=this._register(new X),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Sb,background:Cb,cursor:wb,cursorAccent:Tb,selectionForeground:void 0,selectionBackgroundTransparent:Eb,selectionBackgroundOpaque:Jv.blend(Cb,Eb),selectionInactiveBackgroundTransparent:Eb,selectionInactiveBackgroundOpaque:Jv.blend(Cb,Eb),scrollbarSliderBackground:Jv.opacity(Sb,.2),scrollbarSliderHoverBackground:Jv.opacity(Sb,.4),scrollbarSliderActiveBackground:Jv.opacity(Sb,.5),overviewRulerBorder:Sb,ansi:xb.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=kb(e.foreground,Sb),t.background=kb(e.background,Cb),t.cursor=Jv.blend(t.background,kb(e.cursor,wb)),t.cursorAccent=Jv.blend(t.background,kb(e.cursorAccent,Tb)),t.selectionBackgroundTransparent=kb(e.selectionBackground,Eb),t.selectionBackgroundOpaque=Jv.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=kb(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Jv.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?kb(e.selectionForeground,Kv):void 0,t.selectionForeground===Kv&&(t.selectionForeground=void 0),Jv.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Jv.opacity(t.selectionBackgroundTransparent,.3)),Jv.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Jv.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=kb(e.scrollbarSliderBackground,Jv.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=kb(e.scrollbarSliderHoverBackground,Jv.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=kb(e.scrollbarSliderActiveBackground,Jv.opacity(t.foreground,.5)),t.overviewRulerBorder=kb(e.overviewRulerBorder,Db),t.ansi=xb.slice(),t.ansi[0]=kb(e.black,xb[0]),t.ansi[1]=kb(e.red,xb[1]),t.ansi[2]=kb(e.green,xb[2]),t.ansi[3]=kb(e.yellow,xb[3]),t.ansi[4]=kb(e.blue,xb[4]),t.ansi[5]=kb(e.magenta,xb[5]),t.ansi[6]=kb(e.cyan,xb[6]),t.ansi[7]=kb(e.white,xb[7]),t.ansi[8]=kb(e.brightBlack,xb[8]),t.ansi[9]=kb(e.brightRed,xb[9]),t.ansi[10]=kb(e.brightGreen,xb[10]),t.ansi[11]=kb(e.brightYellow,xb[11]),t.ansi[12]=kb(e.brightBlue,xb[12]),t.ansi[13]=kb(e.brightMagenta,xb[13]),t.ansi[14]=kb(e.brightCyan,xb[14]),t.ansi[15]=kb(e.brightWhite,xb[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=kb(e.extendedAnsi[r],xb[r+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 e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];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()}}};Ob=ym([J(0,Qm)],Ob);function kb(e,t){if(e!==void 0)try{return Yv.toColor(e)}catch{}return t}var Ab=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},jb=class{constructor(){this._services=new Ab,this._services.set(Xm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Um(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},Mb={trace:0,debug:1,info:2,warn:3,error:4,off:5},Nb=`xterm.js: `,Pb=class extends Y{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Fb=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Mb[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Nb)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Pb=ym([J(0,Qm)],Pb);var Fb,Ib=class extends Y{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new X),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new X),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new X),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];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 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,...n){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 t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},$=3,Lb=Object.freeze(new Lm),Rb=0,zb=2,Bb=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*$);let r=t||zm.fromCharData([0,Fm,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*$+0],n=t&2097151;return[this._data[e*$+1],t&2097152?this._combined[e]:n?jm(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*$+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*$+0]=e|2097152|t[2]<<22):this._data[e*$+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*$+0]>>22}hasWidth(e){return this._data[e*$+0]&12582912}getFg(e){return this._data[e*$+1]}getBg(e){return this._data[e*$+2]}hasContent(e){return this._data[e*$+0]&4194303}getCodePoint(e){let t=this._data[e*$+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*$+0]&2097152}getString(e){let t=this._data[e*$+0];return t&2097152?this._combined[e]:t&2097151?jm(t&2097151):``}isProtected(e){return this._data[e*$+2]&536870912}loadCell(e,t){return Rb=e*$,t.content=this._data[Rb+0],t.fg=this._data[Rb+1],t.bg=this._data[Rb+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*$+0]=t.content,this._data[e*$+1]=t.fg,this._data[e*$+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*$+0]=t|n<<22,this._data[e*$+1]=r.fg,this._data[e*$+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*$+0];r&2097152?this._combined[e]+=jm(t):r&2097151?(this._combined[e]=jm(r&2097151)+jm(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*$+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new zm;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new zm;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*zb<this._data.buffer.byteLength;let n=e*$;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*zb<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*zb<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303)return e+(this._data[e*$+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303||this._data[e*$+2]&50331648)return e+(this._data[e*$+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*$+0],n=e&2097151,a=e&2097152?this._combined[t]:n?jm(n):Im;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function Vb(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=Gb(u,d,t),p=1,m=0;for(;p<u.length;){let e=Gb(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function Hb(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function Ub(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function Wb(e,t,n){let r=[],i=e.map((n,r)=>Gb(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=Gb(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function Gb(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var Kb=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new X),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Lh(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Kb._nextId=1;var qb=Kb,Jb={},Yb=Jb.B;Jb[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},Jb.A={"#":`£`},Jb.B=void 0,Jb[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},Jb.C=Jb[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},Jb.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},Jb.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},Jb.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},Jb.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},Jb.E=Jb[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},Jb.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},Jb.H=Jb[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},Jb[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var Xb=4294967295,Zb=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Lb.clone(),this.savedCharset=Yb,this.markers=[],this._nullCell=zm.fromCharData([0,Fm,1,0]),this._whitespaceCell=zm.fromCharData([0,Im,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Jy,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ib(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 Rm),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 Rm),this._whitespaceCell}getBlankLine(e,t){return new Bb(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>Xb?Xb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Lb);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 Ib(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Lb),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)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 Bb(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Bb(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),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 t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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 n=this._optionsService.rawOptions.reflowCursorLine,r=Vb(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Lb),n);if(r.length>0){let n=Hb(this.lines,r);Ub(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Lb),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Bb(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Lb),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=Wb(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(Lb,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=Gb(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->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+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(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 qb(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Qb=class extends Y{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new X),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 Zb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Zb(!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)}},$b=2,ex=1,tx=class extends Y{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,$b),this.rows=Math.max(e.rawOptions.rows||0,ex),this.buffers=this._register(new Qb(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};tx=ym([J(0,Qm)],tx);var nx={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:zy,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},rx=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],ix=class extends Y{constructor(e){super(),this._onOptionChange=this._register(new X),this.onOptionChange=this._onOptionChange.event;let t={...nx};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(zh(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in nx))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in nx))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=nx[e],!ax(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=nx[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=rx.includes(t)?t:nx[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw 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 Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function ax(e){return e===`block`||e===`underline`||e===`bar`}function ox(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&ox(e[r],t-1);return n}var sx=Object.freeze({insertMode:!1}),cx=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),lx=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new X),this.onData=this._onData.event,this._onUserInput=this._register(new X),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new X),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ox(sx),this.decPrivateModes=ox(cx)}reset(){this.modes=ox(sx),this.decPrivateModes=ox(cx)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};lx=ym([J(0,Km),J(1,Zm),J(2,Qm)],lx);var ux={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 dx(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var fx=String.fromCharCode,px={DEFAULT:e=>{let t=[dx(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${fx(t[0])}${fx(t[1])}${fx(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${dx(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${dx(e,!0)};${e.x};${e.y}${t}`}},mx=class extends Y{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new X),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(ux))this.addProtocol(e,ux[e]);for(let e of Object.keys(px))this.addEncoding(e,px[e]);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 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 Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_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,n){if(n){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)}};mx=ym([J(0,Km),J(1,Jm),J(2,Qm)],mx);var hx=[[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]],gx=[[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]],_x;function vx(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var yx=class{constructor(){if(this.version=`6`,!_x){_x=new Uint8Array(65536),_x.fill(1),_x[0]=0,_x.fill(0,1,32),_x.fill(0,127,160),_x.fill(2,4352,4448),_x[9001]=2,_x[9002]=2,_x.fill(2,11904,42192),_x[12351]=1,_x.fill(2,44032,55204),_x.fill(2,63744,64256),_x.fill(2,65040,65050),_x.fill(2,65072,65136),_x.fill(2,65280,65377),_x.fill(2,65504,65511);for(let e=0;e<hx.length;++e)_x.fill(0,hx[e][0],hx[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?_x[e]:vx(e,gx)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=bx.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return bx.createPropertyValue(0,n,r)}},bx=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new X,this.onChange=this._onChange.event;let e=new yx;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},xx=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 Sx(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Cx=2147483647,wx=256,Tx=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>wx)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(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 e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Cx?Cx:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>Cx?Cx:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,Cx):e}},Ex=[],Dx=class{constructor(){this._state=0,this._active=Ex,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=Ex}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=Ex,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ex,!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,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,Mm(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){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&&n-t>0&&this._put(e,t,n)}}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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Ex,this._id=-1,this._state=0}}},Ox=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Mm(e,t,n),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(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},kx=[],Ax=class{constructor(){this._handlers=Object.create(null),this._active=kx,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=kx}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=kx,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||kx,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,Mm(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=kx,this._ident=0}},jx=new Tx;jx.addParam(0);var Mx=class{constructor(e){this._handler=e,this._data=``,this._params=jx,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():jx,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Mm(e,t,n),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(e=>(this._params=jx,this._data=``,this._hitLimit=!1,e));return this._params=jx,this._data=``,this._hitLimit=!1,t}},Nx=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},Px=160,Fx=function(){let e=new Nx(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Px,0,2,0),e.add(Px,8,5,8),e.add(Px,6,0,6),e.add(Px,11,0,11),e.add(Px,13,13,13),e}(),Ix=class extends Y{constructor(e=Fx){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 Tx,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(zh(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Dx),this._dcsParser=this._register(new Ax),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}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 n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:Px)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<Px){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Px){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Px){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Px){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<Px){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=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 i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<Px){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},Lx=/^([\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})$/,Rx=/^[\da-f]+$/;function zx(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=Lx.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),Rx.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function Bx(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function Vx(e,t=16){let[n,r,i]=e;return`rgb:${Bx(n,t)}/${Bx(r,t)}/${Bx(i,t)}`}var Hx={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ux=131072,Wx=10;function Gx(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 Kx=5e3,qx=0,Jx=class extends Y{constructor(e,t,n,r,i,a,o,s,c=new Ix){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Nm,this._utf8Decoder=new Pm,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Lb.clone(),this._eraseAttrDataInternal=Lb.clone(),this._onRequestBell=this._register(new X),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new X),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new X),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new X),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new X),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new X),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new X),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new X),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new X),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 Yx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Q.BEL,()=>this.bell()),this._parser.setExecuteHandler(Q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Q.BS,()=>this.backspace()),this._parser.setExecuteHandler(Q.HT,()=>this.tab()),this._parser.setExecuteHandler(Q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(zv.IND,()=>this.index()),this._parser.setExecuteHandler(zv.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(zv.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ox(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Ox(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Ox(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Ox(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Ox(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Ox(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Ox(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Ox(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Ox(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Ox(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Ox(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Ox(e=>this.restoreCursorColor(e))),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 e in Jb)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new Mx((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),Kx))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${Kx} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ux&&(a=this._parseStack.position+Ux)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ux&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ux))),o||this._dirtyRowTracker.clearRange(),e.length>Ux)for(let t=a;t<e.length;t+=Ux){let a=t+Ux<e.length?t+Ux:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=bx.extractWidth(t);let n=bx.extractShouldJoin(t),m=n?bx.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(jm(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof Bb&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!Gx(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Mx(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ox(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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.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,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,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 n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,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}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 n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,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(Lb));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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);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 n=e.params[0]||1,r=bx.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Q.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Q.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Q.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Q.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Q.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,Yb),this._charsetService.setgCharset(1,Yb),this._charsetService.setgCharset(2,Yb),this._charsetService.setgCharset(3,Yb);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){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Q.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Lm.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_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=Lb.fg,e.bg=Lb.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,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Lb.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Lb.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Lb.fg&16777215,r.bg&=-67108864,r.bg|=Lb.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Q.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53: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=Lb.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 e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Gx(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(`${Q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Wx&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Wx&&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=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(Xx(n))if(r===`?`)t.push({type:0,index:n});else{let e=zx(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=zx(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);Xx(r)&&t.push({type:2,index:r})}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,Yb),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(Hx[e[0]],Jb[e[1]]||Yb),!0):(this.selectDefaultCharset(),!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=Lb.clone(),this._eraseAttrDataInternal=Lb.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 zm;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Q.ESC}${e}${Q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Yx=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&&(qx=e,e=t,t=qx),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Yx=ym([J(0,Km)],Yx);function Xx(e){return 0<=e&&e<256}var Zx=5e7,Qx=12,$x=50,eS=class extends Y{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 X),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 n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Zx)throw 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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=Qx?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=Qx)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>$x&&(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()}},tS=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 n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};tS=ym([J(0,Km)],tS);var nS=!1,rS=class extends Y{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Hh),this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onData=this._register(new X),this.onData=this._onData.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new X),this._instantiationService=new jb,this.optionsService=this._register(new ix(e)),this._instantiationService.setService(Qm,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(tx)),this._instantiationService.setService(Km,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Pb)),this._instantiationService.setService(Zm,this._logService),this.coreService=this._register(this._instantiationService.createInstance(lx)),this._instantiationService.setService(Jm,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(mx)),this._instantiationService.setService(qm,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(bx)),this._instantiationService.setService(eh,this.unicodeService),this._charsetService=this._instantiationService.createInstance(xx),this._instantiationService.setService(Ym,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(tS),this._instantiationService.setService($m,this._oscLinkService),this._inputHandler=this._register(new Jx(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Yh.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Yh.forward(this._bufferService.onResize,this._onResize)),this._register(Yh.forward(this.coreService.onData,this._onData)),this._register(Yh.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 eS((e,t)=>this._inputHandler.parse(e,t))),this._register(Yh.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new X),this._onScroll.event(e=>{this._onScrollApi?.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&&!nS&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),nS=!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,$b),t=Math.max(t,ex),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(Sx.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Sx(this._bufferService),!1))),this._windowsWrappingHeuristics.value=zh(()=>{for(let t of e)t.dispose()})}}},iS={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 aS(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=Q.ESC+`OA`:i.key=Q.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=Q.ESC+`OD`:i.key=Q.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=Q.ESC+`OC`:i.key=Q.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=Q.ESC+`OB`:i.key=Q.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Q.DEL,e.altKey&&(i.key=Q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Q.ESC+`[Z`;break}i.key=Q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Q.ESC+Q.CR:Q.CR,i.cancel=!0;break;case 27:i.key=Q.ESC,e.altKey&&(i.key=Q.ESC+Q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`D`:t?i.key=Q.ESC+`OD`:i.key=Q.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`C`:t?i.key=Q.ESC+`OC`:i.key=Q.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`A`:t?i.key=Q.ESC+`OA`:i.key=Q.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=Q.ESC+`[1;`+(a+1)+`B`:t?i.key=Q.ESC+`OB`:i.key=Q.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Q.ESC+`[2~`);break;case 46:a?i.key=Q.ESC+`[3;`+(a+1)+`~`:i.key=Q.ESC+`[3~`;break;case 36:a?i.key=Q.ESC+`[1;`+(a+1)+`H`:t?i.key=Q.ESC+`OH`:i.key=Q.ESC+`[H`;break;case 35:a?i.key=Q.ESC+`[1;`+(a+1)+`F`:t?i.key=Q.ESC+`OF`:i.key=Q.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Q.ESC+`[5;`+(a+1)+`~`:i.key=Q.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Q.ESC+`[6;`+(a+1)+`~`:i.key=Q.ESC+`[6~`;break;case 112:a?i.key=Q.ESC+`[1;`+(a+1)+`P`:i.key=Q.ESC+`OP`;break;case 113:a?i.key=Q.ESC+`[1;`+(a+1)+`Q`:i.key=Q.ESC+`OQ`;break;case 114:a?i.key=Q.ESC+`[1;`+(a+1)+`R`:i.key=Q.ESC+`OR`;break;case 115:a?i.key=Q.ESC+`[1;`+(a+1)+`S`:i.key=Q.ESC+`OS`;break;case 116:a?i.key=Q.ESC+`[15;`+(a+1)+`~`:i.key=Q.ESC+`[15~`;break;case 117:a?i.key=Q.ESC+`[17;`+(a+1)+`~`:i.key=Q.ESC+`[17~`;break;case 118:a?i.key=Q.ESC+`[18;`+(a+1)+`~`:i.key=Q.ESC+`[18~`;break;case 119:a?i.key=Q.ESC+`[19;`+(a+1)+`~`:i.key=Q.ESC+`[19~`;break;case 120:a?i.key=Q.ESC+`[20;`+(a+1)+`~`:i.key=Q.ESC+`[20~`;break;case 121:a?i.key=Q.ESC+`[21;`+(a+1)+`~`:i.key=Q.ESC+`[21~`;break;case 122:a?i.key=Q.ESC+`[23;`+(a+1)+`~`:i.key=Q.ESC+`[23~`;break;case 123:a?i.key=Q.ESC+`[24;`+(a+1)+`~`:i.key=Q.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Q.DEL:e.keyCode===219?i.key=Q.ESC:e.keyCode===220?i.key=Q.FS:e.keyCode===221&&(i.key=Q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=iS[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Q.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Q.ESC+n}else if(e.keyCode===32)i.key=Q.ESC+(e.ctrlKey?Q.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Q.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Q.US),e.key===`@`&&(i.key=Q.NUL));break}return i}var oS=0,sS=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Jy,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Jy,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((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,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||(oS=this._search(t),oS===-1)||this._getKey(this._array[oS])!==t)return!1;do if(this._array[oS]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(oS),!0;while(++oS<this._array.length&&this._getKey(this._array[oS])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,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&&(oS=this._search(e),!(oS<0||oS>=this._array.length)&&this._getKey(this._array[oS])===e))do yield this._array[oS];while(++oS<this._array.length&&this._getKey(this._array[oS])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(oS=this._search(e),!(oS<0||oS>=this._array.length)&&this._getKey(this._array[oS])===e))do t(this._array[oS]);while(++oS<this._array.length&&this._getKey(this._array[oS])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},cS=0,lS=0,uS=class extends Y{constructor(){super(),this._decorations=new sS(e=>e?.marker.line),this._onDecorationRegistered=this._register(new X),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new X),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(zh(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new dS(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.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,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{cS=t.options.x??0,lS=cS+(t.options.width??1),e>=cS&&e<lS&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},dS=class extends Vh{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new X),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new X),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=Yv.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Yv.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},fS=1e3,pS=class{constructor(e,t=fS){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_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)}},mS=20,hS=class extends Y{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new pS(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
105
+ `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Z(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(zh(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<mS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
106
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===mS+1&&(this._liveRegion.textContent+=Cm.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}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(){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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);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){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};hS=ym([J(1,Xm),J(2,ah),J(3,sh)],hS);var gS=class extends Y{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new X),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new X),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(zh(()=>{Lh(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Z(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Z(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(Z(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(Z(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 n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.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){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&_S(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,Lh(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||e.link.decorations.underline,pointerCursor:e.link.decorations===void 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:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.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(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.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(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};gS=ym([J(1,oh),J(2,sh),J(3,Km),J(4,dh)],gS);function _S(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 vS=class extends rS{constructor(e={}){super(e),this._linkifier=this._register(new Hh),this.browser=jy,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Hh),this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new X),this.onKey=this._onKey.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new X),this.onBell=this._onBell.event,this._onFocus=this._register(new X),this._onBlur=this._register(new X),this._onA11yCharEmitter=this._register(new X),this._onA11yTabEmitter=this._register(new X),this._onWillOpen=this._register(new X),this._setup(),this._decorationService=this._instantiationService.createInstance(uS),this._instantiationService.setService(th,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Ey),this._instantiationService.setService(dh,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(nh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Yh.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Yh.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Yh.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Yh.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(zh(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.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 e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=Jv.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Q.ESC}]${n};${Vx(r)}${Bv.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=qv.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=qv.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(hS,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.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 n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(Z(this.element,`copy`,e=>{this.hasSelection()&&Em(e,this._selectionService)}));let e=e=>Dm(e,this.textarea,this.coreService,this.optionsService);this._register(Z(this.textarea,`paste`,e)),this._register(Z(this.element,`paste`,e)),Fy?this._register(Z(this.element,`mousedown`,e=>{e.button===2&&Am(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Z(this.element,`contextmenu`,e=>{Am(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Uy&&this._register(Z(this.element,`auxclick`,e=>{e.button===1&&km(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Z(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(Z(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(Z(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(Z(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(Z(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(Z(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(Z(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw 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`),this.element?.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(Z(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,xm.get()),Wy||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`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(wy,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(ah,this._coreBrowserService),this._register(Z(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(Z(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(by,this._document,this._helperContainer),this._instantiationService.setService(ih,this._charSizeService),this._themeService=this._instantiationService.createInstance(Ob),this._instantiationService.setService(uh,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ty),this._instantiationService.setService(lh,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Xy,this.rows,this.screenElement)),this._instantiationService.setService(sh,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(Vv,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ky),this._instantiationService.setService(oh,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(gS,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(Mv,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(vb,this.element,this.screenElement,r)),this._instantiationService.setService(ch,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Yh.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Nv,this.screenElement)),this._register(Z(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(hS,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Rv,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Rv,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(yy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Z(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(Z(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.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){Om(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 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 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,n){this._selectionService.setSelection(e,t,n)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.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 n=aS(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===Q.ETX||n.key===Q.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=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`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(yS(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){this._charSizeService?.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(Lb));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Q.ESC+`[I`):this.coreService.triggerDataEvent(Q.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function yS(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var bS=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},xS=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 zm)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},SS=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 xS(t)}getNullCell(){return new zm}},CS=class extends Y{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new X),this.onBufferChange=this._onBufferChange.event,this._normal=new SS(this._core.buffers.normal,`normal`),this._alternate=new SS(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 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)}},wS=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,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)}},TS=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}},ES=[`cols`,`rows`],DS=0,OS=class extends Y{constructor(e){super(),this._core=this._register(new vS(e)),this._addonManager=this._register(new bS),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(ES.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new wS(this._core),this._parser}get unicode(){return this._checkProposedApi(),new TS(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._register(new CS(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}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
107
+ `,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 xm.get()},set promptLabel(e){xm.set(e)},get tooMuchOutput(){return Cm.get()},set tooMuchOutput(e){Cm.set(e)}}}_verifyIntegers(...e){for(DS of e)if(DS===1/0||isNaN(DS)||DS%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(DS of e)if(DS&&(DS===1/0||isNaN(DS)||DS%1!=0||DS<0))throw Error(`This API only accepts positive integers`)}},kS=250,AS=5e3,jS=8e3,MS=3e3;function NS(e){return`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}`}function PS(){return NS(window.location)}var FS=class{opts;ws=null;backoff=kS;reconnectTimer=null;connectTimer=null;stallTimer=null;disposed=!1;ended=!1;receivedData=!1;url;constructor(e){this.opts=e;let t=e.wsBase??PS();this.url=`${t.replace(/\/$/,``)}/ws/terminal/${encodeURIComponent(e.sessionId)}`}connect(){if(this.disposed||this.ended)return;this.clearTimer(),this.opts.onStatus(this.backoff===kS?`connecting`:`reconnecting`);let e=new WebSocket(this.url);e.binaryType=`arraybuffer`,this.ws=e,this.connectTimer=setTimeout(()=>{e.readyState===WebSocket.CONNECTING&&this.forceClose(e)},jS),e.onopen=()=>{this.clearConnectTimer(),this.receivedData&&(this.receivedData=!1,this.opts.onReset?.())},e.onmessage=e=>{typeof e.data==`string`?this.handleControl(e.data):(this.receivedData=!0,this.opts.onData(new Uint8Array(e.data)))},e.onclose=()=>{this.ws=null,this.clearConnectTimer(),this.clearStallTimer(),!(this.disposed||this.ended)&&(this.opts.onStatus(`reconnecting`),this.scheduleReconnect())},e.onerror=()=>{this.forceClose(e)}}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(new TextEncoder().encode(e)),this.watchForStall())}resize(e,t){this.ws&&this.ws.readyState===WebSocket.OPEN&&(this.ws.send(JSON.stringify({t:`resize`,cols:e,rows:t})),this.watchForStall())}dispose(){if(this.disposed=!0,this.clearTimer(),this.clearConnectTimer(),this.clearStallTimer(),this.ws){this.ws.onopen=null,this.ws.onclose=null,this.ws.onerror=null,this.ws.onmessage=null;try{this.ws.close()}catch{}this.ws=null}}handleControl(e){let t;try{t=JSON.parse(e)}catch{return}t.t===`status`&&(t.status===`live`?(this.backoff=kS,this.opts.onStatus(`live`)):t.status===`ended`&&(this.ended=!0,this.opts.onStatus(`ended`)))}watchForStall(){this.stallTimer===null&&(this.stallTimer=setTimeout(()=>{this.stallTimer=null;let e=this.ws;!e||e.readyState!==WebSocket.OPEN||e.bufferedAmount>0&&this.forceClose(e)},MS))}forceClose(e){try{e.close()}catch{}if(this.ws===e&&e.readyState===WebSocket.CLOSED){if(e.onclose=null,this.ws=null,this.disposed||this.ended)return;this.opts.onStatus(`reconnecting`),this.scheduleReconnect()}}scheduleReconnect(){this.clearTimer();let e=this.backoff;this.backoff=Math.min(this.backoff*2,AS),this.reconnectTimer=setTimeout(()=>this.connect(),e)}clearTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}clearConnectTimer(){this.connectTimer!==null&&(clearTimeout(this.connectTimer),this.connectTimer=null)}clearStallTimer(){this.stallTimer!==null&&(clearTimeout(this.stallTimer),this.stallTimer=null)}};function IS(e){if(e.key===`Enter`&&(e.shiftKey||e.ctrlKey)){if(e.type===`keydown`)return{intercept:!0,bytes:`\x1B\r`};if(e.type===`keypress`)return{intercept:!0,bytes:``}}return{intercept:!1}}var LS={background:`#07080b`,foreground:`#C9D1D9`,cursor:`#7c6cf6`,cursorAccent:`#07080b`,selectionBackground:`rgba(124,108,246,0.25)`};function RS({sessionId:e,wsBase:t}){let n=(0,k.useRef)(null),[r,i]=(0,k.useState)(`connecting`);(0,k.useEffect)(()=>{let r=n.current;if(!r)return;let a=new OS({theme:LS,fontFamily:`"JetBrains Mono Variable", "Cascadia Code", Consolas, monospace`,fontSize:12.5,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3}),o=new hm;a.loadAddon(o),a.open(r);let s=()=>{try{o.fit()}catch{}};s();let c=requestAnimationFrame(s),l;l=new FS({sessionId:e,wsBase:t,onData:e=>a.write(e),onReset:()=>a.reset(),onStatus:e=>{i(e),e===`live`&&l.resize(a.cols,a.rows)}});let u=a.onData(e=>l.send(e)),d=a.onResize(({cols:e,rows:t})=>l.resize(e,t));a.attachCustomKeyEventHandler(e=>{let t=IS(e);return t.intercept?(t.bytes&&l.send(t.bytes),!1):!0}),l.connect();let f=new ResizeObserver(()=>s());return f.observe(r),()=>{cancelAnimationFrame(c),f.disconnect(),u.dispose(),d.dispose(),l.dispose(),a.dispose()}},[e,t]);let a=r===`connecting`?{text:`connecting…`,tone:`dim`}:r===`reconnecting`?{text:`disconnected — reconnecting… keystrokes are dropped until the stream is back`,tone:`down`}:r===`ended`?{text:`session stream ended — relaunch or end the session above`,tone:`dim`}:null;return(0,A.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,background:`#07080b`,overflow:`hidden`,boxSizing:`border-box`,padding:`8px 2px 6px 10px`},children:[(0,A.jsx)(`div`,{ref:n,style:{width:`100%`,height:`100%`},"data-session-id":e}),a&&(0,A.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,fontFamily:`"Cascadia Code", "JetBrains Mono", Consolas, monospace`,fontSize:11,padding:`4px 10px`,pointerEvents:`none`,color:a.tone===`down`?`#F4594E`:`#8B949E`,background:a.tone===`down`?`rgba(244,89,78,0.10)`:`rgba(14,17,22,0.85)`,borderBottom:`1px solid ${a.tone===`down`?`rgba(244,89,78,0.4)`:`#1A2028`}`},children:a.text})]})}function zS({featureId:e,sessions:t,className:n,showResume:r=!0}){let i=BS(t);return i?i.status===`ended`?(0,A.jsx)(HS,{featureId:e,session:i,showResume:r}):(0,A.jsxs)(`div`,{className:`grill-panel${n?` ${n}`:``}`,children:[(0,A.jsxs)(`div`,{className:`grill-strip`,children:[(0,A.jsx)(`span`,{className:`grill-kind`,children:i.kind}),(0,A.jsx)(Gi,{status:i.status}),(0,A.jsx)(`span`,{className:`grill-live-label`,children:i.status===`launching`?`launching…`:`live`}),(0,A.jsx)(`span`,{className:`grill-strip-spacer`}),(0,A.jsx)(`span`,{className:`grill-sid`,title:i.ccSessionId??i.id,children:(i.ccSessionId??i.id).slice(0,8)}),(0,A.jsx)(dm,{featureId:e,sessionId:i.id})]}),(0,A.jsx)(`div`,{className:`grill-term`,id:`grill-term`,children:(0,A.jsx)(fm,{label:`terminal`,children:(0,A.jsx)(RS,{sessionId:i.id})})})]}):null}function BS(e){let t=[...e].reverse();return t.find(e=>e.status===`live`||e.status===`launching`)??t.find(e=>e.status===`ended`&&!!e.ccSessionId)??t[0]}function VS(e){return!!e.ccSessionId&&e.kind!==`waypoint`}function HS({featureId:e,session:t,showResume:n}){let r=N.useUtils(),i=Ji(),a=N.feature.launchSession.useMutation({onSuccess:()=>{r.feature.get.invalidate({id:e}),r.feature.list.invalidate()},onError:e=>i.push(e.message)}),o=n&&VS(t);return(0,A.jsxs)(`div`,{className:`session-ended-card`,id:`grill-term`,children:[(0,A.jsx)(`span`,{className:`session-ended-dot`}),(0,A.jsxs)(`div`,{className:`session-ended-main`,children:[(0,A.jsx)(`div`,{className:`session-ended-title`,children:`Session ended`}),(0,A.jsx)(`div`,{className:`session-ended-sub`,children:o?`The conversation is still on disk — resume it to pick up where you left off.`:`Decisions from this conversation were captured to Knowledge.`})]}),o&&(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost session-ended-resume`,disabled:a.isPending,title:`resume the ${t.kind} conversation in a new terminal`,onClick:()=>a.mutate({featureId:e,kind:t.kind}),children:a.isPending?`Resuming…`:`Resume session`})]})}function US({full:e,effective:t}){let{feature:n,sessions:r,docs:i}=e,a=i.find(e=>e.relPath.endsWith(`spec.md`)),o=n.mapped?i.find(e=>e.relPath.endsWith(`map.md`)):void 0,s=r.some(e=>e.status===`live`||e.status===`launching`),c=n.mapped&&n.phase===`spec`&&t===`spec`&&!s&&e.tickets.length===0,l=n.mapped||t===`spec`;return(0,A.jsxs)(`div`,{className:`grill${l?` has-context`:``}`,children:[n.mapped&&(0,A.jsx)(qS,{full:e,relPath:o?.relPath}),t===`spec`&&(0,A.jsx)(WS,{featureId:n.id,relPath:a?.relPath}),(0,A.jsxs)(`div`,{className:`body-title`,style:{marginTop:l?18:0},children:[(0,A.jsx)(Bi,{children:`Session`}),(0,A.jsx)(`span`,{className:`body-hint`,children:`shape the idea with Claude — promote it when it feels concrete`})]}),r.length>0?(0,A.jsx)(zS,{featureId:n.id,sessions:r,showResume:!c}):(0,A.jsx)(`div`,{className:`grill-panel`,children:(0,A.jsx)(Vi,{icon:(0,A.jsx)(wi,{size:16}),title:`No session yet`,hint:`Start a session from the bar above — you and Claude shape the idea here before any code is written.`})}),c&&(0,A.jsx)(GS,{featureId:n.id})]})}function WS({featureId:e,relPath:t}){let[n,r]=(0,k.useState)(!1);return t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`doc-card`,onClick:()=>r(!0),title:`View the spec`,children:[(0,A.jsx)(Ti,{size:14}),(0,A.jsx)(`span`,{className:`doc-card-title`,children:`Specification`}),(0,A.jsx)(`span`,{className:`doc-card-meta`,children:t.split(/[\\/]/).pop()}),(0,A.jsxs)(`span`,{className:`doc-card-open`,children:[`View`,(0,A.jsx)(Si,{size:11})]})]}),n&&(0,A.jsx)(Hp,{featureId:e,relPath:t,title:`Specification`,onClose:()=>r(!1)})]}):(0,A.jsxs)(`div`,{className:`doc-card is-empty`,children:[(0,A.jsx)(Ti,{size:14}),(0,A.jsx)(`span`,{className:`doc-card-title`,children:`Spec not written yet`}),(0,A.jsx)(`span`,{className:`doc-card-hint`,children:`continue the session to draft it`})]})}function GS({featureId:e}){let t=N.useUtils(),n=Ji(),r=N.feature.converge.useMutation({onSuccess:()=>{t.feature.get.invalidate({id:e}),t.feature.list.invalidate()},onError:e=>n.push(e.message)});return(0,A.jsxs)(`div`,{className:`converge-resume`,children:[(0,A.jsx)(`span`,{className:`converge-resume-text`,children:`The converge session ended before tickets were emitted.`}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,disabled:r.isPending,title:`Restart the converge session over map.md + decisions.md`,onClick:()=>r.mutate({featureId:e}),children:r.isPending?`Resuming…`:`Resume converge`})]})}var KS=[`Destination`,`Notes`,`Not yet specified`,`Out of scope`];function qS({full:e,relPath:t}){let n=e.feature.id,r=N.docs.read.useQuery({featureId:n,relPath:t??`map.md`},{enabled:!!t}),i=r.data?XS(r.data.content):{};return!t&&e.waypoints.length===0?(0,A.jsxs)(`div`,{className:`map-panel`,children:[(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(Bi,{children:`Map`}),(0,A.jsx)(`span`,{className:`body-hint`,children:`the destination and open questions, charted before diving in`})]}),(0,A.jsxs)(`div`,{className:`doc-card is-empty`,children:[(0,A.jsx)(Ti,{size:14}),(0,A.jsx)(`span`,{className:`doc-card-title`,children:`Not charted yet`}),(0,A.jsx)(`span`,{className:`doc-card-hint`,children:`the session writes the map as you explore the idea`})]})]}):(0,A.jsxs)(`div`,{className:`map-panel`,children:[(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(Bi,{children:`Map`}),(0,A.jsx)(`span`,{className:`body-hint`,children:`the destination and open questions, charted before diving in`})]}),r.isLoading&&(0,A.jsx)(F,{children:`loading map…`}),t&&(0,A.jsx)(`div`,{className:`map-sections`,children:KS.map(e=>{let t=i[e]?.trim();return(0,A.jsxs)(`section`,{className:`map-section`,children:[(0,A.jsx)(`div`,{className:`map-section-title`,children:e}),t?(0,A.jsx)(`div`,{className:`map-section-body`,children:t}):(0,A.jsx)(F,{children:`—`})]},e)})}),(0,A.jsx)(YS,{featureId:n,waypoints:e.waypoints,frontierIds:e.frontierIds,sessions:e.sessions}),(0,A.jsx)(JS,{full:e,fog:i[`Not yet specified`]?.trim()})]})}function JS({full:e,fog:t}){let{feature:n,gate:r}=e,i=N.useUtils(),a=Ji(),[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(``),u=N.feature.converge.useMutation({onSuccess:()=>{s(!1),l(``),i.feature.get.invalidate({id:n.id}),i.feature.list.invalidate()},onError:e=>a.push(e.message)});return n.phase!==`ideation`||r.next?.id!==`G1`?null:(0,A.jsxs)(`section`,{className:`converge-bar`,children:[t&&(0,A.jsxs)(`div`,{className:`converge-fog`,role:`note`,children:[(0,A.jsx)(`span`,{className:`converge-fog-icon`,"aria-hidden":`true`,children:`⚑`}),(0,A.jsxs)(`span`,{className:`converge-fog-text`,children:[`Fog remains — still not specified: `,t,`. You can converge anyway.`]})]}),r.satisfied?(0,A.jsx)(`button`,{type:`button`,className:`btn btn-solid converge-btn`,disabled:u.isPending,onClick:()=>u.mutate({featureId:n.id}),children:u.isPending?`Converging…`:`Converge`}):o?(0,A.jsxs)(`div`,{className:`converge-override`,children:[(0,A.jsx)(`input`,{className:`override-input`,placeholder:`reason to converge past open waypoints`,value:c,autoFocus:!0,onChange:e=>l(e.target.value)}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-solid`,disabled:!c.trim()||u.isPending,onClick:()=>u.mutate({featureId:n.id,overrideReason:c.trim()}),children:`Converge anyway`}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,onClick:()=>{s(!1),l(``)},children:`Cancel`})]}):(0,A.jsxs)(`div`,{className:`converge-blocked`,children:[(0,A.jsx)(F,{children:r.reason??`resolve the open waypoints to converge`}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost`,onClick:()=>s(!0),children:`Override & converge…`})]})]})}function YS({featureId:e,waypoints:t,frontierIds:n,sessions:r}){let i=N.useUtils(),a=Ji(),o=N.feature.workWaypoint.useMutation({onSuccess:()=>{i.feature.get.invalidate({id:e}),i.feature.list.invalidate()},onError:e=>a.push(e.message)}),s=r.some(e=>e.status===`live`||e.status===`launching`);if(t.length===0)return(0,A.jsx)(`div`,{className:`map-waypoints`,children:(0,A.jsx)(F,{children:`No waypoints yet — they appear here as the map takes shape.`})});let c=new Set(n),l=new Map(t.map(e=>[e.id,e])),u=new Map(t.map(e=>[e.seq,e])),d=e=>e.title,f=e=>e.originWaypointId?l.get(e.originWaypointId)?.title:void 0,p=e=>e.status===`resolved`||e.status===`dropped`,m=t.filter(e=>c.has(e.id)),h=t.filter(e=>e.status===`open`&&!c.has(e.id)),g=t.filter(e=>e.status===`claimed`),_=t.filter(p),v=({w:e})=>{let t=f(e);return t?(0,A.jsxs)(`div`,{className:`wp-lineage`,children:[`surfaced by `,t]}):null};return(0,A.jsxs)(`div`,{className:`map-waypoints`,children:[m.length>0&&(0,A.jsxs)(`section`,{className:`wp-group wp-group-frontier`,children:[(0,A.jsxs)(`div`,{className:`wp-group-title`,children:[`Frontier · `,m.length]}),m.map(t=>{let n=t.type===`research`,r=!n&&!!t.lastSessionId,i=!n&&s;return(0,A.jsxs)(`div`,{className:`wp wp-frontier`,children:[(0,A.jsx)(`span`,{className:`wp-type`,children:t.type}),(0,A.jsx)(`span`,{className:`wp-title`,children:t.title}),(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-solid wp-work`,disabled:i||o.isPending,title:n?`start an AFK research run on this waypoint`:i?`a session is already live on this feature — end or finish it before starting another`:r?`resume the previous session on this waypoint`:`claim this waypoint and open a session`,onClick:()=>o.mutate({featureId:e,waypointId:t.id}),children:r?`Resume`:`Work`}),(0,A.jsx)(v,{w:t})]},t.id)})]}),h.length>0&&(0,A.jsxs)(`section`,{className:`wp-group wp-group-blocked`,children:[(0,A.jsxs)(`div`,{className:`wp-group-title`,children:[`Blocked · `,h.length]}),h.map(e=>{let t=e.blockedBy.map(e=>u.get(e)).filter(e=>!!e&&!p(e)).map(d);return(0,A.jsxs)(`div`,{className:`wp wp-blocked`,children:[(0,A.jsx)(`span`,{className:`wp-type`,children:e.type}),(0,A.jsx)(`span`,{className:`wp-title`,children:e.title}),t.length>0&&(0,A.jsxs)(`span`,{className:`wp-blockers`,children:[`blocked by `,t.join(`, `)]}),(0,A.jsx)(v,{w:e})]},e.id)})]}),g.length>0&&(0,A.jsxs)(`section`,{className:`wp-group wp-group-claimed`,children:[(0,A.jsxs)(`div`,{className:`wp-group-title`,children:[`Claimed · `,g.length]}),g.map(e=>{let t=e.claimedBy?.startsWith(`run_`)??!1;return(0,A.jsxs)(`div`,{className:`wp wp-claimed`,children:[(0,A.jsx)(`span`,{className:`wp-pulse`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`wp-type`,children:e.type}),(0,A.jsx)(`span`,{className:`wp-title`,children:e.title}),t&&(0,A.jsx)(`span`,{className:`wp-run-note`,children:`researching…`}),(0,A.jsx)(v,{w:e})]},e.id)})]}),_.length>0&&(0,A.jsxs)(`details`,{className:`wp-group wp-group-done`,children:[(0,A.jsxs)(`summary`,{className:`wp-group-title`,children:[`Resolved / dropped · `,_.length]}),_.map(e=>(0,A.jsxs)(`div`,{className:`wp wp-done wp-${e.status}`,children:[(0,A.jsx)(`span`,{className:`wp-type`,children:e.status}),(0,A.jsx)(`span`,{className:`wp-title`,children:e.title}),e.summary&&(0,A.jsx)(`span`,{className:`wp-summary`,children:e.summary})]},e.id))]})]})}function XS(e){let t={},n=null,r=[],i=()=>{n!==null&&(t[n]=r.join(`
108
108
  `)),r.length=0};for(let t of e.split(`
109
- `)){let e=t.match(/^##\s+(.+?)\s*$/);e?(i(),n=e[1]):n!==null&&r.push(t)}return i(),t}function KS({full:e,driving:t}){let{feature:n,tickets:r,runs:i}=e,a=[...e.sessions].reverse().find(e=>e.status===`live`||e.status===`launching`),o=Op(Ip(n.id)),s=hp(i),c=r.length,l=r.filter(e=>e.status===`done`).length,u=r.filter(e=>e.status===`failed`).length,d=r.reduce((e,t)=>e+t.commits.length,0),f=t?.featureId===n.id,p=u>0?`var(--danger)`:`var(--ok)`,m=s?.status===`succeeded`?`var(--ok)`:s?.status===`failed`?`var(--danger)`:`var(--text-3)`;return(0,A.jsxs)(`div`,{className:`review-body`,children:[a&&(0,A.jsxs)(`div`,{className:`grill-panel review-session`,children:[(0,A.jsxs)(`div`,{className:`grill-strip`,children:[(0,A.jsx)(`span`,{className:`grill-kind`,children:a.kind}),(0,A.jsx)(Gi,{status:a.status}),(0,A.jsx)(`span`,{className:`grill-live-label`,children:a.status===`launching`?`launching…`:`live`}),(0,A.jsx)(`span`,{className:`grill-strip-spacer`}),(0,A.jsx)(`span`,{className:`grill-sid`,title:a.ccSessionId??a.id,children:(a.ccSessionId??a.id).slice(0,8)}),(0,A.jsx)(um,{featureId:n.id,sessionId:a.id})]}),(0,A.jsx)(`div`,{className:`grill-term`,id:`grill-term`,children:(0,A.jsx)(dm,{label:`terminal`,children:(0,A.jsx)(LS,{sessionId:a.id})})})]}),o&&(0,A.jsx)(qS,{featureId:n.id,branch:n.branch,conflict:o,sessionLive:!!a}),(0,A.jsxs)(`div`,{className:`review-grid`,children:[(0,A.jsxs)(`div`,{className:`review-card`,children:[(0,A.jsx)(Bi,{children:`Summary`}),(0,A.jsxs)(`div`,{className:`check-row`,children:[(0,A.jsx)(`span`,{className:`check-dot`,style:{background:p}}),(0,A.jsx)(`span`,{className:`check-k`,children:`tickets`}),(0,A.jsxs)(`span`,{className:`check-v`,children:[l,`/`,c,` done`,u>0?` · ${u} failed`:``]})]}),(0,A.jsxs)(`div`,{className:`check-row`,children:[(0,A.jsx)(`span`,{className:`check-dot`,style:{background:m}}),(0,A.jsx)(`span`,{className:`check-k`,children:`run`}),(0,A.jsx)(`span`,{className:`check-v`,children:s?`${s.status}${s.summary?` · ${s.summary}`:``}`:`no run recorded`})]}),(0,A.jsxs)(`div`,{className:`check-row`,children:[(0,A.jsx)(`span`,{className:`check-dot`,style:{background:`var(--ph-shipped)`}}),(0,A.jsx)(`span`,{className:`check-k`,children:`changes`}),(0,A.jsxs)(`span`,{className:`check-v`,children:[d,` commit`,d===1?``:`s`]})]}),(0,A.jsx)(`div`,{className:`review-foot`,children:n.branch})]}),(0,A.jsxs)(`div`,{className:`review-card`,children:[(0,A.jsx)(Bi,{children:`Test drive`}),f&&t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`drive-live`,children:[(0,A.jsx)(`span`,{className:`drive-pulse`}),(0,A.jsx)(`span`,{className:`drive-label`,children:`driving now`}),(0,A.jsx)(`span`,{className:`drive-loc`,children:t.branch})]}),(0,A.jsx)(`div`,{className:`drive-copy`,children:`Click through the feature. When it feels right, merge — or stop the drive and send feedback back through tickets.`})]}):(0,A.jsx)(`div`,{className:`drive-copy`,children:`Nothing is running yet. Start the test drive from the next step to boot this branch on its own port and click through the feature yourself — the merge gate wants a human behind the wheel.`})]})]}),f&&(0,A.jsx)(JS,{featureId:n.id})]})}function qS({featureId:e,branch:t,conflict:n,sessionLive:r}){let i=N.useUtils(),a=Ji(),o=N.feature.launchSession.useMutation({onSuccess:()=>void i.feature.get.invalidate({id:e}),onError:e=>a.push(e.message)});return(0,A.jsxs)(`div`,{className:`review-card conflict-card`,children:[(0,A.jsx)(Bi,{children:`Merge conflict`}),(0,A.jsxs)(`div`,{className:`drive-copy`,children:[`Merging `,(0,A.jsx)(`code`,{children:n.base}),` into `,(0,A.jsx)(`code`,{children:t}),` hit conflicts. An agent can merge the base into this branch in the talk worktree, resolve with full spec context, and commit — then retry Merge & ship.`]}),n.files.length>0&&(0,A.jsx)(`ul`,{className:`conflict-files`,children:n.files.map(e=>(0,A.jsx)(`li`,{children:e},e))}),!r&&(0,A.jsx)(P,{variant:`solid`,className:`conflict-resolve`,disabled:o.isPending,onClick:()=>o.mutate({featureId:e,kind:`revisit`,kickoffLine:Dp(n.base,t,n.files)}),children:`Resolve with agent`})]})}function JS({featureId:e}){let[t,n]=(0,k.useState)(!1),r=N.feature.driveInfo.useQuery(void 0,{refetchInterval:1500}).data;return!r||r.featureId!==e?null:(0,A.jsxs)(`div`,{className:`drive-pane`,children:[(0,A.jsxs)(`div`,{className:`drive-pane-strip`,children:[(0,A.jsx)(`span`,{className:`drive-pane-kind`,children:`dev server`}),(0,A.jsx)(`span`,{className:`drive-pane-loc`,children:r.branch}),(0,A.jsx)(`span`,{className:`drive-pane-spacer`}),r.devUrl&&(0,A.jsx)(`a`,{className:`drive-open`,href:r.devUrl,target:`_blank`,rel:`noreferrer noopener`,children:`Open app ↗`}),r.devPaneId&&(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost drive-pane-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:t?`Hide output`:`Show output`})]}),t&&(r.devPaneId?(0,A.jsx)(`div`,{className:`drive-pane-term`,children:(0,A.jsx)(dm,{label:`dev terminal`,children:(0,A.jsx)(LS,{sessionId:r.devPaneId})})}):(0,A.jsx)(`div`,{className:`drive-pane-empty`,children:`no dev command configured for this project`}))]})}function YS({full:e}){let t=[...Ip(e.feature.id)].reverse().find(e=>e.type===`feature.shipped`||e.type===`merge.conflict`||e.type===`feature.status`),n=t&&t.type===`feature.shipped`?zp(t.ts):``;return(0,A.jsxs)(`div`,{className:`shipped-hero`,children:[(0,A.jsx)(`div`,{className:`shipped-check`,children:(0,A.jsx)(bi,{size:17})}),(0,A.jsx)(`div`,{className:`shipped-title`,children:`Shipped to main`}),(0,A.jsxs)(`div`,{className:`shipped-meta`,children:[(0,A.jsx)(gi,{size:12}),e.feature.branch,n?` · merged ${n} ago`:``]}),(0,A.jsx)(`div`,{className:`shipped-sub`,children:`The branch is merged and the pipeline is complete. The full history lives in the Activity tab.`})]})}function XS({featureId:e,readonly:t=!1}){let n=Ji(),r=N.feature.get.useQuery({id:e},{refetchInterval:1500}),[i,a]=(0,k.useState)(()=>new Set),o=r.data?.feature.projectId,s=N.settings.get.useQuery({projectId:o},{enabled:!!o}),c=s.data?.fields.find(e=>e.key===`stepModels.implement`&&e.source===`file`)??s.data?.fields.find(e=>e.key===`model`),l=typeof c?.value==`string`?c.value:`…`;if(r.isLoading)return(0,A.jsx)(F,{children:`loading tickets…`});if(!r.data)return(0,A.jsxs)(F,{children:[`could not load tickets: `,r.error?.message??`unknown`]});let u=r.data.tickets,d=[...r.data.sessions].reverse().find(e=>e.status===`live`||e.status===`launching`),f=u.length,p=u.filter(e=>e.status===`done`).length,m=u.filter(e=>e.status===`failed`).length,h=u.filter(e=>e.status===`burning`).length,g=u.filter(e=>e.status===`cancelled`).length,_=[`${p}/${f} done`];m>0&&_.push(`${m} failed`),h>0&&_.push(`${h} burning`),g>0&&_.push(`${g} cancelled`);let v=_.join(` · `),y=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),b=e=>{navigator.clipboard.writeText(e),n.push(`copied ${Rp(e)}`,`info`)};return(0,A.jsxs)(A.Fragment,{children:[d&&(0,A.jsxs)(`div`,{className:`grill-panel tickets-session`,children:[(0,A.jsxs)(`div`,{className:`grill-strip`,children:[(0,A.jsx)(`span`,{className:`grill-kind`,children:d.kind}),(0,A.jsx)(Gi,{status:d.status}),(0,A.jsx)(`span`,{className:`grill-live-label`,children:d.status===`launching`?`launching…`:`live`}),(0,A.jsx)(`span`,{className:`grill-strip-spacer`}),(0,A.jsx)(`span`,{className:`grill-sid`,title:d.ccSessionId??d.id,children:(d.ccSessionId??d.id).slice(0,8)}),(0,A.jsx)(um,{featureId:e,sessionId:d.id})]}),(0,A.jsx)(`div`,{className:`grill-term`,id:`grill-term`,children:(0,A.jsx)(dm,{label:`terminal`,children:(0,A.jsx)(LS,{sessionId:d.id})})})]}),(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(Bi,{children:`Tickets`}),(0,A.jsx)(`span`,{className:`body-meta`,children:v}),(0,A.jsx)(`span`,{style:{flex:1}}),(0,A.jsxs)(`span`,{className:`chip chip-neutral`,title:`sandbox`,children:[`sandbox · `,sm]}),(0,A.jsx)(`span`,{className:`chip chip-neutral`,title:`model`,children:l})]}),f===0?(0,A.jsx)(`div`,{className:`ledger`,children:(0,A.jsx)(Vi,{icon:(0,A.jsx)(Ti,{size:16}),title:`No tickets yet`,hint:`A session breaks the spec into atomic, reviewable tickets — start one from the bar above.`,compact:!0})}):(0,A.jsx)(`div`,{className:`ledger`,children:u.map(e=>{let t=i.has(e.id);return(0,A.jsxs)(`div`,{className:`ledger-row${t?` is-open`:``}`,children:[(0,A.jsxs)(`button`,{className:`ledger-head`,onClick:()=>y(e.id),children:[(0,A.jsx)(`span`,{className:`lg-caret`,children:(0,A.jsx)(Si,{size:11})}),(0,A.jsxs)(`span`,{className:`lg-seq`,children:[`#`,e.seq]}),(0,A.jsx)(`span`,{className:`lg-title`,children:e.title}),e.blockedBy.length>0&&(0,A.jsxs)(`span`,{className:`lg-block`,title:`Runs after these tickets land`,children:[`after #`,e.blockedBy.join(`, #`)]}),(0,A.jsx)(`span`,{className:`lg-meta`,children:(0,A.jsx)(Ui,{status:e.status})})]}),t&&(0,A.jsxs)(`div`,{className:`ledger-detail`,children:[(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`GOAL`}),(0,A.jsx)(`div`,{className:`td-body`,children:e.goal})]}),e.context&&(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`CONTEXT`}),(0,A.jsx)(`div`,{className:`td-body`,children:e.context})]}),(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`ACCEPTANCE`}),(0,A.jsx)(`ul`,{className:`td-list`,children:e.acceptanceCriteria.map((e,t)=>(0,A.jsx)(`li`,{children:e},t))})]}),(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`SEAMS`}),(0,A.jsx)(`div`,{className:`td-seams`,children:e.seams.map((e,t)=>(0,A.jsx)(`span`,{className:`seam`,children:e},t))})]}),(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`COMMITS`}),e.commits.length===0?(0,A.jsx)(`div`,{className:`td-empty`,children:`no commits yet — the burn writes them`}):(0,A.jsx)(`div`,{className:`td-commits`,children:e.commits.map(e=>(0,A.jsx)(`button`,{className:`commit-sha`,onClick:()=>b(e),title:`copy full sha`,children:Rp(e)},e))})]}),e.status===`failed`&&e.error&&(0,A.jsxs)(`div`,{className:`td-section td-error`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`Error`}),(0,A.jsx)(`div`,{className:`td-error-body`,children:e.error})]}),e.status===`cancelled`&&e.error&&(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`Cancelled`}),(0,A.jsx)(`div`,{className:`td-body`,children:e.error})]})]})]},e.id)})})]})}function ZS({ticketId:e}){let{chunks:t,live:n,trimmed:r}=QS(e),i=(0,k.useRef)(null),[a,o]=(0,k.useState)(!0),s=(0,k.useMemo)(()=>$S(t),[t]);return(0,k.useEffect)(()=>{if(!a)return;let e=i.current;e&&(e.scrollTop=e.scrollHeight)},[s,n,a]),(0,A.jsxs)(`div`,{className:`agent-body`,ref:i,onScroll:()=>{let e=i.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<24;o(t)},children:[r&&(0,A.jsx)(`div`,{className:`agent-trimmed`,children:`… earlier output trimmed …`}),s.length===0&&!n&&(0,A.jsx)(F,{children:`no agent output captured — transcripts are held in server memory for the current burn; older runs keep only the event timeline.`}),s.length===0&&n&&(0,A.jsx)(F,{children:`waiting for the agent's first output…`}),s.map((e,t)=>e.kind===`text`?(0,A.jsxs)(`div`,{className:`agent-turn`,children:[(0,A.jsx)(`span`,{className:`agent-glyph is-text`,children:`⏺`}),(0,A.jsx)(`span`,{className:`agent-prose`,children:e.text})]},t):(0,A.jsxs)(`div`,{className:`agent-turn is-tool`,children:[(0,A.jsx)(`span`,{className:`agent-glyph is-tool`,children:`●`}),(0,A.jsxs)(`span`,{className:`agent-toolline`,children:[(0,A.jsx)(`span`,{className:`agent-toolname`,children:e.name}),e.args&&(0,A.jsxs)(`span`,{className:`agent-toolargs`,children:[`(`,e.args,`)`]})]})]},t)),n&&(0,A.jsxs)(`div`,{className:`agent-live-row`,children:[(0,A.jsx)(`span`,{className:`agent-spinner`,children:`✳`}),(0,A.jsx)(`span`,{className:`agent-live-label`,children:`Burning…`}),(0,A.jsx)(`span`,{className:`agent-cursor`,children:`▍`})]}),!a&&(0,A.jsx)(`button`,{className:`follow-pill agent-follow`,onClick:()=>o(!0),children:`Follow ⇣`})]})}function QS(e){let[t,n]=(0,k.useState)([]),[r,i]=(0,k.useState)(!1),[a,o]=(0,k.useState)(!1),s=t.length>0?t[t.length-1].i:void 0,c=N.run.agentTranscript.useQuery({ticketId:e,after:s},{refetchInterval:1e3});return(0,k.useEffect)(()=>{let e=c.data;e&&(i(e.live),o(e.firstIndex>0),n(t=>{let n=t.length>0?t[t.length-1].i:-1;if(e.nextIndex<=n)return[];if(e.chunks.length===0)return t;let r=e.chunks.filter(e=>e.i>n);return r.length===0?t:[...t,...r]}))},[c.data]),{chunks:t,live:r,trimmed:a}}function $S(e){let t=[];for(let n of e){if(n.kind===`tool`){t.push({kind:`tool`,name:n.name??`tool`,args:eC(n.text)});continue}let e=t[t.length-1];e&&e.kind===`text`?e.text+=n.text:t.push({kind:`text`,text:n.text})}return t.map(e=>e.kind===`text`?{...e,text:e.text.trim()}:e).filter(e=>e.kind!==`text`||e.text.length>0)}function eC(e){let t=e.replace(/\s+/g,` `).trim();return t.length>300?`${t.slice(0,300)}…`:t}function tC({featureId:e,runId:t,readonly:n=!1}){let r=N.feature.get.useQuery({id:e},{refetchInterval:1500}),i=N.run.get.useQuery({runId:t},{refetchInterval:1500,enabled:!!t}),a=Ip(e),o=r.data?.tickets??[],s=(0,k.useMemo)(()=>a.filter(e=>e.runId===t),[a,t]),c=(0,k.useMemo)(()=>aC(s),[s]),[l,u]=(0,k.useState)(null),[d,f]=(0,k.useState)(`agent`),p=o.find(e=>e.status===`burning`)??[...o].reverse().find(e=>e.status===`done`||e.status===`failed`),m=l??p?.id??null,h=o.find(e=>e.id===m)??null,g=o.filter(e=>e.status===`done`).length,_=o.length,v=i.data?Bp(i.data.startedAt,i.data.endedAt??Date.now()):``,y=[...r.data?.sessions??[]].reverse().find(e=>e.status===`live`||e.status===`launching`);return!t&&!y?(0,A.jsx)(`div`,{className:`surface`,children:(0,A.jsx)(Vi,{icon:(0,A.jsx)(wi,{size:16}),title:`No run yet`,hint:`Burning the tickets starts a run — one agent per ticket, each in its own lane.`})}):(0,A.jsxs)(`div`,{children:[y&&(0,A.jsxs)(`div`,{className:`grill-panel tickets-session`,children:[(0,A.jsxs)(`div`,{className:`grill-strip`,children:[(0,A.jsx)(`span`,{className:`grill-kind`,children:y.kind}),(0,A.jsx)(Gi,{status:y.status}),(0,A.jsx)(`span`,{className:`grill-live-label`,children:y.status===`launching`?`launching…`:`live`}),(0,A.jsx)(`span`,{className:`grill-strip-spacer`}),(0,A.jsx)(`span`,{className:`grill-sid`,title:y.ccSessionId??y.id,children:(y.ccSessionId??y.id).slice(0,8)}),(0,A.jsx)(um,{featureId:e,sessionId:y.id})]}),(0,A.jsx)(`div`,{className:`grill-term`,id:`grill-term`,children:(0,A.jsx)(dm,{label:`terminal`,children:(0,A.jsx)(LS,{sessionId:y.id})})})]}),(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(`span`,{className:`section-title`,children:`Run`}),i.data&&(0,A.jsx)(Wi,{status:i.data.status}),(0,A.jsxs)(`span`,{className:`body-meta`,children:[g,`/`,_,` done · `,v]})]}),(0,A.jsxs)(`div`,{className:`run-split`,children:[(0,A.jsxs)(`div`,{className:`run-lanes-panel`,children:[(0,A.jsx)(`div`,{className:`panel-cap`,children:`Ticket lanes`}),(0,A.jsxs)(`div`,{className:`run-lanes`,children:[o.length===0&&(0,A.jsx)(F,{children:`no ticket lanes`}),o.map(e=>(0,A.jsx)(nC,{ticket:e,duration:c.get(e.id),selected:e.id===m,readonly:n,onSelect:()=>{u(e.id),f(`agent`)}},e.id))]})]}),(0,A.jsxs)(`div`,{className:`run-stream-panel`,children:[(0,A.jsxs)(`div`,{className:`stream-head`,children:[(0,A.jsxs)(`div`,{className:`panel-tabs`,children:[(0,A.jsxs)(`button`,{className:`panel-tab${d===`agent`?` is-active`:``}`,onClick:()=>f(`agent`),children:[`Agent`,h&&(0,A.jsxs)(`span`,{className:`panel-tab-ctx`,children:[`#`,h.seq]})]}),(0,A.jsx)(`button`,{className:`panel-tab${d===`events`?` is-active`:``}`,onClick:()=>f(`events`),children:`Events`})]}),d===`agent`&&h?.status===`burning`&&(0,A.jsx)(`span`,{className:`agent-live-dot`,title:`agent running`})]}),d===`agent`?h?(0,A.jsx)(dm,{label:`agent transcript`,children:(0,A.jsx)(ZS,{ticketId:h.id},h.id)}):(0,A.jsx)(`div`,{className:`agent-body`,children:(0,A.jsx)(F,{children:`No agent yet — lanes light up here as tickets start burning.`})}):(0,A.jsx)(rC,{events:s})]})]})]})}function nC({ticket:e,duration:t,selected:n,readonly:r,onSelect:i}){let a=Ji(),o=N.useUtils(),s={onSuccess:()=>o.feature.get.invalidate({id:e.featureId}),onError:e=>a.push(e.message)},c=N.ticket.retry.useMutation(s),l=N.ticket.stop.useMutation(s),u=e=>{navigator.clipboard?.writeText(e).then(()=>a.push(`copied ${Rp(e)}`,`info`),()=>a.push(`copy failed`))},d=[`burning`,`done`,`failed`].includes(e.status)?` status-${e.status}`:``,f=e.commits.length>0,p=t!==void 0,m=e.status===`failed`?e.error?.split(`
110
- `)[0]:void 0,h=c.isPending||l.isPending;return(0,A.jsxs)(`div`,{className:`lane is-clickable${d}${n?` is-selected`:``}`,role:`button`,tabIndex:0,title:`show this ticket's agent`,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&i()},children:[(0,A.jsxs)(`div`,{className:`lane-head`,children:[(0,A.jsxs)(`span`,{className:`lane-seq`,children:[`#`,e.seq]}),(0,A.jsx)(`span`,{className:`lane-title`,children:e.title}),(0,A.jsx)(Ui,{status:e.status})]}),m&&(0,A.jsx)(`div`,{className:`lane-error`,title:e.error,children:m}),!r&&e.status===`failed`&&(0,A.jsxs)(`div`,{className:`lane-actions`,children:[(0,A.jsx)(`button`,{className:`lane-btn`,disabled:h,title:`retry this ticket — continues from any commits preserved by previous attempts`,onClick:t=>{t.stopPropagation(),c.mutate({ticketId:e.id},{onSuccess:t=>{t.resumedFrom&&a.push(`resuming ticket #${e.seq} from ${t.preservedCommits} preserved commit(s)`,`info`)}})},children:`Retry`}),(0,A.jsx)(`button`,{className:`lane-btn lane-btn-danger`,disabled:h,title:`discard any preserved commits from previous attempts and redo the ticket from the feature branch tip`,onClick:t=>{t.stopPropagation(),confirm(`Discard ticket #${e.seq}'s preserved work (if any) and start over?`)&&c.mutate({ticketId:e.id,fresh:!0})},children:`Retry fresh`})]}),!r&&e.status===`burning`&&(0,A.jsx)(`div`,{className:`lane-actions`,children:(0,A.jsx)(`button`,{className:`lane-btn lane-btn-danger`,disabled:h,title:`stop this ticket's agent — other lanes keep burning; committed work is preserved for retry`,onClick:t=>{t.stopPropagation(),l.mutate({ticketId:e.id},{onSuccess:e=>{e.stopped||a.push(`no live agent for this ticket (already finishing?)`,`info`)}})},children:`Stop ticket`})}),(f||p)&&(0,A.jsxs)(`div`,{className:`lane-foot`,children:[(0,A.jsx)(`span`,{className:`lane-commits`,children:e.commits.map(e=>(0,A.jsx)(`button`,{className:`commit-sha`,onClick:t=>{t.stopPropagation(),u(e)},title:`copy sha`,children:Rp(e)},e))}),p&&(0,A.jsx)(`span`,{className:`lane-dur`,children:Bp(0,t)})]})]})}function rC({events:e}){let t=(0,k.useRef)(null),[n,r]=(0,k.useState)(!0);return(0,k.useEffect)(()=>{if(!n)return;let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[e,n]),(0,A.jsxs)(`div`,{className:`stream-body`,ref:t,onScroll:()=>{let e=t.current;if(!e)return;let n=e.scrollHeight-e.scrollTop-e.clientHeight<24;r(n)},children:[e.length===0&&(0,A.jsx)(F,{children:`waiting for events…`}),e.map(e=>(0,A.jsxs)(`div`,{className:`stream-line level-${iC(e.type)}`,children:[(0,A.jsx)(`span`,{className:`sl-time`,children:Lp(e.ts)}),(0,A.jsx)(`span`,{className:`sl-type`,children:e.type}),(0,A.jsx)(`span`,{className:`sl-msg`,children:e.message})]},e.id)),!n&&(0,A.jsx)(`button`,{className:`follow-pill agent-follow`,onClick:()=>r(!0),children:`Follow ⇣`})]})}function iC(e){return/(error|fail|conflict|cancel|stopped)/i.test(e)?`error`:/(done|succeed|finished|shipped|merged)/i.test(e)?`ok`:/(start|burn|launch|advance|running|retry|resum)/i.test(e)?`active`:`info`}function aC(e){let t=new Map;for(let n of e){if(!n.ticketId)continue;let e=t.get(n.ticketId);e?(e.min=Math.min(e.min,n.ts),e.max=Math.max(e.max,n.ts)):t.set(n.ticketId,{min:n.ts,max:n.ts})}let n=new Map;for(let[e,r]of t)r.max>r.min&&n.set(e,r.max-r.min);return n}function oC({featureId:e,viewedPhase:t,onViewPhase:n,guidance:r,driving:i,onDriveChange:a}){let o=N.useUtils(),s=Ji(),c=N.feature.get.useQuery({id:e},{refetchInterval:1500}),l=uC(e),u=()=>{o.feature.get.invalidate({id:e}),o.feature.list.invalidate()},d=N.feature.launchSession.useMutation({onSuccess:u,onError:e=>s.push(e.message)}),f=N.feature.advance.useMutation({onSuccess:()=>{u(),n(null)},onError:e=>s.push(e.message)}),p=N.feature.burn.useMutation({onSuccess:()=>{u(),n(null)},onError:e=>s.push(e.message)}),m=N.run.cancel.useMutation({onSuccess:()=>{u(),s.push(`cancel requested`,`info`)},onError:e=>s.push(e.message)}),h=N.feature.testDrive.useMutation({onError:e=>s.push(e.message)}),g=N.feature.merge.useMutation({onError:e=>s.push(e.message)}),_=N.feature.unarchive.useMutation({onSuccess:()=>{u(),s.push(`feature unarchived`,`success`)},onError:e=>s.push(e.message)});if(c.isLoading)return(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(`div`,{className:`ws-body`,children:(0,A.jsx)(F,{children:`loading feature…`})})});if(!c.data)return(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(`div`,{className:`ws-body`,children:(0,A.jsxs)(F,{children:[`could not load feature`,c.error?`: ${c.error.message}`:``]})})});let v=!!c.error,y=c.data,b=y.feature,x=Cp(b,t),S=wp(b,x),ee=Tp(b,x),C=hp(y.runs),w=kp(y,{driving:i?.featureId===b.id}),te=d.isPending||f.isPending||p.isPending||m.isPending||h.isPending||g.isPending||_.isPending;return(0,A.jsxs)(`section`,{className:`workspace`,children:[(0,A.jsxs)(`div`,{className:`ws-head`,children:[(0,A.jsxs)(`div`,{className:`ws-title-row`,children:[(0,A.jsx)(Hi,{phase:b.phase}),(0,A.jsx)(`span`,{className:`ws-title`,children:b.title}),(0,A.jsx)(`span`,{className:`ws-title-spacer`}),(0,A.jsxs)(`button`,{className:`ws-branch`,title:`Copy branch name`,onClick:()=>dC(b.branch,s),children:[(0,A.jsx)(gi,{size:11}),b.branch]})]}),(0,A.jsx)(cC,{steps:ee,onView:e=>n(e===b.phase?null:e)})]}),S?(0,A.jsxs)(`div`,{className:`readonly-bar`,children:[(0,A.jsx)(`span`,{className:`readonly-tag`,children:`READ-ONLY`}),(0,A.jsxs)(`span`,{children:[`You're viewing the `,gp[x],` phase.`]}),(0,A.jsxs)(`button`,{className:`readonly-back`,onClick:()=>n(null),children:[`Back to `,gp[b.phase],` →`]})]}):(0,A.jsx)(lC,{ns:w,guidance:r,busy:te,onAction:t=>{switch(t){case`startGrill`:d.mutate({featureId:e,kind:`ideation`});break;case`askQuestions`:d.mutate({featureId:e,kind:`qa`});break;case`revisit`:d.mutate({featureId:e,kind:`revisit`,kickoffLine:b.phase===`review`?Ep:void 0});break;case`openGrill`:n(null),requestAnimationFrame(()=>document.getElementById(`grill-term`)?.scrollIntoView({behavior:`smooth`,block:`center`}));break;case`advance`:f.mutate({featureId:e});break;case`burn`:p.mutate({featureId:e});break;case`cancelRun`:C&&m.mutate({runId:C.id});break;case`unarchive`:_.mutate({featureId:e});break;case`testDriveStart`:h.mutate({featureId:e,action:`start`},{onSuccess:t=>{u(),t.ok&&t.branch?a({featureId:e,branch:t.branch}):t.ok||s.push(t.deniedReason??`test drive denied`)}});break;case`testDriveStop`:h.mutate({featureId:e,action:`stop`},{onSuccess:()=>{u(),a(null)}});break;case`merge`:g.mutate({featureId:e},{onSuccess:e=>{if(u(),e.ok)a(null),s.push(`merged — feature shipped`,`success`);else if(e.conflict){let t=e.files.length;s.push(t>0?`merge conflict in ${t} file${t===1?``:`s`} — resolve below and retry`:`merge conflict — resolve below and retry`)}}});break}}}),v&&(0,A.jsxs)(`div`,{className:`ws-banner is-offline`,role:`status`,children:[(0,A.jsx)(`span`,{className:`ws-banner-tag`,children:`OFFLINE`}),(0,A.jsx)(`span`,{children:`server unreachable — retrying…`})]}),l.message&&(0,A.jsxs)(`div`,{className:`ws-banner`,role:`alert`,onClick:l.dismiss,title:`dismiss`,children:[(0,A.jsx)(`span`,{className:`ws-banner-tag`,children:`RESUME FAILED`}),(0,A.jsx)(`span`,{children:l.message})]}),(0,A.jsx)(`div`,{className:`ws-body`,children:(0,A.jsx)(`div`,{className:`ws-body-inner`,children:(0,A.jsx)(sC,{effective:x,full:y,driving:i,runId:C?.id??null,readonly:S})},x)})]})}function sC({effective:e,full:t,driving:n,runId:r,readonly:i}){switch(e){case`ideation`:case`spec`:return(0,A.jsx)(RS,{full:t,effective:e});case`tickets`:return(0,A.jsx)(XS,{featureId:t.feature.id,readonly:i});case`implementation`:return(0,A.jsx)(tC,{featureId:t.feature.id,runId:r,readonly:i});case`review`:return(0,A.jsx)(KS,{full:t,driving:n});case`shipped`:return(0,A.jsx)(YS,{full:t})}}function cC({steps:e,onView:t}){return(0,A.jsx)(`div`,{className:`pipeline`,children:e.map((n,r)=>(0,A.jsxs)(k.Fragment,{children:[(0,A.jsxs)(`button`,{className:`pstep is-${n.state}${n.isViewed?` is-viewed`:``}${n.clickable?` is-clickable`:``}`,title:n.tip,disabled:!n.clickable,onClick:()=>n.clickable&&t(n.phase),children:[(0,A.jsx)(`span`,{className:`pstep-dot`}),(0,A.jsx)(`span`,{className:`pstep-label`,children:n.label})]}),r<e.length-1&&(0,A.jsx)(`span`,{className:`pconn${n.state===`done`?` is-done`:``}`})]},n.phase))})}function lC({ns:e,guidance:t,busy:n,onAction:r}){let i=e.kick===`IN PROGRESS`?`is-progress`:e.kick===`SHIPPED`?`is-shipped`:e.kick===`WAITING`?`is-waiting`:``;return(0,A.jsxs)(`div`,{className:`nextstep`,children:[e.busy&&(0,A.jsx)(`span`,{className:`spin-ring nextstep-spin`}),(0,A.jsxs)(`div`,{className:`nextstep-main`,children:[(0,A.jsx)(`div`,{className:`nextstep-kick ${i}`,children:e.kick}),(0,A.jsx)(`div`,{className:`nextstep-title`,children:e.title}),t&&(0,A.jsx)(`div`,{className:`nextstep-desc`,children:e.desc})]}),(0,A.jsxs)(`div`,{className:`nextstep-actions`,children:[e.secondary.map((e,t)=>(0,A.jsx)(P,{variant:`ghost`,className:`btn-xs`,disabled:n,onClick:()=>r(e.kind),children:e.label},t)),e.primary&&(0,A.jsx)(P,{variant:e.primary.danger?`danger`:`solid`,disabled:n,onClick:()=>r(e.primary.kind),children:n?`Working…`:e.primary.label})]})]})}function uC(e){let t=Ip(e),[n,r]=(0,k.useState)(null),i=(0,k.useRef)(null);return(0,k.useEffect)(()=>{if(t.length===0)return;let e=t[t.length-1].id;if(i.current===null){i.current=e;return}let n=i.current;i.current=e;let a=t.filter(e=>e.id>n&&e.type===`session.resume_failed`),o=a[a.length-1];o&&r(o.message||`session resume failed — relaunch to continue`)},[t]),(0,k.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(null),8e3);return()=>clearTimeout(e)},[n]),{message:n,dismiss:()=>r(null)}}function dC(e,t){navigator.clipboard.writeText(e).then(()=>t.push(`copied ${e}`,`info`)).catch(()=>t.push(`copy failed`))}function fC({projectId:e,onCancel:t,onCreated:n}){let[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(``),[s,c]=(0,k.useState)(``),l=N.useUtils(),u=Ji(),d=N.project.branches.useQuery({projectId:e}),f=d.data?.mainBranch??``,p=d.data?.current,m=d.data?.branches??[],h=d.data?.remoteBranches??[],g=m.length===0&&h.length===0,_=d.data?fp(d.data):f,v=s||_,y=N.feature.launchSession.useMutation(),b=N.feature.create.useMutation({onSuccess:async e=>{await l.feature.list.invalidate(),y.mutate({featureId:e.id,kind:`ideation`},{onSettled:()=>void l.feature.get.invalidate({id:e.id})}),n(e.id)},onError:e=>u.push(e.message)}),x=pC(r),S=b.isPending||y.isPending,ee=()=>{let t=r.trim();t&&b.mutate({projectId:e,title:t,oneLiner:a.trim(),baseBranch:s||void 0})};return(0,A.jsx)(`div`,{className:`nf-overlay`,children:(0,A.jsxs)(`div`,{className:`nf-card`,children:[(0,A.jsx)(`div`,{className:`nf-kick`,children:`NEW FEATURE`}),(0,A.jsx)(`div`,{className:`nf-h`,children:`What are we building?`}),(0,A.jsx)(`div`,{className:`nf-sub`,children:`Name it — runcastle opens a grill session so you and Claude shape the idea before any code is written.`}),(0,A.jsx)(`input`,{className:`nf-input`,value:r,onChange:e=>i(e.target.value),placeholder:`e.g. Slack notifications on failed runs`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&ee(),e.key===`Escape`&&t()}}),(0,A.jsx)(`input`,{className:`nf-input nf-oneliner`,value:a,onChange:e=>o(e.target.value),placeholder:`one-liner (optional) — what & why in a sentence`,onKeyDown:e=>{e.key===`Enter`&&ee(),e.key===`Escape`&&t()}}),(0,A.jsxs)(`details`,{className:`nf-advanced`,children:[(0,A.jsx)(`summary`,{className:`nf-advanced-summary`,children:`Advanced`}),(0,A.jsxs)(`div`,{className:`nf-base`,children:[(0,A.jsx)(`label`,{className:`nf-base-label`,htmlFor:`nf-base-select`,children:`Branch from`}),(0,A.jsxs)(`select`,{id:`nf-base-select`,className:`nf-base-select`,value:v,disabled:d.isPending||g,onChange:e=>c(e.target.value),children:[m.map(e=>(0,A.jsxs)(`option`,{value:e,children:[e,e===f?` (default)`:``,e===p&&e!==f?` (current)`:``]},e)),h.length>0&&(0,A.jsx)(`optgroup`,{label:`Remote (creates a local branch)`,children:h.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))})]}),(0,A.jsx)(`span`,{className:`size-hint`,children:`forks off this branch — and merges back into it when shipped.`})]}),(0,A.jsxs)(`div`,{className:`nf-branch`,children:[`branch · feature/`,x||`…`,` ← `,v||`…`]})]}),(0,A.jsxs)(`div`,{className:`nf-actions`,children:[(0,A.jsx)(P,{variant:`ghost`,onClick:t,disabled:S,children:`Cancel`}),(0,A.jsx)(P,{variant:`solid`,onClick:ee,disabled:!r.trim()||S,children:S?`Starting…`:`Start grill session`})]})]})})}function pC(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40)}function mC(e){let{open:t,onClose:n,features:r,selectedFeatureId:i,onSelect:a,onNewFeature:o,onOpenSettings:s,nav:c}=e,[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(0),p=(0,k.useRef)(null),m=(0,k.useRef)([]);(0,k.useEffect)(()=>{t&&(u(``),f(0),p.current?.focus())},[t]),(0,k.useEffect)(()=>{f(0)},[l]);let h=l.trim().toLowerCase(),g=(0,k.useMemo)(()=>h===``?r:r.filter(e=>e.slug.toLowerCase().includes(h)||e.title.toLowerCase().includes(h)),[r,h]),_=(0,k.useMemo)(()=>(c.projects??[]).filter(e=>e.id!==c.currentProjectId),[c.projects,c.currentProjectId]),v=(0,k.useMemo)(()=>h===``?_:_.filter(e=>e.name.toLowerCase().includes(h)),[_,h]),y=`create new feature`.includes(h),b=`all projects home`.includes(h),x=`open a project`.includes(h),S=`settings preferences`.includes(h),ee=(0,k.useMemo)(()=>{let e=g.map(e=>({kind:`feature`,feature:e}));for(let t of v)e.push({kind:`project`,id:t.id,name:t.name,branch:t.mainBranch,current:!1});return y&&e.push({kind:`newFeature`}),b&&e.push({kind:`home`}),x&&e.push({kind:`openProject`}),S&&e.push({kind:`settings`}),e},[g,v,y,b,x,S]);if(!t)return null;let C=e=>{if(ee.length===0)return;let t=(d+e+ee.length)%ee.length;f(t),m.current[t]?.scrollIntoView({block:`nearest`})},w=e=>{let t=ee[e];if(t){switch(t.kind){case`feature`:a(t.feature.id);break;case`project`:c.enterProject(t.id);break;case`newFeature`:o();break;case`home`:c.goHome();break;case`openProject`:c.showOpen();break;case`settings`:s();break}n()}},te=e=>{e.key===`ArrowDown`?(e.preventDefault(),C(1)):e.key===`ArrowUp`?(e.preventDefault(),C(-1)):e.key===`Enter`?(e.preventDefault(),w(d)):e.key===`Escape`&&(e.preventDefault(),n())},ne=g.length,re=ne+v.length,ie=e=>t=>{m.current[e]=t};return(0,A.jsx)(`div`,{className:`cmdk-backdrop`,onClick:n,children:(0,A.jsxs)(`div`,{className:`cmdk`,onClick:e=>e.stopPropagation(),children:[(0,A.jsx)(`input`,{ref:p,className:`cmdk-input`,placeholder:`Search features, projects, or jump to…`,value:l,onChange:e=>u(e.target.value),onKeyDown:te,"aria-label":`Search features, projects, or jump to`}),(0,A.jsxs)(`div`,{className:`cmdk-list`,children:[g.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`cmdk-group-label`,children:`Features`}),g.map((e,t)=>(0,A.jsxs)(`div`,{ref:ie(t),className:`cmdk-item${t===d?` is-active`:``}`,onMouseEnter:()=>f(t),onClick:()=>w(t),children:[(0,A.jsx)(`span`,{className:`cmdk-item-glyph`,children:(0,A.jsx)(`span`,{className:`feature-dot phase-bg-${e.phase}`})}),(0,A.jsx)(`span`,{className:`cmdk-item-label`,children:e.title}),(0,A.jsx)(`span`,{className:`cmdk-item-slug`,children:e.slug}),(0,A.jsx)(`span`,{className:`cmdk-item-hint`,children:e.id===i?`current`:e.phase})]},e.id))]}),v.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`cmdk-group-label`,children:`Switch project`}),v.map((e,t)=>{let n=ne+t;return(0,A.jsxs)(`div`,{ref:ie(n),className:`cmdk-item${n===d?` is-active`:``}`,onMouseEnter:()=>f(n),onClick:()=>w(n),children:[(0,A.jsx)(`span`,{className:`cmdk-item-glyph`,children:(0,A.jsx)(Ei,{size:13})}),(0,A.jsx)(`span`,{className:`cmdk-item-label`,children:e.name}),(0,A.jsx)(`span`,{className:`cmdk-item-slug`,children:e.mainBranch}),(0,A.jsx)(`span`,{className:`cmdk-item-hint`,children:`project`})]},e.id)})]}),(y||b||x||S)&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`cmdk-group-label`,children:`Actions`}),y&&(0,A.jsx)(hC,{index:re,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:w,glyph:(0,A.jsx)(yi,{size:13}),label:`Create new feature`}),b&&(0,A.jsx)(hC,{index:re+ +!!y,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:w,glyph:(0,A.jsx)(Ei,{size:13}),label:`All projects (home)`}),x&&(0,A.jsx)(hC,{index:re+ +!!y+ +!!b,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:w,glyph:(0,A.jsx)(Ei,{size:13}),label:`Open a project…`}),S&&(0,A.jsx)(hC,{index:re+ +!!y+ +!!b+ +!!x,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:w,glyph:(0,A.jsx)(mi,{size:13}),label:`Settings`})]}),ee.length===0&&(0,A.jsx)(`div`,{className:`cmdk-empty`,children:`No matches`})]}),(0,A.jsxs)(`div`,{className:`cmdk-foot`,children:[(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`kbd`,children:`↑↓`}),` navigate`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`kbd`,children:`↵`}),` select`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`kbd`,children:`esc`}),` close`]})]})]})})}function hC({index:e,activeIndex:t,bindRow:n,setActiveIndex:r,activate:i,glyph:a,label:o}){return(0,A.jsxs)(`div`,{ref:n(e),className:`cmdk-item${e===t?` is-active`:``}`,onMouseEnter:()=>r(e),onClick:()=>i(e),children:[(0,A.jsx)(`span`,{className:`cmdk-item-glyph`,children:a}),(0,A.jsx)(`span`,{className:`cmdk-item-label`,children:o}),(0,A.jsx)(`span`,{className:`cmdk-item-hint`,children:`action`})]})}var gC={serverPort:`RUNCASTLE_SERVER_PORT`,model:`RUNCASTLE_MODEL`,sandbox:`RUNCASTLE_SANDBOX`,sandboxImage:`RUNCASTLE_SANDBOX_IMAGE`,burnConcurrency:`RUNCASTLE_BURN_CONCURRENCY`,burnAttempts:`RUNCASTLE_BURN_ATTEMPTS`,mainBranch:`RUNCASTLE_MAIN_BRANCH`},_C=dp.map(e=>e.id),vC=`stepModels.`;function yC(e){return e.startsWith(vC)}function bC(e){return e.slice(11)}var xC={ideation:`Ideation`,qa:`Q&A`,waypoint:`Waypoint`,converge:`Converge`,research:`Research`,implement:`Implement`,smoke:`Smoke`},SC=lp.map(e=>`${vC}${e}`),CC=new Set([`mainBranch`]),wC={serverPort:{label:`Server port`,help:`Port the runcastle server listens on.`,control:`number`},model:{label:`Default model`,help:`Claude model every step inherits unless overridden below.`,control:`select`,options:_C},sandbox:{label:`Sandbox`,help:`Where launched sessions run.`,control:`select`,options:[`docker`,`noSandbox`]},sandboxImage:{label:`Sandbox image`,help:`Docker image used when a session is sandboxed.`,control:`text`},burnConcurrency:{label:`Burn concurrency`,help:`Max tickets burned in parallel per run (1–8). Each is a full agent.`,control:`number`},burnAttempts:{label:`Burn attempts`,help:`Max agent attempts per ticket per run (1–5). A transient crash (API drop, network) retries with committed work preserved.`,control:`number`},mainBranch:{label:`Main branch`,help:`Branch features merge back into.`,control:`text`},devCommand:{label:`Dev command`,help:`Command that starts this project's dev server.`,control:`text`}};function TC(e){return e==null?``:String(e)}function EC(e){if(yC(e)){let t=bC(e);return{label:xC[t]??t,help:`Model for the ${xC[t]??t} step.`,control:`select`,options:_C}}return wC[e]??{label:e,help:``,control:`text`}}function DC(e){let t=EC(e.key),n=CC.has(e.key),r=!e.editable||n,i=e.source===`project`,a=null;return e.source===`env`?a=`Set by ${gC[e.key]??`the environment`}`:n?a=`Read-only — detected from git`:e.scope===`project`&&(a=i?`Overridden for this project`:`Inherited from global`),{key:e.key,label:t.label,help:t.help,value:TC(e.value),control:t.control,options:t.options??[],readOnly:r,restartRequired:e.restartRequired,overridden:i,source:e.source,note:a,allowCustom:e.key===`model`||yC(e.key)}}function OC(e){return e.fields.filter(e=>!yC(e.key)).map(DC)}function kC(e){return e.fields.filter(e=>e.scope===`project`).map(DC)}function AC(e){return e.fields.filter(e=>yC(e.key)&&e.source===`file`).map(DC).sort((e,t)=>SC.indexOf(e.key)-SC.indexOf(t.key))}function jC(e){let t=new Set(e.fields.filter(e=>yC(e.key)&&e.source===`file`).map(e=>e.key));return SC.filter(e=>!t.has(e)).map(e=>({key:e,label:xC[bC(e)]??bC(e)}))}function MC({onDismiss:e}){let t=N.setup.doctor.useQuery(void 0,{refetchOnWindowFocus:!1}),n=t.data,r=e=>n?.results.find(t=>t.id===e),i=r(`container-runtime`),a=r(`sandcastle-image`),o=r(`afk-token`),s=()=>t.refetch();return(0,A.jsxs)(`div`,{className:`afk-card`,children:[(0,A.jsxs)(`div`,{className:`afk-card-head`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`op-kick`,children:`ENABLE AFK BURNS`}),(0,A.jsx)(`div`,{className:`afk-card-title`,children:`Run features unattended`})]}),e&&(0,A.jsx)(P,{variant:`ghost`,onClick:e,children:`Set up later`})]}),(0,A.jsx)(`p`,{className:`afk-card-sub`,children:`AFK burns run each feature to completion in a sandbox — no interactive session. They need a container runtime, the sandcastle image, and an auth token. Set them up now or anytime from Settings.`}),t.isLoading&&(0,A.jsx)(F,{children:`checking prerequisites…`}),t.error&&(0,A.jsxs)(F,{children:[`could not run checks: `,t.error.message]}),n&&(0,A.jsxs)(`div`,{className:`afk-rows`,children:[(0,A.jsx)(PC,{probe:i,onRecheck:s}),(0,A.jsx)(FC,{probe:a,runtimeOk:i?.status===`ok`,onDone:s}),(0,A.jsx)(IC,{probe:o,onDone:s})]})]})}function NC({probe:e,children:t}){if(!e)return null;let n=e.status===`ok`;return(0,A.jsxs)(`div`,{className:`afk-row${n?` is-ok`:``}`,children:[(0,A.jsxs)(`div`,{className:`afk-row-head`,children:[(0,A.jsx)(`span`,{className:`afk-dot afk-dot-${n?`ok`:`warn`}`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{className:`afk-row-text`,children:[(0,A.jsx)(`div`,{className:`afk-row-label`,children:e.label}),(0,A.jsx)(`div`,{className:`afk-row-detail mono`,children:e.detail})]})]}),!n&&(0,A.jsx)(`div`,{className:`afk-row-action`,children:t})]})}function PC({probe:e,onRecheck:t}){let n=N.setup.runtimeGuide.useQuery(void 0,{enabled:e?.status===`missing`,refetchOnWindowFocus:!1}),r=Ji();if(!e)return null;let i=e.status===`missing`?n.data:void 0,a=i?.command??e.fix??``;return(0,A.jsxs)(NC,{probe:e,children:[a&&(0,A.jsxs)(`div`,{className:`afk-cmd`,children:[(0,A.jsx)(`code`,{className:`afk-cmd-text mono`,children:a}),(0,A.jsx)(P,{variant:`ghost`,onClick:()=>{navigator.clipboard?.writeText(a),r.push(`copied`,`info`)},children:`Copy`})]}),i?.note&&(0,A.jsx)(`div`,{className:`afk-note`,children:i.note}),(0,A.jsx)(P,{variant:`solid`,onClick:t,children:`Re-check`})]})}function FC({probe:e,runtimeOk:t,onDone:n}){let[r,i]=(0,k.useState)(null),a=Ji(),o=N.setup.startTerminal.useMutation({onSuccess:({sessionId:e})=>i(e),onError:e=>a.push(e.message)});return e?(0,A.jsx)(NC,{probe:e,children:r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`afk-term`,children:(0,A.jsx)(dm,{label:`build-image`,children:(0,A.jsx)(LS,{sessionId:r})})}),(0,A.jsx)(`div`,{className:`afk-term-actions`,children:(0,A.jsx)(P,{variant:`solid`,onClick:()=>{i(null),n()},children:`Done — re-check`})})]}):(0,A.jsx)(P,{variant:`solid`,disabled:!t||o.isPending,title:t?void 0:`Install a container runtime first`,onClick:()=>o.mutate({kind:`build-image`}),children:o.isPending?`Starting…`:`Build image`})}):null}function IC({probe:e,onDone:t}){let[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(``),[o,s]=(0,k.useState)(null),c=Ji(),l=N.setup.startTerminal.useMutation({onSuccess:({sessionId:e})=>r(e),onError:e=>c.push(e.message)}),u=N.setup.afkToken.useMutation({onSuccess:e=>{s(e),e.valid&&t()},onError:e=>c.push(e.message)});return e?(0,A.jsxs)(NC,{probe:e,children:[n?(0,A.jsx)(`div`,{className:`afk-term`,children:(0,A.jsx)(dm,{label:`setup-token`,children:(0,A.jsx)(LS,{sessionId:n})})}):(0,A.jsx)(P,{variant:`ghost`,onClick:()=>l.mutate({kind:`setup-token`}),disabled:l.isPending,children:l.isPending?`Starting…`:`Run claude setup-token`}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`afk-token-input`,children:`Paste the token it prints`}),(0,A.jsx)(`input`,{id:`afk-token-input`,className:`op-input mono`,value:i,onChange:e=>a(e.target.value),placeholder:`sk-ant-oat01-…`,spellCheck:!1,autoComplete:`off`}),(0,A.jsx)(`div`,{className:`afk-term-actions`,children:(0,A.jsx)(P,{variant:`solid`,disabled:i.trim()===``||u.isPending,onClick:()=>u.mutate({token:i}),children:u.isPending?`Verifying…`:`Save & verify`})}),o&&(0,A.jsxs)(`div`,{className:`afk-verdict ${o.valid?`is-ok`:`is-warn`}`,children:[o.valid?`✓ `:`⚠ `,o.detail]})]}):null}function LC({projectId:e,onClose:t}){let n=N.settings.get.useQuery(),r=N.settings.get.useQuery({projectId:e});return(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:t,children:(0,A.jsxs)(`div`,{className:`peek settings`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`settings-title`,children:`Settings`}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:t,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`peek-body settings-body`,children:[(0,A.jsx)(RC,{title:`Global`,hint:`Machine-wide defaults for every project.`,query:n,rowsOf:OC}),(0,A.jsx)(HC,{query:n}),(0,A.jsx)(RC,{title:`This project`,hint:`Overrides that apply only to the current project.`,query:r,rowsOf:kC,projectId:e}),(0,A.jsxs)(`section`,{className:`settings-section`,children:[(0,A.jsxs)(`div`,{className:`settings-section-head`,children:[(0,A.jsx)(`h3`,{className:`settings-section-title`,children:`AFK burns`}),(0,A.jsx)(`span`,{className:`settings-section-hint`,children:`Prerequisites for unattended sandbox runs.`})]}),(0,A.jsx)(MC,{})]})]})]})})}function RC({title:e,hint:t,query:n,rowsOf:r,projectId:i}){let a=n.data?r(n.data):[];return(0,A.jsxs)(`section`,{className:`settings-section`,children:[(0,A.jsxs)(`div`,{className:`settings-section-head`,children:[(0,A.jsx)(`h3`,{className:`settings-section-title`,children:e}),(0,A.jsx)(`span`,{className:`settings-section-hint`,children:t})]}),n.isLoading&&(0,A.jsx)(F,{children:`loading…`}),n.error&&(0,A.jsxs)(F,{children:[`could not load settings: `,n.error.message]}),n.data&&a.length===0&&(0,A.jsx)(F,{children:`no settings in this scope`}),a.map(e=>(0,A.jsx)(zC,{row:e,projectId:i},e.key))]})}function zC({row:e,projectId:t}){let n=N.useUtils(),r=Ji(),[i,a]=(0,k.useState)(e.value);(0,k.useEffect)(()=>a(e.value),[e.value]);let o=N.settings.update.useMutation({onSuccess:()=>{n.settings.get.invalidate()},onError:t=>{a(e.value),r.push(t.message)}}),s=n=>{let r=n.trim();if(r===e.value.trim())return;let i=e.control===`number`?Number(r):r;o.mutate({...t?{projectId:t}:{},key:e.key,value:i})},c=()=>t&&o.mutate({projectId:t,key:e.key,value:null}),l=`set-${e.key}`;return(0,A.jsxs)(`div`,{className:`settings-field${e.readOnly?` is-locked`:``}`,children:[(0,A.jsxs)(`label`,{className:`settings-field-head`,htmlFor:l,children:[(0,A.jsx)(`span`,{className:`settings-field-label`,children:e.label}),e.restartRequired&&(0,A.jsx)(`span`,{className:`settings-badge is-warn`,title:`Takes effect after a server restart`,children:`restart required`}),e.overridden&&(0,A.jsx)(`span`,{className:`settings-badge is-override`,children:`overridden`}),o.isPending&&(0,A.jsx)(`span`,{className:`settings-saving`,children:`saving…`})]}),e.help&&(0,A.jsx)(`div`,{className:`settings-field-help`,children:e.help}),e.readOnly?(0,A.jsx)(`div`,{className:`settings-readonly mono`,id:l,children:e.value||`—`}):e.control===`select`&&e.allowCustom?(0,A.jsx)(VC,{id:l,value:e.value,options:e.options,disabled:o.isPending,onCommit:s}):e.control===`select`?(0,A.jsx)(`select`,{id:l,className:`settings-input`,value:i,disabled:o.isPending,onChange:e=>{a(e.target.value),s(e.target.value)},children:e.options.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))}):(0,A.jsx)(`input`,{id:l,className:`settings-input mono`,type:e.control===`number`?`number`:`text`,value:i,disabled:o.isPending,onChange:e=>a(e.target.value),onBlur:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&(a(e.value),t.currentTarget.blur())}}),e.note&&(0,A.jsx)(`div`,{className:`settings-field-note`,children:e.note}),e.overridden&&t&&(0,A.jsx)(`button`,{className:`settings-clear`,onClick:c,disabled:o.isPending,children:`Clear override`})]})}var BC=`__custom__`;function VC({id:e,value:t,options:n,disabled:r,onCommit:i}){let[a,o]=(0,k.useState)(!n.includes(t)&&t!==``),[s,c]=(0,k.useState)(t);return(0,k.useEffect)(()=>{c(t),o(!n.includes(t)&&t!==``)},[t,n]),(0,A.jsxs)(`div`,{className:`settings-combo`,children:[(0,A.jsxs)(`select`,{id:e,className:`settings-input`,value:a?BC:t,disabled:r,onChange:e=>{if(e.target.value===BC){o(!0);return}o(!1),i(e.target.value)},children:[n.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e)),(0,A.jsx)(`option`,{value:BC,children:`Custom…`})]}),a&&(0,A.jsx)(`input`,{className:`settings-input mono`,type:`text`,placeholder:`model id (e.g. claude-opus-4-8)`,value:s,disabled:r,onChange:e=>c(e.target.value),onBlur:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}})]})}function HC({query:e}){let t=N.useUtils(),n=Ji(),[r,i]=(0,k.useState)(!1),a=N.settings.update.useMutation({onSuccess:()=>{t.settings.get.invalidate()},onError:e=>n.push(e.message)}),o=e.data,s=o?AC(o):[],c=o?jC(o):[],l=o?.fields.find(e=>e.key===`model`),u=(e,t)=>{let n=t.trim();n!==``&&a.mutate({key:e,value:n})};return(0,A.jsxs)(`section`,{className:`settings-section`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`settings-advanced-toggle`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,A.jsx)(`span`,{className:`settings-section-title`,children:`Advanced — per-step models`}),(0,A.jsxs)(`span`,{className:`settings-section-hint`,children:[s.length>0?`${s.length} override${s.length===1?``:`s`}`:`none set`,r?` ▾`:` ▸`]})]}),r&&(0,A.jsxs)(`div`,{className:`settings-advanced-body`,children:[s.length===0&&(0,A.jsx)(F,{children:`every step uses the default model.`}),s.map(e=>(0,A.jsxs)(`div`,{className:`settings-field`,children:[(0,A.jsxs)(`div`,{className:`settings-field-head`,children:[(0,A.jsx)(`span`,{className:`settings-field-label`,children:e.label}),a.isPending&&(0,A.jsx)(`span`,{className:`settings-saving`,children:`saving…`})]}),(0,A.jsx)(VC,{id:`step-${e.key}`,value:e.value,options:e.options,disabled:a.isPending,onCommit:t=>u(e.key,t)}),(0,A.jsx)(`button`,{className:`settings-clear`,disabled:a.isPending,onClick:()=>a.mutate({key:e.key,value:null}),children:`Reset to default`})]},e.key)),c.length>0&&(0,A.jsxs)(`div`,{className:`settings-field`,children:[(0,A.jsx)(`label`,{className:`settings-field-label`,htmlFor:`step-add`,children:`Add an override`}),(0,A.jsxs)(`select`,{id:`step-add`,className:`settings-input`,value:``,disabled:a.isPending,onChange:e=>{let t=e.target.value;t&&u(t,typeof l?.value==`string`?l.value:``)},children:[(0,A.jsx)(`option`,{value:``,children:`Choose a step…`}),c.map(e=>(0,A.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]})]})]})}function UC({projectId:e,nav:t}){let n=Li(e),{selectedFeatureId:r,select:i,setCmdk:a}=n,[o,s]=(0,k.useState)(null),c=N.feature.list.useQuery({projectId:e},{refetchInterval:1500});(0,k.useEffect)(()=>{!r&&c.data&&c.data.length>0&&i(c.data[0].id)},[r,c.data,i]),(0,k.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let l=!n.inspectorCollapsed&&!!n.selectedFeatureId&&!n.creating;return(0,A.jsxs)(`div`,{className:`shell${n.inspectorCollapsed?` inspector-collapsed`:``}`,children:[(0,A.jsx)(zi,{nav:t,onOpenCmdk:()=>n.setCmdk(!0),onOpenSettings:()=>n.setSettings(!0),onToggleInspector:n.toggleInspector,inspectorCollapsed:n.inspectorCollapsed}),(0,A.jsxs)(`div`,{className:`shell-body`,children:[(0,A.jsx)(Pp,{projectId:e,selectedFeatureId:n.selectedFeatureId,onSelect:n.select,onNewFeature:n.startCreate}),n.creating?(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(fC,{projectId:e,onCancel:n.cancelCreate,onCreated:n.select})}):n.selectedFeatureId?(0,A.jsx)(oC,{featureId:n.selectedFeatureId,viewedPhase:n.viewedPhase,onViewPhase:n.viewPhase,guidance:n.guidance,driving:o,onDriveChange:s},`ws-${n.selectedFeatureId}`):(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(WC,{onNewFeature:n.startCreate})}),l&&n.selectedFeatureId&&(0,A.jsx)(Hp,{featureId:n.selectedFeatureId},`insp-${n.selectedFeatureId}`)]}),(0,A.jsx)(lm,{projectId:e,activeFeatureId:n.selectedFeatureId,driving:o,onDriveChange:s}),(0,A.jsx)(mC,{open:n.cmdkOpen,onClose:()=>n.setCmdk(!1),features:c.data??[],selectedFeatureId:n.selectedFeatureId,onSelect:n.select,onNewFeature:n.startCreate,onOpenSettings:()=>n.setSettings(!0),nav:t}),n.settingsOpen&&(0,A.jsx)(LC,{projectId:e,onClose:()=>n.setSettings(!1)})]})}function WC({onNewFeature:e}){return(0,A.jsxs)(`div`,{className:`ws-empty`,children:[(0,A.jsx)(`div`,{className:`ws-empty-logo`,children:(0,A.jsx)(ki,{size:44,variant:`outline`})}),(0,A.jsx)(`div`,{className:`ws-empty-title`,children:`Select a feature to begin`}),(0,A.jsx)(`div`,{className:`ws-empty-sub`,children:`Or create one — every feature moves through the same guided pipeline.`}),(0,A.jsx)(`button`,{className:`btn btn-ghost`,onClick:e,children:`New feature`})]})}function GC({nav:e}){let t=e.projects??[],n=N.useQueries(e=>t.map(t=>e.feature.list({projectId:t.id},{refetchInterval:1500})));return(0,A.jsxs)(`div`,{className:`home-frame`,children:[(0,A.jsxs)(`header`,{className:`home-topbar`,children:[(0,A.jsxs)(`span`,{className:`tb-home`,children:[(0,A.jsx)(`span`,{className:`tb-logo`,children:(0,A.jsx)(ki,{size:17})}),(0,A.jsx)(Ai,{})]}),(0,A.jsx)(`span`,{className:`tb-spacer`}),(0,A.jsxs)(`button`,{className:`btn btn-ghost btn-xs`,onClick:e.showOpen,children:[(0,A.jsx)(yi,{size:11}),`Open a project`]})]}),(0,A.jsxs)(`div`,{className:`home`,children:[(0,A.jsxs)(`header`,{className:`home-head`,children:[(0,A.jsxs)(`div`,{className:`home-title`,children:[(0,A.jsx)(`span`,{className:`home-title-text`,children:`Projects`}),(0,A.jsx)(`span`,{className:`home-count`,children:t.length})]}),(0,A.jsx)(`p`,{className:`home-sub`,children:`Every open project and where it stands — runs keep going in the background while you switch.`})]}),(0,A.jsxs)(`div`,{className:`home-grid`,children:[t.map((t,r)=>{let i=n[r]?.data;return(0,A.jsx)(qC,{project:t,stats:li(i??[]),loading:i===void 0,onOpen:()=>e.enterProject(t.id)},t.id)}),(0,A.jsxs)(`button`,{className:`open-card`,onClick:e.showOpen,children:[(0,A.jsx)(`span`,{className:`open-card-plus`,children:(0,A.jsx)(yi,{size:16})}),(0,A.jsx)(`span`,{className:`open-card-label`,children:`Open a project`}),(0,A.jsx)(`span`,{className:`open-card-sub`,children:`Point runcastle at a local git repo`})]})]})]})]})}var KC={attention:`Needs you`,working:`Agent working`,steady:`Steady`,empty:`No features yet`};function qC({project:e,stats:t,loading:n,onOpen:r}){let i=Ji(),a=N.useUtils(),[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(e.name),u=N.project.rename.useMutation({onSuccess:async()=>{await a.project.list.invalidate(),s(!1)},onError:e=>i.push(e.message)}),d=N.project.close.useMutation({onSuccess:async()=>{await a.project.list.invalidate(),i.push(`closed ${e.name}`,`info`)},onError:e=>i.push(e.message)}),f=t.activeRuns>0,p=()=>{let t=c.trim();t&&t!==e.name?u.mutate({projectId:e.id,name:t}):s(!1)};return(0,A.jsxs)(`div`,{className:`project-card health-${t.health}`,children:[(0,A.jsxs)(`button`,{className:`pc-main`,onClick:r,title:`Open ${e.name}`,children:[(0,A.jsxs)(`div`,{className:`pc-head`,children:[o?(0,A.jsx)(`input`,{className:`pc-rename mono`,value:c,autoFocus:!0,onClick:e=>e.stopPropagation(),onChange:e=>l(e.target.value),onKeyDown:t=>{t.stopPropagation(),t.key===`Enter`&&p(),t.key===`Escape`&&(l(e.name),s(!1))},onBlur:p}):(0,A.jsx)(`span`,{className:`pc-name`,children:e.name}),(0,A.jsx)(`span`,{className:`pc-health-dot health-dot-${t.health}`,title:KC[t.health]})]}),(0,A.jsx)(`span`,{className:`pc-path mono`,children:e.repoPath}),(0,A.jsxs)(`span`,{className:`pc-branch`,children:[(0,A.jsx)(gi,{size:11}),e.mainBranch]}),(0,A.jsxs)(`div`,{className:`pc-stats`,children:[(0,A.jsx)(JC,{n:t.total,label:t.total===1?`feature`:`features`}),(0,A.jsx)(JC,{n:t.activeRuns,label:`running`,tone:f?`run`:void 0,spin:f}),(0,A.jsx)(JC,{n:t.needsYou,label:`needs you`,tone:t.needsYou>0?`needs`:void 0})]}),(0,A.jsx)(`span`,{className:`pc-health-label`,children:n?`loading…`:KC[t.health]})]}),(0,A.jsxs)(`div`,{className:`pc-actions`,children:[(0,A.jsx)(`button`,{className:`pc-action`,onClick:()=>{l(e.name),s(!0)},children:`Rename`}),(0,A.jsx)(`button`,{className:`pc-action pc-action-danger`,disabled:f||d.isPending,title:f?`a run is in flight — cannot close`:`Close project`,onClick:()=>d.mutate({projectId:e.id}),children:`Close`})]})]})}function JC({n:e,label:t,tone:n,spin:r}){return(0,A.jsxs)(`span`,{className:`pc-stat${n?` pc-stat-${n}`:``}`,children:[r&&(0,A.jsx)(`span`,{className:`spin-ring`}),(0,A.jsx)(`span`,{className:`pc-stat-n`,children:e}),(0,A.jsx)(`span`,{className:`pc-stat-label`,children:t})]})}function YC({onPick:e,onCancel:t}){let[n,r]=(0,k.useState)(void 0),[i,a]=(0,k.useState)(!1),o=N.project.roots.useQuery(),s=N.project.browse.useQuery({dir:n,showHidden:i},{placeholderData:e=>e,retry:!1});(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let c=s.data,l=c?.dir??n;return(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:t,children:(0,A.jsxs)(`div`,{className:`peek dir-picker`,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose a repository`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`dir-picker-title`,children:`Choose a repository`}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:t,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`dir-picker-bar`,children:[(0,A.jsx)(P,{variant:`ghost`,className:`dir-up`,onClick:()=>c?.parent&&r(c.parent),disabled:!c?.parent,"aria-label":`Up one level`,title:`Up one level`,children:`↑`}),(0,A.jsx)(`div`,{className:`dir-crumbs mono`,"aria-label":`Current path`,children:(c?.crumbs??[]).map((e,t)=>(0,A.jsxs)(`span`,{className:`dir-crumb-wrap`,children:[t>0&&(0,A.jsx)(Si,{size:11}),(0,A.jsx)(`button`,{className:`dir-crumb`,onClick:()=>r(e.path),children:e.name})]},e.path))}),(0,A.jsxs)(`label`,{className:`dir-hidden-toggle`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),(0,A.jsx)(`span`,{children:`Hidden`})]})]}),(0,A.jsxs)(`div`,{className:`dir-picker-body`,children:[(0,A.jsx)(`div`,{className:`dir-rail`,children:(o.data??[]).map(e=>(0,A.jsxs)(`button`,{className:`dir-rail-item${l===e.path?` is-active`:``}`,onClick:()=>r(e.path),title:e.path,children:[(0,A.jsx)(Ei,{size:13}),(0,A.jsx)(`span`,{className:`dir-rail-label mono`,children:e.label})]},e.path))}),(0,A.jsxs)(`div`,{className:`dir-list`,children:[s.isError?(0,A.jsx)(F,{children:s.error.message}):s.isLoading?(0,A.jsx)(F,{children:`Loading…`}):(c?.entries.length??0)===0?(0,A.jsxs)(F,{children:[`No subfolders here`,i?``:` (hidden folders are filtered)`,`.`]}):(c?.entries??[]).map(t=>(0,A.jsxs)(`button`,{className:`dir-item${t.isRepo?` is-repo`:``}`,onClick:()=>r(t.path),onDoubleClick:()=>t.isRepo&&e(t.path),title:t.path,children:[(0,A.jsx)(Ei,{size:13}),(0,A.jsx)(`span`,{className:`dir-item-name mono`,children:t.name}),t.isSymlink&&(0,A.jsx)(`span`,{className:`dir-item-tag`,children:`link`}),t.isRepo&&(0,A.jsxs)(`span`,{className:`dir-item-repo`,children:[(0,A.jsx)(gi,{size:11}),` git`]})]},t.path)),c?.truncated&&(0,A.jsx)(F,{children:`Listing truncated — this folder is very large.`})]})]}),(0,A.jsxs)(`div`,{className:`dir-picker-foot`,children:[(0,A.jsx)(`div`,{className:`dir-picked mono`,title:l,children:(0,A.jsx)(`bdi`,{children:l??`—`})}),(0,A.jsxs)(`div`,{className:`dir-picker-actions`,children:[(0,A.jsx)(P,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,A.jsx)(P,{variant:`solid`,onClick:()=>l&&e(l),disabled:!l,children:`Open this folder`})]})]})]})})}function XC({firstRun:e,onOpened:t,onCancel:n}){let[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=Ji(),c=N.useUtils(),l=N.project.open.useMutation({onSuccess:async e=>{await c.project.list.invalidate(),s.push(`opened ${e.name} on ${e.mainBranch}`,`info`),t(e.id)},onError:e=>s.push(e.message)}),u=e=>{let t=(e??r).trim();t&&l.mutate({repoPath:t})};return(0,A.jsxs)(`div`,{className:`open-project`,children:[(0,A.jsxs)(`div`,{className:`op-card`,children:[(0,A.jsx)(`div`,{className:`op-logo`,children:(0,A.jsx)(ki,{size:22,variant:`ink`})}),(0,A.jsx)(`div`,{className:`op-kick`,children:e?`WELCOME TO RUNCASTLE`:`OPEN A PROJECT`}),(0,A.jsx)(`div`,{className:`op-h`,children:e?`Open your first project`:`Open a project`}),(0,A.jsx)(`div`,{className:`op-sub`,children:`Point runcastle at a local git repository. It detects the default branch and opens the project — every feature runs its pipeline against this repo.`}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`op-repo-path`,children:`Repository path`}),(0,A.jsxs)(`div`,{className:`op-input-row`,children:[(0,A.jsx)(`input`,{id:`op-repo-path`,className:`op-input mono`,value:r,onChange:e=>i(e.target.value),placeholder:`/path/to/your/repo`,autoFocus:!0,spellCheck:!1,onKeyDown:t=>{t.key===`Enter`&&u(),t.key===`Escape`&&!e&&n()}}),(0,A.jsx)(P,{variant:`ghost`,onClick:()=>o(!0),disabled:l.isPending,children:`Browse…`})]}),(0,A.jsx)(`div`,{className:`op-hint`,children:`Browse your machine, or paste a path. The default branch is detected automatically when the project opens.`}),(0,A.jsxs)(`div`,{className:`op-actions`,children:[!e&&(0,A.jsx)(P,{variant:`ghost`,onClick:n,disabled:l.isPending,children:`Cancel`}),(0,A.jsx)(P,{variant:`solid`,onClick:()=>u(),disabled:l.isPending||r.trim()===``,children:l.isPending?`Opening…`:`Open`})]})]}),a&&(0,A.jsx)(YC,{onPick:e=>{i(e),o(!1),u(e)},onCancel:()=>o(!1)})]})}function ZC({onOpened:e,onCancel:t}){let n=N.setup.doctor.useQuery(void 0,{refetchOnWindowFocus:!1}),r=n.data?.results.find(e=>e.id===`git-identity`)?.status===`ok`,[i,a]=(0,k.useState)(null),o=i??(r?`afk`:`identity`);return n.isLoading?(0,A.jsx)(`div`,{className:`open-project`,children:(0,A.jsx)(F,{children:`preparing setup…`})}):o===`project`?(0,A.jsx)(XC,{firstRun:!0,onOpened:e,onCancel:t}):(0,A.jsx)(`div`,{className:`open-project`,children:(0,A.jsxs)(`div`,{className:`op-card wizard-card`,children:[(0,A.jsx)(`div`,{className:`op-logo`,children:(0,A.jsx)(ki,{size:22,variant:`ink`})}),(0,A.jsx)($C,{current:o}),o===`identity`?(0,A.jsx)(ew,{onNext:()=>a(`afk`)}):(0,A.jsx)(tw,{onNext:()=>a(`project`)})]})})}var QC=[{key:`identity`,label:`Git identity`},{key:`afk`,label:`AFK burns`},{key:`project`,label:`First project`}];function $C({current:e}){let t=QC.findIndex(t=>t.key===e);return(0,A.jsx)(`ol`,{className:`wizard-steps`,"aria-label":`Setup progress`,children:QC.map((e,n)=>(0,A.jsxs)(`li`,{className:`wizard-step${n===t?` is-current`:``}${n<t?` is-done`:``}`,children:[(0,A.jsx)(`span`,{className:`wizard-step-dot`,"aria-hidden":!0}),e.label]},e.key))})}function ew({onNext:e}){let[t,n]=(0,k.useState)(``),[r,i]=(0,k.useState)(``),a=Ji(),o=N.useUtils(),s=N.setup.gitIdentity.useMutation({onSuccess:async()=>{await o.setup.doctor.invalidate(),e()},onError:e=>a.push(e.message)}),c=t.trim()!==``&&r.includes(`@`),l=()=>c&&s.mutate({name:t.trim(),email:r.trim()});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`op-kick`,children:`WELCOME TO RUNCASTLE`}),(0,A.jsx)(`div`,{className:`op-h`,children:`Set your git identity`}),(0,A.jsxs)(`div`,{className:`op-sub`,children:[`runcastle commits documentation and merges on your behalf, so it needs a name and email. This writes to `,(0,A.jsx)(`code`,{className:`mono`,children:`git config --global`}),`.`]}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`wiz-name`,children:`Name`}),(0,A.jsx)(`input`,{id:`wiz-name`,className:`op-input mono`,value:t,onChange:e=>n(e.target.value),placeholder:`Ada Lovelace`,autoFocus:!0,spellCheck:!1,onKeyDown:e=>e.key===`Enter`&&l()}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`wiz-email`,children:`Email`}),(0,A.jsx)(`input`,{id:`wiz-email`,className:`op-input mono`,value:r,onChange:e=>i(e.target.value),placeholder:`ada@example.com`,spellCheck:!1,onKeyDown:e=>e.key===`Enter`&&l()}),(0,A.jsx)(`div`,{className:`op-actions`,children:(0,A.jsx)(P,{variant:`solid`,onClick:l,disabled:!c||s.isPending,children:s.isPending?`Saving…`:`Continue`})})]})}function tw({onNext:e}){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(MC,{onDismiss:e}),(0,A.jsx)(`div`,{className:`op-actions`,children:(0,A.jsx)(P,{variant:`solid`,onClick:e,children:`Continue to your first project`})})]})}var nw=`runcastle.update.dismissed`;function rw(e,t){return e.updateAvailable&&e.latest!==null&&e.latest!==t}function iw(){let e=N.system.checkUpdate.useQuery(void 0,{staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),[t,n]=(0,k.useState)(()=>{try{return localStorage.getItem(nw)}catch{return null}}),r=e.data;return!r||!r.latest||!rw(r,t)?null:(0,A.jsxs)(`div`,{className:`update-banner`,role:`status`,children:[(0,A.jsx)(`span`,{className:`update-banner-dot`,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`update-banner-text`,children:[`runcastle `,(0,A.jsx)(`strong`,{children:r.latest}),` is available`,(0,A.jsx)(`span`,{className:`update-banner-sep`,children:` · `}),(0,A.jsxs)(`span`,{className:`update-banner-dim`,children:[`you're on `,r.current]})]}),(0,A.jsx)(`code`,{className:`update-banner-cmd`,children:r.command}),(0,A.jsx)(`button`,{className:`update-banner-dismiss`,onClick:()=>{try{localStorage.setItem(nw,r.latest)}catch{}n(r.latest)},"aria-label":`Dismiss update notice`,title:`Dismiss`,children:`×`})]})}function aw(){let e=di(),t;return t=e.projects===void 0?(0,A.jsx)(`div`,{className:`app-loading`,children:(0,A.jsx)(F,{children:`loading projects…`})}):e.view===`open`&&e.projects.length===0?(0,A.jsx)(ZC,{onOpened:e.enterProject,onCancel:e.cancelOpen}):e.view===`open`?(0,A.jsx)(XC,{firstRun:!1,onOpened:e.enterProject,onCancel:e.cancelOpen}):e.view===`project`&&e.currentProjectId?(0,A.jsx)(UC,{projectId:e.currentProjectId,nav:e},e.currentProjectId):(0,A.jsx)(GC,{nav:e}),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(iw,{}),t]})}function ow(){return(0,A.jsx)(aw,{})}function sw(){let[e]=(0,k.useState)(()=>new Je({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})),[t]=(0,k.useState)(()=>N.createClient({links:[qn({url:`/api/trpc`})]}));return(0,A.jsx)(N.Provider,{client:t,queryClient:e,children:(0,A.jsx)(tt,{client:e,children:(0,A.jsx)(qi,{children:(0,A.jsx)(ow,{})})})})}var cw=document.getElementById(`root`);if(!cw)throw Error(`#root not found`);(0,br.createRoot)(cw).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(sw,{})}));
109
+ `)){let e=t.match(/^##\s+(.+?)\s*$/);e?(i(),n=e[1]):n!==null&&r.push(t)}return i(),t}function ZS({full:e,driving:t}){let{feature:n,tickets:r,runs:i}=e,a=e.sessions.some(e=>e.status===`live`||e.status===`launching`),o=Op(Lp(n.id)),s=hp(i),c=r.length,l=r.filter(e=>e.status===`done`).length,u=r.filter(e=>e.status===`failed`).length,d=r.reduce((e,t)=>e+t.commits.length,0),f=t?.featureId===n.id,p=u>0?`var(--danger)`:`var(--ok)`,m=s?.status===`succeeded`?`var(--ok)`:s?.status===`failed`?`var(--danger)`:`var(--text-3)`;return(0,A.jsxs)(`div`,{className:`review-body`,children:[(0,A.jsx)(zS,{featureId:n.id,sessions:e.sessions,className:`review-session`}),o&&(0,A.jsx)(QS,{featureId:n.id,branch:n.branch,conflict:o,sessionLive:a}),(0,A.jsxs)(`div`,{className:`review-grid`,children:[(0,A.jsxs)(`div`,{className:`review-card`,children:[(0,A.jsx)(Bi,{children:`Summary`}),(0,A.jsxs)(`div`,{className:`check-row`,children:[(0,A.jsx)(`span`,{className:`check-dot`,style:{background:p}}),(0,A.jsx)(`span`,{className:`check-k`,children:`tickets`}),(0,A.jsxs)(`span`,{className:`check-v`,children:[l,`/`,c,` done`,u>0?` · ${u} failed`:``]})]}),(0,A.jsxs)(`div`,{className:`check-row`,children:[(0,A.jsx)(`span`,{className:`check-dot`,style:{background:m}}),(0,A.jsx)(`span`,{className:`check-k`,children:`run`}),(0,A.jsx)(`span`,{className:`check-v`,children:s?`${s.status}${s.summary?` · ${s.summary}`:``}`:`no run recorded`})]}),(0,A.jsxs)(`div`,{className:`check-row`,children:[(0,A.jsx)(`span`,{className:`check-dot`,style:{background:`var(--ph-shipped)`}}),(0,A.jsx)(`span`,{className:`check-k`,children:`changes`}),(0,A.jsxs)(`span`,{className:`check-v`,children:[d,` commit`,d===1?``:`s`]})]}),(0,A.jsx)(`div`,{className:`review-foot`,children:n.branch})]}),(0,A.jsxs)(`div`,{className:`review-card`,children:[(0,A.jsx)(Bi,{children:`Test drive`}),f&&t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`drive-live`,children:[(0,A.jsx)(`span`,{className:`drive-pulse`}),(0,A.jsx)(`span`,{className:`drive-label`,children:`driving now`}),(0,A.jsx)(`span`,{className:`drive-loc`,children:t.branch})]}),(0,A.jsx)(`div`,{className:`drive-copy`,children:`Click through the feature. When it feels right, merge — or stop the drive and send feedback back through tickets.`})]}):(0,A.jsx)(`div`,{className:`drive-copy`,children:`Nothing is running yet. Start the test drive from the next step to boot this branch on its own port and click through the feature yourself — the merge gate wants a human behind the wheel.`})]})]}),f&&(0,A.jsx)($S,{featureId:n.id})]})}function QS({featureId:e,branch:t,conflict:n,sessionLive:r}){let i=N.useUtils(),a=Ji(),o=N.feature.launchSession.useMutation({onSuccess:()=>void i.feature.get.invalidate({id:e}),onError:e=>a.push(e.message)});return(0,A.jsxs)(`div`,{className:`review-card conflict-card`,children:[(0,A.jsx)(Bi,{children:`Merge conflict`}),(0,A.jsxs)(`div`,{className:`drive-copy`,children:[`Merging `,(0,A.jsx)(`code`,{children:n.base}),` into `,(0,A.jsx)(`code`,{children:t}),` hit conflicts. An agent can merge the base into this branch in the talk worktree, resolve with full spec context, and commit — then retry Merge & ship.`]}),n.files.length>0&&(0,A.jsx)(`ul`,{className:`conflict-files`,children:n.files.map(e=>(0,A.jsx)(`li`,{children:e},e))}),!r&&(0,A.jsx)(P,{variant:`solid`,className:`conflict-resolve`,disabled:o.isPending,onClick:()=>o.mutate({featureId:e,kind:`revisit`,kickoffLine:Dp(n.base,t,n.files)}),children:`Resolve with agent`})]})}function $S({featureId:e}){let[t,n]=(0,k.useState)(!1),r=N.feature.driveInfo.useQuery(void 0,{refetchInterval:1500}).data;return!r||r.featureId!==e?null:(0,A.jsxs)(`div`,{className:`drive-pane`,children:[(0,A.jsxs)(`div`,{className:`drive-pane-strip`,children:[(0,A.jsx)(`span`,{className:`drive-pane-kind`,children:`dev server`}),(0,A.jsx)(`span`,{className:`drive-pane-loc`,children:r.branch}),(0,A.jsx)(`span`,{className:`drive-pane-spacer`}),r.devUrl&&(0,A.jsx)(`a`,{className:`drive-open`,href:r.devUrl,target:`_blank`,rel:`noreferrer noopener`,children:`Open app ↗`}),r.devPaneId&&(0,A.jsx)(`button`,{type:`button`,className:`btn btn-xs btn-ghost drive-pane-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:t?`Hide output`:`Show output`})]}),t&&(r.devPaneId?(0,A.jsx)(`div`,{className:`drive-pane-term`,children:(0,A.jsx)(fm,{label:`dev terminal`,children:(0,A.jsx)(RS,{sessionId:r.devPaneId})})}):(0,A.jsx)(`div`,{className:`drive-pane-empty`,children:`no dev command configured for this project`}))]})}function eC({full:e}){let t=[...Lp(e.feature.id)].reverse().find(e=>e.type===`feature.shipped`||e.type===`merge.conflict`||e.type===`feature.status`),n=t&&t.type===`feature.shipped`?Bp(t.ts):``;return(0,A.jsxs)(`div`,{className:`shipped-hero`,children:[(0,A.jsx)(`div`,{className:`shipped-check`,children:(0,A.jsx)(bi,{size:17})}),(0,A.jsx)(`div`,{className:`shipped-title`,children:`Shipped to main`}),(0,A.jsxs)(`div`,{className:`shipped-meta`,children:[(0,A.jsx)(gi,{size:12}),e.feature.branch,n?` · merged ${n} ago`:``]}),(0,A.jsx)(`div`,{className:`shipped-sub`,children:`The branch is merged and the pipeline is complete. The full history lives in the Activity tab.`})]})}function tC({featureId:e,readonly:t=!1}){let n=Ji(),r=N.feature.get.useQuery({id:e},{refetchInterval:1500}),[i,a]=(0,k.useState)(()=>new Set),o=r.data?.feature.projectId,s=N.settings.get.useQuery({projectId:o},{enabled:!!o}),c=s.data?.fields.find(e=>e.key===`stepModels.implement`&&e.source===`file`)??s.data?.fields.find(e=>e.key===`model`),l=typeof c?.value==`string`?c.value:`…`;if(r.isLoading)return(0,A.jsx)(F,{children:`loading tickets…`});if(!r.data)return(0,A.jsxs)(F,{children:[`could not load tickets: `,r.error?.message??`unknown`]});let u=r.data.tickets,d=u.length,f=u.filter(e=>e.status===`done`).length,p=u.filter(e=>e.status===`failed`).length,m=u.filter(e=>e.status===`burning`).length,h=u.filter(e=>e.status===`cancelled`).length,g=[`${f}/${d} done`];p>0&&g.push(`${p} failed`),m>0&&g.push(`${m} burning`),h>0&&g.push(`${h} cancelled`);let _=g.join(` · `),v=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),y=e=>{navigator.clipboard.writeText(e),n.push(`copied ${zp(e)}`,`info`)};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(zS,{featureId:e,sessions:r.data.sessions,className:`tickets-session`}),(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(Bi,{children:`Tickets`}),(0,A.jsx)(`span`,{className:`body-meta`,children:_}),(0,A.jsx)(`span`,{style:{flex:1}}),(0,A.jsxs)(`span`,{className:`chip chip-neutral`,title:`sandbox`,children:[`sandbox · `,cm]}),(0,A.jsx)(`span`,{className:`chip chip-neutral`,title:`model`,children:l})]}),d===0?(0,A.jsx)(`div`,{className:`ledger`,children:(0,A.jsx)(Vi,{icon:(0,A.jsx)(Ti,{size:16}),title:`No tickets yet`,hint:`A session breaks the spec into atomic, reviewable tickets — start one from the bar above.`,compact:!0})}):(0,A.jsx)(`div`,{className:`ledger`,children:u.map(e=>{let t=i.has(e.id);return(0,A.jsxs)(`div`,{className:`ledger-row${t?` is-open`:``}`,children:[(0,A.jsxs)(`button`,{className:`ledger-head`,onClick:()=>v(e.id),children:[(0,A.jsx)(`span`,{className:`lg-caret`,children:(0,A.jsx)(Si,{size:11})}),(0,A.jsxs)(`span`,{className:`lg-seq`,children:[`#`,e.seq]}),(0,A.jsx)(`span`,{className:`lg-title`,children:e.title}),e.blockedBy.length>0&&(0,A.jsxs)(`span`,{className:`lg-block`,title:`Runs after these tickets land`,children:[`after #`,e.blockedBy.join(`, #`)]}),(0,A.jsx)(`span`,{className:`lg-meta`,children:(0,A.jsx)(Ui,{status:e.status})})]}),t&&(0,A.jsxs)(`div`,{className:`ledger-detail`,children:[(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`GOAL`}),(0,A.jsx)(`div`,{className:`td-body`,children:e.goal})]}),e.context&&(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`CONTEXT`}),(0,A.jsx)(`div`,{className:`td-body`,children:e.context})]}),(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`ACCEPTANCE`}),(0,A.jsx)(`ul`,{className:`td-list`,children:e.acceptanceCriteria.map((e,t)=>(0,A.jsx)(`li`,{children:e},t))})]}),(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`SEAMS`}),(0,A.jsx)(`div`,{className:`td-seams`,children:e.seams.map((e,t)=>(0,A.jsx)(`span`,{className:`seam`,children:e},t))})]}),(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`COMMITS`}),e.commits.length===0?(0,A.jsx)(`div`,{className:`td-empty`,children:`no commits yet — the burn writes them`}):(0,A.jsx)(`div`,{className:`td-commits`,children:e.commits.map(e=>(0,A.jsx)(`button`,{className:`commit-sha`,onClick:()=>y(e),title:`copy full sha`,children:zp(e)},e))})]}),e.status===`failed`&&e.error&&(0,A.jsxs)(`div`,{className:`td-section td-error`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`Error`}),(0,A.jsx)(`div`,{className:`td-error-body`,children:e.error})]}),e.status===`cancelled`&&e.error&&(0,A.jsxs)(`div`,{className:`td-section`,children:[(0,A.jsx)(`div`,{className:`td-heading`,children:`Cancelled`}),(0,A.jsx)(`div`,{className:`td-body`,children:e.error})]})]})]},e.id)})})]})}function nC({ticketId:e}){let{chunks:t,live:n,trimmed:r}=rC(e),i=(0,k.useRef)(null),[a,o]=(0,k.useState)(!0),s=(0,k.useMemo)(()=>iC(t),[t]);return(0,k.useEffect)(()=>{if(!a)return;let e=i.current;e&&(e.scrollTop=e.scrollHeight)},[s,n,a]),(0,A.jsxs)(`div`,{className:`agent-body`,ref:i,onScroll:()=>{let e=i.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<24;o(t)},children:[r&&(0,A.jsx)(`div`,{className:`agent-trimmed`,children:`… earlier output trimmed …`}),s.length===0&&!n&&(0,A.jsx)(F,{children:`no agent output captured — transcripts are held in server memory for the current burn; older runs keep only the event timeline.`}),s.length===0&&n&&(0,A.jsx)(F,{children:`waiting for the agent's first output…`}),s.map((e,t)=>e.kind===`text`?(0,A.jsxs)(`div`,{className:`agent-turn`,children:[(0,A.jsx)(`span`,{className:`agent-glyph is-text`,children:`⏺`}),(0,A.jsx)(`span`,{className:`agent-prose`,children:e.text})]},t):(0,A.jsxs)(`div`,{className:`agent-turn is-tool`,children:[(0,A.jsx)(`span`,{className:`agent-glyph is-tool`,children:`●`}),(0,A.jsxs)(`span`,{className:`agent-toolline`,children:[(0,A.jsx)(`span`,{className:`agent-toolname`,children:e.name}),e.args&&(0,A.jsxs)(`span`,{className:`agent-toolargs`,children:[`(`,e.args,`)`]})]})]},t)),n&&(0,A.jsxs)(`div`,{className:`agent-live-row`,children:[(0,A.jsx)(`span`,{className:`agent-spinner`,children:`✳`}),(0,A.jsx)(`span`,{className:`agent-live-label`,children:`Burning…`}),(0,A.jsx)(`span`,{className:`agent-cursor`,children:`▍`})]}),!a&&(0,A.jsx)(`button`,{className:`follow-pill agent-follow`,onClick:()=>o(!0),children:`Follow ⇣`})]})}function rC(e){let[t,n]=(0,k.useState)([]),[r,i]=(0,k.useState)(!1),[a,o]=(0,k.useState)(!1),s=t.length>0?t[t.length-1].i:void 0,c=N.run.agentTranscript.useQuery({ticketId:e,after:s},{refetchInterval:1e3});return(0,k.useEffect)(()=>{let e=c.data;e&&(i(e.live),o(e.firstIndex>0),n(t=>{let n=t.length>0?t[t.length-1].i:-1;if(e.nextIndex<=n)return[];if(e.chunks.length===0)return t;let r=e.chunks.filter(e=>e.i>n);return r.length===0?t:[...t,...r]}))},[c.data]),{chunks:t,live:r,trimmed:a}}function iC(e){let t=[];for(let n of e){if(n.kind===`tool`){t.push({kind:`tool`,name:n.name??`tool`,args:aC(n.text)});continue}let e=t[t.length-1];e&&e.kind===`text`?e.text+=n.text:t.push({kind:`text`,text:n.text})}return t.map(e=>e.kind===`text`?{...e,text:e.text.trim()}:e).filter(e=>e.kind!==`text`||e.text.length>0)}function aC(e){let t=e.replace(/\s+/g,` `).trim();return t.length>300?`${t.slice(0,300)}…`:t}function oC({featureId:e,runId:t,readonly:n=!1}){let r=N.feature.get.useQuery({id:e},{refetchInterval:1500}),i=N.run.get.useQuery({runId:t},{refetchInterval:1500,enabled:!!t}),a=Lp(e),o=r.data?.tickets??[],s=(0,k.useMemo)(()=>a.filter(e=>e.runId===t),[a,t]),c=(0,k.useMemo)(()=>uC(s),[s]),[l,u]=(0,k.useState)(null),[d,f]=(0,k.useState)(`agent`),p=o.find(e=>e.status===`burning`)??[...o].reverse().find(e=>e.status===`done`||e.status===`failed`),m=l??p?.id??null,h=o.find(e=>e.id===m)??null,g=o.filter(e=>e.status===`done`).length,_=o.length,v=i.data?Vp(i.data.startedAt,i.data.endedAt??Date.now()):``,y=r.data?.sessions??[],b=y.some(e=>e.status===`live`||e.status===`launching`);return!t&&!b?(0,A.jsx)(`div`,{className:`surface`,children:(0,A.jsx)(Vi,{icon:(0,A.jsx)(wi,{size:16}),title:`No run yet`,hint:`Burning the tickets starts a run — one agent per ticket, each in its own lane.`})}):(0,A.jsxs)(`div`,{children:[(0,A.jsx)(zS,{featureId:e,sessions:y,className:`tickets-session`}),(0,A.jsxs)(`div`,{className:`body-title`,children:[(0,A.jsx)(`span`,{className:`section-title`,children:`Run`}),i.data&&(0,A.jsx)(Wi,{status:i.data.status}),(0,A.jsxs)(`span`,{className:`body-meta`,children:[g,`/`,_,` done · `,v]})]}),(0,A.jsxs)(`div`,{className:`run-split`,children:[(0,A.jsxs)(`div`,{className:`run-lanes-panel`,children:[(0,A.jsx)(`div`,{className:`panel-cap`,children:`Ticket lanes`}),(0,A.jsxs)(`div`,{className:`run-lanes`,children:[o.length===0&&(0,A.jsx)(F,{children:`no ticket lanes`}),o.map(e=>(0,A.jsx)(sC,{ticket:e,duration:c.get(e.id),selected:e.id===m,readonly:n,onSelect:()=>{u(e.id),f(`agent`)}},e.id))]})]}),(0,A.jsxs)(`div`,{className:`run-stream-panel`,children:[(0,A.jsxs)(`div`,{className:`stream-head`,children:[(0,A.jsxs)(`div`,{className:`panel-tabs`,children:[(0,A.jsxs)(`button`,{className:`panel-tab${d===`agent`?` is-active`:``}`,onClick:()=>f(`agent`),children:[`Agent`,h&&(0,A.jsxs)(`span`,{className:`panel-tab-ctx`,children:[`#`,h.seq]})]}),(0,A.jsx)(`button`,{className:`panel-tab${d===`events`?` is-active`:``}`,onClick:()=>f(`events`),children:`Events`})]}),d===`agent`&&h?.status===`burning`&&(0,A.jsx)(`span`,{className:`agent-live-dot`,title:`agent running`})]}),d===`agent`?h?(0,A.jsx)(fm,{label:`agent transcript`,children:(0,A.jsx)(nC,{ticketId:h.id},h.id)}):(0,A.jsx)(`div`,{className:`agent-body`,children:(0,A.jsx)(F,{children:`No agent yet — lanes light up here as tickets start burning.`})}):(0,A.jsx)(cC,{events:s})]})]})]})}function sC({ticket:e,duration:t,selected:n,readonly:r,onSelect:i}){let a=Ji(),o=N.useUtils(),s={onSuccess:()=>o.feature.get.invalidate({id:e.featureId}),onError:e=>a.push(e.message)},c=N.ticket.retry.useMutation(s),l=N.ticket.stop.useMutation(s),u=e=>{navigator.clipboard?.writeText(e).then(()=>a.push(`copied ${zp(e)}`,`info`),()=>a.push(`copy failed`))},d=[`burning`,`done`,`failed`].includes(e.status)?` status-${e.status}`:``,f=e.commits.length>0,p=t!==void 0,m=e.status===`failed`?e.error?.split(`
110
+ `)[0]:void 0,h=c.isPending||l.isPending;return(0,A.jsxs)(`div`,{className:`lane is-clickable${d}${n?` is-selected`:``}`,role:`button`,tabIndex:0,title:`show this ticket's agent`,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&i()},children:[(0,A.jsxs)(`div`,{className:`lane-head`,children:[(0,A.jsxs)(`span`,{className:`lane-seq`,children:[`#`,e.seq]}),(0,A.jsx)(`span`,{className:`lane-title`,children:e.title}),(0,A.jsx)(Ui,{status:e.status})]}),m&&(0,A.jsx)(`div`,{className:`lane-error`,title:e.error,children:m}),!r&&e.status===`failed`&&(0,A.jsxs)(`div`,{className:`lane-actions`,children:[(0,A.jsx)(`button`,{className:`lane-btn`,disabled:h,title:`retry this ticket — continues from any commits preserved by previous attempts`,onClick:t=>{t.stopPropagation(),c.mutate({ticketId:e.id},{onSuccess:t=>{t.resumedFrom&&a.push(`resuming ticket #${e.seq} from ${t.preservedCommits} preserved commit(s)`,`info`)}})},children:`Retry`}),(0,A.jsx)(`button`,{className:`lane-btn lane-btn-danger`,disabled:h,title:`discard any preserved commits from previous attempts and redo the ticket from the feature branch tip`,onClick:t=>{t.stopPropagation(),confirm(`Discard ticket #${e.seq}'s preserved work (if any) and start over?`)&&c.mutate({ticketId:e.id,fresh:!0})},children:`Retry fresh`})]}),!r&&e.status===`burning`&&(0,A.jsx)(`div`,{className:`lane-actions`,children:(0,A.jsx)(`button`,{className:`lane-btn lane-btn-danger`,disabled:h,title:`stop this ticket's agent — other lanes keep burning; committed work is preserved for retry`,onClick:t=>{t.stopPropagation(),l.mutate({ticketId:e.id},{onSuccess:e=>{e.stopped||a.push(`no live agent for this ticket (already finishing?)`,`info`)}})},children:`Stop ticket`})}),(f||p)&&(0,A.jsxs)(`div`,{className:`lane-foot`,children:[(0,A.jsx)(`span`,{className:`lane-commits`,children:e.commits.map(e=>(0,A.jsx)(`button`,{className:`commit-sha`,onClick:t=>{t.stopPropagation(),u(e)},title:`copy sha`,children:zp(e)},e))}),p&&(0,A.jsx)(`span`,{className:`lane-dur`,children:Vp(0,t)})]})]})}function cC({events:e}){let t=(0,k.useRef)(null),[n,r]=(0,k.useState)(!0);return(0,k.useEffect)(()=>{if(!n)return;let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[e,n]),(0,A.jsxs)(`div`,{className:`stream-body`,ref:t,onScroll:()=>{let e=t.current;if(!e)return;let n=e.scrollHeight-e.scrollTop-e.clientHeight<24;r(n)},children:[e.length===0&&(0,A.jsx)(F,{children:`waiting for events…`}),e.map(e=>(0,A.jsxs)(`div`,{className:`stream-line level-${lC(e.type)}`,children:[(0,A.jsx)(`span`,{className:`sl-time`,children:Rp(e.ts)}),(0,A.jsx)(`span`,{className:`sl-type`,children:e.type}),(0,A.jsx)(`span`,{className:`sl-msg`,children:e.message})]},e.id)),!n&&(0,A.jsx)(`button`,{className:`follow-pill agent-follow`,onClick:()=>r(!0),children:`Follow ⇣`})]})}function lC(e){return/(error|fail|conflict|cancel|stopped)/i.test(e)?`error`:/(done|succeed|finished|shipped|merged)/i.test(e)?`ok`:/(start|burn|launch|advance|running|retry|resum)/i.test(e)?`active`:`info`}function uC(e){let t=new Map;for(let n of e){if(!n.ticketId)continue;let e=t.get(n.ticketId);e?(e.min=Math.min(e.min,n.ts),e.max=Math.max(e.max,n.ts)):t.set(n.ticketId,{min:n.ts,max:n.ts})}let n=new Map;for(let[e,r]of t)r.max>r.min&&n.set(e,r.max-r.min);return n}function dC({featureId:e,viewedPhase:t,onViewPhase:n,guidance:r,driving:i,onDriveChange:a}){let o=N.useUtils(),s=Ji(),c=N.feature.get.useQuery({id:e},{refetchInterval:1500}),l=hC(e),u=()=>{o.feature.get.invalidate({id:e}),o.feature.list.invalidate()},d=N.feature.launchSession.useMutation({onSuccess:u,onError:e=>s.push(e.message)}),f=N.feature.advance.useMutation({onSuccess:()=>{u(),n(null)},onError:e=>s.push(e.message)}),p=N.feature.burn.useMutation({onSuccess:()=>{u(),n(null)},onError:e=>s.push(e.message)}),m=N.run.cancel.useMutation({onSuccess:()=>{u(),s.push(`cancel requested`,`info`)},onError:e=>s.push(e.message)}),h=N.feature.testDrive.useMutation({onError:e=>s.push(e.message)}),g=N.feature.merge.useMutation({onError:e=>s.push(e.message)}),_=N.feature.unarchive.useMutation({onSuccess:()=>{u(),s.push(`feature unarchived`,`success`)},onError:e=>s.push(e.message)});if(c.isLoading)return(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(`div`,{className:`ws-body`,children:(0,A.jsx)(F,{children:`loading feature…`})})});if(!c.data)return(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(`div`,{className:`ws-body`,children:(0,A.jsxs)(F,{children:[`could not load feature`,c.error?`: ${c.error.message}`:``]})})});let v=!!c.error,y=c.data,b=y.feature,x=Cp(b,t),S=wp(b,x),ee=Tp(b,x),C=hp(y.runs),te=Ap(y,{driving:i?.featureId===b.id}),ne=d.isPending||f.isPending||p.isPending||m.isPending||h.isPending||g.isPending||_.isPending;return(0,A.jsxs)(`section`,{className:`workspace`,children:[(0,A.jsxs)(`div`,{className:`ws-head`,children:[(0,A.jsxs)(`div`,{className:`ws-title-row`,children:[(0,A.jsx)(Hi,{phase:b.phase}),(0,A.jsx)(`span`,{className:`ws-title`,children:b.title}),(0,A.jsx)(`span`,{className:`ws-title-spacer`}),(0,A.jsxs)(`button`,{className:`ws-branch`,title:`Copy branch name`,onClick:()=>gC(b.branch,s),children:[(0,A.jsx)(gi,{size:11}),b.branch]})]}),(0,A.jsx)(pC,{steps:ee,onView:e=>n(e===b.phase?null:e)})]}),S?(0,A.jsxs)(`div`,{className:`readonly-bar`,children:[(0,A.jsx)(`span`,{className:`readonly-tag`,children:`READ-ONLY`}),(0,A.jsxs)(`span`,{children:[`You're viewing the `,gp[x],` phase.`]}),(0,A.jsxs)(`button`,{className:`readonly-back`,onClick:()=>n(null),children:[`Back to `,gp[b.phase],` →`]})]}):(0,A.jsx)(mC,{ns:te,guidance:r,busy:ne,onAction:t=>{switch(t){case`startGrill`:d.mutate({featureId:e,kind:`ideation`});break;case`askQuestions`:d.mutate({featureId:e,kind:`qa`});break;case`revisit`:d.mutate({featureId:e,kind:`revisit`,kickoffLine:b.phase===`review`?Ep:void 0});break;case`openGrill`:n(null),requestAnimationFrame(()=>document.getElementById(`grill-term`)?.scrollIntoView({behavior:`smooth`,block:`center`}));break;case`advance`:f.mutate({featureId:e});break;case`burn`:p.mutate({featureId:e});break;case`cancelRun`:C&&m.mutate({runId:C.id});break;case`unarchive`:_.mutate({featureId:e});break;case`testDriveStart`:h.mutate({featureId:e,action:`start`},{onSuccess:t=>{u(),t.ok&&t.branch?a({featureId:e,branch:t.branch}):t.ok||s.push(t.deniedReason??`test drive denied`)}});break;case`testDriveStop`:h.mutate({featureId:e,action:`stop`},{onSuccess:()=>{u(),a(null)}});break;case`merge`:g.mutate({featureId:e},{onSuccess:e=>{if(u(),e.ok)a(null),s.push(`merged — feature shipped`,`success`);else if(e.conflict){let t=e.files.length;s.push(t>0?`merge conflict in ${t} file${t===1?``:`s`} — resolve below and retry`:`merge conflict — resolve below and retry`)}}});break}}}),v&&(0,A.jsxs)(`div`,{className:`ws-banner is-offline`,role:`status`,children:[(0,A.jsx)(`span`,{className:`ws-banner-tag`,children:`OFFLINE`}),(0,A.jsx)(`span`,{children:`server unreachable — retrying…`})]}),l.message&&(0,A.jsxs)(`div`,{className:`ws-banner`,role:`alert`,onClick:l.dismiss,title:`dismiss`,children:[(0,A.jsx)(`span`,{className:`ws-banner-tag`,children:`RESUME FAILED`}),(0,A.jsx)(`span`,{children:l.message})]}),(0,A.jsx)(`div`,{className:`ws-body`,children:(0,A.jsx)(`div`,{className:`ws-body-inner`,children:(0,A.jsx)(fC,{effective:x,full:y,driving:i,runId:C?.id??null,readonly:S})},x)})]})}function fC({effective:e,full:t,driving:n,runId:r,readonly:i}){switch(e){case`ideation`:case`spec`:return(0,A.jsx)(US,{full:t,effective:e});case`tickets`:return(0,A.jsx)(tC,{featureId:t.feature.id,readonly:i});case`implementation`:return(0,A.jsx)(oC,{featureId:t.feature.id,runId:r,readonly:i});case`review`:return(0,A.jsx)(ZS,{full:t,driving:n});case`shipped`:return(0,A.jsx)(eC,{full:t})}}function pC({steps:e,onView:t}){return(0,A.jsx)(`div`,{className:`pipeline`,children:e.map((n,r)=>(0,A.jsxs)(k.Fragment,{children:[(0,A.jsxs)(`button`,{className:`pstep is-${n.state}${n.isViewed?` is-viewed`:``}${n.clickable?` is-clickable`:``}`,title:n.tip,disabled:!n.clickable,onClick:()=>n.clickable&&t(n.phase),children:[(0,A.jsx)(`span`,{className:`pstep-dot`}),(0,A.jsx)(`span`,{className:`pstep-label`,children:n.label})]}),r<e.length-1&&(0,A.jsx)(`span`,{className:`pconn${n.state===`done`?` is-done`:``}`})]},n.phase))})}function mC({ns:e,guidance:t,busy:n,onAction:r}){let i=e.kick===`IN PROGRESS`?`is-progress`:e.kick===`SHIPPED`?`is-shipped`:e.kick===`WAITING`?`is-waiting`:``;return(0,A.jsxs)(`div`,{className:`nextstep`,children:[e.busy&&(0,A.jsx)(`span`,{className:`spin-ring nextstep-spin`}),(0,A.jsxs)(`div`,{className:`nextstep-main`,children:[(0,A.jsx)(`div`,{className:`nextstep-kick ${i}`,children:e.kick}),(0,A.jsx)(`div`,{className:`nextstep-title`,children:e.title}),t&&(0,A.jsx)(`div`,{className:`nextstep-desc`,children:e.desc})]}),(0,A.jsxs)(`div`,{className:`nextstep-actions`,children:[e.secondary.map((e,t)=>(0,A.jsx)(P,{variant:`ghost`,className:`btn-xs`,disabled:n,onClick:()=>r(e.kind),children:e.label},t)),e.primary&&(0,A.jsx)(P,{variant:e.primary.danger?`danger`:`solid`,disabled:n,onClick:()=>r(e.primary.kind),children:n?`Working…`:e.primary.label})]})]})}function hC(e){let t=Lp(e),[n,r]=(0,k.useState)(null),i=(0,k.useRef)(null);return(0,k.useEffect)(()=>{if(t.length===0)return;let e=t[t.length-1].id;if(i.current===null){i.current=e;return}let n=i.current;i.current=e;let a=t.filter(e=>e.id>n&&e.type===`session.resume_failed`),o=a[a.length-1];o&&r(o.message||`session resume failed — relaunch to continue`)},[t]),(0,k.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(null),8e3);return()=>clearTimeout(e)},[n]),{message:n,dismiss:()=>r(null)}}function gC(e,t){navigator.clipboard.writeText(e).then(()=>t.push(`copied ${e}`,`info`)).catch(()=>t.push(`copy failed`))}function _C({projectId:e,onCancel:t,onCreated:n}){let[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(``),[s,c]=(0,k.useState)(``),l=N.useUtils(),u=Ji(),d=N.project.branches.useQuery({projectId:e}),f=d.data?.mainBranch??``,p=d.data?.current,m=d.data?.branches??[],h=d.data?.remoteBranches??[],g=m.length===0&&h.length===0,_=d.data?fp(d.data):f,v=s||_,y=N.feature.launchSession.useMutation(),b=N.feature.create.useMutation({onSuccess:async e=>{await l.feature.list.invalidate(),y.mutate({featureId:e.id,kind:`ideation`},{onSettled:()=>void l.feature.get.invalidate({id:e.id})}),n(e.id)},onError:e=>u.push(e.message)}),x=vC(r),S=b.isPending||y.isPending,ee=()=>{let t=r.trim();t&&b.mutate({projectId:e,title:t,oneLiner:a.trim(),baseBranch:s||void 0})};return(0,A.jsx)(`div`,{className:`nf-overlay`,children:(0,A.jsxs)(`div`,{className:`nf-card`,children:[(0,A.jsx)(`div`,{className:`nf-kick`,children:`NEW FEATURE`}),(0,A.jsx)(`div`,{className:`nf-h`,children:`What are we building?`}),(0,A.jsx)(`div`,{className:`nf-sub`,children:`Name it — runcastle opens a grill session so you and Claude shape the idea before any code is written.`}),(0,A.jsx)(`input`,{className:`nf-input`,value:r,onChange:e=>i(e.target.value),placeholder:`e.g. Slack notifications on failed runs`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&ee(),e.key===`Escape`&&t()}}),(0,A.jsx)(`input`,{className:`nf-input nf-oneliner`,value:a,onChange:e=>o(e.target.value),placeholder:`one-liner (optional) — what & why in a sentence`,onKeyDown:e=>{e.key===`Enter`&&ee(),e.key===`Escape`&&t()}}),(0,A.jsxs)(`details`,{className:`nf-advanced`,children:[(0,A.jsx)(`summary`,{className:`nf-advanced-summary`,children:`Advanced`}),(0,A.jsxs)(`div`,{className:`nf-base`,children:[(0,A.jsx)(`label`,{className:`nf-base-label`,htmlFor:`nf-base-select`,children:`Branch from`}),(0,A.jsxs)(`select`,{id:`nf-base-select`,className:`nf-base-select`,value:v,disabled:d.isPending||g,onChange:e=>c(e.target.value),children:[m.map(e=>(0,A.jsxs)(`option`,{value:e,children:[e,e===f?` (default)`:``,e===p&&e!==f?` (current)`:``]},e)),h.length>0&&(0,A.jsx)(`optgroup`,{label:`Remote (creates a local branch)`,children:h.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))})]}),(0,A.jsx)(`span`,{className:`size-hint`,children:`forks off this branch — and merges back into it when shipped.`})]}),(0,A.jsxs)(`div`,{className:`nf-branch`,children:[`branch · feature/`,x||`…`,` ← `,v||`…`]})]}),(0,A.jsxs)(`div`,{className:`nf-actions`,children:[(0,A.jsx)(P,{variant:`ghost`,onClick:t,disabled:S,children:`Cancel`}),(0,A.jsx)(P,{variant:`solid`,onClick:ee,disabled:!r.trim()||S,children:S?`Starting…`:`Start grill session`})]})]})})}function vC(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40)}function yC(e){let{open:t,onClose:n,features:r,selectedFeatureId:i,onSelect:a,onNewFeature:o,onOpenSettings:s,nav:c}=e,[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(0),p=(0,k.useRef)(null),m=(0,k.useRef)([]);(0,k.useEffect)(()=>{t&&(u(``),f(0),p.current?.focus())},[t]),(0,k.useEffect)(()=>{f(0)},[l]);let h=l.trim().toLowerCase(),g=(0,k.useMemo)(()=>h===``?r:r.filter(e=>e.slug.toLowerCase().includes(h)||e.title.toLowerCase().includes(h)),[r,h]),_=(0,k.useMemo)(()=>(c.projects??[]).filter(e=>e.id!==c.currentProjectId),[c.projects,c.currentProjectId]),v=(0,k.useMemo)(()=>h===``?_:_.filter(e=>e.name.toLowerCase().includes(h)),[_,h]),y=`create new feature`.includes(h),b=`all projects home`.includes(h),x=`open a project`.includes(h),S=`settings preferences`.includes(h),ee=(0,k.useMemo)(()=>{let e=g.map(e=>({kind:`feature`,feature:e}));for(let t of v)e.push({kind:`project`,id:t.id,name:t.name,branch:t.mainBranch,current:!1});return y&&e.push({kind:`newFeature`}),b&&e.push({kind:`home`}),x&&e.push({kind:`openProject`}),S&&e.push({kind:`settings`}),e},[g,v,y,b,x,S]);if(!t)return null;let C=e=>{if(ee.length===0)return;let t=(d+e+ee.length)%ee.length;f(t),m.current[t]?.scrollIntoView({block:`nearest`})},te=e=>{let t=ee[e];if(t){switch(t.kind){case`feature`:a(t.feature.id);break;case`project`:c.enterProject(t.id);break;case`newFeature`:o();break;case`home`:c.goHome();break;case`openProject`:c.showOpen();break;case`settings`:s();break}n()}},ne=e=>{e.key===`ArrowDown`?(e.preventDefault(),C(1)):e.key===`ArrowUp`?(e.preventDefault(),C(-1)):e.key===`Enter`?(e.preventDefault(),te(d)):e.key===`Escape`&&(e.preventDefault(),n())},w=g.length,re=w+v.length,ie=e=>t=>{m.current[e]=t};return(0,A.jsx)(`div`,{className:`cmdk-backdrop`,onClick:n,children:(0,A.jsxs)(`div`,{className:`cmdk`,onClick:e=>e.stopPropagation(),children:[(0,A.jsx)(`input`,{ref:p,className:`cmdk-input`,placeholder:`Search features, projects, or jump to…`,value:l,onChange:e=>u(e.target.value),onKeyDown:ne,"aria-label":`Search features, projects, or jump to`}),(0,A.jsxs)(`div`,{className:`cmdk-list`,children:[g.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`cmdk-group-label`,children:`Features`}),g.map((e,t)=>(0,A.jsxs)(`div`,{ref:ie(t),className:`cmdk-item${t===d?` is-active`:``}`,onMouseEnter:()=>f(t),onClick:()=>te(t),children:[(0,A.jsx)(`span`,{className:`cmdk-item-glyph`,children:(0,A.jsx)(`span`,{className:`feature-dot phase-bg-${e.phase}`})}),(0,A.jsx)(`span`,{className:`cmdk-item-label`,children:e.title}),(0,A.jsx)(`span`,{className:`cmdk-item-slug`,children:e.slug}),(0,A.jsx)(`span`,{className:`cmdk-item-hint`,children:e.id===i?`current`:e.phase})]},e.id))]}),v.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`cmdk-group-label`,children:`Switch project`}),v.map((e,t)=>{let n=w+t;return(0,A.jsxs)(`div`,{ref:ie(n),className:`cmdk-item${n===d?` is-active`:``}`,onMouseEnter:()=>f(n),onClick:()=>te(n),children:[(0,A.jsx)(`span`,{className:`cmdk-item-glyph`,children:(0,A.jsx)(Ei,{size:13})}),(0,A.jsx)(`span`,{className:`cmdk-item-label`,children:e.name}),(0,A.jsx)(`span`,{className:`cmdk-item-slug`,children:e.mainBranch}),(0,A.jsx)(`span`,{className:`cmdk-item-hint`,children:`project`})]},e.id)})]}),(y||b||x||S)&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`cmdk-group-label`,children:`Actions`}),y&&(0,A.jsx)(bC,{index:re,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:te,glyph:(0,A.jsx)(yi,{size:13}),label:`Create new feature`}),b&&(0,A.jsx)(bC,{index:re+ +!!y,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:te,glyph:(0,A.jsx)(Ei,{size:13}),label:`All projects (home)`}),x&&(0,A.jsx)(bC,{index:re+ +!!y+ +!!b,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:te,glyph:(0,A.jsx)(Ei,{size:13}),label:`Open a project…`}),S&&(0,A.jsx)(bC,{index:re+ +!!y+ +!!b+ +!!x,activeIndex:d,bindRow:ie,setActiveIndex:f,activate:te,glyph:(0,A.jsx)(mi,{size:13}),label:`Settings`})]}),ee.length===0&&(0,A.jsx)(`div`,{className:`cmdk-empty`,children:`No matches`})]}),(0,A.jsxs)(`div`,{className:`cmdk-foot`,children:[(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`kbd`,children:`↑↓`}),` navigate`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`kbd`,children:`↵`}),` select`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`kbd`,children:`esc`}),` close`]})]})]})})}function bC({index:e,activeIndex:t,bindRow:n,setActiveIndex:r,activate:i,glyph:a,label:o}){return(0,A.jsxs)(`div`,{ref:n(e),className:`cmdk-item${e===t?` is-active`:``}`,onMouseEnter:()=>r(e),onClick:()=>i(e),children:[(0,A.jsx)(`span`,{className:`cmdk-item-glyph`,children:a}),(0,A.jsx)(`span`,{className:`cmdk-item-label`,children:o}),(0,A.jsx)(`span`,{className:`cmdk-item-hint`,children:`action`})]})}var xC={serverPort:`RUNCASTLE_SERVER_PORT`,model:`RUNCASTLE_MODEL`,sandbox:`RUNCASTLE_SANDBOX`,sandboxImage:`RUNCASTLE_SANDBOX_IMAGE`,burnConcurrency:`RUNCASTLE_BURN_CONCURRENCY`,burnAttempts:`RUNCASTLE_BURN_ATTEMPTS`,mainBranch:`RUNCASTLE_MAIN_BRANCH`},SC=dp.map(e=>e.id),CC=`stepModels.`;function wC(e){return e.startsWith(CC)}function TC(e){return e.slice(11)}var EC={ideation:`Ideation`,qa:`Q&A`,waypoint:`Waypoint`,converge:`Converge`,research:`Research`,implement:`Implement`,smoke:`Smoke`},DC=lp.map(e=>`${CC}${e}`),OC=new Set([`mainBranch`]),kC={serverPort:{label:`Server port`,help:`Port the runcastle server listens on.`,control:`number`},model:{label:`Default model`,help:`Claude model every step inherits unless overridden below.`,control:`select`,options:SC},sandbox:{label:`Sandbox`,help:`Where launched sessions run.`,control:`select`,options:[`docker`,`noSandbox`]},sandboxImage:{label:`Sandbox image`,help:`Docker image used when a session is sandboxed.`,control:`text`},burnConcurrency:{label:`Burn concurrency`,help:`Max tickets burned in parallel per run (1–8). Each is a full agent.`,control:`number`},burnAttempts:{label:`Burn attempts`,help:`Max agent attempts per ticket per run (1–5). A transient crash (API drop, network) retries with committed work preserved.`,control:`number`},mainBranch:{label:`Main branch`,help:`Branch features merge back into.`,control:`text`},devCommand:{label:`Dev command`,help:`Command that starts this project's dev server.`,control:`text`}};function AC(e){return e==null?``:String(e)}function jC(e){if(wC(e)){let t=TC(e);return{label:EC[t]??t,help:`Model for the ${EC[t]??t} step.`,control:`select`,options:SC}}return kC[e]??{label:e,help:``,control:`text`}}function MC(e){let t=jC(e.key),n=OC.has(e.key),r=!e.editable||n,i=e.source===`project`,a=null;return e.source===`env`?a=`Set by ${xC[e.key]??`the environment`}`:n?a=`Read-only — detected from git`:e.scope===`project`&&(a=i?`Overridden for this project`:`Inherited from global`),{key:e.key,label:t.label,help:t.help,value:AC(e.value),control:t.control,options:t.options??[],readOnly:r,restartRequired:e.restartRequired,overridden:i,source:e.source,note:a,allowCustom:e.key===`model`||wC(e.key)}}function NC(e){return e.fields.filter(e=>!wC(e.key)).map(MC)}function PC(e){return e.fields.filter(e=>e.scope===`project`).map(MC)}function FC(e){return e.fields.filter(e=>wC(e.key)&&e.source===`file`).map(MC).sort((e,t)=>DC.indexOf(e.key)-DC.indexOf(t.key))}function IC(e){let t=new Set(e.fields.filter(e=>wC(e.key)&&e.source===`file`).map(e=>e.key));return DC.filter(e=>!t.has(e)).map(e=>({key:e,label:EC[TC(e)]??TC(e)}))}function LC({onDismiss:e}){let t=N.setup.doctor.useQuery(void 0,{refetchOnWindowFocus:!1}),n=t.data,r=e=>n?.results.find(t=>t.id===e),i=r(`container-runtime`),a=r(`sandcastle-image`),o=r(`afk-token`),s=()=>t.refetch();return(0,A.jsxs)(`div`,{className:`afk-card`,children:[(0,A.jsxs)(`div`,{className:`afk-card-head`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`op-kick`,children:`ENABLE AFK BURNS`}),(0,A.jsx)(`div`,{className:`afk-card-title`,children:`Run features unattended`})]}),e&&(0,A.jsx)(P,{variant:`ghost`,onClick:e,children:`Set up later`})]}),(0,A.jsx)(`p`,{className:`afk-card-sub`,children:`AFK burns run each feature to completion in a sandbox — no interactive session. They need a container runtime, the sandcastle image, and an auth token. Set them up now or anytime from Settings.`}),t.isLoading&&(0,A.jsx)(F,{children:`checking prerequisites…`}),t.error&&(0,A.jsxs)(F,{children:[`could not run checks: `,t.error.message]}),n&&(0,A.jsxs)(`div`,{className:`afk-rows`,children:[(0,A.jsx)(zC,{probe:i,onRecheck:s}),(0,A.jsx)(BC,{probe:a,runtimeOk:i?.status===`ok`,onDone:s}),(0,A.jsx)(VC,{probe:o,onDone:s})]})]})}function RC({probe:e,children:t}){if(!e)return null;let n=e.status===`ok`;return(0,A.jsxs)(`div`,{className:`afk-row${n?` is-ok`:``}`,children:[(0,A.jsxs)(`div`,{className:`afk-row-head`,children:[(0,A.jsx)(`span`,{className:`afk-dot afk-dot-${n?`ok`:`warn`}`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{className:`afk-row-text`,children:[(0,A.jsx)(`div`,{className:`afk-row-label`,children:e.label}),(0,A.jsx)(`div`,{className:`afk-row-detail mono`,children:e.detail})]})]}),!n&&(0,A.jsx)(`div`,{className:`afk-row-action`,children:t})]})}function zC({probe:e,onRecheck:t}){let n=N.setup.runtimeGuide.useQuery(void 0,{enabled:e?.status===`missing`,refetchOnWindowFocus:!1}),r=Ji();if(!e)return null;let i=e.status===`missing`?n.data:void 0,a=i?.command??e.fix??``;return(0,A.jsxs)(RC,{probe:e,children:[a&&(0,A.jsxs)(`div`,{className:`afk-cmd`,children:[(0,A.jsx)(`code`,{className:`afk-cmd-text mono`,children:a}),(0,A.jsx)(P,{variant:`ghost`,onClick:()=>{navigator.clipboard?.writeText(a),r.push(`copied`,`info`)},children:`Copy`})]}),i?.note&&(0,A.jsx)(`div`,{className:`afk-note`,children:i.note}),(0,A.jsx)(P,{variant:`solid`,onClick:t,children:`Re-check`})]})}function BC({probe:e,runtimeOk:t,onDone:n}){let[r,i]=(0,k.useState)(null),a=Ji(),o=N.setup.startTerminal.useMutation({onSuccess:({sessionId:e})=>i(e),onError:e=>a.push(e.message)});return e?(0,A.jsx)(RC,{probe:e,children:r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`afk-term`,children:(0,A.jsx)(fm,{label:`build-image`,children:(0,A.jsx)(RS,{sessionId:r})})}),(0,A.jsx)(`div`,{className:`afk-term-actions`,children:(0,A.jsx)(P,{variant:`solid`,onClick:()=>{i(null),n()},children:`Done — re-check`})})]}):(0,A.jsx)(P,{variant:`solid`,disabled:!t||o.isPending,title:t?void 0:`Install a container runtime first`,onClick:()=>o.mutate({kind:`build-image`}),children:o.isPending?`Starting…`:`Build image`})}):null}function VC({probe:e,onDone:t}){let[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(``),[o,s]=(0,k.useState)(null),c=Ji(),l=N.setup.startTerminal.useMutation({onSuccess:({sessionId:e})=>r(e),onError:e=>c.push(e.message)}),u=N.setup.afkToken.useMutation({onSuccess:e=>{s(e),e.valid&&t()},onError:e=>c.push(e.message)});return e?(0,A.jsxs)(RC,{probe:e,children:[n?(0,A.jsx)(`div`,{className:`afk-term`,children:(0,A.jsx)(fm,{label:`setup-token`,children:(0,A.jsx)(RS,{sessionId:n})})}):(0,A.jsx)(P,{variant:`ghost`,onClick:()=>l.mutate({kind:`setup-token`}),disabled:l.isPending,children:l.isPending?`Starting…`:`Run claude setup-token`}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`afk-token-input`,children:`Paste the token it prints`}),(0,A.jsx)(`input`,{id:`afk-token-input`,className:`op-input mono`,value:i,onChange:e=>a(e.target.value),placeholder:`sk-ant-oat01-…`,spellCheck:!1,autoComplete:`off`}),(0,A.jsx)(`div`,{className:`afk-term-actions`,children:(0,A.jsx)(P,{variant:`solid`,disabled:i.trim()===``||u.isPending,onClick:()=>u.mutate({token:i}),children:u.isPending?`Verifying…`:`Save & verify`})}),o&&(0,A.jsxs)(`div`,{className:`afk-verdict ${o.valid?`is-ok`:`is-warn`}`,children:[o.valid?`✓ `:`⚠ `,o.detail]})]}):null}function HC({projectId:e,onClose:t}){let n=N.settings.get.useQuery(),r=N.settings.get.useQuery({projectId:e});return(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:t,children:(0,A.jsxs)(`div`,{className:`peek settings`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`settings-title`,children:`Settings`}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:t,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`peek-body settings-body`,children:[(0,A.jsx)(UC,{title:`Global`,hint:`Machine-wide defaults for every project.`,query:n,rowsOf:NC}),(0,A.jsx)(qC,{query:n}),(0,A.jsx)(UC,{title:`This project`,hint:`Overrides that apply only to the current project.`,query:r,rowsOf:PC,projectId:e}),(0,A.jsxs)(`section`,{className:`settings-section`,children:[(0,A.jsxs)(`div`,{className:`settings-section-head`,children:[(0,A.jsx)(`h3`,{className:`settings-section-title`,children:`AFK burns`}),(0,A.jsx)(`span`,{className:`settings-section-hint`,children:`Prerequisites for unattended sandbox runs.`})]}),(0,A.jsx)(LC,{})]})]})]})})}function UC({title:e,hint:t,query:n,rowsOf:r,projectId:i}){let a=n.data?r(n.data):[];return(0,A.jsxs)(`section`,{className:`settings-section`,children:[(0,A.jsxs)(`div`,{className:`settings-section-head`,children:[(0,A.jsx)(`h3`,{className:`settings-section-title`,children:e}),(0,A.jsx)(`span`,{className:`settings-section-hint`,children:t})]}),n.isLoading&&(0,A.jsx)(F,{children:`loading…`}),n.error&&(0,A.jsxs)(F,{children:[`could not load settings: `,n.error.message]}),n.data&&a.length===0&&(0,A.jsx)(F,{children:`no settings in this scope`}),a.map(e=>(0,A.jsx)(WC,{row:e,projectId:i},e.key))]})}function WC({row:e,projectId:t}){let n=N.useUtils(),r=Ji(),[i,a]=(0,k.useState)(e.value);(0,k.useEffect)(()=>a(e.value),[e.value]);let o=N.settings.update.useMutation({onSuccess:()=>{n.settings.get.invalidate()},onError:t=>{a(e.value),r.push(t.message)}}),s=n=>{let r=n.trim();if(r===e.value.trim())return;let i=e.control===`number`?Number(r):r;o.mutate({...t?{projectId:t}:{},key:e.key,value:i})},c=()=>t&&o.mutate({projectId:t,key:e.key,value:null}),l=`set-${e.key}`;return(0,A.jsxs)(`div`,{className:`settings-field${e.readOnly?` is-locked`:``}`,children:[(0,A.jsxs)(`label`,{className:`settings-field-head`,htmlFor:l,children:[(0,A.jsx)(`span`,{className:`settings-field-label`,children:e.label}),e.restartRequired&&(0,A.jsx)(`span`,{className:`settings-badge is-warn`,title:`Takes effect after a server restart`,children:`restart required`}),e.overridden&&(0,A.jsx)(`span`,{className:`settings-badge is-override`,children:`overridden`}),o.isPending&&(0,A.jsx)(`span`,{className:`settings-saving`,children:`saving…`})]}),e.help&&(0,A.jsx)(`div`,{className:`settings-field-help`,children:e.help}),e.readOnly?(0,A.jsx)(`div`,{className:`settings-readonly mono`,id:l,children:e.value||`—`}):e.control===`select`&&e.allowCustom?(0,A.jsx)(KC,{id:l,value:e.value,options:e.options,disabled:o.isPending,onCommit:s}):e.control===`select`?(0,A.jsx)(`select`,{id:l,className:`settings-input`,value:i,disabled:o.isPending,onChange:e=>{a(e.target.value),s(e.target.value)},children:e.options.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))}):(0,A.jsx)(`input`,{id:l,className:`settings-input mono`,type:e.control===`number`?`number`:`text`,value:i,disabled:o.isPending,onChange:e=>a(e.target.value),onBlur:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&(a(e.value),t.currentTarget.blur())}}),e.note&&(0,A.jsx)(`div`,{className:`settings-field-note`,children:e.note}),e.overridden&&t&&(0,A.jsx)(`button`,{className:`settings-clear`,onClick:c,disabled:o.isPending,children:`Clear override`})]})}var GC=`__custom__`;function KC({id:e,value:t,options:n,disabled:r,onCommit:i}){let[a,o]=(0,k.useState)(!n.includes(t)&&t!==``),[s,c]=(0,k.useState)(t);return(0,k.useEffect)(()=>{c(t),o(!n.includes(t)&&t!==``)},[t,n]),(0,A.jsxs)(`div`,{className:`settings-combo`,children:[(0,A.jsxs)(`select`,{id:e,className:`settings-input`,value:a?GC:t,disabled:r,onChange:e=>{if(e.target.value===GC){o(!0);return}o(!1),i(e.target.value)},children:[n.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e)),(0,A.jsx)(`option`,{value:GC,children:`Custom…`})]}),a&&(0,A.jsx)(`input`,{className:`settings-input mono`,type:`text`,placeholder:`model id (e.g. claude-opus-4-8)`,value:s,disabled:r,onChange:e=>c(e.target.value),onBlur:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}})]})}function qC({query:e}){let t=N.useUtils(),n=Ji(),[r,i]=(0,k.useState)(!1),a=N.settings.update.useMutation({onSuccess:()=>{t.settings.get.invalidate()},onError:e=>n.push(e.message)}),o=e.data,s=o?FC(o):[],c=o?IC(o):[],l=o?.fields.find(e=>e.key===`model`),u=(e,t)=>{let n=t.trim();n!==``&&a.mutate({key:e,value:n})};return(0,A.jsxs)(`section`,{className:`settings-section`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`settings-advanced-toggle`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,A.jsx)(`span`,{className:`settings-section-title`,children:`Advanced — per-step models`}),(0,A.jsxs)(`span`,{className:`settings-section-hint`,children:[s.length>0?`${s.length} override${s.length===1?``:`s`}`:`none set`,r?` ▾`:` ▸`]})]}),r&&(0,A.jsxs)(`div`,{className:`settings-advanced-body`,children:[s.length===0&&(0,A.jsx)(F,{children:`every step uses the default model.`}),s.map(e=>(0,A.jsxs)(`div`,{className:`settings-field`,children:[(0,A.jsxs)(`div`,{className:`settings-field-head`,children:[(0,A.jsx)(`span`,{className:`settings-field-label`,children:e.label}),a.isPending&&(0,A.jsx)(`span`,{className:`settings-saving`,children:`saving…`})]}),(0,A.jsx)(KC,{id:`step-${e.key}`,value:e.value,options:e.options,disabled:a.isPending,onCommit:t=>u(e.key,t)}),(0,A.jsx)(`button`,{className:`settings-clear`,disabled:a.isPending,onClick:()=>a.mutate({key:e.key,value:null}),children:`Reset to default`})]},e.key)),c.length>0&&(0,A.jsxs)(`div`,{className:`settings-field`,children:[(0,A.jsx)(`label`,{className:`settings-field-label`,htmlFor:`step-add`,children:`Add an override`}),(0,A.jsxs)(`select`,{id:`step-add`,className:`settings-input`,value:``,disabled:a.isPending,onChange:e=>{let t=e.target.value;t&&u(t,typeof l?.value==`string`?l.value:``)},children:[(0,A.jsx)(`option`,{value:``,children:`Choose a step…`}),c.map(e=>(0,A.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]})]})]})}function JC({projectId:e,nav:t}){let n=Li(e),{selectedFeatureId:r,select:i,setCmdk:a}=n,[o,s]=(0,k.useState)(null),c=N.feature.list.useQuery({projectId:e},{refetchInterval:1500});(0,k.useEffect)(()=>{!r&&c.data&&c.data.length>0&&i(c.data[0].id)},[r,c.data,i]),(0,k.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let l=!n.inspectorCollapsed&&!!n.selectedFeatureId&&!n.creating;return(0,A.jsxs)(`div`,{className:`shell${n.inspectorCollapsed?` inspector-collapsed`:``}`,children:[(0,A.jsx)(zi,{nav:t,onOpenCmdk:()=>n.setCmdk(!0),onOpenSettings:()=>n.setSettings(!0),onToggleInspector:n.toggleInspector,inspectorCollapsed:n.inspectorCollapsed}),(0,A.jsxs)(`div`,{className:`shell-body`,children:[(0,A.jsx)(Fp,{projectId:e,selectedFeatureId:n.selectedFeatureId,onSelect:n.select,onNewFeature:n.startCreate}),n.creating?(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(_C,{projectId:e,onCancel:n.cancelCreate,onCreated:n.select})}):n.selectedFeatureId?(0,A.jsx)(dC,{featureId:n.selectedFeatureId,viewedPhase:n.viewedPhase,onViewPhase:n.viewPhase,guidance:n.guidance,driving:o,onDriveChange:s},`ws-${n.selectedFeatureId}`):(0,A.jsx)(`section`,{className:`workspace`,children:(0,A.jsx)(YC,{onNewFeature:n.startCreate})}),l&&n.selectedFeatureId&&(0,A.jsx)(Up,{featureId:n.selectedFeatureId},`insp-${n.selectedFeatureId}`)]}),(0,A.jsx)(um,{projectId:e,activeFeatureId:n.selectedFeatureId,driving:o,onDriveChange:s}),(0,A.jsx)(yC,{open:n.cmdkOpen,onClose:()=>n.setCmdk(!1),features:c.data??[],selectedFeatureId:n.selectedFeatureId,onSelect:n.select,onNewFeature:n.startCreate,onOpenSettings:()=>n.setSettings(!0),nav:t}),n.settingsOpen&&(0,A.jsx)(HC,{projectId:e,onClose:()=>n.setSettings(!1)})]})}function YC({onNewFeature:e}){return(0,A.jsxs)(`div`,{className:`ws-empty`,children:[(0,A.jsx)(`div`,{className:`ws-empty-logo`,children:(0,A.jsx)(ki,{size:44,variant:`outline`})}),(0,A.jsx)(`div`,{className:`ws-empty-title`,children:`Select a feature to begin`}),(0,A.jsx)(`div`,{className:`ws-empty-sub`,children:`Or create one — every feature moves through the same guided pipeline.`}),(0,A.jsx)(`button`,{className:`btn btn-ghost`,onClick:e,children:`New feature`})]})}function XC({nav:e}){let t=e.projects??[],n=N.useQueries(e=>t.map(t=>e.feature.list({projectId:t.id},{refetchInterval:1500})));return(0,A.jsxs)(`div`,{className:`home-frame`,children:[(0,A.jsxs)(`header`,{className:`home-topbar`,children:[(0,A.jsxs)(`span`,{className:`tb-home`,children:[(0,A.jsx)(`span`,{className:`tb-logo`,children:(0,A.jsx)(ki,{size:17})}),(0,A.jsx)(Ai,{})]}),(0,A.jsx)(`span`,{className:`tb-spacer`}),(0,A.jsxs)(`button`,{className:`btn btn-ghost btn-xs`,onClick:e.showOpen,children:[(0,A.jsx)(yi,{size:11}),`Open a project`]})]}),(0,A.jsxs)(`div`,{className:`home`,children:[(0,A.jsxs)(`header`,{className:`home-head`,children:[(0,A.jsxs)(`div`,{className:`home-title`,children:[(0,A.jsx)(`span`,{className:`home-title-text`,children:`Projects`}),(0,A.jsx)(`span`,{className:`home-count`,children:t.length})]}),(0,A.jsx)(`p`,{className:`home-sub`,children:`Every open project and where it stands — runs keep going in the background while you switch.`})]}),(0,A.jsxs)(`div`,{className:`home-grid`,children:[t.map((t,r)=>{let i=n[r]?.data;return(0,A.jsx)(QC,{project:t,stats:li(i??[]),loading:i===void 0,onOpen:()=>e.enterProject(t.id)},t.id)}),(0,A.jsxs)(`button`,{className:`open-card`,onClick:e.showOpen,children:[(0,A.jsx)(`span`,{className:`open-card-plus`,children:(0,A.jsx)(yi,{size:16})}),(0,A.jsx)(`span`,{className:`open-card-label`,children:`Open a project`}),(0,A.jsx)(`span`,{className:`open-card-sub`,children:`Point runcastle at a local git repo`})]})]})]})]})}var ZC={attention:`Needs you`,working:`Agent working`,steady:`Steady`,empty:`No features yet`};function QC({project:e,stats:t,loading:n,onOpen:r}){let i=Ji(),a=N.useUtils(),[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(e.name),u=N.project.rename.useMutation({onSuccess:async()=>{await a.project.list.invalidate(),s(!1)},onError:e=>i.push(e.message)}),d=N.project.close.useMutation({onSuccess:async()=>{await a.project.list.invalidate(),i.push(`closed ${e.name}`,`info`)},onError:e=>i.push(e.message)}),f=t.activeRuns>0,p=()=>{let t=c.trim();t&&t!==e.name?u.mutate({projectId:e.id,name:t}):s(!1)};return(0,A.jsxs)(`div`,{className:`project-card health-${t.health}`,children:[(0,A.jsxs)(`button`,{className:`pc-main`,onClick:r,title:`Open ${e.name}`,children:[(0,A.jsxs)(`div`,{className:`pc-head`,children:[o?(0,A.jsx)(`input`,{className:`pc-rename mono`,value:c,autoFocus:!0,onClick:e=>e.stopPropagation(),onChange:e=>l(e.target.value),onKeyDown:t=>{t.stopPropagation(),t.key===`Enter`&&p(),t.key===`Escape`&&(l(e.name),s(!1))},onBlur:p}):(0,A.jsx)(`span`,{className:`pc-name`,children:e.name}),(0,A.jsx)(`span`,{className:`pc-health-dot health-dot-${t.health}`,title:ZC[t.health]})]}),(0,A.jsx)(`span`,{className:`pc-path mono`,children:e.repoPath}),(0,A.jsxs)(`span`,{className:`pc-branch`,children:[(0,A.jsx)(gi,{size:11}),e.mainBranch]}),(0,A.jsxs)(`div`,{className:`pc-stats`,children:[(0,A.jsx)($C,{n:t.total,label:t.total===1?`feature`:`features`}),(0,A.jsx)($C,{n:t.activeRuns,label:`running`,tone:f?`run`:void 0,spin:f}),(0,A.jsx)($C,{n:t.needsYou,label:`needs you`,tone:t.needsYou>0?`needs`:void 0})]}),(0,A.jsx)(`span`,{className:`pc-health-label`,children:n?`loading…`:ZC[t.health]})]}),(0,A.jsxs)(`div`,{className:`pc-actions`,children:[(0,A.jsx)(`button`,{className:`pc-action`,onClick:()=>{l(e.name),s(!0)},children:`Rename`}),(0,A.jsx)(`button`,{className:`pc-action pc-action-danger`,disabled:f||d.isPending,title:f?`a run is in flight — cannot close`:`Close project`,onClick:()=>d.mutate({projectId:e.id}),children:`Close`})]})]})}function $C({n:e,label:t,tone:n,spin:r}){return(0,A.jsxs)(`span`,{className:`pc-stat${n?` pc-stat-${n}`:``}`,children:[r&&(0,A.jsx)(`span`,{className:`spin-ring`}),(0,A.jsx)(`span`,{className:`pc-stat-n`,children:e}),(0,A.jsx)(`span`,{className:`pc-stat-label`,children:t})]})}function ew({onPick:e,onCancel:t}){let[n,r]=(0,k.useState)(void 0),[i,a]=(0,k.useState)(!1),o=N.project.roots.useQuery(),s=N.project.browse.useQuery({dir:n,showHidden:i},{placeholderData:e=>e,retry:!1});(0,k.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let c=s.data,l=c?.dir??n;return(0,A.jsx)(`div`,{className:`peek-backdrop`,onClick:t,children:(0,A.jsxs)(`div`,{className:`peek dir-picker`,role:`dialog`,"aria-modal":`true`,"aria-label":`Choose a repository`,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:`peek-head`,children:[(0,A.jsx)(`span`,{className:`dir-picker-title`,children:`Choose a repository`}),(0,A.jsx)(`button`,{className:`peek-close`,onClick:t,"aria-label":`Close (Esc)`,children:`✕`})]}),(0,A.jsxs)(`div`,{className:`dir-picker-bar`,children:[(0,A.jsx)(P,{variant:`ghost`,className:`dir-up`,onClick:()=>c?.parent&&r(c.parent),disabled:!c?.parent,"aria-label":`Up one level`,title:`Up one level`,children:`↑`}),(0,A.jsx)(`div`,{className:`dir-crumbs mono`,"aria-label":`Current path`,children:(c?.crumbs??[]).map((e,t)=>(0,A.jsxs)(`span`,{className:`dir-crumb-wrap`,children:[t>0&&(0,A.jsx)(Si,{size:11}),(0,A.jsx)(`button`,{className:`dir-crumb`,onClick:()=>r(e.path),children:e.name})]},e.path))}),(0,A.jsxs)(`label`,{className:`dir-hidden-toggle`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),(0,A.jsx)(`span`,{children:`Hidden`})]})]}),(0,A.jsxs)(`div`,{className:`dir-picker-body`,children:[(0,A.jsx)(`div`,{className:`dir-rail`,children:(o.data??[]).map(e=>(0,A.jsxs)(`button`,{className:`dir-rail-item${l===e.path?` is-active`:``}`,onClick:()=>r(e.path),title:e.path,children:[(0,A.jsx)(Ei,{size:13}),(0,A.jsx)(`span`,{className:`dir-rail-label mono`,children:e.label})]},e.path))}),(0,A.jsxs)(`div`,{className:`dir-list`,children:[s.isError?(0,A.jsx)(F,{children:s.error.message}):s.isLoading?(0,A.jsx)(F,{children:`Loading…`}):(c?.entries.length??0)===0?(0,A.jsxs)(F,{children:[`No subfolders here`,i?``:` (hidden folders are filtered)`,`.`]}):(c?.entries??[]).map(t=>(0,A.jsxs)(`button`,{className:`dir-item${t.isRepo?` is-repo`:``}`,onClick:()=>r(t.path),onDoubleClick:()=>t.isRepo&&e(t.path),title:t.path,children:[(0,A.jsx)(Ei,{size:13}),(0,A.jsx)(`span`,{className:`dir-item-name mono`,children:t.name}),t.isSymlink&&(0,A.jsx)(`span`,{className:`dir-item-tag`,children:`link`}),t.isRepo&&(0,A.jsxs)(`span`,{className:`dir-item-repo`,children:[(0,A.jsx)(gi,{size:11}),` git`]})]},t.path)),c?.truncated&&(0,A.jsx)(F,{children:`Listing truncated — this folder is very large.`})]})]}),(0,A.jsxs)(`div`,{className:`dir-picker-foot`,children:[(0,A.jsx)(`div`,{className:`dir-picked mono`,title:l,children:(0,A.jsx)(`bdi`,{children:l??`—`})}),(0,A.jsxs)(`div`,{className:`dir-picker-actions`,children:[(0,A.jsx)(P,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,A.jsx)(P,{variant:`solid`,onClick:()=>l&&e(l),disabled:!l,children:`Open this folder`})]})]})]})})}function tw({firstRun:e,onOpened:t,onCancel:n}){let[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=Ji(),c=N.useUtils(),l=N.project.open.useMutation({onSuccess:async e=>{await c.project.list.invalidate(),s.push(`opened ${e.name} on ${e.mainBranch}`,`info`),t(e.id)},onError:e=>s.push(e.message)}),u=e=>{let t=(e??r).trim();t&&l.mutate({repoPath:t})};return(0,A.jsxs)(`div`,{className:`open-project`,children:[(0,A.jsxs)(`div`,{className:`op-card`,children:[(0,A.jsx)(`div`,{className:`op-logo`,children:(0,A.jsx)(ki,{size:22,variant:`ink`})}),(0,A.jsx)(`div`,{className:`op-kick`,children:e?`WELCOME TO RUNCASTLE`:`OPEN A PROJECT`}),(0,A.jsx)(`div`,{className:`op-h`,children:e?`Open your first project`:`Open a project`}),(0,A.jsx)(`div`,{className:`op-sub`,children:`Point runcastle at a local git repository. It detects the default branch and opens the project — every feature runs its pipeline against this repo.`}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`op-repo-path`,children:`Repository path`}),(0,A.jsxs)(`div`,{className:`op-input-row`,children:[(0,A.jsx)(`input`,{id:`op-repo-path`,className:`op-input mono`,value:r,onChange:e=>i(e.target.value),placeholder:`/path/to/your/repo`,autoFocus:!0,spellCheck:!1,onKeyDown:t=>{t.key===`Enter`&&u(),t.key===`Escape`&&!e&&n()}}),(0,A.jsx)(P,{variant:`ghost`,onClick:()=>o(!0),disabled:l.isPending,children:`Browse…`})]}),(0,A.jsx)(`div`,{className:`op-hint`,children:`Browse your machine, or paste a path. The default branch is detected automatically when the project opens.`}),(0,A.jsxs)(`div`,{className:`op-actions`,children:[!e&&(0,A.jsx)(P,{variant:`ghost`,onClick:n,disabled:l.isPending,children:`Cancel`}),(0,A.jsx)(P,{variant:`solid`,onClick:()=>u(),disabled:l.isPending||r.trim()===``,children:l.isPending?`Opening…`:`Open`})]})]}),a&&(0,A.jsx)(ew,{onPick:e=>{i(e),o(!1),u(e)},onCancel:()=>o(!1)})]})}function nw({onOpened:e,onCancel:t}){let n=N.setup.doctor.useQuery(void 0,{refetchOnWindowFocus:!1}),r=n.data?.results.find(e=>e.id===`git-identity`)?.status===`ok`,[i,a]=(0,k.useState)(null),o=i??(r?`afk`:`identity`);return n.isLoading?(0,A.jsx)(`div`,{className:`open-project`,children:(0,A.jsx)(F,{children:`preparing setup…`})}):o===`project`?(0,A.jsx)(tw,{firstRun:!0,onOpened:e,onCancel:t}):(0,A.jsx)(`div`,{className:`open-project`,children:(0,A.jsxs)(`div`,{className:`op-card wizard-card`,children:[(0,A.jsx)(`div`,{className:`op-logo`,children:(0,A.jsx)(ki,{size:22,variant:`ink`})}),(0,A.jsx)(iw,{current:o}),o===`identity`?(0,A.jsx)(aw,{onNext:()=>a(`afk`)}):(0,A.jsx)(ow,{onNext:()=>a(`project`)})]})})}var rw=[{key:`identity`,label:`Git identity`},{key:`afk`,label:`AFK burns`},{key:`project`,label:`First project`}];function iw({current:e}){let t=rw.findIndex(t=>t.key===e);return(0,A.jsx)(`ol`,{className:`wizard-steps`,"aria-label":`Setup progress`,children:rw.map((e,n)=>(0,A.jsxs)(`li`,{className:`wizard-step${n===t?` is-current`:``}${n<t?` is-done`:``}`,children:[(0,A.jsx)(`span`,{className:`wizard-step-dot`,"aria-hidden":!0}),e.label]},e.key))})}function aw({onNext:e}){let[t,n]=(0,k.useState)(``),[r,i]=(0,k.useState)(``),a=Ji(),o=N.useUtils(),s=N.setup.gitIdentity.useMutation({onSuccess:async()=>{await o.setup.doctor.invalidate(),e()},onError:e=>a.push(e.message)}),c=t.trim()!==``&&r.includes(`@`),l=()=>c&&s.mutate({name:t.trim(),email:r.trim()});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`op-kick`,children:`WELCOME TO RUNCASTLE`}),(0,A.jsx)(`div`,{className:`op-h`,children:`Set your git identity`}),(0,A.jsxs)(`div`,{className:`op-sub`,children:[`runcastle commits documentation and merges on your behalf, so it needs a name and email. This writes to `,(0,A.jsx)(`code`,{className:`mono`,children:`git config --global`}),`.`]}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`wiz-name`,children:`Name`}),(0,A.jsx)(`input`,{id:`wiz-name`,className:`op-input mono`,value:t,onChange:e=>n(e.target.value),placeholder:`Ada Lovelace`,autoFocus:!0,spellCheck:!1,onKeyDown:e=>e.key===`Enter`&&l()}),(0,A.jsx)(`label`,{className:`op-label`,htmlFor:`wiz-email`,children:`Email`}),(0,A.jsx)(`input`,{id:`wiz-email`,className:`op-input mono`,value:r,onChange:e=>i(e.target.value),placeholder:`ada@example.com`,spellCheck:!1,onKeyDown:e=>e.key===`Enter`&&l()}),(0,A.jsx)(`div`,{className:`op-actions`,children:(0,A.jsx)(P,{variant:`solid`,onClick:l,disabled:!c||s.isPending,children:s.isPending?`Saving…`:`Continue`})})]})}function ow({onNext:e}){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(LC,{onDismiss:e}),(0,A.jsx)(`div`,{className:`op-actions`,children:(0,A.jsx)(P,{variant:`solid`,onClick:e,children:`Continue to your first project`})})]})}var sw=`runcastle.update.dismissed`;function cw(e,t){return e.updateAvailable&&e.latest!==null&&e.latest!==t}function lw(){let e=N.system.checkUpdate.useQuery(void 0,{staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),[t,n]=(0,k.useState)(()=>{try{return localStorage.getItem(sw)}catch{return null}}),r=e.data;return!r||!r.latest||!cw(r,t)?null:(0,A.jsxs)(`div`,{className:`update-banner`,role:`status`,children:[(0,A.jsx)(`span`,{className:`update-banner-dot`,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`update-banner-text`,children:[`runcastle `,(0,A.jsx)(`strong`,{children:r.latest}),` is available`,(0,A.jsx)(`span`,{className:`update-banner-sep`,children:` · `}),(0,A.jsxs)(`span`,{className:`update-banner-dim`,children:[`you're on `,r.current]})]}),(0,A.jsx)(`code`,{className:`update-banner-cmd`,children:r.command}),(0,A.jsx)(`button`,{className:`update-banner-dismiss`,onClick:()=>{try{localStorage.setItem(sw,r.latest)}catch{}n(r.latest)},"aria-label":`Dismiss update notice`,title:`Dismiss`,children:`×`})]})}function uw(){let e=di(),t;return t=e.projects===void 0?(0,A.jsx)(`div`,{className:`app-loading`,children:(0,A.jsx)(F,{children:`loading projects…`})}):e.view===`open`&&e.projects.length===0?(0,A.jsx)(nw,{onOpened:e.enterProject,onCancel:e.cancelOpen}):e.view===`open`?(0,A.jsx)(tw,{firstRun:!1,onOpened:e.enterProject,onCancel:e.cancelOpen}):e.view===`project`&&e.currentProjectId?(0,A.jsx)(JC,{projectId:e.currentProjectId,nav:e},e.currentProjectId):(0,A.jsx)(XC,{nav:e}),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(lw,{}),t]})}function dw(){return(0,A.jsx)(uw,{})}function fw(){let[e]=(0,k.useState)(()=>new Je({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})),[t]=(0,k.useState)(()=>N.createClient({links:[qn({url:`/api/trpc`})]}));return(0,A.jsx)(N.Provider,{client:t,queryClient:e,children:(0,A.jsx)(tt,{client:e,children:(0,A.jsx)(qi,{children:(0,A.jsx)(dw,{})})})})}var pw=document.getElementById(`root`);if(!pw)throw Error(`#root not found`);(0,br.createRoot)(pw).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(fw,{})}));