@ycodium-ai/plugin-conversation 0.2.2092 → 0.2.2098

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.
Files changed (2) hide show
  1. package/assets/ui.js +49 -49
  2. package/package.json +2 -2
package/assets/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- var XD=Object.create;var lf=Object.defineProperty;var YD=Object.getOwnPropertyDescriptor;var JD=Object.getOwnPropertyNames;var ZD=Object.getPrototypeOf,e1=Object.prototype.hasOwnProperty;var t1=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var df=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Tn=(e,t)=>{for(var n in t)lf(e,n,{get:t[n],enumerable:!0})},Wb=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of JD(t))!e1.call(e,r)&&r!==n&&lf(e,r,{get:()=>t[r],enumerable:!(o=YD(t,r))||o.enumerable});return e};var kd=(e,t,n)=>(n=e!=null?XD(ZD(e)):{},Wb(t||!e||!e.__esModule?lf(n,"default",{value:e,enumerable:!0}):n,e)),Gb=e=>Wb(lf({},"__esModule",{value:!0}),e);var uf={};Tn(uf,{Activity:()=>o1,Children:()=>ah,Component:()=>Ki,Fragment:()=>ti,Profiler:()=>r1,PureComponent:()=>a1,StrictMode:()=>i1,Suspense:()=>ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>s1,__COMPILER_RUNTIME:()=>l1,act:()=>d1,cache:()=>c1,cacheSignal:()=>u1,captureOwnerStack:()=>f1,cloneElement:()=>cf,createContext:()=>Ht,createElement:()=>Te,createRef:()=>p1,default:()=>un,forwardRef:()=>qn,isValidElement:()=>sh,lazy:()=>m1,memo:()=>ue,startTransition:()=>g1,unstable_useCacheRefresh:()=>h1,use:()=>Ut,useActionState:()=>v1,useCallback:()=>B,useContext:()=>sn,useDebugValue:()=>x1,useDeferredValue:()=>y1,useEffect:()=>q,useEffectEvent:()=>lh,useId:()=>Qr,useImperativeHandle:()=>Xr,useInsertionEffect:()=>Pd,useLayoutEffect:()=>ye,useMemo:()=>z,useOptimistic:()=>C1,useReducer:()=>ni,useRef:()=>_,useState:()=>G,useSyncExternalStore:()=>Sa,useTransition:()=>b1,version:()=>I1});var Qb,un,o1,ah,Ki,ti,r1,a1,i1,ih,s1,l1,d1,c1,u1,f1,cf,Ht,Te,p1,qn,sh,m1,ue,g1,h1,Ut,v1,B,sn,x1,y1,q,lh,Qr,Xr,Pd,ye,z,C1,ni,_,G,Sa,b1,I1,me=t1(()=>{Qb=window.__ycodiumPluginHost.react,un=Qb,{Activity:o1,Children:ah,Component:Ki,Fragment:ti,Profiler:r1,PureComponent:a1,StrictMode:i1,Suspense:ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:s1,__COMPILER_RUNTIME:l1,act:d1,cache:c1,cacheSignal:u1,captureOwnerStack:f1,cloneElement:cf,createContext:Ht,createElement:Te,createRef:p1,forwardRef:qn,isValidElement:sh,lazy:m1,memo:ue,startTransition:g1,unstable_useCacheRefresh:h1,use:Ut,useActionState:v1,useCallback:B,useContext:sn,useDebugValue:x1,useDeferredValue:y1,useEffect:q,useEffectEvent:lh,useId:Qr,useImperativeHandle:Xr,useInsertionEffect:Pd,useLayoutEffect:ye,useMemo:z,useOptimistic:C1,useReducer:ni,useRef:_,useState:G,useSyncExternalStore:Sa,useTransition:b1,version:I1}=Qb});var S0=df(bo=>{"use strict";var yB=(me(),Gb(uf));function I0(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 pi(){}var Co={d:{f:pi,r:function(){throw Error(I0(522))},D:pi,C:pi,L:pi,m:pi,X:pi,S:pi,M:pi},p:0,findDOMNode:null},CB=Symbol.for("react.portal");function bB(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:CB,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var hc=yB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Xf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}bo.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Co;bo.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(I0(299));return bB(e,t,null,n)};bo.flushSync=function(e){var t=hc.T,n=Co.p;try{if(hc.T=null,Co.p=2,e)return e()}finally{hc.T=t,Co.p=n,Co.d.f()}};bo.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Co.d.C(e,t))};bo.prefetchDNS=function(e){typeof e=="string"&&Co.d.D(e)};bo.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=Xf(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Co.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&Co.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};bo.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Xf(t.as,t.crossOrigin);Co.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==null&&Co.d.M(e)};bo.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=Xf(n,t.crossOrigin);Co.d.L(e,n,{crossOrigin:o,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})}};bo.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Xf(t.as,t.crossOrigin);Co.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 Co.d.m(e)};bo.requestFormReset=function(e){Co.d.r(e)};bo.unstable_batchedUpdates=function(e,t){return e(t)};bo.useFormState=function(e,t,n){return hc.H.useFormState(e,t,n)};bo.useFormStatus=function(){return hc.H.useHostTransitionStatus()};bo.version="19.2.6"});var vc=df((lZ,T0)=>{"use strict";function w0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(w0)}catch(e){console.error(e)}}w0(),T0.exports=S0()});var NM=df(RM=>{"use strict";var ld=(me(),Gb(uf));function kK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var PK=typeof Object.is=="function"?Object.is:kK,AK=ld.useState,EK=ld.useEffect,MK=ld.useLayoutEffect,RK=ld.useDebugValue;function NK(e,t){var n=t(),o=AK({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return MK(function(){r.value=n,r.getSnapshot=t,eC(r)&&a({inst:r})},[e,n,t]),EK(function(){return eC(r)&&a({inst:r}),e(function(){eC(r)&&a({inst:r})})},[e]),RK(n),n}function eC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!PK(e,n)}catch{return!0}}function _K(e,t){return t()}var DK=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?_K:NK;RM.useSyncExternalStore=ld.useSyncExternalStore!==void 0?ld.useSyncExternalStore:DK});var DM=df((ale,_M)=>{"use strict";_M.exports=NM()});var jb=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
1
+ var JD=Object.create;var af=Object.defineProperty;var ZD=Object.getOwnPropertyDescriptor;var e1=Object.getOwnPropertyNames;var t1=Object.getPrototypeOf,n1=Object.prototype.hasOwnProperty;var o1=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var sf=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},An=(e,t)=>{for(var n in t)af(e,n,{get:t[n],enumerable:!0})},Gb=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of e1(t))!n1.call(e,r)&&r!==n&&af(e,r,{get:()=>t[r],enumerable:!(o=ZD(t,r))||o.enumerable});return e};var Sd=(e,t,n)=>(n=e!=null?JD(t1(e)):{},Gb(t||!e||!e.__esModule?af(n,"default",{value:e,enumerable:!0}):n,e)),jb=e=>Gb(af({},"__esModule",{value:!0}),e);var df={};An(df,{Activity:()=>a1,Children:()=>ah,Component:()=>Ui,Fragment:()=>Ja,Profiler:()=>i1,PureComponent:()=>s1,StrictMode:()=>l1,Suspense:()=>ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>d1,__COMPILER_RUNTIME:()=>c1,act:()=>u1,cache:()=>f1,cacheSignal:()=>p1,captureOwnerStack:()=>m1,cloneElement:()=>lf,createContext:()=>Ht,createElement:()=>Te,createRef:()=>g1,default:()=>hn,forwardRef:()=>Wn,isValidElement:()=>sh,lazy:()=>h1,memo:()=>ue,startTransition:()=>v1,unstable_useCacheRefresh:()=>x1,use:()=>Ut,useActionState:()=>y1,useCallback:()=>B,useContext:()=>fn,useDebugValue:()=>C1,useDeferredValue:()=>b1,useEffect:()=>q,useEffectEvent:()=>lh,useId:()=>Wr,useImperativeHandle:()=>Gr,useInsertionEffect:()=>wd,useLayoutEffect:()=>ye,useMemo:()=>z,useOptimistic:()=>I1,useReducer:()=>Za,useRef:()=>_,useState:()=>G,useSyncExternalStore:()=>xa,useTransition:()=>S1,version:()=>w1});var Xb,hn,a1,ah,Ui,Ja,i1,s1,l1,ih,d1,c1,u1,f1,p1,m1,lf,Ht,Te,g1,Wn,sh,h1,ue,v1,x1,Ut,y1,B,fn,C1,b1,q,lh,Wr,Gr,wd,ye,z,I1,Za,_,G,xa,S1,w1,me=o1(()=>{Xb=window.__ycodiumPluginHost.react,hn=Xb,{Activity:a1,Children:ah,Component:Ui,Fragment:Ja,Profiler:i1,PureComponent:s1,StrictMode:l1,Suspense:ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:d1,__COMPILER_RUNTIME:c1,act:u1,cache:f1,cacheSignal:p1,captureOwnerStack:m1,cloneElement:lf,createContext:Ht,createElement:Te,createRef:g1,forwardRef:Wn,isValidElement:sh,lazy:h1,memo:ue,startTransition:v1,unstable_useCacheRefresh:x1,use:Ut,useActionState:y1,useCallback:B,useContext:fn,useDebugValue:C1,useDeferredValue:b1,useEffect:q,useEffectEvent:lh,useId:Wr,useImperativeHandle:Gr,useInsertionEffect:wd,useLayoutEffect:ye,useMemo:z,useOptimistic:I1,useReducer:Za,useRef:_,useState:G,useSyncExternalStore:xa,useTransition:S1,version:w1}=Xb});var w0=sf(To=>{"use strict";var bB=(me(),jb(df));function S0(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 ci(){}var wo={d:{f:ci,r:function(){throw Error(S0(522))},D:ci,C:ci,L:ci,m:ci,X:ci,S:ci,M:ci},p:0,findDOMNode:null},IB=Symbol.for("react.portal");function SB(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:IB,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var fc=bB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function jf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}To.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wo;To.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(S0(299));return SB(e,t,null,n)};To.flushSync=function(e){var t=fc.T,n=wo.p;try{if(fc.T=null,wo.p=2,e)return e()}finally{fc.T=t,wo.p=n,wo.d.f()}};To.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,wo.d.C(e,t))};To.prefetchDNS=function(e){typeof e=="string"&&wo.d.D(e)};To.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=jf(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?wo.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&wo.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};To.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=jf(t.as,t.crossOrigin);wo.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==null&&wo.d.M(e)};To.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=jf(n,t.crossOrigin);wo.d.L(e,n,{crossOrigin:o,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})}};To.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=jf(t.as,t.crossOrigin);wo.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 wo.d.m(e)};To.requestFormReset=function(e){wo.d.r(e)};To.unstable_batchedUpdates=function(e,t){return e(t)};To.useFormState=function(e,t,n){return fc.H.useFormState(e,t,n)};To.useFormStatus=function(){return fc.H.useHostTransitionStatus()};To.version="19.2.6"});var pc=sf((cZ,L0)=>{"use strict";function T0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(T0)}catch(e){console.error(e)}}T0(),L0.exports=w0()});var _M=sf(NM=>{"use strict";var ad=(me(),jb(df));function AK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var EK=typeof Object.is=="function"?Object.is:AK,MK=ad.useState,RK=ad.useEffect,NK=ad.useLayoutEffect,_K=ad.useDebugValue;function DK(e,t){var n=t(),o=MK({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return NK(function(){r.value=n,r.getSnapshot=t,eC(r)&&a({inst:r})},[e,n,t]),RK(function(){return eC(r)&&a({inst:r}),e(function(){eC(r)&&a({inst:r})})},[e]),_K(n),n}function eC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!EK(e,n)}catch{return!0}}function OK(e,t){return t()}var FK=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?OK:DK;NM.useSyncExternalStore=ad.useSyncExternalStore!==void 0?ad.useSyncExternalStore:FK});var OM=sf((sle,DM)=>{"use strict";DM.exports=_M()});var Qb=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  :root, :host {
4
4
  --radius-lg: var(--radius);
@@ -3665,74 +3665,74 @@ var XD=Object.create;var lf=Object.defineProperty;var YD=Object.getOwnPropertyDe
3665
3665
  }
3666
3666
  }
3667
3667
  }
3668
- `;me();me();var Xb=Ht(null),Yb=Xb.Provider,Jb=Ht(""),Zb=Jb.Provider;function ff(){return sn(Jb)}function Jo(){let e=sn(Xb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var dh="conversation";var ch="__ycodiumConversationBridge",eI="ycodium.conversation.rebindable-bridge.v1";me();function tI(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=tI(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function nI(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=tI(e))&&(o&&(o+=" "),o+=t);return o}var oI=nI;var S1=(e,t)=>{let n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},w1=(e,t)=>({classGroupId:e,validator:t}),uI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var rI=[],T1="arbitrary..",L1=e=>{let t=P1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return k1(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return fI(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?S1(d,l):l:d||rI}return n[i]||rI}}},fI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=fI(e,t+1,a);if(d)return d}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let d=0;d<l;d++){let c=i[d];if(c.validator(s))return c.classGroupId}},k1=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?T1+o:void 0})(),P1=e=>{let{theme:t,classGroups:n}=e;return A1(n,t)},A1=(e,t)=>{let n=uI();for(let o in e){let r=e[o];ph(r,n,o,t)}return n},ph=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];E1(i,t,n,o)}},E1=(e,t,n,o)=>{if(typeof e=="string"){M1(e,t,n);return}if(typeof e=="function"){R1(e,t,n,o);return}N1(e,t,n,o)},M1=(e,t,n)=>{let o=e===""?t:pI(t,e);o.classGroupId=n},R1=(e,t,n,o)=>{if(_1(e)){ph(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(w1(n,e))},N1=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];ph(l,pI(t,s),n,o)}},pI=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);s||(s=uI(),n.nextPart.set(i,s)),n=s}return n},_1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,D1=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}};var O1=[],aI=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),F1=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let g=0;g<c;g++){let v=r[g];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,g)),l=g+1;continue}if(v==="/"){d=g;continue}}v==="["?i++:v==="]"?i--:v==="("?s++:v===")"&&s--}let f=a.length===0?r:r.slice(l),p=f,m=!1;f.endsWith("!")?(p=f.slice(0,-1),m=!0):f.startsWith("!")&&(p=f.slice(1),m=!0);let h=d&&d>l?d-l:void 0;return aI(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):aI(O1,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},B1=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);s||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(i)):r.push(i)}return r.length>0&&(r.sort(),o.push(...r)),o}},z1=e=>({cache:D1(e.cacheSize),parseClassName:F1(e),sortModifiers:B1(e),postfixLookupClassGroupIds:$1(e),...L1(e)}),$1=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},H1=/\s+/,U1=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(H1),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let x=!!v,y;if(x){let L=g.substring(0,v);y=o(L);let I=y&&i[y]?o(g):void 0;I&&I!==y&&(y=I,x=!1)}else y=o(g);if(!y){if(!x){d=f+(d.length>0?" "+d:d);continue}if(y=o(g),!y){d=f+(d.length>0?" "+d:d);continue}x=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=h?C+"!":C,k=w+y;if(s.indexOf(k)>-1)continue;s.push(k);let S=r(y,x);for(let L=0;L<S.length;++L){let I=S[L];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},K1=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=mI(n))&&(r&&(r+=" "),r+=o);return r},mI=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=mI(e[o]))&&(n&&(n+=" "),n+=t);return n},iI=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=z1(d),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=l=>{let d=o(l);if(d)return d;let c=U1(l,n);return r(l,c),c};return a=i,(...l)=>a(K1(...l))},q1=[],Rn=e=>{let t=n=>n[e]||q1;return t.isThemeGetter=!0,t},gI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,V1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,W1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,G1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,j1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Q1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,X1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oi=e=>V1.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),Yr=e=>!!e&&Number.isInteger(Number(e)),uh=e=>e.endsWith("%")&&it(e.slice(0,-1)),wa=e=>W1.test(e),vI=()=>!0,Y1=e=>G1.test(e)&&!j1.test(e),mh=()=>!1,J1=e=>Q1.test(e),Z1=e=>X1.test(e),eO=e=>!Le(e)&&!ke(e),tO=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),nO=e=>ri(e,CI,mh),Le=e=>gI.test(e),qi=e=>ri(e,bI,Y1),sI=e=>ri(e,cO,it),oO=e=>ri(e,SI,vI),rO=e=>ri(e,II,mh),lI=e=>ri(e,xI,mh),aO=e=>ri(e,yI,Z1),pf=e=>ri(e,wI,J1),ke=e=>hI.test(e),Ad=e=>Vi(e,bI),iO=e=>Vi(e,II),dI=e=>Vi(e,xI),sO=e=>Vi(e,CI),lO=e=>Vi(e,yI),mf=e=>Vi(e,wI,!0),dO=e=>Vi(e,SI,!0),ri=(e,t,n)=>{let o=gI.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Vi=(e,t,n=!1)=>{let o=hI.exec(e);return o?o[1]?t(o[1]):n:!1},xI=e=>e==="position"||e==="percentage",yI=e=>e==="image"||e==="url",CI=e=>e==="length"||e==="size"||e==="bg-size",bI=e=>e==="length",cO=e=>e==="number",II=e=>e==="family-name",SI=e=>e==="number"||e==="weight",wI=e=>e==="shadow";var cI=()=>{let e=Rn("color"),t=Rn("font"),n=Rn("text"),o=Rn("font-weight"),r=Rn("tracking"),a=Rn("leading"),i=Rn("breakpoint"),s=Rn("container"),l=Rn("spacing"),d=Rn("radius"),c=Rn("shadow"),f=Rn("inset-shadow"),p=Rn("text-shadow"),m=Rn("drop-shadow"),h=Rn("blur"),g=Rn("perspective"),v=Rn("aspect"),x=Rn("ease"),y=Rn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...w(),ke,Le],S=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],I=()=>[ke,Le,l],T=()=>[oi,"full","auto",...I()],E=()=>[Yr,"none","subgrid",ke,Le],A=()=>["auto",{span:["full",Yr,ke,Le]},Yr,ke,Le],N=()=>[Yr,"auto",ke,Le],R=()=>["auto","min","max","fr",ke,Le],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...I()],O=()=>[oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],oe=()=>[oi,"screen","full","dvw","lvw","svw","min","max","fit",...I()],te=()=>[oi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,ke,Le],Ke=()=>[...w(),dI,lI,{position:[ke,Le]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],fe=()=>["auto","cover","contain",sO,nO,{size:[ke,Le]}],Ne=()=>[uh,Ad,qi],Ae=()=>["","none","full",d,ke,Le],ae=()=>["",it,Ad,qi],Ee=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[it,uh,dI,lI],Ie=()=>["","none",h,ke,Le],st=()=>["none",it,ke,Le],dt=()=>["none",it,ke,Le],lt=()=>[it,ke,Le],ct=()=>[oi,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[wa],breakpoint:[wa],color:[vI],container:[wa],"drop-shadow":[wa],ease:["in","out","in-out"],font:[eO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[wa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[wa],shadow:[wa],spacing:["px",it],text:[wa],"text-shadow":[wa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",oi,Le,ke,v]}],container:["container"],"container-type":[{"@container":["","normal","size",ke,Le]}],"container-named":[tO],columns:[{columns:[it,Le,ke,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Yr,"auto",ke,Le]}],basis:[{basis:[oi,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,oi,"auto","initial","none",Le]}],grow:[{grow:["",it,ke,Le]}],shrink:[{shrink:["",it,ke,Le]}],order:[{order:[Yr,"first","last","none",ke,Le]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],"inline-size":[{inline:["auto",...oe()]}],"min-inline-size":[{"min-inline":["auto",...oe()]}],"max-inline-size":[{"max-inline":["none",...oe()]}],"block-size":[{block:["auto",...te()]}],"min-block-size":[{"min-block":["auto",...te()]}],"max-block-size":[{"max-block":["none",...te()]}],w:[{w:[s,"screen",...O()]}],"min-w":[{"min-w":[s,"screen","none",...O()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,Ad,qi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,dO,oO]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",uh,Le]}],"font-family":[{font:[iO,rO,t]}],"font-features":[{"font-features":[Le]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ke,Le]}],"line-clamp":[{"line-clamp":[it,"none",ke,sI]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",ke,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",ke,qi]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[it,"auto",ke,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[Yr,ke,Le]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ke()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yr,ke,Le],radial:["",ke,Le],conic:[Yr,ke,Le]},lO,aO]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Ne()}],"gradient-via-pos":[{via:Ne()}],"gradient-to-pos":[{to:Ne()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Ae()}],"rounded-s":[{"rounded-s":Ae()}],"rounded-e":[{"rounded-e":Ae()}],"rounded-t":[{"rounded-t":Ae()}],"rounded-r":[{"rounded-r":Ae()}],"rounded-b":[{"rounded-b":Ae()}],"rounded-l":[{"rounded-l":Ae()}],"rounded-ss":[{"rounded-ss":Ae()}],"rounded-se":[{"rounded-se":Ae()}],"rounded-ee":[{"rounded-ee":Ae()}],"rounded-es":[{"rounded-es":Ae()}],"rounded-tl":[{"rounded-tl":Ae()}],"rounded-tr":[{"rounded-tr":Ae()}],"rounded-br":[{"rounded-br":Ae()}],"rounded-bl":[{"rounded-bl":Ae()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ee(),"hidden","none"]}],"divide-style":[{divide:[...Ee(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,ke,Le]}],"outline-w":[{outline:["",it,Ad,qi]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,mf,pf]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,mf,pf]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[it,qi]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",p,mf,pf]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[it,ke,Le]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ke,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ke()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Le]}],filter:[{filter:["","none",ke,Le]}],blur:[{blur:Ie()}],brightness:[{brightness:[it,ke,Le]}],contrast:[{contrast:[it,ke,Le]}],"drop-shadow":[{"drop-shadow":["","none",m,mf,pf]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",it,ke,Le]}],"hue-rotate":[{"hue-rotate":[it,ke,Le]}],invert:[{invert:["",it,ke,Le]}],saturate:[{saturate:[it,ke,Le]}],sepia:[{sepia:["",it,ke,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Le]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[it,ke,Le]}],"backdrop-contrast":[{"backdrop-contrast":[it,ke,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,ke,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,ke,Le]}],"backdrop-invert":[{"backdrop-invert":["",it,ke,Le]}],"backdrop-opacity":[{"backdrop-opacity":[it,ke,Le]}],"backdrop-saturate":[{"backdrop-saturate":[it,ke,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",it,ke,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",ke,Le]}],ease:[{ease:["linear","initial",x,ke,Le]}],delay:[{delay:[it,ke,Le]}],animate:[{animate:["none",y,ke,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,ke,Le]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:st()}],"rotate-x":[{"rotate-x":st()}],"rotate-y":[{"rotate-y":st()}],"rotate-z":[{"rotate-z":st()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[ke,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ct()}],"translate-x":[{"translate-x":ct()}],"translate-y":[{"translate-y":ct()}],"translate-z":[{"translate-z":ct()}],"translate-none":["translate-none"],zoom:[{zoom:[Yr,ke,Le]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Le]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[it,Ad,qi,sI]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},uO=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(ul(e,"cacheSize",t),ul(e,"prefix",n),ul(e,"experimentalParseClassName",o),gf(e.theme,a.theme),gf(e.classGroups,a.classGroups),gf(e.conflictingClassGroups,a.conflictingClassGroups),gf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ul(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),ul(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),hf(e.theme,r.theme),hf(e.classGroups,r.classGroups),hf(e.conflictingClassGroups,r.conflictingClassGroups),hf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),fh(e,r,"postfixLookupClassGroups"),fh(e,r,"orderSensitiveModifiers"),e),ul=(e,t,n)=>{n!==void 0&&(e[t]=n)},gf=(e,t)=>{if(t)for(let n in t)ul(e,n,t[n])},hf=(e,t)=>{if(t)for(let n in t)fh(e,t,n)},fh=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},TI=(e,...t)=>typeof e=="function"?iI(cI,e,...t):iI(()=>uO(cI(),e),...t);var fO=TI({extend:{classGroups:{"font-size":[{text:["chat","chat-row","chat-code","chat-dense","chat-meta","control-1","control-2","control-3","control-4","control-5"]}]}}});function F(...e){return fO(oI(e))}me();var gh=Ht(!0);var hh=Ht(void 0);function ai(){let e=Ut(gh);return Ut(hh)??e}me();var vf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var LI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var kI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var vh=e=>{let t=kI(e);return t.charAt(0).toUpperCase()+t.slice(1)};me();var PI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var AI=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var EI=qn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Te("svg",{ref:l,...PI,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:vf("lucide",r),...!a&&!AI(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>Te(d,c)),...Array.isArray(a)?a:[a]]));var j=(e,t)=>{let n=qn(({className:o,...r},a)=>Te(EI,{ref:a,iconNode:t,className:vf(`lucide-${LI(vh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=vh(e),n};var pO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ed=j("arrow-down",pO);var mO=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Md=j("arrow-up-right",mO);var gO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Rd=j("arrow-up",gO);var hO=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Nd=j("blocks",hO);var vO=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],fl=j("bookmark",vO);var xO=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Wi=j("bot",xO);var yO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],xo=j("check",yO);var CO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ln=j("chevron-down",CO);var bO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Gi=j("chevron-left",bO);var IO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],zo=j("chevron-right",IO);var SO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_d=j("chevron-up",SO);var wO=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Dd=j("chevrons-left",wO);var TO=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Od=j("chevrons-right",TO);var LO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],yo=j("circle-alert",LO);var kO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ji=j("copy",kO);var PO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Zo=j("ellipsis",PO);var AO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Fd=j("eye",AO);var EO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Qi=j("file-code",EO);var MO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Xi=j("file-text",MO);var RO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Bd=j("file",RO);var NO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ii=j("folder",NO);var _O=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],zd=j("frame",_O);var DO=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],$d=j("git-branch-plus",DO);var OO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Hd=j("globe",OO);var FO=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Ud=j("grip-vertical",FO);var BO=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],Kd=j("hammer",BO);var zO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Yi=j("image",zO);var $O=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ta=j("layers",$O);var HO=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],qd=j("list-ordered",HO);var UO=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Ji=j("list-todo",UO);var KO=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Vd=j("list",KO);var qO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],si=j("lock-open",qO);var VO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Wd=j("lock",VO);var WO=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Zi=j("message-circle",WO);var GO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],es=j("message-square",GO);var jO=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Gd=j("minimize-2",jO);var QO=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Jr=j("mouse-pointer-click",QO);var XO=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],jd=j("package",XO);var YO=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],ts=j("paintbrush",YO);var JO=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Mo=j("paperclip",JO);var ZO=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Zr=j("pen-line",ZO);var eF=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Qd=j("pencil-ruler",eF);var tF=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Xd=j("pencil",tF);var nF=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ns=j("puzzle",nF);var oF=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],os=j("rotate-ccw",oF);var rF=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],rs=j("search",rF);var aF=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Yd=j("send",aF);var iF=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Jd=j("settings",iF);var sF=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],pl=j("sliders-horizontal",sF);var lF=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],li=j("sparkles",lF);var dF=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ro=j("square-pen",dF);var cF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Zd=j("square",cF);var uF=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],as=j("star",uF);var fF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],La=j("terminal",fF);var pF=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],ec=j("text-quote",pF);var mF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],ea=j("user-round",mF);var gF=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],tc=j("wrench",gF);var hF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=j("x",hF);var vF=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],is=j("zap",vF);me();function _e(){return{t:Jo().i18n.usePluginTranslation()}}me();var xF=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function Z(e){let t=n=>{let o=Jo(),r=ff(),a=ai(),i=o.ui[e];return Te(i,{...n,...xF.has(e)&&!a?{open:!1}:{},className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var U9=Z("useLinkContextMenu"),ka=Z("ProviderInstanceIcon"),MI=Z("UserAvatar"),ml=Z("Badge"),ne=Z("Button"),K9=Z("Label"),xf=Z("Input"),RI=Z("Textarea"),q9=Z("Switch"),nc=Z("Separator"),V9=Z("Skeleton"),yf=Z("Spinner"),W9=Z("ScrollArea"),G9=Z("Card"),j9=Z("CardAction"),Q9=Z("CardContent"),X9=Z("CardDescription"),Y9=Z("CardFooter"),J9=Z("CardHeader"),Z9=Z("CardTitle"),eQ=Z("Empty"),tQ=Z("EmptyContent"),nQ=Z("EmptyDescription"),oQ=Z("EmptyHeader"),rQ=Z("EmptyMedia"),aQ=Z("EmptyTitle"),iQ=Z("InputGroup"),sQ=Z("InputGroupAddon"),lQ=Z("InputGroupInput"),dQ=Z("DocumentPanel"),cQ=Z("MasterDetail"),Cf=Z("Select"),uQ=Z("SelectContent"),bf=Z("SelectItem"),If=Z("SelectPopup"),NI=Z("SelectTrigger"),Sf=Z("SelectValue"),oc=Z("Toggle"),_I=Z("ToggleGroup"),DI=Z("AlertDialog"),OI=Z("AlertDialogClose"),FI=Z("AlertDialogDescription"),BI=Z("AlertDialogFooter"),zI=Z("AlertDialogHeader"),$I=Z("AlertDialogPopup"),HI=Z("AlertDialogTitle"),wf=Z("Dialog"),fQ=Z("DialogClose"),Tf=Z("DialogDescription"),Lf=Z("DialogFooter"),kf=Z("DialogHeader"),Pf=Z("DialogPopup"),UI=Z("DialogPanel"),Af=Z("DialogTitle"),pQ=Z("DialogTrigger"),mQ=Z("DropdownMenu"),gQ=Z("DropdownMenuContent"),hQ=Z("DropdownMenuItem"),vQ=Z("DropdownMenuTrigger"),er=Z("Menu"),rc=Z("MenuGroup"),xQ=Z("MenuGroupLabel"),tr=Z("MenuItem"),nr=Z("MenuPopup"),Pa=Z("MenuRadioGroup"),wr=Z("MenuRadioItem"),di=Z("MenuSeparator"),or=Z("MenuTrigger"),gl=Z("Popover"),hl=Z("PopoverPopup"),vl=Z("PopoverTrigger"),KI=Z("Table"),qI=Z("TableBody"),ci=Z("TableCell"),ss=Z("TableHead"),VI=Z("TableHeader"),Ef=Z("TableRow"),Xe=Z("Tooltip"),Ye=Z("TooltipPopup"),Je=Z("TooltipTrigger"),WI=Z("Collapsible"),GI=Z("CollapsiblePanel"),jI=Z("CollapsibleTrigger"),ac=Z("Alert"),ic=Z("AlertAction"),Mf=Z("AlertDescription"),xh=Z("AlertTitle"),Rf=Z("Kbd"),Nf=Z("Command"),_f=Z("CommandGroup"),Df=Z("CommandItem"),Of=Z("CommandList"),QI=Z("Combobox"),XI=Z("ComboboxEmpty"),YI=Z("ComboboxInput"),xl=Z("ComboboxItem"),JI=Z("ComboboxListVirtualized"),ZI=Z("TooltipProvider"),eS=Z("StyledDiffCodeView"),tS=Z("DevBackdropArt"),rr=Z("Markdown"),nS=Z("DiffView");var{jsx:u,jsxs:b,Fragment:be}=window.__ycodiumPluginHost.jsxRuntime;function oS({mode:e,onModeChange:t}){let{t:n}=_e();return b(_I,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":n("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:o=>{let r=o[0];(r==="chat"||r==="trajectory")&&t(r)},children:[b(oc,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(es,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(oc,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(qd,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function rS({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat"?"chat":"trajectory";return u("div",{className:"relative flex min-h-0 flex-1 flex-col","aria-hidden":t?void 0:!0,inert:t?void 0:!0,"data-chat-view-pane":r,"data-pane-visible":t?"true":"false",children:u(hh,{value:t,children:r==="chat"?n:o})})}me();function so(){return{t:Jo().i18n.usePluginTranslation()}}function aS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function iS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function sc(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var yF=ue(function({item:t,ordinal:n,usage:o,onSelect:r}){return b("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[u("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),b("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?b("span",{className:"flex items-baseline gap-2",children:[u("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?u("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:sc(o.outputTokens)}):null]}):null]})]})});function CF({totals:e}){let{t}=so();if(!e)return null;let n=aS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:sc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:sc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?sc(e.cachedInputTokens):`${sc(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var bF=ue(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=so(),i=Jo().writeClipboard,[s,l]=G(!1),d=a("turnNavigator.copyMarkdown");return b(Xe,{children:[u(Je,{render:u(ne,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:s?u(xo,{className:"size-3 text-primary"}):u(ji,{className:"size-3"})}),u(Ye,{children:u("p",{children:d})})]})});function sS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=so(),[d,c]=G(!1),f=z(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=z(()=>iS(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return b(gl,{onOpenChange:c,open:d,children:[b(vl,{render:u(ne,{"aria-label":h,className:F("gap-1.5 rounded-full px-3",s==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:s==="float"?{bottom:n+12}:void 0,title:h,variant:"glass"}),children:[u(Vd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(hl,{align:"end",className:"w-80 flex-col",side:"top",children:b("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[b("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),u("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),u("div",{className:F("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>u(yF,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(CF,{totals:p}),b("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),u(bF,{size:"icon-xs",getText:a,variant:"ghost"}),u(ne,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>i("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(ne,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>i("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}me();function lS(e,t,n,o={}){if(t!==null)for(let r=0;r<e.length;r+=1){let a=e[r];if(a===void 0)continue;let i=n(a);if(i!==null)return i===t?{anchorIndex:r,anchorOffset:o.anchorOffset??16}:void 0}}me();function ls(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function IF(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function SF(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function wF(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var yh=SF(wF()),dS=new Map;function cS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=dS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(yh,IF(e,t));return dS.set(n,r),r}function Ch(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var TF=new Intl.DateTimeFormat(void 0,{month:"long"});function LF(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function kF(e,t){let n=Ch(e);return n?cS(t,!1).format(n):""}function ta(e,t){let n=Ch(e);if(!n)return"";let o=kF(e,t),r=n.getDate(),a=TF.format(n),i=n.getFullYear();return`${o}, ${r}${LF(r)} ${a} ${i}`}var PF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric"}),AF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric",year:"numeric"});function ui(e,t,n=Date.now()){let o=Ch(e);if(!o)return"";let r=cS(t,!1).format(o),a=new Date(n),i=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),l=Math.round((i-s)/864e5);return l<=0?r:l===1?`yesterday at ${r}`:`${(o.getFullYear()===a.getFullYear()?PF:AF).format(o)} ${r}`}me();me();async function EF(e,t){if(typeof window>"u"||typeof navigator>"u"||!navigator.clipboard?.writeText)throw new Error(`Clipboard API is unavailable while copying ${t}.`);if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(n){throw new Error(`Failed to copy ${t} to the clipboard.`,{cause:n})}}function Ff({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=G(!1),i=_(null),s=_(n),l=_(o),d=_(t),c=_(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=B((p,m)=>{EF(p,d.current).then(h=>{h&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},h=>{l.current?.(h instanceof Error?h:new Error(String(h)),m)})},[]);return q(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function Dt(){let e=Jo().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var uS=1e3;function MF({title:e,description:t}){return b("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-balance text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?u("span",{className:"block text-muted-foreground",children:t}):null]})}var yl=ue(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=Dt(),s=_(null),[l,d]=G(null),c=_(null),f=(h,g)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(g===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:h,description:g}),c.current=setTimeout(()=>d(null),uS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Ff({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:uS});return b(Xe,{children:[u(Je,{render:u(ne,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:m?u(xo,{className:"size-3 text-primary"}):u(ji,{className:"size-3"})}),u(Ye,{children:u("p",{children:i("copyButton.copyToClipboard")})}),l?u("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:l.top,left:l.left},children:u("span",{className:"relative block -translate-x-1/2",children:u(MF,{title:l.title,description:l.description})})}):null]})});function RF(e){return e<1e3?Math.round(e).toLocaleString():e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Bf({label:e,children:t}){let[n,o]=G(!1);return b(Xe,{open:n,onOpenChange:o,children:[u(Je,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Ye,{children:e})]})}var fS=ue(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=Dt(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return b("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[b("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?b(Bf,{label:i,children:[a==="completed"?u(xo,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(jt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Zd,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(Bf,{label:ta(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:ui(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?b(Bf,{label:r("timeline.workingTime",{duration:ls(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),ls(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(Bf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),RF(t.outputTokens)]}):null]}),o?u(yl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});me();me();function pS(e){if(e<1e3)return String(e);if(e<1e6){let n=e/1e3;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}k`}if(e<1e9){let n=e/1e6;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var mS=ue(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=Dt(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(be,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:F(i==="inline"?"inline-flex items-center gap-1 tabular-nums align-middle":"inline-grid grid-cols-[4ch_4ch] gap-2 text-right tabular-nums align-middle",r),children:[b("span",{"aria-hidden":"true",className:"font-mono text-success",children:["+",pS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",pS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function gS(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function NF(e){let t=e,n,o,r=t.match(/:(\d+)$/);if(!r?.[1])return{path:t,line:void 0,column:void 0};n=r[1],t=t.slice(0,-r[0].length);let a=t.match(/:(\d+)$/);return a?.[1]?(o=a[1],t=t.slice(0,-a[0].length)):(o=n,n=void 0),{path:t,line:o,column:n}}function hS(e){return e.replaceAll("\\","/")}function vS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function _F(e){return e.replace(/[\\/]+$/,"")}function DF(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function OF(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function FF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function zf(e,t){let{path:n,line:o,column:r}=NF(e),a=vS(hS(n)),i=a;if(t){let s=vS(hS(_F(t))),l=DF(s),d=a.toLowerCase(),c=s.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)i=l;else if(d.startsWith(f)){let m=a.slice(s.length+1);i=`${l}/${m}`}else if(!FF(a)){let m=OF(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function xS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function yS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var $f="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function lc({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function dc({status:e}){return u("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:u("span",{className:F("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Hf({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:F("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?u("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}me();var Cl=new Map,CS=24,BF=4e3;function bh(e){let t=Cl.get(e);if(t)return t;let n={values:new Map,listeners:new Set};if(Cl.set(e,n),Cl.size>CS){for(let[o,r]of Cl)if(r.listeners.size===0&&o!==e&&(Cl.delete(o),Cl.size<=CS))break}return n}function Ih(e,t,n){return bh(e).values.get(t)??n}function cc(e,t,n,o=!0){let r=bh(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>BF){let a=r.values.keys().next().value;a!==void 0&&r.values.delete(a)}o&&r.listeners.forEach(a=>a())}}function bl(e,t,n){let o=B(s=>{let l=bh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=B(()=>Ih(e,t,n),[e,t,n]),a=Sa(o,r,r),i=B(s=>cc(e,t,s),[e,t]);return[a,i]}function Uf({name:e,className:t}){switch(e){case"bot":return u(Wi,{className:t,"aria-hidden":!0});case"check":return u(xo,{className:t,"aria-hidden":!0});case"circle-alert":return u(yo,{className:t,"aria-hidden":!0});case"eye":return u(Fd,{className:t,"aria-hidden":!0});case"globe":return u(Hd,{className:t,"aria-hidden":!0});case"hammer":return u(Kd,{className:t,"aria-hidden":!0});case"message-circle":return u(Zi,{className:t,"aria-hidden":!0});case"search":return u(rs,{className:t,"aria-hidden":!0});case"square-pen":return u(Ro,{className:t,"aria-hidden":!0});case"terminal":return u(La,{className:t,"aria-hidden":!0});case"wrench":return u(tc,{className:t,"aria-hidden":!0});case"x":return u(jt,{className:t,"aria-hidden":!0});case"zap":return u(is,{className:t,"aria-hidden":!0})}}function zF(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function Sh(e,t){let n=new Map;for(let o of e){let r=t(o);n.set(r,(n.get(r)??0)+1)}return Array.from(n,([o,r])=>({action:o,icon:zF(o),count:r}))}function wh(e,t){let n;for(let o of Sh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var Il=20;function Sl(e){return gS(e)}function bS(e,t,n){let o=e.toolLabel,r=n.resolveToolCommand(e);if(r&&o?.descriptive&&!o.path&&o.detail?.trim())return o.detail.replace(/\s+/g," ").trim();for(let p of[e.rawCommand,e.command]){let m=n.parseToolCommandInput(p)?.description;if(m)return m.replace(/\s+/g," ").trim()}if(r)return r.replace(/\s+/g," ").trim();let a=typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null,i=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,s=o?.name??i??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?zf(l,t):void 0,c=[s.trim().toLowerCase()==="tool"?void 0:s,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(h=>h.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function IS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Th(e)?null:u(mS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Th(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function $F({entry:e,failed:t=!1,derive:n}){return t?u(yo,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u(Uf,{name:wh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function HF({entries:e,failed:t,derive:n}){let{t:o}=Dt(),r=z(()=>Sh(e,n.toolGroupAction),[e,n]),a=r.length===1;return a&&r[0].count<2?null:u("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":o("toolGroup.calls",{count:e.length}),children:r.map(({action:i,icon:s,count:l})=>b("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u(Uf,{name:s,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function SS({entry:e}){let t=Ut(In),n=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,o=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:o,onOpenFileDiff:t.onOpenFileDiff});return u("div",{className:"min-w-0 space-y-2 p-3",children:r!==void 0?u(be,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var UF=ue(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=Ut(In).derive,{t:l}=Dt(),[d,c]=bl(o,`call:${Sl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Th(n),m=s.resolveWorkEntryStatus(n),h=m==="failed"||m==="running"?m:null,g=Qr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Sl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":g,onClick:()=>{a?.(),c(!d)},className:F("chat-tool-member-row chat-tool-summary flex w-full min-w-0 items-center gap-1.5 px-3 text-left hover:bg-accent/20",f?"text-destructive":"text-muted-foreground"),children:[u(dc,{status:h}),u(lc,{children:u($F,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:bS(n,r,s)??l("toolGroup.calls",{count:1})}),u(IS,{entry:n,failed:f})]}),f||p?u("span",{className:"chat-process-meta shrink-0",children:f?l("toolGroup.failed",{count:1}):l("toolGroup.cancelled",{count:1})}):null,u(ln,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:g,children:u(SS,{entry:n})}):null]})});function KF({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=_(null);return ye(()=>{let a=r.current;if(!a)return;a.scrollTop=Ih(e,`${t}:scroll`,0);let i=()=>{cc(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[e,t]),u("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:n},children:o})}var wS=ue(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=Ut(In).derive,{t:l}=Dt(),[d,c]=bl(o,`group:${n}`,!1),[f,p]=bl(o,`group-page:${n}`,0),m=Qr(),h=_(null),[g,v]=G(null),x=t.at(-1),y=z(()=>t.filter(O=>s.workEntryIndicatesFailure(O)),[t,s]),C=z(()=>t.filter(Th),[t]),w=t.filter(O=>O.toolLifecycleStatus==="inProgress").length,k=y[0]??C[0],S=k??x,L=Math.max(0,Math.ceil(t.length/Il)-1),I=Math.min(f,L),T=I*Il,E=t.slice(T,T+Il),A=t.length>1;if(ye(()=>{if(!g)return;let O=h.current,oe=Array.from(O?.querySelectorAll("[data-tool-identity]")??[]).find(W=>W.dataset.toolIdentity===g.id);if(!oe)return;let te=oe.closest('[data-slot="scroll-area-viewport"]');te&&(te.scrollTop+=oe.getBoundingClientRect().top-te.getBoundingClientRect().top),oe.querySelector("button")?.focus({preventScroll:!0})},[g]),!x||!S)return null;let N=O=>{a?.(),p(O)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},$=yS(t.map(O=>xS(s.resolveWorkEntryStatus(O)))),H=wh(t,s.toolGroupAction),K=$==="failed"?"failed":$==="running"?"running":"success";return u(Hf,{state:$,variant:"tool",children:b("section",{ref:h,"data-tool-group-id":n,className:"min-w-0",children:[b("div",{className:"flex min-w-0 items-center",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!A&&!d&&cc(o,`call:${Sl(x)}`,!0)},className:F($f,"flex-1",k?"text-destructive":"text-muted-foreground"),children:[u(dc,{status:K}),u(lc,{children:u(Uf,{name:H,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",y.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:F("flex min-w-0 flex-1 items-center",d&&A?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&A?l("toolGroup.calls",{count:t.length}):bS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&A?null:u(IS,{entry:S,failed:s.workEntryIndicatesFailure(S)})]}),w>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:w})}):null,y.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:y.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&A?null:u(HF,{entries:t,failed:y.length>0,derive:s}),u(ln,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),k&&A?u("button",{type:"button",className:"chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 text-destructive underline [@media(pointer:coarse)]:min-h-11",onClick:()=>{a?.(),c(!0),p(Math.floor(t.indexOf(k)/Il)),cc(o,`call:${Sl(k)}`,!0),v({id:Sl(k)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:A?b(be,{children:[t.length>Il?b("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[u("span",{className:"min-w-0 flex-1 tabular-nums",children:l("toolGroup.pageRange",{from:T+1,to:Math.min(T+Il,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:I===0,Icon:Dd},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Gi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===L,Icon:zo},{label:l("toolGroup.lastPage"),target:L,disabled:I===L,Icon:Od}].map(({label:O,target:oe,disabled:te,Icon:W})=>u("button",{type:"button","aria-label":O,disabled:te,onClick:()=>N(oe),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(W,{"aria-hidden":!0,className:"size-icon-1"})},O))]}):null,u(KF,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:E.map(O=>u(UF,{entry:O,...R},Sl(O)))})})]}):u(SS,{entry:x})}):null]})})});function qF(e,t,n){let o=n-t;if(Math.abs(o)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+o));return Math.abs(r-e.scrollTop)<1?null:r}function TS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,i=!0,s=null,l=()=>{if(s=null,!i||!n.isConnected||!t.contains(n))return;let f=qF(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{i&&s===null&&(s=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{i=!1,c?.disconnect(),s!==null&&cancelAnimationFrame(s),s=null}}}me();function Lh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function LS(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),s=e[a].getBoundingClientRect();Math.max(s.bottom,s.top+1)>t?(r=a,o=a):n=a+1}return r}function VF(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=LS(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.max(0,Math.round(t-l.getBoundingClientRect().top))}};if(n.length===0)return o(e);let r=LS(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let i=o(n[a]);if(i)return i}return null}function kS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var kh=class extends Ki{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function PS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i}){let s=_(null);Xr(n,()=>({get node(){return s.current},measure:()=>{let d=s.current;return d?{scroll:d.scrollTop,scrollLength:d.clientHeight,contentLength:d.scrollHeight,topOf:c=>{let f=Lh(d,c);return f===null?null:kS(f,d)},heightOf:c=>{let f=Lh(d,c);return f===null?null:f.offsetHeight},rowAtScroll:()=>VF(d)}:null},scrollToEnd:d=>{let c=s.current;if(c){if(d?.animated){c.scrollTo({top:c.scrollHeight,behavior:"smooth"});return}c.scrollTop=c.scrollHeight-c.clientHeight}},scrollToRow:(d,c)=>{let f=s.current;if(!f)return!1;let p=Lh(f,d);return p?(f.scrollTop=Math.max(0,kS(p,f)-(c?.viewOffset??0)),!0):!1},scrollToOffset:d=>{let c=s.current;c&&(c.scrollTop=Math.max(0,d))}}),[]);let l=B(d=>{s.current=d,o(d)},[o]);return u(kh,{inputKey:e,onBeforeInputChange:t,children:u("div",{ref:l,className:r,style:{position:"relative"},onScroll:i,children:a})})}me();var AS=ue(function({sectionKey:t,rowKeyPrefix:n,rows:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(i=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(i)},`${n}:${i.id}`))})});function WF(e){for(let t of e)switch(t.kind){case"turn-identity":return t.turnId;case"working":return t.turnId??null;case"message":if(t.message.role==="assistant")return t.message.turnId;break;case"tool-group":if(t.entries[0]?.turnId!==void 0)return t.entries[0].turnId??null;break;case"work":if(t.groupedEntries[0]?.turnId!==void 0)return t.groupedEntries[0].turnId??null;break;case"turn-plan":return t.turnPlan.turnId;case"proposed-plan":return t.proposedPlan.turnId;case"turn-summary":return t.footer.turnId}return null}function ES(e,t){let n=[];for(let o of t){if(o.end<=o.start)continue;let r=e.slice(o.start,o.end);n.push({key:o.key,turnId:WF(r),firstRowIndex:o.start,rows:r})}return n}function MS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function uc(e,t,n){let o=e.findIndex(r=>r.rows.some(a=>a.id===t));return o<0?n:Math.max(n,e.length-o)}me();me();var NS=100,GF=new Map,RS=new Map,Ah=e=>typeof e=="function"?e():e,jF=(e,t)=>typeof t=="function"?t(e):t;function QF(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function XF(e,t){let n=RS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},RS.set(e,n)),n}function YF(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Ph(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function _S(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:Ah(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function fc(e){queueMicrotask(()=>YF(e))}function Sn(e,t,n,o=NS){let r=Math.max(1,o),a=QF(GF,e,r),i=_S(a,t,n),s=B(f=>i.alive?(a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,i.subscribers.add(f),fc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),fc(a)}):()=>{},[r,i,a,t]),l=B(()=>i.value,[i]),d=Sa(s,l,l),c=B(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=jF(p,f);if(!Object.is(m,p)){i.value=m,Ph(a,t,i);for(let h of i.subscribers)h();fc(a)}},[i,a,t]);return[d,c]}function Ln(e,t,n,o=NS){let r=Math.max(1,o),a=XF(e,r),i=_S(a,t,()=>({current:Ah(n)}));return q(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,fc(a),()=>{i.leases=Math.max(0,i.leases-1),fc(a)}},[r,i,a,t]),i.value}function pc(e,t){let n=_(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:Ah(t)}}),n.current.ref}var ds=3,JF=ds;function DS(e){let[t,n]=Sn("timeline-reveal-window",e,ds),o=B(()=>{n(s=>s+JF)},[n]),r=B(s=>{n(l=>s>l?s:l)},[n]),a=B(()=>{n(ds)},[n]),i=B(s=>{n(l=>Math.min(l,Math.max(ds,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function OS({root:e,minimumCount:t,canCompact:n,onCompact:o}){let r=e.ownerDocument,a=new Set,i,s=!1,l=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,d=()=>{if(i=void 0,r.hidden||a.size>0||!n()||e.clientHeight<=0||!l())return;let x=r.getSelection();if(x&&!x.isCollapsed){for(let L=0;L<x.rangeCount;L+=1)if(x.getRangeAt(L).intersectsNode(e))return}let y=e.querySelectorAll("[data-timeline-turn-section]"),C=e.getBoundingClientRect().top-32,w=0,k=Math.max(0,y.length-t);for(;w<k;){let L=Math.floor((w+k)/2),I=y[L].getBoundingClientRect().bottom;if(!Number.isFinite(I))return;I<=C?w=L+1:k=L}if(w===0)return;let S=r.activeElement;if(S){for(let L=0;L<w;L+=1)if(y[L].contains(S))return}o(y.length-w)},c=()=>{i===void 0&&(i=setTimeout(d,400))},f=()=>{clearTimeout(i),i=setTimeout(d,400)},p=()=>{let x=l();!x||!s?f():c(),s=x},m=x=>{a.add(x.pointerId),f()},h=x=>{a.delete(x.pointerId),f()},g=()=>{a.clear(),f()},v=["wheel","keydown","focusin","focusout"];for(let x of v)e.addEventListener(x,f,{passive:!0});return e.addEventListener("scroll",p,{passive:!0}),e.addEventListener("pointerdown",m,!0),r.addEventListener("pointerup",h,!0),r.addEventListener("pointercancel",h,!0),r.addEventListener("selectionchange",f),r.addEventListener("visibilitychange",c),r.defaultView?.addEventListener("blur",g),c(),{schedule:c,disconnect:()=>{clearTimeout(i);for(let x of v)e.removeEventListener(x,f);e.removeEventListener("scroll",p),e.removeEventListener("pointerdown",m,!0),r.removeEventListener("pointerup",h,!0),r.removeEventListener("pointercancel",h,!0),r.removeEventListener("selectionchange",f),r.removeEventListener("visibilitychange",c),r.defaultView?.removeEventListener("blur",g)}}}me();me();function FS(e){let t=_(e);t.current=e;let n=_(!1),o=_(null),r=_(null),a=_(0),i=B(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=B(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let c=++a.current;r.current=requestAnimationFrame(f=>{if(c!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=B(c=>{o.current=c,s()},[s]),d=B(()=>{o.current=null,i()},[i]);return ye(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),z(()=>({request:l,cancel:d}),[l,d])}function BS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=_(o);r.current=o;let a=FS(o),i=_(new Map),s=_(null),l=_(null),d=_(n);d.current=n;let c=B(()=>{if(!r.current||!e)return;let g=e.scrollTop+t,v=null,x=Number.NEGATIVE_INFINITY,y=null,C=Number.POSITIVE_INFINITY;for(let[k,S]of i.current){if(!S.isConnected)continue;let L=S.offsetTop;L<C&&(C=L,y=k),L<=g&&L>=x&&(x=L,v=k)}let w=v??y;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=B(()=>{r.current&&a.request(c)},[a,c]);q(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let g=!0,v=new IntersectionObserver(()=>{!g||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let x of i.current.values())v.observe(x);return f(),()=>{g=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=_(new Map),m=B(g=>{let v=p.current.get(g);if(v)return v;let x=y=>{let C=i.current.get(g);C&&C!==y&&(s.current?.unobserve(C),i.current.delete(g)),y?(i.current.set(g,y),s.current?.observe(y)):p.current.delete(g)};return p.current.set(g,x),x},[]),h=B(()=>{r.current&&(l.current=null,f())},[f]);return z(()=>({observeSection:m,refresh:h}),[m,h])}function mc(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=s=>{let l=e.indexOf(s);return l<0?null:[e.slice(0,l),e.slice(l+s.length)]},i=a(o)??a(r);return i===null?b(be,{children:[e,t]}):b(be,{children:[i[0],t,i[1]]})}me();function zS(){let e=Jo(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,i)=>e.notify(r,a,i);return{error:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"error",s)},warning:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"warning",s)},success:(r,a,i)=>{let s=a??i?.description;o(n(r,s),"success",s)}}}function Kf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function Eh(e){let t=e.trimEnd().split(/\r?\n/),n=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;n[0]?.trim().length===0;)n.shift();if(n[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(n.shift();n[0]?.trim().length===0;)n.shift();return n.join(`
3669
- `)}function $S(e,t){let n=t?.maxLines??8,o=Eh(e).trimEnd().split(/\r?\n/).map(s=>s.trimEnd()),r=[],a=0,i=!1;for(let s of o){let l=s.trim().length>0;if(l&&a>=n){i=!0;break}r.push(s),l&&(a+=1)}for(;r.length>0&&r.at(-1)?.trim().length===0;)r.pop();return r.length===0?Kf(e)??"Plan preview unavailable.":(i&&r.push("","..."),r.join(`
3670
- `))}function ZF(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function HS(e){let t=Kf(e);return`${ZF(t??"plan")}.md`}function US(e){return`${e.trimEnd()}
3671
- `}function KS(e,t){let n=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(o)},0)}var qS=ue(function({planMarkdown:t,environmentId:n,threadRef:o,cwd:r,workspaceRoot:a,onSavePlanToWorkspace:i}){let{t:s}=Dt(),l=zS(),[d,c]=G(!1),[f,p]=G(!1),[m,h]=G(""),[g,v]=G(!1),{copyToClipboard:x,isCopied:y}=Ff({target:"plan",onError:H=>{l.error(s("proposedPlan.couldNotCopy"),H,{description:s("proposedPlan.copyErrorDescription")})}}),C=Qr(),w=Kf(t)??s("proposedPlan.defaultTitle"),k=t.split(`
3672
- `).length,S=t.length>900||k>20,L=Eh(t),I=S?$S(t,{maxLines:10}):null,T=HS(t),E=US(t),A=()=>{KS(T,E)},N=()=>{x(E)},R=()=>{if(!a){l.error(s("proposedPlan.workspacePathUnavailable"),s("proposedPlan.workspacePathUnavailableDescription"));return}h(H=>H.length>0?H:T),p(!0)},$=()=>{let H=m.trim();if(!(!a||i===null)){if(!H){l.warning(s("proposedPlan.enterWorkspacePath"));return}v(!0),(async()=>{let K=await i({environmentId:n,workspaceRoot:a,relativePath:H,contents:E});if(v(!1),K.ok){p(!1),l.success(s("proposedPlan.savedToWorkspace"),K.relativePath);return}l.error(s("proposedPlan.couldNotSave"),void 0,{description:s("proposedPlan.saveErrorDescription")})})()}};return b("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[b("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b("div",{className:"flex min-w-0 items-center gap-2",children:[u(ml,{variant:"secondary",children:s("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:w})]}),b(er,{children:[u(or,{render:u(ne,{"aria-label":s("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(Zo,{"aria-hidden":"true",className:"size-4"})}),b(nr,{align:"end",children:[u(tr,{onClick:N,children:s(y?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(tr,{onClick:A,children:s("proposedPlan.downloadAsMarkdown")}),i!==null?u(tr,{onClick:R,disabled:!a||g,children:s("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:F("relative",S&&!d&&"max-h-104 overflow-hidden"),children:[S&&!d?u(rr,{text:I??"",cwd:r,threadRef:o,isStreaming:!1}):u(rr,{text:L,cwd:r,threadRef:o,isStreaming:!1}),S&&!d?u("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-card/95 via-card/80 to-transparent"}):null]}),S?u("div",{className:"mt-4 flex justify-center",children:u(ne,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>c(H=>!H),children:s(d?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(wf,{open:f,onOpenChange:H=>{g||p(H)},children:b(Pf,{className:"max-w-xl",children:[b(kf,{children:[u(Af,{children:s("proposedPlan.saveToWorkspace")}),u(Tf,{children:mc(s("proposedPlan.pathHint"),u("code",{children:a??s("proposedPlan.theWorkspace")}),"path")})]}),u(UI,{className:"space-y-3",children:b("label",{htmlFor:C,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:s("proposedPlan.workspacePath")}),u(xf,{id:C,value:m,onChange:H=>h(H.target.value),placeholder:T,spellCheck:!1,disabled:g})]})}),b(Lf,{children:[u(ne,{variant:"outline",size:"sm",onClick:()=>p(!1),disabled:g,children:s("proposedPlan.cancel")}),u(ne,{size:"sm",onClick:()=>{$()},disabled:g,children:s(g?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function VS({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function WS({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}me();var qf=class extends Ki{state={failed:!1,error:null};static getDerivedStateFromError(t){return{failed:!0,error:t instanceof Error?t:new Error(String(t))}}componentDidUpdate(t){this.state.failed&&t.resetKey!==this.props.resetKey&&this.setState({failed:!1,error:null})}render(){if(!this.state.failed)return this.props.children;let{fallback:t}=this.props;return typeof t=="function"?t(this.state.error):t}};function e2({error:e,className:t}){let{t:n}=Dt();return b(Xe,{children:[b(Je,{render:u("div",{className:F("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(yo,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Ye,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function GS(e){return u(e2,{error:e})}me();function Mh(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function fi(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||t2.has(t)?"text":"file"}var t2=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function jS(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var n2="<ycodium-system>";function Rh(e){return e.startsWith(n2)}var o2=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function QS(e){let t=e.match(o2);return t&&t.length>0?t:[e]}function XS(e){let t=e.match(/<plugin-instruction>\n([\s\S]*?)\n<\/plugin-instruction>/)?.[1];if(t===void 0)return null;try{let n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return null;let o=n;return typeof o.pluginId!="string"||typeof o.title!="string"||typeof o.body!="string"?null:{pluginId:o.pluginId,title:o.title,body:o.body}}catch{return null}}function YS(e){switch(e){case"image":return Yi;case"pdf":return Xi;case"text":return Qi;case"file":return Mo}}var r2=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function gc(e){let t=r2.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=a2(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function a2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3668
+ `;me();me();var Yb=Ht(null),Jb=Yb.Provider,Zb=Ht(""),eI=Zb.Provider;function cf(){return fn(Zb)}function Xo(){let e=fn(Yb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var dh="conversation";var ch="__ycodiumConversationBridge",tI="ycodium.conversation.rebindable-bridge.v1";me();function nI(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=nI(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function oI(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=nI(e))&&(o&&(o+=" "),o+=t);return o}var rI=oI;var T1=(e,t)=>{let n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},L1=(e,t)=>({classGroupId:e,validator:t}),fI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var aI=[],k1="arbitrary..",P1=e=>{let t=E1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return A1(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return pI(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?T1(d,l):l:d||aI}return n[i]||aI}}},pI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=pI(e,t+1,a);if(d)return d}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let d=0;d<l;d++){let c=i[d];if(c.validator(s))return c.classGroupId}},A1=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?k1+o:void 0})(),E1=e=>{let{theme:t,classGroups:n}=e;return M1(n,t)},M1=(e,t)=>{let n=fI();for(let o in e){let r=e[o];ph(r,n,o,t)}return n},ph=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];R1(i,t,n,o)}},R1=(e,t,n,o)=>{if(typeof e=="string"){N1(e,t,n);return}if(typeof e=="function"){_1(e,t,n,o);return}D1(e,t,n,o)},N1=(e,t,n)=>{let o=e===""?t:mI(t,e);o.classGroupId=n},_1=(e,t,n,o)=>{if(O1(e)){ph(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(L1(n,e))},D1=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];ph(l,mI(t,s),n,o)}},mI=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);s||(s=fI(),n.nextPart.set(i,s)),n=s}return n},O1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,F1=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}};var B1=[],iI=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),z1=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let g=0;g<c;g++){let v=r[g];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,g)),l=g+1;continue}if(v==="/"){d=g;continue}}v==="["?i++:v==="]"?i--:v==="("?s++:v===")"&&s--}let f=a.length===0?r:r.slice(l),p=f,m=!1;f.endsWith("!")?(p=f.slice(0,-1),m=!0):f.startsWith("!")&&(p=f.slice(1),m=!0);let h=d&&d>l?d-l:void 0;return iI(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):iI(B1,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},$1=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);s||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(i)):r.push(i)}return r.length>0&&(r.sort(),o.push(...r)),o}},H1=e=>({cache:F1(e.cacheSize),parseClassName:z1(e),sortModifiers:$1(e),postfixLookupClassGroupIds:U1(e),...P1(e)}),U1=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},K1=/\s+/,q1=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(K1),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let x=!!v,y;if(x){let L=g.substring(0,v);y=o(L);let I=y&&i[y]?o(g):void 0;I&&I!==y&&(y=I,x=!1)}else y=o(g);if(!y){if(!x){d=f+(d.length>0?" "+d:d);continue}if(y=o(g),!y){d=f+(d.length>0?" "+d:d);continue}x=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=h?C+"!":C,k=w+y;if(s.indexOf(k)>-1)continue;s.push(k);let S=r(y,x);for(let L=0;L<S.length;++L){let I=S[L];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},V1=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=gI(n))&&(r&&(r+=" "),r+=o);return r},gI=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=gI(e[o]))&&(n&&(n+=" "),n+=t);return n},sI=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=H1(d),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=l=>{let d=o(l);if(d)return d;let c=q1(l,n);return r(l,c),c};return a=i,(...l)=>a(V1(...l))},W1=[],Dn=e=>{let t=n=>n[e]||W1;return t.isThemeGetter=!0,t},hI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,j1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,X1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Y1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ei=e=>G1.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),jr=e=>!!e&&Number.isInteger(Number(e)),uh=e=>e.endsWith("%")&&it(e.slice(0,-1)),ya=e=>j1.test(e),xI=()=>!0,Z1=e=>Q1.test(e)&&!X1.test(e),mh=()=>!1,eO=e=>Y1.test(e),tO=e=>J1.test(e),nO=e=>!Le(e)&&!ke(e),oO=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),rO=e=>ti(e,bI,mh),Le=e=>hI.test(e),Ki=e=>ti(e,II,Z1),lI=e=>ti(e,fO,it),aO=e=>ti(e,wI,xI),iO=e=>ti(e,SI,mh),dI=e=>ti(e,yI,mh),sO=e=>ti(e,CI,tO),uf=e=>ti(e,TI,eO),ke=e=>vI.test(e),Td=e=>qi(e,II),lO=e=>qi(e,SI),cI=e=>qi(e,yI),dO=e=>qi(e,bI),cO=e=>qi(e,CI),ff=e=>qi(e,TI,!0),uO=e=>qi(e,wI,!0),ti=(e,t,n)=>{let o=hI.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},qi=(e,t,n=!1)=>{let o=vI.exec(e);return o?o[1]?t(o[1]):n:!1},yI=e=>e==="position"||e==="percentage",CI=e=>e==="image"||e==="url",bI=e=>e==="length"||e==="size"||e==="bg-size",II=e=>e==="length",fO=e=>e==="number",SI=e=>e==="family-name",wI=e=>e==="number"||e==="weight",TI=e=>e==="shadow";var uI=()=>{let e=Dn("color"),t=Dn("font"),n=Dn("text"),o=Dn("font-weight"),r=Dn("tracking"),a=Dn("leading"),i=Dn("breakpoint"),s=Dn("container"),l=Dn("spacing"),d=Dn("radius"),c=Dn("shadow"),f=Dn("inset-shadow"),p=Dn("text-shadow"),m=Dn("drop-shadow"),h=Dn("blur"),g=Dn("perspective"),v=Dn("aspect"),x=Dn("ease"),y=Dn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...w(),ke,Le],S=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],I=()=>[ke,Le,l],T=()=>[ei,"full","auto",...I()],E=()=>[jr,"none","subgrid",ke,Le],A=()=>["auto",{span:["full",jr,ke,Le]},jr,ke,Le],N=()=>[jr,"auto",ke,Le],R=()=>["auto","min","max","fr",ke,Le],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...I()],O=()=>[ei,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],oe=()=>[ei,"screen","full","dvw","lvw","svw","min","max","fit",...I()],ee=()=>[ei,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,ke,Le],qe=()=>[...w(),cI,dI,{position:[ke,Le]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],fe=()=>["auto","cover","contain",dO,rO,{size:[ke,Le]}],Ne=()=>[uh,Td,Ki],Ae=()=>["","none","full",d,ke,Le],ae=()=>["",it,Td,Ki],Ee=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[it,uh,cI,dI],Ie=()=>["","none",h,ke,Le],st=()=>["none",it,ke,Le],dt=()=>["none",it,ke,Le],lt=()=>[it,ke,Le],ct=()=>[ei,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ya],breakpoint:[ya],color:[xI],container:[ya],"drop-shadow":[ya],ease:["in","out","in-out"],font:[nO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ya],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ya],shadow:[ya],spacing:["px",it],text:[ya],"text-shadow":[ya],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ei,Le,ke,v]}],container:["container"],"container-type":[{"@container":["","normal","size",ke,Le]}],"container-named":[oO],columns:[{columns:[it,Le,ke,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[jr,"auto",ke,Le]}],basis:[{basis:[ei,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,ei,"auto","initial","none",Le]}],grow:[{grow:["",it,ke,Le]}],shrink:[{shrink:["",it,ke,Le]}],order:[{order:[jr,"first","last","none",ke,Le]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],"inline-size":[{inline:["auto",...oe()]}],"min-inline-size":[{"min-inline":["auto",...oe()]}],"max-inline-size":[{"max-inline":["none",...oe()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[s,"screen",...O()]}],"min-w":[{"min-w":[s,"screen","none",...O()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,Td,Ki]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,uO,aO]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",uh,Le]}],"font-family":[{font:[lO,iO,t]}],"font-features":[{"font-features":[Le]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ke,Le]}],"line-clamp":[{"line-clamp":[it,"none",ke,lI]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",ke,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",ke,Ki]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[it,"auto",ke,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[jr,ke,Le]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:qe()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jr,ke,Le],radial:["",ke,Le],conic:[jr,ke,Le]},cO,sO]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Ne()}],"gradient-via-pos":[{via:Ne()}],"gradient-to-pos":[{to:Ne()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Ae()}],"rounded-s":[{"rounded-s":Ae()}],"rounded-e":[{"rounded-e":Ae()}],"rounded-t":[{"rounded-t":Ae()}],"rounded-r":[{"rounded-r":Ae()}],"rounded-b":[{"rounded-b":Ae()}],"rounded-l":[{"rounded-l":Ae()}],"rounded-ss":[{"rounded-ss":Ae()}],"rounded-se":[{"rounded-se":Ae()}],"rounded-ee":[{"rounded-ee":Ae()}],"rounded-es":[{"rounded-es":Ae()}],"rounded-tl":[{"rounded-tl":Ae()}],"rounded-tr":[{"rounded-tr":Ae()}],"rounded-br":[{"rounded-br":Ae()}],"rounded-bl":[{"rounded-bl":Ae()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ee(),"hidden","none"]}],"divide-style":[{divide:[...Ee(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,ke,Le]}],"outline-w":[{outline:["",it,Td,Ki]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,ff,uf]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,ff,uf]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[it,Ki]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",p,ff,uf]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[it,ke,Le]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ke,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:qe()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Le]}],filter:[{filter:["","none",ke,Le]}],blur:[{blur:Ie()}],brightness:[{brightness:[it,ke,Le]}],contrast:[{contrast:[it,ke,Le]}],"drop-shadow":[{"drop-shadow":["","none",m,ff,uf]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",it,ke,Le]}],"hue-rotate":[{"hue-rotate":[it,ke,Le]}],invert:[{invert:["",it,ke,Le]}],saturate:[{saturate:[it,ke,Le]}],sepia:[{sepia:["",it,ke,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Le]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[it,ke,Le]}],"backdrop-contrast":[{"backdrop-contrast":[it,ke,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,ke,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,ke,Le]}],"backdrop-invert":[{"backdrop-invert":["",it,ke,Le]}],"backdrop-opacity":[{"backdrop-opacity":[it,ke,Le]}],"backdrop-saturate":[{"backdrop-saturate":[it,ke,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",it,ke,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",ke,Le]}],ease:[{ease:["linear","initial",x,ke,Le]}],delay:[{delay:[it,ke,Le]}],animate:[{animate:["none",y,ke,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,ke,Le]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:st()}],"rotate-x":[{"rotate-x":st()}],"rotate-y":[{"rotate-y":st()}],"rotate-z":[{"rotate-z":st()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[ke,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ct()}],"translate-x":[{"translate-x":ct()}],"translate-y":[{"translate-y":ct()}],"translate-z":[{"translate-z":ct()}],"translate-none":["translate-none"],zoom:[{zoom:[jr,ke,Le]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Le]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[it,Td,Ki,lI]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},pO=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(ll(e,"cacheSize",t),ll(e,"prefix",n),ll(e,"experimentalParseClassName",o),pf(e.theme,a.theme),pf(e.classGroups,a.classGroups),pf(e.conflictingClassGroups,a.conflictingClassGroups),pf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ll(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),ll(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),mf(e.theme,r.theme),mf(e.classGroups,r.classGroups),mf(e.conflictingClassGroups,r.conflictingClassGroups),mf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),fh(e,r,"postfixLookupClassGroups"),fh(e,r,"orderSensitiveModifiers"),e),ll=(e,t,n)=>{n!==void 0&&(e[t]=n)},pf=(e,t)=>{if(t)for(let n in t)ll(e,n,t[n])},mf=(e,t)=>{if(t)for(let n in t)fh(e,t,n)},fh=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},LI=(e,...t)=>typeof e=="function"?sI(uI,e,...t):sI(()=>pO(uI(),e),...t);var mO=LI({extend:{classGroups:{"font-size":[{text:["chat","chat-row","chat-code","chat-dense","chat-meta","control-1","control-2","control-3","control-4","control-5"]}]}}});function F(...e){return mO(rI(e))}me();var gh=Ht(!0);var hh=Ht(void 0);function ni(){let e=Ut(gh);return Ut(hh)??e}me();var gf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var kI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var PI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var vh=e=>{let t=PI(e);return t.charAt(0).toUpperCase()+t.slice(1)};me();var AI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var EI=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var MI=Wn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Te("svg",{ref:l,...AI,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:gf("lucide",r),...!a&&!EI(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>Te(d,c)),...Array.isArray(a)?a:[a]]));var j=(e,t)=>{let n=Wn(({className:o,...r},a)=>Te(MI,{ref:a,iconNode:t,className:gf(`lucide-${kI(vh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=vh(e),n};var gO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ld=j("arrow-down",gO);var hO=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],kd=j("arrow-up-right",hO);var vO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Pd=j("arrow-up",vO);var xO=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Ad=j("blocks",xO);var yO=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],dl=j("bookmark",yO);var CO=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Vi=j("bot",CO);var bO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Io=j("check",bO);var IO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],pn=j("chevron-down",IO);var SO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Wi=j("chevron-left",SO);var wO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Uo=j("chevron-right",wO);var TO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ed=j("chevron-up",TO);var LO=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Md=j("chevrons-left",LO);var kO=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Rd=j("chevrons-right",kO);var PO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],So=j("circle-alert",PO);var AO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Gi=j("copy",AO);var EO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Yo=j("ellipsis",EO);var MO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nd=j("eye",MO);var RO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],ji=j("file-code",RO);var NO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Qi=j("file-text",NO);var _O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],_d=j("file",_O);var DO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],oi=j("folder",DO);var OO=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],Dd=j("frame",OO);var FO=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],Od=j("git-branch-plus",FO);var BO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Fd=j("globe",BO);var zO=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Bd=j("grip-vertical",zO);var $O=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],zd=j("hammer",$O);var HO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Xi=j("image",HO);var UO=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ca=j("layers",UO);var KO=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],$d=j("list-ordered",KO);var qO=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Yi=j("list-todo",qO);var VO=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Hd=j("list",VO);var WO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],ri=j("lock-open",WO);var GO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Ud=j("lock",GO);var jO=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Ji=j("message-circle",jO);var QO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Zi=j("message-square",QO);var XO=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Kd=j("minimize-2",XO);var YO=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Qr=j("mouse-pointer-click",YO);var JO=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],qd=j("package",JO);var ZO=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],es=j("paintbrush",ZO);var eF=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Ro=j("paperclip",eF);var tF=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Xr=j("pen-line",tF);var nF=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Vd=j("pencil-ruler",nF);var oF=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Wd=j("pencil",oF);var rF=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ts=j("puzzle",rF);var aF=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ns=j("rotate-ccw",aF);var iF=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],os=j("search",iF);var sF=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Gd=j("send",sF);var lF=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],jd=j("settings",lF);var dF=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],cl=j("sliders-horizontal",dF);var cF=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ai=j("sparkles",cF);var uF=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],No=j("square-pen",uF);var fF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Qd=j("square",fF);var pF=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],rs=j("star",pF);var mF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ba=j("terminal",mF);var gF=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Xd=j("text-quote",gF);var hF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Yr=j("user-round",hF);var vF=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Yd=j("wrench",vF);var xF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=j("x",xF);var yF=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],as=j("zap",yF);me();function De(){return{t:Xo().i18n.usePluginTranslation()}}me();var CF=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function J(e){let t=n=>{let o=Xo(),r=cf(),a=ni(),i=o.ui[e];return Te(i,{...n,...CF.has(e)&&!a?{open:!1}:{},className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var q9=J("useLinkContextMenu"),Ia=J("ProviderInstanceIcon"),RI=J("UserAvatar"),ul=J("Badge"),te=J("Button"),V9=J("Label"),hf=J("Input"),NI=J("Textarea"),W9=J("Switch"),Jd=J("Separator"),G9=J("Skeleton"),vf=J("Spinner"),j9=J("ScrollArea"),Q9=J("Card"),X9=J("CardAction"),Y9=J("CardContent"),J9=J("CardDescription"),Z9=J("CardFooter"),eQ=J("CardHeader"),tQ=J("CardTitle"),nQ=J("Empty"),oQ=J("EmptyContent"),rQ=J("EmptyDescription"),aQ=J("EmptyHeader"),iQ=J("EmptyMedia"),sQ=J("EmptyTitle"),lQ=J("InputGroup"),dQ=J("InputGroupAddon"),cQ=J("InputGroupInput"),uQ=J("DocumentPanel"),fQ=J("MasterDetail"),xf=J("Select"),pQ=J("SelectContent"),yf=J("SelectItem"),Cf=J("SelectPopup"),_I=J("SelectTrigger"),bf=J("SelectValue"),Zd=J("Toggle"),DI=J("ToggleGroup"),OI=J("AlertDialog"),FI=J("AlertDialogClose"),BI=J("AlertDialogDescription"),zI=J("AlertDialogFooter"),$I=J("AlertDialogHeader"),HI=J("AlertDialogPopup"),UI=J("AlertDialogTitle"),If=J("Dialog"),mQ=J("DialogClose"),Sf=J("DialogDescription"),wf=J("DialogFooter"),Tf=J("DialogHeader"),Lf=J("DialogPopup"),KI=J("DialogPanel"),kf=J("DialogTitle"),gQ=J("DialogTrigger"),hQ=J("DropdownMenu"),vQ=J("DropdownMenuContent"),xQ=J("DropdownMenuItem"),yQ=J("DropdownMenuTrigger"),Jo=J("Menu"),ec=J("MenuGroup"),CQ=J("MenuGroupLabel"),Zo=J("MenuItem"),er=J("MenuPopup"),Sa=J("MenuRadioGroup"),Cr=J("MenuRadioItem"),ii=J("MenuSeparator"),tr=J("MenuTrigger"),fl=J("Popover"),pl=J("PopoverPopup"),ml=J("PopoverTrigger"),qI=J("Table"),VI=J("TableBody"),si=J("TableCell"),is=J("TableHead"),WI=J("TableHeader"),Pf=J("TableRow"),Qe=J("Tooltip"),Xe=J("TooltipPopup"),Ye=J("TooltipTrigger"),GI=J("Collapsible"),jI=J("CollapsiblePanel"),QI=J("CollapsibleTrigger"),tc=J("Alert"),nc=J("AlertAction"),Af=J("AlertDescription"),xh=J("AlertTitle"),Ef=J("Kbd"),Mf=J("Command"),Rf=J("CommandGroup"),Nf=J("CommandItem"),_f=J("CommandList"),XI=J("Combobox"),YI=J("ComboboxEmpty"),JI=J("ComboboxInput"),gl=J("ComboboxItem"),ZI=J("ComboboxListVirtualized"),eS=J("TooltipProvider"),tS=J("StyledDiffCodeView"),nS=J("DevBackdropArt"),nr=J("Markdown"),oS=J("DiffView");var{jsx:u,jsxs:b,Fragment:be}=window.__ycodiumPluginHost.jsxRuntime;function rS({mode:e,onModeChange:t}){let{t:n}=De();return b(DI,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":n("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:o=>{let r=o[0];(r==="chat"||r==="trajectory")&&t(r)},children:[b(Zd,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(Zi,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(Zd,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u($d,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function aS({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat"?"chat":"trajectory";return u("div",{className:"relative flex min-h-0 flex-1 flex-col","aria-hidden":t?void 0:!0,inert:t?void 0:!0,"data-chat-view-pane":r,"data-pane-visible":t?"true":"false",children:u(hh,{value:t,children:r==="chat"?n:o})})}me();function co(){return{t:Xo().i18n.usePluginTranslation()}}function iS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function sS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function oc(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var bF=ue(function({item:t,ordinal:n,usage:o,onSelect:r}){return b("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[u("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),b("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?b("span",{className:"flex items-baseline gap-2",children:[u("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?u("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:oc(o.outputTokens)}):null]}):null]})]})});function IF({totals:e}){let{t}=co();if(!e)return null;let n=iS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:oc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:oc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?oc(e.cachedInputTokens):`${oc(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var SF=ue(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=co(),i=Xo().writeClipboard,[s,l]=G(!1),d=a("turnNavigator.copyMarkdown");return b(Qe,{children:[u(Ye,{render:u(te,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:s?u(Io,{className:"size-3 text-primary"}):u(Gi,{className:"size-3"})}),u(Xe,{children:u("p",{children:d})})]})});function lS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=co(),[d,c]=G(!1),f=z(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=z(()=>sS(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return b(fl,{onOpenChange:c,open:d,children:[b(ml,{render:u(te,{"aria-label":h,className:F("gap-1.5 rounded-full px-3",s==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:s==="float"?{bottom:n+12}:void 0,title:h,variant:"glass"}),children:[u(Hd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(pl,{align:"end",className:"w-80 flex-col",side:"top",children:b("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[b("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),u("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),u("div",{className:F("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>u(bF,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(IF,{totals:p}),b("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),u(SF,{size:"icon-xs",getText:a,variant:"ghost"}),u(te,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>i("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(te,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>i("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}me();function dS(e,t,n,o={}){if(t!==null)for(let r=0;r<e.length;r+=1){let a=e[r];if(a===void 0)continue;let i=n(a);if(i!==null)return i===t?{anchorIndex:r,anchorOffset:o.anchorOffset??16}:void 0}}me();function ss(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function wF(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function TF(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function LF(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var yh=TF(LF()),cS=new Map;function uS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=cS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(yh,wF(e,t));return cS.set(n,r),r}function Ch(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var kF=new Intl.DateTimeFormat(void 0,{month:"long"});function PF(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function AF(e,t){let n=Ch(e);return n?uS(t,!1).format(n):""}function Jr(e,t){let n=Ch(e);if(!n)return"";let o=AF(e,t),r=n.getDate(),a=kF.format(n),i=n.getFullYear();return`${o}, ${r}${PF(r)} ${a} ${i}`}var EF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric"}),MF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric",year:"numeric"});function li(e,t,n=Date.now()){let o=Ch(e);if(!o)return"";let r=uS(t,!1).format(o),a=new Date(n),i=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),l=Math.round((i-s)/864e5);return l<=0?r:l===1?`yesterday at ${r}`:`${(o.getFullYear()===a.getFullYear()?EF:MF).format(o)} ${r}`}me();me();async function RF(e,t){if(typeof window>"u"||typeof navigator>"u"||!navigator.clipboard?.writeText)throw new Error(`Clipboard API is unavailable while copying ${t}.`);if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(n){throw new Error(`Failed to copy ${t} to the clipboard.`,{cause:n})}}function Df({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=G(!1),i=_(null),s=_(n),l=_(o),d=_(t),c=_(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=B((p,m)=>{RF(p,d.current).then(h=>{h&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},h=>{l.current?.(h instanceof Error?h:new Error(String(h)),m)})},[]);return q(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function Dt(){let e=Xo().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var fS=1e3;function NF({title:e,description:t}){return b("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-balance text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?u("span",{className:"block text-muted-foreground",children:t}):null]})}var hl=ue(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=Dt(),s=_(null),[l,d]=G(null),c=_(null),f=(h,g)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(g===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:h,description:g}),c.current=setTimeout(()=>d(null),fS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Df({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:fS});return b(Qe,{children:[u(Ye,{render:u(te,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:m?u(Io,{className:"size-3 text-primary"}):u(Gi,{className:"size-3"})}),u(Xe,{children:u("p",{children:i("copyButton.copyToClipboard")})}),l?u("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:l.top,left:l.left},children:u("span",{className:"relative block -translate-x-1/2",children:u(NF,{title:l.title,description:l.description})})}):null]})});function _F(e){return e<1e3?Math.round(e).toLocaleString():e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Of({label:e,children:t}){let[n,o]=G(!1);return b(Qe,{open:n,onOpenChange:o,children:[u(Ye,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Xe,{children:e})]})}var pS=ue(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=Dt(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return b("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[b("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?b(Of,{label:i,children:[a==="completed"?u(Io,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(jt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Qd,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(Of,{label:Jr(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:li(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?b(Of,{label:r("timeline.workingTime",{duration:ss(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),ss(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(Of,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),_F(t.outputTokens)]}):null]}),o?u(hl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});me();me();function mS(e){if(e<1e3)return String(e);if(e<1e6){let n=e/1e3;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}k`}if(e<1e9){let n=e/1e6;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var gS=ue(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=Dt(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(be,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:F(i==="inline"?"inline-flex items-center gap-1 tabular-nums align-middle":"inline-grid grid-cols-[4ch_4ch] gap-2 text-right tabular-nums align-middle",r),children:[b("span",{"aria-hidden":"true",className:"font-mono text-success",children:["+",mS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",mS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function hS(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function DF(e){let t=e,n,o,r=t.match(/:(\d+)$/);if(!r?.[1])return{path:t,line:void 0,column:void 0};n=r[1],t=t.slice(0,-r[0].length);let a=t.match(/:(\d+)$/);return a?.[1]?(o=a[1],t=t.slice(0,-a[0].length)):(o=n,n=void 0),{path:t,line:o,column:n}}function vS(e){return e.replaceAll("\\","/")}function xS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function OF(e){return e.replace(/[\\/]+$/,"")}function FF(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function BF(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function zF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Ff(e,t){let{path:n,line:o,column:r}=DF(e),a=xS(vS(n)),i=a;if(t){let s=xS(vS(OF(t))),l=FF(s),d=a.toLowerCase(),c=s.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)i=l;else if(d.startsWith(f)){let m=a.slice(s.length+1);i=`${l}/${m}`}else if(!zF(a)){let m=BF(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function yS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function CS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Bf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function rc({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function ac({status:e}){return u("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:u("span",{className:F("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function zf({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:F("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?u("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}me();var vl=new Map,bS=24,$F=4e3;function bh(e){let t=vl.get(e);if(t)return t;let n={values:new Map,listeners:new Set};if(vl.set(e,n),vl.size>bS){for(let[o,r]of vl)if(r.listeners.size===0&&o!==e&&(vl.delete(o),vl.size<=bS))break}return n}function Ih(e,t,n){return bh(e).values.get(t)??n}function ic(e,t,n,o=!0){let r=bh(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>$F){let a=r.values.keys().next().value;a!==void 0&&r.values.delete(a)}o&&r.listeners.forEach(a=>a())}}function xl(e,t,n){let o=B(s=>{let l=bh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=B(()=>Ih(e,t,n),[e,t,n]),a=xa(o,r,r),i=B(s=>ic(e,t,s),[e,t]);return[a,i]}function $f({name:e,className:t}){switch(e){case"bot":return u(Vi,{className:t,"aria-hidden":!0});case"check":return u(Io,{className:t,"aria-hidden":!0});case"circle-alert":return u(So,{className:t,"aria-hidden":!0});case"eye":return u(Nd,{className:t,"aria-hidden":!0});case"globe":return u(Fd,{className:t,"aria-hidden":!0});case"hammer":return u(zd,{className:t,"aria-hidden":!0});case"message-circle":return u(Ji,{className:t,"aria-hidden":!0});case"search":return u(os,{className:t,"aria-hidden":!0});case"square-pen":return u(No,{className:t,"aria-hidden":!0});case"terminal":return u(ba,{className:t,"aria-hidden":!0});case"wrench":return u(Yd,{className:t,"aria-hidden":!0});case"x":return u(jt,{className:t,"aria-hidden":!0});case"zap":return u(as,{className:t,"aria-hidden":!0})}}function HF(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function Sh(e,t){let n=new Map;for(let o of e){let r=t(o);n.set(r,(n.get(r)??0)+1)}return Array.from(n,([o,r])=>({action:o,icon:HF(o),count:r}))}function wh(e,t){let n;for(let o of Sh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var yl=20;function Cl(e){return hS(e)}function IS(e,t,n){let o=e.toolLabel,r=n.resolveToolCommand(e);if(r&&o?.descriptive&&!o.path&&o.detail?.trim())return o.detail.replace(/\s+/g," ").trim();for(let p of[e.rawCommand,e.command]){let m=n.parseToolCommandInput(p)?.description;if(m)return m.replace(/\s+/g," ").trim()}if(r)return r.replace(/\s+/g," ").trim();let a=typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null,i=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,s=o?.name??i??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?Ff(l,t):void 0,c=[s.trim().toLowerCase()==="tool"?void 0:s,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(h=>h.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function SS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Th(e)?null:u(gS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Th(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function UF({entry:e,failed:t=!1,derive:n}){return t?u(So,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u($f,{name:wh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function KF({entries:e,failed:t,derive:n}){let{t:o}=Dt(),r=z(()=>Sh(e,n.toolGroupAction),[e,n]),a=r.length===1;return a&&r[0].count<2?null:u("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":o("toolGroup.calls",{count:e.length}),children:r.map(({action:i,icon:s,count:l})=>b("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u($f,{name:s,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function wS({entry:e}){let t=Ut(Tn),n=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,o=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:o,onOpenFileDiff:t.onOpenFileDiff});return u("div",{className:"min-w-0 space-y-2 p-3",children:r!==void 0?u(be,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var qF=ue(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=Ut(Tn).derive,{t:l}=Dt(),[d,c]=xl(o,`call:${Cl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Th(n),m=s.resolveWorkEntryStatus(n),h=m==="failed"||m==="running"?m:null,g=Wr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Cl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":g,onClick:()=>{a?.(),c(!d)},className:F("chat-tool-member-row chat-tool-summary flex w-full min-w-0 items-center gap-1.5 px-3 text-left hover:bg-accent/20",f?"text-destructive":"text-muted-foreground"),children:[u(ac,{status:h}),u(rc,{children:u(UF,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:IS(n,r,s)??l("toolGroup.calls",{count:1})}),u(SS,{entry:n,failed:f})]}),f||p?u("span",{className:"chat-process-meta shrink-0",children:f?l("toolGroup.failed",{count:1}):l("toolGroup.cancelled",{count:1})}):null,u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:g,children:u(wS,{entry:n})}):null]})});function VF({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=_(null);return ye(()=>{let a=r.current;if(!a)return;a.scrollTop=Ih(e,`${t}:scroll`,0);let i=()=>{ic(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[e,t]),u("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:n},children:o})}var TS=ue(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=Ut(Tn).derive,{t:l}=Dt(),[d,c]=xl(o,`group:${n}`,!1),[f,p]=xl(o,`group-page:${n}`,0),m=Wr(),h=_(null),[g,v]=G(null),x=t.at(-1),y=z(()=>t.filter(O=>s.workEntryIndicatesFailure(O)),[t,s]),C=z(()=>t.filter(Th),[t]),w=t.filter(O=>O.toolLifecycleStatus==="inProgress").length,k=y[0]??C[0],S=k??x,L=Math.max(0,Math.ceil(t.length/yl)-1),I=Math.min(f,L),T=I*yl,E=t.slice(T,T+yl),A=t.length>1;if(ye(()=>{if(!g)return;let O=h.current,oe=Array.from(O?.querySelectorAll("[data-tool-identity]")??[]).find(W=>W.dataset.toolIdentity===g.id);if(!oe)return;let ee=oe.closest('[data-slot="scroll-area-viewport"]');ee&&(ee.scrollTop+=oe.getBoundingClientRect().top-ee.getBoundingClientRect().top),oe.querySelector("button")?.focus({preventScroll:!0})},[g]),!x||!S)return null;let N=O=>{a?.(),p(O)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},$=CS(t.map(O=>yS(s.resolveWorkEntryStatus(O)))),H=wh(t,s.toolGroupAction),K=$==="failed"?"failed":$==="running"?"running":"success";return u(zf,{state:$,variant:"tool",children:b("section",{ref:h,"data-tool-group-id":n,className:"min-w-0",children:[b("div",{className:"flex min-w-0 items-center",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!A&&!d&&ic(o,`call:${Cl(x)}`,!0)},className:F(Bf,"flex-1",k?"text-destructive":"text-muted-foreground"),children:[u(ac,{status:K}),u(rc,{children:u($f,{name:H,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",y.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:F("flex min-w-0 flex-1 items-center",d&&A?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&A?l("toolGroup.calls",{count:t.length}):IS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&A?null:u(SS,{entry:S,failed:s.workEntryIndicatesFailure(S)})]}),w>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:w})}):null,y.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:y.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&A?null:u(KF,{entries:t,failed:y.length>0,derive:s}),u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),k&&A?u("button",{type:"button",className:"chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 text-destructive underline [@media(pointer:coarse)]:min-h-11",onClick:()=>{a?.(),c(!0),p(Math.floor(t.indexOf(k)/yl)),ic(o,`call:${Cl(k)}`,!0),v({id:Cl(k)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:A?b(be,{children:[t.length>yl?b("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[u("span",{className:"min-w-0 flex-1 tabular-nums",children:l("toolGroup.pageRange",{from:T+1,to:Math.min(T+yl,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:I===0,Icon:Md},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Wi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===L,Icon:Uo},{label:l("toolGroup.lastPage"),target:L,disabled:I===L,Icon:Rd}].map(({label:O,target:oe,disabled:ee,Icon:W})=>u("button",{type:"button","aria-label":O,disabled:ee,onClick:()=>N(oe),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(W,{"aria-hidden":!0,className:"size-icon-1"})},O))]}):null,u(VF,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:E.map(O=>u(qF,{entry:O,...R},Cl(O)))})})]}):u(wS,{entry:x})}):null]})})});function WF(e,t,n){let o=n-t;if(Math.abs(o)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+o));return Math.abs(r-e.scrollTop)<1?null:r}function LS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,i=!0,s=null,l=()=>{if(s=null,!i||!n.isConnected||!t.contains(n))return;let f=WF(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{i&&s===null&&(s=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{i=!1,c?.disconnect(),s!==null&&cancelAnimationFrame(s),s=null}}}me();function Lh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function kS(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),s=e[a].getBoundingClientRect();Math.max(s.bottom,s.top+1)>t?(r=a,o=a):n=a+1}return r}function GF(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=kS(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.max(0,Math.round(t-l.getBoundingClientRect().top))}};if(n.length===0)return o(e);let r=kS(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let i=o(n[a]);if(i)return i}return null}function PS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var kh=class extends Ui{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function AS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i}){let s=_(null);Gr(n,()=>({get node(){return s.current},measure:()=>{let d=s.current;return d?{scroll:d.scrollTop,scrollLength:d.clientHeight,contentLength:d.scrollHeight,topOf:c=>{let f=Lh(d,c);return f===null?null:PS(f,d)},heightOf:c=>{let f=Lh(d,c);return f===null?null:f.offsetHeight},rowAtScroll:()=>GF(d)}:null},scrollToEnd:d=>{let c=s.current;if(c){if(d?.animated){c.scrollTo({top:c.scrollHeight,behavior:"smooth"});return}c.scrollTop=c.scrollHeight-c.clientHeight}},scrollToRow:(d,c)=>{let f=s.current;if(!f)return!1;let p=Lh(f,d);return p?(f.scrollTop=Math.max(0,PS(p,f)-(c?.viewOffset??0)),!0):!1},scrollToOffset:d=>{let c=s.current;c&&(c.scrollTop=Math.max(0,d))}}),[]);let l=B(d=>{s.current=d,o(d)},[o]);return u(kh,{inputKey:e,onBeforeInputChange:t,children:u("div",{ref:l,className:r,style:{position:"relative"},onScroll:i,children:a})})}me();var ES=ue(function({sectionKey:t,rowKeyPrefix:n,rows:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(i=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(i)},`${n}:${i.id}`))})});function jF(e){for(let t of e)switch(t.kind){case"turn-identity":return t.turnId;case"working":return t.turnId??null;case"message":if(t.message.role==="assistant")return t.message.turnId;break;case"tool-group":if(t.entries[0]?.turnId!==void 0)return t.entries[0].turnId??null;break;case"work":if(t.groupedEntries[0]?.turnId!==void 0)return t.groupedEntries[0].turnId??null;break;case"turn-plan":return t.turnPlan.turnId;case"proposed-plan":return t.proposedPlan.turnId;case"turn-summary":return t.footer.turnId}return null}function MS(e,t){let n=[];for(let o of t){if(o.end<=o.start)continue;let r=e.slice(o.start,o.end);n.push({key:o.key,turnId:jF(r),firstRowIndex:o.start,rows:r})}return n}function RS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function sc(e,t,n){let o=e.findIndex(r=>r.rows.some(a=>a.id===t));return o<0?n:Math.max(n,e.length-o)}me();me();var _S=100,QF=new Map,NS=new Map,Ah=e=>typeof e=="function"?e():e,XF=(e,t)=>typeof t=="function"?t(e):t;function YF(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function JF(e,t){let n=NS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},NS.set(e,n)),n}function ZF(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Ph(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function DS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:Ah(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function lc(e){queueMicrotask(()=>ZF(e))}function Ln(e,t,n,o=_S){let r=Math.max(1,o),a=YF(QF,e,r),i=DS(a,t,n),s=B(f=>i.alive?(a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,i.subscribers.add(f),lc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),lc(a)}):()=>{},[r,i,a,t]),l=B(()=>i.value,[i]),d=xa(s,l,l),c=B(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=XF(p,f);if(!Object.is(m,p)){i.value=m,Ph(a,t,i);for(let h of i.subscribers)h();lc(a)}},[i,a,t]);return[d,c]}function En(e,t,n,o=_S){let r=Math.max(1,o),a=JF(e,r),i=DS(a,t,()=>({current:Ah(n)}));return q(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,lc(a),()=>{i.leases=Math.max(0,i.leases-1),lc(a)}},[r,i,a,t]),i.value}function dc(e,t){let n=_(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:Ah(t)}}),n.current.ref}var ls=3,e2=ls;function OS(e){let[t,n]=Ln("timeline-reveal-window",e,ls),o=B(()=>{n(s=>s+e2)},[n]),r=B(s=>{n(l=>s>l?s:l)},[n]),a=B(()=>{n(ls)},[n]),i=B(s=>{n(l=>Math.min(l,Math.max(ls,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function FS({root:e,minimumCount:t,canCompact:n,onCompact:o}){let r=e.ownerDocument,a=new Set,i,s=!1,l=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,d=()=>{if(i=void 0,r.hidden||a.size>0||!n()||e.clientHeight<=0||!l())return;let x=r.getSelection();if(x&&!x.isCollapsed){for(let L=0;L<x.rangeCount;L+=1)if(x.getRangeAt(L).intersectsNode(e))return}let y=e.querySelectorAll("[data-timeline-turn-section]"),C=e.getBoundingClientRect().top-32,w=0,k=Math.max(0,y.length-t);for(;w<k;){let L=Math.floor((w+k)/2),I=y[L].getBoundingClientRect().bottom;if(!Number.isFinite(I))return;I<=C?w=L+1:k=L}if(w===0)return;let S=r.activeElement;if(S){for(let L=0;L<w;L+=1)if(y[L].contains(S))return}o(y.length-w)},c=()=>{i===void 0&&(i=setTimeout(d,400))},f=()=>{clearTimeout(i),i=setTimeout(d,400)},p=()=>{let x=l();!x||!s?f():c(),s=x},m=x=>{a.add(x.pointerId),f()},h=x=>{a.delete(x.pointerId),f()},g=()=>{a.clear(),f()},v=["wheel","keydown","focusin","focusout"];for(let x of v)e.addEventListener(x,f,{passive:!0});return e.addEventListener("scroll",p,{passive:!0}),e.addEventListener("pointerdown",m,!0),r.addEventListener("pointerup",h,!0),r.addEventListener("pointercancel",h,!0),r.addEventListener("selectionchange",f),r.addEventListener("visibilitychange",c),r.defaultView?.addEventListener("blur",g),c(),{schedule:c,disconnect:()=>{clearTimeout(i);for(let x of v)e.removeEventListener(x,f);e.removeEventListener("scroll",p),e.removeEventListener("pointerdown",m,!0),r.removeEventListener("pointerup",h,!0),r.removeEventListener("pointercancel",h,!0),r.removeEventListener("selectionchange",f),r.removeEventListener("visibilitychange",c),r.defaultView?.removeEventListener("blur",g)}}}me();me();function BS(e){let t=_(e);t.current=e;let n=_(!1),o=_(null),r=_(null),a=_(0),i=B(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=B(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let c=++a.current;r.current=requestAnimationFrame(f=>{if(c!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=B(c=>{o.current=c,s()},[s]),d=B(()=>{o.current=null,i()},[i]);return ye(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),z(()=>({request:l,cancel:d}),[l,d])}function zS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=_(o);r.current=o;let a=BS(o),i=_(new Map),s=_(null),l=_(null),d=_(n);d.current=n;let c=B(()=>{if(!r.current||!e)return;let g=e.scrollTop+t,v=null,x=Number.NEGATIVE_INFINITY,y=null,C=Number.POSITIVE_INFINITY;for(let[k,S]of i.current){if(!S.isConnected)continue;let L=S.offsetTop;L<C&&(C=L,y=k),L<=g&&L>=x&&(x=L,v=k)}let w=v??y;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=B(()=>{r.current&&a.request(c)},[a,c]);q(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let g=!0,v=new IntersectionObserver(()=>{!g||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let x of i.current.values())v.observe(x);return f(),()=>{g=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=_(new Map),m=B(g=>{let v=p.current.get(g);if(v)return v;let x=y=>{let C=i.current.get(g);C&&C!==y&&(s.current?.unobserve(C),i.current.delete(g)),y?(i.current.set(g,y),s.current?.observe(y)):p.current.delete(g)};return p.current.set(g,x),x},[]),h=B(()=>{r.current&&(l.current=null,f())},[f]);return z(()=>({observeSection:m,refresh:h}),[m,h])}function cc(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=s=>{let l=e.indexOf(s);return l<0?null:[e.slice(0,l),e.slice(l+s.length)]},i=a(o)??a(r);return i===null?b(be,{children:[e,t]}):b(be,{children:[i[0],t,i[1]]})}me();function $S(){let e=Xo(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,i)=>e.notify(r,a,i);return{error:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"error",s)},warning:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"warning",s)},success:(r,a,i)=>{let s=a??i?.description;o(n(r,s),"success",s)}}}function Hf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function Eh(e){let t=e.trimEnd().split(/\r?\n/),n=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;n[0]?.trim().length===0;)n.shift();if(n[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(n.shift();n[0]?.trim().length===0;)n.shift();return n.join(`
3669
+ `)}function HS(e,t){let n=t?.maxLines??8,o=Eh(e).trimEnd().split(/\r?\n/).map(s=>s.trimEnd()),r=[],a=0,i=!1;for(let s of o){let l=s.trim().length>0;if(l&&a>=n){i=!0;break}r.push(s),l&&(a+=1)}for(;r.length>0&&r.at(-1)?.trim().length===0;)r.pop();return r.length===0?Hf(e)??"Plan preview unavailable.":(i&&r.push("","..."),r.join(`
3670
+ `))}function t2(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function US(e){let t=Hf(e);return`${t2(t??"plan")}.md`}function KS(e){return`${e.trimEnd()}
3671
+ `}function qS(e,t){let n=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(o)},0)}var VS=ue(function({planMarkdown:t,environmentId:n,threadRef:o,cwd:r,workspaceRoot:a,onSavePlanToWorkspace:i}){let{t:s}=Dt(),l=$S(),[d,c]=G(!1),[f,p]=G(!1),[m,h]=G(""),[g,v]=G(!1),{copyToClipboard:x,isCopied:y}=Df({target:"plan",onError:H=>{l.error(s("proposedPlan.couldNotCopy"),H,{description:s("proposedPlan.copyErrorDescription")})}}),C=Wr(),w=Hf(t)??s("proposedPlan.defaultTitle"),k=t.split(`
3672
+ `).length,S=t.length>900||k>20,L=Eh(t),I=S?HS(t,{maxLines:10}):null,T=US(t),E=KS(t),A=()=>{qS(T,E)},N=()=>{x(E)},R=()=>{if(!a){l.error(s("proposedPlan.workspacePathUnavailable"),s("proposedPlan.workspacePathUnavailableDescription"));return}h(H=>H.length>0?H:T),p(!0)},$=()=>{let H=m.trim();if(!(!a||i===null)){if(!H){l.warning(s("proposedPlan.enterWorkspacePath"));return}v(!0),(async()=>{let K=await i({environmentId:n,workspaceRoot:a,relativePath:H,contents:E});if(v(!1),K.ok){p(!1),l.success(s("proposedPlan.savedToWorkspace"),K.relativePath);return}l.error(s("proposedPlan.couldNotSave"),void 0,{description:s("proposedPlan.saveErrorDescription")})})()}};return b("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[b("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b("div",{className:"flex min-w-0 items-center gap-2",children:[u(ul,{variant:"secondary",children:s("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:w})]}),b(Jo,{children:[u(tr,{render:u(te,{"aria-label":s("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(Yo,{"aria-hidden":"true",className:"size-4"})}),b(er,{align:"end",children:[u(Zo,{onClick:N,children:s(y?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(Zo,{onClick:A,children:s("proposedPlan.downloadAsMarkdown")}),i!==null?u(Zo,{onClick:R,disabled:!a||g,children:s("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:F("relative",S&&!d&&"max-h-104 overflow-hidden"),children:[S&&!d?u(nr,{text:I??"",cwd:r,threadRef:o,isStreaming:!1}):u(nr,{text:L,cwd:r,threadRef:o,isStreaming:!1}),S&&!d?u("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-card/95 via-card/80 to-transparent"}):null]}),S?u("div",{className:"mt-4 flex justify-center",children:u(te,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>c(H=>!H),children:s(d?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(If,{open:f,onOpenChange:H=>{g||p(H)},children:b(Lf,{className:"max-w-xl",children:[b(Tf,{children:[u(kf,{children:s("proposedPlan.saveToWorkspace")}),u(Sf,{children:cc(s("proposedPlan.pathHint"),u("code",{children:a??s("proposedPlan.theWorkspace")}),"path")})]}),u(KI,{className:"space-y-3",children:b("label",{htmlFor:C,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:s("proposedPlan.workspacePath")}),u(hf,{id:C,value:m,onChange:H=>h(H.target.value),placeholder:T,spellCheck:!1,disabled:g})]})}),b(wf,{children:[u(te,{variant:"outline",size:"sm",onClick:()=>p(!1),disabled:g,children:s("proposedPlan.cancel")}),u(te,{size:"sm",onClick:()=>{$()},disabled:g,children:s(g?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function WS({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function GS({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}me();var Uf=class extends Ui{state={failed:!1,error:null};static getDerivedStateFromError(t){return{failed:!0,error:t instanceof Error?t:new Error(String(t))}}componentDidUpdate(t){this.state.failed&&t.resetKey!==this.props.resetKey&&this.setState({failed:!1,error:null})}render(){if(!this.state.failed)return this.props.children;let{fallback:t}=this.props;return typeof t=="function"?t(this.state.error):t}};function n2({error:e,className:t}){let{t:n}=Dt();return b(Qe,{children:[b(Ye,{render:u("div",{className:F("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(So,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Xe,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function jS(e){return u(n2,{error:e})}me();function Mh(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function di(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||o2.has(t)?"text":"file"}var o2=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function QS(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var r2="<ycodium-system>";function Rh(e){return e.startsWith(r2)}var a2=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function XS(e){let t=e.match(a2);return t&&t.length>0?t:[e]}function YS(e){let t=e.match(/<plugin-instruction>\n([\s\S]*?)\n<\/plugin-instruction>/)?.[1];if(t===void 0)return null;try{let n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return null;let o=n;return typeof o.pluginId!="string"||typeof o.title!="string"||typeof o.body!="string"?null:{pluginId:o.pluginId,title:o.title,body:o.body}}catch{return null}}function JS(e){switch(e){case"image":return Xi;case"pdf":return Qi;case"text":return ji;case"file":return Ro}}var i2=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function uc(e){let t=i2.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=s2(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function s2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3673
3673
  `).trimEnd()}),n=null)};for(let r of e.split(`
3674
- `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var i2=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function Nh(e){let t=i2.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3675
- `),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),i=o.find(p=>p.startsWith("Comment: ")),s=o.find(p=>p.startsWith("Targets: ")),l=o.indexOf("Requested visual changes:"),d=o.slice(l+1),c=d.indexOf("<element_context>"),f=l<0?[]:d.slice(0,c<0?void 0:c).filter(p=>p.startsWith("- ")).map(p=>p.slice(2));return{promptText:e.slice(0,t.index).replace(/\n+$/,""),annotation:{id:a?.slice(4).trim()||`${t.index}`,title:r?.slice(6).trim()||"Preview annotation",comment:i?.slice(9).trim()||"",targetSummary:s?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var s2=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,l2=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,d2=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function c2(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function u2(e){let t={};for(let n of e.matchAll(l2))t[n[1]]=c2(n[2]??"");return t}function JS(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function f2(e){let n=Array.from(e.matchAll(d2)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function p2(e,t,n){let o=u2(e),r=JS(o.startIndex),a=JS(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=f2(t);return{id:`review-comment:${n}:${s}:${i}:${r}:${a}`,sectionId:s,sectionTitle:o.sectionTitle?.trim()||"Review",filePath:i,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||"line",text:l.text,diff:l.contents,fenceLanguage:l.language}}function _h(e){let t=[],n=0,o=0;for(let a of e.matchAll(s2)){let i=a.index??0,s=e.slice(n,i);s.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:s});let l=p2(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${i}`,text:a[0]}),n=i+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function ZS(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
3676
- `)}function e0(e){if((e.fenceLanguage??"diff")!=="diff")return"";let t=e.diff.trim();if(t.length===0)return"";if(t.startsWith("diff --git "))return t;let n=e.filePath.replaceAll("\\","/");return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
3677
- `)}var m2="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",g2=`${m2} border border-border/70 bg-accent/40 text-foreground`,Vf=`${g2} text-[12px]`,Wf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Gf="truncate leading-tight",t0='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>';var h2=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function v2(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function x2(e){let t=e.displayName?.trim();return t||v2(e.name)}function n0(e){let t=[],n=0;for(let o of e.text.matchAll(h2)){let r=o[1]??"",a=o[2]??"",i=(o.index??0)+r.length,s=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(i>n&&t.push(e.text.slice(n,i)),t.push(u(y2,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(be,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(be,{children:t}))}function y2(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:F(Vf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:Wf,dangerouslySetInnerHTML:{__html:t0}}),u("span",{className:Gf,children:x2(e.skill)})]})})}function o0(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Xe,{children:[b(Je,{render:u("span",{className:F(Vf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(La,{className:F(Wf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Gf,children:t})]}),u(Ye,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var C2=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function b2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3674
+ `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var l2=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function Nh(e){let t=l2.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3675
+ `),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),i=o.find(p=>p.startsWith("Comment: ")),s=o.find(p=>p.startsWith("Targets: ")),l=o.indexOf("Requested visual changes:"),d=o.slice(l+1),c=d.indexOf("<element_context>"),f=l<0?[]:d.slice(0,c<0?void 0:c).filter(p=>p.startsWith("- ")).map(p=>p.slice(2));return{promptText:e.slice(0,t.index).replace(/\n+$/,""),annotation:{id:a?.slice(4).trim()||`${t.index}`,title:r?.slice(6).trim()||"Preview annotation",comment:i?.slice(9).trim()||"",targetSummary:s?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var d2=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,c2=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,u2=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function f2(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function p2(e){let t={};for(let n of e.matchAll(c2))t[n[1]]=f2(n[2]??"");return t}function ZS(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function m2(e){let n=Array.from(e.matchAll(u2)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function g2(e,t,n){let o=p2(e),r=ZS(o.startIndex),a=ZS(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=m2(t);return{id:`review-comment:${n}:${s}:${i}:${r}:${a}`,sectionId:s,sectionTitle:o.sectionTitle?.trim()||"Review",filePath:i,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||"line",text:l.text,diff:l.contents,fenceLanguage:l.language}}function _h(e){let t=[],n=0,o=0;for(let a of e.matchAll(d2)){let i=a.index??0,s=e.slice(n,i);s.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:s});let l=g2(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${i}`,text:a[0]}),n=i+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function e0(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
3676
+ `)}function t0(e){if((e.fenceLanguage??"diff")!=="diff")return"";let t=e.diff.trim();if(t.length===0)return"";if(t.startsWith("diff --git "))return t;let n=e.filePath.replaceAll("\\","/");return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
3677
+ `)}var h2="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",v2=`${h2} border border-border/70 bg-accent/40 text-foreground`,Kf=`${v2} text-[12px]`,qf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Vf="truncate leading-tight",n0='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>';var x2=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function y2(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function C2(e){let t=e.displayName?.trim();return t||y2(e.name)}function o0(e){let t=[],n=0;for(let o of e.text.matchAll(x2)){let r=o[1]??"",a=o[2]??"",i=(o.index??0)+r.length,s=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(i>n&&t.push(e.text.slice(n,i)),t.push(u(b2,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(be,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(be,{children:t}))}function b2(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:F(Kf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:qf,dangerouslySetInnerHTML:{__html:n0}}),u("span",{className:Vf,children:C2(e.skill)})]})})}function r0(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Qe,{children:[b(Ye,{render:u("span",{className:F(Kf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(ba,{className:F(qf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Vf,children:t})]}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var I2=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function S2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3678
3678
  `).trimEnd()}),n=null)};for(let r of e.split(`
3679
- `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}if(n){if(r.startsWith(" ")){n.bodyLines.push(r.slice(2));continue}r.length===0&&n.bodyLines.push("")}}return o(),t}function I2(e){let t=C2.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=b2(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3679
+ `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}if(n){if(r.startsWith(" ")){n.bodyLines.push(r.slice(2));continue}r.length===0&&n.bodyLines.push("")}}return o(),t}function w2(e){let t=I2.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=S2(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3680
3680
  ${a}`:r).join(`
3681
3681
 
3682
- `):null,contexts:o}}function r0(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),n=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${n}`}function Dh(e){let t=gc(e),n=I2(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var S2=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function a0(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(jf(o))}return t.join(" ")}function jf(e){let t=e.trim(),n=S2.exec(t);if(!n)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let o=Number.parseInt(n[2]??"",10),r=Number.parseInt(n[3]??n[2]??"",10);return!Number.isFinite(o)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:r0({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function i0(e,t){let n=0;for(let o of t){let r=jf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function Oh({row:e}){let t=Ut(In).derive;if(Rh(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(be,{children:[u(L2,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Oh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(P2,{row:e})}return u(w2,{row:e,text:e.message.text})}function Fh({images:e}){let t=Ut(In),{t:n}=Dt();return e.length===0?null:u("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>u("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Mh(e,o.id);r&&t.onImageExpand(r)},children:u("img",{src:o.previewUrl,alt:o.name,className:"block h-auto max-h-[220px] w-full object-cover"})}):u("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function w2({row:e,text:t}){let{t:n}=Dt(),o=Ut(In),r=e.message.attachments??[],a=Dh(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Nh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=gc(l),c=[...a.elementContexts,...d.contexts],f=r.filter(v=>v.name.startsWith("preview-annotation-")),p=r.filter(v=>!v.name.startsWith("preview-annotation-")),m=p.filter(v=>fi(v)==="image"),h=p.filter(v=>fi(v)!=="image"),g=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(T2,{author:g}),b("div",{className:"min-w-0 flex-1 space-y-2",children:[b("div",{className:"flex min-h-7 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-chat-dense",children:[u("span",{className:"min-w-0 truncate font-medium text-foreground",children:g?.displayName??n("message.user")}),b(Xe,{children:[u(Je,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:ui(e.message.createdAt,o.timestampFormat)}),u(Ye,{children:ta(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(A2,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(yl,{text:a.copyText,variant:"ghost"})]})]}),b("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(Fh,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(zh,{attachment:v},v.id))}),s.map((v,x)=>u(R2,{annotation:v,image:f[x]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(M2,{context:v},`${v.header}:${v.body}`))}):null,u(F2,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function T2({author:e}){let t=e;return t!==null?u(MI,{userId:t.userId,displayName:t.displayName,size:28,className:"mt-0.5"}):u("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-message text-secondary-label",children:u(ea,{className:"size-4"})})}function Qf({children:e}){return u("div",{className:"flex justify-center py-1",children:u("div",{className:"max-w-[80%] rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:e})})}function L2({parsed:e}){let{t}=Dt();return b(Qf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var k2={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.stopped":"childThread.notification.stopped","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved"};function P2({row:e}){let{t}=Dt(),n=Ut(In).derive,o=e.message.attachments??[],r=o.filter(l=>fi(l)==="image"),a=o.filter(l=>fi(l)!=="image"),i=l=>{let d=XS(l);if(d)return b(Qf,{children:[u("p",{className:"font-medium text-foreground/80",children:d.title}),d.body.length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:d.body}):null]});let c=n.parseThreadHandoverText(l);if(c)return b(Qf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),u("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:c.includedTurns})}),u("p",{className:"mt-1 whitespace-pre-wrap",children:c.body})]});let f=n.parseSystemNotificationText(l);return f?b(Qf,{children:[u("p",{className:"font-medium text-foreground/80",children:t(k2[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=QS(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(be,{children:[s.map((l,d)=>u(ti,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(Fh,{images:r}),a.map(l=>u(zh,{attachment:l},l.id))]}):null]})}function d0(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Rh(e??""))return null;let r=Dh(n??e??"").visibleText;for(;;){let s=Nh(r);if(!s.annotation)break;r=s.promptText}let a=gc(r).promptText,i=_h(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var c0=34,u0=8,Bh=c0+u0,f0=ue(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=Dt(),s=i(r?"timeline.pinnedTurnHeaderShowLess":"timeline.pinnedTurnHeaderShowMore");return u("div",{ref:t,className:"group pointer-events-none absolute inset-x-0 top-0 z-10 px-3 sm:px-5",style:{paddingTop:u0},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:F("transcript-col-wide pointer-events-auto flex gap-2 rounded-sm border border-border/70 bg-background pe-1 ps-3 shadow-md shadow-black/10",r?"items-start py-1.5":"items-center"),...r?{}:{style:{height:c0}},children:[u("span",{ref:n,className:F("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Xe,{children:[u(Je,{render:u(ne,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(_d,{}):u(ln,{})}),u(Ye,{side:"bottom",children:s})]})]})})});function A2({messageId:e,onFork:t}){let{t:n}=Dt(),o=n("fork.action");return b(Xe,{children:[u(Je,{render:u(ne,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u($d,{className:"size-3"})}),u(Ye,{side:"top",children:o})]})}function p0({row:e}){let t=Ut(In),{t:n}=Dt(),[o,r]=bl(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Hf,{state:"idle",children:b("button",{type:"button",className:F($f,"chat-process-text cursor-pointer text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":n("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[u(dc,{status:null}),u(lc,{children:u(ec,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(ln,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>fi(c)==="image"),l=i.filter(c=>fi(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":"(empty response)");return u(be,{children:b("div",{className:"relative min-w-0 px-1 py-0.5","data-assistant-text-tone":e.textTone==="process"&&e.presentation!=="compact"?"process":"primary",children:[e.presentation==="compact"?b("div",{className:"mb-1 flex items-center gap-2",children:[u("button",{type:"button",className:"chat-process-meta mb-1 rounded-sm text-secondary-label","aria-expanded":!0,onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!1)},children:n("timeline.collapseMessage")}),e.copyInFooter?null:u(yl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u($h,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(rr,{text:d,className:e.textTone==="process"&&e.presentation!=="compact"?"chat-commentary":"chat-readable-body",cwd:t.markdownCwd,threadRef:t.threadRef??void 0,isStreaming:!!e.message.streaming,lineBreaks:t.derive.shouldPreserveAssistantLineBreaks(d),skills:t.skills}),u(Fh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(zh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?b("div",{className:"mt-1.5 flex items-center gap-2 text-chat-row tabular-nums opacity-0 transition-opacity duration-(--control-duration) focus-within:opacity-100 group-hover/assistant:opacity-100",children:[u(E2,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Xe,{children:[u(Je,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:ui(e.message.updatedAt,t.timestampFormat)}),u(Ye,{children:ta(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function E2({row:e}){let n=Ut(In).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(yl,{text:n.text??"",variant:"ghost"}):null}var s0=ue(function(t){let n=t.context.body.length>0?`${t.context.header}
3683
- ${t.context.body}`:t.context.header;return u(o0,{label:t.context.header,tooltipText:n})}),M2=ue(function(t){let n=t.context.body?`${t.context.header}
3684
- ${t.context.body}`:t.context.header;return b(Xe,{children:[b(Je,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(Jr,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Ye,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function zh(e){let{t}=Dt(),n=fi(e.attachment),o=YS(n),r=t("attachments.open",{name:e.attachment.name}),a=b(be,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0 flex-1",children:[u("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),u("span",{className:"block text-secondary-label text-chat-meta",children:jS(e.attachment.sizeBytes)})]})]});return e.attachment.previewUrl?u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 hover:bg-background/90",children:a}):u("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:a})}function R2(e){let t=Ut(In),{t:n}=Dt();return b("div",{className:"mb-2 flex max-w-full items-center overflow-hidden rounded-lg border border-border/70 bg-background/70",children:[e.image?.previewUrl?u("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":n("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let o=Mh([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:"Annotated preview crop",className:"size-full object-cover"})}):null,b("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?u("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,b("div",{className:F("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?u("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?b("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(ts,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var N2=8,_2=600,D2=1.75,l0=`linear-gradient(to bottom, black calc(100% - ${D2}rem), transparent)`;function O2(e){return e.trim().length===0?!1:e.length>_2||e.split(`
3685
- `).length>N2}var F2=ue(function(t){let[n,o]=G(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&O2(t.text),i=a&&!n;return b("div",{children:[r?u("div",{className:F("relative",i&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":i?"true":"false","data-user-message-collapsible":a?"true":"false","data-user-message-fade":i?"true":"false",style:i?{WebkitMaskImage:l0,maskImage:l0}:void 0,children:u(B2,{text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,a||t.footer?b("div",{className:F("mt-1.5 flex items-center gap-2",a&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[a?u(ne,{type:"button",size:"xs",variant:"ghost","aria-expanded":n,"data-scroll-anchor-ignore":!0,onClick:()=>o(s=>!s),className:"-ml-1 h-6 rounded-control-2 px-1.5 text-secondary-label text-chat-row hover:bg-muted/40 hover:text-message-foreground",children:n?"Show less":"Show full message"}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),B2=ue(function(t){let n=Ut(In),o=(a,i)=>{let s=/^\s+/.exec(a)?.[0]??"",l=a.slice(s.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return b(ti,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(rr,{text:c,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,d?u("span",{"aria-hidden":"true",children:d}):null]},i)},r=_h(t.text);if(r.some(a=>a.kind==="review-comment"))return u("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?u("div",{className:"wrap-break-word",children:u(rr,{text:a.text.trim(),cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:u(z2,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=i0(t.text,t.terminalContexts),i=a0(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=jf(d.header),f=t.text.indexOf(c,l);if(f===-1){s.length=0;break}f>l&&s.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),s.push(u(s0,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(s.length>0)return l<t.text.length&&s.push(o(t.text.slice(l),`user-message-terminal-context-inline-rest:${l}`)),u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}for(let l of t.terminalContexts)s.push(u(s0,{context:l},`user-terminal-context-inline:${l.header}`)),s.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)s.push(u(rr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1},"user-message-terminal-context-inline-text"));else if(i.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}return t.text.length===0?null:u(rr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function z2({comment:e}){let t=Ut(In),n=e.fenceLanguage??"diff",o=e0(e);return b("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[b("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:zf(e.filePath,t.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle," \xB7 ",e.rangeLabel]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(n0,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(rr,{text:ZS(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(nS,{patch:o}):null]})}function $2({badge:e}){return b(be,{children:[e.providerId?u("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:u(ka,{providerId:e.providerId,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,b("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.providerId?u("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}),e.effortLabel?b("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function $h({badge:e,createdAt:t}){let n=Ut(In);return b("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[u($2,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Xe,{children:[u(Je,{render:u("span",{className:"shrink-0 tabular-nums"}),children:ui(t,n.timestampFormat)}),u(Ye,{children:ta(t,n.timestampFormat)})]})]})}function m0({row:e}){let{t}=Dt(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,e.badge.sourceLabel,n].filter(a=>typeof a=="string"&&a.length>0).join(" \xB7 "),r=e.pending?t("timeline.modelSwitchPending",{model:o}):t("timeline.modelSwitched",{model:o});return b("div",{role:"separator","aria-label":r,"data-pending":e.pending?"true":void 0,className:"flex items-center gap-2 px-1 py-1 text-chat-dense text-muted-foreground/70",children:[u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),b("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.providerId?u(ka,{providerId:e.badge.providerId,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,u("span",{className:"truncate",children:r})]}),u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}var In=Ht(null),h0=Ht(null),H2=u("div",{className:"h-3 sm:h-4"}),U2=u("div",{className:"h-10 sm:h-12"}),K2=Object.freeze([]);function q2({loading:e,onLoadEarlier:t,fade:n}){return u("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:t,disabled:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground disabled:cursor-default pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:e?"Loading earlier turns\u2026":"Load earlier turns"})})})}function V2({onReveal:e,fade:t}){return u("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:"Show earlier turns"})})})}var W2=u("div",{className:"h-3 sm:h-4"}),G2=[],j2=new Set,Q2=200,X2=1e4,Y2=600,J2=()=>{};function ar(e,t){let n=_(e);return t&&(n.current=e),n.current}var Z2=[],v0=ue(function({derive:t,activities:n=Z2,threadKey:o,threadRef:r,environmentId:a,isWorking:i,workingStepLabel:s=null,stall:l=null,retry:d=null,onInterrupt:c=null,onRespondToDecision:f=null,scheduledWakes:p=K2,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=J2,timelineEntries:y,latestTurn:C,latestAssistantMessageId:w=null,runningTurnId:k,resolveModelBadge:S,pendingModelSelection:L,onOpenFileDiff:I,onForkFromUserMessage:T,onImageExpand:E,markdownCwd:A,resolvedTheme:N,timestampFormat:R,workspaceRoot:$,skills:H=G2,anchorMessageId:K,onAnchorReady:O,onRowsChange:oe,contentInsetEndAdjustment:te,liveFollowEnabled:W,awaitingUserDecision:Ke=!1,onIsAtEndChange:ve,onManualNavigation:fe,onDisclosureNavigation:Ne=fe,hideEmptyPlaceholder:Ae=!1,topFadeEnabled:ae=!1,scrollerRef:Ee,loadEarlier:xe=null,revealMessageRequest:re=null,onRevealMessageHandled:Ie,usageByTurnId:st,renderWorkGroup:dt,renderToolCallDetail:lt,loadScrollAnchor:ct,saveScrollAnchor:Mt,disclosure:at,useVisibleThreadCompletion:$e,export:Se,onSavePlanToWorkspace:Be,paneActive:Ze,onTurnNavigatorChange:qt}){let X=ai(),nn=_(X);nn.current=X;let yt=at.usePersistedExpandedTurnIds(o),[dn,Tt]=Sn("timeline-auto-expanded-turns",o,j2),Yt=z(()=>t.resolveExpandedTurnIds(yt??[],dn),[dn,t,yt]),[Jt,Rt]=Sn("timeline-disclosure-reading",o,!1),On=_(o);On.current=o;let An=_(Yt);An.current=Yt;let fn=Ln("timeline-following-end",o,!0);fn.current=W&&K===null;let Fn=Ln("timeline-scroll-restore-pending",o,!1),Nt=pc(o,null),Vt=pc(o,null),Bn=pc(o,null),oo=Ln("timeline-content-inset",o,te),zt=_(null),D=B(U=>{if(U!==null&&(zt.current=U),typeof Ee=="function"){Ee(U);return}Ee.current=U},[Ee]);ye(()=>{VS({timeline:zt.current,previousOverlayHeight:oo.current,overlayHeight:te,followingEnd:X&&W&&!Jt&&K===null}),oo.current=te},[K,te,Jt,W,X]),q(()=>()=>{Vt.current?.stop()},[]);let Y=B(()=>{Vt.current?.stop(),Vt.current=null,Nt.current=null,Rt(!1)},[Nt,Vt,Rt]),de=B(U=>{Ne(),Nt.current=U,Rt(!0),Vt.current?.stop();let ce=zt.current?.node??null;if(!ce)return;let Oe=Array.from(ce.querySelectorAll("[data-timeline-row-id]")).find(ho=>ho.dataset.timelineRowId===U);if(!Oe)return;let rt=Bn.current;Vt.current=TS({viewport:ce,row:Oe,anchor:rt&&Oe.contains(rt)?rt:Oe,scrollToOffset:ho=>{ce.scrollTop=ho}})},[Ne]),ie=Ln("timeline-live-follow-previous",o,W);ye(()=>{W&&!ie.current&&Y(),ie.current=W},[W,Y]);let pe=Ln("timeline-latest-turn-previous",o,C);q(()=>{let U=pe.current;if(pe.current=C,!(!C||U?.turnId===void 0)){if(C.turnId===U.turnId){U.state==="running"&&C.state==="interrupted"&&Tt(ce=>{let Oe=new Set(ce);return Oe.add(C.turnId),Oe});return}Tt(ce=>{if(!ce.has(U.turnId))return ce;let Oe=new Set(ce);return Oe.delete(U.turnId),Oe})}},[C]);let et=Ln("timeline-rows-cache",o,null,3);et.current??=t.createRowsCache();let gt=et.current.deriveGroups,pn=ar(n,X),ht=ar(y,X),Zt=ar(C,X),Wt=ar(k,X),bt=ar(Yt,X),mn=ar(i,X),ge=ar(h,X),vt=ar(S,X),Lt=ar(L,X),ut=ar(s,X),tt=ar(l,X),It=ar(d,X),zn=z(()=>gt({activities:pn,timelineEntries:ht,latestTurn:Zt,runningTurnId:Wt,expandedTurnIds:bt,isWorking:mn,activeTurnStartedAt:ge,resolveModelBadge:vt,pendingModelSelection:Lt}),[gt,pn,ht,Zt,Wt,bt,mn,ge,vt,Lt]),Ge=pB(zn.rows,t),_t=z(()=>ES(Ge,zn.turnGroups),[zn.turnGroups,Ge]),En=_(Ge);En.current=Ge;let gn=B(U=>{let ce=En.current.find(Oe=>Oe.id===U||Oe.kind==="work"&&Oe.groupedEntries.some(rt=>rt.id===U)||Oe.kind==="tool-group"&&Oe.entries.some(rt=>rt.id===U));de(ce?.id??U)},[de]),Lo=_(Ge);Lo.current=Ge;let Mn=Ln("timeline-scroll-snapshot",o,null),ro=B((U,ce=fn.current)=>{U.scrollLength<=0||(Mn.current={threadKey:o,anchor:WS({measurement:U,followingEnd:ce})})},[fn,o,Mn]),J=B(()=>{let U=Mn.current;U&&Mt(U.threadKey,U.anchor)},[Mt,Mn]),qe=B(()=>{if(!X||Fn.current)return;let U=zt.current?.measure();U&&U.scrollLength>0&&(ro(U,fn.current&&t.resolveIsAtEnd(U,te)!==!1),J())},[ro,te,t,fn,X,J,Fn]),xt=DS(o),Qe=_(xt);Qe.current=xt;let{startIndex:cn,hasHiddenOlder:hn}=MS(_t.length,xt.revealedCount),vn=z(()=>_t.slice(cn),[cn,_t]),$t=_(_t);$t.current=_t;let $n=pc(o,null),en=B(()=>{if(!nn.current)return;let U=zt.current?.node;U&&($n.current={scrollHeight:U.scrollHeight,scrollTop:U.scrollTop,until:Date.now()+X2})},[$n]);ye(()=>{if(!X)return;let U=$n.current;if(!U)return;$n.current=null;let ce=zt.current?.node;if(!ce||Date.now()>U.until)return;let Oe=U.scrollTop+(ce.scrollHeight-U.scrollHeight);ce.scrollTop=Oe},[X,cn,Ge.length]);let mo=B(()=>{en(),Qe.current.revealOlder()},[en]),Ya=_(mo);Ya.current=mo;let fa=_(hn);fa.current=hn;let Jn=_(null),Re=Ln("timeline-scroll-restore",o,void 0);if(Re.current===void 0&&Ge.length>0){let U=ct(o);Re.current=U!==null&&Ge.some(ce=>ce.id===U.rowId)?U:null}let pa=Re.current??null,vr=_(()=>{}),[ma,Oi]=Sn("timeline-scroll-restore-settled",o,!1),qo=pa!==null&&!ma,kt=Ln("timeline-last-anchor-save",o,0);q(()=>{let U=pa;if(!X||ma||U===null)return;let ce=null,Oe=requestAnimationFrame(()=>{nn.current&&(fe(),Qe.current.revealAtLeast(uc($t.current,U.rowId,Qe.current.revealedCount)),ce=requestAnimationFrame(()=>{nn.current&&(Oi(!0),vr.current(U.rowId,-U.offsetPx))}))});return()=>{cancelAnimationFrame(Oe),ce!==null&&cancelAnimationFrame(ce)}},[fe,X,pa,ma]);let Zn=Ln("timeline-restore-after-presentation",o,!1),Gt=qo||Zn.current;Fn.current=Gt,ye(()=>{if(X)return()=>{On.current!==o?J():qe(),Zn.current=!0}},[X,o]),ye(()=>{if(!X||!Zn.current)return;let U=null,ce=null,Oe=()=>{zt.current?.scrollToEnd(),Zn.current=!1,Fn.current=!1,fn.current=!0,jo.current=!0,Qo.current={...Qo.current,followEnabled:!0,restoreInProgress:!1},ve(!0)},rt=ct(o),ho=rt!==null&&$t.current.some(Ir=>Ir.rows.some(Ao=>Ao.id===rt.rowId));return rt===null?U=requestAnimationFrame(Oe):ho?(fe(),Qe.current.revealAtLeast(uc($t.current,rt.rowId,Qe.current.revealedCount)),U=requestAnimationFrame(()=>{ce=requestAnimationFrame(()=>{nn.current&&(vr.current(rt.rowId,-rt.offsetPx),Zn.current=!1,Fn.current=!1)})})):Ge.length>0&&(U=requestAnimationFrame(Oe)),()=>{U!==null&&cancelAnimationFrame(U),ce!==null&&cancelAnimationFrame(ce)}},[ct,ve,fe,X,o,Ge.length,_t.length]);let ga=z(()=>X?eB(_t,t):[],[t,X,_t]),tn=z(()=>{if(!X)return[];let U=new Map;for(let ce of _t)for(let Oe of ce.rows){let rt=Oe.kind==="message"?Oe.message.turnId??null:Oe.kind==="turn-summary"?Oe.footer.turnId:null;if(rt!==null){U.set(ce.key,rt);break}}return ga.filter(ce=>ce.userText!==null).map(ce=>({...ce,turnId:U.get(ce.sectionKey)??null}))},[X,ga,_t]),Hn=B(U=>{Y(),fe(),Qe.current.revealAtLeast(uc($t.current,U.anchorRowId,Qe.current.revealedCount));let ce=o;requestAnimationFrame(()=>{On.current===ce&&vr.current(U.anchorRowId,24)})},[fe,Y,o]),on=z(()=>X?{items:tn,totalTurnCount:g,bottomInset:te,usageByTurnId:st,onSelect:Hn,exportMarkdown:Se.markdown,onDownload:Se.download}:null,[te,Se,Hn,X,g,tn,st]);q(()=>{on!==null&&qt(on)},[qt,on]),q(()=>{if(X)return()=>qt(null)},[qt,X]),q(()=>{if(re===null||!X)return;Y(),fe();let U=t.resolveToolGroupRevealRowId(Lo.current,re.rowId);Qe.current.revealAtLeast(uc($t.current,U,Qe.current.revealedCount));let ce=requestAnimationFrame(()=>{On.current===o&&(vr.current(U,24),Ie?.())});return()=>cancelAnimationFrame(ce)},[re,X,fe,Y,Ie,t,o]);let Ja=z(()=>ga.flatMap(U=>U.headerText===null?[]:[{sectionKey:U.sectionKey,text:U.headerText}]),[ga]),he=_(Ja);he.current=Ja;let bn=Ln("timeline-active-header",o,null),Vo=Ja.at(-1)?.text??null,Fi=Vo!==null,xr=_(null),Wo=_(null),[yr,Do]=Sn("timeline-pinned-header-expanded",o,!1),Vr=_(yr);Vr.current=yr;let go=B(()=>{if(!nn.current)return;let U=xr.current,ce=Wo.current;!U||!ce||(U.dataset.truncated=Vr.current||ce.scrollWidth>ce.clientWidth+1?"true":"false")},[]),[Go,Bi]=G(null),zi=z(()=>t.hasSettledAssistantMessage(y,w),[t,y,w]),[Un,Cr]=G(null),ha=B(()=>{en(),xe?.onLoadEarlier()},[en,xe]);Jn.current=xe===null||xe.loading?null:ha;let $i=B((U,ce)=>{if(!nn.current)return;let Oe=zt.current?.node;if(!Oe)return;let rt=Array.from(Oe.querySelectorAll("[data-timeline-turn-section]")),ho=rt.findIndex(Ao=>Ao.querySelector(`[data-timeline-row-id="${CSS.escape(U)}"]`)),Ir=ho<0?rt:rt.slice(0,ho+1);for(let Ao of Ir)Ao.style.contentVisibility="visible";Oe.offsetHeight,zt.current?.scrollToRow(U,{viewOffset:ce}),requestAnimationFrame(()=>{for(let Ao of Ir)Ao.style.removeProperty("content-visibility")})},[]);vr.current=$i;let Oo=z(()=>lS(Ge,K,U=>U.kind==="message"&&U.message.role==="user"?U.message.id:null),[K,Ge]),ko=X&&W&&!Jt&&Oo===void 0&&!Gt,jo=_(ko);jo.current=ko;let Qo=_({followEnabled:ko,restoreInProgress:Gt,loadEarlier:xe});Qo.current={followEnabled:ko,restoreInProgress:Gt,loadEarlier:xe};let va=_(null);q(()=>{if(!Un||!X)return;let U=OS({root:Un,minimumCount:ds,canCompact:()=>{let ce=Qo.current,Oe=$n.current;return ce.followEnabled&&!ce.restoreInProgress&&!ce.loadEarlier?.loading&&!(Oe&&Oe.until>Date.now())&&Qe.current.revealedCount>ds},onCompact:ce=>{xn.current=!0,en(),Qe.current.compactTo(ce)}});return va.current=U,()=>{U.disconnect(),va.current=null}},[en,X,Un]),q(()=>{va.current?.schedule()},[ko,xe?.loading,xt.revealedCount,_t.length]),q(()=>{if(!Un||!X||typeof ResizeObserver>"u")return;let U=()=>{if(!nn.current||!jo.current)return;let rt=Un.scrollHeight-Un.clientHeight;Math.abs(Un.scrollTop-rt)>.5&&(Un.scrollTop=rt)},ce=new ResizeObserver(U);ce.observe(Un);let Oe=Un.firstElementChild;return Oe&&ce.observe(Oe),()=>ce.disconnect()},[X,Un]),$e({viewport:Go,viewActive:Ze&&X,threadKey:o,completedAt:!Gt&&C?.state==="completed"&&zi?C.completedAt:null,messageId:w,bottomInset:te});let[Xo,ze]=Sn("timeline-anchored-end-height",o,0),ft=Ln("timeline-anchored-ready",o,null);ye(()=>{if(!X)return;if(Oo===void 0||K===null){ze(0),ft.current=null;return}let U=zt.current?.node,ce=Ge[Oo.anchorIndex],Oe=zt.current?.measure();if(!U||!ce||!Oe||Oe.scrollLength<=0)return;let rt=Oe.topOf(ce.id);if(rt===null)return;let ho=Oe.contentLength-Xo-rt,Ir=Math.max(0,Oe.scrollLength-te-Oo.anchorOffset),Ao=Math.max(0,Math.round(Ir-ho));if(Math.abs(Ao-Xo)>1){ze(Ao);return}ft.current!==K&&(ft.current=K,O(K,{rowId:ce.id,lastRowId:Ge.at(-1)?.id??null}))},[K,Oo,Xo,te,O,X,Ge]);let an=Ge.at(-1)?.id??null;q(()=>{oe?.(an)},[an,oe,o]);let xn=Ln("timeline-top-reveal-armed",o,!0),br=B(U=>{if(U>Y2){xn.current=!0;return}if(xn.current){if(xn.current=!1,fa.current){Ya.current();return}Jn.current?.()}},[xn]),Wr=B(()=>{if(!nn.current||On.current!==o)return;let U=zt.current?.measure();if(!U||Fn.current)return;ro(U);let ce=t.resolveIsAtEnd({contentLength:U.contentLength,scroll:U.scroll,scrollLength:U.scrollLength},te);ce!==void 0&&ve(ce),U.contentLength-U.scrollLength-U.scroll>2&&br(U.scroll);let Oe=Date.now();Oe-kt.current>=Q2&&(kt.current=Oe,J())},[ro,te,t,br,ve,J,o,Fn]),Yo=_(null),Js=B(()=>{nn.current&&Yo.current===null&&(Yo.current=requestAnimationFrame(()=>{Yo.current=null,go()}))},[go]);q(()=>()=>{Yo.current!==null&&(cancelAnimationFrame(Yo.current),Yo.current=null)},[o]);let yn=B(U=>{if(U===null||U===bn.current)return;bn.current=U;let ce=he.current.find(Oe=>Oe.sectionKey===U);ce&&Wo.current&&(Wo.current.textContent=ce.text),Vr.current&&Do(!1),Js()},[bn,Js,Do]),xd=BS({root:Un,topInsetPx:Bh,onActiveSectionChange:yn,active:X});q(()=>{if(!X){J();return}let U=requestAnimationFrame(()=>{if(!nn.current)return;let ce=zt.current?.node;ce&&jo.current&&(ce.scrollTop=ce.scrollHeight-ce.clientHeight),xd.refresh()});return()=>cancelAnimationFrame(U)},[J,xd,X]);let Zs=B(()=>{Do(U=>!U)},[Do]);ye(()=>{if(!X)return;let U=bn.current,ce=U===null?void 0:he.current.find(Oe=>Oe.sectionKey===U);ce&&Wo.current&&(Wo.current.textContent=ce.text),Js()},[X,Js,yr]);let qu=z(()=>{let U=hn?u(V2,{onReveal:mo,fade:ae}):xe!==null?u(q2,{loading:xe.loading,onLoadEarlier:ha,fade:ae}):ae?U2:H2;return Fi?b(be,{children:[u("div",{style:{height:Bh}}),U]}):U},[ha,hn,Fi,xe,mo,ae]);q(()=>{if(!X)return;let U=requestAnimationFrame(Wr);return()=>cancelAnimationFrame(U)},[Wr,X,Gt,Ge.length]);let Bg=z(()=>({timestampFormat:R,threadKey:o,threadRef:r,markdownCwd:A,resolvedTheme:N,workspaceRoot:$,skills:H,activeThreadEnvironmentId:a,onForkFromUserMessage:T,onImageExpand:E,onOpenFileDiff:I,onProcessDisclosureChange:gn,agentPanelModel:v,onOpenAgents:x,onInterrupt:c,onRespondToDecision:f,scheduledWakes:p,onCancelScheduledWake:m,derive:t,renderWorkGroup:dt,renderToolCallDetail:lt,onSavePlanToWorkspace:Be}),[R,o,r,A,N,$,H,a,T,E,I,gn,v,x,c,f,p,m,t,dt,lt,Be]),xa=z(()=>({isWorking:mn,latestTurnId:Zt?.turnId??null,workingStepLabel:ut,stall:tt,retry:It}),[mn,Zt?.turnId,It,tt,ut]),Po=B(U=>u(nB,{row:U}),[]);return Ge.length===0&&!i?Ae?null:u("div",{className:"flex h-full items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:"Send a message to start the conversation."})}):u(In,{value:Bg,children:u(h0,{value:xa,children:b("div",{ref:Bi,onClickCapture:U=>{Bn.current=U.target instanceof Element?U.target.closest("button"):null},onWheelCapture:Y,onTouchMoveCapture:Y,onPointerDownCapture:U=>{U.target===zt.current?.node&&Y()},onKeyDownCapture:U=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(U.key)&&Y()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":Ke?"true":"false","data-disclosure-reading":Jt?"true":void 0,"data-timeline-follow-end":ko?"true":"false","data-timeline-anchor-row":Oo===void 0?void 0:Ge[Oo.anchorIndex]?.id??void 0,"data-timeline-end-inset":te,children:[u(PS,{inputKey:o,onBeforeInputChange:qe,handleRef:D,onAttach:Cr,onScroll:Wr,className:F("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",ae&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:te},children:[qu,vn.map(U=>u(AS,{sectionKey:U.key,rowKeyPrefix:o,rows:U.rows,renderRow:Po,sectionRef:xd.observeSection(U.key)},`${o}:${U.key}`)),W2,Oo?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:Xo}}):null]})}),Vo!==null?u(f0,{ref:xr,textRef:Wo,initialText:Vo,expanded:yr,onToggleExpanded:Zs}):null]})})})});function eB(e,t){return e.map(n=>{let o=n.rows.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of n.rows)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:n.key,sectionKey:n.key,anchorRowId:o?.id??n.rows[0]?.id??n.key,userText:r===null?null:g0(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:g0(a),headerText:r===null?null:d0(r.text,t)}})}var Hh=240,tB=/\s/u;function g0(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Hh-1;)n-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),n-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(tB.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Hh)||(t.push(a),n+=a.length,n>Hh))return r()}return t.length>0?t.join(""):null}var nB=ue(function({row:t}){let n=Ut(In);return u("div",{className:F("relative",t.kind==="message"&&t.message.role==="user"?"pb-6":t.kind==="message"&&t.message.role==="assistant"?t.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":t.id,"data-timeline-row-kind":t.kind,"data-message-id":t.kind==="message"?t.message.id:void 0,"data-message-role":t.kind==="message"?t.message.role:void 0,children:b(qf,{resetKey:t.id,fallback:GS,children:[t.kind==="turn-summary"?u(fS,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(wS,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(oB,{row:t}):null,t.kind==="model-switch"?u(m0,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u($h,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(Oh,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(p0,{row:t}):null,t.kind==="proposed-plan"?u(aB,{row:t}):null,t.kind==="turn-plan"?u(iB,{row:t}):null,t.kind==="working"?u(sB,{row:t}):null]})})});function oB({row:e}){let t=Ut(In),n=ai(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(be,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(rB,{entry:r},r.id))})}function rB({entry:e}){let[t,n]=G(!1),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":t,className:F("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive":"text-muted-foreground"),onClick:()=>n(r=>!r),disabled:o===void 0,children:[u("span",{"aria-hidden":!0,className:F("block size-2 shrink-0 rounded-full",e.tone==="error"?"bg-destructive":e.tone==="thinking"||e.tone==="info"?"bg-muted-foreground/60":"border border-muted-foreground/60")}),u("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:e.label}),o!==void 0?u(ln,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!t&&"-rotate-90")}):null]}),t&&o!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:o}):null]})}function aB({row:e}){let t=Ut(In);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(qS,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var iB=ue(function({row:t}){let[n,o]=G(!1),{steps:r}=t.turnPlan.plan,a=r.filter(d=>d.status==="completed").length,i=a===r.length,s=r.find(d=>d.status==="inProgress")?.step??r.find(d=>d.status==="pending")?.step??r.at(-1)?.step??"Plan";return b("div",{className:"min-w-0 px-1 py-0.5",children:[b("button",{type:"button",className:"relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-[12px] leading-5 transition-colors duration-(--control-duration) hover:bg-accent/20 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11","aria-expanded":n,onClick:()=>o(d=>!d),children:[u(n?ln:zo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),r.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:r.map(d=>u("span",{className:F("h-[3px] w-2.5 rounded-full",d.status==="completed"?"bg-success":d.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},d.step))}):null,u("span",{className:F("min-w-0 truncate",i?"text-muted-foreground/65":"font-medium text-foreground/85"),children:s}),r.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[a,"/",r.length]}):null]}),n?u("div",{className:"mt-0.5 space-y-px pl-6",children:r.map(d=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:F("w-3 shrink-0 text-center font-mono text-chat-meta",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step})]},d.step))}):null]})});function sB({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Ut(h0),{t:r}=Dt();return b("div",{className:"border-b border-border/60 pb-2 pt-1",children:[u("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 px-1 text-chat text-muted-foreground tabular-nums","data-testid":"working-row",children:b("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?mc(r("activity.workingForLive"),u(fB,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(lB,{retry:o}):n&&!e.compacting?u(cB,{stall:n}):null]})}function lB({retry:e}){let{t}=Dt(),n=Ut(In);return b(ac,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Mf,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(ic,{children:u(ne,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var dB={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function cB({stall:e}){let{t}=Dt(),{onInterrupt:n}=Ut(In),o=t(dB[e.reason]);return b("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[u("span",{className:"tabular-nums",children:mc(t("stall.noOutputForLive"),u(uB,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ne,{className:"h-5 px-1.5 text-chat-row",onClick:n,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t("stall.interrupt")}):null]})}function x0(e,t){let n=ai();q(()=>{let o=()=>{t.current&&(t.current.textContent=Uh(e))};if(o(),!n)return;let r=setInterval(o,1e3);return document.addEventListener("visibilitychange",o),()=>{clearInterval(r),document.removeEventListener("visibilitychange",o)}},[n,e,t])}function uB({since:e}){let t=_(null);return x0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Uh(e)})}function fB({createdAt:e}){let t=_(null);return x0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Uh(e)})}function pB(e,t){let n=_({byId:new Map,result:[]}),o=_(t);return o.current=t,z(()=>{let r=new Map,a=e.map(i=>{let s=n.current.byId.get(i.id),l=s&&mB(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function mB(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":{let n=t;return e.turnId===n.turnId&&e.createdAt===n.createdAt&&e.badge===n.badge}case"turn-summary":{let n=t;return e.createdAt===n.createdAt&&e.copyText===n.copyText&&e.footer===n.footer}case"tool-group":{let n=t;return e.createdAt===n.createdAt&&e.groupId===n.groupId&&e.entries===n.entries}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&e.modelBadge===n.modelBadge}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&e.badge===n.badge}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let n=t;return e.createdAt===n.createdAt&&e.turnPlan.plan===n.turnPlan.plan}case"work":{let n=t;return e.isExpandedToolGroupEntry===n.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===n.isLastExpandedToolGroupEntry&&e.groupedEntries===n.groupedEntries}case"message":{let n=t;return e.message===n.message&&e.presentation===n.presentation&&e.textTone===n.textTone&&e.durationStart===n.durationStart&&e.showAssistantMeta===n.showAssistantMeta&&e.showAssistantCopyButton===n.showAssistantCopyButton&&e.copyInFooter===n.copyInFooter&&e.assistantCopyStreaming===n.assistantCopyStreaming&&e.modelBadge===n.modelBadge}}}function gB(e,t){let n=Date.parse(e),o=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(o))return null;let r=Math.max(0,Math.floor((o-n)/1e3));if(r<60)return`${r}s`;let a=Math.floor(r/3600),i=Math.floor(r%3600/60),s=r%60;return a>0?i>0?`${a}h ${i}m`:`${a}h`:s>0?`${i}m ${s}s`:`${i}m`}function Uh(e){return gB(e,new Date().toISOString())??"0s"}me();var y0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var C0=50,hB=32;function vB(e){let t=[];for(let n=0;n<e.length;n+=C0)t.push(e.slice(n,n+C0));return t}function xB({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
3682
+ `):null,contexts:o}}function a0(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),n=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${n}`}function Dh(e){let t=uc(e),n=w2(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var T2=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function i0(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Wf(o))}return t.join(" ")}function Wf(e){let t=e.trim(),n=T2.exec(t);if(!n)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let o=Number.parseInt(n[2]??"",10),r=Number.parseInt(n[3]??n[2]??"",10);return!Number.isFinite(o)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:a0({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function s0(e,t){let n=0;for(let o of t){let r=Wf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function Oh({row:e}){let t=Ut(Tn).derive;if(Rh(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(be,{children:[u(P2,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Oh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(E2,{row:e})}return u(L2,{row:e,text:e.message.text})}function Fh({images:e}){let t=Ut(Tn),{t:n}=Dt();return e.length===0?null:u("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>u("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Mh(e,o.id);r&&t.onImageExpand(r)},children:u("img",{src:o.previewUrl,alt:o.name,className:"block h-auto max-h-[220px] w-full object-cover"})}):u("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function L2({row:e,text:t}){let{t:n}=Dt(),o=Ut(Tn),r=e.message.attachments??[],a=Dh(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Nh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=uc(l),c=[...a.elementContexts,...d.contexts],f=r.filter(v=>v.name.startsWith("preview-annotation-")),p=r.filter(v=>!v.name.startsWith("preview-annotation-")),m=p.filter(v=>di(v)==="image"),h=p.filter(v=>di(v)!=="image"),g=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(k2,{author:g}),b("div",{className:"min-w-0 flex-1 space-y-2",children:[b("div",{className:"flex min-h-7 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-chat-dense",children:[u("span",{className:"min-w-0 truncate font-medium text-foreground",children:g?.displayName??n("message.user")}),b(Qe,{children:[u(Ye,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:li(e.message.createdAt,o.timestampFormat)}),u(Xe,{children:Jr(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(M2,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(hl,{text:a.copyText,variant:"ghost"})]})]}),b("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(Fh,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(zh,{attachment:v},v.id))}),s.map((v,x)=>u(_2,{annotation:v,image:f[x]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(N2,{context:v},`${v.header}:${v.body}`))}):null,u(z2,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function k2({author:e}){let t=e;return t!==null?u(RI,{userId:t.userId,displayName:t.displayName,size:28,className:"mt-0.5"}):u("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-message text-secondary-label",children:u(Yr,{className:"size-4"})})}function Gf({children:e}){return u("div",{className:"flex justify-center py-1",children:u("div",{className:"max-w-[80%] rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:e})})}function P2({parsed:e}){let{t}=Dt();return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var A2={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.stopped":"childThread.notification.stopped","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved"};function E2({row:e}){let{t}=Dt(),n=Ut(Tn).derive,o=e.message.attachments??[],r=o.filter(l=>di(l)==="image"),a=o.filter(l=>di(l)!=="image"),i=l=>{let d=YS(l);if(d)return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:d.title}),d.body.length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:d.body}):null]});let c=n.parseThreadHandoverText(l);if(c)return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),u("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:c.includedTurns})}),u("p",{className:"mt-1 whitespace-pre-wrap",children:c.body})]});let f=n.parseSystemNotificationText(l);return f?b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t(A2[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=XS(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(be,{children:[s.map((l,d)=>u(Ja,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(Fh,{images:r}),a.map(l=>u(zh,{attachment:l},l.id))]}):null]})}function c0(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Rh(e??""))return null;let r=Dh(n??e??"").visibleText;for(;;){let s=Nh(r);if(!s.annotation)break;r=s.promptText}let a=uc(r).promptText,i=_h(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var u0=34,f0=8,Bh=u0+f0,p0=ue(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=Dt(),s=i(r?"timeline.pinnedTurnHeaderShowLess":"timeline.pinnedTurnHeaderShowMore");return u("div",{ref:t,className:"group pointer-events-none absolute inset-x-0 top-0 z-10 px-3 sm:px-5",style:{paddingTop:f0},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:F("transcript-col-wide pointer-events-auto flex gap-2 rounded-sm border border-border/70 bg-background pe-1 ps-3 shadow-md shadow-black/10",r?"items-start py-1.5":"items-center"),...r?{}:{style:{height:u0}},children:[u("span",{ref:n,className:F("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Qe,{children:[u(Ye,{render:u(te,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Ed,{}):u(pn,{})}),u(Xe,{side:"bottom",children:s})]})]})})});function M2({messageId:e,onFork:t}){let{t:n}=Dt(),o=n("fork.action");return b(Qe,{children:[u(Ye,{render:u(te,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Od,{className:"size-3"})}),u(Xe,{side:"top",children:o})]})}function m0({row:e}){let t=Ut(Tn),{t:n}=Dt(),[o,r]=xl(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(zf,{state:"idle",children:b("button",{type:"button",className:F(Bf,"chat-process-text cursor-pointer text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":n("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[u(ac,{status:null}),u(rc,{children:u(Xd,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(pn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>di(c)==="image"),l=i.filter(c=>di(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":"(empty response)");return u(be,{children:b("div",{className:"relative min-w-0 px-1 py-0.5","data-assistant-text-tone":e.textTone==="process"&&e.presentation!=="compact"?"process":"primary",children:[e.presentation==="compact"?b("div",{className:"mb-1 flex items-center gap-2",children:[u("button",{type:"button",className:"chat-process-meta mb-1 rounded-sm text-secondary-label","aria-expanded":!0,onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!1)},children:n("timeline.collapseMessage")}),e.copyInFooter?null:u(hl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u($h,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(nr,{text:d,className:e.textTone==="process"&&e.presentation!=="compact"?"chat-commentary":"chat-readable-body",cwd:t.markdownCwd,threadRef:t.threadRef??void 0,isStreaming:!!e.message.streaming,lineBreaks:t.derive.shouldPreserveAssistantLineBreaks(d),skills:t.skills}),u(Fh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(zh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?b("div",{className:"mt-1.5 flex items-center gap-2 text-chat-row tabular-nums opacity-0 transition-opacity duration-(--control-duration) focus-within:opacity-100 group-hover/assistant:opacity-100",children:[u(R2,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Qe,{children:[u(Ye,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:li(e.message.updatedAt,t.timestampFormat)}),u(Xe,{children:Jr(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function R2({row:e}){let n=Ut(Tn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(hl,{text:n.text??"",variant:"ghost"}):null}var l0=ue(function(t){let n=t.context.body.length>0?`${t.context.header}
3683
+ ${t.context.body}`:t.context.header;return u(r0,{label:t.context.header,tooltipText:n})}),N2=ue(function(t){let n=t.context.body?`${t.context.header}
3684
+ ${t.context.body}`:t.context.header;return b(Qe,{children:[b(Ye,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(Qr,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function zh(e){let{t}=Dt(),n=di(e.attachment),o=JS(n),r=t("attachments.open",{name:e.attachment.name}),a=b(be,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0 flex-1",children:[u("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),u("span",{className:"block text-secondary-label text-chat-meta",children:QS(e.attachment.sizeBytes)})]})]});return e.attachment.previewUrl?u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 hover:bg-background/90",children:a}):u("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:a})}function _2(e){let t=Ut(Tn),{t:n}=Dt();return b("div",{className:"mb-2 flex max-w-full items-center overflow-hidden rounded-lg border border-border/70 bg-background/70",children:[e.image?.previewUrl?u("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":n("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let o=Mh([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:"Annotated preview crop",className:"size-full object-cover"})}):null,b("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?u("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,b("div",{className:F("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?u("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?b("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(es,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var D2=8,O2=600,F2=1.75,d0=`linear-gradient(to bottom, black calc(100% - ${F2}rem), transparent)`;function B2(e){return e.trim().length===0?!1:e.length>O2||e.split(`
3685
+ `).length>D2}var z2=ue(function(t){let[n,o]=G(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&B2(t.text),i=a&&!n;return b("div",{children:[r?u("div",{className:F("relative",i&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":i?"true":"false","data-user-message-collapsible":a?"true":"false","data-user-message-fade":i?"true":"false",style:i?{WebkitMaskImage:d0,maskImage:d0}:void 0,children:u($2,{text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,a||t.footer?b("div",{className:F("mt-1.5 flex items-center gap-2",a&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[a?u(te,{type:"button",size:"xs",variant:"ghost","aria-expanded":n,"data-scroll-anchor-ignore":!0,onClick:()=>o(s=>!s),className:"-ml-1 h-6 rounded-control-2 px-1.5 text-secondary-label text-chat-row hover:bg-muted/40 hover:text-message-foreground",children:n?"Show less":"Show full message"}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),$2=ue(function(t){let n=Ut(Tn),o=(a,i)=>{let s=/^\s+/.exec(a)?.[0]??"",l=a.slice(s.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return b(Ja,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(nr,{text:c,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,d?u("span",{"aria-hidden":"true",children:d}):null]},i)},r=_h(t.text);if(r.some(a=>a.kind==="review-comment"))return u("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?u("div",{className:"wrap-break-word",children:u(nr,{text:a.text.trim(),cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:u(H2,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=s0(t.text,t.terminalContexts),i=i0(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Wf(d.header),f=t.text.indexOf(c,l);if(f===-1){s.length=0;break}f>l&&s.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),s.push(u(l0,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(s.length>0)return l<t.text.length&&s.push(o(t.text.slice(l),`user-message-terminal-context-inline-rest:${l}`)),u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}for(let l of t.terminalContexts)s.push(u(l0,{context:l},`user-terminal-context-inline:${l.header}`)),s.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)s.push(u(nr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1},"user-message-terminal-context-inline-text"));else if(i.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}return t.text.length===0?null:u(nr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function H2({comment:e}){let t=Ut(Tn),n=e.fenceLanguage??"diff",o=t0(e);return b("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[b("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:Ff(e.filePath,t.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle," \xB7 ",e.rangeLabel]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(o0,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(nr,{text:e0(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(oS,{patch:o}):null]})}function U2({badge:e}){return b(be,{children:[e.providerId?u("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:u(Ia,{providerId:e.providerId,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,b("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.providerId?u("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}),e.effortLabel?b("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function $h({badge:e,createdAt:t}){let n=Ut(Tn);return b("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[u(U2,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Qe,{children:[u(Ye,{render:u("span",{className:"shrink-0 tabular-nums"}),children:li(t,n.timestampFormat)}),u(Xe,{children:Jr(t,n.timestampFormat)})]})]})}function g0({row:e}){let{t}=Dt(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,e.badge.sourceLabel,n].filter(a=>typeof a=="string"&&a.length>0).join(" \xB7 "),r=e.pending?t("timeline.modelSwitchPending",{model:o}):t("timeline.modelSwitched",{model:o});return b("div",{role:"separator","aria-label":r,"data-pending":e.pending?"true":void 0,className:"flex items-center gap-2 px-1 py-1 text-chat-dense text-muted-foreground/70",children:[u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),b("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.providerId?u(Ia,{providerId:e.badge.providerId,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,u("span",{className:"truncate",children:r})]}),u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}var Tn=Ht(null),v0=Ht(null),K2=u("div",{className:"h-3 sm:h-4"}),q2=u("div",{className:"h-10 sm:h-12"}),V2=Object.freeze([]);function W2({loading:e,onLoadEarlier:t,fade:n}){return u("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:t,disabled:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground disabled:cursor-default pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:e?"Loading earlier turns\u2026":"Load earlier turns"})})})}function G2({onReveal:e,fade:t}){return u("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:"Show earlier turns"})})})}var j2=u("div",{className:"h-3 sm:h-4"}),Q2=[],X2=new Set,Y2=200,J2=1e4,Z2=600,eB=()=>{};function or(e,t){let n=_(e);return t&&(n.current=e),n.current}var tB=[],x0=ue(function({derive:t,activities:n=tB,threadKey:o,threadRef:r,environmentId:a,isWorking:i,workingStepLabel:s=null,stall:l=null,retry:d=null,onInterrupt:c=null,onRespondToDecision:f=null,scheduledWakes:p=V2,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=eB,timelineEntries:y,latestTurn:C,latestAssistantMessageId:w=null,runningTurnId:k,resolveModelBadge:S,pendingModelSelection:L,onOpenFileDiff:I,onForkFromUserMessage:T,onImageExpand:E,markdownCwd:A,resolvedTheme:N,timestampFormat:R,workspaceRoot:$,skills:H=Q2,anchorMessageId:K,onAnchorReady:O,onRowsChange:oe,contentInsetEndAdjustment:ee,liveFollowEnabled:W,awaitingUserDecision:qe=!1,onIsAtEndChange:ve,onManualNavigation:fe,onDisclosureNavigation:Ne=fe,hideEmptyPlaceholder:Ae=!1,topFadeEnabled:ae=!1,scrollerRef:Ee,loadEarlier:xe=null,revealMessageRequest:re=null,onRevealMessageHandled:Ie,usageByTurnId:st,renderWorkGroup:dt,renderToolCallDetail:lt,loadScrollAnchor:ct,saveScrollAnchor:Et,disclosure:ot,useVisibleThreadCompletion:He,export:Se,onSavePlanToWorkspace:ze,paneActive:Je,onTurnNavigatorChange:qt}){let X=ni(),nn=_(X);nn.current=X;let xt=ot.usePersistedExpandedTurnIds(o),[mn,Tt]=Ln("timeline-auto-expanded-turns",o,X2),Yt=z(()=>t.resolveExpandedTurnIds(xt??[],mn),[mn,t,xt]),[Jt,Mt]=Ln("timeline-disclosure-reading",o,!1),zn=_(o);zn.current=o;let kn=_(Yt);kn.current=Yt;let vn=En("timeline-following-end",o,!0);vn.current=W&&K===null;let $n=En("timeline-scroll-restore-pending",o,!1),Vt=dc(o,null),Zt=dc(o,null),Sn=dc(o,null),ho=En("timeline-content-inset",o,ee),zt=_(null),D=B(U=>{if(U!==null&&(zt.current=U),typeof Ee=="function"){Ee(U);return}Ee.current=U},[Ee]);ye(()=>{WS({timeline:zt.current,previousOverlayHeight:ho.current,overlayHeight:ee,followingEnd:X&&W&&!Jt&&K===null}),ho.current=ee},[K,ee,Jt,W,X]),q(()=>()=>{Zt.current?.stop()},[]);let Y=B(()=>{Zt.current?.stop(),Zt.current=null,Vt.current=null,Mt(!1)},[Vt,Zt,Mt]),ce=B(U=>{Ne(),Vt.current=U,Mt(!0),Zt.current?.stop();let se=zt.current?.node??null;if(!se)return;let Re=Array.from(se.querySelectorAll("[data-timeline-row-id]")).find(gn=>gn.dataset.timelineRowId===U);if(!Re)return;let yt=Sn.current;Zt.current=LS({viewport:se,row:Re,anchor:yt&&Re.contains(yt)?yt:Re,scrollToOffset:gn=>{se.scrollTop=gn}})},[Ne]),ie=En("timeline-live-follow-previous",o,W);ye(()=>{W&&!ie.current&&Y(),ie.current=W},[W,Y]);let pe=En("timeline-latest-turn-previous",o,C);q(()=>{let U=pe.current;if(pe.current=C,!(!C||U?.turnId===void 0)){if(C.turnId===U.turnId){U.state==="running"&&C.state==="interrupted"&&Tt(se=>{let Re=new Set(se);return Re.add(C.turnId),Re});return}Tt(se=>{if(!se.has(U.turnId))return se;let Re=new Set(se);return Re.delete(U.turnId),Re})}},[C]);let Ze=En("timeline-rows-cache",o,null,3);Ze.current??=t.createRowsCache();let pt=Ze.current.deriveGroups,xn=or(n,X),ht=or(y,X),en=or(C,X),tn=or(k,X),bt=or(Yt,X),yn=or(i,X),sn=or(h,X),ge=or(S,X),Rt=or(L,X),rt=or(s,X),Lt=or(l,X),et=or(d,X),Nt=z(()=>pt({activities:xn,timelineEntries:ht,latestTurn:en,runningTurnId:tn,expandedTurnIds:bt,isWorking:yn,activeTurnStartedAt:sn,resolveModelBadge:ge,pendingModelSelection:Rt}),[pt,xn,ht,en,tn,bt,yn,sn,ge,Rt]),ut=gB(Nt.rows,t),ft=z(()=>MS(ut,Nt.turnGroups),[Nt.turnGroups,ut]),eo=_(ut);eo.current=ut;let ln=B(U=>{let se=eo.current.find(Re=>Re.id===U||Re.kind==="work"&&Re.groupedEntries.some(yt=>yt.id===U)||Re.kind==="tool-group"&&Re.entries.some(yt=>yt.id===U));ce(se?.id??U)},[ce]),Nn=_(ut);Nn.current=ut;let Hn=En("timeline-scroll-snapshot",o,null),Un=B((U,se=vn.current)=>{U.scrollLength<=0||(Hn.current={threadKey:o,anchor:GS({measurement:U,followingEnd:se})})},[vn,o,Hn]),ne=B(()=>{let U=Hn.current;U&&Et(U.threadKey,U.anchor)},[Et,Hn]),Fe=B(()=>{if(!X||$n.current)return;let U=zt.current?.measure();U&&U.scrollLength>0&&(Un(U,vn.current&&t.resolveIsAtEnd(U,ee)!==!1),ne())},[Un,ee,t,vn,X,ne,$n]),at=OS(o),je=_(at);je.current=at;let{startIndex:wn,hasHiddenOlder:dn}=RS(ft.length,at.revealedCount),Cn=z(()=>ft.slice(wn),[wn,ft]),$t=_(ft);$t.current=ft;let Kn=dc(o,null),Wt=B(()=>{if(!nn.current)return;let U=zt.current?.node;U&&(Kn.current={scrollHeight:U.scrollHeight,scrollTop:U.scrollTop,until:Date.now()+J2})},[Kn]);ye(()=>{if(!X)return;let U=Kn.current;if(!U)return;Kn.current=null;let se=zt.current?.node;if(!se||Date.now()>U.until)return;let Re=U.scrollTop+(se.scrollHeight-U.scrollHeight);se.scrollTop=Re},[X,wn,ut.length]);let vo=B(()=>{Wt(),je.current.revealOlder()},[Wt]),Wa=_(vo);Wa.current=vo;let Ga=_(dn);Ga.current=dn;let Ni=_(null),he=En("timeline-scroll-restore",o,void 0);if(he.current===void 0&&ut.length>0){let U=ct(o);he.current=U!==null&&ut.some(se=>se.id===U.rowId)?U:null}let da=he.current??null,Go=_(()=>{}),[ja,gd]=Ln("timeline-scroll-restore-settled",o,!1),ca=da!==null&&!ja,qn=En("timeline-last-anchor-save",o,0);q(()=>{let U=da;if(!X||ja||U===null)return;let se=null,Re=requestAnimationFrame(()=>{nn.current&&(fe(),je.current.revealAtLeast(sc($t.current,U.rowId,je.current.revealedCount)),se=requestAnimationFrame(()=>{nn.current&&(gd(!0),Go.current(U.rowId,-U.offsetPx))}))});return()=>{cancelAnimationFrame(Re),se!==null&&cancelAnimationFrame(se)}},[fe,X,da,ja]);let _t=En("timeline-restore-after-presentation",o,!1),ro=ca||_t.current;$n.current=ro,ye(()=>{if(X)return()=>{zn.current!==o?ne():Fe(),_t.current=!0}},[X,o]),ye(()=>{if(!X||!_t.current)return;let U=null,se=null,Re=()=>{zt.current?.scrollToEnd(),_t.current=!1,$n.current=!1,vn.current=!0,Qo.current=!0,io.current={...io.current,followEnabled:!0,restoreInProgress:!1},ve(!0)},yt=ct(o),gn=yt!==null&&$t.current.some(xr=>xr.rows.some(Co=>Co.id===yt.rowId));return yt===null?U=requestAnimationFrame(Re):gn?(fe(),je.current.revealAtLeast(sc($t.current,yt.rowId,je.current.revealedCount)),U=requestAnimationFrame(()=>{se=requestAnimationFrame(()=>{nn.current&&(Go.current(yt.rowId,-yt.offsetPx),_t.current=!1,$n.current=!1)})})):ut.length>0&&(U=requestAnimationFrame(Re)),()=>{U!==null&&cancelAnimationFrame(U),se!==null&&cancelAnimationFrame(se)}},[ct,ve,fe,X,o,ut.length,ft.length]);let on=z(()=>X?nB(ft,t):[],[t,X,ft]),_i=z(()=>{if(!X)return[];let U=new Map;for(let se of ft)for(let Re of se.rows){let yt=Re.kind==="message"?Re.message.turnId??null:Re.kind==="turn-summary"?Re.footer.turnId:null;if(yt!==null){U.set(se.key,yt);break}}return on.filter(se=>se.userText!==null).map(se=>({...se,turnId:U.get(se.sectionKey)??null}))},[X,on,ft]),It=B(U=>{Y(),fe(),je.current.revealAtLeast(sc($t.current,U.anchorRowId,je.current.revealedCount));let se=o;requestAnimationFrame(()=>{zn.current===se&&Go.current(U.anchorRowId,24)})},[fe,Y,o]),xo=z(()=>X?{items:_i,totalTurnCount:g,bottomInset:ee,usageByTurnId:st,onSelect:It,exportMarkdown:Se.markdown,onDownload:Se.download}:null,[ee,Se,It,X,g,_i,st]);q(()=>{xo!==null&&qt(xo)},[qt,xo]),q(()=>{if(X)return()=>qt(null)},[qt,X]),q(()=>{if(re===null||!X)return;Y(),fe();let U=t.resolveToolGroupRevealRowId(Nn.current,re.rowId);je.current.revealAtLeast(sc($t.current,U,je.current.revealedCount));let se=requestAnimationFrame(()=>{zn.current===o&&(Go.current(U,24),Ie?.())});return()=>cancelAnimationFrame(se)},[re,X,fe,Y,Ie,t,o]);let bn=z(()=>on.flatMap(U=>U.headerText===null?[]:[{sectionKey:U.sectionKey,text:U.headerText}]),[on]),_e=_(bn);_e.current=bn;let Gt=En("timeline-active-header",o,null),Eo=bn.at(-1)?.text??null,gr=Eo!==null,Di=_(null),yo=_(null),[Hr,jo]=Ln("timeline-pinned-header-expanded",o,!1),hr=_(Hr);hr.current=Hr;let ao=B(()=>{if(!nn.current)return;let U=Di.current,se=yo.current;!U||!se||(U.dataset.truncated=hr.current||se.scrollWidth>se.clientWidth+1?"true":"false")},[]),[Ur,ua]=G(null),Oi=z(()=>t.hasSettledAssistantMessage(y,w),[t,y,w]),[_n,Fi]=G(null),Oo=B(()=>{Wt(),xe?.onLoadEarlier()},[Wt,xe]);Ni.current=xe===null||xe.loading?null:Oo;let Bi=B((U,se)=>{if(!nn.current)return;let Re=zt.current?.node;if(!Re)return;let yt=Array.from(Re.querySelectorAll("[data-timeline-turn-section]")),gn=yt.findIndex(Co=>Co.querySelector(`[data-timeline-row-id="${CSS.escape(U)}"]`)),xr=gn<0?yt:yt.slice(0,gn+1);for(let Co of xr)Co.style.contentVisibility="visible";Re.offsetHeight,zt.current?.scrollToRow(U,{viewOffset:se}),requestAnimationFrame(()=>{for(let Co of xr)Co.style.removeProperty("content-visibility")})},[]);Go.current=Bi;let Fo=z(()=>dS(ut,K,U=>U.kind==="message"&&U.message.role==="user"?U.message.id:null),[K,ut]),vr=X&&W&&!Jt&&Fo===void 0&&!ro,Qo=_(vr);Qo.current=vr;let io=_({followEnabled:vr,restoreInProgress:ro,loadEarlier:xe});io.current={followEnabled:vr,restoreInProgress:ro,loadEarlier:xe};let zi=_(null);q(()=>{if(!_n||!X)return;let U=FS({root:_n,minimumCount:ls,canCompact:()=>{let se=io.current,Re=Kn.current;return se.followEnabled&&!se.restoreInProgress&&!se.loadEarlier?.loading&&!(Re&&Re.until>Date.now())&&je.current.revealedCount>ls},onCompact:se=>{rn.current=!0,Wt(),je.current.compactTo(se)}});return zi.current=U,()=>{U.disconnect(),zi.current=null}},[Wt,X,_n]),q(()=>{zi.current?.schedule()},[vr,xe?.loading,at.revealedCount,ft.length]),q(()=>{if(!_n||!X||typeof ResizeObserver>"u")return;let U=()=>{if(!nn.current||!Qo.current)return;let yt=_n.scrollHeight-_n.clientHeight;Math.abs(_n.scrollTop-yt)>.5&&(_n.scrollTop=yt)},se=new ResizeObserver(U);se.observe(_n);let Re=_n.firstElementChild;return Re&&se.observe(Re),()=>se.disconnect()},[X,_n]),He({viewport:Ur,viewActive:Je&&X,threadKey:o,completedAt:!ro&&C?.state==="completed"&&Oi?C.completedAt:null,messageId:w,bottomInset:ee});let[Bo,$e]=Ln("timeline-anchored-end-height",o,0),vt=En("timeline-anchored-ready",o,null);ye(()=>{if(!X)return;if(Fo===void 0||K===null){$e(0),vt.current=null;return}let U=zt.current?.node,se=ut[Fo.anchorIndex],Re=zt.current?.measure();if(!U||!se||!Re||Re.scrollLength<=0)return;let yt=Re.topOf(se.id);if(yt===null)return;let gn=Re.contentLength-Bo-yt,xr=Math.max(0,Re.scrollLength-ee-Fo.anchorOffset),Co=Math.max(0,Math.round(xr-gn));if(Math.abs(Co-Bo)>1){$e(Co);return}vt.current!==K&&(vt.current=K,O(K,{rowId:se.id,lastRowId:ut.at(-1)?.id??null}))},[K,Fo,Bo,ee,O,X,ut]);let cn=ut.at(-1)?.id??null;q(()=>{oe?.(cn)},[cn,oe,o]);let rn=En("timeline-top-reveal-armed",o,!0),Qa=B(U=>{if(U>Z2){rn.current=!0;return}if(rn.current){if(rn.current=!1,Ga.current){Wa.current();return}Ni.current?.()}},[rn]),fa=B(()=>{if(!nn.current||zn.current!==o)return;let U=zt.current?.measure();if(!U||$n.current)return;Un(U);let se=t.resolveIsAtEnd({contentLength:U.contentLength,scroll:U.scroll,scrollLength:U.scrollLength},ee);se!==void 0&&ve(se),U.contentLength-U.scrollLength-U.scroll>2&&Qa(U.scroll);let Re=Date.now();Re-qn.current>=Y2&&(qn.current=Re,ne())},[Un,ee,t,Qa,ve,ne,o,$n]),zo=_(null),Kr=B(()=>{nn.current&&zo.current===null&&(zo.current=requestAnimationFrame(()=>{zo.current=null,ao()}))},[ao]);q(()=>()=>{zo.current!==null&&(cancelAnimationFrame(zo.current),zo.current=null)},[o]);let Og=B(U=>{if(U===null||U===Gt.current)return;Gt.current=U;let se=_e.current.find(Re=>Re.sectionKey===U);se&&yo.current&&(yo.current.textContent=se.text),hr.current&&jo(!1),Kr()},[Gt,Kr,jo]),un=zS({root:_n,topInsetPx:Bh,onActiveSectionChange:Og,active:X});q(()=>{if(!X){ne();return}let U=requestAnimationFrame(()=>{if(!nn.current)return;let se=zt.current?.node;se&&Qo.current&&(se.scrollTop=se.scrollHeight-se.clientHeight),un.refresh()});return()=>cancelAnimationFrame(U)},[ne,un,X]);let Fg=B(()=>{jo(U=>!U)},[jo]);ye(()=>{if(!X)return;let U=Gt.current,se=U===null?void 0:_e.current.find(Re=>Re.sectionKey===U);se&&yo.current&&(yo.current.textContent=se.text),Kr()},[X,Kr,Hr]);let Ys=z(()=>{let U=dn?u(G2,{onReveal:vo,fade:ae}):xe!==null?u(W2,{loading:xe.loading,onLoadEarlier:Oo,fade:ae}):ae?q2:K2;return gr?b(be,{children:[u("div",{style:{height:Bh}}),U]}):U},[Oo,dn,gr,xe,vo,ae]);q(()=>{if(!X)return;let U=requestAnimationFrame(fa);return()=>cancelAnimationFrame(U)},[fa,X,ro,ut.length]);let $u=z(()=>({timestampFormat:R,threadKey:o,threadRef:r,markdownCwd:A,resolvedTheme:N,workspaceRoot:$,skills:H,activeThreadEnvironmentId:a,onForkFromUserMessage:T,onImageExpand:E,onOpenFileDiff:I,onProcessDisclosureChange:ln,agentPanelModel:v,onOpenAgents:x,onInterrupt:c,onRespondToDecision:f,scheduledWakes:p,onCancelScheduledWake:m,derive:t,renderWorkGroup:dt,renderToolCallDetail:lt,onSavePlanToWorkspace:ze}),[R,o,r,A,N,$,H,a,T,E,I,ln,v,x,c,f,p,m,t,dt,lt,ze]),Bg=z(()=>({isWorking:yn,latestTurnId:en?.turnId??null,workingStepLabel:rt,stall:Lt,retry:et}),[yn,en?.turnId,et,Lt,rt]),pa=B(U=>u(rB,{row:U}),[]);return ut.length===0&&!i?Ae?null:u("div",{className:"flex h-full items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:"Send a message to start the conversation."})}):u(Tn,{value:$u,children:u(v0,{value:Bg,children:b("div",{ref:ua,onClickCapture:U=>{Sn.current=U.target instanceof Element?U.target.closest("button"):null},onWheelCapture:Y,onTouchMoveCapture:Y,onPointerDownCapture:U=>{U.target===zt.current?.node&&Y()},onKeyDownCapture:U=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(U.key)&&Y()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":qe?"true":"false","data-disclosure-reading":Jt?"true":void 0,"data-timeline-follow-end":vr?"true":"false","data-timeline-anchor-row":Fo===void 0?void 0:ut[Fo.anchorIndex]?.id??void 0,"data-timeline-end-inset":ee,children:[u(AS,{inputKey:o,onBeforeInputChange:Fe,handleRef:D,onAttach:Fi,onScroll:fa,className:F("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",ae&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:ee},children:[Ys,Cn.map(U=>u(ES,{sectionKey:U.key,rowKeyPrefix:o,rows:U.rows,renderRow:pa,sectionRef:un.observeSection(U.key)},`${o}:${U.key}`)),j2,Fo?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:Bo}}):null]})}),Eo!==null?u(p0,{ref:Di,textRef:yo,initialText:Eo,expanded:Hr,onToggleExpanded:Fg}):null]})})})});function nB(e,t){return e.map(n=>{let o=n.rows.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of n.rows)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:n.key,sectionKey:n.key,anchorRowId:o?.id??n.rows[0]?.id??n.key,userText:r===null?null:h0(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:h0(a),headerText:r===null?null:c0(r.text,t)}})}var Hh=240,oB=/\s/u;function h0(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Hh-1;)n-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),n-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(oB.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Hh)||(t.push(a),n+=a.length,n>Hh))return r()}return t.length>0?t.join(""):null}var rB=ue(function({row:t}){let n=Ut(Tn);return u("div",{className:F("relative",t.kind==="message"&&t.message.role==="user"?"pb-6":t.kind==="message"&&t.message.role==="assistant"?t.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":t.id,"data-timeline-row-kind":t.kind,"data-message-id":t.kind==="message"?t.message.id:void 0,"data-message-role":t.kind==="message"?t.message.role:void 0,children:b(Uf,{resetKey:t.id,fallback:jS,children:[t.kind==="turn-summary"?u(pS,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(TS,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(aB,{row:t}):null,t.kind==="model-switch"?u(g0,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u($h,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(Oh,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(m0,{row:t}):null,t.kind==="proposed-plan"?u(sB,{row:t}):null,t.kind==="turn-plan"?u(lB,{row:t}):null,t.kind==="working"?u(dB,{row:t}):null]})})});function aB({row:e}){let t=Ut(Tn),n=ni(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(be,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(iB,{entry:r},r.id))})}function iB({entry:e}){let[t,n]=G(!1),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":t,className:F("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive":"text-muted-foreground"),onClick:()=>n(r=>!r),disabled:o===void 0,children:[u("span",{"aria-hidden":!0,className:F("block size-2 shrink-0 rounded-full",e.tone==="error"?"bg-destructive":e.tone==="thinking"||e.tone==="info"?"bg-muted-foreground/60":"border border-muted-foreground/60")}),u("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:e.label}),o!==void 0?u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!t&&"-rotate-90")}):null]}),t&&o!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:o}):null]})}function sB({row:e}){let t=Ut(Tn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(VS,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var lB=ue(function({row:t}){let[n,o]=G(!1),{steps:r}=t.turnPlan.plan,a=r.filter(d=>d.status==="completed").length,i=a===r.length,s=r.find(d=>d.status==="inProgress")?.step??r.find(d=>d.status==="pending")?.step??r.at(-1)?.step??"Plan";return b("div",{className:"min-w-0 px-1 py-0.5",children:[b("button",{type:"button",className:"relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-[12px] leading-5 transition-colors duration-(--control-duration) hover:bg-accent/20 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11","aria-expanded":n,onClick:()=>o(d=>!d),children:[u(n?pn:Uo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),r.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:r.map(d=>u("span",{className:F("h-[3px] w-2.5 rounded-full",d.status==="completed"?"bg-success":d.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},d.step))}):null,u("span",{className:F("min-w-0 truncate",i?"text-muted-foreground/65":"font-medium text-foreground/85"),children:s}),r.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[a,"/",r.length]}):null]}),n?u("div",{className:"mt-0.5 space-y-px pl-6",children:r.map(d=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:F("w-3 shrink-0 text-center font-mono text-chat-meta",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step})]},d.step))}):null]})});function dB({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Ut(v0),{t:r}=Dt();return b("div",{className:"border-b border-border/60 pb-2 pt-1",children:[u("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 px-1 text-chat text-muted-foreground tabular-nums","data-testid":"working-row",children:b("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?cc(r("activity.workingForLive"),u(mB,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(cB,{retry:o}):n&&!e.compacting?u(fB,{stall:n}):null]})}function cB({retry:e}){let{t}=Dt(),n=Ut(Tn);return b(tc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Af,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(nc,{children:u(te,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var uB={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function fB({stall:e}){let{t}=Dt(),{onInterrupt:n}=Ut(Tn),o=t(uB[e.reason]);return b("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[u("span",{className:"tabular-nums",children:cc(t("stall.noOutputForLive"),u(pB,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(te,{className:"h-5 px-1.5 text-chat-row",onClick:n,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t("stall.interrupt")}):null]})}function y0(e,t){let n=ni();q(()=>{let o=()=>{t.current&&(t.current.textContent=Uh(e))};if(o(),!n)return;let r=setInterval(o,1e3);return document.addEventListener("visibilitychange",o),()=>{clearInterval(r),document.removeEventListener("visibilitychange",o)}},[n,e,t])}function pB({since:e}){let t=_(null);return y0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Uh(e)})}function mB({createdAt:e}){let t=_(null);return y0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Uh(e)})}function gB(e,t){let n=_({byId:new Map,result:[]}),o=_(t);return o.current=t,z(()=>{let r=new Map,a=e.map(i=>{let s=n.current.byId.get(i.id),l=s&&hB(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function hB(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":{let n=t;return e.turnId===n.turnId&&e.createdAt===n.createdAt&&e.badge===n.badge}case"turn-summary":{let n=t;return e.createdAt===n.createdAt&&e.copyText===n.copyText&&e.footer===n.footer}case"tool-group":{let n=t;return e.createdAt===n.createdAt&&e.groupId===n.groupId&&e.entries===n.entries}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&e.modelBadge===n.modelBadge}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&e.badge===n.badge}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let n=t;return e.createdAt===n.createdAt&&e.turnPlan.plan===n.turnPlan.plan}case"work":{let n=t;return e.isExpandedToolGroupEntry===n.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===n.isLastExpandedToolGroupEntry&&e.groupedEntries===n.groupedEntries}case"message":{let n=t;return e.message===n.message&&e.presentation===n.presentation&&e.textTone===n.textTone&&e.durationStart===n.durationStart&&e.showAssistantMeta===n.showAssistantMeta&&e.showAssistantCopyButton===n.showAssistantCopyButton&&e.copyInFooter===n.copyInFooter&&e.assistantCopyStreaming===n.assistantCopyStreaming&&e.modelBadge===n.modelBadge}}}function vB(e,t){let n=Date.parse(e),o=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(o))return null;let r=Math.max(0,Math.floor((o-n)/1e3));if(r<60)return`${r}s`;let a=Math.floor(r/3600),i=Math.floor(r%3600/60),s=r%60;return a>0?i>0?`${a}h ${i}m`:`${a}h`:s>0?`${i}m ${s}s`:`${i}m`}function Uh(e){return vB(e,new Date().toISOString())??"0s"}me();var C0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var b0=50,xB=32;function yB(e){let t=[];for(let n=0;n<e.length;n+=b0)t.push(e.slice(n,n+b0));return t}function CB({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
3686
3686
 
3687
3687
  `):[r,...s].filter(Boolean).join(`
3688
3688
 
3689
- `);return l.length===0?null:u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:l})}var b0=ue(function({inputKey:t,rows:n,loadEarlier:o,timestampFormat:r,paneVisible:a,useToolCallDetail:i,threadRef:s,resolveChatAnchorMessageId:l,onOpenInChat:d}){let{t:c}=so(),[f,p]=Sn("trajectory-kind-filter",t,"all"),[m,h]=Sn("trajectory-expanded-rows",t,()=>new Set),[g,v]=Sn("trajectory-follow-latest",t,!0),x=z(()=>{let E=new Set(n.map(A=>A.kind));return y0.filter(A=>E.has(A))},[n]),y=z(()=>f==="all"?n:n.filter(E=>E.kind===f),[n,f]),C=z(()=>vB(y),[y]),w=E=>h(A=>{let N=new Set(A);return N.has(E)?N.delete(E):N.add(E),N}),k=_(null),S=Ln("trajectory-at-end",t,!0),L=Ln("trajectory-scroll-top",t,0),I=()=>{if(!a)return;let E=k.current;E&&(L.current=E.scrollTop,S.current=E.scrollHeight-E.scrollTop-E.clientHeight<=hB)},T=E=>{E&&(S.current=!0),v(E)};return ye(()=>{if(!a)return;let E=k.current;if(E)return(!g||!S.current)&&(E.scrollTop=L.current),()=>{L.current=E.scrollTop}},[S,g,t,a,L]),ye(()=>{if(!a||!g||!S.current)return;let E=k.current;E&&(E.scrollTop=E.scrollHeight)},[y,g,t,a,n]),b("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[b("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[b("div",{role:"group","aria-label":c("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ne,{size:"xs",variant:f==="all"?"secondary":"ghost","aria-pressed":f==="all",onClick:()=>p("all"),children:c("trajectory.filterAll")}),x.map(E=>u(ne,{size:"xs",variant:f===E?"secondary":"ghost","aria-pressed":f===E,onClick:()=>p(E),children:c(`trajectory.kinds.${E}`)},E))]}),u(oc,{className:"ml-auto",size:"xs",variant:"outline",pressed:g,onPressedChange:T,"aria-label":c("trajectory.followLatest"),children:c("trajectory.followLatest")})]}),b("div",{ref:k,className:"min-h-0 flex-1 overflow-auto",onScroll:I,"data-trajectory-scroll":!0,children:[o!==null?b("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[u("span",{children:c("trajectory.loadEarlier")}),u(ne,{size:"xs",variant:"outline",disabled:o.loading,onClick:o.onLoadEarlier,children:o.loading?c("trajectory.loadingEarlier"):c("trajectory.loadEarlierAction")})]}):null,y.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:c("trajectory.empty")}):b(KI,{children:[u(VI,{className:"sticky top-0 z-10 bg-background",children:b(Ef,{className:"hover:bg-transparent",children:[u(ss,{className:"w-px whitespace-nowrap",children:c("trajectory.columnTime")}),u(ss,{className:"w-px whitespace-nowrap",children:c("trajectory.columnType")}),u(ss,{children:c("trajectory.columnSummary")}),u(ss,{className:"w-px whitespace-nowrap",children:c("trajectory.columnStatus")}),u(ss,{className:"w-px whitespace-nowrap",children:c("trajectory.columnDuration")}),u(ss,{className:"w-px",children:u("span",{className:"sr-only",children:c("trajectory.openInChat")})})]})}),C.map((E,A)=>u(qI,{className:"trajectory-chunk [&_tr:last-child]:border-b",children:E.map(N=>{let R=m.has(N.id),$=N.detail!==void 0||N.toolCallId!==void 0,H=l(N);return[b(Ef,{"data-trajectory-row-id":N.id,className:F($&&"cursor-pointer"),onClick:$?()=>w(N.id):void 0,children:[u(ci,{className:"whitespace-nowrap text-muted-foreground",title:ta(N.createdAt,r),children:ui(N.createdAt,r)}),u(ci,{className:"whitespace-nowrap",children:c(`trajectory.kinds.${N.kind}`)}),u(ci,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[$?u(ne,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":c(R?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":R,onClick:K=>{K.stopPropagation(),w(N.id)},children:R?u(ln,{"aria-hidden":!0}):u(zo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:N.summary})]})}),u(ci,{className:"whitespace-nowrap",children:c(`trajectory.status.${N.status}`)}),u(ci,{className:"whitespace-nowrap text-muted-foreground",children:N.durationMs!==void 0?ls(N.durationMs):c("trajectory.valueUnknown")}),u(ci,{className:"whitespace-nowrap",children:H!==null?b(Xe,{children:[u(Je,{render:u(ne,{size:"xs",variant:"ghost","aria-label":c("trajectory.openInChat"),onClick:K=>{K.stopPropagation(),d(H)}}),children:u(es,{"aria-hidden":!0})}),u(Ye,{side:"top",children:c("trajectory.openInChat")})]}):null})]},`${t}:${N.id}`),R&&$?u(Ef,{className:"hover:bg-transparent","data-trajectory-detail-row":N.id,children:b(ci,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:c("trajectory.detailTitle")}),N.kind==="tool-call"&&N.toolCallId!==void 0?u(xB,{threadRef:s,useToolCallDetail:i,toolCallId:N.toolCallId,turnId:N.turnId,fallback:N.detail,revision:`${N.status}:${N.updatedActivityId??N.activityId??N.id}`}):N.detail!==void 0?u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:N.detail}):null]})},`${t}:${N.id}:detail`):null]})},`${t}:${E[0]?.id??A}`))]})]})]})});me();var gs=kd(vc());me();function k0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>o=>{t.forEach(r=>r(o))},t)}var xc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cs(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Yf(e){return"nodeType"in e}function Io(e){var t,n;return e?cs(e)?e:Yf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Jf(e){let{Document:t}=Io(e);return e instanceof t}function wl(e){return cs(e)?!1:e instanceof Io(e).HTMLElement}function qh(e){return e instanceof Io(e).SVGElement}function us(e){return e?cs(e)?e.document:Yf(e)?Jf(e)?e:wl(e)||qh(e)?e.ownerDocument:document:document:document}var ir=xc?ye:q;function Zf(e){let t=_(e);return ir(()=>{t.current=e}),B(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function P0(){let e=_(null),t=B((o,r)=>{e.current=setInterval(o,r)},[]),n=B(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Tl(e,t){t===void 0&&(t=[e]);let n=_(e);return ir(()=>{n.current!==e&&(n.current=e)},t),n}function Ll(e,t){let n=_();return z(()=>{let o=e(n.current);return n.current=o,o},[...t])}function yc(e){let t=Zf(e),n=_(null),o=B(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function ep(e){let t=_();return q(()=>{t.current=e},[e]),t.current}var Kh={};function fs(e,t){return z(()=>{if(t)return t;let n=Kh[e]==null?0:Kh[e]+1;return Kh[e]=n,e+"-"+n},[e,t])}function A0(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((a,i)=>{let s=Object.entries(i);for(let[l,d]of s){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var ps=A0(1),ms=A0(-1);function IB(e){return"clientX"in e&&"clientY"in e}function Cc(e){if(!e)return!1;let{KeyboardEvent:t}=Io(e.target);return t&&e instanceof t}function SB(e){if(!e)return!1;let{TouchEvent:t}=Io(e.target);return t&&e instanceof t}function bc(e){if(SB(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return IB(e)?{x:e.clientX,y:e.clientY}:null}var mi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[mi.Translate.toString(e),mi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),L0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function E0(e){return e.matches(L0)?e:e.querySelector(L0)}me();var wB={display:"none"};function M0(e){let{id:t,value:n}=e;return un.createElement("div",{id:t,style:wB},n)}function R0(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return un.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function N0(){let[e,t]=G("");return{announce:B(o=>{o!=null&&t(o)},[]),announcement:e}}var W0=Ht(null);function TB(e){let t=sn(W0);q(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function LB(){let[e]=G(()=>new Set),t=B(o=>(e.add(o),()=>e.delete(o)),[e]);return[B(o=>{let{type:r,event:a}=o;e.forEach(i=>{var s;return(s=i[r])==null?void 0:s.call(i,a)})},[e]),t]}var kB={draggable:`
3689
+ `);return l.length===0?null:u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:l})}var I0=ue(function({inputKey:t,rows:n,loadEarlier:o,timestampFormat:r,paneVisible:a,useToolCallDetail:i,threadRef:s,resolveChatAnchorMessageId:l,onOpenInChat:d}){let{t:c}=co(),[f,p]=Ln("trajectory-kind-filter",t,"all"),[m,h]=Ln("trajectory-expanded-rows",t,()=>new Set),[g,v]=Ln("trajectory-follow-latest",t,!0),x=z(()=>{let E=new Set(n.map(A=>A.kind));return C0.filter(A=>E.has(A))},[n]),y=z(()=>f==="all"?n:n.filter(E=>E.kind===f),[n,f]),C=z(()=>yB(y),[y]),w=E=>h(A=>{let N=new Set(A);return N.has(E)?N.delete(E):N.add(E),N}),k=_(null),S=En("trajectory-at-end",t,!0),L=En("trajectory-scroll-top",t,0),I=()=>{if(!a)return;let E=k.current;E&&(L.current=E.scrollTop,S.current=E.scrollHeight-E.scrollTop-E.clientHeight<=xB)},T=E=>{E&&(S.current=!0),v(E)};return ye(()=>{if(!a)return;let E=k.current;if(E)return(!g||!S.current)&&(E.scrollTop=L.current),()=>{L.current=E.scrollTop}},[S,g,t,a,L]),ye(()=>{if(!a||!g||!S.current)return;let E=k.current;E&&(E.scrollTop=E.scrollHeight)},[y,g,t,a,n]),b("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[b("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[b("div",{role:"group","aria-label":c("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(te,{size:"xs",variant:f==="all"?"secondary":"ghost","aria-pressed":f==="all",onClick:()=>p("all"),children:c("trajectory.filterAll")}),x.map(E=>u(te,{size:"xs",variant:f===E?"secondary":"ghost","aria-pressed":f===E,onClick:()=>p(E),children:c(`trajectory.kinds.${E}`)},E))]}),u(Zd,{className:"ml-auto",size:"xs",variant:"outline",pressed:g,onPressedChange:T,"aria-label":c("trajectory.followLatest"),children:c("trajectory.followLatest")})]}),b("div",{ref:k,className:"min-h-0 flex-1 overflow-auto",onScroll:I,"data-trajectory-scroll":!0,children:[o!==null?b("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[u("span",{children:c("trajectory.loadEarlier")}),u(te,{size:"xs",variant:"outline",disabled:o.loading,onClick:o.onLoadEarlier,children:o.loading?c("trajectory.loadingEarlier"):c("trajectory.loadEarlierAction")})]}):null,y.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:c("trajectory.empty")}):b(qI,{children:[u(WI,{className:"sticky top-0 z-10 bg-background",children:b(Pf,{className:"hover:bg-transparent",children:[u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnTime")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnType")}),u(is,{children:c("trajectory.columnSummary")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnStatus")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnDuration")}),u(is,{className:"w-px",children:u("span",{className:"sr-only",children:c("trajectory.openInChat")})})]})}),C.map((E,A)=>u(VI,{className:"trajectory-chunk [&_tr:last-child]:border-b",children:E.map(N=>{let R=m.has(N.id),$=N.detail!==void 0||N.toolCallId!==void 0,H=l(N);return[b(Pf,{"data-trajectory-row-id":N.id,className:F($&&"cursor-pointer"),onClick:$?()=>w(N.id):void 0,children:[u(si,{className:"whitespace-nowrap text-muted-foreground",title:Jr(N.createdAt,r),children:li(N.createdAt,r)}),u(si,{className:"whitespace-nowrap",children:c(`trajectory.kinds.${N.kind}`)}),u(si,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[$?u(te,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":c(R?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":R,onClick:K=>{K.stopPropagation(),w(N.id)},children:R?u(pn,{"aria-hidden":!0}):u(Uo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:N.summary})]})}),u(si,{className:"whitespace-nowrap",children:c(`trajectory.status.${N.status}`)}),u(si,{className:"whitespace-nowrap text-muted-foreground",children:N.durationMs!==void 0?ss(N.durationMs):c("trajectory.valueUnknown")}),u(si,{className:"whitespace-nowrap",children:H!==null?b(Qe,{children:[u(Ye,{render:u(te,{size:"xs",variant:"ghost","aria-label":c("trajectory.openInChat"),onClick:K=>{K.stopPropagation(),d(H)}}),children:u(Zi,{"aria-hidden":!0})}),u(Xe,{side:"top",children:c("trajectory.openInChat")})]}):null})]},`${t}:${N.id}`),R&&$?u(Pf,{className:"hover:bg-transparent","data-trajectory-detail-row":N.id,children:b(si,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:c("trajectory.detailTitle")}),N.kind==="tool-call"&&N.toolCallId!==void 0?u(CB,{threadRef:s,useToolCallDetail:i,toolCallId:N.toolCallId,turnId:N.turnId,fallback:N.detail,revision:`${N.status}:${N.updatedActivityId??N.activityId??N.id}`}):N.detail!==void 0?u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:N.detail}):null]})},`${t}:${N.id}:detail`):null]})},`${t}:${E[0]?.id??A}`))]})]})]})});me();var ms=Sd(pc());me();function P0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>o=>{t.forEach(r=>r(o))},t)}var mc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ds(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Qf(e){return"nodeType"in e}function Lo(e){var t,n;return e?ds(e)?e:Qf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Xf(e){let{Document:t}=Lo(e);return e instanceof t}function bl(e){return ds(e)?!1:e instanceof Lo(e).HTMLElement}function qh(e){return e instanceof Lo(e).SVGElement}function cs(e){return e?ds(e)?e.document:Qf(e)?Xf(e)?e:bl(e)||qh(e)?e.ownerDocument:document:document:document}var rr=mc?ye:q;function Yf(e){let t=_(e);return rr(()=>{t.current=e}),B(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function A0(){let e=_(null),t=B((o,r)=>{e.current=setInterval(o,r)},[]),n=B(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Il(e,t){t===void 0&&(t=[e]);let n=_(e);return rr(()=>{n.current!==e&&(n.current=e)},t),n}function Sl(e,t){let n=_();return z(()=>{let o=e(n.current);return n.current=o,o},[...t])}function gc(e){let t=Yf(e),n=_(null),o=B(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Jf(e){let t=_();return q(()=>{t.current=e},[e]),t.current}var Kh={};function us(e,t){return z(()=>{if(t)return t;let n=Kh[e]==null?0:Kh[e]+1;return Kh[e]=n,e+"-"+n},[e,t])}function E0(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((a,i)=>{let s=Object.entries(i);for(let[l,d]of s){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var fs=E0(1),ps=E0(-1);function wB(e){return"clientX"in e&&"clientY"in e}function hc(e){if(!e)return!1;let{KeyboardEvent:t}=Lo(e.target);return t&&e instanceof t}function TB(e){if(!e)return!1;let{TouchEvent:t}=Lo(e.target);return t&&e instanceof t}function vc(e){if(TB(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return wB(e)?{x:e.clientX,y:e.clientY}:null}var ui=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ui.Translate.toString(e),ui.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),k0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function M0(e){return e.matches(k0)?e:e.querySelector(k0)}me();var LB={display:"none"};function R0(e){let{id:t,value:n}=e;return hn.createElement("div",{id:t,style:LB},n)}function N0(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return hn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function _0(){let[e,t]=G("");return{announce:B(o=>{o!=null&&t(o)},[]),announcement:e}}var G0=Ht(null);function kB(e){let t=fn(G0);q(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function PB(){let[e]=G(()=>new Set),t=B(o=>(e.add(o),()=>e.delete(o)),[e]);return[B(o=>{let{type:r,event:a}=o;e.forEach(i=>{var s;return(s=i[r])==null?void 0:s.call(i,a)})},[e]),t]}var AB={draggable:`
3690
3690
  To pick up a draggable item, press the space bar.
3691
3691
  While dragging, use the arrow keys to move the item.
3692
3692
  Press space again to drop the item in its new position, or press escape to cancel.
3693
- `},PB={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function AB(e){let{announcements:t=PB,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=kB}=e,{announce:a,announcement:i}=N0(),s=fs("DndLiveRegion"),[l,d]=G(!1);if(q(()=>{d(!0)},[]),TB(z(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=un.createElement(un.Fragment,null,un.createElement(M0,{id:o,value:r.draggable}),un.createElement(R0,{id:s,announcement:i}));return n?(0,gs.createPortal)(c,n):c}var Nn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Nn||(Nn={}));function np(){}function Zh(e,t){return z(()=>({sensor:e,options:t??{}}),[e,t])}function G0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>[...t].filter(o=>o!=null),[...t])}var Tr=Object.freeze({x:0,y:0});function j0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Q0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function EB(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function _0(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function ev(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function D0(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var X0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=D0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=j0(D0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(Q0)},Y0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=_0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=_0(l),c=r.reduce((p,m,h)=>p+j0(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(Q0)};function MB(e,t){let n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=r-o,s=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=i*s,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var RB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:i}=a,s=n.get(i);if(s){let l=MB(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(EB)};function NB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function J0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Tr}function _B(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}var DB=_B(1);function OB(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function FB(e,t,n){let o=OB(t);if(!o)return e;let{scaleX:r,scaleY:a,x:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),d=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:d,right:l+c,bottom:d+f,left:l}}var BB={ignoreTransform:!1};function xs(e,t){t===void 0&&(t=BB);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Io(e).getComputedStyle(e);d&&(n=FB(n,d,c))}let{top:o,left:r,width:a,height:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function O0(e){return xs(e,{ignoreTransform:!0})}function zB(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $B(e,t){return t===void 0&&(t=Io(e).getComputedStyle(e)),t.position==="fixed"}function HB(e,t){t===void 0&&(t=Io(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?n.test(a):!1})}function Lc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(Jf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!wl(r)||qh(r)||n.includes(r))return n;let a=Io(e).getComputedStyle(r);return r!==e&&HB(r,a)&&n.push(r),$B(r,a)?n:o(r.parentNode)}return e?o(e):n}function Z0(e){let[t]=Lc(e,1);return t??null}function Vh(e){return!xc||!e?null:cs(e)?e:Yf(e)?Jf(e)||e===us(e).scrollingElement?window:wl(e)?e:null:null}function ew(e){return cs(e)?e.scrollX:e.scrollLeft}function tw(e){return cs(e)?e.scrollY:e.scrollTop}function jh(e){return{x:ew(e),y:tw(e)}}var Vn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Vn||(Vn={}));function nw(e){return!xc||!e?!1:e===document.scrollingElement}function ow(e){let t={x:0,y:0},n=nw(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=o.y,s=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:i,isRight:s,maxScroll:o,minScroll:t}}var UB={x:.2,y:.2};function KB(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=UB);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=ow(e),m={x:0,y:0},h={x:0,y:0},g={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+g.height?(m.y=Vn.Backward,h.y=o*Math.abs((t.top+g.height-a)/g.height)):!c&&l>=t.bottom-g.height&&(m.y=Vn.Forward,h.y=o*Math.abs((t.bottom-g.height-l)/g.height)),!p&&s>=t.right-g.width?(m.x=Vn.Forward,h.x=o*Math.abs((t.right-g.width-s)/g.width)):!f&&i<=t.left+g.width&&(m.x=Vn.Backward,h.x=o*Math.abs((t.left+g.width-i)/g.width)),{direction:m,speed:h}}function qB(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function rw(e){return e.reduce((t,n)=>ps(t,jh(n)),Tr)}function VB(e){return e.reduce((t,n)=>t+ew(n),0)}function WB(e){return e.reduce((t,n)=>t+tw(n),0)}function GB(e,t){if(t===void 0&&(t=xs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);Z0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var jB=[["x",["left","right"],VB],["y",["top","bottom"],WB]],Sc=class{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let o=Lc(n),r=rw(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of jB)for(let l of i)Object.defineProperty(this,l,{get:()=>{let d=s(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},hs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}};function QB(e){let{EventTarget:t}=Io(e);return e instanceof t?e:us(e)}function Wh(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var sr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(sr||(sr={}));function F0(e){e.preventDefault()}function XB(e){e.stopPropagation()}var pt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(pt||(pt={}));var aw={start:[pt.Space,pt.Enter],cancel:[pt.Esc],end:[pt.Space,pt.Enter,pt.Tab]},YB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case pt.Right:return{...n,x:n.x+25};case pt.Left:return{...n,x:n.x-25};case pt.Down:return{...n,y:n.y+25};case pt.Up:return{...n,y:n.y-25}}},kl=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:n}}=t;this.props=t,this.listeners=new hs(us(n)),this.windowListeners=new hs(Io(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sr.Resize,this.handleCancel),this.windowListeners.add(sr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sr.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&GB(o),n(Tr)}handleKeyDown(t){if(Cc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=aw,coordinateGetter:i=YB,scrollBehavior:s="smooth"}=r,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:d}=o.current,c=d?{x:d.left,y:d.top}:Tr;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=ms(f,c),m={x:0,y:0},{scrollableAncestors:h}=o.current;for(let g of h){let v=t.code,{isTop:x,isRight:y,isLeft:C,isBottom:w,maxScroll:k,minScroll:S}=ow(g),L=qB(g),I={x:Math.min(v===pt.Right?L.right-L.width/2:L.right,Math.max(v===pt.Right?L.left:L.left+L.width/2,f.x)),y:Math.min(v===pt.Down?L.bottom-L.height/2:L.bottom,Math.max(v===pt.Down?L.top:L.top+L.height/2,f.y))},T=v===pt.Right&&!y||v===pt.Left&&!C,E=v===pt.Down&&!w||v===pt.Up&&!x;if(T&&I.x!==f.x){let A=g.scrollLeft+p.x,N=v===pt.Right&&A<=k.x||v===pt.Left&&A>=S.x;if(N&&!p.y){g.scrollTo({left:A,behavior:s});return}N?m.x=g.scrollLeft-A:m.x=v===pt.Right?g.scrollLeft-k.x:g.scrollLeft-S.x,m.x&&g.scrollBy({left:-m.x,behavior:s});break}else if(E&&I.y!==f.y){let A=g.scrollTop+p.y,N=v===pt.Down&&A<=k.y||v===pt.Up&&A>=S.y;if(N&&!p.x){g.scrollTo({top:A,behavior:s});return}N?m.y=g.scrollTop-A:m.y=v===pt.Down?g.scrollTop-k.y:g.scrollTop-S.y,m.y&&g.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,ps(ms(f,this.referenceCoordinates),m))}}}handleMove(t,n){let{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){let{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){let{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};kl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=aw,onActivation:r}=t,{active:a}=n,{code:i}=e.nativeEvent;if(o.start.includes(i)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function B0(e){return!!(e&&"distance"in e)}function z0(e){return!!(e&&"delay"in e)}var wc=class{constructor(t,n,o){var r;o===void 0&&(o=QB(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;let{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=us(i),this.documentListeners=new hs(this.document),this.listeners=new hs(o),this.windowListeners=new hs(Io(i)),this.initialCoordinates=(r=bc(a))!=null?r:Tr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(sr.Resize,this.handleCancel),this.windowListeners.add(sr.DragStart,F0),this.windowListeners.add(sr.VisibilityChange,this.handleCancel),this.windowListeners.add(sr.ContextMenu,F0),this.documentListeners.add(sr.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(z0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(B0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){let{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(sr.Click,XB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=(n=bc(t))!=null?n:Tr,d=ms(r,l);if(!o&&s){if(B0(s)){if(s.tolerance!=null&&Wh(d,s.tolerance))return this.handleCancel();if(Wh(d,s.distance))return this.handleStart()}if(z0(s)&&Wh(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){let{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){let{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===pt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},JB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Pl=class extends wc{constructor(t){let{event:n}=t,o=us(n.target);super(t,JB,o)}};Pl.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];var ZB={move:{name:"mousemove"},end:{name:"mouseup"}},Qh;(function(e){e[e.RightClick=2]="RightClick"})(Qh||(Qh={}));var Xh=class extends wc{constructor(t){super(t,ZB,us(t.event.target))}};Xh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Qh.RightClick?!1:(o?.({event:n}),!0)}}];var Gh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Yh=class extends wc{constructor(t){super(t,Gh)}static setup(){return window.addEventListener(Gh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Gh.move.name,t)};function t(){}}};Yh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var Ic;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ic||(Ic={}));var op;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(op||(op={}));function ez(e){let{acceleration:t,activator:n=Ic.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=op.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=nz({delta:f,disabled:!a}),[h,g]=P0(),v=_({x:0,y:0}),x=_({x:0,y:0}),y=z(()=>{switch(n){case Ic.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ic.DraggableRect:return r}},[n,r,l]),C=_(null),w=B(()=>{let S=C.current;if(!S)return;let L=v.current.x*x.current.x,I=v.current.y*x.current.y;S.scrollBy(L,I)},[]),k=z(()=>s===op.TreeOrder?[...d].reverse():d,[s,d]);q(()=>{if(!a||!d.length||!y){g();return}for(let S of k){if(o?.(S)===!1)continue;let L=d.indexOf(S),I=c[L];if(!I)continue;let{direction:T,speed:E}=KB(S,I,y,t,p);for(let A of["x","y"])m[A][T[A]]||(E[A]=0,T[A]=0);if(E.x>0||E.y>0){g(),C.current=S,h(w,i),v.current=E,x.current=T;return}}v.current={x:0,y:0},x.current={x:0,y:0},g()},[t,w,o,g,a,i,JSON.stringify(y),JSON.stringify(m),h,d,k,c,JSON.stringify(p)])}var tz={x:{[Vn.Backward]:!1,[Vn.Forward]:!1},y:{[Vn.Backward]:!1,[Vn.Forward]:!1}};function nz(e){let{delta:t,disabled:n}=e,o=ep(t);return Ll(r=>{if(n||!o||!r)return tz;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Vn.Backward]:r.x[Vn.Backward]||a.x===-1,[Vn.Forward]:r.x[Vn.Forward]||a.x===1},y:{[Vn.Backward]:r.y[Vn.Backward]||a.y===-1,[Vn.Forward]:r.y[Vn.Forward]||a.y===1}}},[n,t,o])}function oz(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Ll(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function rz(e,t){return z(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,o)}));return[...n,...a]},[]),[e,t])}var Tc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Tc||(Tc={}));var Jh;(function(e){e.Optimized="optimized"})(Jh||(Jh={}));var $0=new Map;function az(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=G(null),{frequency:s,measure:l,strategy:d}=r,c=_(e),f=v(),p=Tl(f),m=B(function(x){x===void 0&&(x=[]),!p.current&&i(y=>y===null?x:y.concat(x.filter(C=>!y.includes(C))))},[p]),h=_(null),g=Ll(x=>{if(f&&!n)return $0;if(!x||x===$0||c.current!==e||a!=null){let y=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){y.set(C.id,C.rect.current);continue}let w=C.node.current,k=w?new Sc(l(w),w):null;C.rect.current=k,k&&y.set(C.id,k)}return y}return x},[e,a,n,f,l]);return q(()=>{c.current=e},[e]),q(()=>{f||m()},[n,f]),q(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),q(()=>{f||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...o]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case Tc.Always:return!1;case Tc.BeforeDragging:return n;default:return!n}}}function iw(e,t){return Ll(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function iz(e,t){return iw(e,t)}function sz(e){let{callback:t,disabled:n}=e,o=Zf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return q(()=>()=>r?.disconnect(),[r]),r}function rp(e){let{callback:t,disabled:n}=e,o=Zf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return q(()=>()=>r?.disconnect(),[r]),r}function lz(e){return new Sc(xs(e),e)}function H0(e,t,n){t===void 0&&(t=lz);let[o,r]=G(null);function a(){r(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}let i=sz({callback(l){if(e)for(let d of l){let{type:c,target:f}=d;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),s=rp({callback:a});return ir(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function dz(e){let t=iw(e);return J0(e,t)}var U0=[];function cz(e){let t=_(e),n=Ll(o=>e?o&&o!==U0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Lc(e):U0,[e]);return q(()=>{t.current=e},[e]),n}function uz(e){let[t,n]=G(null),o=_(e),r=B(a=>{let i=Vh(a.target);i&&n(s=>s?(s.set(i,jh(i)),new Map(s)):null)},[]);return q(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Vh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,jh(d)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),o.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{let d=Vh(l);d?.removeEventListener("scroll",r)})}},[r,e]),z(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ps(a,i),Tr):rw(e):Tr,[e,t])}function K0(e,t){t===void 0&&(t=[]);let n=_(null);return q(()=>{n.current=null},t),q(()=>{let o=e!==Tr;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ms(e,n.current):Tr}function fz(e){q(()=>{if(!xc)return;let t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(let n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function pz(e,t){return z(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function sw(e){return z(()=>e?zB(e):null,[e])}var q0=[];function mz(e,t){t===void 0&&(t=xs);let[n]=e,o=sw(n?Io(n):null),[r,a]=G(q0);function i(){a(()=>e.length?e.map(l=>nw(l)?o:new Sc(t(l),l)):q0)}let s=rp({callback:i});return ir(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function gz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return wl(t)?t:e}function hz(e){let{measure:t}=e,[n,o]=G(null),r=B(d=>{for(let{target:c}of d)if(wl(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=rp({callback:r}),i=B(d=>{let c=gz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=yc(i);return z(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var vz=[{sensor:Pl,options:{}},{sensor:kl,options:{}}],xz={current:{}},tp={draggable:{measure:O0},droppable:{measure:O0,strategy:Tc.WhileDragging,frequency:Jh.Optimized},dragOverlay:{measure:xs}},vs=class extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}},yz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:np},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tp,measureDroppableContainers:np,windowRect:null,measuringScheduled:!1},Cz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:np,draggableNodes:new Map,over:null,measureDroppableContainers:np},ap=Ht(Cz),lw=Ht(yz);function bz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vs}}}function Iz(e,t){switch(t.type){case Nn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Nn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Nn.DragEnd:case Nn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Nn.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new vs(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Nn.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let i=new vs(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case Nn.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new vs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Sz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=sn(ap),a=ep(o),i=ep(n?.id);return q(()=>{if(!t&&!o&&a&&i!=null){if(!Cc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=E0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function wz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function Tz(e){return z(()=>({draggable:{...tp.draggable,...e?.draggable},droppable:{...tp.droppable,...e?.droppable},dragOverlay:{...tp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Lz(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=_(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;ir(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!o)return;let d=t?.node.current;if(!d||d.isConnected===!1)return;let c=n(d),f=J0(c,o);if(i||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=Z0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var dw=Ht({...Tr,scaleX:1,scaleY:1}),gi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(gi||(gi={}));var cw=ue(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=vz,collisionDetection:f=RB,measuring:p,modifiers:m,...h}=t,g=ni(Iz,void 0,bz),[v,x]=g,[y,C]=LB(),[w,k]=G(gi.Uninitialized),S=w===gi.Initialized,{draggable:{active:L,nodes:I,translate:T},droppable:{containers:E}}=v,A=L!=null?I.get(L):null,N=_({initial:null,translated:null}),R=z(()=>{var ie;return L!=null?{id:L,data:(ie=A?.data)!=null?ie:xz,rect:N}:null},[L,A]),$=_(null),[H,K]=G(null),[O,oe]=G(null),te=Tl(h,Object.values(h)),W=fs("DndDescribedBy",i),Ke=z(()=>E.getEnabled(),[E]),ve=Tz(p),{droppableRects:fe,measureDroppableContainers:Ne,measuringScheduled:Ae}=az(Ke,{dragging:S,dependencies:[T.x,T.y],config:ve.droppable}),ae=oz(I,L),Ee=z(()=>O?bc(O):null,[O]),xe=de(),re=iz(ae,ve.draggable.measure);Lz({activeNode:L!=null?I.get(L):null,config:xe.layoutShiftCompensation,initialRect:re,measure:ve.draggable.measure});let Ie=H0(ae,ve.draggable.measure,re),st=H0(ae?ae.parentElement:null),dt=_({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=E.getNodeFor((n=dt.current.over)==null?void 0:n.id),ct=hz({measure:ve.dragOverlay.measure}),Mt=(o=ct.nodeRef.current)!=null?o:ae,at=S?(r=ct.rect)!=null?r:Ie:null,$e=!!(ct.nodeRef.current&&ct.rect),Se=dz($e?null:Ie),Be=sw(Mt?Io(Mt):null),Ze=cz(S?lt??ae:null),qt=mz(Ze),X=wz(m,{transform:{x:T.x-Se.x,y:T.y-Se.y,scaleX:1,scaleY:1},activatorEvent:O,active:R,activeNodeRect:Ie,containerNodeRect:st,draggingNodeRect:at,over:dt.current.over,overlayNodeRect:ct.rect,scrollableAncestors:Ze,scrollableAncestorRects:qt,windowRect:Be}),nn=Ee?ps(Ee,T):null,yt=uz(Ze),dn=K0(yt),Tt=K0(yt,[Ie]),Yt=ps(X,dn),Jt=at?DB(at,X):null,Rt=R&&Jt?f({active:R,collisionRect:Jt,droppableRects:fe,droppableContainers:Ke,pointerCoordinates:nn}):null,On=ev(Rt,"id"),[An,fn]=G(null),Fn=$e?X:ps(X,Tt),Nt=NB(Fn,(a=An?.rect)!=null?a:null,Ie),Vt=_(null),Bn=B((ie,pe)=>{let{sensor:et,options:gt}=pe;if($.current==null)return;let pn=I.get($.current);if(!pn)return;let ht=ie.nativeEvent,Zt=new et({active:$.current,activeNode:pn,event:ht,options:gt,context:dt,onAbort(bt){if(!I.get(bt))return;let{onDragAbort:ge}=te.current,vt={id:bt};ge?.(vt),y({type:"onDragAbort",event:vt})},onPending(bt,mn,ge,vt){if(!I.get(bt))return;let{onDragPending:ut}=te.current,tt={id:bt,constraint:mn,initialCoordinates:ge,offset:vt};ut?.(tt),y({type:"onDragPending",event:tt})},onStart(bt){let mn=$.current;if(mn==null)return;let ge=I.get(mn);if(!ge)return;let{onDragStart:vt}=te.current,Lt={activatorEvent:ht,active:{id:mn,data:ge.data,rect:N}};(0,gs.unstable_batchedUpdates)(()=>{vt?.(Lt),k(gi.Initializing),x({type:Nn.DragStart,initialCoordinates:bt,active:mn}),y({type:"onDragStart",event:Lt}),K(Vt.current),oe(ht)})},onMove(bt){x({type:Nn.DragMove,coordinates:bt})},onEnd:Wt(Nn.DragEnd),onCancel:Wt(Nn.DragCancel)});Vt.current=Zt;function Wt(bt){return async function(){let{active:ge,collisions:vt,over:Lt,scrollAdjustedTranslate:ut}=dt.current,tt=null;if(ge&&ut){let{cancelDrop:It}=te.current;tt={activatorEvent:ht,active:ge,collisions:vt,delta:ut,over:Lt},bt===Nn.DragEnd&&typeof It=="function"&&await Promise.resolve(It(tt))&&(bt=Nn.DragCancel)}$.current=null,(0,gs.unstable_batchedUpdates)(()=>{x({type:bt}),k(gi.Uninitialized),fn(null),K(null),oe(null),Vt.current=null;let It=bt===Nn.DragEnd?"onDragEnd":"onDragCancel";if(tt){let zn=te.current[It];zn?.(tt),y({type:It,event:tt})}})}}},[I]),oo=B((ie,pe)=>(et,gt)=>{let pn=et.nativeEvent,ht=I.get(gt);if($.current!==null||!ht||pn.dndKit||pn.defaultPrevented)return;let Zt={active:ht};ie(et,pe.options,Zt)===!0&&(pn.dndKit={capturedBy:pe.sensor},$.current=gt,Bn(et,pe))},[I,Bn]),zt=rz(c,oo);fz(c),ir(()=>{Ie&&w===gi.Initializing&&k(gi.Initialized)},[Ie,w]),q(()=>{let{onDragMove:ie}=te.current,{active:pe,activatorEvent:et,collisions:gt,over:pn}=dt.current;if(!pe||!et)return;let ht={active:pe,activatorEvent:et,collisions:gt,delta:{x:Yt.x,y:Yt.y},over:pn};(0,gs.unstable_batchedUpdates)(()=>{ie?.(ht),y({type:"onDragMove",event:ht})})},[Yt.x,Yt.y]),q(()=>{let{active:ie,activatorEvent:pe,collisions:et,droppableContainers:gt,scrollAdjustedTranslate:pn}=dt.current;if(!ie||$.current==null||!pe||!pn)return;let{onDragOver:ht}=te.current,Zt=gt.get(On),Wt=Zt&&Zt.rect.current?{id:Zt.id,rect:Zt.rect.current,data:Zt.data,disabled:Zt.disabled}:null,bt={active:ie,activatorEvent:pe,collisions:et,delta:{x:pn.x,y:pn.y},over:Wt};(0,gs.unstable_batchedUpdates)(()=>{fn(Wt),ht?.(bt),y({type:"onDragOver",event:bt})})},[On]),ir(()=>{dt.current={activatorEvent:O,active:R,activeNode:ae,collisionRect:Jt,collisions:Rt,droppableRects:fe,draggableNodes:I,draggingNode:Mt,draggingNodeRect:at,droppableContainers:E,over:An,scrollableAncestors:Ze,scrollAdjustedTranslate:Yt},N.current={initial:at,translated:Jt}},[R,ae,Rt,Jt,I,Mt,at,fe,E,An,Ze,Yt]),ez({...xe,delta:T,draggingRect:Jt,pointerCoordinates:nn,scrollableAncestors:Ze,scrollableAncestorRects:qt});let D=z(()=>({active:R,activeNode:ae,activeNodeRect:Ie,activatorEvent:O,collisions:Rt,containerNodeRect:st,dragOverlay:ct,draggableNodes:I,droppableContainers:E,droppableRects:fe,over:An,measureDroppableContainers:Ne,scrollableAncestors:Ze,scrollableAncestorRects:qt,measuringConfiguration:ve,measuringScheduled:Ae,windowRect:Be}),[R,ae,Ie,O,Rt,st,ct,I,E,fe,An,Ne,Ze,qt,ve,Ae,Be]),Y=z(()=>({activatorEvent:O,activators:zt,active:R,activeNodeRect:Ie,ariaDescribedById:{draggable:W},dispatch:x,draggableNodes:I,over:An,measureDroppableContainers:Ne}),[O,zt,R,Ie,x,W,I,An,Ne]);return un.createElement(W0.Provider,{value:C},un.createElement(ap.Provider,{value:Y},un.createElement(lw.Provider,{value:D},un.createElement(dw.Provider,{value:Nt},d)),un.createElement(Sz,{disabled:s?.restoreFocus===!1})),un.createElement(AB,{...s,hiddenTextDescribedById:W}));function de(){let ie=H?.autoScrollEnabled===!1,pe=typeof l=="object"?l.enabled===!1:l===!1,et=S&&!ie&&!pe;return typeof l=="object"?{...l,enabled:et}:{enabled:et}}}),kz=Ht(null),V0="button",Pz="Draggable";function uw(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=fs(Pz),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=sn(ap),{role:m=V0,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=sn(v?dw:kz),[y,C]=yc(),[w,k]=yc(),S=pz(i,t),L=Tl(n);ir(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:w,data:L}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let I=z(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":v&&m===V0?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[o,m,g,v,h,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:v,listeners:o?void 0:S,node:y,over:p,setNodeRef:C,setActivatorNodeRef:k,transform:x}}function fw(){return sn(lw)}var Az="Droppable",Ez={timeout:25};function pw(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=fs(Az),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=sn(ap),c=_({disabled:n}),f=_(!1),p=_(null),m=_(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Ez,...r},x=Tl(g??o),y=B(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),m.current=null},v)},[v]),C=rp({callback:y,disabled:h||!i}),w=B((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[k,S]=yc(w),L=Tl(t);return q(()=>{!C||!k.current||(C.disconnect(),f.current=!1,C.observe(k.current))},[k,C]),q(()=>(s({type:Nn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:k,rect:p,data:L}}),()=>s({type:Nn.UnregisterDroppable,key:a,id:o})),[o]),q(()=>{n!==c.current.disabled&&(s({type:Nn.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,s]),{active:i,rect:p,isOver:l?.id===o,node:k,over:l,setNodeRef:S}}me();function mw(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Mz(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function ip(e){return e!==null&&e>=0}function Rz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Nz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var gw=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=mw(t,o,n),i=t[r],s=a[r];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}};var sp={scaleX:1,scaleY:1},hw=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e,s=(t=a[n])!=null?t:o;if(!s)return null;if(r===n){let d=a[i];return d?{x:0,y:n<i?d.top+d.height-(s.top+s.height):d.top-s.top,...sp}:null}let l=_z(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...sp}:r<n&&r>=i?{x:0,y:s.height+l,...sp}:{x:0,y:0,...sp}};function _z(e,t,n){let o=e[t],r=e[t-1],a=e[t+1];return o?n<t?r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0:a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0:0}var vw="Sortable",xw=un.createContext({activeIndex:-1,containerId:vw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gw,disabled:{draggable:!1,droppable:!1}});function yw(e){let{children:t,id:n,items:o,strategy:r=gw,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=fw(),f=fs(vw,n),p=s.rect!==null,m=z(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),h=i!=null,g=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,x=_(m),y=!Rz(m,x.current),C=v!==-1&&g===-1||y,w=Nz(a);ir(()=>{y&&h&&c(m)},[y,m,h,c]),q(()=>{x.current=m},[m]);let k=z(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:Mz(m,l),strategy:r}),[g,f,w.draggable,w.droppable,C,m,v,l,p,r]);return un.createElement(xw.Provider,{value:k},t)}var Dz=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return mw(n,o,r).indexOf(t)},Oz=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!o||s!==a&&r===i?!1:n?!0:i!==r&&t===l},Fz={duration:200,easing:"ease"},Cw="transform",Bz=mi.Transition.toString({property:Cw,duration:0,easing:"linear"}),zz={roleDescription:"sortable"};function $z(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=G(null),s=_(n);return ir(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=xs(o.current,{ignoreTransform:!0}),c={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(c.x||c.y)&&i(c)}}n!==s.current&&(s.current=n)},[t,n,o,r]),q(()=>{a&&i(null)},[a]),a}function bw(e){let{animateLayoutChanges:t=Oz,attributes:n,disabled:o,data:r,getNewIndex:a=Dz,id:i,strategy:s,resizeObserverConfig:l,transition:d=Fz}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=sn(xw),C=Hz(o,m),w=c.indexOf(i),k=z(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=z(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:I,isOver:T,setNodeRef:E}=pw({id:i,data:k,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:A,activatorEvent:N,activeNodeRect:R,attributes:$,setNodeRef:H,listeners:K,isDragging:O,over:oe,setActivatorNodeRef:te,transform:W}=uw({id:i,data:k,attributes:{...zz,...n},disabled:C.draggable}),Ke=k0(E,H),ve=!!A,fe=ve&&!h&&ip(p)&&ip(v),Ne=!x&&O,Ae=Ne&&fe?W:null,Ee=fe?Ae??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:w}):null,xe=ip(p)&&ip(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,re=A?.id,Ie=_({activeId:re,items:c,newIndex:xe,containerId:f}),st=c!==Ie.current.items,dt=t({active:A,containerId:f,isDragging:O,isSorting:ve,id:i,index:w,items:c,newIndex:Ie.current.newIndex,previousItems:Ie.current.items,previousContainerId:Ie.current.containerId,transition:d,wasDragging:Ie.current.activeId!=null}),lt=$z({disabled:!dt,index:w,node:I,rect:L});return q(()=>{ve&&Ie.current.newIndex!==xe&&(Ie.current.newIndex=xe),f!==Ie.current.containerId&&(Ie.current.containerId=f),c!==Ie.current.items&&(Ie.current.items=c)},[ve,xe,f,c]),q(()=>{if(re===Ie.current.activeId)return;if(re!=null&&Ie.current.activeId==null){Ie.current.activeId=re;return}let Mt=setTimeout(()=>{Ie.current.activeId=re},50);return()=>clearTimeout(Mt)},[re]),{active:A,activeIndex:p,attributes:$,data:k,rect:L,index:w,newIndex:xe,items:c,isOver:T,isSorting:ve,isDragging:O,listeners:K,node:I,overIndex:v,over:oe,setNodeRef:Ke,setActivatorNodeRef:te,setDroppableNodeRef:E,setDraggableNodeRef:H,transform:lt??Ee,transition:ct()};function ct(){if(lt||st&&Ie.current.newIndex===w)return Bz;if(!(Ne&&!Cc(N)||!d)&&(ve||dt))return mi.Transition.toString({...d,property:Cw})}}function Hz(e,t){var n,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function lp(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var Uz=[pt.Down,pt.Right,pt.Up,pt.Left],Iw=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(Uz.includes(e.code)){if(e.preventDefault(),!n||!o)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let p=r.get(f.id);if(p)switch(e.code){case pt.Down:o.top<p.top&&l.push(f);break;case pt.Up:o.top>p.top&&l.push(f);break;case pt.Left:o.left>p.left&&l.push(f);break;case pt.Right:o.left<p.left&&l.push(f);break}});let d=Y0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=ev(d,"id");if(c===i?.id&&d.length>1&&(c=d[1].id),c!=null){let f=a.get(n.id),p=a.get(c),m=p?r.get(p.id):null,h=p?.node.current;if(h&&m&&f&&p){let v=Lc(h).some((S,L)=>s[L]!==S),x=Sw(f,p),y=Kz(f,p),C=v||!x?{x:0,y:0}:{x:y?o.width-m.width:0,y:y?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:ms(w,C)}}}};function Sw(e,t){return!lp(e)||!lp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Kz(e,t){return!lp(e)||!lp(t)||!Sw(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function qz(e,t,n){let o={...e};return t.top+e.y<=n.top?o.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(o.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?o.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(o.x=n.left+n.width-t.right),o}var ww=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:qz(n,t,r)},Tw=e=>{let{transform:t}=e;return{...t,x:0}};me();me();var dp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function Lw(e){return`(min-width: ${typeof e=="number"?e:dp[e]}px)`}function kw(e){return`(max-width: ${(typeof e=="number"?e:dp[e])-1}px)`}function Vz(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(Lw(e.min)),e.max!=null&&n.push(kw(e.max)),e.pointer==="coarse"&&n.push("(pointer: coarse)"),e.pointer==="fine"&&n.push("(pointer: fine)"),n.length===0?"(min-width: 0px)":n.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let n of e.split(":"))if(n.startsWith("max-")){let o=n.slice(4);o in dp&&t.push(kw(o))}else n in dp&&t.push(Lw(n));return t.length>0?t.join(" and "):e}function Wz(){return!1}function cp(e){let t=Vz(e),n=B(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=B(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return Sa(n,o,Wz)}me();var lo=new Map;function Gz(e,t,n){return`${e}\0${t}\0${n??"none"}`}function tv(e,t){lo.delete(e),lo.set(e,t)}function Al(e,t){if(lo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,lo.delete(e);for(let n of t.state.added)t.releaseUpload(n.id),URL.revokeObjectURL(n.previewUrl);for(let n of t.listeners)n()}}function jz(e){if(lo.size<=100)return;let t=Array.from(lo);for(let[n,o]of t){if(lo.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Al(n,o)}for(let[n,o]of t){if(lo.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Al(n,o)}}function up(){queueMicrotask(()=>jz())}function Pw(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Gz(e,n.intentId,a),s=lo.get(i);if(s)return s.releaseUpload=o.releaseUpload,s.watchAuthority=r,s.state;let l={key:i,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.text??"",retained:n.management?.attachments??[],added:[],saving:!1,error:null},d={state:l,listeners:new Set,releaseUpload:o.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return lo.set(i,d),l}function Aw(e,t){let n=lo.get(e);return n?(n.releaseAuthorityWatch===void 0&&n.watchAuthority!==void 0&&(n.releaseAuthorityWatch=n.watchAuthority({threadKey:n.state.inputKey,intentId:n.state.intentId,revision:n.state.revision,onInvalid:()=>Al(e,n)})),n.committed=!0,tv(e,n),n.listeners.add(t),up(),()=>{n.listeners.delete(t),up()}):()=>{}}function ys(e,t){let n=lo.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,tv(e,n);for(let r of n.listeners)r()}}function fp(e){return lo.get(e)?.state}function Ew(e){let t=lo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,tv(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Al(e,t);return}up()}}}function pp(e){let t=lo.get(e);t&&Al(e,t)}function Mw(e,t){let n=new Map(t.flatMap(o=>o.waiting&&o.management!==void 0?[[o.intentId,o.management.revision]]:[]));for(let[o,r]of lo)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Al(o,r);up()}function Rw({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=so(),c=Pw(n,o,e,a,i),f=Sa(A=>Aw(c.key,A),()=>fp(c.key)??c,()=>fp(c.key)??c),{key:p,text:m,retained:h,added:g,saving:v,error:x}=f,y=_(null),C=a.useUploadStatuses(),w=z(()=>h.map(A=>A.id),[h]),k=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;q(()=>{t===void 0&&(pp(p),l())},[t,p,l]);let L=()=>{v||(pp(p),l())},I=A=>{if(v||r||S)return;let N=null,R=[...g];for(let $ of A){let H=$.type||"application/octet-stream";if(h.length+R.length>=a.limits.maxAttachments||$.size===0||$.size>a.maxAttachmentBytes(H)){N=d("turnQueue.attachmentLimit",{name:$.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(H))});continue}let K=a.makeImageAttachment({id:a.randomUUID(),name:$.name,mimeType:H,sizeBytes:$.size,file:$});R.push(K),a.startUpload({environmentId:o,image:K})}ys(p,$=>({...$,added:R,error:N}))},T=async()=>{let A=fp(p);if(!A||A.saving||r||S||!A.text.trim()&&A.retained.length+A.added.length===0)return;let N=Ew(p);if(N!==null){ys(p,R=>({...R,saving:!0,error:null}));try{await a.awaitUploads(A.added.map($=>$.id));let R=a.getUploadedAttachments({environmentId:o,images:A.added});if(!R)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:A.text,attachments:[...A.retained,...R]}),pp(p),l()}catch(R){ys(p,$=>({...$,saving:!1,error:R instanceof Error?R.message:d("turnQueue.actionFailed")}))}finally{N()}}},E=[...h.map((A,N)=>({...A,previewUrl:k[N],added:!1})),...g.map(A=>({...A,added:!0}))];return u(wf,{open:!0,onOpenChange:A=>{A||L()},children:b(Pf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(kf,{children:[u(Af,{children:d("turnQueue.editTitle")}),u(Tf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:A=>{A.dataTransfer.types.includes("Files")&&A.preventDefault()},onDrop:A=>{A.dataTransfer.files.length&&(A.preventDefault(),A.stopPropagation(),I(Array.from(A.dataTransfer.files)))},children:[u(RI,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:A=>ys(p,N=>({...N,text:A.target.value})),onPaste:A=>{A.clipboardData.files.length&&(A.preventDefault(),I(Array.from(A.clipboardData.files)))},onKeyDown:A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&!A.nativeEvent.isComposing&&(A.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:E.map(A=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[A.type==="image"&&A.previewUrl?u("img",{src:A.previewUrl,alt:A.name,className:"size-12 rounded object-cover"}):u(Mo,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:A.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(A.sizeBytes)}),A.added&&C.get(A.id)!=="ready"?u("p",{children:d(C.get(A.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,A.added&&C.get(A.id)==="failed"?u(ne,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let N=g.find(R=>R.id===A.id);N&&a.retryUpload({environmentId:o,image:N})},children:d("turnQueue.retryUpload")}):null]}),u(ne,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:A.name}),disabled:v||S,onClick:()=>{A.added?(a.releaseUpload(A.id),A.previewUrl&&URL.revokeObjectURL(A.previewUrl),ys(p,N=>({...N,added:N.added.filter(R=>R.id!==A.id)}))):ys(p,N=>({...N,retained:N.retained.filter(R=>R.id!==A.id)}))},children:u(jt,{className:"size-3.5"})})]},A.id))}),u("input",{ref:y,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:A=>{I(Array.from(A.target.files??[])),A.target.value=""}}),b(ne,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>y.current?.click(),children:[u(Mo,{className:"size-4"}),d("turnQueue.addAttachments")]}),S?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,x?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),b(Lf,{children:[u(ne,{variant:"ghost",disabled:v,onClick:L,children:d("turnQueue.discardEdit")}),u(ne,{disabled:v||r||S||!m.trim()&&E.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function Nw(e,t){let n=e.find(a=>a.intentId===t.intentId);if(!n)return e;let o=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?o.length:o.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(o.splice(r,0,n),o)}function _w(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return Nw(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function Dw(e,t){if(!e.find(l=>l.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(l=>l.intentId===t.beforeIntentId))return{entries:e,settled:!0};let o=new Set(e.map(l=>l.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(l=>o.has(l));return e.filter(l=>r.has(l.intentId)).some((l,d)=>l.intentId!==a[d])?{entries:e,settled:!0}:{entries:Nw(e,t),settled:!1}}me();me();function Qz({entry:e,unavailable:t,onCancel:n}){let{t:o}=so(),r=_(!1),[a,i]=G(!1),[s,l]=G(!1),[d,c]=G(!1);q(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,i(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,i(!1)}}};return b("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[u("p",{className:"text-muted-foreground",children:o(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),u("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??o("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?u("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?d&&e.action==="abandon"?b("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),b("div",{className:"flex flex-wrap gap-2",children:[u(ne,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ne,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ne,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?c(!0):void f(),children:o(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,s?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function Ow({entries:e,unavailable:t,onCancel:n}){let{t:o}=so(),[r,a]=G(!1),i=Qr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(ne,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":i,onClick:()=>a(s=>!s),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:i,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(s=>u(Qz,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function nv({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=so(),i=_(!1),[s,l]=G(!1),[d,c]=G(!1),f=_(!1),[p,m]=G(!1),[h,g]=G(!1),[v,x]=G(null);q(()=>{e.paused||c(!1)},[e.paused]);let y=o?.[0];q(()=>{m(!1),x(null)},[y?.intentId,y?.status,y?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&y?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),k=async()=>{if(f.current||t||r===void 0||y===void 0)return;let T=y;f.current=!0,g(!0),x(null);try{await r(T),m(!1)}catch{x(T.intentId)}finally{f.current=!1,g(!1)}},S=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),L=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),I=async()=>{if(!(i.current||t||!e.paused)){i.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{i.current=!1,l(!1)}}};return b("div",{className:"mx-auto mb-2 flex w-full max-w-3xl flex-wrap items-start gap-2 rounded-md border border-warning/40 bg-background px-3 py-2 text-xs text-foreground","data-turn-queue-banner":!0,role:"status",children:[b("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[b("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:S}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:L}),e.paused&&C?u("p",{className:"text-muted-foreground",children:a("turnQueue.pausedUncertainDescription")}):null,t?u("p",{className:"text-muted-foreground",children:a("turnQueue.disconnected")}):null,d&&e.paused?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.resumeFailed")}):null,v!==null&&v===y?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ne,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(be,{children:[u(ne,{size:"xs",variant:"outline",disabled:h,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(DI,{open:p,onOpenChange:T=>{T||m(!1)},children:b($I,{className:"max-w-lg",children:[b(zI,{children:[u(HI,{children:a("turnQueue.stopWaiting")}),u(FI,{children:a("turnQueue.abandonDescription")})]}),b(BI,{children:[u(OI,{render:u(ne,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ne,{variant:"outline",disabled:h||t,onClick:()=>{k()},children:a(h?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(Ow,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var Xz=[Tw,ww];function Yz({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=so(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:h}=bw({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return b("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:mi.Transform.toString(p),transition:m},className:F("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",h&&"z-10 bg-accent shadow-md ring-1 ring-primary/50 ring-inset",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[n?u("span",{"aria-hidden":"true","data-queue-drop-position":n,className:F("pointer-events-none absolute inset-x-1 z-20 h-0.5 rounded-full bg-primary before:absolute before:-top-0.5 before:start-0 before:size-1.5 before:rounded-full before:bg-primary",n==="before"?"top-0":"bottom-0")}):null,u(ne,{ref:f,size:"icon-xs",variant:"ghost",className:F("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(xo,{className:"size-3.5"}):u(Ud,{className:"size-3.5"})}),i,h&&o?u("span",{"aria-hidden":"true","data-queue-drag-position":!0,className:"pointer-events-none absolute end-3 rounded bg-primary/10 px-2 py-1 font-medium text-primary tabular-nums",children:o}):null]})}function Fw({inputKey:e,entries:t,environmentId:n,unavailable:o,attachments:r,actions:a,onCancel:i}){let{t:s}=so(),l=cp("(prefers-reduced-motion: reduce)"),[d,c]=Sn("turn-queue:editing",e,null),[f,p]=Sn("turn-queue:pending",e,!1),m=Ln("turn-queue:pending-ref",e,!1),[h,g]=Sn("turn-queue:error",e,null),[v,x]=Sn("turn-queue:drag",e,null),[y,C]=Sn("turn-queue:move",e,null),w=Ln("turn-queue:reorder-ref",e,!1),[k,S]=Sn("turn-queue:feedback",e,null),L=G0(Zh(Pl,{activationConstraint:{distance:5}}),Zh(kl,{coordinateGetter:Iw,scrollBehavior:l?"auto":"smooth"})),I=z(()=>t.filter(O=>O.waiting),[t]),T=y?Dw(I,y.preview):null,E=T?.entries??I,A=o||f||y!==null,N=E.findIndex(O=>O.intentId===v?.activeId),R=E.findIndex(O=>O.intentId===v?.overId);q(()=>{Mw(e,t)},[t,e]),q(()=>{y!==null&&(o||y.acknowledged&&T?.settled)&&(w.current=!1,C(null),!o&&I.some(O=>O.intentId===y.preview.intentId)&&S({intentId:y.preview.intentId,kind:"saved"}))},[I,y,T?.settled,o]),q(()=>{if(k===null||k.kind==="failed")return;let O=window.setTimeout(()=>S(oe=>oe===k?null:oe),1600);return()=>window.clearTimeout(O)},[k]);let $=async O=>{if(!(m.current||w.current||o)){m.current=!0,p(!0),g(null),S(null);try{await O()}catch(oe){g(oe instanceof Error?oe.message:s("turnQueue.actionFailed"))}finally{m.current=!1,p(!1)}}},H=(O,oe)=>$(async()=>{let te=_w(I,O.intentId,oe);if(!(te===null||!O.management?.canReorder)){w.current=!0,C({preview:te,acknowledged:!1});try{await a.onReorder(O,oe),C(W=>W?.preview===te?{...W,acknowledged:!0}:W)}catch(W){throw w.current=!1,C(null),S({intentId:O.intentId,kind:"failed"}),W}}}),K=o?s("turnQueue.disconnected"):y!==null?s("turnQueue.saving"):v!==null?`${s("turnQueue.dragStarted")} ${R+1}/${E.length}`:k?.kind==="saved"?s("common.action.done"):k?.kind==="cancelled"?s("turnQueue.dragCancelled"):"";return b(be,{children:[E.length>0?b("section",{"aria-label":s("turnQueue.pendingMessages"),"data-turn-queue-dock":!0,className:"mx-auto mb-2 w-full max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-background/95 text-xs shadow-xs",children:[b("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[u("span",{className:"shrink-0",children:s("turnQueue.queued",{count:E.length})}),u("span",{role:"status","aria-live":v===null?"polite":"off","data-queue-reorder-status":y?"saving":k?.kind,className:F("min-w-0 truncate",k?.kind==="saved"&&"text-primary"),children:K})]}),u(cw,{sensors:L,collisionDetection:X0,modifiers:Xz,accessibility:{screenReaderInstructions:{draggable:s("turnQueue.dragInstructions")},announcements:{onDragStart:()=>s("turnQueue.dragStarted"),onDragOver:({over:O})=>{let oe=E.findIndex(te=>te.intentId===O?.id);return oe<0?void 0:`${s("turnQueue.dragStarted")} ${oe+1}/${E.length}`},onDragEnd:()=>s("turnQueue.dragFinished"),onDragCancel:()=>s("turnQueue.dragCancelled")}},onDragStart:({active:O})=>{let oe=E.find(te=>te.intentId===O.id);!oe?.management?.canReorder||A||(g(null),S(null),x({activeId:oe.intentId,overId:oe.intentId}))},onDragOver:({over:O})=>{let oe=E.find(te=>te.intentId===O?.id);oe&&x(te=>te&&{...te,overId:oe.intentId})},onDragCancel:()=>{v&&S({intentId:v.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:O,over:oe})=>{if(x(null),!oe||O.id===oe.id)return;let te=E.findIndex(fe=>fe.intentId===O.id),W=E.findIndex(fe=>fe.intentId===oe.id),Ke=E[te];if(!Ke?.management?.canReorder||W<0)return;let ve=E[W+(te<W?1:0)]?.intentId??null;H(Ke,ve)},children:u(yw,{items:E.map(O=>O.intentId),strategy:hw,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:E.map((O,oe)=>b(Yz,{entry:O,disabled:!O.management?.canReorder||A,reducedMotion:l,feedback:k?.intentId===O.intentId?k.kind:void 0,dropPosition:O.intentId===v?.overId&&N!==R?N<R?"after":"before":void 0,dragPosition:O.intentId===v?.activeId?`${R+1}/${E.length}`:void 0,children:[b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:O.text||s("turnQueue.attachmentsOnly")}),O.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(Mo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:O.attachmentNames.join(", ")})]}):null,O.pendingAction?u("p",{className:"text-muted-foreground",children:s(O.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,O.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:O.failure}):null]}),b("div",{className:F("flex shrink-0 items-center gap-0.5",O.intentId===v?.activeId&&"invisible"),children:[u(ne,{size:"icon-xs",variant:"ghost",disabled:!O.management||A||v!==null,"aria-label":s("turnQueue.editMessage"),title:s("turnQueue.editMessage"),onClick:()=>c(O),children:u(Xd,{className:"size-3.5"})}),O.management?.canSteer?u(ne,{size:"icon-xs",variant:"ghost",disabled:A||v!==null,"aria-label":s("turnQueue.steer"),title:s("turnQueue.steerDescription"),onClick:()=>{$(()=>a.onRun(O,"steer"))},children:u(Yd,{className:"size-3.5"})}):null,b(er,{children:[u(or,{render:u(ne,{size:"icon-xs",variant:"ghost",disabled:A||!O.management||v!==null,"aria-label":s("turnQueue.messageActions")}),children:u(Zo,{className:"size-4"})}),b(nr,{align:"end",children:[b(tr,{disabled:!O.management?.canReorder||oe===0,onClick:()=>{H(O,E[oe-1].intentId)},children:[u(Rd,{className:"size-4"}),s("turnQueue.moveUp")]}),b(tr,{disabled:!O.management?.canReorder||oe===E.length-1,onClick:()=>{H(O,E[oe+2]?.intentId??null)},children:[u(Ed,{className:"size-4"}),s("turnQueue.moveDown")]}),O.management?.canSteer?u(tr,{onClick:()=>{$(()=>a.onRun(O,"steer"))},children:s("turnQueue.steer")}):null,u(tr,{disabled:!O.management?.canRun,onClick:()=>{$(()=>a.onRun(O,"interrupt"))},children:s(O.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(di,{}),u(tr,{disabled:O.action!=="cancel",onClick:()=>{$(()=>i(O))},children:s("turnQueue.cancelMessage")})]})]})]})]},O.intentId))})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,d?u(Rw,{entry:d,current:t.find(O=>O.intentId===d.intentId),inputKey:e,environmentId:n,unavailable:A,attachments:r,watchEditorAuthority:a.watchEditorAuthority,onEdit:a.onEdit,onClose:()=>c(null)},`${e}\0${d.intentId}\0${d.management?.revision??"none"}`):null]})}me();var ov=220,Jz={opacity:0,transform:"translate3d(0, 4rem, 0)"},Zz={opacity:0,transform:"translate3d(0, 7rem, 0)"},Bw={opacity:1,transform:"none"},zw={transition:`transform ${ov}ms ease-in, opacity ${ov}ms ease-in`},e5={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function Hw({className:e,items:t}){let[n,o]=G(null),r=_(null),a=n!==null&&t.some(p=>p.id===n)?n:null;if(q(()=>()=>{r.current&&clearTimeout(r.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let s=t.slice(1),l=s.length>0,d=l&&a!==i.id,c=s[0],f=p=>{!p.onDismiss||a||(o(p.id),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,p.onDismiss?.()},ov))};return u("div",{className:F("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:F("relative flex flex-col-reverse",l?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[d&&c?u("div",{className:F("pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-2xl","chat-composer-banner-stack-cap border border-b-0 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",e5[c.variant],"transition-opacity duration-150 ease-out","group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0"),style:{width:"96%"},"aria-hidden":"true"}):null,u("div",{className:F("relative z-10",a===i.id?"pointer-events-none":null),style:{...zw,...a===i.id?Jz:Bw},children:u($w,{item:i,attached:!0,exiting:a===i.id,onDismissRequest:()=>f(i)})}),l?u("div",{"data-composer-banner-stack-expanded-items":"true",className:F("relative z-20 grid grid-rows-[0fr] transition-[grid-template-rows] duration-150 ease-out","group-hover/banner-stack:grid-rows-[1fr] group-focus-within/banner-stack:grid-rows-[1fr]"),children:u("div",{className:"min-h-0 overflow-hidden",children:u("div",{className:F("invisible pointer-events-none space-y-2 pb-2 opacity-0","translate-y-1 transform-gpu transition-[opacity,transform] duration-150 ease-out will-change-[opacity,transform]","group-hover/banner-stack:visible group-hover/banner-stack:pointer-events-auto group-hover/banner-stack:translate-y-0 group-hover/banner-stack:opacity-100","group-focus-within/banner-stack:visible group-focus-within/banner-stack:pointer-events-auto group-focus-within/banner-stack:translate-y-0 group-focus-within/banner-stack:opacity-100"),children:s.map(p=>u("div",{className:F(a===p.id?"pointer-events-none":null),style:{...zw,...a===p.id?Zz:Bw},children:u($w,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function $w({item:e,attached:t,exiting:n,onDismissRequest:o}){let r=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(ac,{variant:e.variant,role:"status",className:F("min-h-0 px-3 text-xs sm:px-4",t?"chat-composer-drawer-surface chat-composer-drawer-attached pt-1.5 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.25rem)]":"alert-glass rounded-[22px] py-1.5",e.className),"data-composer-banner-presentation":"compact","data-variant":e.variant,children:[e.icon,b(xh,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[u("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?b(ic,{className:F("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ne,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss notice",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]}):b(ac,{variant:e.variant,className:F(t?"chat-composer-drawer-surface chat-composer-drawer-attached px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.375rem)] text-xs sm:px-4":"alert-glass rounded-[22px]",e.className),"data-variant":e.variant,children:[e.icon,u(xh,{children:e.title}),e.description?u(Mf,{children:e.description}):null,e.actions||e.onDismiss?b(ic,{className:F(e.actionClassName,r?"max-sm:col-start-3 max-sm:row-start-1 max-sm:mt-0 max-sm:self-start":void 0),children:[e.actions,e.onDismiss?u(ne,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss warning",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]})}function Uw({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u(Hw,{className:"relative z-0",items:e});return u("div",{ref:r,"data-chat-composer-overlay":"true",className:o.active?"pointer-events-none absolute inset-0 z-20 flex items-center":"pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2",children:b("div",{ref:o.transitionGroupRef,className:"w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]",children:[b("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?b("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),i]}):i,b("div",{className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:o.composerTransitionName},children:[u("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-[22px]",children:u("div",{ref:o.composerAnchorRef,className:"relative z-10",children:n})}),u("div",{className:"min-h-0",children:t})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]})})}function Kw(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var t5=["image/gif","image/jpeg","image/png","image/webp"],n5=new Set(t5);function rv(e){return n5.has(e.toLowerCase())}function o5(e){return rv(e)?"image":"file"}var r5=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function av(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||r5.has(t)?"text":"file"}function iv(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function sv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return o5(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var a5=new Set(["claudeAgent","cursor","grok","dsh","acp"]),qw=e=>a5.has(e)?"in-session":"next-turn";function i5(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function s5(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function l5(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function kc(e){return`[${s5(i5(e))}](${l5(e)})`}me();var d5=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,c5=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var u5=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),f5=/^[A-Za-z][A-Za-z0-9+.-]*:/,p5=/^[A-Za-z]:[\\/]/,m5=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function g5(e){let t=[];for(let n of e.matchAll(u5)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),i=n[3]??"",s=i;try{s=decodeURIComponent(i)}catch{}let l=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\")),d=l>=0?s.slice(l+1):s,c=f5.test(s)&&!p5.test(s);if(!s||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(c5)){let o=n[0],r=n[1]??"",a=n[2],i=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!i||a===void 0&&m5.test(i))continue;let s=(n.index??0)+r.length,l=s+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(s,l),start:s,end:l})}return t}function Pc(e,t={}){let n=g5(e);for(let o of e.matchAll(d5)){let r=o[0],a=o[1]??"",i=o[2]??"";if(!i)continue;let s=(o.index??0)+a.length,l=s+r.length-a.length;n.push({type:"skill",value:i,source:e.slice(s,l),start:s,end:l})}for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function h5(e){return e.replace(/\r\n/g,`
3694
- `).replace(/^\n+|\n+$/g,"")}function v5(e){return h5(e.text).length>0}function Vw(e){return!v5(e)}function x5(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function Ww(e){return`${e.terminalLabel} (${x5(e)})`}function Gw(e,t,n){return e<=n&&n<t}function jw(e,t){if(!t)return;let n=e[e.length-1];if(n&&n.type==="text"){n.text+=t;return}e.push({type:"text",text:t})}function Qw(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]==="\uFFFC"){if(o>n&&t({type:"text",text:e.slice(n,o),promptOffset:n})===!0||t({type:"terminal-context",promptOffset:o})===!0)return!0;n=o+1}return n<e.length&&t({type:"text",text:e.slice(n),promptOffset:n})===!0}function y5(e,t){return Qw(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function C5(e,t){return y5(e,(n,o)=>{for(let r of Pc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function b5(e){let t=[];if(!e)return t;let n=Pc(e),o=0;for(let r of n)r.start<o||(r.start>o&&jw(t,e.slice(o,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),o=r.end);return o<e.length&&jw(t,e.slice(o)),t}function lv(e,t,n){return!e||t>=n?!1:C5(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&Gw(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&Gw(t,n,l))})}function Cs(e,t=[]){if(!e)return[];let n=[],o=0;return Qw(e,r=>r.type==="text"?(n.push(...b5(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function Yw(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:"foreground"}var Xw=e=>e.type!=="text";function dv(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function I5(e){return e===" "||e===`
3695
- `||e===" "||e==="\r"||e==="\uFFFC"}function S5(e,t){let n=t-1;for(;n>=0&&!I5(e[n]??"");)n-=1;return n+1}function Lr(e,t){let n=dv(e,t),o=Cs(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="skill"){let l=i.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Jw(e){return e.type==="text"?e.text.length:1}function Zw(e,t){let n=e.reduce((o,r)=>o+Jw(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function lr(e,t){return Zw(Cs(e),t)}function dr(e,t){let n=dv(e,t),o=Cs(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="skill"){let l=i.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Ac(e,t,n){let o=Cs(e);if(!o.some(Xw))return!1;let r=Zw(o,t),a=0;for(let i of o){if(Xw(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=Jw(i)}return!1}function cr(e,t){let n=dv(e,t),o=e.lastIndexOf(`
3696
- `,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let s=/^\/(\S*)$/.exec(r);if(s)return{kind:"slash-command",query:s[1]??"",rangeStart:o,rangeEnd:n}}let a=S5(e,n),i=e.slice(a,n);return i.startsWith("$")?{kind:"skill",query:i.slice(1),rangeStart:a,rangeEnd:n}:i.startsWith("@")?{kind:"path",query:i.slice(1),rangeStart:a,rangeEnd:n}:null}function eT(e,t,n,o){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,n));return{text:`${e.slice(0,r)}${o}${e.slice(a)}`,cursor:r+o.length}}var tT="Ask for changes, send follow-ups, or attach images";var nT="application/x-ycodium-composer-mention";function cv(e){return e.includes(nT)}function oT(e){let t=n=>cv(n.dataTransfer.types)?(n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(n){t(n)&&e.setDragActive(!0)},onDragOver(n){t(n)&&(n.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(n){if(!t(n))return;e.setDragActive(!1);let o=n.dataTransfer.getData(nT);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}me();var uv=ue(function(t){let{t:n}=_e();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:F("text-[10px] font-medium leading-none tabular-nums",t.pulsing?"animate-[prompt-stash-count-enter_180ms_ease-out_both] text-primary motion-reduce:animate-none":"text-muted-foreground"),children:t.count},t.pulseKey);return o?b(ne,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("shrink-0 gap-1 px-1.5",(t.menuOpen||t.pulsing)&&"[--control-icon-color:currentColor] text-foreground"),onPointerDown:a=>a.preventDefault(),onClick:t.onToggleMenu,children:[u(fl,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):b("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-t-xl border border-b-0 px-3 pb-1 text-xs leading-none","transition-colors duration-(--control-duration)",t.menuOpen&&"pointer-events-none",t.menuOpen||t.pulsing?"text-foreground":"text-muted-foreground hover:text-foreground"),onPointerDown:a=>{a.preventDefault()},onClick:t.onToggleMenu,children:[u(fl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});me();function w5(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function T5(e){let t=w5(e);if(!t)return null;let n=Date.now()-t.getTime();if(n<0)return{value:"just now",suffix:null};let o=Math.floor(n/1e3);if(o<60)return{value:"just now",suffix:null};let r=Math.floor(o/60);if(r<60)return{value:`${r}m`,suffix:"ago"};let a=Math.floor(r/60);return a<24?{value:`${a}h`,suffix:"ago"}:{value:`${Math.floor(a/24)}d`,suffix:"ago"}}function rT(e){let t=T5(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}me();var aT=Ht(null),iT=aT.Provider;function Ot(){let e=sn(aT);if(e===null)throw new Error("Composer API has not been provided.");return e}var sT=90;function lT(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function L5(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>sT?`${n.slice(0,sT)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var dT=ue(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=_e(),s=Ot(),l=_(null),[d,c]=G(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return q(()=>{let p=m=>{let h=l.current;h&&m.composedPath().includes(h)||m.target instanceof Element&&m.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),q(()=>{n.length!==0&&(n.some(p=>p.id===d)||c(n[0]?.id??null))},[n,d]),s.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(n.length===0)return;p.preventDefault(),p.stopPropagation();let m=n.findIndex(x=>x.id===d),h=p.key==="ArrowDown"?1:-1,v=((m>=0?m:h===1?-1:0)+h+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(Nf,{autoHighlight:!1,mode:"none",children:b("div",{ref:l,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[u("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:u(ne,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(jt,{className:"size-3"})})}),u(Of,{className:"max-h-64 scroll-pb-6",children:u(_f,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>b(Df,{value:p.id,className:F("group/stash relative cursor-pointer select-none gap-3 rounded-lg px-3 py-1.5! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",d===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{d!==p.id&&c(p.id)},onMouseDown:m=>{m.preventDefault()},onClick:()=>{o(p)},children:[u("span",{className:"min-w-0 flex-1 truncate text-xs",children:L5(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):lT(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:lT(p)})}):null,p.attachments.length>0?u("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(m=>u("img",{src:m.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},m.id))}):null,u("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:rT(p.createdAt)}),u(ne,{variant:"ghost",size:"icon-xs",className:"pointer-events-none shrink-0 [--control-icon-color:currentColor] opacity-0 shadow-none! transition-opacity pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 group-hover/stash:pointer-events-auto group-hover/stash:opacity-100 group-focus-within/stash:pointer-events-auto group-focus-within/stash:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100","aria-label":i("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(jt,{className:"stroke-2"})})]},p.id))})})]})})});me();function uT(e){let t=new Map;return e.map(n=>{let o=t.get(n.step)??0;return t.set(n.step,o+1),{key:`${n.step}:${o}`,step:n}})}function cT({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:F("flex w-10 shrink-0 items-center gap-0.5",e),children:uT(t).map(({key:n,step:o})=>u("span",{className:F("h-[3px] min-w-0 flex-1 rounded-full",o.status==="completed"?"bg-success":o.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},n))})}var fv=ue(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=_e();if(i.totalSteps<=0)return null;let d=i.completedSteps>=i.totalSteps,c=l("tasksBadge.ariaLabel",{completed:i.completedSteps,total:i.totalSteps,step:i.step});return a==="inline"?b("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[b(ne,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":c,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Ji,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(cT,{steps:s}),b("span",{className:F("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:F("chat-composer-shoulder-tab chat-composer-tasks-tab absolute -top-7 left-4 z-0 flex h-8 items-center gap-1 rounded-t-xl border border-b-0 px-2 pb-1 text-xs leading-none text-muted-foreground",n?"right-28":"right-4",d&&"text-foreground"),"data-composer-tasks-badge":"true",children:[b("button",{type:"button","aria-expanded":t,"aria-label":c,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Ji,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:"Tasks"}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:i.step}),b("span",{className:F("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(cT,{className:"w-20",steps:s})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]})}),fT=ue(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=_e();return b("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[b("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[b("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:n,onPointerDown:i=>i.preventDefault(),children:[u(Ji,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),b("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:uT(r).map(({key:i,step:s})=>b("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:F("w-3 shrink-0 text-center font-mono text-[10px]",s.status==="completed"?"text-success":s.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:s.status==="completed"?"\u2713":s.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0 flex-1",s.status==="completed"?"text-muted-foreground/55":s.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:s.step}),u("span",{className:"ml-auto w-10 shrink-0 text-right text-[10px] text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:s.durationMs!==void 0?ls(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function pT(e){let t=0,n=0;for(let o of e.imageIds){let r=e.uploadsByImageId[o];r?.status==="failed"&&r.environmentId===e.environmentId?n+=1:(r?.status!=="ready"||r.environmentId!==e.environmentId)&&(t+=1)}return n>0?n===1?"Retry or remove the failed image":"Retry or remove the failed images":t>0?t===1?"Image still uploading":"Images still uploading":null}function mp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function mT(e){switch(e){case"image":return Yi;case"pdf":return Xi;case"text":return Qi;case"file":return Mo}}var gT="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",hT=`${gT} border border-border/70 bg-accent/40 text-foreground`,k5=`${hT} text-[12px]`,vi=`${hT} text-[0.86em] select-none`,gp="relative inline-flex align-[-0.125em] leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']",na="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",vT="truncate leading-tight",oa="block self-center truncate leading-tight select-none",xT=`${gT} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,yT='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',hp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";function P5(e,t,n){let o=[];o.push(t(e));let r=n(e);return r&&o.push(r),e.pageUrl&&o.push(e.pageUrl),e.selector&&o.push(e.selector),e.htmlPreview.trim().length>0&&(o.push(""),o.push(e.htmlPreview.trim().slice(0,600))),o.join(`
3697
- `)}function A5({context:e,onRemove:t}){let{t:n}=_e(),o=Ot().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Xe,{children:[u(Je,{render:b("span",{className:F(vi,"pr-1"),children:[u(Jr,{className:F(na,"size-icon-1")}),u("span",{className:oa,children:r}),a?u("span",{className:"select-none text-[10px] font-normal leading-tight text-muted-foreground/85",children:a}):null,u("button",{type:"button","aria-label":n("pendingContext.removeElement",{label:r}),className:hp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]})}),u(Ye,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:P5(e,o.formatLabel,o.formatSourceLabel)})]})}function CT({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(o=>u(A5,{context:o,onRemove:t},o.id))})}function bT({comments:e,onRemove:t,className:n}){let{t:o}=_e();return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:F(vi,"pr-1"),children:[u(Zi,{className:F(na,"size-icon-1")}),u("span",{className:oa,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:hp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Xe,{children:[u(Je,{render:i}),u(Ye,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function vp(e){let t=`${e.count} ${e.label}${e.count===1?"":"s"}`;return b(Xe,{children:[u(Je,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Ye,{side:"top",children:t})]})}function IT({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=_e(),l=Ot().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:F("flex flex-wrap gap-1.5",i),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(h=>{let g=l.normalizeSelection(h.element);return g?[{id:h.id,label:l.formatLabel(g)}]:[]});return b("section",{className:"group/preview-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[f?.previewUrl?u("button",{type:"button","aria-label":s("previewAnnotation.previewImage",{name:f.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>o(f.id),children:u("img",{src:f.previewUrl,alt:s("previewAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/preview-annotation:scale-[1.03]"})}):u("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:u(Jr,{className:"size-icon-2"})}),b("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[c.comment.trim()?u("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:c.comment.trim()}):null,b("div",{className:F("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?b("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:h,label:g})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:g},h)),m.length>2?b("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,b("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(vp,{icon:u(Jr,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(vp,{icon:u(zd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(vp,{icon:u(Zr,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(vp,{icon:u(ts,{className:"size-3"}),count:c.styleChanges.length,label:"style change"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:mp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Xe,{children:[u(Je,{render:u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":`Retry upload for ${f.name}`,onClick:()=>a(f)}),children:u(os,{className:"size-3"})}),u(Ye,{side:"top",children:p.reason})]}):null]})]})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":s("previewAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>n(c.id),children:u(jt,{className:"size-3"})})]},c.id)})})}me();function ST(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function wT(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function TT(e,t){let n=Ot().pane.useVisible(),[o,r]=G(null);ye(()=>{if(!n)return;let i=e.current;if(!i)return;let s=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!s)return;let p=f.find(v=>v.target===i);if(!p)return;let m=window.getComputedStyle(i),h=Number.parseFloat(m.paddingLeft)||0,g=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+h+g))});return c.observe(i),()=>{s=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,s&&r(i.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{s=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=ST(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&wT(o,{hasWideActions:t})}}var pv={};Tn(pv,{LexicalComposerContext:()=>LT,createLexicalComposerContext:()=>E5,useLexicalComposerContext:()=>M5});me();var LT=Ht(null);function E5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function M5(){let e=sn(LT);return e==null&&(function(t,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of n)r.append("v",a);throw o.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var mv=pv,kT=mv.LexicalComposerContext,PT=mv.createLexicalComposerContext,Cn=mv.useLexicalComposerContext;var Kx={};Tn(Kx,{$addUpdateTag:()=>nm,$applyNodeReplacement:()=>eu,$caretFromPoint:()=>ki,$caretRangeFromSelection:()=>tx,$cloneWithProperties:()=>Ox,$cloneWithPropertiesEphemeral:()=>mH,$comparePointCaretNext:()=>$x,$copyNode:()=>_x,$create:()=>hH,$createLineBreakNode:()=>Bl,$createNodeSelection:()=>yx,$createParagraphNode:()=>Da,$createPoint:()=>Rr,$createRangeSelection:()=>xk,$createRangeSelectionFromDom:()=>K$,$createTabNode:()=>Xp,$createTextNode:()=>Wn,$extendCaretToRange:()=>Bx,$findMatchingParent:()=>Dc,$getAdjacentChildCaret:()=>Wl,$getAdjacentNode:()=>Bk,$getAdjacentSiblingOrParentSiblingCaret:()=>wH,$getCaretInDirection:()=>Pi,$getCaretRange:()=>Li,$getCaretRangeInDirection:()=>Ux,$getCharacterOffsets:()=>Gv,$getChildCaret:()=>Fa,$getChildCaretAtIndex:()=>Zk,$getChildCaretOrSelf:()=>jk,$getCollapsedCaretRange:()=>Qk,$getCommonAncestor:()=>Oc,$getCommonAncestorResultBranchOrder:()=>Hx,$getEditor:()=>Dx,$getNearestNodeFromDOMNode:()=>tm,$getNearestRootOrShadowRoot:()=>Hk,$getNodeByKey:()=>Dn,$getNodeByKeyOrThrow:()=>Uk,$getNodeFromDOMNode:()=>kx,$getPreviousSelection:()=>Ms,$getRoot:()=>$o,$getSelection:()=>St,$getSiblingCaret:()=>Yn,$getState:()=>Ap,$getStateChange:()=>d$,$getTextContent:()=>W$,$getTextNodeOffset:()=>Mr,$getTextPointCaret:()=>Ti,$getTextPointCaretSlice:()=>Zv,$getWritableNodeState:()=>ax,$hasAncestor:()=>qp,$hasUpdateTag:()=>dH,$insertNodes:()=>V$,$isBlockElementNode:()=>U$,$isChildCaret:()=>Er,$isDecoratorNode:()=>Qt,$isEditorState:()=>X$,$isElementNode:()=>Q,$isExtendableTextPointCaret:()=>Jk,$isInlineElementOrDecoratorNode:()=>cH,$isLeafNode:()=>iH,$isLineBreakNode:()=>ws,$isNodeCaret:()=>yH,$isNodeSelection:()=>Xc,$isParagraphNode:()=>Tk,$isRangeSelection:()=>He,$isRootNode:()=>eo,$isRootOrShadowRoot:()=>fr,$isSiblingCaret:()=>Es,$isTabNode:()=>xx,$isTextNode:()=>Me,$isTextPointCaret:()=>Oa,$isTextPointCaretSlice:()=>SH,$isTokenOrSegmented:()=>Ra,$isTokenOrTab:()=>Ci,$nodesOfType:()=>lH,$normalizeCaret:()=>Pr,$normalizeSelection__EXPERIMENTAL:()=>Ep,$onUpdate:()=>$k,$parseSerializedNode:()=>Q$,$removeTextFromCaretRange:()=>Yk,$rewindSiblingCaret:()=>Xl,$selectAll:()=>sH,$setCompositionKey:()=>jn,$setPointFromCaret:()=>Gl,$setSelection:()=>_o,$setSelectionFromCaretRange:()=>Xk,$setState:()=>c$,$splitAtPointCaretNext:()=>kH,$splitNode:()=>uH,$updateRangeSelectionFromCaretRange:()=>Fc,ArtificialNode__DO_NOT_USE:()=>Up,BEFORE_INPUT_COMMAND:()=>sx,BLUR_COMMAND:()=>YL,CAN_REDO_COMMAND:()=>I$,CAN_UNDO_COMMAND:()=>S$,CLEAR_EDITOR_COMMAND:()=>C$,CLEAR_HISTORY_COMMAND:()=>b$,CLICK_COMMAND:()=>_L,COLLABORATION_TAG:()=>lk,COMMAND_PRIORITY_CRITICAL:()=>tH,COMMAND_PRIORITY_EDITOR:()=>Rl,COMMAND_PRIORITY_HIGH:()=>eH,COMMAND_PRIORITY_LOW:()=>J$,COMMAND_PRIORITY_NORMAL:()=>Z$,COMPOSITION_END_COMMAND:()=>cx,COMPOSITION_END_TAG:()=>fk,COMPOSITION_START_COMMAND:()=>dx,COMPOSITION_START_TAG:()=>uk,CONTROLLED_TEXT_INSERTION_COMMAND:()=>_l,COPY_COMMAND:()=>gx,CUT_COMMAND:()=>hx,DELETE_CHARACTER_COMMAND:()=>Hc,DELETE_LINE_COMMAND:()=>Kc,DELETE_WORD_COMMAND:()=>Uc,DRAGEND_COMMAND:()=>QL,DRAGOVER_COMMAND:()=>jL,DRAGSTART_COMMAND:()=>GL,DROP_COMMAND:()=>WL,DecoratorNode:()=>Vc,ElementNode:()=>Si,FOCUS_COMMAND:()=>XL,FORMAT_ELEMENT_COMMAND:()=>y$,FORMAT_TEXT_COMMAND:()=>xi,HISTORIC_TAG:()=>M$,HISTORY_MERGE_TAG:()=>Lp,HISTORY_PUSH_TAG:()=>R$,INDENT_CONTENT_COMMAND:()=>v$,INPUT_COMMAND:()=>lx,INSERT_LINE_BREAK_COMMAND:()=>Rc,INSERT_PARAGRAPH_COMMAND:()=>Fv,INSERT_TAB_COMMAND:()=>h$,INTERNAL_$isBlock:()=>_a,IS_ALL_FORMATTING:()=>q5,IS_BOLD:()=>F5,IS_CODE:()=>H5,IS_HIGHLIGHT:()=>nx,IS_ITALIC:()=>B5,IS_STRIKETHROUGH:()=>z5,IS_SUBSCRIPT:()=>U5,IS_SUPERSCRIPT:()=>K5,IS_UNDERLINE:()=>$5,KEY_ARROW_DOWN_COMMAND:()=>$L,KEY_ARROW_LEFT_COMMAND:()=>FL,KEY_ARROW_RIGHT_COMMAND:()=>DL,KEY_ARROW_UP_COMMAND:()=>zL,KEY_BACKSPACE_COMMAND:()=>UL,KEY_DELETE_COMMAND:()=>qL,KEY_DOWN_COMMAND:()=>mx,KEY_ENTER_COMMAND:()=>Dp,KEY_ESCAPE_COMMAND:()=>KL,KEY_MODIFIER_COMMAND:()=>JL,KEY_SPACE_COMMAND:()=>HL,KEY_TAB_COMMAND:()=>VL,LineBreakNode:()=>Fl,MOVE_TO_END:()=>OL,MOVE_TO_START:()=>BL,NODE_STATE_KEY:()=>o$,OUTDENT_CONTENT_COMMAND:()=>x$,PASTE_COMMAND:()=>ux,PASTE_TAG:()=>N$,ParagraphNode:()=>Hl,REDO_COMMAND:()=>px,REMOVE_TEXT_COMMAND:()=>Bv,RootNode:()=>$l,SELECTION_CHANGE_COMMAND:()=>ix,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>g$,SELECT_ALL_COMMAND:()=>zv,SKIP_COLLAB_TAG:()=>_$,SKIP_DOM_SELECTION_TAG:()=>ck,SKIP_SCROLL_INTO_VIEW_TAG:()=>dk,SKIP_SELECTION_FOCUS_TAG:()=>Vv,TEXT_TYPE_TO_FORMAT:()=>co,TabNode:()=>zl,TextNode:()=>ks,UNDO_COMMAND:()=>fx,addClassNamesToElement:()=>NH,buildImportMap:()=>E$,configExtension:()=>AH,createCommand:()=>je,createEditor:()=>nH,createSharedNodeState:()=>PL,createState:()=>l$,declarePeerDependency:()=>EH,defineExtension:()=>PH,flipDirection:()=>Ai,getDOMOwnerDocument:()=>Rx,getDOMSelection:()=>_r,getDOMSelectionFromTarget:()=>Kk,getDOMTextNode:()=>As,getEditorPropertyFromDOMNode:()=>Jc,getNearestEditorFromDOMNode:()=>Lx,getRegisteredNode:()=>wx,getRegisteredNodeOrThrow:()=>Sx,getStaticNodeConfig:()=>tu,getTextDirection:()=>aH,getTransformSetFromKlass:()=>kk,isBlockDomNode:()=>Yv,isCurrentlyReadOnlyMode:()=>jl,isDOMDocumentNode:()=>Ek,isDOMNode:()=>Ql,isDOMTextNode:()=>ia,isDOMUnmanaged:()=>Gk,isDocumentFragment:()=>qk,isExactShortcutMatch:()=>At,isHTMLAnchorElement:()=>fH,isHTMLElement:()=>So,isInlineDomNode:()=>Vk,isLexicalEditor:()=>Zp,isModifierMatch:()=>Fk,isSelectionCapturedInDecoratorInput:()=>Tx,isSelectionWithinEditor:()=>Yc,makeStepwiseIterator:()=>zx,mergeRegister:()=>DH,normalizeClassNames:()=>nu,removeClassNamesFromElement:()=>_H,removeFromParent:()=>bi,resetRandomKey:()=>oH,safeCast:()=>MH,setDOMUnmanaged:()=>gH,setNodeIndentFromDOM:()=>Wk,shallowMergeConfig:()=>RH,toggleTextFormatType:()=>Gc});function ee(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function CL(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);n.search=o.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Nr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,R5=Nr&&"documentMode"in document?document.documentMode:null,kr=Nr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ii=Nr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Pp=!(!Nr||!("InputEvent"in window)||R5)&&"getTargetRanges"in new window.InputEvent("input"),Wp=Nr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Qc=Nr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,N5=Nr&&/Android/.test(navigator.userAgent),bL=Nr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Tv=Nr&&N5&&bL,Gp=Nr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&kr&&!bL,_5=0,D5=1,O5=2,F5=1,B5=2,z5=4,$5=8,H5=16,U5=32,K5=64,nx=128,q5=2047,V5=1,W5=2,G5=3,j5=4,Q5=5,X5=6,Bc=Wp||Qc||Gp?"\xA0":"\u200B",jp=`
3693
+ `},EB={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function MB(e){let{announcements:t=EB,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=AB}=e,{announce:a,announcement:i}=_0(),s=us("DndLiveRegion"),[l,d]=G(!1);if(q(()=>{d(!0)},[]),kB(z(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=hn.createElement(hn.Fragment,null,hn.createElement(R0,{id:o,value:r.draggable}),hn.createElement(N0,{id:s,announcement:i}));return n?(0,ms.createPortal)(c,n):c}var On;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(On||(On={}));function ep(){}function Zh(e,t){return z(()=>({sensor:e,options:t??{}}),[e,t])}function j0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>[...t].filter(o=>o!=null),[...t])}var br=Object.freeze({x:0,y:0});function Q0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function X0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function RB(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function D0(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function ev(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function O0(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Y0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=O0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=Q0(O0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(X0)},J0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=D0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=D0(l),c=r.reduce((p,m,h)=>p+Q0(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(X0)};function NB(e,t){let n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=r-o,s=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=i*s,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var _B=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:i}=a,s=n.get(i);if(s){let l=NB(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(RB)};function DB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Z0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:br}function OB(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}var FB=OB(1);function BB(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function zB(e,t,n){let o=BB(t);if(!o)return e;let{scaleX:r,scaleY:a,x:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),d=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:d,right:l+c,bottom:d+f,left:l}}var $B={ignoreTransform:!1};function vs(e,t){t===void 0&&(t=$B);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Lo(e).getComputedStyle(e);d&&(n=zB(n,d,c))}let{top:o,left:r,width:a,height:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function F0(e){return vs(e,{ignoreTransform:!0})}function HB(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function UB(e,t){return t===void 0&&(t=Lo(e).getComputedStyle(e)),t.position==="fixed"}function KB(e,t){t===void 0&&(t=Lo(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?n.test(a):!1})}function Ic(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(Xf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!bl(r)||qh(r)||n.includes(r))return n;let a=Lo(e).getComputedStyle(r);return r!==e&&KB(r,a)&&n.push(r),UB(r,a)?n:o(r.parentNode)}return e?o(e):n}function ew(e){let[t]=Ic(e,1);return t??null}function Vh(e){return!mc||!e?null:ds(e)?e:Qf(e)?Xf(e)||e===cs(e).scrollingElement?window:bl(e)?e:null:null}function tw(e){return ds(e)?e.scrollX:e.scrollLeft}function nw(e){return ds(e)?e.scrollY:e.scrollTop}function jh(e){return{x:tw(e),y:nw(e)}}var Gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Gn||(Gn={}));function ow(e){return!mc||!e?!1:e===document.scrollingElement}function rw(e){let t={x:0,y:0},n=ow(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=o.y,s=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:i,isRight:s,maxScroll:o,minScroll:t}}var qB={x:.2,y:.2};function VB(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=qB);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=rw(e),m={x:0,y:0},h={x:0,y:0},g={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+g.height?(m.y=Gn.Backward,h.y=o*Math.abs((t.top+g.height-a)/g.height)):!c&&l>=t.bottom-g.height&&(m.y=Gn.Forward,h.y=o*Math.abs((t.bottom-g.height-l)/g.height)),!p&&s>=t.right-g.width?(m.x=Gn.Forward,h.x=o*Math.abs((t.right-g.width-s)/g.width)):!f&&i<=t.left+g.width&&(m.x=Gn.Backward,h.x=o*Math.abs((t.left+g.width-i)/g.width)),{direction:m,speed:h}}function WB(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function aw(e){return e.reduce((t,n)=>fs(t,jh(n)),br)}function GB(e){return e.reduce((t,n)=>t+tw(n),0)}function jB(e){return e.reduce((t,n)=>t+nw(n),0)}function QB(e,t){if(t===void 0&&(t=vs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);ew(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var XB=[["x",["left","right"],GB],["y",["top","bottom"],jB]],yc=class{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let o=Ic(n),r=aw(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of XB)for(let l of i)Object.defineProperty(this,l,{get:()=>{let d=s(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},gs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}};function YB(e){let{EventTarget:t}=Lo(e);return e instanceof t?e:cs(e)}function Wh(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var ar;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ar||(ar={}));function B0(e){e.preventDefault()}function JB(e){e.stopPropagation()}var mt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(mt||(mt={}));var iw={start:[mt.Space,mt.Enter],cancel:[mt.Esc],end:[mt.Space,mt.Enter,mt.Tab]},ZB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case mt.Right:return{...n,x:n.x+25};case mt.Left:return{...n,x:n.x-25};case mt.Down:return{...n,y:n.y+25};case mt.Up:return{...n,y:n.y-25}}},wl=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:n}}=t;this.props=t,this.listeners=new gs(cs(n)),this.windowListeners=new gs(Lo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ar.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&QB(o),n(br)}handleKeyDown(t){if(hc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=iw,coordinateGetter:i=ZB,scrollBehavior:s="smooth"}=r,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:d}=o.current,c=d?{x:d.left,y:d.top}:br;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=ps(f,c),m={x:0,y:0},{scrollableAncestors:h}=o.current;for(let g of h){let v=t.code,{isTop:x,isRight:y,isLeft:C,isBottom:w,maxScroll:k,minScroll:S}=rw(g),L=WB(g),I={x:Math.min(v===mt.Right?L.right-L.width/2:L.right,Math.max(v===mt.Right?L.left:L.left+L.width/2,f.x)),y:Math.min(v===mt.Down?L.bottom-L.height/2:L.bottom,Math.max(v===mt.Down?L.top:L.top+L.height/2,f.y))},T=v===mt.Right&&!y||v===mt.Left&&!C,E=v===mt.Down&&!w||v===mt.Up&&!x;if(T&&I.x!==f.x){let A=g.scrollLeft+p.x,N=v===mt.Right&&A<=k.x||v===mt.Left&&A>=S.x;if(N&&!p.y){g.scrollTo({left:A,behavior:s});return}N?m.x=g.scrollLeft-A:m.x=v===mt.Right?g.scrollLeft-k.x:g.scrollLeft-S.x,m.x&&g.scrollBy({left:-m.x,behavior:s});break}else if(E&&I.y!==f.y){let A=g.scrollTop+p.y,N=v===mt.Down&&A<=k.y||v===mt.Up&&A>=S.y;if(N&&!p.x){g.scrollTo({top:A,behavior:s});return}N?m.y=g.scrollTop-A:m.y=v===mt.Down?g.scrollTop-k.y:g.scrollTop-S.y,m.y&&g.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,fs(ps(f,this.referenceCoordinates),m))}}}handleMove(t,n){let{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){let{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){let{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};wl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=iw,onActivation:r}=t,{active:a}=n,{code:i}=e.nativeEvent;if(o.start.includes(i)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function z0(e){return!!(e&&"distance"in e)}function $0(e){return!!(e&&"delay"in e)}var Cc=class{constructor(t,n,o){var r;o===void 0&&(o=YB(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;let{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=cs(i),this.documentListeners=new gs(this.document),this.listeners=new gs(o),this.windowListeners=new gs(Lo(i)),this.initialCoordinates=(r=vc(a))!=null?r:br,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.DragStart,B0),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),this.windowListeners.add(ar.ContextMenu,B0),this.documentListeners.add(ar.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(z0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){let{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ar.Click,JB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ar.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=(n=vc(t))!=null?n:br,d=ps(r,l);if(!o&&s){if(z0(s)){if(s.tolerance!=null&&Wh(d,s.tolerance))return this.handleCancel();if(Wh(d,s.distance))return this.handleStart()}if($0(s)&&Wh(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){let{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){let{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===mt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},ez={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Tl=class extends Cc{constructor(t){let{event:n}=t,o=cs(n.target);super(t,ez,o)}};Tl.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];var tz={move:{name:"mousemove"},end:{name:"mouseup"}},Qh;(function(e){e[e.RightClick=2]="RightClick"})(Qh||(Qh={}));var Xh=class extends Cc{constructor(t){super(t,tz,cs(t.event.target))}};Xh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Qh.RightClick?!1:(o?.({event:n}),!0)}}];var Gh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Yh=class extends Cc{constructor(t){super(t,Gh)}static setup(){return window.addEventListener(Gh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Gh.move.name,t)};function t(){}}};Yh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var xc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(xc||(xc={}));var tp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(tp||(tp={}));function nz(e){let{acceleration:t,activator:n=xc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=tp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=rz({delta:f,disabled:!a}),[h,g]=A0(),v=_({x:0,y:0}),x=_({x:0,y:0}),y=z(()=>{switch(n){case xc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case xc.DraggableRect:return r}},[n,r,l]),C=_(null),w=B(()=>{let S=C.current;if(!S)return;let L=v.current.x*x.current.x,I=v.current.y*x.current.y;S.scrollBy(L,I)},[]),k=z(()=>s===tp.TreeOrder?[...d].reverse():d,[s,d]);q(()=>{if(!a||!d.length||!y){g();return}for(let S of k){if(o?.(S)===!1)continue;let L=d.indexOf(S),I=c[L];if(!I)continue;let{direction:T,speed:E}=VB(S,I,y,t,p);for(let A of["x","y"])m[A][T[A]]||(E[A]=0,T[A]=0);if(E.x>0||E.y>0){g(),C.current=S,h(w,i),v.current=E,x.current=T;return}}v.current={x:0,y:0},x.current={x:0,y:0},g()},[t,w,o,g,a,i,JSON.stringify(y),JSON.stringify(m),h,d,k,c,JSON.stringify(p)])}var oz={x:{[Gn.Backward]:!1,[Gn.Forward]:!1},y:{[Gn.Backward]:!1,[Gn.Forward]:!1}};function rz(e){let{delta:t,disabled:n}=e,o=Jf(t);return Sl(r=>{if(n||!o||!r)return oz;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Gn.Backward]:r.x[Gn.Backward]||a.x===-1,[Gn.Forward]:r.x[Gn.Forward]||a.x===1},y:{[Gn.Backward]:r.y[Gn.Backward]||a.y===-1,[Gn.Forward]:r.y[Gn.Forward]||a.y===1}}},[n,t,o])}function az(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Sl(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function iz(e,t){return z(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,o)}));return[...n,...a]},[]),[e,t])}var bc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(bc||(bc={}));var Jh;(function(e){e.Optimized="optimized"})(Jh||(Jh={}));var H0=new Map;function sz(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=G(null),{frequency:s,measure:l,strategy:d}=r,c=_(e),f=v(),p=Il(f),m=B(function(x){x===void 0&&(x=[]),!p.current&&i(y=>y===null?x:y.concat(x.filter(C=>!y.includes(C))))},[p]),h=_(null),g=Sl(x=>{if(f&&!n)return H0;if(!x||x===H0||c.current!==e||a!=null){let y=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){y.set(C.id,C.rect.current);continue}let w=C.node.current,k=w?new yc(l(w),w):null;C.rect.current=k,k&&y.set(C.id,k)}return y}return x},[e,a,n,f,l]);return q(()=>{c.current=e},[e]),q(()=>{f||m()},[n,f]),q(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),q(()=>{f||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...o]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case bc.Always:return!1;case bc.BeforeDragging:return n;default:return!n}}}function sw(e,t){return Sl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lz(e,t){return sw(e,t)}function dz(e){let{callback:t,disabled:n}=e,o=Yf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return q(()=>()=>r?.disconnect(),[r]),r}function np(e){let{callback:t,disabled:n}=e,o=Yf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return q(()=>()=>r?.disconnect(),[r]),r}function cz(e){return new yc(vs(e),e)}function U0(e,t,n){t===void 0&&(t=cz);let[o,r]=G(null);function a(){r(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}let i=dz({callback(l){if(e)for(let d of l){let{type:c,target:f}=d;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),s=np({callback:a});return rr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function uz(e){let t=sw(e);return Z0(e,t)}var K0=[];function fz(e){let t=_(e),n=Sl(o=>e?o&&o!==K0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Ic(e):K0,[e]);return q(()=>{t.current=e},[e]),n}function pz(e){let[t,n]=G(null),o=_(e),r=B(a=>{let i=Vh(a.target);i&&n(s=>s?(s.set(i,jh(i)),new Map(s)):null)},[]);return q(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Vh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,jh(d)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),o.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{let d=Vh(l);d?.removeEventListener("scroll",r)})}},[r,e]),z(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>fs(a,i),br):aw(e):br,[e,t])}function q0(e,t){t===void 0&&(t=[]);let n=_(null);return q(()=>{n.current=null},t),q(()=>{let o=e!==br;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ps(e,n.current):br}function mz(e){q(()=>{if(!mc)return;let t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(let n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function gz(e,t){return z(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function lw(e){return z(()=>e?HB(e):null,[e])}var V0=[];function hz(e,t){t===void 0&&(t=vs);let[n]=e,o=lw(n?Lo(n):null),[r,a]=G(V0);function i(){a(()=>e.length?e.map(l=>ow(l)?o:new yc(t(l),l)):V0)}let s=np({callback:i});return rr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function vz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return bl(t)?t:e}function xz(e){let{measure:t}=e,[n,o]=G(null),r=B(d=>{for(let{target:c}of d)if(bl(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=np({callback:r}),i=B(d=>{let c=vz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=gc(i);return z(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var yz=[{sensor:Tl,options:{}},{sensor:wl,options:{}}],Cz={current:{}},Zf={draggable:{measure:F0},droppable:{measure:F0,strategy:bc.WhileDragging,frequency:Jh.Optimized},dragOverlay:{measure:vs}},hs=class extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}},bz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ep},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Zf,measureDroppableContainers:ep,windowRect:null,measuringScheduled:!1},Iz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ep,draggableNodes:new Map,over:null,measureDroppableContainers:ep},op=Ht(Iz),dw=Ht(bz);function Sz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hs}}}function wz(e,t){switch(t.type){case On.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case On.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case On.DragEnd:case On.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case On.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new hs(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case On.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let i=new hs(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case On.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new hs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Tz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=fn(op),a=Jf(o),i=Jf(n?.id);return q(()=>{if(!t&&!o&&a&&i!=null){if(!hc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=M0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function Lz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function kz(e){return z(()=>({draggable:{...Zf.draggable,...e?.draggable},droppable:{...Zf.droppable,...e?.droppable},dragOverlay:{...Zf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Pz(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=_(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;rr(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!o)return;let d=t?.node.current;if(!d||d.isConnected===!1)return;let c=n(d),f=Z0(c,o);if(i||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=ew(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var cw=Ht({...br,scaleX:1,scaleY:1}),fi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fi||(fi={}));var uw=ue(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=yz,collisionDetection:f=_B,measuring:p,modifiers:m,...h}=t,g=Za(wz,void 0,Sz),[v,x]=g,[y,C]=PB(),[w,k]=G(fi.Uninitialized),S=w===fi.Initialized,{draggable:{active:L,nodes:I,translate:T},droppable:{containers:E}}=v,A=L!=null?I.get(L):null,N=_({initial:null,translated:null}),R=z(()=>{var ie;return L!=null?{id:L,data:(ie=A?.data)!=null?ie:Cz,rect:N}:null},[L,A]),$=_(null),[H,K]=G(null),[O,oe]=G(null),ee=Il(h,Object.values(h)),W=us("DndDescribedBy",i),qe=z(()=>E.getEnabled(),[E]),ve=kz(p),{droppableRects:fe,measureDroppableContainers:Ne,measuringScheduled:Ae}=sz(qe,{dragging:S,dependencies:[T.x,T.y],config:ve.droppable}),ae=az(I,L),Ee=z(()=>O?vc(O):null,[O]),xe=ce(),re=lz(ae,ve.draggable.measure);Pz({activeNode:L!=null?I.get(L):null,config:xe.layoutShiftCompensation,initialRect:re,measure:ve.draggable.measure});let Ie=U0(ae,ve.draggable.measure,re),st=U0(ae?ae.parentElement:null),dt=_({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=E.getNodeFor((n=dt.current.over)==null?void 0:n.id),ct=xz({measure:ve.dragOverlay.measure}),Et=(o=ct.nodeRef.current)!=null?o:ae,ot=S?(r=ct.rect)!=null?r:Ie:null,He=!!(ct.nodeRef.current&&ct.rect),Se=uz(He?null:Ie),ze=lw(Et?Lo(Et):null),Je=fz(S?lt??ae:null),qt=hz(Je),X=Lz(m,{transform:{x:T.x-Se.x,y:T.y-Se.y,scaleX:1,scaleY:1},activatorEvent:O,active:R,activeNodeRect:Ie,containerNodeRect:st,draggingNodeRect:ot,over:dt.current.over,overlayNodeRect:ct.rect,scrollableAncestors:Je,scrollableAncestorRects:qt,windowRect:ze}),nn=Ee?fs(Ee,T):null,xt=pz(Je),mn=q0(xt),Tt=q0(xt,[Ie]),Yt=fs(X,mn),Jt=ot?FB(ot,X):null,Mt=R&&Jt?f({active:R,collisionRect:Jt,droppableRects:fe,droppableContainers:qe,pointerCoordinates:nn}):null,zn=ev(Mt,"id"),[kn,vn]=G(null),$n=He?X:fs(X,Tt),Vt=DB($n,(a=kn?.rect)!=null?a:null,Ie),Zt=_(null),Sn=B((ie,pe)=>{let{sensor:Ze,options:pt}=pe;if($.current==null)return;let xn=I.get($.current);if(!xn)return;let ht=ie.nativeEvent,en=new Ze({active:$.current,activeNode:xn,event:ht,options:pt,context:dt,onAbort(bt){if(!I.get(bt))return;let{onDragAbort:sn}=ee.current,ge={id:bt};sn?.(ge),y({type:"onDragAbort",event:ge})},onPending(bt,yn,sn,ge){if(!I.get(bt))return;let{onDragPending:rt}=ee.current,Lt={id:bt,constraint:yn,initialCoordinates:sn,offset:ge};rt?.(Lt),y({type:"onDragPending",event:Lt})},onStart(bt){let yn=$.current;if(yn==null)return;let sn=I.get(yn);if(!sn)return;let{onDragStart:ge}=ee.current,Rt={activatorEvent:ht,active:{id:yn,data:sn.data,rect:N}};(0,ms.unstable_batchedUpdates)(()=>{ge?.(Rt),k(fi.Initializing),x({type:On.DragStart,initialCoordinates:bt,active:yn}),y({type:"onDragStart",event:Rt}),K(Zt.current),oe(ht)})},onMove(bt){x({type:On.DragMove,coordinates:bt})},onEnd:tn(On.DragEnd),onCancel:tn(On.DragCancel)});Zt.current=en;function tn(bt){return async function(){let{active:sn,collisions:ge,over:Rt,scrollAdjustedTranslate:rt}=dt.current,Lt=null;if(sn&&rt){let{cancelDrop:et}=ee.current;Lt={activatorEvent:ht,active:sn,collisions:ge,delta:rt,over:Rt},bt===On.DragEnd&&typeof et=="function"&&await Promise.resolve(et(Lt))&&(bt=On.DragCancel)}$.current=null,(0,ms.unstable_batchedUpdates)(()=>{x({type:bt}),k(fi.Uninitialized),vn(null),K(null),oe(null),Zt.current=null;let et=bt===On.DragEnd?"onDragEnd":"onDragCancel";if(Lt){let Nt=ee.current[et];Nt?.(Lt),y({type:et,event:Lt})}})}}},[I]),ho=B((ie,pe)=>(Ze,pt)=>{let xn=Ze.nativeEvent,ht=I.get(pt);if($.current!==null||!ht||xn.dndKit||xn.defaultPrevented)return;let en={active:ht};ie(Ze,pe.options,en)===!0&&(xn.dndKit={capturedBy:pe.sensor},$.current=pt,Sn(Ze,pe))},[I,Sn]),zt=iz(c,ho);mz(c),rr(()=>{Ie&&w===fi.Initializing&&k(fi.Initialized)},[Ie,w]),q(()=>{let{onDragMove:ie}=ee.current,{active:pe,activatorEvent:Ze,collisions:pt,over:xn}=dt.current;if(!pe||!Ze)return;let ht={active:pe,activatorEvent:Ze,collisions:pt,delta:{x:Yt.x,y:Yt.y},over:xn};(0,ms.unstable_batchedUpdates)(()=>{ie?.(ht),y({type:"onDragMove",event:ht})})},[Yt.x,Yt.y]),q(()=>{let{active:ie,activatorEvent:pe,collisions:Ze,droppableContainers:pt,scrollAdjustedTranslate:xn}=dt.current;if(!ie||$.current==null||!pe||!xn)return;let{onDragOver:ht}=ee.current,en=pt.get(zn),tn=en&&en.rect.current?{id:en.id,rect:en.rect.current,data:en.data,disabled:en.disabled}:null,bt={active:ie,activatorEvent:pe,collisions:Ze,delta:{x:xn.x,y:xn.y},over:tn};(0,ms.unstable_batchedUpdates)(()=>{vn(tn),ht?.(bt),y({type:"onDragOver",event:bt})})},[zn]),rr(()=>{dt.current={activatorEvent:O,active:R,activeNode:ae,collisionRect:Jt,collisions:Mt,droppableRects:fe,draggableNodes:I,draggingNode:Et,draggingNodeRect:ot,droppableContainers:E,over:kn,scrollableAncestors:Je,scrollAdjustedTranslate:Yt},N.current={initial:ot,translated:Jt}},[R,ae,Mt,Jt,I,Et,ot,fe,E,kn,Je,Yt]),nz({...xe,delta:T,draggingRect:Jt,pointerCoordinates:nn,scrollableAncestors:Je,scrollableAncestorRects:qt});let D=z(()=>({active:R,activeNode:ae,activeNodeRect:Ie,activatorEvent:O,collisions:Mt,containerNodeRect:st,dragOverlay:ct,draggableNodes:I,droppableContainers:E,droppableRects:fe,over:kn,measureDroppableContainers:Ne,scrollableAncestors:Je,scrollableAncestorRects:qt,measuringConfiguration:ve,measuringScheduled:Ae,windowRect:ze}),[R,ae,Ie,O,Mt,st,ct,I,E,fe,kn,Ne,Je,qt,ve,Ae,ze]),Y=z(()=>({activatorEvent:O,activators:zt,active:R,activeNodeRect:Ie,ariaDescribedById:{draggable:W},dispatch:x,draggableNodes:I,over:kn,measureDroppableContainers:Ne}),[O,zt,R,Ie,x,W,I,kn,Ne]);return hn.createElement(G0.Provider,{value:C},hn.createElement(op.Provider,{value:Y},hn.createElement(dw.Provider,{value:D},hn.createElement(cw.Provider,{value:Vt},d)),hn.createElement(Tz,{disabled:s?.restoreFocus===!1})),hn.createElement(MB,{...s,hiddenTextDescribedById:W}));function ce(){let ie=H?.autoScrollEnabled===!1,pe=typeof l=="object"?l.enabled===!1:l===!1,Ze=S&&!ie&&!pe;return typeof l=="object"?{...l,enabled:Ze}:{enabled:Ze}}}),Az=Ht(null),W0="button",Ez="Draggable";function fw(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=us(Ez),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=fn(op),{role:m=W0,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=fn(v?cw:Az),[y,C]=gc(),[w,k]=gc(),S=gz(i,t),L=Il(n);rr(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:w,data:L}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let I=z(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":v&&m===W0?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[o,m,g,v,h,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:v,listeners:o?void 0:S,node:y,over:p,setNodeRef:C,setActivatorNodeRef:k,transform:x}}function pw(){return fn(dw)}var Mz="Droppable",Rz={timeout:25};function mw(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=us(Mz),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=fn(op),c=_({disabled:n}),f=_(!1),p=_(null),m=_(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Rz,...r},x=Il(g??o),y=B(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),m.current=null},v)},[v]),C=np({callback:y,disabled:h||!i}),w=B((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[k,S]=gc(w),L=Il(t);return q(()=>{!C||!k.current||(C.disconnect(),f.current=!1,C.observe(k.current))},[k,C]),q(()=>(s({type:On.RegisterDroppable,element:{id:o,key:a,disabled:n,node:k,rect:p,data:L}}),()=>s({type:On.UnregisterDroppable,key:a,id:o})),[o]),q(()=>{n!==c.current.disabled&&(s({type:On.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,s]),{active:i,rect:p,isOver:l?.id===o,node:k,over:l,setNodeRef:S}}me();function gw(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Nz(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function rp(e){return e!==null&&e>=0}function _z(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Dz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var hw=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=gw(t,o,n),i=t[r],s=a[r];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}};var ap={scaleX:1,scaleY:1},vw=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e,s=(t=a[n])!=null?t:o;if(!s)return null;if(r===n){let d=a[i];return d?{x:0,y:n<i?d.top+d.height-(s.top+s.height):d.top-s.top,...ap}:null}let l=Oz(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...ap}:r<n&&r>=i?{x:0,y:s.height+l,...ap}:{x:0,y:0,...ap}};function Oz(e,t,n){let o=e[t],r=e[t-1],a=e[t+1];return o?n<t?r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0:a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0:0}var xw="Sortable",yw=hn.createContext({activeIndex:-1,containerId:xw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hw,disabled:{draggable:!1,droppable:!1}});function Cw(e){let{children:t,id:n,items:o,strategy:r=hw,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=pw(),f=us(xw,n),p=s.rect!==null,m=z(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),h=i!=null,g=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,x=_(m),y=!_z(m,x.current),C=v!==-1&&g===-1||y,w=Dz(a);rr(()=>{y&&h&&c(m)},[y,m,h,c]),q(()=>{x.current=m},[m]);let k=z(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:Nz(m,l),strategy:r}),[g,f,w.draggable,w.droppable,C,m,v,l,p,r]);return hn.createElement(yw.Provider,{value:k},t)}var Fz=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return gw(n,o,r).indexOf(t)},Bz=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!o||s!==a&&r===i?!1:n?!0:i!==r&&t===l},zz={duration:200,easing:"ease"},bw="transform",$z=ui.Transition.toString({property:bw,duration:0,easing:"linear"}),Hz={roleDescription:"sortable"};function Uz(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=G(null),s=_(n);return rr(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=vs(o.current,{ignoreTransform:!0}),c={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(c.x||c.y)&&i(c)}}n!==s.current&&(s.current=n)},[t,n,o,r]),q(()=>{a&&i(null)},[a]),a}function Iw(e){let{animateLayoutChanges:t=Bz,attributes:n,disabled:o,data:r,getNewIndex:a=Fz,id:i,strategy:s,resizeObserverConfig:l,transition:d=zz}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=fn(yw),C=Kz(o,m),w=c.indexOf(i),k=z(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=z(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:I,isOver:T,setNodeRef:E}=mw({id:i,data:k,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:A,activatorEvent:N,activeNodeRect:R,attributes:$,setNodeRef:H,listeners:K,isDragging:O,over:oe,setActivatorNodeRef:ee,transform:W}=fw({id:i,data:k,attributes:{...Hz,...n},disabled:C.draggable}),qe=P0(E,H),ve=!!A,fe=ve&&!h&&rp(p)&&rp(v),Ne=!x&&O,Ae=Ne&&fe?W:null,Ee=fe?Ae??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:w}):null,xe=rp(p)&&rp(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,re=A?.id,Ie=_({activeId:re,items:c,newIndex:xe,containerId:f}),st=c!==Ie.current.items,dt=t({active:A,containerId:f,isDragging:O,isSorting:ve,id:i,index:w,items:c,newIndex:Ie.current.newIndex,previousItems:Ie.current.items,previousContainerId:Ie.current.containerId,transition:d,wasDragging:Ie.current.activeId!=null}),lt=Uz({disabled:!dt,index:w,node:I,rect:L});return q(()=>{ve&&Ie.current.newIndex!==xe&&(Ie.current.newIndex=xe),f!==Ie.current.containerId&&(Ie.current.containerId=f),c!==Ie.current.items&&(Ie.current.items=c)},[ve,xe,f,c]),q(()=>{if(re===Ie.current.activeId)return;if(re!=null&&Ie.current.activeId==null){Ie.current.activeId=re;return}let Et=setTimeout(()=>{Ie.current.activeId=re},50);return()=>clearTimeout(Et)},[re]),{active:A,activeIndex:p,attributes:$,data:k,rect:L,index:w,newIndex:xe,items:c,isOver:T,isSorting:ve,isDragging:O,listeners:K,node:I,overIndex:v,over:oe,setNodeRef:qe,setActivatorNodeRef:ee,setDroppableNodeRef:E,setDraggableNodeRef:H,transform:lt??Ee,transition:ct()};function ct(){if(lt||st&&Ie.current.newIndex===w)return $z;if(!(Ne&&!hc(N)||!d)&&(ve||dt))return ui.Transition.toString({...d,property:bw})}}function Kz(e,t){var n,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function ip(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var qz=[mt.Down,mt.Right,mt.Up,mt.Left],Sw=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(qz.includes(e.code)){if(e.preventDefault(),!n||!o)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let p=r.get(f.id);if(p)switch(e.code){case mt.Down:o.top<p.top&&l.push(f);break;case mt.Up:o.top>p.top&&l.push(f);break;case mt.Left:o.left>p.left&&l.push(f);break;case mt.Right:o.left<p.left&&l.push(f);break}});let d=J0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=ev(d,"id");if(c===i?.id&&d.length>1&&(c=d[1].id),c!=null){let f=a.get(n.id),p=a.get(c),m=p?r.get(p.id):null,h=p?.node.current;if(h&&m&&f&&p){let v=Ic(h).some((S,L)=>s[L]!==S),x=ww(f,p),y=Vz(f,p),C=v||!x?{x:0,y:0}:{x:y?o.width-m.width:0,y:y?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:ps(w,C)}}}};function ww(e,t){return!ip(e)||!ip(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Vz(e,t){return!ip(e)||!ip(t)||!ww(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Wz(e,t,n){let o={...e};return t.top+e.y<=n.top?o.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(o.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?o.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(o.x=n.left+n.width-t.right),o}var Tw=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:Wz(n,t,r)},Lw=e=>{let{transform:t}=e;return{...t,x:0}};me();me();var sp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function kw(e){return`(min-width: ${typeof e=="number"?e:sp[e]}px)`}function Pw(e){return`(max-width: ${(typeof e=="number"?e:sp[e])-1}px)`}function Gz(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(kw(e.min)),e.max!=null&&n.push(Pw(e.max)),e.pointer==="coarse"&&n.push("(pointer: coarse)"),e.pointer==="fine"&&n.push("(pointer: fine)"),n.length===0?"(min-width: 0px)":n.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let n of e.split(":"))if(n.startsWith("max-")){let o=n.slice(4);o in sp&&t.push(Pw(o))}else n in sp&&t.push(kw(n));return t.length>0?t.join(" and "):e}function jz(){return!1}function lp(e){let t=Gz(e),n=B(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=B(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return xa(n,o,jz)}me();var uo=new Map;function Qz(e,t,n){return`${e}\0${t}\0${n??"none"}`}function tv(e,t){uo.delete(e),uo.set(e,t)}function Ll(e,t){if(uo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,uo.delete(e);for(let n of t.state.added)t.releaseUpload(n.id),URL.revokeObjectURL(n.previewUrl);for(let n of t.listeners)n()}}function Xz(e){if(uo.size<=100)return;let t=Array.from(uo);for(let[n,o]of t){if(uo.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Ll(n,o)}for(let[n,o]of t){if(uo.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Ll(n,o)}}function dp(){queueMicrotask(()=>Xz())}function Aw(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Qz(e,n.intentId,a),s=uo.get(i);if(s)return s.releaseUpload=o.releaseUpload,s.watchAuthority=r,s.state;let l={key:i,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.text??"",retained:n.management?.attachments??[],added:[],saving:!1,error:null},d={state:l,listeners:new Set,releaseUpload:o.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return uo.set(i,d),l}function Ew(e,t){let n=uo.get(e);return n?(n.releaseAuthorityWatch===void 0&&n.watchAuthority!==void 0&&(n.releaseAuthorityWatch=n.watchAuthority({threadKey:n.state.inputKey,intentId:n.state.intentId,revision:n.state.revision,onInvalid:()=>Ll(e,n)})),n.committed=!0,tv(e,n),n.listeners.add(t),dp(),()=>{n.listeners.delete(t),dp()}):()=>{}}function xs(e,t){let n=uo.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,tv(e,n);for(let r of n.listeners)r()}}function cp(e){return uo.get(e)?.state}function Mw(e){let t=uo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,tv(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Ll(e,t);return}dp()}}}function up(e){let t=uo.get(e);t&&Ll(e,t)}function Rw(e,t){let n=new Map(t.flatMap(o=>o.waiting&&o.management!==void 0?[[o.intentId,o.management.revision]]:[]));for(let[o,r]of uo)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Ll(o,r);dp()}function Nw({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=co(),c=Aw(n,o,e,a,i),f=xa(A=>Ew(c.key,A),()=>cp(c.key)??c,()=>cp(c.key)??c),{key:p,text:m,retained:h,added:g,saving:v,error:x}=f,y=_(null),C=a.useUploadStatuses(),w=z(()=>h.map(A=>A.id),[h]),k=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;q(()=>{t===void 0&&(up(p),l())},[t,p,l]);let L=()=>{v||(up(p),l())},I=A=>{if(v||r||S)return;let N=null,R=[...g];for(let $ of A){let H=$.type||"application/octet-stream";if(h.length+R.length>=a.limits.maxAttachments||$.size===0||$.size>a.maxAttachmentBytes(H)){N=d("turnQueue.attachmentLimit",{name:$.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(H))});continue}let K=a.makeImageAttachment({id:a.randomUUID(),name:$.name,mimeType:H,sizeBytes:$.size,file:$});R.push(K),a.startUpload({environmentId:o,image:K})}xs(p,$=>({...$,added:R,error:N}))},T=async()=>{let A=cp(p);if(!A||A.saving||r||S||!A.text.trim()&&A.retained.length+A.added.length===0)return;let N=Mw(p);if(N!==null){xs(p,R=>({...R,saving:!0,error:null}));try{await a.awaitUploads(A.added.map($=>$.id));let R=a.getUploadedAttachments({environmentId:o,images:A.added});if(!R)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:A.text,attachments:[...A.retained,...R]}),up(p),l()}catch(R){xs(p,$=>({...$,saving:!1,error:R instanceof Error?R.message:d("turnQueue.actionFailed")}))}finally{N()}}},E=[...h.map((A,N)=>({...A,previewUrl:k[N],added:!1})),...g.map(A=>({...A,added:!0}))];return u(If,{open:!0,onOpenChange:A=>{A||L()},children:b(Lf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(Tf,{children:[u(kf,{children:d("turnQueue.editTitle")}),u(Sf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:A=>{A.dataTransfer.types.includes("Files")&&A.preventDefault()},onDrop:A=>{A.dataTransfer.files.length&&(A.preventDefault(),A.stopPropagation(),I(Array.from(A.dataTransfer.files)))},children:[u(NI,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:A=>xs(p,N=>({...N,text:A.target.value})),onPaste:A=>{A.clipboardData.files.length&&(A.preventDefault(),I(Array.from(A.clipboardData.files)))},onKeyDown:A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&!A.nativeEvent.isComposing&&(A.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:E.map(A=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[A.type==="image"&&A.previewUrl?u("img",{src:A.previewUrl,alt:A.name,className:"size-12 rounded object-cover"}):u(Ro,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:A.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(A.sizeBytes)}),A.added&&C.get(A.id)!=="ready"?u("p",{children:d(C.get(A.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,A.added&&C.get(A.id)==="failed"?u(te,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let N=g.find(R=>R.id===A.id);N&&a.retryUpload({environmentId:o,image:N})},children:d("turnQueue.retryUpload")}):null]}),u(te,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:A.name}),disabled:v||S,onClick:()=>{A.added?(a.releaseUpload(A.id),A.previewUrl&&URL.revokeObjectURL(A.previewUrl),xs(p,N=>({...N,added:N.added.filter(R=>R.id!==A.id)}))):xs(p,N=>({...N,retained:N.retained.filter(R=>R.id!==A.id)}))},children:u(jt,{className:"size-3.5"})})]},A.id))}),u("input",{ref:y,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:A=>{I(Array.from(A.target.files??[])),A.target.value=""}}),b(te,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>y.current?.click(),children:[u(Ro,{className:"size-4"}),d("turnQueue.addAttachments")]}),S?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,x?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),b(wf,{children:[u(te,{variant:"ghost",disabled:v,onClick:L,children:d("turnQueue.discardEdit")}),u(te,{disabled:v||r||S||!m.trim()&&E.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function _w(e,t){let n=e.find(a=>a.intentId===t.intentId);if(!n)return e;let o=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?o.length:o.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(o.splice(r,0,n),o)}function Dw(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return _w(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function Ow(e,t){if(!e.find(l=>l.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(l=>l.intentId===t.beforeIntentId))return{entries:e,settled:!0};let o=new Set(e.map(l=>l.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(l=>o.has(l));return e.filter(l=>r.has(l.intentId)).some((l,d)=>l.intentId!==a[d])?{entries:e,settled:!0}:{entries:_w(e,t),settled:!1}}me();me();function Yz({entry:e,unavailable:t,onCancel:n}){let{t:o}=co(),r=_(!1),[a,i]=G(!1),[s,l]=G(!1),[d,c]=G(!1);q(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,i(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,i(!1)}}};return b("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[u("p",{className:"text-muted-foreground",children:o(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),u("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??o("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?u("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?d&&e.action==="abandon"?b("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),b("div",{className:"flex flex-wrap gap-2",children:[u(te,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(te,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(te,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?c(!0):void f(),children:o(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,s?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function Fw({entries:e,unavailable:t,onCancel:n}){let{t:o}=co(),[r,a]=G(!1),i=Wr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(te,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":i,onClick:()=>a(s=>!s),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:i,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(s=>u(Yz,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function nv({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=co(),i=_(!1),[s,l]=G(!1),[d,c]=G(!1),f=_(!1),[p,m]=G(!1),[h,g]=G(!1),[v,x]=G(null);q(()=>{e.paused||c(!1)},[e.paused]);let y=o?.[0];q(()=>{m(!1),x(null)},[y?.intentId,y?.status,y?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&y?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),k=async()=>{if(f.current||t||r===void 0||y===void 0)return;let T=y;f.current=!0,g(!0),x(null);try{await r(T),m(!1)}catch{x(T.intentId)}finally{f.current=!1,g(!1)}},S=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),L=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),I=async()=>{if(!(i.current||t||!e.paused)){i.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{i.current=!1,l(!1)}}};return b("div",{className:"mx-auto mb-2 flex w-full max-w-3xl flex-wrap items-start gap-2 rounded-md border border-warning/40 bg-background px-3 py-2 text-xs text-foreground","data-turn-queue-banner":!0,role:"status",children:[b("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[b("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:S}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:L}),e.paused&&C?u("p",{className:"text-muted-foreground",children:a("turnQueue.pausedUncertainDescription")}):null,t?u("p",{className:"text-muted-foreground",children:a("turnQueue.disconnected")}):null,d&&e.paused?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.resumeFailed")}):null,v!==null&&v===y?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(te,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(be,{children:[u(te,{size:"xs",variant:"outline",disabled:h,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(OI,{open:p,onOpenChange:T=>{T||m(!1)},children:b(HI,{className:"max-w-lg",children:[b($I,{children:[u(UI,{children:a("turnQueue.stopWaiting")}),u(BI,{children:a("turnQueue.abandonDescription")})]}),b(zI,{children:[u(FI,{render:u(te,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(te,{variant:"outline",disabled:h||t,onClick:()=>{k()},children:a(h?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(Fw,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var Jz=[Lw,Tw];function Zz({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=co(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:h}=Iw({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return b("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:ui.Transform.toString(p),transition:m},className:F("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",h&&"z-10 bg-accent shadow-md ring-1 ring-primary/50 ring-inset",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[n?u("span",{"aria-hidden":"true","data-queue-drop-position":n,className:F("pointer-events-none absolute inset-x-1 z-20 h-0.5 rounded-full bg-primary before:absolute before:-top-0.5 before:start-0 before:size-1.5 before:rounded-full before:bg-primary",n==="before"?"top-0":"bottom-0")}):null,u(te,{ref:f,size:"icon-xs",variant:"ghost",className:F("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(Io,{className:"size-3.5"}):u(Bd,{className:"size-3.5"})}),i,h&&o?u("span",{"aria-hidden":"true","data-queue-drag-position":!0,className:"pointer-events-none absolute end-3 rounded bg-primary/10 px-2 py-1 font-medium text-primary tabular-nums",children:o}):null]})}function Bw({inputKey:e,entries:t,environmentId:n,unavailable:o,attachments:r,actions:a,onCancel:i}){let{t:s}=co(),l=lp("(prefers-reduced-motion: reduce)"),[d,c]=Ln("turn-queue:editing",e,null),[f,p]=Ln("turn-queue:pending",e,!1),m=En("turn-queue:pending-ref",e,!1),[h,g]=Ln("turn-queue:error",e,null),[v,x]=Ln("turn-queue:drag",e,null),[y,C]=Ln("turn-queue:move",e,null),w=En("turn-queue:reorder-ref",e,!1),[k,S]=Ln("turn-queue:feedback",e,null),L=j0(Zh(Tl,{activationConstraint:{distance:5}}),Zh(wl,{coordinateGetter:Sw,scrollBehavior:l?"auto":"smooth"})),I=z(()=>t.filter(O=>O.waiting),[t]),T=y?Ow(I,y.preview):null,E=T?.entries??I,A=o||f||y!==null,N=E.findIndex(O=>O.intentId===v?.activeId),R=E.findIndex(O=>O.intentId===v?.overId);q(()=>{Rw(e,t)},[t,e]),q(()=>{y!==null&&(o||y.acknowledged&&T?.settled)&&(w.current=!1,C(null),!o&&I.some(O=>O.intentId===y.preview.intentId)&&S({intentId:y.preview.intentId,kind:"saved"}))},[I,y,T?.settled,o]),q(()=>{if(k===null||k.kind==="failed")return;let O=window.setTimeout(()=>S(oe=>oe===k?null:oe),1600);return()=>window.clearTimeout(O)},[k]);let $=async O=>{if(!(m.current||w.current||o)){m.current=!0,p(!0),g(null),S(null);try{await O()}catch(oe){g(oe instanceof Error?oe.message:s("turnQueue.actionFailed"))}finally{m.current=!1,p(!1)}}},H=(O,oe)=>$(async()=>{let ee=Dw(I,O.intentId,oe);if(!(ee===null||!O.management?.canReorder)){w.current=!0,C({preview:ee,acknowledged:!1});try{await a.onReorder(O,oe),C(W=>W?.preview===ee?{...W,acknowledged:!0}:W)}catch(W){throw w.current=!1,C(null),S({intentId:O.intentId,kind:"failed"}),W}}}),K=o?s("turnQueue.disconnected"):y!==null?s("turnQueue.saving"):v!==null?`${s("turnQueue.dragStarted")} ${R+1}/${E.length}`:k?.kind==="saved"?s("common.action.done"):k?.kind==="cancelled"?s("turnQueue.dragCancelled"):"";return b(be,{children:[E.length>0?b("section",{"aria-label":s("turnQueue.pendingMessages"),"data-turn-queue-dock":!0,className:"mx-auto mb-2 w-full max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-background/95 text-xs shadow-xs",children:[b("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[u("span",{className:"shrink-0",children:s("turnQueue.queued",{count:E.length})}),u("span",{role:"status","aria-live":v===null?"polite":"off","data-queue-reorder-status":y?"saving":k?.kind,className:F("min-w-0 truncate",k?.kind==="saved"&&"text-primary"),children:K})]}),u(uw,{sensors:L,collisionDetection:Y0,modifiers:Jz,accessibility:{screenReaderInstructions:{draggable:s("turnQueue.dragInstructions")},announcements:{onDragStart:()=>s("turnQueue.dragStarted"),onDragOver:({over:O})=>{let oe=E.findIndex(ee=>ee.intentId===O?.id);return oe<0?void 0:`${s("turnQueue.dragStarted")} ${oe+1}/${E.length}`},onDragEnd:()=>s("turnQueue.dragFinished"),onDragCancel:()=>s("turnQueue.dragCancelled")}},onDragStart:({active:O})=>{let oe=E.find(ee=>ee.intentId===O.id);!oe?.management?.canReorder||A||(g(null),S(null),x({activeId:oe.intentId,overId:oe.intentId}))},onDragOver:({over:O})=>{let oe=E.find(ee=>ee.intentId===O?.id);oe&&x(ee=>ee&&{...ee,overId:oe.intentId})},onDragCancel:()=>{v&&S({intentId:v.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:O,over:oe})=>{if(x(null),!oe||O.id===oe.id)return;let ee=E.findIndex(fe=>fe.intentId===O.id),W=E.findIndex(fe=>fe.intentId===oe.id),qe=E[ee];if(!qe?.management?.canReorder||W<0)return;let ve=E[W+(ee<W?1:0)]?.intentId??null;H(qe,ve)},children:u(Cw,{items:E.map(O=>O.intentId),strategy:vw,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:E.map((O,oe)=>b(Zz,{entry:O,disabled:!O.management?.canReorder||A,reducedMotion:l,feedback:k?.intentId===O.intentId?k.kind:void 0,dropPosition:O.intentId===v?.overId&&N!==R?N<R?"after":"before":void 0,dragPosition:O.intentId===v?.activeId?`${R+1}/${E.length}`:void 0,children:[b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:O.text||s("turnQueue.attachmentsOnly")}),O.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(Ro,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:O.attachmentNames.join(", ")})]}):null,O.pendingAction?u("p",{className:"text-muted-foreground",children:s(O.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,O.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:O.failure}):null]}),b("div",{className:F("flex shrink-0 items-center gap-0.5",O.intentId===v?.activeId&&"invisible"),children:[u(te,{size:"icon-xs",variant:"ghost",disabled:!O.management||A||v!==null,"aria-label":s("turnQueue.editMessage"),title:s("turnQueue.editMessage"),onClick:()=>c(O),children:u(Wd,{className:"size-3.5"})}),O.management?.canSteer?u(te,{size:"icon-xs",variant:"ghost",disabled:A||v!==null,"aria-label":s("turnQueue.steer"),title:s("turnQueue.steerDescription"),onClick:()=>{$(()=>a.onRun(O,"steer"))},children:u(Gd,{className:"size-3.5"})}):null,b(Jo,{children:[u(tr,{render:u(te,{size:"icon-xs",variant:"ghost",disabled:A||!O.management||v!==null,"aria-label":s("turnQueue.messageActions")}),children:u(Yo,{className:"size-4"})}),b(er,{align:"end",children:[b(Zo,{disabled:!O.management?.canReorder||oe===0,onClick:()=>{H(O,E[oe-1].intentId)},children:[u(Pd,{className:"size-4"}),s("turnQueue.moveUp")]}),b(Zo,{disabled:!O.management?.canReorder||oe===E.length-1,onClick:()=>{H(O,E[oe+2]?.intentId??null)},children:[u(Ld,{className:"size-4"}),s("turnQueue.moveDown")]}),O.management?.canSteer?u(Zo,{onClick:()=>{$(()=>a.onRun(O,"steer"))},children:s("turnQueue.steer")}):null,u(Zo,{disabled:!O.management?.canRun,onClick:()=>{$(()=>a.onRun(O,"interrupt"))},children:s(O.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(ii,{}),u(Zo,{disabled:O.action!=="cancel",onClick:()=>{$(()=>i(O))},children:s("turnQueue.cancelMessage")})]})]})]})]},O.intentId))})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,d?u(Nw,{entry:d,current:t.find(O=>O.intentId===d.intentId),inputKey:e,environmentId:n,unavailable:A,attachments:r,watchEditorAuthority:a.watchEditorAuthority,onEdit:a.onEdit,onClose:()=>c(null)},`${e}\0${d.intentId}\0${d.management?.revision??"none"}`):null]})}me();var ov=220,e5={opacity:0,transform:"translate3d(0, 4rem, 0)"},t5={opacity:0,transform:"translate3d(0, 7rem, 0)"},zw={opacity:1,transform:"none"},$w={transition:`transform ${ov}ms ease-in, opacity ${ov}ms ease-in`},n5={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function Uw({className:e,items:t}){let[n,o]=G(null),r=_(null),a=n!==null&&t.some(p=>p.id===n)?n:null;if(q(()=>()=>{r.current&&clearTimeout(r.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let s=t.slice(1),l=s.length>0,d=l&&a!==i.id,c=s[0],f=p=>{!p.onDismiss||a||(o(p.id),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,p.onDismiss?.()},ov))};return u("div",{className:F("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:F("relative flex flex-col-reverse",l?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[d&&c?u("div",{className:F("pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-2xl","chat-composer-banner-stack-cap border border-b-0 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",n5[c.variant],"transition-opacity duration-150 ease-out","group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0"),style:{width:"96%"},"aria-hidden":"true"}):null,u("div",{className:F("relative z-10",a===i.id?"pointer-events-none":null),style:{...$w,...a===i.id?e5:zw},children:u(Hw,{item:i,attached:!0,exiting:a===i.id,onDismissRequest:()=>f(i)})}),l?u("div",{"data-composer-banner-stack-expanded-items":"true",className:F("relative z-20 grid grid-rows-[0fr] transition-[grid-template-rows] duration-150 ease-out","group-hover/banner-stack:grid-rows-[1fr] group-focus-within/banner-stack:grid-rows-[1fr]"),children:u("div",{className:"min-h-0 overflow-hidden",children:u("div",{className:F("invisible pointer-events-none space-y-2 pb-2 opacity-0","translate-y-1 transform-gpu transition-[opacity,transform] duration-150 ease-out will-change-[opacity,transform]","group-hover/banner-stack:visible group-hover/banner-stack:pointer-events-auto group-hover/banner-stack:translate-y-0 group-hover/banner-stack:opacity-100","group-focus-within/banner-stack:visible group-focus-within/banner-stack:pointer-events-auto group-focus-within/banner-stack:translate-y-0 group-focus-within/banner-stack:opacity-100"),children:s.map(p=>u("div",{className:F(a===p.id?"pointer-events-none":null),style:{...$w,...a===p.id?t5:zw},children:u(Hw,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function Hw({item:e,attached:t,exiting:n,onDismissRequest:o}){let r=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(tc,{variant:e.variant,role:"status",className:F("min-h-0 px-3 text-xs sm:px-4",t?"chat-composer-drawer-surface chat-composer-drawer-attached pt-1.5 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.25rem)]":"alert-glass rounded-[22px] py-1.5",e.className),"data-composer-banner-presentation":"compact","data-variant":e.variant,children:[e.icon,b(xh,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[u("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?b(nc,{className:F("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(te,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss notice",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]}):b(tc,{variant:e.variant,className:F(t?"chat-composer-drawer-surface chat-composer-drawer-attached px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.375rem)] text-xs sm:px-4":"alert-glass rounded-[22px]",e.className),"data-variant":e.variant,children:[e.icon,u(xh,{children:e.title}),e.description?u(Af,{children:e.description}):null,e.actions||e.onDismiss?b(nc,{className:F(e.actionClassName,r?"max-sm:col-start-3 max-sm:row-start-1 max-sm:mt-0 max-sm:self-start":void 0),children:[e.actions,e.onDismiss?u(te,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss warning",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]})}function Kw({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u(Uw,{className:"relative z-0",items:e});return u("div",{ref:r,"data-chat-composer-overlay":"true",className:o.active?"pointer-events-none absolute inset-0 z-20 flex items-center":"pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2",children:b("div",{ref:o.transitionGroupRef,className:"w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]",children:[b("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?b("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),i]}):i,b("div",{className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:o.composerTransitionName},children:[u("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-[22px]",children:u("div",{ref:o.composerAnchorRef,className:"relative z-10",children:n})}),u("div",{className:"min-h-0",children:t})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]})})}function qw(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var o5=["image/gif","image/jpeg","image/png","image/webp"],r5=new Set(o5);function rv(e){return r5.has(e.toLowerCase())}function a5(e){return rv(e)?"image":"file"}var i5=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function av(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||i5.has(t)?"text":"file"}function iv(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function sv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return a5(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var s5=new Set(["claudeAgent","cursor","grok","dsh","acp"]),Vw=e=>s5.has(e)?"in-session":"next-turn";function l5(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function d5(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function c5(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Sc(e){return`[${d5(l5(e))}](${c5(e)})`}me();var u5=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,f5=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var p5=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),m5=/^[A-Za-z][A-Za-z0-9+.-]*:/,g5=/^[A-Za-z]:[\\/]/,h5=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function v5(e){let t=[];for(let n of e.matchAll(p5)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),i=n[3]??"",s=i;try{s=decodeURIComponent(i)}catch{}let l=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\")),d=l>=0?s.slice(l+1):s,c=m5.test(s)&&!g5.test(s);if(!s||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(f5)){let o=n[0],r=n[1]??"",a=n[2],i=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!i||a===void 0&&h5.test(i))continue;let s=(n.index??0)+r.length,l=s+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(s,l),start:s,end:l})}return t}function wc(e,t={}){let n=v5(e);for(let o of e.matchAll(u5)){let r=o[0],a=o[1]??"",i=o[2]??"";if(!i)continue;let s=(o.index??0)+a.length,l=s+r.length-a.length;n.push({type:"skill",value:i,source:e.slice(s,l),start:s,end:l})}for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function x5(e){return e.replace(/\r\n/g,`
3694
+ `).replace(/^\n+|\n+$/g,"")}function y5(e){return x5(e.text).length>0}function Ww(e){return!y5(e)}function C5(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function Gw(e){return`${e.terminalLabel} (${C5(e)})`}function jw(e,t,n){return e<=n&&n<t}function Qw(e,t){if(!t)return;let n=e[e.length-1];if(n&&n.type==="text"){n.text+=t;return}e.push({type:"text",text:t})}function Xw(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]==="\uFFFC"){if(o>n&&t({type:"text",text:e.slice(n,o),promptOffset:n})===!0||t({type:"terminal-context",promptOffset:o})===!0)return!0;n=o+1}return n<e.length&&t({type:"text",text:e.slice(n),promptOffset:n})===!0}function b5(e,t){return Xw(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function I5(e,t){return b5(e,(n,o)=>{for(let r of wc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function S5(e){let t=[];if(!e)return t;let n=wc(e),o=0;for(let r of n)r.start<o||(r.start>o&&Qw(t,e.slice(o,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),o=r.end);return o<e.length&&Qw(t,e.slice(o)),t}function lv(e,t,n){return!e||t>=n?!1:I5(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&jw(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&jw(t,n,l))})}function ys(e,t=[]){if(!e)return[];let n=[],o=0;return Xw(e,r=>r.type==="text"?(n.push(...S5(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function Jw(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:"foreground"}var Yw=e=>e.type!=="text";function dv(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function w5(e){return e===" "||e===`
3695
+ `||e===" "||e==="\r"||e==="\uFFFC"}function T5(e,t){let n=t-1;for(;n>=0&&!w5(e[n]??"");)n-=1;return n+1}function Ir(e,t){let n=dv(e,t),o=ys(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="skill"){let l=i.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Zw(e){return e.type==="text"?e.text.length:1}function eT(e,t){let n=e.reduce((o,r)=>o+Zw(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function ir(e,t){return eT(ys(e),t)}function sr(e,t){let n=dv(e,t),o=ys(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="skill"){let l=i.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Tc(e,t,n){let o=ys(e);if(!o.some(Yw))return!1;let r=eT(o,t),a=0;for(let i of o){if(Yw(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=Zw(i)}return!1}function lr(e,t){let n=dv(e,t),o=e.lastIndexOf(`
3696
+ `,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let s=/^\/(\S*)$/.exec(r);if(s)return{kind:"slash-command",query:s[1]??"",rangeStart:o,rangeEnd:n}}let a=T5(e,n),i=e.slice(a,n);return i.startsWith("$")?{kind:"skill",query:i.slice(1),rangeStart:a,rangeEnd:n}:i.startsWith("@")?{kind:"path",query:i.slice(1),rangeStart:a,rangeEnd:n}:null}function tT(e,t,n,o){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,n));return{text:`${e.slice(0,r)}${o}${e.slice(a)}`,cursor:r+o.length}}var nT="Ask for changes, send follow-ups, or attach images";var oT="application/x-ycodium-composer-mention";function cv(e){return e.includes(oT)}function rT(e){let t=n=>cv(n.dataTransfer.types)?(n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(n){t(n)&&e.setDragActive(!0)},onDragOver(n){t(n)&&(n.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(n){if(!t(n))return;e.setDragActive(!1);let o=n.dataTransfer.getData(oT);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}me();var uv=ue(function(t){let{t:n}=De();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:F("text-[10px] font-medium leading-none tabular-nums",t.pulsing?"animate-[prompt-stash-count-enter_180ms_ease-out_both] text-primary motion-reduce:animate-none":"text-muted-foreground"),children:t.count},t.pulseKey);return o?b(te,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("shrink-0 gap-1 px-1.5",(t.menuOpen||t.pulsing)&&"[--control-icon-color:currentColor] text-foreground"),onPointerDown:a=>a.preventDefault(),onClick:t.onToggleMenu,children:[u(dl,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):b("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-t-xl border border-b-0 px-3 pb-1 text-xs leading-none","transition-colors duration-(--control-duration)",t.menuOpen&&"pointer-events-none",t.menuOpen||t.pulsing?"text-foreground":"text-muted-foreground hover:text-foreground"),onPointerDown:a=>{a.preventDefault()},onClick:t.onToggleMenu,children:[u(dl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});me();function L5(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function k5(e){let t=L5(e);if(!t)return null;let n=Date.now()-t.getTime();if(n<0)return{value:"just now",suffix:null};let o=Math.floor(n/1e3);if(o<60)return{value:"just now",suffix:null};let r=Math.floor(o/60);if(r<60)return{value:`${r}m`,suffix:"ago"};let a=Math.floor(r/60);return a<24?{value:`${a}h`,suffix:"ago"}:{value:`${Math.floor(a/24)}d`,suffix:"ago"}}function aT(e){let t=k5(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}me();var iT=Ht(null),sT=iT.Provider;function Ot(){let e=fn(iT);if(e===null)throw new Error("Composer API has not been provided.");return e}var lT=90;function dT(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function P5(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>lT?`${n.slice(0,lT)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var cT=ue(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=De(),s=Ot(),l=_(null),[d,c]=G(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return q(()=>{let p=m=>{let h=l.current;h&&m.composedPath().includes(h)||m.target instanceof Element&&m.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),q(()=>{n.length!==0&&(n.some(p=>p.id===d)||c(n[0]?.id??null))},[n,d]),s.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(n.length===0)return;p.preventDefault(),p.stopPropagation();let m=n.findIndex(x=>x.id===d),h=p.key==="ArrowDown"?1:-1,v=((m>=0?m:h===1?-1:0)+h+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(Mf,{autoHighlight:!1,mode:"none",children:b("div",{ref:l,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[u("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:u(te,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(jt,{className:"size-3"})})}),u(_f,{className:"max-h-64 scroll-pb-6",children:u(Rf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>b(Nf,{value:p.id,className:F("group/stash relative cursor-pointer select-none gap-3 rounded-lg px-3 py-1.5! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",d===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{d!==p.id&&c(p.id)},onMouseDown:m=>{m.preventDefault()},onClick:()=>{o(p)},children:[u("span",{className:"min-w-0 flex-1 truncate text-xs",children:P5(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):dT(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:dT(p)})}):null,p.attachments.length>0?u("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(m=>u("img",{src:m.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},m.id))}):null,u("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:aT(p.createdAt)}),u(te,{variant:"ghost",size:"icon-xs",className:"pointer-events-none shrink-0 [--control-icon-color:currentColor] opacity-0 shadow-none! transition-opacity pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 group-hover/stash:pointer-events-auto group-hover/stash:opacity-100 group-focus-within/stash:pointer-events-auto group-focus-within/stash:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100","aria-label":i("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(jt,{className:"stroke-2"})})]},p.id))})})]})})});me();function fT(e){let t=new Map;return e.map(n=>{let o=t.get(n.step)??0;return t.set(n.step,o+1),{key:`${n.step}:${o}`,step:n}})}function uT({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:F("flex w-10 shrink-0 items-center gap-0.5",e),children:fT(t).map(({key:n,step:o})=>u("span",{className:F("h-[3px] min-w-0 flex-1 rounded-full",o.status==="completed"?"bg-success":o.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},n))})}var fv=ue(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=De();if(i.totalSteps<=0)return null;let d=i.completedSteps>=i.totalSteps,c=l("tasksBadge.ariaLabel",{completed:i.completedSteps,total:i.totalSteps,step:i.step});return a==="inline"?b("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[b(te,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":c,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(uT,{steps:s}),b("span",{className:F("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:F("chat-composer-shoulder-tab chat-composer-tasks-tab absolute -top-7 left-4 z-0 flex h-8 items-center gap-1 rounded-t-xl border border-b-0 px-2 pb-1 text-xs leading-none text-muted-foreground",n?"right-28":"right-4",d&&"text-foreground"),"data-composer-tasks-badge":"true",children:[b("button",{type:"button","aria-expanded":t,"aria-label":c,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:"Tasks"}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:i.step}),b("span",{className:F("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(uT,{className:"w-20",steps:s})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]})}),pT=ue(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=De();return b("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[b("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[b("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:n,onPointerDown:i=>i.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),b("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:fT(r).map(({key:i,step:s})=>b("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:F("w-3 shrink-0 text-center font-mono text-[10px]",s.status==="completed"?"text-success":s.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:s.status==="completed"?"\u2713":s.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0 flex-1",s.status==="completed"?"text-muted-foreground/55":s.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:s.step}),u("span",{className:"ml-auto w-10 shrink-0 text-right text-[10px] text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:s.durationMs!==void 0?ss(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function mT(e){let t=0,n=0;for(let o of e.imageIds){let r=e.uploadsByImageId[o];r?.status==="failed"&&r.environmentId===e.environmentId?n+=1:(r?.status!=="ready"||r.environmentId!==e.environmentId)&&(t+=1)}return n>0?n===1?"Retry or remove the failed image":"Retry or remove the failed images":t>0?t===1?"Image still uploading":"Images still uploading":null}function fp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function gT(e){switch(e){case"image":return Xi;case"pdf":return Qi;case"text":return ji;case"file":return Ro}}var hT="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",vT=`${hT} border border-border/70 bg-accent/40 text-foreground`,A5=`${vT} text-[12px]`,mi=`${vT} text-[0.86em] select-none`,pp="relative inline-flex align-[-0.125em] leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']",Zr="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",xT="truncate leading-tight",ea="block self-center truncate leading-tight select-none",yT=`${hT} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,CT='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',mp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";function E5(e,t,n){let o=[];o.push(t(e));let r=n(e);return r&&o.push(r),e.pageUrl&&o.push(e.pageUrl),e.selector&&o.push(e.selector),e.htmlPreview.trim().length>0&&(o.push(""),o.push(e.htmlPreview.trim().slice(0,600))),o.join(`
3697
+ `)}function M5({context:e,onRemove:t}){let{t:n}=De(),o=Ot().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Qe,{children:[u(Ye,{render:b("span",{className:F(mi,"pr-1"),children:[u(Qr,{className:F(Zr,"size-icon-1")}),u("span",{className:ea,children:r}),a?u("span",{className:"select-none text-[10px] font-normal leading-tight text-muted-foreground/85",children:a}):null,u("button",{type:"button","aria-label":n("pendingContext.removeElement",{label:r}),className:mp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]})}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:E5(e,o.formatLabel,o.formatSourceLabel)})]})}function bT({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(o=>u(M5,{context:o,onRemove:t},o.id))})}function IT({comments:e,onRemove:t,className:n}){let{t:o}=De();return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:F(mi,"pr-1"),children:[u(Ji,{className:F(Zr,"size-icon-1")}),u("span",{className:ea,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:mp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Qe,{children:[u(Ye,{render:i}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function gp(e){let t=`${e.count} ${e.label}${e.count===1?"":"s"}`;return b(Qe,{children:[u(Ye,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Xe,{side:"top",children:t})]})}function ST({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=De(),l=Ot().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:F("flex flex-wrap gap-1.5",i),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(h=>{let g=l.normalizeSelection(h.element);return g?[{id:h.id,label:l.formatLabel(g)}]:[]});return b("section",{className:"group/preview-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[f?.previewUrl?u("button",{type:"button","aria-label":s("previewAnnotation.previewImage",{name:f.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>o(f.id),children:u("img",{src:f.previewUrl,alt:s("previewAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/preview-annotation:scale-[1.03]"})}):u("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:u(Qr,{className:"size-icon-2"})}),b("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[c.comment.trim()?u("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:c.comment.trim()}):null,b("div",{className:F("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?b("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:h,label:g})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:g},h)),m.length>2?b("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,b("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(gp,{icon:u(Qr,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(gp,{icon:u(Dd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(gp,{icon:u(Xr,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(gp,{icon:u(es,{className:"size-3"}),count:c.styleChanges.length,label:"style change"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:fp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Qe,{children:[u(Ye,{render:u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":`Retry upload for ${f.name}`,onClick:()=>a(f)}),children:u(ns,{className:"size-3"})}),u(Xe,{side:"top",children:p.reason})]}):null]})]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":s("previewAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>n(c.id),children:u(jt,{className:"size-3"})})]},c.id)})})}me();function wT(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function TT(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function LT(e,t){let n=Ot().pane.useVisible(),[o,r]=G(null);ye(()=>{if(!n)return;let i=e.current;if(!i)return;let s=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!s)return;let p=f.find(v=>v.target===i);if(!p)return;let m=window.getComputedStyle(i),h=Number.parseFloat(m.paddingLeft)||0,g=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+h+g))});return c.observe(i),()=>{s=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,s&&r(i.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{s=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=wT(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&TT(o,{hasWideActions:t})}}var pv={};An(pv,{LexicalComposerContext:()=>kT,createLexicalComposerContext:()=>R5,useLexicalComposerContext:()=>N5});me();var kT=Ht(null);function R5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function N5(){let e=fn(kT);return e==null&&(function(t,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of n)r.append("v",a);throw o.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var mv=pv,PT=mv.LexicalComposerContext,AT=mv.createLexicalComposerContext,In=mv.useLexicalComposerContext;var Kx={};An(Kx,{$addUpdateTag:()=>em,$applyNodeReplacement:()=>Xc,$caretFromPoint:()=>wi,$caretRangeFromSelection:()=>tx,$cloneWithProperties:()=>Ox,$cloneWithPropertiesEphemeral:()=>hH,$comparePointCaretNext:()=>$x,$copyNode:()=>_x,$create:()=>xH,$createLineBreakNode:()=>Dl,$createNodeSelection:()=>yx,$createParagraphNode:()=>Ea,$createPoint:()=>Pr,$createRangeSelection:()=>yk,$createRangeSelectionFromDom:()=>V$,$createTabNode:()=>jp,$createTextNode:()=>jn,$extendCaretToRange:()=>Bx,$findMatchingParent:()=>Mc,$getAdjacentChildCaret:()=>Kl,$getAdjacentNode:()=>zk,$getAdjacentSiblingOrParentSiblingCaret:()=>LH,$getCaretInDirection:()=>Ti,$getCaretRange:()=>Si,$getCaretRangeInDirection:()=>Ux,$getCharacterOffsets:()=>Gv,$getChildCaret:()=>Ra,$getChildCaretAtIndex:()=>eP,$getChildCaretOrSelf:()=>Qk,$getCollapsedCaretRange:()=>Xk,$getCommonAncestor:()=>Rc,$getCommonAncestorResultBranchOrder:()=>Hx,$getEditor:()=>Dx,$getNearestNodeFromDOMNode:()=>Zp,$getNearestRootOrShadowRoot:()=>Uk,$getNodeByKey:()=>Bn,$getNodeByKeyOrThrow:()=>Kk,$getNodeFromDOMNode:()=>kx,$getPreviousSelection:()=>Es,$getRoot:()=>Ko,$getSelection:()=>St,$getSiblingCaret:()=>Zn,$getState:()=>kp,$getStateChange:()=>u$,$getTextContent:()=>j$,$getTextNodeOffset:()=>kr,$getTextPointCaret:()=>Ii,$getTextPointCaretSlice:()=>Zv,$getWritableNodeState:()=>ax,$hasAncestor:()=>Up,$hasUpdateTag:()=>uH,$insertNodes:()=>G$,$isBlockElementNode:()=>q$,$isChildCaret:()=>Lr,$isDecoratorNode:()=>Qt,$isEditorState:()=>J$,$isElementNode:()=>Q,$isExtendableTextPointCaret:()=>Zk,$isInlineElementOrDecoratorNode:()=>fH,$isLeafNode:()=>lH,$isLineBreakNode:()=>Ss,$isNodeCaret:()=>bH,$isNodeSelection:()=>Wc,$isParagraphNode:()=>Lk,$isRangeSelection:()=>Ue,$isRootNode:()=>to,$isRootOrShadowRoot:()=>cr,$isSiblingCaret:()=>As,$isTabNode:()=>xx,$isTextNode:()=>Me,$isTextPointCaret:()=>Ma,$isTextPointCaretSlice:()=>TH,$isTokenOrSegmented:()=>ka,$isTokenOrTab:()=>vi,$nodesOfType:()=>cH,$normalizeCaret:()=>wr,$normalizeSelection__EXPERIMENTAL:()=>Pp,$onUpdate:()=>Hk,$parseSerializedNode:()=>Y$,$removeTextFromCaretRange:()=>Jk,$rewindSiblingCaret:()=>Gl,$selectAll:()=>dH,$setCompositionKey:()=>Xn,$setPointFromCaret:()=>ql,$setSelection:()=>Do,$setSelectionFromCaretRange:()=>Yk,$setState:()=>f$,$splitAtPointCaretNext:()=>AH,$splitNode:()=>pH,$updateRangeSelectionFromCaretRange:()=>Nc,ArtificialNode__DO_NOT_USE:()=>$p,BEFORE_INPUT_COMMAND:()=>sx,BLUR_COMMAND:()=>JL,CAN_REDO_COMMAND:()=>w$,CAN_UNDO_COMMAND:()=>T$,CLEAR_EDITOR_COMMAND:()=>I$,CLEAR_HISTORY_COMMAND:()=>S$,CLICK_COMMAND:()=>DL,COLLABORATION_TAG:()=>dk,COMMAND_PRIORITY_CRITICAL:()=>oH,COMMAND_PRIORITY_EDITOR:()=>Al,COMMAND_PRIORITY_HIGH:()=>nH,COMMAND_PRIORITY_LOW:()=>eH,COMMAND_PRIORITY_NORMAL:()=>tH,COMPOSITION_END_COMMAND:()=>cx,COMPOSITION_END_TAG:()=>pk,COMPOSITION_START_COMMAND:()=>dx,COMPOSITION_START_TAG:()=>fk,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ml,COPY_COMMAND:()=>gx,CUT_COMMAND:()=>hx,DELETE_CHARACTER_COMMAND:()=>Fc,DELETE_LINE_COMMAND:()=>zc,DELETE_WORD_COMMAND:()=>Bc,DRAGEND_COMMAND:()=>XL,DRAGOVER_COMMAND:()=>QL,DRAGSTART_COMMAND:()=>jL,DROP_COMMAND:()=>GL,DecoratorNode:()=>Hc,ElementNode:()=>Ci,FOCUS_COMMAND:()=>YL,FORMAT_ELEMENT_COMMAND:()=>b$,FORMAT_TEXT_COMMAND:()=>gi,HISTORIC_TAG:()=>N$,HISTORY_MERGE_TAG:()=>wp,HISTORY_PUSH_TAG:()=>_$,INDENT_CONTENT_COMMAND:()=>y$,INPUT_COMMAND:()=>lx,INSERT_LINE_BREAK_COMMAND:()=>Pc,INSERT_PARAGRAPH_COMMAND:()=>Fv,INSERT_TAB_COMMAND:()=>x$,INTERNAL_$isBlock:()=>Aa,IS_ALL_FORMATTING:()=>W5,IS_BOLD:()=>z5,IS_CODE:()=>K5,IS_HIGHLIGHT:()=>nx,IS_ITALIC:()=>$5,IS_STRIKETHROUGH:()=>H5,IS_SUBSCRIPT:()=>q5,IS_SUPERSCRIPT:()=>V5,IS_UNDERLINE:()=>U5,KEY_ARROW_DOWN_COMMAND:()=>HL,KEY_ARROW_LEFT_COMMAND:()=>BL,KEY_ARROW_RIGHT_COMMAND:()=>OL,KEY_ARROW_UP_COMMAND:()=>$L,KEY_BACKSPACE_COMMAND:()=>KL,KEY_DELETE_COMMAND:()=>VL,KEY_DOWN_COMMAND:()=>mx,KEY_ENTER_COMMAND:()=>Np,KEY_ESCAPE_COMMAND:()=>qL,KEY_MODIFIER_COMMAND:()=>ZL,KEY_SPACE_COMMAND:()=>UL,KEY_TAB_COMMAND:()=>WL,LineBreakNode:()=>_l,MOVE_TO_END:()=>FL,MOVE_TO_START:()=>zL,NODE_STATE_KEY:()=>a$,OUTDENT_CONTENT_COMMAND:()=>C$,PASTE_COMMAND:()=>ux,PASTE_TAG:()=>D$,ParagraphNode:()=>Bl,REDO_COMMAND:()=>px,REMOVE_TEXT_COMMAND:()=>Bv,RootNode:()=>Fl,SELECTION_CHANGE_COMMAND:()=>ix,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>v$,SELECT_ALL_COMMAND:()=>zv,SKIP_COLLAB_TAG:()=>O$,SKIP_DOM_SELECTION_TAG:()=>uk,SKIP_SCROLL_INTO_VIEW_TAG:()=>ck,SKIP_SELECTION_FOCUS_TAG:()=>Vv,TEXT_TYPE_TO_FORMAT:()=>fo,TabNode:()=>Ol,TextNode:()=>Ls,UNDO_COMMAND:()=>fx,addClassNamesToElement:()=>DH,buildImportMap:()=>R$,configExtension:()=>MH,createCommand:()=>Ge,createEditor:()=>rH,createSharedNodeState:()=>AL,createState:()=>c$,declarePeerDependency:()=>RH,defineExtension:()=>EH,flipDirection:()=>Li,getDOMOwnerDocument:()=>Rx,getDOMSelection:()=>Er,getDOMSelectionFromTarget:()=>qk,getDOMTextNode:()=>Ps,getEditorPropertyFromDOMNode:()=>jc,getNearestEditorFromDOMNode:()=>Lx,getRegisteredNode:()=>wx,getRegisteredNodeOrThrow:()=>Sx,getStaticNodeConfig:()=>Yc,getTextDirection:()=>sH,getTransformSetFromKlass:()=>Pk,isBlockDomNode:()=>Yv,isCurrentlyReadOnlyMode:()=>Vl,isDOMDocumentNode:()=>Mk,isDOMNode:()=>Wl,isDOMTextNode:()=>oa,isDOMUnmanaged:()=>jk,isDocumentFragment:()=>Vk,isExactShortcutMatch:()=>Pt,isHTMLAnchorElement:()=>mH,isHTMLElement:()=>ko,isInlineDomNode:()=>Wk,isLexicalEditor:()=>Yp,isModifierMatch:()=>Bk,isSelectionCapturedInDecoratorInput:()=>Tx,isSelectionWithinEditor:()=>Gc,makeStepwiseIterator:()=>zx,mergeRegister:()=>FH,normalizeClassNames:()=>Jc,removeClassNamesFromElement:()=>OH,removeFromParent:()=>xi,resetRandomKey:()=>aH,safeCast:()=>NH,setDOMUnmanaged:()=>vH,setNodeIndentFromDOM:()=>Gk,shallowMergeConfig:()=>_H,toggleTextFormatType:()=>Kc});function Z(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function bL(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);n.search=o.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Ar=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,_5=Ar&&"documentMode"in document?document.documentMode:null,Sr=Ar&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yi=Ar&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Lp=!(!Ar||!("InputEvent"in window)||_5)&&"getTargetRanges"in new window.InputEvent("input"),qp=Ar&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Vc=Ar&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,D5=Ar&&/Android/.test(navigator.userAgent),IL=Ar&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Tv=Ar&&D5&&IL,Vp=Ar&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Sr&&!IL,O5=0,F5=1,B5=2,z5=1,$5=2,H5=4,U5=8,K5=16,q5=32,V5=64,nx=128,W5=2047,G5=1,j5=2,Q5=3,X5=4,Y5=5,J5=6,_c=qp||Vc||Vp?"\xA0":"\u200B",Wp=`
3698
3698
 
3699
- `,ox=Ii?"\xA0":Bc,IL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",SL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Y5=new RegExp("^[^"+SL+"]*["+IL+"]"),J5=new RegExp("^[^"+IL+"]*["+SL+"]"),co={bold:1,capitalize:1024,code:16,highlight:nx,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Z5={directionless:1,unmergeable:2},Lv={center:2,end:6,justify:4,left:1,right:3,start:5},e$={[W5]:"center",[X5]:"end",[j5]:"justify",[V5]:"left",[G5]:"right",[Q5]:"start"},t$={normal:0,segmented:2,token:1},n$={[_5]:"normal",[O5]:"segmented",[D5]:"token"},o$="$",AT="$config";function wL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(Q(i)&&wL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var kv=!1,rx=0;function r$(e){rx=e.timeStamp}function gv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&em(e,n)!==void 0}function a$(e,t,n){let o=_r(Ho(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Ex(t,i,r,a,!1)}function i$(e,t,n){if(He(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return ia(t)&&n.isAttached()}function s$(e,t,n,o){for(let r=e;r&&!Gk(r);r=Zc(r)){let a=em(r,t);if(a!==void 0){let i=Dn(a,n);if(i)return Qt(i)||!So(r)?void 0:[r,i]}else if(r===o)return[o,Nk(n)]}}function TL(e,t,n){kv=!0;let o=performance.now()-rx>100;try{aa(e,()=>{let r=St()||(function(p){return p.getEditorState().read(()=>{let m=St();return m!==null?m.clone():null})})(e),a=new Map,i=e.getRootElement(),s=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],h=m.type,g=m.target,v=s$(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Me(y)&&ia(g)&&i$(r,g,y)&&a$(g,y,e);else if(h==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let L=C[S],I=kx(L),T=L.parentNode;if(T!=null&&L!==l&&I===null&&!gv(L,T,e)){if(Ii){let E=(So(L)?L.innerText:null)||L.nodeValue;E&&(c+=E)}T.removeChild(L)}}let w=m.removedNodes,k=w.length;if(k>0){let S=0;for(let L=0;L<k;L++){let I=w[L];(gv(I,g,e)||l===I)&&(g.appendChild(I),S++)}k!==S&&a.set(x,y)}}}if(a.size>0)for(let[p,m]of a)m.reconcileObservedMutation(p,e);let f=n.takeRecords();if(f.length>0){for(let p=0;p<f.length;p++){let m=f[p],h=m.addedNodes,g=m.target;for(let v=0;v<h.length;v++){let x=h[v],y=x.parentNode;y==null||x.nodeName!=="BR"||gv(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&_o(r),Ii&&zk(e)&&r.insertRawText(c))})}finally{kv=!1}}function LL(e){let t=e._observer;t!==null&&TL(e,t.takeRecords(),t)}function kL(e){(function(t){rx===0&&Ho(t).addEventListener("textInput",r$,!0)})(e),e._observer=new MutationObserver((t,n)=>{TL(e,t,n)})}var Pv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||u$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function l$(e,t){return new Pv(e,t)}function Ap(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function d$(e,t,n){let o=Ap(e,n,"direct"),r=Ap(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function c$(e,t,n){let o;if(Gn(),typeof n=="function"){let a=e.getLatest(),i=Ap(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return ax(r).updateFromKnown(t,o),r}function PL(e){let t=new Map,n=new Set;for(let o=typeof e=="function"?e:e.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=tu(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let i;"stateConfig"in a?(i=a.stateConfig,a.flat&&n.add(i.key)):i=a,t.set(i.key,i)}}return{flatKeys:n,sharedConfigMap:t}}var Av=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,n,o=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:i}=this.sharedNodeState,s=a!==void 0?a:(function(l,d,c){let f=c.size;if(d)for(let p in d){let m=l.get(p);m&&c.has(m)||f++}return f})(i,o,r);this.size=s}getValue(t){let n=this.knownState.get(t);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(t.key,t);let o=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(o=t.parse(r)),this.updateFromKnown(t,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete t[o.key]:t[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in t&&(n[o]=t[o],delete t[o]);return ET(t)&&(n.$=t),n}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new e(t,n,(function(a,i,s){let l;if(s)for(let[d,c]of Object.entries(s)){let f=a.get(d);f?i.has(f)||i.set(f,f.parse(c)):(l=l||{},l[d]=c)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(t,n){let o=t.key;this.sharedNodeState.sharedConfigMap.set(o,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&o in a||(a&&(delete a[o],this.unknownState=ET(a)),this.size++),r.set(t,n)}updateFromUnknown(t,n){let o=this.sharedNodeState.sharedConfigMap.get(t);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=n)}updateFromJSON(t){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,t)for(let[o,r]of Object.entries(t))this.updateFromUnknown(o,r)}};function ax(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Av(t,AL(t));return t.__state=n,n}function AL(e){return e.__state?e.__state.sharedNodeState:Sx(Dx(),e.getType()).sharedNodeState}function ET(e){if(e)for(let t in e)return e}function u$(e){return e}function MT(e,t,n){for(let[o,r]of t.knownState){if(e.has(o.key))continue;e.add(o.key);let a=n?n.getValue(o):o.defaultValue;if(a!==r&&!o.isEqual(a,r))return!0}return!1}function RT(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,i]of Object.entries(o))if(!e.has(a)&&(e.add(a),i!==(r?r[a]:void 0)))return!0}return!1}function NT(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function _T(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,i=t.__format,s=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===i)&&(r===null||r===s)&&(e.__state===null||l===d||(function(c,f){if(c===f)return!0;if(c&&f&&c.size!==f.size)return!1;let p=new Set;return!(c&&MT(p,c,f)||f&&MT(p,f,c)||c&&RT(p,c,f)||f&&RT(p,f,c))})(l,d))}function DT(e,t){let n=e.mergeWithSibling(t),o=Kt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function OT(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Me(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(_T(t,o)){o=DT(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Me(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(_T(o,n)){o=DT(o,n);break}break}n.remove()}}else o.remove()}function Ep(e){return FT(e.anchor),FT(e.focus),e}function FT(e){for(;e.type==="element";){let t=e.getNode(),n=e.offset,o,r;if(n===t.getChildrenSize()?(o=t.getChildAtIndex(n-1),r=!0):(o=t.getChildAtIndex(n),r=!1),Me(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!Q(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var Ts,to,zc,Qp,Ev,Mv,Ls,Ar,Rv,$c,_n="",ra=null,Is=null,El=!1,Mp=!1;function Rp(e,t){let n=Ls.get(e);if(t!==null){let o=Ov(e);o.parentNode===t&&t.removeChild(o)}if(Ar.has(e)||to._keyToDOMMap.delete(e),Q(n)){let o=_p(n,Ls);Nv(o,0,o.length-1,null)}n!==void 0&&Mx($c,zc,Qp,n,"destroyed")}function Nv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Rp(a,o)}}function bs(e,t){e.setProperty("text-align",t)}var f$="40px";function EL(e,t){let n=Ts.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(to._rootElement||e).getPropertyValue("--lexical-indent-base-value")||f$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function ML(e,t){let n=e.style;t===0?bs(n,""):t===1?bs(n,"left"):t===2?bs(n,"center"):t===3?bs(n,"right"):t===4?bs(n,"justify"):t===5?bs(n,"start"):t===6&&bs(n,"end")}function _v(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(eo(o))return null;let a=o.getParentOrThrow();return eo(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Np(e,t){let n=Ar.get(e);n===void 0&&ee(60);let o=n.createDOM(Ts,to);if((function(r,a,i){let s=i._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,i,r),s.set(r,a)})(e,o,to),Me(n)?o.setAttribute("data-lexical-text","true"):Qt(n)&&o.setAttribute("data-lexical-decorator","true"),Q(n)){let r=n.__indent,a=n.__size;if(_v(o,n),r!==0&&EL(o,r),a!==0){let s=a-1;Dv(_p(n,Ar),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&ML(o,i),n.isInline()||RL(null,n,o)}else{let r=n.getTextContent();if(Qt(n)){let a=n.decorate(to,Ts);a!==null&&NL(e,a),o.contentEditable="false"}_n+=r}return t!==null&&t.insertChild(o),Mx($c,zc,Qp,n,"created"),o}function Dv(e,t,n,o,r){let a=_n;_n="";let i=n;for(;i<=o;++i){Np(e[i],r);let s=Ar.get(e[i]);s!==null&&Me(s)?ra===null&&(ra=s.getFormat(),Is=s.getStyle()):Q(s)&&i<o&&!s.isInline()&&(_n+=jp)}r.element.__lexicalTextContent=_n,_n=a+_n}function BT(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return ws(o)?"line-break":Qt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function RL(e,t,n){let o=BT(e,Ls),r=BT(t,Ar);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function p$(e,t,n){var o;ra=null,Is=null,(function(r,a,i){let s=_n,l=r.__size,d=a.__size;_n="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Ip(f,c);else{let h=Ov(f),g=Np(p,null);try{c.replaceChild(g,h)}catch(v){if(typeof v=="object"&&v!=null){let x=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${g.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(x)}throw v}Rp(f,null)}let m=Ar.get(p);Me(m)&&ra===null&&(ra=m.getFormat(),Is=m.getStyle())}else{let f=_p(r,Ls),p=_p(a,Ar);if(f.length!==l&&ee(227),p.length!==d&&ee(228),l===0)d!==0&&Dv(p,0,0,d-1,i);else if(d===0){if(l!==0){let m=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;Nv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,h,g,v,x,y){let C=v-1,w=x-1,k,S,L=y.getFirstChild(),I=0,T=0;for(;I<=C&&T<=w;){let N=h[I],R=g[T];if(N===R)L=hv(Ip(R,y.element)),I++,T++;else{if(S===void 0&&(S=zT(g,T)),k===void 0)k=zT(h,I);else if(!k.has(N)){I++;continue}if(!S.has(N)){L=hv(Ov(N)),Rp(N,y.element),I++,k.delete(N);continue}if(k.has(R)){let H=Ul(to,R);H!==L&&y.withBefore(L).insertChild(H),L=hv(Ip(R,y.element)),I++,T++}else Np(R,y.withBefore(L)),T++}let $=Ar.get(R);$!==null&&Me($)?ra===null&&(ra=$.getFormat(),Is=$.getStyle()):Q($)&&T<=w&&!$.isInline()&&(_n+=jp)}let E=I>C,A=T>w;if(E&&!A){let N=g[w+1],R=N===void 0?null:to.getElementByKey(N);Dv(g,0,T,w,y.withBefore(R))}else A&&!E&&Nv(h,I,C,y.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=_n,_n=s+_n})(e,t,t.getDOMSlot(n)),o=t,ra==null||ra===o.__textFormat||Mp||o.setTextFormat(ra),(function(r){Is==null||Is===r.__textStyle||Mp||r.setTextStyle(Is)})(t)}function _p(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&ee(101),n.push(o),o=r.__next}return n}function Ip(e,t){let n=Ls.get(e),o=Ar.get(e);n!==void 0&&o!==void 0||ee(61);let r=El||Mv.has(e)||Ev.has(e),a=Ul(to,e);if(n===o&&!r){let i;if(Q(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return _n+=i,a}if(n!==o&&r&&Mx($c,zc,Qp,o,"updated"),o.updateDOM(n,a,Ts)){let i=Np(e,null);return t===null&&ee(62),t.replaceChild(i,a),Rp(e,null),i}if(Q(n)){Q(o)||ee(334,e);let i=o.__indent;(El||i!==n.__indent)&&EL(a,i);let s=o.__format;if((El||s!==n.__format)&&ML(a,s),r)p$(n,o,a),eo(o)||o.isInline()||RL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),_n+=d}if((El||o.__dir!==n.__dir)&&(_v(a,o),eo(o)&&!El))for(let l of o.getChildren())Q(l)&&_v(Ul(to,l.getKey()),l)}else{let i=o.getTextContent();if(Qt(o)){let s=o.decorate(to,Ts);s!==null&&NL(e,s)}_n+=i}if(!Mp&&eo(o)&&o.__cachedText!==_n){let i=o.getWritable();i.__cachedText=_n,o=i}return a}function NL(e,t){let n=to._pendingDecorators,o=to._decorators;if(n===null){if(o[e]===t)return;n=Rk(to)}n[e]=t}function hv(e){let t=e.nextSibling;return t!==null&&t===to._blockCursorElement&&(t=t.nextSibling),t}function zT(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function m$(e,t,n,o,r,a){_n="",El=o===2,to=n,Ts=n._config,zc=n._nodes,Qp=to._listeners.mutation,Ev=r,Mv=a,Ls=e._nodeMap,Ar=t._nodeMap,Mp=t._readOnly,Rv=new Map(n._keyToDOMMap);let i=new Map;return $c=i,Ip("root",null),to=void 0,zc=void 0,Ev=void 0,Mv=void 0,Ls=void 0,Ar=void 0,Ts=void 0,Rv=void 0,$c=void 0,i}function Ov(e){let t=Rv.get(e);return t===void 0&&ee(75,e),t}function je(e){return{type:e}}var ix=je("SELECTION_CHANGE_COMMAND"),g$=je("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),_L=je("CLICK_COMMAND"),sx=je("BEFORE_INPUT_COMMAND"),lx=je("INPUT_COMMAND"),dx=je("COMPOSITION_START_COMMAND"),cx=je("COMPOSITION_END_COMMAND"),Hc=je("DELETE_CHARACTER_COMMAND"),Rc=je("INSERT_LINE_BREAK_COMMAND"),Fv=je("INSERT_PARAGRAPH_COMMAND"),_l=je("CONTROLLED_TEXT_INSERTION_COMMAND"),ux=je("PASTE_COMMAND"),Bv=je("REMOVE_TEXT_COMMAND"),Uc=je("DELETE_WORD_COMMAND"),Kc=je("DELETE_LINE_COMMAND"),xi=je("FORMAT_TEXT_COMMAND"),fx=je("UNDO_COMMAND"),px=je("REDO_COMMAND"),mx=je("KEYDOWN_COMMAND"),DL=je("KEY_ARROW_RIGHT_COMMAND"),OL=je("MOVE_TO_END"),FL=je("KEY_ARROW_LEFT_COMMAND"),BL=je("MOVE_TO_START"),zL=je("KEY_ARROW_UP_COMMAND"),$L=je("KEY_ARROW_DOWN_COMMAND"),Dp=je("KEY_ENTER_COMMAND"),HL=je("KEY_SPACE_COMMAND"),UL=je("KEY_BACKSPACE_COMMAND"),KL=je("KEY_ESCAPE_COMMAND"),qL=je("KEY_DELETE_COMMAND"),VL=je("KEY_TAB_COMMAND"),h$=je("INSERT_TAB_COMMAND"),v$=je("INDENT_CONTENT_COMMAND"),x$=je("OUTDENT_CONTENT_COMMAND"),WL=je("DROP_COMMAND"),y$=je("FORMAT_ELEMENT_COMMAND"),GL=je("DRAGSTART_COMMAND"),jL=je("DRAGOVER_COMMAND"),QL=je("DRAGEND_COMMAND"),gx=je("COPY_COMMAND"),hx=je("CUT_COMMAND"),zv=je("SELECT_ALL_COMMAND"),C$=je("CLEAR_EDITOR_COMMAND"),b$=je("CLEAR_HISTORY_COMMAND"),I$=je("CAN_REDO_COMMAND"),S$=je("CAN_UNDO_COMMAND"),XL=je("FOCUS_COMMAND"),YL=je("BLUR_COMMAND"),JL=je("KEY_MODIFIER_COMMAND"),Aa=Object.freeze({}),$v=[["keydown",function(e,t){qc=e.timeStamp,ZL=e.key,!t.isComposing()&&Ce(t,mx,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;Ql(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&aa(t,()=>{Ak(n)||(Kv=!0)})}],["compositionstart",function(e,t){Ce(t,dx,e)}],["compositionend",function(e,t){Ii?Mc=!0:Qc||!Wp&&!Gp?Ce(t,cx,e):(Sp=!0,wp=e.data)}],["input",function(e,t){e.stopPropagation(),aa(t,()=>{t.dispatchCommand(lx,e)},{event:e}),Ml=null}],["click",function(e,t){aa(t,()=>{let n=St(),o=_r(Ho(t)),r=Ms();if(o){if(He(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!eo(i)&&$o().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&i!==n.focus.getNode()){let s=Dc(i,l=>Q(l)&&!l.isInline());Q(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(So(a)||ia(a))&&_o(Yp(r,o,t,e))}}Ce(t,_L,e)})}],["cut",Aa],["copy",Aa],["dragstart",Aa],["dragover",Aa],["dragend",Aa],["paste",Aa],["focus",Aa],["blur",Aa],["drop",Aa]];Pp&&$v.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||Ii&&zk(o)||r!=="insertCompositionText"&&Ce(o,sx,n)})(e,t)]);var qc=0,ZL=null,ek=0,Ml=null,Hv=new WeakMap,Op=new WeakMap,Uv=!1,Kv=!1,Nc=!1,Mc=!1,Sp=!1,wp="",Ss=null,tk=[0,"",0,"root",0];function nk(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Kt(),d=_r(Ho(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Me(s)||(!r&&(!Pp||ek<o+50)||s.isDirty()&&m<2||_k(n))&&a.offset!==i.offset&&!s.isComposing()||Ra(s)||s.isDirty()&&m>1||(r||!Pp)&&p!==null&&!s.isComposing()&&c!==As(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||(function(h,g){if(g.isSegmented())return!0;if(!h.isCollapsed())return!1;let v=h.anchor.offset,x=g.getParentOrThrow(),y=Ci(g);return v===0?!g.canInsertTextBefore()||!x.canInsertTextBefore()&&!g.isComposing()||y||(function(C){let w=C.getPreviousSibling();return(Me(w)||Q(w)&&w.isInline())&&!w.canInsertTextAfter()})(g):v===g.getTextContentSize()&&(!g.canInsertTextAfter()||!x.canInsertTextAfter()&&!g.isComposing()||y)})(e,s)}function $T(e,t){return ia(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function HT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Uv&&(Uv=!1,$T(o,r)&&$T(a,i)&&!Ss)||aa(t,()=>{if(!n)return void _o(null);if(!Yc(t,o,a))return;let s=St();if(Ss&&He(s)&&s.isCollapsed()){let l=s.anchor,d=Ss.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=Ss.clone(),_o(s))}if(Ss=null,He(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=Ho(t).event,f=c?c.timeStamp:performance.now(),[p,m,h,g,v]=tk,x=$o(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)Tp(s,p,m);else if(l.type==="text")Me(d)||ee(141),ok(s,d);else if(l.type==="element"&&!y){Q(d)||ee(259);let C=l.getNode();C.isEmpty()?(function(w,k){let S=k.getTextFormat(),L=k.getTextStyle();Tp(w,S,L)})(s,C):Tp(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,h=s.isBackward(),g=h?i:r,v=h?r:i,x=h?f:c,y=h?c:f,C=2047,w=!1;for(let k=0;k<m;k++){let S=p[k],L=S.getTextContentSize();if(Me(S)&&L!==0&&!(k===0&&S.__key===x&&g===L||k===m-1&&S.__key===y&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Ce(t,ix,void 0)})}function Tp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function ok(e,t){Tp(e,t.getFormat(),t.getStyle())}function rk(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function w$(e){let t=e.inputType,n=rk(e),o=Kt(),r=St();if(t==="deleteContentBackward"){if(r===null){let f=Ms();if(!He(f))return!0;_o(f.clone())}if(He(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,ZL==="MediaLast"&&a<qc+30&&o.isComposing()&&f){if(jn(null),qc=0,setTimeout(()=>{aa(o,()=>{jn(null)})},30),He(r)){let p=r.anchor.getNode();p.markDirty(),Me(p)||ee(142),ok(r,p)}}else{jn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),h=p.canInsertTextAfter(),g=r.anchor.offset===0&&r.focus.offset===m.length,v=Tv&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!Qt(Bk(r.anchor,!0))),!v){Ce(o,Hc,!0);let x=St();Tv&&He(x)&&x.isCollapsed()&&(Ss=x,setTimeout(()=>Ss=null))}}return!0}}var a;if(!He(r))return!0;let i=e.data;Ml!==null&&Ax(!1,o,Ml),r.dirty&&Ml===null||!r.isCollapsed()||eo(r.anchor.getNode())||n===null||r.applyDOMRange(n),Ml=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
3700
- `)e.preventDefault(),Ce(o,Rc,!1);else if(i===jp)e.preventDefault(),Ce(o,Fv,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&nk(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Ce(o,_l,i)):Ml=i;return ek=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Ce(o,_l,e);break;case"insertFromComposition":jn(null),Ce(o,_l,e);break;case"insertLineBreak":jn(null),Ce(o,Rc,!1);break;case"insertParagraph":jn(null),Nc&&!Qc?(Nc=!1,Ce(o,Rc,!1)):Ce(o,Fv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Ce(o,ux,e);break;case"deleteByComposition":(function(f,p){return f!==p||Q(f)||Q(p)||!Ci(f)||!Ci(p)})(d,c)&&Ce(o,Bv,e);break;case"deleteByDrag":case"deleteByCut":Ce(o,Bv,e);break;case"deleteContent":Ce(o,Hc,!1);break;case"deleteWordBackward":Ce(o,Uc,!0);break;case"deleteWordForward":Ce(o,Uc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Ce(o,Kc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Ce(o,Kc,!1);break;case"formatStrikeThrough":Ce(o,xi,"strikethrough");break;case"formatBold":Ce(o,xi,"bold");break;case"formatItalic":Ce(o,xi,"italic");break;case"formatUnderline":Ce(o,xi,"underline");break;case"historyUndo":Ce(o,fx,void 0);break;case"historyRedo":Ce(o,px,void 0)}return!0}function T$(e){if(So(e.target)&&Ak(e.target))return!0;let t=Kt(),n=St(),o=e.data,r=rk(e);if(o!=null&&He(n)&&nk(n,r,o,e.timeStamp,!1)){Mc&&(Fp(t,o),Mc=!1);let a=n.anchor.getNode(),i=_r(Ho(t));if(i===null)return!0;let s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,d=s?n.focus.offset:n.anchor.offset;Pp&&!n.isCollapsed()&&Me(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===Ok(i.anchorNode)||Ce(t,_l,o);let c=o.length;Ii&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Tv&&t.isComposing()&&(qc=0,jn(null))}else Ax(!1,t,o!==null?o:void 0),Mc&&(Fp(t,o||void 0),Mc=!1);return(function(){Gn();let a=Kt();LL(a)})(),!0}function L$(e){let t=Kt(),n=St();if(He(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();jn(o.key),nm(uk),(e.timeStamp<qc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Me(r)&&r.getStyle()!==n.style)&&Ce(t,_l,ox)}return!0}function k$(e){return Fp(Kt(),e.data),nm(fk),!0}function Fp(e,t){let n=e._compositionKey;if(jn(null),n!==null&&t!=null){if(t===""){let o=Dn(n),r=As(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Me(o)){let a=_r(Ho(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Ex(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3701
- `){let o=St();if(He(o)||Xc(o)){if(He(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Ce(e,Dp,null)}}}Ax(!0,e,t)}function P$(e){let t=Kt();if(e.key==null)return!0;if(Sp){if(mL(e))return aa(t,()=>{Fp(t,wp)}),Sp=!1,wp="",!0;Sp=!1,wp=""}if((function(n){return At(n,"ArrowRight",{shiftKey:"any"})})(e))Ce(t,DL,e);else if((function(n){return At(n,"ArrowRight",Ma)})(e))Ce(t,OL,e);else if((function(n){return At(n,"ArrowLeft",{shiftKey:"any"})})(e))Ce(t,FL,e);else if((function(n){return At(n,"ArrowLeft",Ma)})(e))Ce(t,BL,e);else if((function(n){return At(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Ce(t,zL,e);else if((function(n){return At(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Ce(t,$L,e);else if((function(n){return At(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Nc=!0,Ce(t,Dp,e);else if((function(n){return n.key===" "})(e))Ce(t,HL,e);else if((function(n){return kr&&At(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Nc=!0,Ce(t,Rc,!0);else if((function(n){return At(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Nc=!1,Ce(t,Dp,e);else if((function(n){return At(n,"Backspace",{shiftKey:"any"})||kr&&At(n,"h",{ctrlKey:!0})})(e))mL(e)?Ce(t,UL,e):(e.preventDefault(),Ce(t,Hc,!0));else if((function(n){return n.key==="Escape"})(e))Ce(t,KL,e);else if((function(n){return At(n,"Delete",{})||kr&&At(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Ce(t,qL,e):(e.preventDefault(),Ce(t,Hc,!1));else if((function(n){return At(n,"Backspace",pL)})(e))e.preventDefault(),Ce(t,Uc,!0);else if((function(n){return At(n,"Delete",pL)})(e))e.preventDefault(),Ce(t,Uc,!1);else if((function(n){return kr&&At(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Ce(t,Kc,!0);else if((function(n){return kr&&(At(n,"Delete",{metaKey:!0})||At(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Ce(t,Kc,!1);else if((function(n){return At(n,"b",Ma)})(e))e.preventDefault(),Ce(t,xi,"bold");else if((function(n){return At(n,"u",Ma)})(e))e.preventDefault(),Ce(t,xi,"underline");else if((function(n){return At(n,"i",Ma)})(e))e.preventDefault(),Ce(t,xi,"italic");else if((function(n){return At(n,"Tab",{shiftKey:"any"})})(e))Ce(t,VL,e);else if((function(n){return At(n,"z",Ma)})(e))e.preventDefault(),Ce(t,fx,void 0);else if((function(n){return kr?At(n,"z",{metaKey:!0,shiftKey:!0}):At(n,"y",{ctrlKey:!0})||At(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Ce(t,px,void 0);else{let n=t._editorState._selection;n===null||He(n)?gL(e)&&(e.preventDefault(),Ce(t,zv,e)):(function(o){return At(o,"c",Ma)})(e)?(e.preventDefault(),Ce(t,gx,e)):(function(o){return At(o,"x",Ma)})(e)?(e.preventDefault(),Ce(t,hx,e)):gL(e)&&(e.preventDefault(),Ce(t,zv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(JL,e),!0}function ak(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Dl=new Map;function ik(e){let t=Kk(e.target);if(t===null)return;let n=Lx(t.anchorNode);if(n===null)return;Kv&&(Kv=!1,aa(n,()=>{let l=Ms(),d=t.anchorNode;(So(d)||ia(d))&&_o(Yp(l,t,n,e))}));let o=Px(n),r=o[o.length-1],a=r._key,i=Dl.get(a),s=i||r;s!==n&&HT(t,s,!1),HT(t,n,!0),n!==r?Dl.set(a,n):i&&Dl.delete(a)}function UT(e){e._lexicalHandled=!0}function KT(e){return e._lexicalHandled===!0}var qT=()=>{};function A$(e){let t=Hv.get(e);if(t===void 0)return void qT();let n=Op.get(t);if(n===void 0)return void qT();let o=n-1;o>=0||ee(164),Hv.delete(e),Op.set(t,o),o===0&&t.removeEventListener("selectionchange",ik);let r=Jc(e);Zp(r)?((function(i){if(i._parentEditor!==null){let s=Px(i),l=s[s.length-1]._key;Dl.get(l)===i&&Dl.delete(l)}else Dl.delete(i._key)})(r),e.__lexicalEditor=null):r&&ee(198);let a=ak(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function qv(e,t,n){Gn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=St();if(!He(l)||!Q(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return qp(f,s)&&d.set(s.__key,0,"element"),qp(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(He(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(Hp(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(Hp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else Xc(a)&&t&&e.isSelected()&&e.selectPrevious();if(He(a)&&t&&!i){let s=e.getIndexWithinParent();bi(e),$p(a,r,s,-1)}else bi(e);n||fr(r)||r.canBeEmpty()||!r.isEmpty()||qv(r,t),t&&a&&eo(r)&&r.isEmpty()&&r.selectEnd()}function E$(e){return e}var sk=Symbol.for("ephemeral");function Bp(e){return e[sk]||!1}var ur=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=tu(this);return t===void 0&&ee(64,this.name),t}static clone(t){ee(65,this.name)}$config(){return{}}config(t,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:t}),{[t]:n}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Mk(this,t)}getType(){return this.__type}isInline(){ee(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Dn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||St();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Me(this))return o;if(He(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Qt(this)&&this.isInline()&&r){let a=n.isBackward()?n.focus:n.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let n=t.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Dn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&ee(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(fr(n))return Q(t)||t===this&&Qt(t)||ee(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&ee(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Dn(t)}getPreviousSiblings(){let t=[],n=this.getParent();if(n===null)return t;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)t.push(o),o=o.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Dn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=Q(this)?this:this.getParent(),o=Q(t)?t:t.getParent(),r=n&&o?Oc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Oc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Hx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&ee(279),!1)))}isParentOf(t){let n=Oc(this,t);return n!==null&&n.type==="ancestor"}getNodesBetween(t){let n=this.isBefore(t),o=[],r=new Set,a=this;for(;a!==null;){let i=a.__key;if(r.has(i)||(r.add(i),o.push(a)),a===t)break;let s=Q(a)?n?a.getFirstChild():a.getLastChild():null;if(s!==null){a=s;continue}let l=n?a.getNextSibling():a.getPreviousSibling();if(l!==null){a=l;continue}let d=a.getParentOrThrow();if(r.has(d.__key)||o.push(d),d===t)break;let c=null,f=d;do{if(f===null&&ee(68),c=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||r.has(f.__key)||o.push(f)}while(c===null);a=c}return n||o.reverse(),o}isDirty(){let t=Kt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Bp(this))return this;let t=Dn(this.__key);return t===null&&ee(113),t}getWritable(){if(Bp(this))return this;Gn();let t=Ba(),n=Kt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=St();if(s!==null&&s.setCachedNodes(null),i.has(r))return Kp(a),a;let l=Ox(a);return i.add(r),Kp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){ee(70)}updateDOM(t,n,o){ee(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){let t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){ee(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of AL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&ax(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){qv(this,!0,t)}replace(t,n){Gn();let o=St();o!==null&&(o=o.clone()),Iv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;bi(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;if(qv(r,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,s.__prev=p,f===null?l.__last=i:f.getWritable().__prev=i,s.__next=m,s.__parent=h,l.__size=d,n&&(Q(this)&&Q(s)||ee(139),this.getChildren().forEach(g=>{s.append(g)})),He(o)){_o(o);let g=o.anchor,v=o.focus;g.key===a&&jT(g,s),v.key===a&&jT(v,s)}return yi()===a&&jn(i),s}insertAfter(t,n=!0){Gn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=St(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(bi(r),He(i)){let h=a.__key,g=i.anchor,v=i.focus;s=g.type==="element"&&g.key===h&&g.offset===m+1,l=v.type==="element"&&v.key===h&&v.offset===m+1}}let d=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=r.__key,p=o.__next;if(d===null?c.__last=f:d.getWritable().__prev=f,c.__size++,o.__next=f,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&He(i)){let m=this.getIndexWithinParent();$p(i,c,m+1);let h=c.__key;s&&i.anchor.set(h,m+2,"element"),l&&i.focus.set(h,m+2,"element")}return t}insertBefore(t,n=!0){Gn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;bi(r);let i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();i===null?s.__first=a:i.getWritable().__next=a,s.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=St();return n&&He(c)&&$p(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Da()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){Gn();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(Q(o))return o.select();if(!Me(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){Gn();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(Q(o))return o.select(0,0);if(!Me(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},M$="historic",R$="history-push",Lp="history-merge",N$="paste",lk="collaboration",_$="skip-collab",dk="skip-scroll-into-view",ck="skip-dom-selection",Vv="skip-selection-focus",uk="composition-start",fk="composition-end",Fl=class e extends ur{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3702
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&xp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&xp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&xp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&xp(a))return!0}return!1})(t)?null:{conversion:D$,priority:0}}}static importJSON(t){return Bl().updateFromJSON(t)}};function D$(e){return{node:Bl()}}function Bl(){return eu(new Fl)}function ws(e){return e instanceof Fl}function xp(e){return ia(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function vv(e,t){return 16&t?"code":t&nx?"mark":32&t?"sub":64&t?"sup":null}function xv(e,t){return 1&t?"strong":2&t?"em":"span"}function pk(e,t,n,o,r){let a=o.classList,i=Ol(r,"base");i!==void 0&&a.add(...i),i=Ol(r,"underlineStrikethrough");let s=!1,l=8&t&&4&t;i!==void 0&&(8&n&&4&n?(s=!0,l||a.add(...i)):l&&a.remove(...i));for(let d in co){let c=co[d];if(i=Ol(r,d),i!==void 0)if(n&c){if(s&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...i);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...i)}else t&c&&a.remove(...i)}}function mk(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?Bc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||Ii){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,h=0,g=0;for(;h<p&&h<m&&c[h]===f[h];)h++;for(;g+h<p&&g+h<m&&c[p-g-1]===f[m-g-1];)g++;return[h,p-h-g,f.slice(h,m-g)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function VT(e,t,n,o,r,a){mk(r,e,t);let i=a.theme.text;i!==void 0&&pk(0,0,o,e,i)}function yp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var ks=class e extends ur{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",n){super(n),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return n$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===yi()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=co[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Gc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=vv(0,o),a=xv(0,o),i=r===null?a:r,s=document.createElement(i),l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),s.appendChild(l)),VT(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(s.style.cssText=d),s}updateDOM(t,n,o){let r=this.__text,a=t.__format,i=this.__format,s=vv(0,a),l=vv(0,i),d=xv(0,a),c=xv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let g=n.firstChild;g==null&&ee(48);let v=document.createElement(c);return VT(v,this,0,i,r,o),n.replaceChild(v,g),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&ee(49)),mk(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&pk(0,a,i,f,p);let m=t.__style,h=this.__style;return m!==h&&(n.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:z$,priority:0}),b:()=>({conversion:F$,priority:0}),code:()=>({conversion:Ea,priority:0}),em:()=>({conversion:Ea,priority:0}),i:()=>({conversion:Ea,priority:0}),mark:()=>({conversion:Ea,priority:0}),s:()=>({conversion:Ea,priority:0}),span:()=>({conversion:O$,priority:0}),strong:()=>({conversion:Ea,priority:0}),sub:()=>({conversion:Ea,priority:0}),sup:()=>({conversion:Ea,priority:0}),u:()=>({conversion:Ea,priority:0})}}static importJSON(t){return Wn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:n}=super.exportDOM(t);return So(n)||ee(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=yp(n,"b")),this.hasFormat("italic")&&(n=yp(n,"i")),this.hasFormat("strikethrough")&&(n=yp(n,"s")),this.hasFormat("underline")&&(n=yp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,n){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?co[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?Z5[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Gc(this.getFormat(),t,null);return this.setFormat(n)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let n=t$[t];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){Gn();let o=t,r=n,a=St(),i=this.getTextContent(),s=this.__key;if(typeof i=="string"){let l=i.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!He(a))return vk(s,o,s,r,"text","text");{let l=yi();l!==a.anchor.key&&l!==a.focus.key||jn(s),a.setTextNodeRange(this,o,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,n,o,r){let a=this.getWritable(),i=a.__text,s=o.length,l=t;l<0&&(l=s+l,l<0&&(l=0));let d=St();if(r&&He(d)){let f=t+s;d.setTextNodeRange(a,f,a,f)}let c=i.slice(0,l)+o+i.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Gn();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=yi(),i=o.length;t.sort((I,T)=>I-T),t.push(i);let s=[],l=t.length;for(let I=0,T=0;I<i&&T<=l;T++){let E=t[T];E>I&&(s.push(o.slice(I,E)),I=E)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),h=n.getStyle(),g=n.__detail,v=!1,x=null,y=null,C=St();if(He(C)){let[I,T]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];I.type==="text"&&I.key===r&&(x=I),T.type==="text"&&T.key===r&&(y=T)}n.isSegmented()?(p=Wn(c),p.__format=m,p.__style=h,p.__detail=g,p.__state=NT(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let I=1;I<d;I++){let T=Wn(s[I]);T.__format=m,T.__style=h,T.__detail=g,T.__state=NT(n,T);let E=T.__key;a===r&&jn(E),w.push(T)}let k=x?x.offset:null,S=y?y.offset:null,L=0;for(let I of w){if(!x&&!y)break;let T=L+I.getTextContentSize();if(x!==null&&k!==null&&k<=T&&k>=L&&(x.set(I.getKey(),k-L,"text"),k<T&&(x=null)),y!==null&&S!==null&&S<=T&&S>=L){y.set(I.getKey(),S-L,"text");break}L=T}if(f!==null){(function(E){let A=E.getPreviousSibling(),N=E.getNextSibling();A!==null&&Kp(A),N!==null&&Kp(N)})(this);let I=f.getWritable(),T=this.getIndexWithinParent();v?(I.splice(T,0,w),this.remove()):I.splice(T,1,w),He(C)&&$p(C,f,T,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||ee(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;yi()===r&&jn(o);let s=St();if(He(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&tL(f,n,o,t,i),p!==null&&p.key===r&&tL(p,n,o,t,i)}let l=t.__text,d=n?l+a:a+l;this.setTextContent(d);let c=this.getWritable();return t.remove(),c}isTextEntity(){return!1}};function O$(e){return{forChild:vx(e.style),node:null}}function F$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:vx(t.style,n?void 0:"bold"),node:null}}var WT=new WeakMap;function B$(e){if(!So(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function z$(e){let t=e;e.parentElement===null&&ee(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=WT.get(a))===void 0&&!B$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)WT.set(i[l],s);return s})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let i=0;i<a;i++){let s=o[i];s===`
3699
+ `,ox=yi?"\xA0":_c,SL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",wL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Z5=new RegExp("^[^"+wL+"]*["+SL+"]"),e$=new RegExp("^[^"+SL+"]*["+wL+"]"),fo={bold:1,capitalize:1024,code:16,highlight:nx,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},t$={directionless:1,unmergeable:2},Lv={center:2,end:6,justify:4,left:1,right:3,start:5},n$={[j5]:"center",[J5]:"end",[X5]:"justify",[G5]:"left",[Q5]:"right",[Y5]:"start"},o$={normal:0,segmented:2,token:1},r$={[O5]:"normal",[B5]:"segmented",[F5]:"token"},a$="$",ET="$config";function TL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(Q(i)&&TL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var kv=!1,rx=0;function i$(e){rx=e.timeStamp}function gv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&Jp(e,n)!==void 0}function s$(e,t,n){let o=Er(qo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Ex(t,i,r,a,!1)}function l$(e,t,n){if(Ue(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return oa(t)&&n.isAttached()}function d$(e,t,n,o){for(let r=e;r&&!jk(r);r=Qc(r)){let a=Jp(r,t);if(a!==void 0){let i=Bn(a,n);if(i)return Qt(i)||!ko(r)?void 0:[r,i]}else if(r===o)return[o,_k(n)]}}function LL(e,t,n){kv=!0;let o=performance.now()-rx>100;try{na(e,()=>{let r=St()||(function(p){return p.getEditorState().read(()=>{let m=St();return m!==null?m.clone():null})})(e),a=new Map,i=e.getRootElement(),s=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],h=m.type,g=m.target,v=d$(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Me(y)&&oa(g)&&l$(r,g,y)&&s$(g,y,e);else if(h==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let L=C[S],I=kx(L),T=L.parentNode;if(T!=null&&L!==l&&I===null&&!gv(L,T,e)){if(yi){let E=(ko(L)?L.innerText:null)||L.nodeValue;E&&(c+=E)}T.removeChild(L)}}let w=m.removedNodes,k=w.length;if(k>0){let S=0;for(let L=0;L<k;L++){let I=w[L];(gv(I,g,e)||l===I)&&(g.appendChild(I),S++)}k!==S&&a.set(x,y)}}}if(a.size>0)for(let[p,m]of a)m.reconcileObservedMutation(p,e);let f=n.takeRecords();if(f.length>0){for(let p=0;p<f.length;p++){let m=f[p],h=m.addedNodes,g=m.target;for(let v=0;v<h.length;v++){let x=h[v],y=x.parentNode;y==null||x.nodeName!=="BR"||gv(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&Do(r),yi&&$k(e)&&r.insertRawText(c))})}finally{kv=!1}}function kL(e){let t=e._observer;t!==null&&LL(e,t.takeRecords(),t)}function PL(e){(function(t){rx===0&&qo(t).addEventListener("textInput",i$,!0)})(e),e._observer=new MutationObserver((t,n)=>{LL(e,t,n)})}var Pv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||p$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function c$(e,t){return new Pv(e,t)}function kp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function u$(e,t,n){let o=kp(e,n,"direct"),r=kp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function f$(e,t,n){let o;if(Qn(),typeof n=="function"){let a=e.getLatest(),i=kp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return ax(r).updateFromKnown(t,o),r}function AL(e){let t=new Map,n=new Set;for(let o=typeof e=="function"?e:e.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=Yc(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let i;"stateConfig"in a?(i=a.stateConfig,a.flat&&n.add(i.key)):i=a,t.set(i.key,i)}}return{flatKeys:n,sharedConfigMap:t}}var Av=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,n,o=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:i}=this.sharedNodeState,s=a!==void 0?a:(function(l,d,c){let f=c.size;if(d)for(let p in d){let m=l.get(p);m&&c.has(m)||f++}return f})(i,o,r);this.size=s}getValue(t){let n=this.knownState.get(t);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(t.key,t);let o=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(o=t.parse(r)),this.updateFromKnown(t,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete t[o.key]:t[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in t&&(n[o]=t[o],delete t[o]);return MT(t)&&(n.$=t),n}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new e(t,n,(function(a,i,s){let l;if(s)for(let[d,c]of Object.entries(s)){let f=a.get(d);f?i.has(f)||i.set(f,f.parse(c)):(l=l||{},l[d]=c)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(t,n){let o=t.key;this.sharedNodeState.sharedConfigMap.set(o,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&o in a||(a&&(delete a[o],this.unknownState=MT(a)),this.size++),r.set(t,n)}updateFromUnknown(t,n){let o=this.sharedNodeState.sharedConfigMap.get(t);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=n)}updateFromJSON(t){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,t)for(let[o,r]of Object.entries(t))this.updateFromUnknown(o,r)}};function ax(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Av(t,EL(t));return t.__state=n,n}function EL(e){return e.__state?e.__state.sharedNodeState:Sx(Dx(),e.getType()).sharedNodeState}function MT(e){if(e)for(let t in e)return e}function p$(e){return e}function RT(e,t,n){for(let[o,r]of t.knownState){if(e.has(o.key))continue;e.add(o.key);let a=n?n.getValue(o):o.defaultValue;if(a!==r&&!o.isEqual(a,r))return!0}return!1}function NT(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,i]of Object.entries(o))if(!e.has(a)&&(e.add(a),i!==(r?r[a]:void 0)))return!0}return!1}function _T(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function DT(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,i=t.__format,s=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===i)&&(r===null||r===s)&&(e.__state===null||l===d||(function(c,f){if(c===f)return!0;if(c&&f&&c.size!==f.size)return!1;let p=new Set;return!(c&&RT(p,c,f)||f&&RT(p,f,c)||c&&NT(p,c,f)||f&&NT(p,f,c))})(l,d))}function OT(e,t){let n=e.mergeWithSibling(t),o=Kt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function FT(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Me(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(DT(t,o)){o=OT(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Me(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(DT(o,n)){o=OT(o,n);break}break}n.remove()}}else o.remove()}function Pp(e){return BT(e.anchor),BT(e.focus),e}function BT(e){for(;e.type==="element";){let t=e.getNode(),n=e.offset,o,r;if(n===t.getChildrenSize()?(o=t.getChildAtIndex(n-1),r=!0):(o=t.getChildAtIndex(n),r=!1),Me(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!Q(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var ws,no,Dc,Gp,Ev,Mv,Ts,Tr,Rv,Oc,Fn="",ta=null,bs=null,kl=!1,Ap=!1;function Ep(e,t){let n=Ts.get(e);if(t!==null){let o=Ov(e);o.parentNode===t&&t.removeChild(o)}if(Tr.has(e)||no._keyToDOMMap.delete(e),Q(n)){let o=Rp(n,Ts);Nv(o,0,o.length-1,null)}n!==void 0&&Mx(Oc,Dc,Gp,n,"destroyed")}function Nv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Ep(a,o)}}function Cs(e,t){e.setProperty("text-align",t)}var m$="40px";function ML(e,t){let n=ws.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(no._rootElement||e).getPropertyValue("--lexical-indent-base-value")||m$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function RL(e,t){let n=e.style;t===0?Cs(n,""):t===1?Cs(n,"left"):t===2?Cs(n,"center"):t===3?Cs(n,"right"):t===4?Cs(n,"justify"):t===5?Cs(n,"start"):t===6&&Cs(n,"end")}function _v(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(to(o))return null;let a=o.getParentOrThrow();return to(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Mp(e,t){let n=Tr.get(e);n===void 0&&Z(60);let o=n.createDOM(ws,no);if((function(r,a,i){let s=i._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,i,r),s.set(r,a)})(e,o,no),Me(n)?o.setAttribute("data-lexical-text","true"):Qt(n)&&o.setAttribute("data-lexical-decorator","true"),Q(n)){let r=n.__indent,a=n.__size;if(_v(o,n),r!==0&&ML(o,r),a!==0){let s=a-1;Dv(Rp(n,Tr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&RL(o,i),n.isInline()||NL(null,n,o)}else{let r=n.getTextContent();if(Qt(n)){let a=n.decorate(no,ws);a!==null&&_L(e,a),o.contentEditable="false"}Fn+=r}return t!==null&&t.insertChild(o),Mx(Oc,Dc,Gp,n,"created"),o}function Dv(e,t,n,o,r){let a=Fn;Fn="";let i=n;for(;i<=o;++i){Mp(e[i],r);let s=Tr.get(e[i]);s!==null&&Me(s)?ta===null&&(ta=s.getFormat(),bs=s.getStyle()):Q(s)&&i<o&&!s.isInline()&&(Fn+=Wp)}r.element.__lexicalTextContent=Fn,Fn=a+Fn}function zT(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return Ss(o)?"line-break":Qt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function NL(e,t,n){let o=zT(e,Ts),r=zT(t,Tr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function g$(e,t,n){var o;ta=null,bs=null,(function(r,a,i){let s=Fn,l=r.__size,d=a.__size;Fn="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Cp(f,c);else{let h=Ov(f),g=Mp(p,null);try{c.replaceChild(g,h)}catch(v){if(typeof v=="object"&&v!=null){let x=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${g.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(x)}throw v}Ep(f,null)}let m=Tr.get(p);Me(m)&&ta===null&&(ta=m.getFormat(),bs=m.getStyle())}else{let f=Rp(r,Ts),p=Rp(a,Tr);if(f.length!==l&&Z(227),p.length!==d&&Z(228),l===0)d!==0&&Dv(p,0,0,d-1,i);else if(d===0){if(l!==0){let m=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;Nv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,h,g,v,x,y){let C=v-1,w=x-1,k,S,L=y.getFirstChild(),I=0,T=0;for(;I<=C&&T<=w;){let N=h[I],R=g[T];if(N===R)L=hv(Cp(R,y.element)),I++,T++;else{if(S===void 0&&(S=$T(g,T)),k===void 0)k=$T(h,I);else if(!k.has(N)){I++;continue}if(!S.has(N)){L=hv(Ov(N)),Ep(N,y.element),I++,k.delete(N);continue}if(k.has(R)){let H=zl(no,R);H!==L&&y.withBefore(L).insertChild(H),L=hv(Cp(R,y.element)),I++,T++}else Mp(R,y.withBefore(L)),T++}let $=Tr.get(R);$!==null&&Me($)?ta===null&&(ta=$.getFormat(),bs=$.getStyle()):Q($)&&T<=w&&!$.isInline()&&(Fn+=Wp)}let E=I>C,A=T>w;if(E&&!A){let N=g[w+1],R=N===void 0?null:no.getElementByKey(N);Dv(g,0,T,w,y.withBefore(R))}else A&&!E&&Nv(h,I,C,y.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=Fn,Fn=s+Fn})(e,t,t.getDOMSlot(n)),o=t,ta==null||ta===o.__textFormat||Ap||o.setTextFormat(ta),(function(r){bs==null||bs===r.__textStyle||Ap||r.setTextStyle(bs)})(t)}function Rp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&Z(101),n.push(o),o=r.__next}return n}function Cp(e,t){let n=Ts.get(e),o=Tr.get(e);n!==void 0&&o!==void 0||Z(61);let r=kl||Mv.has(e)||Ev.has(e),a=zl(no,e);if(n===o&&!r){let i;if(Q(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return Fn+=i,a}if(n!==o&&r&&Mx(Oc,Dc,Gp,o,"updated"),o.updateDOM(n,a,ws)){let i=Mp(e,null);return t===null&&Z(62),t.replaceChild(i,a),Ep(e,null),i}if(Q(n)){Q(o)||Z(334,e);let i=o.__indent;(kl||i!==n.__indent)&&ML(a,i);let s=o.__format;if((kl||s!==n.__format)&&RL(a,s),r)g$(n,o,a),to(o)||o.isInline()||NL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),Fn+=d}if((kl||o.__dir!==n.__dir)&&(_v(a,o),to(o)&&!kl))for(let l of o.getChildren())Q(l)&&_v(zl(no,l.getKey()),l)}else{let i=o.getTextContent();if(Qt(o)){let s=o.decorate(no,ws);s!==null&&_L(e,s)}Fn+=i}if(!Ap&&to(o)&&o.__cachedText!==Fn){let i=o.getWritable();i.__cachedText=Fn,o=i}return a}function _L(e,t){let n=no._pendingDecorators,o=no._decorators;if(n===null){if(o[e]===t)return;n=Nk(no)}n[e]=t}function hv(e){let t=e.nextSibling;return t!==null&&t===no._blockCursorElement&&(t=t.nextSibling),t}function $T(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function h$(e,t,n,o,r,a){Fn="",kl=o===2,no=n,ws=n._config,Dc=n._nodes,Gp=no._listeners.mutation,Ev=r,Mv=a,Ts=e._nodeMap,Tr=t._nodeMap,Ap=t._readOnly,Rv=new Map(n._keyToDOMMap);let i=new Map;return Oc=i,Cp("root",null),no=void 0,Dc=void 0,Ev=void 0,Mv=void 0,Ts=void 0,Tr=void 0,ws=void 0,Rv=void 0,Oc=void 0,i}function Ov(e){let t=Rv.get(e);return t===void 0&&Z(75,e),t}function Ge(e){return{type:e}}var ix=Ge("SELECTION_CHANGE_COMMAND"),v$=Ge("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),DL=Ge("CLICK_COMMAND"),sx=Ge("BEFORE_INPUT_COMMAND"),lx=Ge("INPUT_COMMAND"),dx=Ge("COMPOSITION_START_COMMAND"),cx=Ge("COMPOSITION_END_COMMAND"),Fc=Ge("DELETE_CHARACTER_COMMAND"),Pc=Ge("INSERT_LINE_BREAK_COMMAND"),Fv=Ge("INSERT_PARAGRAPH_COMMAND"),Ml=Ge("CONTROLLED_TEXT_INSERTION_COMMAND"),ux=Ge("PASTE_COMMAND"),Bv=Ge("REMOVE_TEXT_COMMAND"),Bc=Ge("DELETE_WORD_COMMAND"),zc=Ge("DELETE_LINE_COMMAND"),gi=Ge("FORMAT_TEXT_COMMAND"),fx=Ge("UNDO_COMMAND"),px=Ge("REDO_COMMAND"),mx=Ge("KEYDOWN_COMMAND"),OL=Ge("KEY_ARROW_RIGHT_COMMAND"),FL=Ge("MOVE_TO_END"),BL=Ge("KEY_ARROW_LEFT_COMMAND"),zL=Ge("MOVE_TO_START"),$L=Ge("KEY_ARROW_UP_COMMAND"),HL=Ge("KEY_ARROW_DOWN_COMMAND"),Np=Ge("KEY_ENTER_COMMAND"),UL=Ge("KEY_SPACE_COMMAND"),KL=Ge("KEY_BACKSPACE_COMMAND"),qL=Ge("KEY_ESCAPE_COMMAND"),VL=Ge("KEY_DELETE_COMMAND"),WL=Ge("KEY_TAB_COMMAND"),x$=Ge("INSERT_TAB_COMMAND"),y$=Ge("INDENT_CONTENT_COMMAND"),C$=Ge("OUTDENT_CONTENT_COMMAND"),GL=Ge("DROP_COMMAND"),b$=Ge("FORMAT_ELEMENT_COMMAND"),jL=Ge("DRAGSTART_COMMAND"),QL=Ge("DRAGOVER_COMMAND"),XL=Ge("DRAGEND_COMMAND"),gx=Ge("COPY_COMMAND"),hx=Ge("CUT_COMMAND"),zv=Ge("SELECT_ALL_COMMAND"),I$=Ge("CLEAR_EDITOR_COMMAND"),S$=Ge("CLEAR_HISTORY_COMMAND"),w$=Ge("CAN_REDO_COMMAND"),T$=Ge("CAN_UNDO_COMMAND"),YL=Ge("FOCUS_COMMAND"),JL=Ge("BLUR_COMMAND"),ZL=Ge("KEY_MODIFIER_COMMAND"),wa=Object.freeze({}),$v=[["keydown",function(e,t){$c=e.timeStamp,ek=e.key,!t.isComposing()&&Ce(t,mx,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;Wl(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&na(t,()=>{Ek(n)||(Kv=!0)})}],["compositionstart",function(e,t){Ce(t,dx,e)}],["compositionend",function(e,t){yi?kc=!0:Vc||!qp&&!Vp?Ce(t,cx,e):(bp=!0,Ip=e.data)}],["input",function(e,t){e.stopPropagation(),na(t,()=>{t.dispatchCommand(lx,e)},{event:e}),Pl=null}],["click",function(e,t){na(t,()=>{let n=St(),o=Er(qo(t)),r=Es();if(o){if(Ue(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!to(i)&&Ko().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&i!==n.focus.getNode()){let s=Mc(i,l=>Q(l)&&!l.isInline());Q(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(ko(a)||oa(a))&&Do(Qp(r,o,t,e))}}Ce(t,DL,e)})}],["cut",wa],["copy",wa],["dragstart",wa],["dragover",wa],["dragend",wa],["paste",wa],["focus",wa],["blur",wa],["drop",wa]];Lp&&$v.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||yi&&$k(o)||r!=="insertCompositionText"&&Ce(o,sx,n)})(e,t)]);var $c=0,ek=null,tk=0,Pl=null,Hv=new WeakMap,_p=new WeakMap,Uv=!1,Kv=!1,Ac=!1,kc=!1,bp=!1,Ip="",Is=null,nk=[0,"",0,"root",0];function ok(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Kt(),d=Er(qo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Me(s)||(!r&&(!Lp||tk<o+50)||s.isDirty()&&m<2||Dk(n))&&a.offset!==i.offset&&!s.isComposing()||ka(s)||s.isDirty()&&m>1||(r||!Lp)&&p!==null&&!s.isComposing()&&c!==Ps(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||(function(h,g){if(g.isSegmented())return!0;if(!h.isCollapsed())return!1;let v=h.anchor.offset,x=g.getParentOrThrow(),y=vi(g);return v===0?!g.canInsertTextBefore()||!x.canInsertTextBefore()&&!g.isComposing()||y||(function(C){let w=C.getPreviousSibling();return(Me(w)||Q(w)&&w.isInline())&&!w.canInsertTextAfter()})(g):v===g.getTextContentSize()&&(!g.canInsertTextAfter()||!x.canInsertTextAfter()&&!g.isComposing()||y)})(e,s)}function HT(e,t){return oa(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function UT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Uv&&(Uv=!1,HT(o,r)&&HT(a,i)&&!Is)||na(t,()=>{if(!n)return void Do(null);if(!Gc(t,o,a))return;let s=St();if(Is&&Ue(s)&&s.isCollapsed()){let l=s.anchor,d=Is.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=Is.clone(),Do(s))}if(Is=null,Ue(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=qo(t).event,f=c?c.timeStamp:performance.now(),[p,m,h,g,v]=nk,x=Ko(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)Sp(s,p,m);else if(l.type==="text")Me(d)||Z(141),rk(s,d);else if(l.type==="element"&&!y){Q(d)||Z(259);let C=l.getNode();C.isEmpty()?(function(w,k){let S=k.getTextFormat(),L=k.getTextStyle();Sp(w,S,L)})(s,C):Sp(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,h=s.isBackward(),g=h?i:r,v=h?r:i,x=h?f:c,y=h?c:f,C=2047,w=!1;for(let k=0;k<m;k++){let S=p[k],L=S.getTextContentSize();if(Me(S)&&L!==0&&!(k===0&&S.__key===x&&g===L||k===m-1&&S.__key===y&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Ce(t,ix,void 0)})}function Sp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function rk(e,t){Sp(e,t.getFormat(),t.getStyle())}function ak(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function L$(e){let t=e.inputType,n=ak(e),o=Kt(),r=St();if(t==="deleteContentBackward"){if(r===null){let f=Es();if(!Ue(f))return!0;Do(f.clone())}if(Ue(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,ek==="MediaLast"&&a<$c+30&&o.isComposing()&&f){if(Xn(null),$c=0,setTimeout(()=>{na(o,()=>{Xn(null)})},30),Ue(r)){let p=r.anchor.getNode();p.markDirty(),Me(p)||Z(142),rk(r,p)}}else{Xn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),h=p.canInsertTextAfter(),g=r.anchor.offset===0&&r.focus.offset===m.length,v=Tv&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!Qt(zk(r.anchor,!0))),!v){Ce(o,Fc,!0);let x=St();Tv&&Ue(x)&&x.isCollapsed()&&(Is=x,setTimeout(()=>Is=null))}}return!0}}var a;if(!Ue(r))return!0;let i=e.data;Pl!==null&&Ax(!1,o,Pl),r.dirty&&Pl===null||!r.isCollapsed()||to(r.anchor.getNode())||n===null||r.applyDOMRange(n),Pl=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
3700
+ `)e.preventDefault(),Ce(o,Pc,!1);else if(i===Wp)e.preventDefault(),Ce(o,Fv,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&ok(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Ce(o,Ml,i)):Pl=i;return tk=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Ce(o,Ml,e);break;case"insertFromComposition":Xn(null),Ce(o,Ml,e);break;case"insertLineBreak":Xn(null),Ce(o,Pc,!1);break;case"insertParagraph":Xn(null),Ac&&!Vc?(Ac=!1,Ce(o,Pc,!1)):Ce(o,Fv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Ce(o,ux,e);break;case"deleteByComposition":(function(f,p){return f!==p||Q(f)||Q(p)||!vi(f)||!vi(p)})(d,c)&&Ce(o,Bv,e);break;case"deleteByDrag":case"deleteByCut":Ce(o,Bv,e);break;case"deleteContent":Ce(o,Fc,!1);break;case"deleteWordBackward":Ce(o,Bc,!0);break;case"deleteWordForward":Ce(o,Bc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Ce(o,zc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Ce(o,zc,!1);break;case"formatStrikeThrough":Ce(o,gi,"strikethrough");break;case"formatBold":Ce(o,gi,"bold");break;case"formatItalic":Ce(o,gi,"italic");break;case"formatUnderline":Ce(o,gi,"underline");break;case"historyUndo":Ce(o,fx,void 0);break;case"historyRedo":Ce(o,px,void 0)}return!0}function k$(e){if(ko(e.target)&&Ek(e.target))return!0;let t=Kt(),n=St(),o=e.data,r=ak(e);if(o!=null&&Ue(n)&&ok(n,r,o,e.timeStamp,!1)){kc&&(Dp(t,o),kc=!1);let a=n.anchor.getNode(),i=Er(qo(t));if(i===null)return!0;let s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,d=s?n.focus.offset:n.anchor.offset;Lp&&!n.isCollapsed()&&Me(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===Fk(i.anchorNode)||Ce(t,Ml,o);let c=o.length;yi&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Tv&&t.isComposing()&&($c=0,Xn(null))}else Ax(!1,t,o!==null?o:void 0),kc&&(Dp(t,o||void 0),kc=!1);return(function(){Qn();let a=Kt();kL(a)})(),!0}function P$(e){let t=Kt(),n=St();if(Ue(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Xn(o.key),em(fk),(e.timeStamp<$c+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Me(r)&&r.getStyle()!==n.style)&&Ce(t,Ml,ox)}return!0}function A$(e){return Dp(Kt(),e.data),em(pk),!0}function Dp(e,t){let n=e._compositionKey;if(Xn(null),n!==null&&t!=null){if(t===""){let o=Bn(n),r=Ps(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Me(o)){let a=Er(qo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Ex(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3701
+ `){let o=St();if(Ue(o)||Wc(o)){if(Ue(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Ce(e,Np,null)}}}Ax(!0,e,t)}function E$(e){let t=Kt();if(e.key==null)return!0;if(bp){if(gL(e))return na(t,()=>{Dp(t,Ip)}),bp=!1,Ip="",!0;bp=!1,Ip=""}if((function(n){return Pt(n,"ArrowRight",{shiftKey:"any"})})(e))Ce(t,OL,e);else if((function(n){return Pt(n,"ArrowRight",La)})(e))Ce(t,FL,e);else if((function(n){return Pt(n,"ArrowLeft",{shiftKey:"any"})})(e))Ce(t,BL,e);else if((function(n){return Pt(n,"ArrowLeft",La)})(e))Ce(t,zL,e);else if((function(n){return Pt(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Ce(t,$L,e);else if((function(n){return Pt(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Ce(t,HL,e);else if((function(n){return Pt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Ac=!0,Ce(t,Np,e);else if((function(n){return n.key===" "})(e))Ce(t,UL,e);else if((function(n){return Sr&&Pt(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Ac=!0,Ce(t,Pc,!0);else if((function(n){return Pt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Ac=!1,Ce(t,Np,e);else if((function(n){return Pt(n,"Backspace",{shiftKey:"any"})||Sr&&Pt(n,"h",{ctrlKey:!0})})(e))gL(e)?Ce(t,KL,e):(e.preventDefault(),Ce(t,Fc,!0));else if((function(n){return n.key==="Escape"})(e))Ce(t,qL,e);else if((function(n){return Pt(n,"Delete",{})||Sr&&Pt(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Ce(t,VL,e):(e.preventDefault(),Ce(t,Fc,!1));else if((function(n){return Pt(n,"Backspace",mL)})(e))e.preventDefault(),Ce(t,Bc,!0);else if((function(n){return Pt(n,"Delete",mL)})(e))e.preventDefault(),Ce(t,Bc,!1);else if((function(n){return Sr&&Pt(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Ce(t,zc,!0);else if((function(n){return Sr&&(Pt(n,"Delete",{metaKey:!0})||Pt(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Ce(t,zc,!1);else if((function(n){return Pt(n,"b",La)})(e))e.preventDefault(),Ce(t,gi,"bold");else if((function(n){return Pt(n,"u",La)})(e))e.preventDefault(),Ce(t,gi,"underline");else if((function(n){return Pt(n,"i",La)})(e))e.preventDefault(),Ce(t,gi,"italic");else if((function(n){return Pt(n,"Tab",{shiftKey:"any"})})(e))Ce(t,WL,e);else if((function(n){return Pt(n,"z",La)})(e))e.preventDefault(),Ce(t,fx,void 0);else if((function(n){return Sr?Pt(n,"z",{metaKey:!0,shiftKey:!0}):Pt(n,"y",{ctrlKey:!0})||Pt(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Ce(t,px,void 0);else{let n=t._editorState._selection;n===null||Ue(n)?hL(e)&&(e.preventDefault(),Ce(t,zv,e)):(function(o){return Pt(o,"c",La)})(e)?(e.preventDefault(),Ce(t,gx,e)):(function(o){return Pt(o,"x",La)})(e)?(e.preventDefault(),Ce(t,hx,e)):hL(e)&&(e.preventDefault(),Ce(t,zv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(ZL,e),!0}function ik(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Rl=new Map;function sk(e){let t=qk(e.target);if(t===null)return;let n=Lx(t.anchorNode);if(n===null)return;Kv&&(Kv=!1,na(n,()=>{let l=Es(),d=t.anchorNode;(ko(d)||oa(d))&&Do(Qp(l,t,n,e))}));let o=Px(n),r=o[o.length-1],a=r._key,i=Rl.get(a),s=i||r;s!==n&&UT(t,s,!1),UT(t,n,!0),n!==r?Rl.set(a,n):i&&Rl.delete(a)}function KT(e){e._lexicalHandled=!0}function qT(e){return e._lexicalHandled===!0}var VT=()=>{};function M$(e){let t=Hv.get(e);if(t===void 0)return void VT();let n=_p.get(t);if(n===void 0)return void VT();let o=n-1;o>=0||Z(164),Hv.delete(e),_p.set(t,o),o===0&&t.removeEventListener("selectionchange",sk);let r=jc(e);Yp(r)?((function(i){if(i._parentEditor!==null){let s=Px(i),l=s[s.length-1]._key;Rl.get(l)===i&&Rl.delete(l)}else Rl.delete(i._key)})(r),e.__lexicalEditor=null):r&&Z(198);let a=ik(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function qv(e,t,n){Qn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=St();if(!Ue(l)||!Q(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return Up(f,s)&&d.set(s.__key,0,"element"),Up(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ue(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(zp(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(zp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else Wc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ue(a)&&t&&!i){let s=e.getIndexWithinParent();xi(e),Bp(a,r,s,-1)}else xi(e);n||cr(r)||r.canBeEmpty()||!r.isEmpty()||qv(r,t),t&&a&&to(r)&&r.isEmpty()&&r.selectEnd()}function R$(e){return e}var lk=Symbol.for("ephemeral");function Op(e){return e[lk]||!1}var dr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Yc(this);return t===void 0&&Z(64,this.name),t}static clone(t){Z(65,this.name)}$config(){return{}}config(t,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:t}),{[t]:n}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Rk(this,t)}getType(){return this.__type}isInline(){Z(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Bn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||St();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Me(this))return o;if(Ue(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Qt(this)&&this.isInline()&&r){let a=n.isBackward()?n.focus:n.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let n=t.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Bn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&Z(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(cr(n))return Q(t)||t===this&&Qt(t)||Z(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&Z(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Bn(t)}getPreviousSiblings(){let t=[],n=this.getParent();if(n===null)return t;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)t.push(o),o=o.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Bn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=Q(this)?this:this.getParent(),o=Q(t)?t:t.getParent(),r=n&&o?Rc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Rc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Hx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&Z(279),!1)))}isParentOf(t){let n=Rc(this,t);return n!==null&&n.type==="ancestor"}getNodesBetween(t){let n=this.isBefore(t),o=[],r=new Set,a=this;for(;a!==null;){let i=a.__key;if(r.has(i)||(r.add(i),o.push(a)),a===t)break;let s=Q(a)?n?a.getFirstChild():a.getLastChild():null;if(s!==null){a=s;continue}let l=n?a.getNextSibling():a.getPreviousSibling();if(l!==null){a=l;continue}let d=a.getParentOrThrow();if(r.has(d.__key)||o.push(d),d===t)break;let c=null,f=d;do{if(f===null&&Z(68),c=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||r.has(f.__key)||o.push(f)}while(c===null);a=c}return n||o.reverse(),o}isDirty(){let t=Kt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Op(this))return this;let t=Bn(this.__key);return t===null&&Z(113),t}getWritable(){if(Op(this))return this;Qn();let t=Na(),n=Kt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=St();if(s!==null&&s.setCachedNodes(null),i.has(r))return Hp(a),a;let l=Ox(a);return i.add(r),Hp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){Z(70)}updateDOM(t,n,o){Z(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){let t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){Z(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of EL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&ax(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){qv(this,!0,t)}replace(t,n){Qn();let o=St();o!==null&&(o=o.clone()),Iv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;xi(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;if(qv(r,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,s.__prev=p,f===null?l.__last=i:f.getWritable().__prev=i,s.__next=m,s.__parent=h,l.__size=d,n&&(Q(this)&&Q(s)||Z(139),this.getChildren().forEach(g=>{s.append(g)})),Ue(o)){Do(o);let g=o.anchor,v=o.focus;g.key===a&&QT(g,s),v.key===a&&QT(v,s)}return hi()===a&&Xn(i),s}insertAfter(t,n=!0){Qn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=St(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(xi(r),Ue(i)){let h=a.__key,g=i.anchor,v=i.focus;s=g.type==="element"&&g.key===h&&g.offset===m+1,l=v.type==="element"&&v.key===h&&v.offset===m+1}}let d=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=r.__key,p=o.__next;if(d===null?c.__last=f:d.getWritable().__prev=f,c.__size++,o.__next=f,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&Ue(i)){let m=this.getIndexWithinParent();Bp(i,c,m+1);let h=c.__key;s&&i.anchor.set(h,m+2,"element"),l&&i.focus.set(h,m+2,"element")}return t}insertBefore(t,n=!0){Qn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;xi(r);let i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();i===null?s.__first=a:i.getWritable().__next=a,s.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=St();return n&&Ue(c)&&Bp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Ea()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){Qn();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(Q(o))return o.select();if(!Me(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){Qn();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(Q(o))return o.select(0,0);if(!Me(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},N$="historic",_$="history-push",wp="history-merge",D$="paste",dk="collaboration",O$="skip-collab",ck="skip-scroll-into-view",uk="skip-dom-selection",Vv="skip-selection-focus",fk="composition-start",pk="composition-end",_l=class e extends dr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3702
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&hp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&hp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&hp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&hp(a))return!0}return!1})(t)?null:{conversion:F$,priority:0}}}static importJSON(t){return Dl().updateFromJSON(t)}};function F$(e){return{node:Dl()}}function Dl(){return Xc(new _l)}function Ss(e){return e instanceof _l}function hp(e){return oa(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function vv(e,t){return 16&t?"code":t&nx?"mark":32&t?"sub":64&t?"sup":null}function xv(e,t){return 1&t?"strong":2&t?"em":"span"}function mk(e,t,n,o,r){let a=o.classList,i=Nl(r,"base");i!==void 0&&a.add(...i),i=Nl(r,"underlineStrikethrough");let s=!1,l=8&t&&4&t;i!==void 0&&(8&n&&4&n?(s=!0,l||a.add(...i)):l&&a.remove(...i));for(let d in fo){let c=fo[d];if(i=Nl(r,d),i!==void 0)if(n&c){if(s&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...i);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...i)}else t&c&&a.remove(...i)}}function gk(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?_c:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||yi){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,h=0,g=0;for(;h<p&&h<m&&c[h]===f[h];)h++;for(;g+h<p&&g+h<m&&c[p-g-1]===f[m-g-1];)g++;return[h,p-h-g,f.slice(h,m-g)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function WT(e,t,n,o,r,a){gk(r,e,t);let i=a.theme.text;i!==void 0&&mk(0,0,o,e,i)}function vp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Ls=class e extends dr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",n){super(n),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return r$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===hi()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=fo[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Kc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=vv(0,o),a=xv(0,o),i=r===null?a:r,s=document.createElement(i),l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),s.appendChild(l)),WT(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(s.style.cssText=d),s}updateDOM(t,n,o){let r=this.__text,a=t.__format,i=this.__format,s=vv(0,a),l=vv(0,i),d=xv(0,a),c=xv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let g=n.firstChild;g==null&&Z(48);let v=document.createElement(c);return WT(v,this,0,i,r,o),n.replaceChild(v,g),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&Z(49)),gk(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&mk(0,a,i,f,p);let m=t.__style,h=this.__style;return m!==h&&(n.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:H$,priority:0}),b:()=>({conversion:z$,priority:0}),code:()=>({conversion:Ta,priority:0}),em:()=>({conversion:Ta,priority:0}),i:()=>({conversion:Ta,priority:0}),mark:()=>({conversion:Ta,priority:0}),s:()=>({conversion:Ta,priority:0}),span:()=>({conversion:B$,priority:0}),strong:()=>({conversion:Ta,priority:0}),sub:()=>({conversion:Ta,priority:0}),sup:()=>({conversion:Ta,priority:0}),u:()=>({conversion:Ta,priority:0})}}static importJSON(t){return jn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:n}=super.exportDOM(t);return ko(n)||Z(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=vp(n,"b")),this.hasFormat("italic")&&(n=vp(n,"i")),this.hasFormat("strikethrough")&&(n=vp(n,"s")),this.hasFormat("underline")&&(n=vp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,n){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?fo[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?t$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Kc(this.getFormat(),t,null);return this.setFormat(n)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let n=o$[t];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){Qn();let o=t,r=n,a=St(),i=this.getTextContent(),s=this.__key;if(typeof i=="string"){let l=i.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!Ue(a))return xk(s,o,s,r,"text","text");{let l=hi();l!==a.anchor.key&&l!==a.focus.key||Xn(s),a.setTextNodeRange(this,o,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,n,o,r){let a=this.getWritable(),i=a.__text,s=o.length,l=t;l<0&&(l=s+l,l<0&&(l=0));let d=St();if(r&&Ue(d)){let f=t+s;d.setTextNodeRange(a,f,a,f)}let c=i.slice(0,l)+o+i.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Qn();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=hi(),i=o.length;t.sort((I,T)=>I-T),t.push(i);let s=[],l=t.length;for(let I=0,T=0;I<i&&T<=l;T++){let E=t[T];E>I&&(s.push(o.slice(I,E)),I=E)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),h=n.getStyle(),g=n.__detail,v=!1,x=null,y=null,C=St();if(Ue(C)){let[I,T]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];I.type==="text"&&I.key===r&&(x=I),T.type==="text"&&T.key===r&&(y=T)}n.isSegmented()?(p=jn(c),p.__format=m,p.__style=h,p.__detail=g,p.__state=_T(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let I=1;I<d;I++){let T=jn(s[I]);T.__format=m,T.__style=h,T.__detail=g,T.__state=_T(n,T);let E=T.__key;a===r&&Xn(E),w.push(T)}let k=x?x.offset:null,S=y?y.offset:null,L=0;for(let I of w){if(!x&&!y)break;let T=L+I.getTextContentSize();if(x!==null&&k!==null&&k<=T&&k>=L&&(x.set(I.getKey(),k-L,"text"),k<T&&(x=null)),y!==null&&S!==null&&S<=T&&S>=L){y.set(I.getKey(),S-L,"text");break}L=T}if(f!==null){(function(E){let A=E.getPreviousSibling(),N=E.getNextSibling();A!==null&&Hp(A),N!==null&&Hp(N)})(this);let I=f.getWritable(),T=this.getIndexWithinParent();v?(I.splice(T,0,w),this.remove()):I.splice(T,1,w),Ue(C)&&Bp(C,f,T,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||Z(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;hi()===r&&Xn(o);let s=St();if(Ue(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&nL(f,n,o,t,i),p!==null&&p.key===r&&nL(p,n,o,t,i)}let l=t.__text,d=n?l+a:a+l;this.setTextContent(d);let c=this.getWritable();return t.remove(),c}isTextEntity(){return!1}};function B$(e){return{forChild:vx(e.style),node:null}}function z$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:vx(t.style,n?void 0:"bold"),node:null}}var GT=new WeakMap;function $$(e){if(!ko(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function H$(e){let t=e;e.parentElement===null&&Z(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=GT.get(a))===void 0&&!$$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)GT.set(i[l],s);return s})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let i=0;i<a;i++){let s=o[i];s===`
3703
3703
  `||s===`\r
3704
- `?r.push(Bl()):s===" "?r.push(Xp()):s!==""&&r.push(Wn(s))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=t,r=!0;for(;o!==null&&(o=GT(o,!1))!==null;){let a=o.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=t,r=!0;for(;o!==null&&(o=GT(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Wn(n)}}function GT(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,So(n)){let a=n.style.display;if(a===""&&!Vk(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(ia(n))return n;if(n.nodeName==="BR")return null}}var $$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ea(e){let t=$$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:vx(e.style,t),node:null}}function Wn(e=""){return eu(new ks(e))}function Me(e){return e instanceof ks}function vx(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),i=e.fontStyle==="italic",s=o.includes("underline"),l=e.verticalAlign;return d=>(Me(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),i&&!d.hasFormat("italic")&&d.toggleFormat("italic"),s&&!d.hasFormat("underline")&&d.toggleFormat("underline"),l!=="sub"||d.hasFormat("subscript")||d.toggleFormat("subscript"),l!=="super"||d.hasFormat("superscript")||d.toggleFormat("superscript"),t&&!d.hasFormat(t)&&d.toggleFormat(t)),d)}var zl=class e extends ks{static getType(){return"tab"}static clone(t){return new e(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){let n=super.createDOM(t),o=Ol(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return Xp().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&CL(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||ee(286),this}setDetail(t){return t!==2&&ee(127),this}setMode(t){return t!=="normal"&&ee(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Xp(){return eu(new zl)}function xx(e){return e instanceof zl}var Wv=class{key;offset;type;_selection;constructor(t,n,o){this._selection=null,this.key=t,this.offset=n,this.type=o}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:$x(Pr(ki(this,"next")),Pr(ki(t,"next")))<0}getNode(){let t=Dn(this.key);return t===null&&ee(20),t}set(t,n,o,r){let a=this._selection,i=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,jl()||(yi()===i&&jn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Rr(e,t,n){return new Wv(e,t,n)}function yv(e,t){let n=t.__key,o=e.offset,r="element";if(Me(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!Q(t)){let a=t.getNextSibling();if(Me(a))n=a.__key,o=0,r="text";else{let i=t.getParent();i&&(n=i.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function jT(e,t){if(Q(t)){let n=t.getLastDescendant();Q(n)||Me(n)?yv(e,n):yv(e,t)}else yv(e,t)}var zp=class e{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!Xc(t))return!1;let n=this._nodes,o=t._nodes;return n.size===o.size&&Array.from(n).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){let n=this.getNodes(),o=n.length,r=n[o-1],a;if(Me(r))a=r.select();else{let i=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(i,i)}a.insertNodes(t);for(let i=0;i<o;i++)n[i].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=Dn(r);a!==null&&o.push(a)}return jl()||(this._cachedNodes=o),o}getTextContent(){let t=this.getNodes(),n="";for(let o=0;o<t.length;o++)n+=t[o].getTextContent();return n}deleteNodes(){let t=this.getNodes();if((St()||Ms())===this&&t[0]){let n=Yn(t[0],"next");Xk(Li(n,n))}for(let n of t)n.remove()}};function He(e){return e instanceof Ps}var Ps=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,n,o,r){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!He(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=(function(o){let r=[],[a,i]=o.getTextSlices();a&&r.push(a.caret.origin);let s=new Set,l=new Set;for(let d of o)if(Er(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;Q(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),Es(o.focus)&&Q(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Fa(o.focus.origin,"previous");Er(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Wl(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!Q(d)||l.has(d)||d.isEmpty()||s.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=Pr(o.anchor),c=Pr(o.anchor.getFlipped()),f=m=>Oa(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(Ux(tx(this),"next"));return jl()||(this._cachedNodes=n),n}setTextNodeRange(t,n,o,r){this.anchor.set(t.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],o=t[t.length-1],r=this.anchor,a=this.focus,i=r.isBefore(a),[s,l]=Gv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(Q(p)&&!p.isInline())c||(d+=`
3705
- `),c=!p.isEmpty();else if(c=!1,Me(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=s<l?m.slice(s,l):m.slice(l,s)):m=i?m.slice(s):m.slice(l):p===o&&(m=i?m.slice(0,l):m.slice(0,s)),d+=m}else!Qt(p)&&!ws(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Kt(),o=n.getEditorState()._selection,r=hk(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,i]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(i.key,i.offset,i.type,!0),Ep(this)}clone(){let t=this.anchor,n=this.focus;return new e(Rr(t.key,t.offset,t.type),Rr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Gc(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let n=co[t];return(this.format&n)!==0}insertRawText(t){let n=t.split(/(\r?\n|\t)/),o=[],r=n.length;for(let a=0;a<r;a++){let i=n[a];i===`
3704
+ `?r.push(Dl()):s===" "?r.push(jp()):s!==""&&r.push(jn(s))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=t,r=!0;for(;o!==null&&(o=jT(o,!1))!==null;){let a=o.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=t,r=!0;for(;o!==null&&(o=jT(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:jn(n)}}function jT(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,ko(n)){let a=n.style.display;if(a===""&&!Wk(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(oa(n))return n;if(n.nodeName==="BR")return null}}var U$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ta(e){let t=U$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:vx(e.style,t),node:null}}function jn(e=""){return Xc(new Ls(e))}function Me(e){return e instanceof Ls}function vx(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),i=e.fontStyle==="italic",s=o.includes("underline"),l=e.verticalAlign;return d=>(Me(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),i&&!d.hasFormat("italic")&&d.toggleFormat("italic"),s&&!d.hasFormat("underline")&&d.toggleFormat("underline"),l!=="sub"||d.hasFormat("subscript")||d.toggleFormat("subscript"),l!=="super"||d.hasFormat("superscript")||d.toggleFormat("superscript"),t&&!d.hasFormat(t)&&d.toggleFormat(t)),d)}var Ol=class e extends Ls{static getType(){return"tab"}static clone(t){return new e(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){let n=super.createDOM(t),o=Nl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return jp().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&bL(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||Z(286),this}setDetail(t){return t!==2&&Z(127),this}setMode(t){return t!=="normal"&&Z(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function jp(){return Xc(new Ol)}function xx(e){return e instanceof Ol}var Wv=class{key;offset;type;_selection;constructor(t,n,o){this._selection=null,this.key=t,this.offset=n,this.type=o}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:$x(wr(wi(this,"next")),wr(wi(t,"next")))<0}getNode(){let t=Bn(this.key);return t===null&&Z(20),t}set(t,n,o,r){let a=this._selection,i=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,Vl()||(hi()===i&&Xn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Pr(e,t,n){return new Wv(e,t,n)}function yv(e,t){let n=t.__key,o=e.offset,r="element";if(Me(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!Q(t)){let a=t.getNextSibling();if(Me(a))n=a.__key,o=0,r="text";else{let i=t.getParent();i&&(n=i.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function QT(e,t){if(Q(t)){let n=t.getLastDescendant();Q(n)||Me(n)?yv(e,n):yv(e,t)}else yv(e,t)}var Fp=class e{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!Wc(t))return!1;let n=this._nodes,o=t._nodes;return n.size===o.size&&Array.from(n).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){let n=this.getNodes(),o=n.length,r=n[o-1],a;if(Me(r))a=r.select();else{let i=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(i,i)}a.insertNodes(t);for(let i=0;i<o;i++)n[i].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=Bn(r);a!==null&&o.push(a)}return Vl()||(this._cachedNodes=o),o}getTextContent(){let t=this.getNodes(),n="";for(let o=0;o<t.length;o++)n+=t[o].getTextContent();return n}deleteNodes(){let t=this.getNodes();if((St()||Es())===this&&t[0]){let n=Zn(t[0],"next");Yk(Si(n,n))}for(let n of t)n.remove()}};function Ue(e){return e instanceof ks}var ks=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,n,o,r){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Ue(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=(function(o){let r=[],[a,i]=o.getTextSlices();a&&r.push(a.caret.origin);let s=new Set,l=new Set;for(let d of o)if(Lr(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;Q(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),As(o.focus)&&Q(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Ra(o.focus.origin,"previous");Lr(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Kl(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!Q(d)||l.has(d)||d.isEmpty()||s.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=wr(o.anchor),c=wr(o.anchor.getFlipped()),f=m=>Ma(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(Ux(tx(this),"next"));return Vl()||(this._cachedNodes=n),n}setTextNodeRange(t,n,o,r){this.anchor.set(t.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],o=t[t.length-1],r=this.anchor,a=this.focus,i=r.isBefore(a),[s,l]=Gv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(Q(p)&&!p.isInline())c||(d+=`
3705
+ `),c=!p.isEmpty();else if(c=!1,Me(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=s<l?m.slice(s,l):m.slice(l,s)):m=i?m.slice(s):m.slice(l):p===o&&(m=i?m.slice(0,l):m.slice(0,s)),d+=m}else!Qt(p)&&!Ss(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Kt(),o=n.getEditorState()._selection,r=vk(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,i]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(i.key,i.offset,i.type,!0),Pp(this)}clone(){let t=this.anchor,n=this.focus;return new e(Pr(t.key,t.offset,t.type),Pr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Kc(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let n=fo[t];return(this.format&n)!==0}insertRawText(t){let n=t.split(/(\r?\n|\t)/),o=[],r=n.length;for(let a=0;a<r;a++){let i=n[a];i===`
3706
3706
  `||i===`\r
3707
- `?o.push(Bl()):i===" "?o.push(Xp()):o.push(Wn(i))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,i=n,s=o;!this.isCollapsed()&&o.isBefore(n)&&(i=o,s=n),i.type==="element"&&(function(v,x,y,C){let w=v.getNode(),k=w.getChildAtIndex(v.offset),S=Wn();if(S.setFormat(y),S.setStyle(C),Tk(k))k.splice(0,0,[S]);else{let L=eo(w)?Da().append(S):S;k===null?w.append(L):k.insertBefore(L)}v.is(x)&&x.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&Gl(s,Pr(ki(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Me(p)||ee(26);let m=p.getTextContent().length,h=p.getParentOrThrow(),g=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(Ra(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Me(v)&&v.canInsertTextBefore()&&!Ra(v)||(v=Wn(),v.setFormat(r),v.setStyle(a),h.canInsertTextAfter()?p.insertAfter(v):h.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(Ra(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Me(v)&&!Ra(v)||(v=Wn(),v.setFormat(r),h.canInsertTextBefore()?p.insertBefore(v):h.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=Wn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||Q(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),gk(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Ci(p)){let C=Wn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),x=p.getStyle();if(l!==d||v===r&&x===a){if(xx(p)){let C=Wn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=Wn(t);if(C.setFormat(r),C.setStyle(a),C.select(),l===0)p.insertBefore(C,!1);else{let[w]=p.splitText(l);w.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let y=d-l;p=p.spliceText(l,y,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...g.getParentKeys()]),x=Q(p)?p:p.getParentOrThrow(),y=Q(g)?g:g.getParentOrThrow(),C=g;if(!x.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(s.type==="text"&&(d!==0||g.getTextContent()==="")||s.type==="element"&&g.getIndexWithinParent()<d)if(Me(g)&&!Ci(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let I=Wn(g.getTextContent());g.replace(I),g=I}eo(s.getNode())||s.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let I=g.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?g.remove():I.remove()}else v.add(g.__key);let w=y.getChildren(),k=new Set(c),S=x.is(y),L=x.isInline()&&p.getNextSibling()===null?x:p;for(let I=w.length-1;I>=0;I--){let T=w[I];if(T.is(p)||Q(T)&&T.isParentOf(p))break;T.isAttached()&&(!k.has(T)||T.is(C)?S||L.insertAfter(T,!1):T.remove())}if(!S){let I=y,T=null;for(;I!==null;){let E=I.getChildren(),A=E.length;(A===0||E[A-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(Ci(p))if(l===m)p.select();else{let I=Wn(t);I.select(),p.replace(I)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let I=1;I<f;I++){let T=c[I],E=T.__key;v.has(E)||T.remove()}}}removeText(){let t=St()===this;Fc(this,Yk(tx(this))),t&&St()!==this&&_o(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void jn(null);let o=this.getNodes(),r=[];for(let w of o)Me(w)&&r.push(w);let a=w=>{o.forEach(k=>{if(Q(k)){let S=k.getFormatFlags(t,w);k.setTextFormat(S)}})},i=r.length;if(i===0)return this.toggleFormat(t),jn(null),void a(n);let s=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:s,f=d?s:l,p=0,m=r[0],h=c.type==="element"?0:c.offset;if(c.type==="text"&&h===m.getTextContentSize()&&(p=1,m=r[1],h=0),m==null)return;let g=m.getFormatFlags(t,n);a(g);let v=i-1,x=r[v],y=f.type==="text"?f.offset:x.getTextContentSize();if(m.is(x)){if(h===y)return;if(Ra(m)||h===0&&y===m.getTextContentSize())m.setFormat(g);else{let w=m.splitText(h,y),k=h===0?w[0]:w[1];k.setFormat(g),c.type==="text"&&c.set(k.__key,0,"text"),f.type==="text"&&f.set(k.__key,y-h,"text")}return void(this.format=g)}h===0||Ra(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let C=x.getFormatFlags(t,g);y>0&&(y===x.getTextContentSize()||Ra(x)||([x]=x.splitText(y)),x.setFormat(C));for(let w=p+1;w<v;w++){let k=r[w],S=k.getFormatFlags(t,C);k.setFormat(S)}c.type==="text"&&c.set(m.__key,h,"text"),f.type==="text"&&f.set(x.__key,y,"text"),this.format=g|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=St();return He(h)||ee(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Dc(n,_a),r=t[t.length-1];if(Q(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=Cv(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(Q(h)||Qt(h))&&!h.isInline())){Q(o)||ee(211,n.constructor.name,n.getType());let h=Cv(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=Da(),v=null;for(let x=0;x<h.length;x++){let y=h[x],C=ws(y);if(C||Qt(y)&&y.isInline()||Q(y)&&y.isInline()||Me(y)||y.isParentRequired()){if(v===null&&(v=y.createParentElementNode(),g.append(v),C))continue;v!==null&&v.append(y)}else g.append(y),v=null}return g})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!Q(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;Q(f=c)&&_a(f)&&!f.isEmpty()&&Q(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(Q(o)||ee(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&ee(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),x=g,y=[g];for(;x!==v;)x.getNextSibling()||ee(140),x=x.getNextSibling(),y.push(x);let C=h;for(let w of y)C=C.insertAfter(w)})(o,c));let p=Dc(i,_a);l&&Q(p)&&(l.canMergeWhenEmpty()||_a(d))&&(p.append(...l.getChildren()),l.remove()),Q(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=Q(o)?o.getLastChild():null;ws(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Da();return $o().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Cv(this),n=Dc(this.anchor.getNode(),_a);Q(n)||ee(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Bl();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,i]=Gv(this),s=this.isBackward(),[l,d]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=s?[i,a]:[a,i];if(n===0)return[];if(n===1){if(Me(o)&&!this.isCollapsed()){let p=o.splitText(c,f),m=c===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(Me(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Me(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(oL(this,t,n,o))return;let r=t==="move",a=Kt(),i=_r(Ho(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!Q(d)||d.isInline()||d.canBeEmpty()||Xv(s,a,l),this.dirty){let c=Ul(a,this.anchor.key),f=Ul(a,this.focus.key);this.anchor.type==="text"&&(c=As(c)),this.focus.type==="text"&&(f=As(f)),c&&f&&yk(i,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(i,t,n?"backward":"forward",o),i.rangeCount>0){let c=i.getRangeAt(0),f=this.anchor.getNode(),p=eo(f)?f:Hk(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),h=[],g=!1;for(let v=0;v<m.length;v++){let x=m[v];qp(x,p)?h.push(x):g=!0}if(g&&h.length>0)if(n){let v=h[0];Q(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];Q(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let x=v.focus,y=v.anchor,C=y.key,w=y.offset,k=y.type;y.set(x.key,x.offset,x.type,!0),x.set(C,w,k,!0)})(this)}}o==="lineboundary"&&oL(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&Q(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(Q(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=Bx(ki(o,t?"previous":"next"));if(a.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(Er(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=Pr(l);Fc(this,Li(d,d)),a.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:l,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(Es(l)){if(Q(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else s={block:l.origin,type:"merge-next-block"};continue}if(Qt(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=yx();d.add(l.origin.getKey()),_o(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return Fc(this,Li(!l.origin.isEmpty()&&d.isEmpty()?Xl(Yn(d,l.direction)):a.anchor,l)),this.removeText()}}let i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&XT(this,o.getNode()))return}else{let s=i.type==="text"?i.getNode():null;if(r=o.type==="text"?o.getNode():null,s!==null&&s.isSegmented()){let l=i.offset,d=s.getTextContentSize();if(s.is(r)||t&&l!==d||!t&&l!==0)return void YT(s,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(s)||t&&l!==0||!t&&l!==d)return void YT(r,t,l)}(function(l,d){let c=l.anchor,f=l.focus,p=c.getNode(),m=f.getNode();if(p===m&&c.type==="text"&&f.type==="text"){let h=c.offset,g=f.offset,v=h<g,x=v?h:g,y=v?g:h,C=y-1;x!==C&&(function(w){return!(_k(w)||H$(w))})(p.getTextContent().slice(x,y))&&(d?f.set(f.key,C,f.type):c.set(c.key,C,c.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&eo(o.getParent())&&o.getPreviousSibling()===null&&XT(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Xc(e){return e instanceof zp}function QT(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Gv(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[QT(n),QT(o)]}function XT(e,t){for(let n=t;n;n=n.getParent()){if(Q(n)){if(n.collapseAtStart(e))return!0;if(fr(n))break}if(n.getPreviousSibling())break}return!1}var H$=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function YT(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,i=0,s=0;for(let d=0;d<a;d++){let c=d===a-1;if(s=i,i+=r[d].length,t&&i===n||i>n||c){r.splice(d,1),c&&(s=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(s,s))}function JT(e,t,n,o){let r,a=t;if(So(e)){let i=!1,s=e.childNodes,l=s.length,d=o._blockCursorElement;a===l&&(i=!0,a=l-1);let c=s[a],f=!1;if(c===d)c=s[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=Nl(c),Me(r))a=Mr(r,i?"next":"previous");else{let p=Nl(e);if(p===null)return null;if(Q(p)){let m=o.getElementByKey(p.getKey());m===null&&ee(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),Q(p)||ee(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(Q(g)&&(function(v,x,y){let C=v.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()})(g,0,n)){let v=i?g.getLastDescendant():g.getFirstDescendant();v===null?p=g:(g=v,p=Q(g)?g:g.getParentOrThrow()),a=0}Me(g)?(r=g,p=null,a=Mr(g,i?"next":"previous")):g!==p&&i&&!f&&(Q(p)||ee(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Qt(p)&&Nl(e)===p?m:m+1,p=p.getParentOrThrow()}if(Q(p))return Rr(p.__key,a,"element")}}else r=Nl(e);return Me(r)?Rr(r.__key,Mr(r,a,"clamp"),"text"):null}function ZT(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),i=r.getParent();if(t){if((n||!t)&&a===null&&Q(i)&&i.isInline()){let s=i.getPreviousSibling();Me(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else Q(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Me(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&Q(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&Q(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Me(s)&&e.set(s.__key,0,"text")}}}function gk(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);ZT(e,o,r),ZT(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function hk(e,t,n,o,r,a){if(e===null||n===null||!Yc(r,e,n))return null;let i=JT(e,t,He(a)?a.anchor:null,r);if(i===null)return null;let s=JT(n,o,He(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=Nl(e),d=Nl(n);if(Qt(l)&&Qt(d))return null}return gk(i,s),[i,s]}function U$(e){return Q(e)&&!e.isInline()}function vk(e,t,n,o,r,a){let i=Ba(),s=new Ps(Rr(e,t,r),Rr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function xk(){let e=Rr("root",0,"element"),t=Rr("root",0,"element");return new Ps(e,t,0,"")}function yx(){return new zp(new Set)}function K$(e,t){return Yp(null,e,t,null)}function Yp(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,i=a?a.type:void 0,s=i==="selectionchange",l=!kv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(He(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(s||i===void 0)&&He(e)&&!Yc(n,d,c))return e.clone();let m=hk(d,f,c,p,n,e);if(m===null)return null;let[h,g]=m,v=0,x="";if(He(e)){let y=e.anchor;if(h.key===y.key)v=e.format,x=e.style;else{let C=h.getNode();Me(C)?(v=C.getFormat(),x=C.getStyle()):Q(C)&&(v=C.getTextFormat(),x=C.getTextStyle())}}return new Ps(h,g,v,x)}function St(){return Ba()._selection}function Ms(){return Kt()._editorState._selection}function $p(e,t,n,o=1){let r=e.anchor,a=e.focus,i=r.getNode(),s=a.getNode();if(!t.is(i)&&!t.is(s))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let c=Math.max(0,d+o);r.set(l,c,"element"),a.set(l,c,"element"),eL(e)}}else{let d=e.isBackward(),c=d?a:r,f=c.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let h=c.offset;(n<=h&&o>0||n<h&&o<0)&&c.set(l,Math.max(0,h+o),"element")}if(t.is(m)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}eL(e)}function eL(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!Q(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(Q(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(Q(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function Hp(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Me(o)?(i=o.getTextContentSize(),s="text"):Q(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Me(r)?s="text":Q(r)&&(s="element")),a!==null&&s!==null?e.set(a,i,s):(i=t.getIndexWithinParent(),i===-1&&(i=n.getChildrenSize()),e.set(n.__key,i,"element"))}function tL(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function yk(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function nL(e,t,n){let o=Ul(e,t.getKey());if(Q(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function q$(e,t,n,o,r,a,i){let s=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(lk)&&f!==a||f!==null&&Tx(f))return;if(!He(t))return void(e!==null&&Yc(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=nL(n,h,p.offset),[y,C]=nL(n,g,m.offset),w=t.format,k=t.style,S=t.isCollapsed(),L=v,I=y,T=!1;var E,A,N,R,$;if(p.type==="text"?(L=As(v),T=h.getFormat()!==w||h.getStyle()!==k):He(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=As(y)),L!==null&&I!==null&&(S&&(e===null||T||He(e)&&(e.format!==w||e.style!==k))&&(E=w,A=k,N=x,R=p.key,$=performance.now(),tk=[E,A,N,R,$]),d!==x||c!==C||s!==L||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Vv)||a.focus({preventScroll:!0}),p.type==="element"))){if(yk(o,L,x,I,C),!Ii||!t.isCollapsed()||a===null||r.has(Vv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(dk)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let H=He(t)&&t.anchor.type==="element"?L.childNodes[x]||null:o.rangeCount>0?o.getRangeAt(0):null;if(H!==null){let K;if(H instanceof Text){let O=document.createRange();O.selectNode(H),K=O.getBoundingClientRect()}else K=H.getBoundingClientRect();(function(O,oe,te){let W=Rx(te),Ke=Nx(W);if(W===null||Ke===null)return;let{top:ve,bottom:fe}=oe,Ne=0,Ae=0,ae=te;for(;ae!==null;){let Ee=ae===W.body;if(Ee)Ne=0,Ae=Ho(O).innerHeight;else{let re=ae.getBoundingClientRect();Ne=re.top,Ae=re.bottom}let xe=0;if(ve<Ne?xe=-(Ne-ve):fe>Ae&&(xe=fe-Ae),xe!==0)if(Ee)Ke.scrollBy(0,xe);else{let re=ae.scrollTop;ae.scrollTop+=xe;let Ie=ae.scrollTop-re;ve-=Ie,fe-=Ie}if(Ee)break;ae=Zc(ae)}})(n,K,a)}}Uv=!0}}function V$(e){let t=St()||Ms();t===null&&(t=$o().selectEnd()),t.insertNodes(e)}function W$(){let e=St();return e===null?"":e.getTextContent()}function Cv(e){let t=e;e.isCollapsed()||t.removeText();let n=St();He(n)&&(t=n),He(t)||ee(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!_a(r);){let i=r;if([r,a]=G$(r,a),i.is(r))break}return a}function G$(e,t){let n=e.getParent();if(!n){let r=Da();return $o().append(r),r.select(),[$o(),0]}if(Me(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!Q(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new Ps(Rr(e.__key,t,"element"),Rr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function oL(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[c,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(c.key,c.offset,c.type),!0}let a=ki(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!Jk(l)){for(let c of l){d=!1;let{origin:f}=c;if(!Qt(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Bx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Er(c))c.origin.isInline()||(l=c);else{if(Q(c.origin))continue;Qt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&Qt(l.origin)&&l.origin.isKeyboardSelectable()){let c=yx();return c.add(l.origin.getKey()),_o(c),!0}return l=Pr(l),s&&Gl(e.anchor,l),Gl(e.focus,l),d||!i}var Qn=null,Xn=null,No=!1,bv=!1,kp=0,rL={characterData:!0,childList:!0,subtree:!0};function jl(){return No||Qn!==null&&Qn._readOnly}function Gn(){No&&ee(13)}function Ck(){kp>99&&ee(14)}function Ba(){return Qn===null&&ee(195,bk()),Qn}function Kt(){return Xn===null&&ee(196,bk()),Xn}function bk(){let e=0,t=new Set,n=wi.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=Jc(r);if(Zp(a))e++;else if(a){let i=String(a.constructor.version||"<0.17.1");i===n&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function j$(){return Xn}function aL(e,t,n){let o=t.__type,r=Sx(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let i=a.length;for(let s=0;s<i&&(a[s](t),t.isAttached());s++);}function iL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Ik(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function Q$(e){return Cx(e,Kt()._nodes)}function Cx(e,t){let n=e.type,o=t.get(n);o===void 0&&ee(17,n);let r=o.klass;e.type!==r.getType()&&ee(18,r.name);let a=r.importJSON(e),i=e.children;if(Q(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Cx(i[s],t);a.append(l)}return a}function sL(e,t,n){let o=Qn,r=No,a=Xn;Qn=t,No=!0,Xn=e;try{return n()}finally{Qn=o,No=r,Xn=a}}function Na(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,i=a._selection,s=n._selection,l=e._dirtyType!==0,d=Qn,c=No,f=Xn,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Xn=e,Qn=n,No=!1,e._updating=!0;try{let S=e._dirtyType,L=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),h=m$(a,n,e,S,L,I)}catch(S){if(S instanceof Error&&e._onError(S),bv)throw S;return Lk(e,null,o,n),kL(e),e._dirtyType=2,bv=!0,Na(e,a),void(bv=!1)}finally{m.observe(o,rL),e._updating=p,Qn=d,No=c,Xn=f}}n._readOnly||(n._readOnly=!0);let g=e._dirtyLeaves,v=e._dirtyElements,x=e._normalizedNodes,y=e._updateTags,C=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(S,L){let I=S._decorators,T=S._pendingDecorators||I,E=L._nodeMap,A;for(A in T)E.has(A)||(T===I&&(T=Rk(S)),delete T[A])})(e,n);let w=r?null:_r(Ho(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!y.has(ck)){Xn=e,Qn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&Xv(S,e,o),q$(i,s,e,w,y,o)}(function(S,L,I){let T=S._blockCursorElement;if(He(I)&&I.isCollapsed()&&I.anchor.type==="element"&&L.contains(document.activeElement)){let E=I.anchor,A=E.getNode(),N=E.offset,R=!1,$=null;if(N===A.getChildrenSize())Sv(A.getChildAtIndex(N-1))&&(R=!0);else{let H=A.getChildAtIndex(N);if(H!==null&&Sv(H)){let K=H.getPreviousSibling();(K===null||Sv(K))&&(R=!0,$=S.getElementByKey(H.__key))}}if(R){let H=S.getElementByKey(A.__key);return T===null&&(S._blockCursorElement=T=(function(K){let O=K.theme,oe=document.createElement("div");oe.contentEditable="false",oe.setAttribute("data-lexical-cursor","true");let te=O.blockCursor;if(te!==void 0){if(typeof te=="string"){let W=nu(te);te=O.blockCursor=W}te!==void 0&&oe.classList.add(...te)}return oe})(S._config)),L.style.caretColor="transparent",void($===null?H.appendChild(T):H.insertBefore(T,$))}}T!==null&&Xv(T,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,rL),Xn=f,Qn=d}}h!==null&&(function(S,L,I,T,E){let A=Array.from(S._listeners.mutation),N=A.length;for(let R=0;R<N;R++){let[$,H]=A[R];for(let K of H){let O=L.get(K);O!==void 0&&$(O,{dirtyLeaves:T,prevEditorState:E,updateTags:I})}}})(e,h,y,g,a),He(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(ix,void 0);let k=e._pendingDecorators;k!==null&&(e._decorators=k,e._pendingDecorators=null,_c("decorator",e,!0,k)),(function(S,L,I){let T=uL(L),E=uL(I);T!==E&&_c("textcontent",S,!0,E)})(e,t||a,n),_c("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:x,prevEditorState:t||a,tags:y}),(function(S,L){if(S._deferred=[],L.length!==0){let I=S._updating;S._updating=!0;try{for(let T=0;T<L.length;T++)L[T]()}finally{S._updating=I}}})(e,C),(function(S){let L=S._updates;if(L.length!==0){let I=L.shift();if(I){let[T,E]=I;Jp(S,T,E)}}})(e)}function _c(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let i=0;i<a.length;i++)a[i].apply(null,o)}finally{t._updating=r}}function lL(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,i]=r,s=e._pendingEditorState,l;i!==void 0&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(s===null&&ee(191),s._flushSync=!0),l&&e._deferred.push(l),Ik(e,i.tag)),s==null?Jp(e,a,i):a()}}return o}function Jp(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,Ik(e,n.tag),a=n.skipTransforms||!1,i=n.discrete||!1),r&&e._deferred.push(r);let s=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=Sk(l||s),d=!0),l._flushSync=i;let c=Qn,f=No,p=Xn,m=e._updating;Qn=l,No=!1,e._updating=!0,Xn=e;let h=e._headless||e.getRootElement()===null;Ix(null);try{d&&(h?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(y,C){let w=y.getEditorState()._selection,k=_r(Ho(y));return He(w)||w==null?Yp(w,k,y,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=lL(e,a),(function(y,C){let w=C.getEditorState()._selection,k=y._selection;if(He(k)){let S=k.anchor,L=k.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,k)),L.type==="text"){let T=L.getNode();I!==T&&T.selectionTransform(w,k)}}})(l,e),e._dirtyType!==0&&(a?(function(y,C){let w=C._dirtyLeaves,k=y._nodeMap;for(let S of w){let L=k.get(S);Me(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&OT(L)}})(l,e):(function(y,C){let w=C._dirtyLeaves,k=C._dirtyElements,S=y._nodeMap,L=yi(),I=new Map,T=w,E=T.size,A=k,N=A.size;for(;E>0||N>0;){if(E>0){C._dirtyLeaves=new Set;for(let R of T){let $=S.get(R);Me($)&&$.isAttached()&&$.isSimpleText()&&!$.isUnmergeable()&&OT($),$!==void 0&&iL($,L)&&aL(C,$,I),w.add(R)}if(T=C._dirtyLeaves,E=T.size,E>0){kp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let R of A){let $=R[0],H=R[1];if(k.set($,H),!H)continue;let K=S.get($);K!==void 0&&iL(K,L)&&aL(C,K,I)}T=C._dirtyLeaves,E=T.size,A=C._dirtyElements,N=A.size,kp++}C._dirtyLeaves=w,C._dirtyElements=k})(l,e),lL(e),(function(y,C,w,k){let S=y._nodeMap,L=C._nodeMap,I=[];for(let[T]of k){let E=L.get(T);E!==void 0&&(E.isAttached()||(Q(E)&&wL(E,T,S,L,I,k),S.has(T)||k.delete(T),I.push(T)))}for(let T of I)L.delete(T);for(let T of w){let E=L.get(T);E===void 0||E.isAttached()||(S.has(T)||w.delete(T),L.delete(T))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let x=l._selection;if(He(x)){let y=l._nodeMap,C=x.anchor.key,w=x.focus.key;y.get(C)!==void 0&&y.get(w)!==void 0||ee(19)}else Xc(x)&&x._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Na(e)}finally{Qn=c,No=f,Xn=p,e._updating=m,kp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,x){let y=x.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(y))return!0}else if(y!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Na(e)):d&&rH(()=>{Na(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function aa(e,t,n){Xn===e&&n===void 0?t():Jp(e,t,n)}var jv=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&ee(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&ee(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&ee(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(Gp||Qc||Wp);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",o.insertBefore(i,a),o.__lexicalLineBreak=i}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=dL(n,o);a.push(r);let i=dL(n,this.element),s=t.getIndexWithinParent();for(let l=0;l<i.length;l++){let d=a[l],c=i[l];if(d===void 0||d<c)break;if(d>c){s+=1;break}}return[t.getParentOrThrow(),s]}};function dL(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&ee(225),n.reverse()}var Si=class extends ur{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return e$[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Kt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Me(n)&&t.push(n),Q(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Q(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;Q(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return Q(a)&&a.getLastDescendant()||a||null}let r=n[t];return Q(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Dn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&ee(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Dn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&ee(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=jp)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=Lv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=co[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Gc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Gn();let o=St(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Me(l)||Q(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Me(l)||Q(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return He(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):vk(s,r,s,a,"element","element")}selectStart(){let t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){let t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?Lv[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Bp(this)&&ee(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||ee(226,String(t),String(n),String(r));let i=a.__key,s=[],l=[],d=this.getChildAtIndex(t+n),c=null,f=r-n+o.length;if(t!==0)if(t===r)c=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(c=m.getPreviousSibling())}if(n>0){let m=c===null?this.getFirstChild():c.getNextSibling();for(let h=0;h<n;h++){m===null&&ee(100);let g=m.getNextSibling(),v=m.__key;bi(m.getWritable()),l.push(v),m=g}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let h=m.getWritable();h.__parent===i&&f--,bi(h);let g=m.__key;if(p===null)a.__first=g,h.__prev=null;else{let v=p.getWritable();v.__next=g,h.__prev=v.__key}m.__key===i&&ee(76),h.__parent=i,s.push(g),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=St();if(He(m)){let h=new Set(l),g=new Set(s),{anchor:v,focus:x}=m;cL(v,h,g)&&Hp(v,v.getNode(),this,c,d),cL(x,h,g)&&Hp(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||fr(this)||this.remove()}}return a}getDOMSlot(t){return new jv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(So(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||fr(this)||this.getChildren().some(Me)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let i=n.getElementByKey(a.getKey());i!==null&&(r==null?(o.insertChild(i),r=i):r!==i&&o.replaceChild(i,r),r=r.nextSibling)}}};function Q(e){return e instanceof Si}function cL(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Vc=class extends ur{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Qt(e){return e instanceof Vc}var $l=class e extends Si{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ee(51)}getTextContent(){let t=this.__cachedText;return!jl()&&Kt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){ee(52)}replace(t){ee(53)}insertBefore(t){ee(54)}insertAfter(t){ee(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)Q(r)||Qt(r)||ee(282);return super.splice(t,n,o)}static importJSON(t){return $o().updateFromJSON(t)}collapseAtStart(){return!0}};function eo(e){return e instanceof $l}function Sk(e){return new Wc(new Map(e._nodeMap))}function bx(){return new Wc(new Map([["root",new $l]]))}function wk(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ee(130,n.name),Q(e)){let o=t.children;Array.isArray(o)||ee(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=wk(r[a]);o.push(i)}}return t}function X$(e){return e instanceof Wc}var Wc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return sL(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return sL(null,this,()=>({root:wk($o())}))}},Up=class extends Si{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Hl=class e extends Si{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Ol(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:Y$,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(So(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Da().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Me);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Da();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||Me(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Y$(e){let t=Da();if(e.style&&(t.setFormat(e.style.textAlign),Wk(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Lv&&t.setFormat(n)}return{node:t}}function Da(){return eu(new Hl)}function Tk(e){return e instanceof Hl}var Rl=0,J$=1,Z$=2,eH=3,tH=4;function Lk(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=bx(),e._pendingEditorState=o,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function kk(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=tu(o),a=o.transform;if(!n.has(a)){n.add(a);let i=o.transform();i&&t.add(i)}if(r){let i=r.$transform;i&&t.add(i),o=r.extends}else{let i=Object.getPrototypeOf(o);o=i.prototype instanceof ur&&i!==ur?i:void 0}}return t}function nH(e){let t=e||{},n=j$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=bx(),s=t.namespace||(r!==null?r._config.namespace:Dk()),l=t.editorState,d=[$l,ks,Fl,zl,Hl,Up,...t.nodes||[]],{onError:c,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let g=0;g<d.length;g++){let v=d[g],x=null,y=null;if(typeof v!="function"){let k=v;v=k.replace,x=k.with,y=k.withKlass||null}tu(v);let C=v.getType(),w=kk(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:PL(d[g]),transforms:w})}}let h=new wi(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(g,v){let x=new Map,y=new Set,C=w=>{Object.keys(w).forEach(k=>{let S=x.get(k);S===void 0&&(S=[],x.set(k,S)),S.push(w[k])})};return g.forEach(w=>{let k=w.klass.importDOM;if(k==null||y.has(k))return;y.add(k);let S=k.call(w.klass);S!==null&&C(S)}),v&&C(v),x})(m,f?f.import:void 0),p,e);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=2),(function(g){g.registerCommand(sx,w$,Rl),g.registerCommand(lx,T$,Rl),g.registerCommand(dx,L$,Rl),g.registerCommand(cx,k$,Rl),g.registerCommand(mx,P$,Rl)})(h),h}var wi=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,n,o,r,a,i,s,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Dk(),this._onError=a,this._htmlConversions=i,this._editable=s,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&ee(35);let r=this._commands;r.has(t)||r.set(t,[new Set,new Set,new Set,new Set,new Set]);let a=r.get(t);a===void 0&&ee(36,String(t));let i=a[o];return i.add(n),()=>{i.delete(n),a.every(s=>s.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,i=a.get(n);i===void 0&&(i=new Set,a.set(n,i)),i.add(r);let s=o&&o.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(n,r),()=>{i.delete(r),i.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&ee(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=Jv(o).get(n.getType());if(!r)return;let a=new Map;for(let i of r.keys())a.set(i,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let i=this.registerNodeTransformToKlass(a,n);r.push(i)}return(function(i,s){let l=Jv(i.getEditorState()),d=[];for(let c of s){let f=l.get(c);f&&d.push(f)}d.length!==0&&i.update(()=>{for(let c of d)for(let f of c.keys()){let p=Dn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:Lp}:void 0)})(this,r.map(i=>i.klass.getType())),()=>{r.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Ce(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Ol(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Lk(this,n,t,r),n!==null&&(this._config.disableEvents||A$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Nx(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,kL(this),this._updateTags.add(Lp),Na(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Hv.set(s,d);let c=Op.get(d)??0;c<1&&d.addEventListener("selectionchange",ik),Op.set(d,c+1),s.__lexicalEditor=l;let f=ak(s);for(let p=0;p<$v.length;p++){let[m,h]=$v[p],g=typeof h=="function"?v=>{KT(v)||(UT(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(KT(v))return;UT(v);let x=l.isEditable();switch(m){case"cut":return x&&Ce(l,hx,v);case"copy":return Ce(l,gx,v);case"paste":return x&&Ce(l,ux,v);case"dragstart":return x&&Ce(l,GL,v);case"dragover":return x&&Ce(l,jL,v);case"dragend":return x&&Ce(l,QL,v);case"focus":return x&&Ce(l,XL,v);case"blur":return x&&Ce(l,YL,v);case"drop":return x&&Ce(l,WL,v)}};s.addEventListener(m,g),f.push(()=>{s.removeEventListener(m,g)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(Lp),Na(this);_c("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&ee(38);let o=t;o._readOnly&&(o=Sk(t),o._selection=t._selection?t._selection.clone():null),LL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Na(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Na(this)}parseEditorState(t,n){return(function(o,r,a){let i=bx(),s=Qn,l=No,d=Xn,c=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Qn=i,No=!1,Xn=r,Ix(null);try{let h=r._nodes;Cx(o.root,h),a&&a(),i._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Qn=s,No=l,Xn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Na(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Jp(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),aa(this,()=>{let r=St(),a=$o();r!==null?r.dirty||_o(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),nm("focus"),$k(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=_r(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,_c("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};wi.version="0.41.0+prod.esm";var Qv=null;function Ix(e){Qv=e}var Pk=1;function oH(){Pk=1}function Sx(e,t){let n=wx(e,t);return n===void 0&&ee(30,t),n}function wx(e,t){return e._nodes.get(t)}var rH=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function Ak(e){return Qt(tm(e))}function Tx(e){let t=document.activeElement;if(!So(t))return!1;let n=t.nodeName;return Qt(tm(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&Jc(t)==null)}function Yc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Tx(t)&&Lx(t)===e}catch{return!1}}function Zp(e){return e instanceof wi}function Lx(e){let t=e;for(;t!=null;){let n=Jc(t);if(Zp(n))return n;t=Zc(t)}return null}function Jc(e){return e?e.__lexicalEditor:null}function aH(e){return Y5.test(e)?"rtl":J5.test(e)?"ltr":null}function Ci(e){return xx(e)||e.isToken()}function Ra(e){return Ci(e)||e.isSegmented()}function ia(e){return Ql(e)&&e.nodeType===3}function Ek(e){return Ql(e)&&e.nodeType===9}function As(e){let t=e;for(;t!=null;){if(ia(t))return t;t=t.firstChild}return null}function Gc(e,t,n){let o=co[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~co.superscript:t==="superscript"?r&=~co.subscript:t==="lowercase"?(r&=~co.uppercase,r&=~co.capitalize):t==="uppercase"?(r&=~co.lowercase,r&=~co.capitalize):t==="capitalize"&&(r&=~co.lowercase,r&=~co.uppercase),r}function iH(e){return Me(e)||ws(e)||Qt(e)}function Mk(e,t){let n=(function(){let i=Qv;return Qv=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Gn(),Ck();let o=Kt(),r=Ba(),a=""+Pk++;r._nodeMap.set(a,e),Q(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function bi(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),i=a!==null?a.__key:null,s=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=i),a===null&&(o.__last=s),l!==null&&(l.__next=i),d!==null&&(d.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Kp(e){Ck(),Bp(e)&&ee(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Ba(),r=Kt(),a=o._nodeMap,i=r._dirtyElements;n!==null&&(function(l,d,c){let f=l;for(;f!==null;){if(c.has(f))return;let p=d.get(f);if(p===void 0)break;c.set(f,!1),f=p.__parent}})(n,a,i);let s=t.__key;r._dirtyType=1,Q(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function jn(e){Gn();let t=Kt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Dn(n);o!==null&&o.getWritable()}if(e!==null){let o=Dn(e);o!==null&&o.getWritable()}}}function yi(){return jl()?null:Kt()._compositionKey}function Dn(e,t){let n=(t||Ba())._nodeMap.get(e);return n===void 0?null:n}function kx(e,t){let n=em(e,Kt());return n!==void 0?Dn(n,t):null}function em(e,t){return e[`__lexicalKey_${t._key}`]}function tm(e,t){let n=e;for(;n!=null;){let o=kx(n,t);if(o!==null)return o;n=Zc(n)}return null}function Rk(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function uL(e){return e.read(()=>$o().getTextContent())}function $o(){return Nk(Ba())}function Nk(e){return e._nodeMap.get("root")}function _o(e){Gn();let t=Ba();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Nl(e){let t=Kt(),n=(function(o,r){let a=o;for(;a!=null;){let i=em(a,r);if(i!==void 0)return i;a=Zc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Dn("root"):null:Dn(n)}function _k(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Px(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function Dk(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ok(e){return ia(e)?e.nodeValue:null}function Ax(e,t,n){let o=_r(Ho(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=Ok(r),l=tm(r);if(s!==null&&Me(l)){if((s===Bc||s===ox)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Ex(l,s,a,i,e)}}}function Ex(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let i=a.isComposing(),s=t;if((i||r)&&(t.endsWith(Bc)&&(s=t.slice(0,-Bc.length)),r)){let d=ox,c;for(;(c=s.indexOf(d))!==-1;)s=s.slice(0,c)+s.slice(c+d.length),n!==null&&n>c&&(n=Math.max(c,n-d.length)),o!==null&&o>c&&(o=Math.max(c,o-d.length))}let l=a.getTextContent();if(r||s!==l){if(s===""){if(jn(null),Wp||Qc||Gp)a.remove();else{let g=Kt();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Ms(),f=a.getTextContentSize(),p=yi(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||He(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!i||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!i))return void a.markDirty();let h=St();if(!He(h)||n===null||o===null)return void fL(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=Wn(a.getTextContent());a.replace(g),a=g}fL(a,s,h)}}}function fL(e,t,n){if(e.setTextContent(t),He(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=Mr(e,a.offset,"clamp"))}}}function Cp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function Fk(e,t){return Cp(e,t,"altKey")&&Cp(e,t,"ctrlKey")&&Cp(e,t,"shiftKey")&&Cp(e,t,"metaKey")}function At(e,t,n){if(!Fk(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var Ma={ctrlKey:!kr,metaKey:kr},pL={altKey:kr,ctrlKey:!kr};function mL(e){return e.key==="Backspace"}function gL(e){return At(e,"a",Ma)}function sH(e){let t=$o();if(He(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Ep(e),e}{let n=t.select(0,t.getChildrenSize());return _o(Ep(n)),n}}function Ol(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=nu(r);return n[t]=a,a}return r}function Mx(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&ee(33,a);let l=s.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(i),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(i,f?"updated":r)}function lH(e){let t=e.getType(),n=Ba();if(n._readOnly){let a=Jv(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function hL(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function Bk(e,t){let n=e.offset;if(e.type==="element")return hL(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?hL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function zk(e){let t=Ho(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Ce(e,t,n){return(function(o,r,a){let i=Px(o);for(let s=4;s>=0;s--)for(let l=0;l<i.length;l++){let d=i[l],c=d._commands.get(r);if(c!==void 0){let f=c[s];if(f!==void 0){let p=Array.from(f),m=p.length,h=!1;if(aa(d,()=>{for(let g=0;g<m;g++)if(p[g](a,o))return void(h=!0)}),h)return h}}}return!1})(e,t,n)}function Ul(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&ee(75,t),n}function Zc(e){let t=e.assignedSlot||e.parentElement;return qk(t)?t.host:t}function Rx(e){return Ek(e)?e:So(e)?e.ownerDocument:null}function dH(e){return Kt()._updateTags.has(e)}function nm(e){Gn(),Kt()._updateTags.add(e)}function $k(e){Gn(),Kt()._deferred.push(e)}function qp(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Nx(e){let t=Rx(e);return t?t.defaultView:null}function Ho(e){let t=e._window;return t===null&&ee(78),t}function cH(e){return Q(e)&&e.isInline()||Qt(e)&&e.isInline()}function Hk(e){let t=e.getParentOrThrow();for(;t!==null;){if(fr(t))return t;t=t.getParentOrThrow()}return t}function fr(e){return eo(e)||Q(e)&&e.isShadowRoot()}function _x(e){let t=e.constructor.clone(e);return Mk(t,null),t.afterCloneFrom(e),t}function eu(e){let t=Kt(),n=e.getType(),o=wx(t,n);o===void 0&&ee(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let i=r(e),s=i.constructor;return a!==null?i instanceof a||ee(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||ee(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&ee(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Iv(e,t){!eo(e.getParent())||Q(t)||Qt(t)||ee(99)}function Uk(e){let t=Dn(e);return t===null&&ee(63,e),t}function Sv(e){return(Qt(e)||Q(e)&&!e.canBeEmpty())&&!e.isInline()}function Xv(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function _r(e){return Nr?(e||window).getSelection():null}function Kk(e){let t=Nx(e);return t?t.getSelection():null}function uH(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),fr(e)&&ee(102);let o=i=>{let s=i.getParentOrThrow(),l=fr(s),d=i!==n||l?_x(i):i;if(l)return Q(i)&&Q(d)||ee(133),i.insertAfter(d),[i,d,d];{let[c,f,p]=o(s),m=i.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function fH(e){return So(e)&&e.tagName==="A"}function So(e){return Ql(e)&&e.nodeType===1}function Ql(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function qk(e){return Ql(e)&&e.nodeType===11}function Vk(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return e.nodeName.match(t)!==null}function Yv(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return e.nodeName.match(t)!==null}function _a(e){if(Qt(e)&&!e.isInline())return!0;if(!Q(e)||fr(e))return!1;let t=e.getFirstChild(),n=t===null||ws(t)||Me(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Dx(){return Kt()}var vL=new WeakMap,pH=new Map;function Jv(e){if(!e._readOnly&&e.isEmpty())return pH;e._readOnly||ee(192);let t=vL.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let i=a.__type,s=o.get(i);s||(s=new Map,o.set(i,s)),s.set(r,a)}return o})(e),vL.set(e,t)),t}function Ox(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function mH(e){return(t=Ox(e))[sk]=!0,t;var t}function Wk(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function gH(e){e.__lexicalUnmanaged=!0}function Gk(e){return e.__lexicalUnmanaged===!0}function Ec(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==ur[t]}function tu(e){let t=AT in e.prototype?e.prototype[AT]():void 0,n=(function(i){if(!(i===ur||i.prototype instanceof ur)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{wi.version&&(l=JSON.parse(wi.version))}catch{}ee(290,i.name,s,l)}return i===Vc||i===Si||i===ur})(e),o=!n&&Ec(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[i,s]of Object.entries(t))a=i,r=s;if(!n&&a&&(Ec(e,"getType")||(e.getType=()=>a),Ec(e,"clone")||(e.clone=i=>(Ix(i),new e)),Ec(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Ec(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function hH(e){let t=Dx();return Gn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Dc=(e,t)=>{let n=e;for(;n!=null&&!eo(n);){if(t(n))return n;n=n.getParent()}return null},vH={next:"previous",previous:"next"},Kl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return zx({hasNext:Es,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Yn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Yn(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,i=this.getParentAtCaret(),s=new Map;for(let l=a.getAdjacentCaret();l!==null&&s.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();s.set(d.getKey(),d)}for(let l of r){if(s.size>0){let d=a.getNodeAtCaret();if(d){if(s.delete(d.getKey()),s.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(i)&&l.remove(),d.replace(l)}}else d===null&&ee(263,Array.from(s).join(" "))}else a.insert(l);a=Yn(l,this.direction)}for(let l of s.values())l.remove();return this}},jc=class e extends Kl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Fa(t,this.direction)}getParentCaret(t="root"){return Yn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Ai(this.direction);return Yn(this.getNodeAtCaret(),t)||Fa(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}},xH={root:eo,shadowRoot:fr};function Ai(e){return vH[e]}function Fx(e,t="root"){return xH[t](e)?null:e}var ql=class e extends Kl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Yn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Q(this.origin)?Fa(this.origin,this.direction):null}getParentCaret(t="root"){return Yn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Ai(this.direction);return Yn(this.getNodeAtCaret(),t)||Fa(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Vl)&&this.direction===t.direction&&this.origin.is(t.origin)}},Vl=class e extends Kl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ti(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Yn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ti(this.origin,Ai(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof ql||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Yn(this.origin,this.direction)}};function Oa(e){return e instanceof Vl}function yH(e){return e instanceof Kl}function Es(e){return e instanceof ql}function Er(e){return e instanceof jc}var CH={next:class extends Vl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Vl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},bH={next:class extends ql{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends ql{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},IH={next:class extends jc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends jc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Yn(e,t){return e?new bH[t](e):null}function Ti(e,t,n){return e?new CH[t](e,Mr(e,n)):null}function Mr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&CL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function Zv(e,t){return new Vp(e,t)}function Fa(e,t){return Q(e)?new IH[t](e):null}function jk(e){return e&&e.getChildCaret()||e}function Wl(e){return e&&jk(e.getAdjacentCaret())}var ex=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Oa(a)?(function(i,s){let{direction:l,origin:d}=i,c=Mr(d,s==="focus"?Ai(l):l);return Zv(i,c-i.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[Zv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=Oa(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Oa(o),a=i=>i.isSameNodeCaret(o)?null:Wl(i)||i.getParentCaret(t);return zx({hasNext:i=>i!==null&&!(r&&o.isSameNodeCaret(i)),initial:n.isSameNodeCaret(o)?null:a(n),map:i=>i,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Vp=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return Ti(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function SH(e){return e instanceof Vp}function Bx(e){return Li(e,Yn($o(),e.direction))}function Qk(e){return Li(e,e)}function Li(e,t){return e.direction!==t.direction&&ee(265),new ex(e,t,e.direction)}function zx(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let i={done:!1,value:r(a)};return a=o(a),i}}}function $x(e,t){let n=Oc(e.origin,t.origin);switch(n===null&&ee(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,i){return Math.sign(a-i)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Hx(n)}}function Hx(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,i=n;for(;a&&i;a=a.getNextSibling(),i=i.getNextSibling()){if(a.__key===r)return-1;if(i.__key===o)return 1}return a===null?1:-1}function bp(e,t){return t.is(e)}function xL(e){return Q(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Oc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=xL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=xL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(bp(e,o)||ee(276),{commonAncestor:o,type:"ancestor"}):r===null?(bp(t,o)||ee(277),{commonAncestor:o,type:"descendant"}):((Q(a)||bp(e,a))&&(Q(r)||bp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||ee(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function ki(e,t){let{type:n,key:o,offset:r}=e,a=Uk(e.key);return n==="text"?(Me(a)||ee(266,a.getType(),o),Ti(a,t,r)):(Q(a)||ee(267,a.getType(),o),Zk(a,e.offset,t))}function Gl(e,t){let{origin:n,direction:o}=t,r=o==="next";Oa(t)?e.set(n.getKey(),t.offset,"text"):Es(t)?Me(n)?e.set(n.getKey(),Mr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Er(t)&&Q(n)||ee(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function Xk(e){let t=St(),n=He(t)?t:xk();return Fc(n,e),_o(n),n}function Fc(e,t){Gl(e.anchor,t.anchor),Gl(e.focus,t.focus)}function tx(e){let{anchor:t,focus:n}=e,o=ki(t,"next"),r=ki(n,"next"),a=$x(o,r)<=0?"next":"previous";return Li(Pi(o,a),Pi(r,a))}function Xl(e){let{direction:t,origin:n}=e,o=Yn(n,Ai(t)).getNodeAtCaret();return o?Yn(o,t):Fa(n.getParentOrThrow(),t)}function yL(e,t="root"){let n=[e];for(let o=Er(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Xl(o));return n}function wv(e){return!!e&&e.origin.isAttached()}function Yk(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Ux(e,o),i=yL(a.anchor,n),s=yL(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(Er(h))l.add(h.origin.getKey());else if(Es(h)){let{origin:g}=h;Q(g)&&!l.has(g.getKey())||d.push(g)}for(let h of d)h.remove();for(let h of a.getTextSlices()){if(!h)continue;let{origin:g}=h.caret,v=g.getTextContentSize(),x=Xl(Yn(g,o)),y=g.getMode();if(Math.abs(h.distance)===v&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)x.remove();else if(h.distance!==0){r="removeEmptySlices";let C=h.removeTextSlice(),w=h.caret.origin;if(y==="segmented"){let k=C.origin,S=Wn(k.getTextContent()).setStyle(k.getStyle()).setFormat(k.getFormat());x.replaceOrInsert(S),C=Ti(S,o,C.offset)}w.is(i[0].origin)&&(i[0]=C),w.is(s[0].origin)&&(s[0]=C.getFlipped())}}let c,f;for(let h of i)if(wv(h)){c=Pr(h);break}for(let h of s)if(wv(h)){f=Pr(h);break}let p=(function(h,g,v){if(!h||!g)return null;let x=h.getParentAtCaret(),y=g.getParentAtCaret();if(!x||!y)return null;let C=x.getParents().reverse();C.push(x);let w=y.getParents().reverse();w.push(y);let k=Math.min(C.length,w.length),S;for(S=0;S<k&&C[S]===w[S];S++);let L=(E,A)=>{let N;for(let R=S;R<E.length;R++){let $=E[R];if(fr($))return;!N&&A($)&&(N=$)}return N},I=L(C,_a),T=I&&L(w,E=>v.has(E.getKey())&&_a(E));return I&&T?[I,T]:null})(c,f,l);if(p){let[h,g]=p;Fa(h,"previous").splice(0,g.getChildren());let v=g.getParent();for(g.remove(!0);v&&v.isEmpty();){let x=v;v=v.getParent(),x.remove(!0)}}let m=[c,f,...i,...s].find(wv);if(m)return Qk(Pi(Pr(m),e.direction));ee(269,JSON.stringify(i.map(h=>h.origin.__key)))}function Pr(e){let t=(function(r){let a=r;for(;Er(a);){let i=Wl(a);if(!Er(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Me(t.origin))return Oa(t)?t:Ti(t.origin,n,n);let o=t.getAdjacentCaret();return Es(o)&&Me(o.origin)?Ti(o.origin,n,Ai(n)):t}function Jk(e){return Oa(e)&&e.offset!==Mr(e.origin,e.direction)}function Pi(e,t){return e.direction===t?e:e.getFlipped()}function Ux(e,t){return e.direction===t?e:Li(Pi(e.focus,t),Pi(e.anchor,t))}function Zk(e,t,n){let o=Fa(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Pi(o,n)}function wH(e,t="root"){let n=0,o=e,r=Wl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Wl(o)}return r&&[r,n]}function TH(e){let{origin:t,offset:n,direction:o}=e;if(n===Mr(t,o))return e.getSiblingCaret();if(n===Mr(t,Ai(o)))return Xl(e.getSiblingCaret());let[r]=t.splitText(n);return Me(r)||ee(281),Pi(Yn(r,"next"),o)}function LH(e,t){return!0}function kH(e,{$copyElementNode:t=_x,$splitTextPointCaretNext:n=TH,rootMode:o="shadowRoot",$shouldSplit:r=LH}={}){if(Oa(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Er(e)&&(!i.canBeEmpty()||!r(i,"first")))return Xl(a);let s=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(s.length>0||i.canBeEmpty()&&r(i,"last"))&&a.insert(t(i).splice(0,0,s))}return a}function PH(e){return e}function AH(...e){return e}function EH(e,t){return[e,t]}function MH(e){return e}function RH(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function nu(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function NH(e,...t){let n=nu(...t);n.length>0&&e.classList.add(...n)}function _H(e,...t){let n=nu(...t);n.length>0&&e.classList.remove(...n)}function DH(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Kx,Xte=M.$addUpdateTag,om=M.$applyNodeReplacement,Yl=M.$caretFromPoint,eP=M.$caretRangeFromSelection,rm=M.$cloneWithProperties,tP=M.$cloneWithPropertiesEphemeral,Yte=M.$comparePointCaretNext,Jte=M.$copyNode,nP=M.$create,Rs=M.$createLineBreakNode,oP=M.$createNodeSelection,pr=M.$createParagraphNode,Zte=M.$createPoint,Ns=M.$createRangeSelection,rP=M.$createRangeSelectionFromDom,aP=M.$createTabNode,Dr=M.$createTextNode,iP=M.$extendCaretToRange,za=M.$findMatchingParent,qx=M.$getAdjacentChildCaret,ene=M.$getAdjacentNode,_s=M.$getAdjacentSiblingOrParentSiblingCaret,Vx=M.$getCaretInDirection,sP=M.$getCaretRange,tne=M.$getCaretRangeInDirection,lP=M.$getCharacterOffsets,Ei=M.$getChildCaret,nne=M.$getChildCaretAtIndex,Wx=M.$getChildCaretOrSelf,dP=M.$getCollapsedCaretRange,one=M.$getCommonAncestor,rne=M.$getCommonAncestorResultBranchOrder,am=M.$getEditor,ane=M.$getNearestNodeFromDOMNode,ine=M.$getNearestRootOrShadowRoot,im=M.$getNodeByKey,sne=M.$getNodeByKeyOrThrow,cP=M.$getNodeFromDOMNode,ou=M.$getPreviousSelection,Ct=M.$getRoot,De=M.$getSelection,$a=M.$getSiblingCaret,sm=M.$getState,lne=M.$getStateChange,dne=M.$getTextContent,cne=M.$getTextNodeOffset,une=M.$getTextPointCaret,fne=M.$getTextPointCaretSlice,pne=M.$getWritableNodeState,uP=M.$hasAncestor,mne=M.$hasUpdateTag,gne=M.$insertNodes,Jl=M.$isBlockElementNode,ru=M.$isChildCaret,lm=M.$isDecoratorNode,fP=M.$isEditorState,Ue=M.$isElementNode,pP=M.$isExtendableTextPointCaret,hne=M.$isInlineElementOrDecoratorNode,mP=M.$isLeafNode,Zl=M.$isLineBreakNode,vne=M.$isNodeCaret,Gx=M.$isNodeSelection,gP=M.$isParagraphNode,we=M.$isRangeSelection,au=M.$isRootNode,Ds=M.$isRootOrShadowRoot,hP=M.$isSiblingCaret,xne=M.$isTabNode,nt=M.$isTextNode,dm=M.$isTextPointCaret,yne=M.$isTextPointCaretSlice,jx=M.$isTokenOrSegmented,Cne=M.$isTokenOrTab,bne=M.$nodesOfType,vP=M.$normalizeCaret,xP=M.$normalizeSelection__EXPERIMENTAL,Ine=M.$onUpdate,yP=M.$parseSerializedNode,Sne=M.$removeTextFromCaretRange,CP=M.$rewindSiblingCaret,cm=M.$selectAll,wne=M.$setCompositionKey,Tne=M.$setPointFromCaret,Or=M.$setSelection,bP=M.$setSelectionFromCaretRange,um=M.$setState,IP=M.$splitAtPointCaretNext,SP=M.$splitNode,Lne=M.$updateRangeSelectionFromCaretRange,Qx=M.ArtificialNode__DO_NOT_USE,kne=M.BEFORE_INPUT_COMMAND,wP=M.BLUR_COMMAND,iu=M.CAN_REDO_COMMAND,su=M.CAN_UNDO_COMMAND,fm=M.CLEAR_EDITOR_COMMAND,TP=M.CLEAR_HISTORY_COMMAND,LP=M.CLICK_COMMAND,Pne=M.COLLABORATION_TAG,pm=M.COMMAND_PRIORITY_CRITICAL,Xt=M.COMMAND_PRIORITY_EDITOR,Fr=M.COMMAND_PRIORITY_HIGH,ed=M.COMMAND_PRIORITY_LOW,Ane=M.COMMAND_PRIORITY_NORMAL,Ene=M.COMPOSITION_END_COMMAND,kP=M.COMPOSITION_END_TAG,Mne=M.COMPOSITION_START_COMMAND,PP=M.COMPOSITION_START_TAG,AP=M.CONTROLLED_TEXT_INSERTION_COMMAND,mm=M.COPY_COMMAND,EP=M.CUT_COMMAND,gm=M.DELETE_CHARACTER_COMMAND,MP=M.DELETE_LINE_COMMAND,RP=M.DELETE_WORD_COMMAND,Rne=M.DRAGEND_COMMAND,Nne=M.DRAGOVER_COMMAND,NP=M.DRAGSTART_COMMAND,_P=M.DROP_COMMAND,Ha=M.DecoratorNode,_ne=M.ElementNode,DP=M.FOCUS_COMMAND,Dne=M.FORMAT_ELEMENT_COMMAND,OP=M.FORMAT_TEXT_COMMAND,hm=M.HISTORIC_TAG,Br=M.HISTORY_MERGE_TAG,FP=M.HISTORY_PUSH_TAG,Xx=M.INDENT_CONTENT_COMMAND,One=M.INPUT_COMMAND,Yx=M.INSERT_LINE_BREAK_COMMAND,BP=M.INSERT_PARAGRAPH_COMMAND,zP=M.INSERT_TAB_COMMAND,lu=M.INTERNAL_$isBlock,Fne=M.IS_ALL_FORMATTING,Bne=M.IS_BOLD,zne=M.IS_CODE,$ne=M.IS_HIGHLIGHT,Hne=M.IS_ITALIC,Une=M.IS_STRIKETHROUGH,Kne=M.IS_SUBSCRIPT,qne=M.IS_SUPERSCRIPT,Vne=M.IS_UNDERLINE,$P=M.KEY_ARROW_DOWN_COMMAND,vm=M.KEY_ARROW_LEFT_COMMAND,xm=M.KEY_ARROW_RIGHT_COMMAND,HP=M.KEY_ARROW_UP_COMMAND,ym=M.KEY_BACKSPACE_COMMAND,UP=M.KEY_DELETE_COMMAND,KP=M.KEY_DOWN_COMMAND,Cm=M.KEY_ENTER_COMMAND,Wne=M.KEY_ESCAPE_COMMAND,Gne=M.KEY_MODIFIER_COMMAND,jne=M.KEY_SPACE_COMMAND,bm=M.KEY_TAB_COMMAND,qP=M.LineBreakNode,Qne=M.MOVE_TO_END,Xne=M.MOVE_TO_START,Yne=M.NODE_STATE_KEY,VP=M.OUTDENT_CONTENT_COMMAND,Im=M.PASTE_COMMAND,WP=M.PASTE_TAG,GP=M.ParagraphNode,jP=M.REDO_COMMAND,QP=M.REMOVE_TEXT_COMMAND,XP=M.RootNode,Jne=M.SELECTION_CHANGE_COMMAND,YP=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,JP=M.SELECT_ALL_COMMAND,Zne=M.SKIP_COLLAB_TAG,eoe=M.SKIP_DOM_SELECTION_TAG,toe=M.SKIP_SCROLL_INTO_VIEW_TAG,noe=M.SKIP_SELECTION_FOCUS_TAG,ZP=M.TEXT_TYPE_TO_FORMAT,eA=M.TabNode,Sm=M.TextNode,tA=M.UNDO_COMMAND,du=M.addClassNamesToElement,ooe=M.buildImportMap,wm=M.configExtension,nA=M.createCommand,Tm=M.createEditor,roe=M.createSharedNodeState,oA=M.createState,rA=M.declarePeerDependency,kn=M.defineExtension,aoe=M.flipDirection,ioe=M.getDOMOwnerDocument,Jx=M.getDOMSelection,soe=M.getDOMSelectionFromTarget,aA=M.getDOMTextNode,loe=M.getEditorPropertyFromDOMNode,doe=M.getNearestEditorFromDOMNode,iA=M.getRegisteredNode,coe=M.getRegisteredNodeOrThrow,uoe=M.getStaticNodeConfig,foe=M.getTextDirection,poe=M.getTransformSetFromKlass,sA=M.isBlockDomNode,moe=M.isCurrentlyReadOnlyMode,lA=M.isDOMDocumentNode,dA=M.isDOMNode,goe=M.isDOMTextNode,hoe=M.isDOMUnmanaged,Zx=M.isDocumentFragment,voe=M.isExactShortcutMatch,cA=M.isHTMLAnchorElement,Lm=M.isHTMLElement,cu=M.isInlineDomNode,xoe=M.isLexicalEditor,yoe=M.isModifierMatch,Coe=M.isSelectionCapturedInDecoratorInput,uA=M.isSelectionWithinEditor,ey=M.makeStepwiseIterator,sa=M.mergeRegister,boe=M.normalizeClassNames,km=M.removeClassNamesFromElement,Ioe=M.removeFromParent,Soe=M.resetRandomKey,zr=M.safeCast,woe=M.setDOMUnmanaged,Toe=M.setNodeIndentFromDOM,Pm=M.shallowMergeConfig,ty=M.toggleTextFormatType;var ny={};Tn(ny,{LexicalComposer:()=>FH});me();var fA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,OH=fA?ye:q,Am={tag:Br};function FH({initialConfig:e,children:t}){let n=z(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=PT(null,o),c=Tm({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>i(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=Ct();if(m.isEmpty()){let h=pr();m.append(h);let g=fA?document.activeElement:null;(De()!==null||g!==null&&g===f.getRootElement())&&h.select()}},Am);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,Am);break}case"object":f.setEditorState(p,Am);break;case"function":f.update(()=>{Ct().isEmpty()&&p(f)},Am)}}})(c,s),[c,d]},[]);return OH(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(kT.Provider,{value:n,children:t})}var BH=ny,pA=BH.LexicalComposer;var ry={};Tn(ry,{$canShowPlaceholder:()=>gA,$canShowPlaceholderCurry:()=>$H,$findTextIntersectionFromCharacters:()=>HH,$isRootTextContentEmpty:()=>oy,$isRootTextContentEmptyCurry:()=>zH,$rootTextContent:()=>mA,registerLexicalTextEntity:()=>KH});function mA(){return Ct().getTextContent()}function oy(e,t=!0){if(e)return!1;let n=mA();return t&&(n=n.trim()),n===""}function zH(e,t){return()=>oy(e,t)}function gA(e){if(!oy(e,!1))return!1;let t=Ct().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(lm(r))return!1;if(Ue(r)){if(!gP(r)||r.__indent!==0)return!1;let a=r.getChildren(),i=a.length;for(let s=0;s<i;s++){let l=a[o];if(!nt(l))return!1}}}return!0}function $H(e){return()=>gA(e)}function HH(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(Ue(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(nt(n)){let i=n.getTextContentSize();if(o+i>t)return{node:n,offset:t-o};o+=i}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let i=a.getNextSibling();if(i!==null){n=i;continue e}a=a.getParent()}break}return null}function UH(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function KH(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Dr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(Sm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(nt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(h=>h.getLatest().__mode)(l)!==0)return void a(l);{let h=m.end-p.length;if(h>0){let g=p+d.slice(0,h);if(l.select(),l.setTextContent(g),h===d.length)i.remove();else{let v=d.slice(h);i.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){s=t(d);let p,m=s===null?"":d.slice(s.end);if(d=m,m===""){let g=c.getNextSibling();if(nt(g)){m=c.getTextContent()+g.getTextContent();let v=t(m);if(v===null)return void(r(g)?a(g):g.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&nt(l)&&l.isTextEntity()){f+=s.end;continue}s.start===0?[p,c]=c.splitText(s.end):[,p,c]=c.splitText(s.start+f,s.end+f),p===void 0&&UH(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),c==null)return;f=0,l=h}}),e.registerNodeTransform(n,i=>{let s=i.getTextContent(),l=t(s);if(l===null||l.start!==0)return void a(i);if(s.length>l.end)return void i.splitText(l.end);let d=i.getPreviousSibling();nt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();nt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Os=ry,Noe=Os.$canShowPlaceholder,Em=Os.$canShowPlaceholderCurry,_oe=Os.$findTextIntersectionFromCharacters,Doe=Os.$isRootTextContentEmpty,Ooe=Os.$isRootTextContentEmptyCurry,Foe=Os.$rootTextContent,Boe=Os.registerLexicalTextEntity;var cy={};Tn(cy,{$addNodeStyle:()=>QH,$cloneWithProperties:()=>rm,$copyBlockFormatIndent:()=>wA,$ensureForwardRangeSelection:()=>SA,$forEachSelectedTextNode:()=>IA,$getComputedStyleForElement:()=>sy,$getComputedStyleForParent:()=>ly,$getSelectionStyleValueForProperty:()=>oU,$isAtNodeEnd:()=>jH,$isParentElementRTL:()=>dy,$isParentRTL:()=>WH,$moveCaretSelection:()=>kA,$moveCharacter:()=>tU,$patchStyleText:()=>XH,$selectAll:()=>cm,$setBlocksType:()=>YH,$shouldOverrideDefaultCharacterSelection:()=>eU,$sliceSelectedTextNodeContent:()=>GH,$trimTextContentFromAnchor:()=>bA,$wrapNodes:()=>ZH,createDOMRange:()=>qH,createRectsFromDOMRange:()=>VH,getCSSFromStyleObject:()=>CA,getStyleObjectFromCSS:()=>Nm,trimTextContentFromAnchor:()=>rU});function iy(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Rm=new Map;function hA(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function vA(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function qH(e,t,n,o,r){let a=t.getKey(),i=o.getKey(),s=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(i),c=n,f=r;if(nt(t)&&(l=hA(l)),nt(o)&&(d=hA(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=vA(l)),d.nodeName==="BR"&&([d,f]=vA(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{s.setStart(l,c),s.setEnd(d,f)}catch{return null}return!s.collapsed||c===f&&a===i||(s.setStart(d,f),s.setEnd(l,c)),s}function VH(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(t.getClientRects()),s,l=i.length;i.sort((d,c)=>{let f=d.top-c.top;return Math.abs(f)<=3?d.left-c.left:f});for(let d=0;d<l;d++){let c=i[d],f=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,p=c.width+a===o.width;f||p?(i.splice(d--,1),l--):s=c}return i}function yA(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Nm(e){let t=Rm.get(e);return t===void 0&&(t=yA(e),Rm.set(e,t)),t}function CA(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function sy(e){let t=am().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function ly(e){return sy(au(e)?e:e.getParentOrThrow())}function WH(e){let t=ly(e);return t!==null&&t.direction==="rtl"}function GH(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!jx(t)&&o!==null){let[r,a]=o,i=e.isBackward(),s=r.getNode(),l=a.getNode(),d=t.is(s),c=t.is(l);if(d||c){let[f,p]=lP(e),m=s.is(l),h=t.is(i?l:s),g=t.is(i?s:l),v,x=0;m?(x=f>p?p:f,v=f>p?f:p):h?(x=i?p:f,v=void 0):g&&(x=0,v=i?f:p);let y=t.__text.slice(x,v);y!==t.__text&&(n==="clone"&&(t=tP(t)),t.__text=y)}}return t}function jH(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return Ue(t)||iy(177),e.offset===t.getChildrenSize()}function bA(e,t,n){let o=t.getNode(),r=n;if(Ue(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(Ue(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),i=0;if(a===null){let d=o.getParentOrThrow(),c=d.getPreviousSibling();for(;c===null;){if(d=d.getParent(),d===null){a=null;break}c=d.getPreviousSibling()}d!==null&&(i=d.isInline()?0:2,a=c)}let s=o.getTextContent();s===""&&Ue(o)&&!o.isInline()&&(s=`
3707
+ `?o.push(Dl()):i===" "?o.push(jp()):o.push(jn(i))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,i=n,s=o;!this.isCollapsed()&&o.isBefore(n)&&(i=o,s=n),i.type==="element"&&(function(v,x,y,C){let w=v.getNode(),k=w.getChildAtIndex(v.offset),S=jn();if(S.setFormat(y),S.setStyle(C),Lk(k))k.splice(0,0,[S]);else{let L=to(w)?Ea().append(S):S;k===null?w.append(L):k.insertBefore(L)}v.is(x)&&x.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&ql(s,wr(wi(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Me(p)||Z(26);let m=p.getTextContent().length,h=p.getParentOrThrow(),g=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(ka(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Me(v)&&v.canInsertTextBefore()&&!ka(v)||(v=jn(),v.setFormat(r),v.setStyle(a),h.canInsertTextAfter()?p.insertAfter(v):h.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(ka(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Me(v)&&!ka(v)||(v=jn(),v.setFormat(r),h.canInsertTextBefore()?p.insertBefore(v):h.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=jn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||Q(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),hk(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(vi(p)){let C=jn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),x=p.getStyle();if(l!==d||v===r&&x===a){if(xx(p)){let C=jn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=jn(t);if(C.setFormat(r),C.setStyle(a),C.select(),l===0)p.insertBefore(C,!1);else{let[w]=p.splitText(l);w.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let y=d-l;p=p.spliceText(l,y,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...g.getParentKeys()]),x=Q(p)?p:p.getParentOrThrow(),y=Q(g)?g:g.getParentOrThrow(),C=g;if(!x.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(s.type==="text"&&(d!==0||g.getTextContent()==="")||s.type==="element"&&g.getIndexWithinParent()<d)if(Me(g)&&!vi(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let I=jn(g.getTextContent());g.replace(I),g=I}to(s.getNode())||s.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let I=g.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?g.remove():I.remove()}else v.add(g.__key);let w=y.getChildren(),k=new Set(c),S=x.is(y),L=x.isInline()&&p.getNextSibling()===null?x:p;for(let I=w.length-1;I>=0;I--){let T=w[I];if(T.is(p)||Q(T)&&T.isParentOf(p))break;T.isAttached()&&(!k.has(T)||T.is(C)?S||L.insertAfter(T,!1):T.remove())}if(!S){let I=y,T=null;for(;I!==null;){let E=I.getChildren(),A=E.length;(A===0||E[A-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(vi(p))if(l===m)p.select();else{let I=jn(t);I.select(),p.replace(I)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let I=1;I<f;I++){let T=c[I],E=T.__key;v.has(E)||T.remove()}}}removeText(){let t=St()===this;Nc(this,Jk(tx(this))),t&&St()!==this&&Do(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Xn(null);let o=this.getNodes(),r=[];for(let w of o)Me(w)&&r.push(w);let a=w=>{o.forEach(k=>{if(Q(k)){let S=k.getFormatFlags(t,w);k.setTextFormat(S)}})},i=r.length;if(i===0)return this.toggleFormat(t),Xn(null),void a(n);let s=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:s,f=d?s:l,p=0,m=r[0],h=c.type==="element"?0:c.offset;if(c.type==="text"&&h===m.getTextContentSize()&&(p=1,m=r[1],h=0),m==null)return;let g=m.getFormatFlags(t,n);a(g);let v=i-1,x=r[v],y=f.type==="text"?f.offset:x.getTextContentSize();if(m.is(x)){if(h===y)return;if(ka(m)||h===0&&y===m.getTextContentSize())m.setFormat(g);else{let w=m.splitText(h,y),k=h===0?w[0]:w[1];k.setFormat(g),c.type==="text"&&c.set(k.__key,0,"text"),f.type==="text"&&f.set(k.__key,y-h,"text")}return void(this.format=g)}h===0||ka(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let C=x.getFormatFlags(t,g);y>0&&(y===x.getTextContentSize()||ka(x)||([x]=x.splitText(y)),x.setFormat(C));for(let w=p+1;w<v;w++){let k=r[w],S=k.getFormatFlags(t,C);k.setFormat(S)}c.type==="text"&&c.set(m.__key,h,"text"),f.type==="text"&&f.set(x.__key,y,"text"),this.format=g|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=St();return Ue(h)||Z(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Mc(n,Aa),r=t[t.length-1];if(Q(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=Cv(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(Q(h)||Qt(h))&&!h.isInline())){Q(o)||Z(211,n.constructor.name,n.getType());let h=Cv(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=Ea(),v=null;for(let x=0;x<h.length;x++){let y=h[x],C=Ss(y);if(C||Qt(y)&&y.isInline()||Q(y)&&y.isInline()||Me(y)||y.isParentRequired()){if(v===null&&(v=y.createParentElementNode(),g.append(v),C))continue;v!==null&&v.append(y)}else g.append(y),v=null}return g})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!Q(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;Q(f=c)&&Aa(f)&&!f.isEmpty()&&Q(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(Q(o)||Z(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&Z(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),x=g,y=[g];for(;x!==v;)x.getNextSibling()||Z(140),x=x.getNextSibling(),y.push(x);let C=h;for(let w of y)C=C.insertAfter(w)})(o,c));let p=Mc(i,Aa);l&&Q(p)&&(l.canMergeWhenEmpty()||Aa(d))&&(p.append(...l.getChildren()),l.remove()),Q(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=Q(o)?o.getLastChild():null;Ss(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Ea();return Ko().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Cv(this),n=Mc(this.anchor.getNode(),Aa);Q(n)||Z(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Dl();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,i]=Gv(this),s=this.isBackward(),[l,d]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=s?[i,a]:[a,i];if(n===0)return[];if(n===1){if(Me(o)&&!this.isCollapsed()){let p=o.splitText(c,f),m=c===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(Me(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Me(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(rL(this,t,n,o))return;let r=t==="move",a=Kt(),i=Er(qo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!Q(d)||d.isInline()||d.canBeEmpty()||Xv(s,a,l),this.dirty){let c=zl(a,this.anchor.key),f=zl(a,this.focus.key);this.anchor.type==="text"&&(c=Ps(c)),this.focus.type==="text"&&(f=Ps(f)),c&&f&&Ck(i,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(i,t,n?"backward":"forward",o),i.rangeCount>0){let c=i.getRangeAt(0),f=this.anchor.getNode(),p=to(f)?f:Uk(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),h=[],g=!1;for(let v=0;v<m.length;v++){let x=m[v];Up(x,p)?h.push(x):g=!0}if(g&&h.length>0)if(n){let v=h[0];Q(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];Q(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let x=v.focus,y=v.anchor,C=y.key,w=y.offset,k=y.type;y.set(x.key,x.offset,x.type,!0),x.set(C,w,k,!0)})(this)}}o==="lineboundary"&&rL(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&Q(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(Q(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=Bx(wi(o,t?"previous":"next"));if(a.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(Lr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=wr(l);Nc(this,Si(d,d)),a.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:l,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(As(l)){if(Q(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else s={block:l.origin,type:"merge-next-block"};continue}if(Qt(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=yx();d.add(l.origin.getKey()),Do(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return Nc(this,Si(!l.origin.isEmpty()&&d.isEmpty()?Gl(Zn(d,l.direction)):a.anchor,l)),this.removeText()}}let i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&YT(this,o.getNode()))return}else{let s=i.type==="text"?i.getNode():null;if(r=o.type==="text"?o.getNode():null,s!==null&&s.isSegmented()){let l=i.offset,d=s.getTextContentSize();if(s.is(r)||t&&l!==d||!t&&l!==0)return void JT(s,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(s)||t&&l!==0||!t&&l!==d)return void JT(r,t,l)}(function(l,d){let c=l.anchor,f=l.focus,p=c.getNode(),m=f.getNode();if(p===m&&c.type==="text"&&f.type==="text"){let h=c.offset,g=f.offset,v=h<g,x=v?h:g,y=v?g:h,C=y-1;x!==C&&(function(w){return!(Dk(w)||K$(w))})(p.getTextContent().slice(x,y))&&(d?f.set(f.key,C,f.type):c.set(c.key,C,c.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&to(o.getParent())&&o.getPreviousSibling()===null&&YT(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Wc(e){return e instanceof Fp}function XT(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Gv(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[XT(n),XT(o)]}function YT(e,t){for(let n=t;n;n=n.getParent()){if(Q(n)){if(n.collapseAtStart(e))return!0;if(cr(n))break}if(n.getPreviousSibling())break}return!1}var K$=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function JT(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,i=0,s=0;for(let d=0;d<a;d++){let c=d===a-1;if(s=i,i+=r[d].length,t&&i===n||i>n||c){r.splice(d,1),c&&(s=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(s,s))}function ZT(e,t,n,o){let r,a=t;if(ko(e)){let i=!1,s=e.childNodes,l=s.length,d=o._blockCursorElement;a===l&&(i=!0,a=l-1);let c=s[a],f=!1;if(c===d)c=s[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=El(c),Me(r))a=kr(r,i?"next":"previous");else{let p=El(e);if(p===null)return null;if(Q(p)){let m=o.getElementByKey(p.getKey());m===null&&Z(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),Q(p)||Z(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(Q(g)&&(function(v,x,y){let C=v.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()})(g,0,n)){let v=i?g.getLastDescendant():g.getFirstDescendant();v===null?p=g:(g=v,p=Q(g)?g:g.getParentOrThrow()),a=0}Me(g)?(r=g,p=null,a=kr(g,i?"next":"previous")):g!==p&&i&&!f&&(Q(p)||Z(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Qt(p)&&El(e)===p?m:m+1,p=p.getParentOrThrow()}if(Q(p))return Pr(p.__key,a,"element")}}else r=El(e);return Me(r)?Pr(r.__key,kr(r,a,"clamp"),"text"):null}function eL(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),i=r.getParent();if(t){if((n||!t)&&a===null&&Q(i)&&i.isInline()){let s=i.getPreviousSibling();Me(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else Q(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Me(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&Q(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&Q(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Me(s)&&e.set(s.__key,0,"text")}}}function hk(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);eL(e,o,r),eL(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function vk(e,t,n,o,r,a){if(e===null||n===null||!Gc(r,e,n))return null;let i=ZT(e,t,Ue(a)?a.anchor:null,r);if(i===null)return null;let s=ZT(n,o,Ue(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=El(e),d=El(n);if(Qt(l)&&Qt(d))return null}return hk(i,s),[i,s]}function q$(e){return Q(e)&&!e.isInline()}function xk(e,t,n,o,r,a){let i=Na(),s=new ks(Pr(e,t,r),Pr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function yk(){let e=Pr("root",0,"element"),t=Pr("root",0,"element");return new ks(e,t,0,"")}function yx(){return new Fp(new Set)}function V$(e,t){return Qp(null,e,t,null)}function Qp(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,i=a?a.type:void 0,s=i==="selectionchange",l=!kv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ue(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(s||i===void 0)&&Ue(e)&&!Gc(n,d,c))return e.clone();let m=vk(d,f,c,p,n,e);if(m===null)return null;let[h,g]=m,v=0,x="";if(Ue(e)){let y=e.anchor;if(h.key===y.key)v=e.format,x=e.style;else{let C=h.getNode();Me(C)?(v=C.getFormat(),x=C.getStyle()):Q(C)&&(v=C.getTextFormat(),x=C.getTextStyle())}}return new ks(h,g,v,x)}function St(){return Na()._selection}function Es(){return Kt()._editorState._selection}function Bp(e,t,n,o=1){let r=e.anchor,a=e.focus,i=r.getNode(),s=a.getNode();if(!t.is(i)&&!t.is(s))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let c=Math.max(0,d+o);r.set(l,c,"element"),a.set(l,c,"element"),tL(e)}}else{let d=e.isBackward(),c=d?a:r,f=c.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let h=c.offset;(n<=h&&o>0||n<h&&o<0)&&c.set(l,Math.max(0,h+o),"element")}if(t.is(m)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}tL(e)}function tL(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!Q(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(Q(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(Q(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function zp(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Me(o)?(i=o.getTextContentSize(),s="text"):Q(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Me(r)?s="text":Q(r)&&(s="element")),a!==null&&s!==null?e.set(a,i,s):(i=t.getIndexWithinParent(),i===-1&&(i=n.getChildrenSize()),e.set(n.__key,i,"element"))}function nL(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function Ck(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function oL(e,t,n){let o=zl(e,t.getKey());if(Q(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function W$(e,t,n,o,r,a,i){let s=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(dk)&&f!==a||f!==null&&Tx(f))return;if(!Ue(t))return void(e!==null&&Gc(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=oL(n,h,p.offset),[y,C]=oL(n,g,m.offset),w=t.format,k=t.style,S=t.isCollapsed(),L=v,I=y,T=!1;var E,A,N,R,$;if(p.type==="text"?(L=Ps(v),T=h.getFormat()!==w||h.getStyle()!==k):Ue(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=Ps(y)),L!==null&&I!==null&&(S&&(e===null||T||Ue(e)&&(e.format!==w||e.style!==k))&&(E=w,A=k,N=x,R=p.key,$=performance.now(),nk=[E,A,N,R,$]),d!==x||c!==C||s!==L||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Vv)||a.focus({preventScroll:!0}),p.type==="element"))){if(Ck(o,L,x,I,C),!yi||!t.isCollapsed()||a===null||r.has(Vv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(ck)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let H=Ue(t)&&t.anchor.type==="element"?L.childNodes[x]||null:o.rangeCount>0?o.getRangeAt(0):null;if(H!==null){let K;if(H instanceof Text){let O=document.createRange();O.selectNode(H),K=O.getBoundingClientRect()}else K=H.getBoundingClientRect();(function(O,oe,ee){let W=Rx(ee),qe=Nx(W);if(W===null||qe===null)return;let{top:ve,bottom:fe}=oe,Ne=0,Ae=0,ae=ee;for(;ae!==null;){let Ee=ae===W.body;if(Ee)Ne=0,Ae=qo(O).innerHeight;else{let re=ae.getBoundingClientRect();Ne=re.top,Ae=re.bottom}let xe=0;if(ve<Ne?xe=-(Ne-ve):fe>Ae&&(xe=fe-Ae),xe!==0)if(Ee)qe.scrollBy(0,xe);else{let re=ae.scrollTop;ae.scrollTop+=xe;let Ie=ae.scrollTop-re;ve-=Ie,fe-=Ie}if(Ee)break;ae=Qc(ae)}})(n,K,a)}}Uv=!0}}function G$(e){let t=St()||Es();t===null&&(t=Ko().selectEnd()),t.insertNodes(e)}function j$(){let e=St();return e===null?"":e.getTextContent()}function Cv(e){let t=e;e.isCollapsed()||t.removeText();let n=St();Ue(n)&&(t=n),Ue(t)||Z(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Aa(r);){let i=r;if([r,a]=Q$(r,a),i.is(r))break}return a}function Q$(e,t){let n=e.getParent();if(!n){let r=Ea();return Ko().append(r),r.select(),[Ko(),0]}if(Me(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!Q(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new ks(Pr(e.__key,t,"element"),Pr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function rL(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[c,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(c.key,c.offset,c.type),!0}let a=wi(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!Zk(l)){for(let c of l){d=!1;let{origin:f}=c;if(!Qt(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Bx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Lr(c))c.origin.isInline()||(l=c);else{if(Q(c.origin))continue;Qt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&Qt(l.origin)&&l.origin.isKeyboardSelectable()){let c=yx();return c.add(l.origin.getKey()),Do(c),!0}return l=wr(l),s&&ql(e.anchor,l),ql(e.focus,l),d||!i}var Yn=null,Jn=null,_o=!1,bv=!1,Tp=0,aL={characterData:!0,childList:!0,subtree:!0};function Vl(){return _o||Yn!==null&&Yn._readOnly}function Qn(){_o&&Z(13)}function bk(){Tp>99&&Z(14)}function Na(){return Yn===null&&Z(195,Ik()),Yn}function Kt(){return Jn===null&&Z(196,Ik()),Jn}function Ik(){let e=0,t=new Set,n=bi.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=jc(r);if(Yp(a))e++;else if(a){let i=String(a.constructor.version||"<0.17.1");i===n&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function X$(){return Jn}function iL(e,t,n){let o=t.__type,r=Sx(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let i=a.length;for(let s=0;s<i&&(a[s](t),t.isAttached());s++);}function sL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Sk(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function Y$(e){return Cx(e,Kt()._nodes)}function Cx(e,t){let n=e.type,o=t.get(n);o===void 0&&Z(17,n);let r=o.klass;e.type!==r.getType()&&Z(18,r.name);let a=r.importJSON(e),i=e.children;if(Q(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Cx(i[s],t);a.append(l)}return a}function lL(e,t,n){let o=Yn,r=_o,a=Jn;Yn=t,_o=!0,Jn=e;try{return n()}finally{Yn=o,_o=r,Jn=a}}function Pa(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,i=a._selection,s=n._selection,l=e._dirtyType!==0,d=Yn,c=_o,f=Jn,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Jn=e,Yn=n,_o=!1,e._updating=!0;try{let S=e._dirtyType,L=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),h=h$(a,n,e,S,L,I)}catch(S){if(S instanceof Error&&e._onError(S),bv)throw S;return kk(e,null,o,n),PL(e),e._dirtyType=2,bv=!0,Pa(e,a),void(bv=!1)}finally{m.observe(o,aL),e._updating=p,Yn=d,_o=c,Jn=f}}n._readOnly||(n._readOnly=!0);let g=e._dirtyLeaves,v=e._dirtyElements,x=e._normalizedNodes,y=e._updateTags,C=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(S,L){let I=S._decorators,T=S._pendingDecorators||I,E=L._nodeMap,A;for(A in T)E.has(A)||(T===I&&(T=Nk(S)),delete T[A])})(e,n);let w=r?null:Er(qo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!y.has(uk)){Jn=e,Yn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&Xv(S,e,o),W$(i,s,e,w,y,o)}(function(S,L,I){let T=S._blockCursorElement;if(Ue(I)&&I.isCollapsed()&&I.anchor.type==="element"&&L.contains(document.activeElement)){let E=I.anchor,A=E.getNode(),N=E.offset,R=!1,$=null;if(N===A.getChildrenSize())Sv(A.getChildAtIndex(N-1))&&(R=!0);else{let H=A.getChildAtIndex(N);if(H!==null&&Sv(H)){let K=H.getPreviousSibling();(K===null||Sv(K))&&(R=!0,$=S.getElementByKey(H.__key))}}if(R){let H=S.getElementByKey(A.__key);return T===null&&(S._blockCursorElement=T=(function(K){let O=K.theme,oe=document.createElement("div");oe.contentEditable="false",oe.setAttribute("data-lexical-cursor","true");let ee=O.blockCursor;if(ee!==void 0){if(typeof ee=="string"){let W=Jc(ee);ee=O.blockCursor=W}ee!==void 0&&oe.classList.add(...ee)}return oe})(S._config)),L.style.caretColor="transparent",void($===null?H.appendChild(T):H.insertBefore(T,$))}}T!==null&&Xv(T,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,aL),Jn=f,Yn=d}}h!==null&&(function(S,L,I,T,E){let A=Array.from(S._listeners.mutation),N=A.length;for(let R=0;R<N;R++){let[$,H]=A[R];for(let K of H){let O=L.get(K);O!==void 0&&$(O,{dirtyLeaves:T,prevEditorState:E,updateTags:I})}}})(e,h,y,g,a),Ue(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(ix,void 0);let k=e._pendingDecorators;k!==null&&(e._decorators=k,e._pendingDecorators=null,Ec("decorator",e,!0,k)),(function(S,L,I){let T=fL(L),E=fL(I);T!==E&&Ec("textcontent",S,!0,E)})(e,t||a,n),Ec("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:x,prevEditorState:t||a,tags:y}),(function(S,L){if(S._deferred=[],L.length!==0){let I=S._updating;S._updating=!0;try{for(let T=0;T<L.length;T++)L[T]()}finally{S._updating=I}}})(e,C),(function(S){let L=S._updates;if(L.length!==0){let I=L.shift();if(I){let[T,E]=I;Xp(S,T,E)}}})(e)}function Ec(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let i=0;i<a.length;i++)a[i].apply(null,o)}finally{t._updating=r}}function dL(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,i]=r,s=e._pendingEditorState,l;i!==void 0&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(s===null&&Z(191),s._flushSync=!0),l&&e._deferred.push(l),Sk(e,i.tag)),s==null?Xp(e,a,i):a()}}return o}function Xp(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,Sk(e,n.tag),a=n.skipTransforms||!1,i=n.discrete||!1),r&&e._deferred.push(r);let s=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=wk(l||s),d=!0),l._flushSync=i;let c=Yn,f=_o,p=Jn,m=e._updating;Yn=l,_o=!1,e._updating=!0,Jn=e;let h=e._headless||e.getRootElement()===null;Ix(null);try{d&&(h?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(y,C){let w=y.getEditorState()._selection,k=Er(qo(y));return Ue(w)||w==null?Qp(w,k,y,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=dL(e,a),(function(y,C){let w=C.getEditorState()._selection,k=y._selection;if(Ue(k)){let S=k.anchor,L=k.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,k)),L.type==="text"){let T=L.getNode();I!==T&&T.selectionTransform(w,k)}}})(l,e),e._dirtyType!==0&&(a?(function(y,C){let w=C._dirtyLeaves,k=y._nodeMap;for(let S of w){let L=k.get(S);Me(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&FT(L)}})(l,e):(function(y,C){let w=C._dirtyLeaves,k=C._dirtyElements,S=y._nodeMap,L=hi(),I=new Map,T=w,E=T.size,A=k,N=A.size;for(;E>0||N>0;){if(E>0){C._dirtyLeaves=new Set;for(let R of T){let $=S.get(R);Me($)&&$.isAttached()&&$.isSimpleText()&&!$.isUnmergeable()&&FT($),$!==void 0&&sL($,L)&&iL(C,$,I),w.add(R)}if(T=C._dirtyLeaves,E=T.size,E>0){Tp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let R of A){let $=R[0],H=R[1];if(k.set($,H),!H)continue;let K=S.get($);K!==void 0&&sL(K,L)&&iL(C,K,I)}T=C._dirtyLeaves,E=T.size,A=C._dirtyElements,N=A.size,Tp++}C._dirtyLeaves=w,C._dirtyElements=k})(l,e),dL(e),(function(y,C,w,k){let S=y._nodeMap,L=C._nodeMap,I=[];for(let[T]of k){let E=L.get(T);E!==void 0&&(E.isAttached()||(Q(E)&&TL(E,T,S,L,I,k),S.has(T)||k.delete(T),I.push(T)))}for(let T of I)L.delete(T);for(let T of w){let E=L.get(T);E===void 0||E.isAttached()||(S.has(T)||w.delete(T),L.delete(T))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let x=l._selection;if(Ue(x)){let y=l._nodeMap,C=x.anchor.key,w=x.focus.key;y.get(C)!==void 0&&y.get(w)!==void 0||Z(19)}else Wc(x)&&x._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Pa(e)}finally{Yn=c,_o=f,Jn=p,e._updating=m,Tp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,x){let y=x.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(y))return!0}else if(y!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Pa(e)):d&&iH(()=>{Pa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function na(e,t,n){Jn===e&&n===void 0?t():Xp(e,t,n)}var jv=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&Z(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&Z(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&Z(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(Vp||Vc||qp);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",o.insertBefore(i,a),o.__lexicalLineBreak=i}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=cL(n,o);a.push(r);let i=cL(n,this.element),s=t.getIndexWithinParent();for(let l=0;l<i.length;l++){let d=a[l],c=i[l];if(d===void 0||d<c)break;if(d>c){s+=1;break}}return[t.getParentOrThrow(),s]}};function cL(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&Z(225),n.reverse()}var Ci=class extends dr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return n$[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Kt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Me(n)&&t.push(n),Q(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Q(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;Q(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return Q(a)&&a.getLastDescendant()||a||null}let r=n[t];return Q(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Bn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&Z(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Bn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&Z(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=Wp)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=Lv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=fo[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Kc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Qn();let o=St(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Me(l)||Q(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Me(l)||Q(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ue(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):xk(s,r,s,a,"element","element")}selectStart(){let t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){let t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?Lv[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Op(this)&&Z(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||Z(226,String(t),String(n),String(r));let i=a.__key,s=[],l=[],d=this.getChildAtIndex(t+n),c=null,f=r-n+o.length;if(t!==0)if(t===r)c=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(c=m.getPreviousSibling())}if(n>0){let m=c===null?this.getFirstChild():c.getNextSibling();for(let h=0;h<n;h++){m===null&&Z(100);let g=m.getNextSibling(),v=m.__key;xi(m.getWritable()),l.push(v),m=g}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let h=m.getWritable();h.__parent===i&&f--,xi(h);let g=m.__key;if(p===null)a.__first=g,h.__prev=null;else{let v=p.getWritable();v.__next=g,h.__prev=v.__key}m.__key===i&&Z(76),h.__parent=i,s.push(g),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=St();if(Ue(m)){let h=new Set(l),g=new Set(s),{anchor:v,focus:x}=m;uL(v,h,g)&&zp(v,v.getNode(),this,c,d),uL(x,h,g)&&zp(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||cr(this)||this.remove()}}return a}getDOMSlot(t){return new jv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||cr(this)||this.getChildren().some(Me)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let i=n.getElementByKey(a.getKey());i!==null&&(r==null?(o.insertChild(i),r=i):r!==i&&o.replaceChild(i,r),r=r.nextSibling)}}};function Q(e){return e instanceof Ci}function uL(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Hc=class extends dr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Qt(e){return e instanceof Hc}var Fl=class e extends Ci{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Z(51)}getTextContent(){let t=this.__cachedText;return!Vl()&&Kt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){Z(52)}replace(t){Z(53)}insertBefore(t){Z(54)}insertAfter(t){Z(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)Q(r)||Qt(r)||Z(282);return super.splice(t,n,o)}static importJSON(t){return Ko().updateFromJSON(t)}collapseAtStart(){return!0}};function to(e){return e instanceof Fl}function wk(e){return new Uc(new Map(e._nodeMap))}function bx(){return new Uc(new Map([["root",new Fl]]))}function Tk(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Z(130,n.name),Q(e)){let o=t.children;Array.isArray(o)||Z(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=Tk(r[a]);o.push(i)}}return t}function J$(e){return e instanceof Uc}var Uc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return lL(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return lL(null,this,()=>({root:Tk(Ko())}))}},$p=class extends Ci{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Bl=class e extends Ci{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Nl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:Z$,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Ea().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Me);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Ea();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||Me(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Z$(e){let t=Ea();if(e.style&&(t.setFormat(e.style.textAlign),Gk(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Lv&&t.setFormat(n)}return{node:t}}function Ea(){return Xc(new Bl)}function Lk(e){return e instanceof Bl}var Al=0,eH=1,tH=2,nH=3,oH=4;function kk(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=bx(),e._pendingEditorState=o,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function Pk(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Yc(o),a=o.transform;if(!n.has(a)){n.add(a);let i=o.transform();i&&t.add(i)}if(r){let i=r.$transform;i&&t.add(i),o=r.extends}else{let i=Object.getPrototypeOf(o);o=i.prototype instanceof dr&&i!==dr?i:void 0}}return t}function rH(e){let t=e||{},n=X$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=bx(),s=t.namespace||(r!==null?r._config.namespace:Ok()),l=t.editorState,d=[Fl,Ls,_l,Ol,Bl,$p,...t.nodes||[]],{onError:c,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let g=0;g<d.length;g++){let v=d[g],x=null,y=null;if(typeof v!="function"){let k=v;v=k.replace,x=k.with,y=k.withKlass||null}Yc(v);let C=v.getType(),w=Pk(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:AL(d[g]),transforms:w})}}let h=new bi(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(g,v){let x=new Map,y=new Set,C=w=>{Object.keys(w).forEach(k=>{let S=x.get(k);S===void 0&&(S=[],x.set(k,S)),S.push(w[k])})};return g.forEach(w=>{let k=w.klass.importDOM;if(k==null||y.has(k))return;y.add(k);let S=k.call(w.klass);S!==null&&C(S)}),v&&C(v),x})(m,f?f.import:void 0),p,e);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=2),(function(g){g.registerCommand(sx,L$,Al),g.registerCommand(lx,k$,Al),g.registerCommand(dx,P$,Al),g.registerCommand(cx,A$,Al),g.registerCommand(mx,E$,Al)})(h),h}var bi=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,n,o,r,a,i,s,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ok(),this._onError=a,this._htmlConversions=i,this._editable=s,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&Z(35);let r=this._commands;r.has(t)||r.set(t,[new Set,new Set,new Set,new Set,new Set]);let a=r.get(t);a===void 0&&Z(36,String(t));let i=a[o];return i.add(n),()=>{i.delete(n),a.every(s=>s.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,i=a.get(n);i===void 0&&(i=new Set,a.set(n,i)),i.add(r);let s=o&&o.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(n,r),()=>{i.delete(r),i.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&Z(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=Jv(o).get(n.getType());if(!r)return;let a=new Map;for(let i of r.keys())a.set(i,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let i=this.registerNodeTransformToKlass(a,n);r.push(i)}return(function(i,s){let l=Jv(i.getEditorState()),d=[];for(let c of s){let f=l.get(c);f&&d.push(f)}d.length!==0&&i.update(()=>{for(let c of d)for(let f of c.keys()){let p=Bn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:wp}:void 0)})(this,r.map(i=>i.klass.getType())),()=>{r.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Ce(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Nl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,kk(this,n,t,r),n!==null&&(this._config.disableEvents||M$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Nx(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,PL(this),this._updateTags.add(wp),Pa(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Hv.set(s,d);let c=_p.get(d)??0;c<1&&d.addEventListener("selectionchange",sk),_p.set(d,c+1),s.__lexicalEditor=l;let f=ik(s);for(let p=0;p<$v.length;p++){let[m,h]=$v[p],g=typeof h=="function"?v=>{qT(v)||(KT(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(qT(v))return;KT(v);let x=l.isEditable();switch(m){case"cut":return x&&Ce(l,hx,v);case"copy":return Ce(l,gx,v);case"paste":return x&&Ce(l,ux,v);case"dragstart":return x&&Ce(l,jL,v);case"dragover":return x&&Ce(l,QL,v);case"dragend":return x&&Ce(l,XL,v);case"focus":return x&&Ce(l,YL,v);case"blur":return x&&Ce(l,JL,v);case"drop":return x&&Ce(l,GL,v)}};s.addEventListener(m,g),f.push(()=>{s.removeEventListener(m,g)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(wp),Pa(this);Ec("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&Z(38);let o=t;o._readOnly&&(o=wk(t),o._selection=t._selection?t._selection.clone():null),kL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Pa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Pa(this)}parseEditorState(t,n){return(function(o,r,a){let i=bx(),s=Yn,l=_o,d=Jn,c=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Yn=i,_o=!1,Jn=r,Ix(null);try{let h=r._nodes;Cx(o.root,h),a&&a(),i._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Yn=s,_o=l,Jn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Pa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Xp(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),na(this,()=>{let r=St(),a=Ko();r!==null?r.dirty||Do(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),em("focus"),Hk(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Er(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Ec("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};bi.version="0.41.0+prod.esm";var Qv=null;function Ix(e){Qv=e}var Ak=1;function aH(){Ak=1}function Sx(e,t){let n=wx(e,t);return n===void 0&&Z(30,t),n}function wx(e,t){return e._nodes.get(t)}var iH=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function Ek(e){return Qt(Zp(e))}function Tx(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return Qt(Zp(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&jc(t)==null)}function Gc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Tx(t)&&Lx(t)===e}catch{return!1}}function Yp(e){return e instanceof bi}function Lx(e){let t=e;for(;t!=null;){let n=jc(t);if(Yp(n))return n;t=Qc(t)}return null}function jc(e){return e?e.__lexicalEditor:null}function sH(e){return Z5.test(e)?"rtl":e$.test(e)?"ltr":null}function vi(e){return xx(e)||e.isToken()}function ka(e){return vi(e)||e.isSegmented()}function oa(e){return Wl(e)&&e.nodeType===3}function Mk(e){return Wl(e)&&e.nodeType===9}function Ps(e){let t=e;for(;t!=null;){if(oa(t))return t;t=t.firstChild}return null}function Kc(e,t,n){let o=fo[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~fo.superscript:t==="superscript"?r&=~fo.subscript:t==="lowercase"?(r&=~fo.uppercase,r&=~fo.capitalize):t==="uppercase"?(r&=~fo.lowercase,r&=~fo.capitalize):t==="capitalize"&&(r&=~fo.lowercase,r&=~fo.uppercase),r}function lH(e){return Me(e)||Ss(e)||Qt(e)}function Rk(e,t){let n=(function(){let i=Qv;return Qv=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Qn(),bk();let o=Kt(),r=Na(),a=""+Ak++;r._nodeMap.set(a,e),Q(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function xi(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),i=a!==null?a.__key:null,s=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=i),a===null&&(o.__last=s),l!==null&&(l.__next=i),d!==null&&(d.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Hp(e){bk(),Op(e)&&Z(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Na(),r=Kt(),a=o._nodeMap,i=r._dirtyElements;n!==null&&(function(l,d,c){let f=l;for(;f!==null;){if(c.has(f))return;let p=d.get(f);if(p===void 0)break;c.set(f,!1),f=p.__parent}})(n,a,i);let s=t.__key;r._dirtyType=1,Q(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Xn(e){Qn();let t=Kt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Bn(n);o!==null&&o.getWritable()}if(e!==null){let o=Bn(e);o!==null&&o.getWritable()}}}function hi(){return Vl()?null:Kt()._compositionKey}function Bn(e,t){let n=(t||Na())._nodeMap.get(e);return n===void 0?null:n}function kx(e,t){let n=Jp(e,Kt());return n!==void 0?Bn(n,t):null}function Jp(e,t){return e[`__lexicalKey_${t._key}`]}function Zp(e,t){let n=e;for(;n!=null;){let o=kx(n,t);if(o!==null)return o;n=Qc(n)}return null}function Nk(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function fL(e){return e.read(()=>Ko().getTextContent())}function Ko(){return _k(Na())}function _k(e){return e._nodeMap.get("root")}function Do(e){Qn();let t=Na();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function El(e){let t=Kt(),n=(function(o,r){let a=o;for(;a!=null;){let i=Jp(a,r);if(i!==void 0)return i;a=Qc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Bn("root"):null:Bn(n)}function Dk(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Px(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function Ok(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Fk(e){return oa(e)?e.nodeValue:null}function Ax(e,t,n){let o=Er(qo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=Fk(r),l=Zp(r);if(s!==null&&Me(l)){if((s===_c||s===ox)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Ex(l,s,a,i,e)}}}function Ex(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let i=a.isComposing(),s=t;if((i||r)&&(t.endsWith(_c)&&(s=t.slice(0,-_c.length)),r)){let d=ox,c;for(;(c=s.indexOf(d))!==-1;)s=s.slice(0,c)+s.slice(c+d.length),n!==null&&n>c&&(n=Math.max(c,n-d.length)),o!==null&&o>c&&(o=Math.max(c,o-d.length))}let l=a.getTextContent();if(r||s!==l){if(s===""){if(Xn(null),qp||Vc||Vp)a.remove();else{let g=Kt();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Es(),f=a.getTextContentSize(),p=hi(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ue(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!i||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!i))return void a.markDirty();let h=St();if(!Ue(h)||n===null||o===null)return void pL(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=jn(a.getTextContent());a.replace(g),a=g}pL(a,s,h)}}}function pL(e,t,n){if(e.setTextContent(t),Ue(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=kr(e,a.offset,"clamp"))}}}function xp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function Bk(e,t){return xp(e,t,"altKey")&&xp(e,t,"ctrlKey")&&xp(e,t,"shiftKey")&&xp(e,t,"metaKey")}function Pt(e,t,n){if(!Bk(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var La={ctrlKey:!Sr,metaKey:Sr},mL={altKey:Sr,ctrlKey:!Sr};function gL(e){return e.key==="Backspace"}function hL(e){return Pt(e,"a",La)}function dH(e){let t=Ko();if(Ue(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Pp(e),e}{let n=t.select(0,t.getChildrenSize());return Do(Pp(n)),n}}function Nl(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=Jc(r);return n[t]=a,a}return r}function Mx(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&Z(33,a);let l=s.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(i),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(i,f?"updated":r)}function cH(e){let t=e.getType(),n=Na();if(n._readOnly){let a=Jv(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function vL(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function zk(e,t){let n=e.offset;if(e.type==="element")return vL(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?vL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function $k(e){let t=qo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Ce(e,t,n){return(function(o,r,a){let i=Px(o);for(let s=4;s>=0;s--)for(let l=0;l<i.length;l++){let d=i[l],c=d._commands.get(r);if(c!==void 0){let f=c[s];if(f!==void 0){let p=Array.from(f),m=p.length,h=!1;if(na(d,()=>{for(let g=0;g<m;g++)if(p[g](a,o))return void(h=!0)}),h)return h}}}return!1})(e,t,n)}function zl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&Z(75,t),n}function Qc(e){let t=e.assignedSlot||e.parentElement;return Vk(t)?t.host:t}function Rx(e){return Mk(e)?e:ko(e)?e.ownerDocument:null}function uH(e){return Kt()._updateTags.has(e)}function em(e){Qn(),Kt()._updateTags.add(e)}function Hk(e){Qn(),Kt()._deferred.push(e)}function Up(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Nx(e){let t=Rx(e);return t?t.defaultView:null}function qo(e){let t=e._window;return t===null&&Z(78),t}function fH(e){return Q(e)&&e.isInline()||Qt(e)&&e.isInline()}function Uk(e){let t=e.getParentOrThrow();for(;t!==null;){if(cr(t))return t;t=t.getParentOrThrow()}return t}function cr(e){return to(e)||Q(e)&&e.isShadowRoot()}function _x(e){let t=e.constructor.clone(e);return Rk(t,null),t.afterCloneFrom(e),t}function Xc(e){let t=Kt(),n=e.getType(),o=wx(t,n);o===void 0&&Z(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let i=r(e),s=i.constructor;return a!==null?i instanceof a||Z(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||Z(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&Z(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Iv(e,t){!to(e.getParent())||Q(t)||Qt(t)||Z(99)}function Kk(e){let t=Bn(e);return t===null&&Z(63,e),t}function Sv(e){return(Qt(e)||Q(e)&&!e.canBeEmpty())&&!e.isInline()}function Xv(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Er(e){return Ar?(e||window).getSelection():null}function qk(e){let t=Nx(e);return t?t.getSelection():null}function pH(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),cr(e)&&Z(102);let o=i=>{let s=i.getParentOrThrow(),l=cr(s),d=i!==n||l?_x(i):i;if(l)return Q(i)&&Q(d)||Z(133),i.insertAfter(d),[i,d,d];{let[c,f,p]=o(s),m=i.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function mH(e){return ko(e)&&e.tagName==="A"}function ko(e){return Wl(e)&&e.nodeType===1}function Wl(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function Vk(e){return Wl(e)&&e.nodeType===11}function Wk(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return e.nodeName.match(t)!==null}function Yv(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return e.nodeName.match(t)!==null}function Aa(e){if(Qt(e)&&!e.isInline())return!0;if(!Q(e)||cr(e))return!1;let t=e.getFirstChild(),n=t===null||Ss(t)||Me(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Dx(){return Kt()}var xL=new WeakMap,gH=new Map;function Jv(e){if(!e._readOnly&&e.isEmpty())return gH;e._readOnly||Z(192);let t=xL.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let i=a.__type,s=o.get(i);s||(s=new Map,o.set(i,s)),s.set(r,a)}return o})(e),xL.set(e,t)),t}function Ox(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function hH(e){return(t=Ox(e))[lk]=!0,t;var t}function Gk(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function vH(e){e.__lexicalUnmanaged=!0}function jk(e){return e.__lexicalUnmanaged===!0}function Lc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==dr[t]}function Yc(e){let t=ET in e.prototype?e.prototype[ET]():void 0,n=(function(i){if(!(i===dr||i.prototype instanceof dr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{bi.version&&(l=JSON.parse(bi.version))}catch{}Z(290,i.name,s,l)}return i===Hc||i===Ci||i===dr})(e),o=!n&&Lc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[i,s]of Object.entries(t))a=i,r=s;if(!n&&a&&(Lc(e,"getType")||(e.getType=()=>a),Lc(e,"clone")||(e.clone=i=>(Ix(i),new e)),Lc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Lc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function xH(e){let t=Dx();return Qn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Mc=(e,t)=>{let n=e;for(;n!=null&&!to(n);){if(t(n))return n;n=n.getParent()}return null},yH={next:"previous",previous:"next"},$l=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return zx({hasNext:As,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Zn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Zn(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,i=this.getParentAtCaret(),s=new Map;for(let l=a.getAdjacentCaret();l!==null&&s.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();s.set(d.getKey(),d)}for(let l of r){if(s.size>0){let d=a.getNodeAtCaret();if(d){if(s.delete(d.getKey()),s.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(i)&&l.remove(),d.replace(l)}}else d===null&&Z(263,Array.from(s).join(" "))}else a.insert(l);a=Zn(l,this.direction)}for(let l of s.values())l.remove();return this}},qc=class e extends $l{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ra(t,this.direction)}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Li(this.direction);return Zn(this.getNodeAtCaret(),t)||Ra(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}},CH={root:to,shadowRoot:cr};function Li(e){return yH[e]}function Fx(e,t="root"){return CH[t](e)?null:e}var Hl=class e extends $l{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Zn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Q(this.origin)?Ra(this.origin,this.direction):null}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Li(this.direction);return Zn(this.getNodeAtCaret(),t)||Ra(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Ul)&&this.direction===t.direction&&this.origin.is(t.origin)}},Ul=class e extends $l{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ii(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ii(this.origin,Li(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Hl||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Zn(this.origin,this.direction)}};function Ma(e){return e instanceof Ul}function bH(e){return e instanceof $l}function As(e){return e instanceof Hl}function Lr(e){return e instanceof qc}var IH={next:class extends Ul{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ul{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},SH={next:class extends Hl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Hl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},wH={next:class extends qc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends qc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Zn(e,t){return e?new SH[t](e):null}function Ii(e,t,n){return e?new IH[t](e,kr(e,n)):null}function kr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&bL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function Zv(e,t){return new Kp(e,t)}function Ra(e,t){return Q(e)?new wH[t](e):null}function Qk(e){return e&&e.getChildCaret()||e}function Kl(e){return e&&Qk(e.getAdjacentCaret())}var ex=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Ma(a)?(function(i,s){let{direction:l,origin:d}=i,c=kr(d,s==="focus"?Li(l):l);return Zv(i,c-i.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[Zv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=Ma(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Ma(o),a=i=>i.isSameNodeCaret(o)?null:Kl(i)||i.getParentCaret(t);return zx({hasNext:i=>i!==null&&!(r&&o.isSameNodeCaret(i)),initial:n.isSameNodeCaret(o)?null:a(n),map:i=>i,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Kp=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return Ii(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function TH(e){return e instanceof Kp}function Bx(e){return Si(e,Zn(Ko(),e.direction))}function Xk(e){return Si(e,e)}function Si(e,t){return e.direction!==t.direction&&Z(265),new ex(e,t,e.direction)}function zx(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let i={done:!1,value:r(a)};return a=o(a),i}}}function $x(e,t){let n=Rc(e.origin,t.origin);switch(n===null&&Z(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,i){return Math.sign(a-i)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Hx(n)}}function Hx(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,i=n;for(;a&&i;a=a.getNextSibling(),i=i.getNextSibling()){if(a.__key===r)return-1;if(i.__key===o)return 1}return a===null?1:-1}function yp(e,t){return t.is(e)}function yL(e){return Q(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Rc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=yL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=yL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(yp(e,o)||Z(276),{commonAncestor:o,type:"ancestor"}):r===null?(yp(t,o)||Z(277),{commonAncestor:o,type:"descendant"}):((Q(a)||yp(e,a))&&(Q(r)||yp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||Z(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function wi(e,t){let{type:n,key:o,offset:r}=e,a=Kk(e.key);return n==="text"?(Me(a)||Z(266,a.getType(),o),Ii(a,t,r)):(Q(a)||Z(267,a.getType(),o),eP(a,e.offset,t))}function ql(e,t){let{origin:n,direction:o}=t,r=o==="next";Ma(t)?e.set(n.getKey(),t.offset,"text"):As(t)?Me(n)?e.set(n.getKey(),kr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Lr(t)&&Q(n)||Z(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function Yk(e){let t=St(),n=Ue(t)?t:yk();return Nc(n,e),Do(n),n}function Nc(e,t){ql(e.anchor,t.anchor),ql(e.focus,t.focus)}function tx(e){let{anchor:t,focus:n}=e,o=wi(t,"next"),r=wi(n,"next"),a=$x(o,r)<=0?"next":"previous";return Si(Ti(o,a),Ti(r,a))}function Gl(e){let{direction:t,origin:n}=e,o=Zn(n,Li(t)).getNodeAtCaret();return o?Zn(o,t):Ra(n.getParentOrThrow(),t)}function CL(e,t="root"){let n=[e];for(let o=Lr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Gl(o));return n}function wv(e){return!!e&&e.origin.isAttached()}function Jk(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Ux(e,o),i=CL(a.anchor,n),s=CL(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(Lr(h))l.add(h.origin.getKey());else if(As(h)){let{origin:g}=h;Q(g)&&!l.has(g.getKey())||d.push(g)}for(let h of d)h.remove();for(let h of a.getTextSlices()){if(!h)continue;let{origin:g}=h.caret,v=g.getTextContentSize(),x=Gl(Zn(g,o)),y=g.getMode();if(Math.abs(h.distance)===v&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)x.remove();else if(h.distance!==0){r="removeEmptySlices";let C=h.removeTextSlice(),w=h.caret.origin;if(y==="segmented"){let k=C.origin,S=jn(k.getTextContent()).setStyle(k.getStyle()).setFormat(k.getFormat());x.replaceOrInsert(S),C=Ii(S,o,C.offset)}w.is(i[0].origin)&&(i[0]=C),w.is(s[0].origin)&&(s[0]=C.getFlipped())}}let c,f;for(let h of i)if(wv(h)){c=wr(h);break}for(let h of s)if(wv(h)){f=wr(h);break}let p=(function(h,g,v){if(!h||!g)return null;let x=h.getParentAtCaret(),y=g.getParentAtCaret();if(!x||!y)return null;let C=x.getParents().reverse();C.push(x);let w=y.getParents().reverse();w.push(y);let k=Math.min(C.length,w.length),S;for(S=0;S<k&&C[S]===w[S];S++);let L=(E,A)=>{let N;for(let R=S;R<E.length;R++){let $=E[R];if(cr($))return;!N&&A($)&&(N=$)}return N},I=L(C,Aa),T=I&&L(w,E=>v.has(E.getKey())&&Aa(E));return I&&T?[I,T]:null})(c,f,l);if(p){let[h,g]=p;Ra(h,"previous").splice(0,g.getChildren());let v=g.getParent();for(g.remove(!0);v&&v.isEmpty();){let x=v;v=v.getParent(),x.remove(!0)}}let m=[c,f,...i,...s].find(wv);if(m)return Xk(Ti(wr(m),e.direction));Z(269,JSON.stringify(i.map(h=>h.origin.__key)))}function wr(e){let t=(function(r){let a=r;for(;Lr(a);){let i=Kl(a);if(!Lr(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Me(t.origin))return Ma(t)?t:Ii(t.origin,n,n);let o=t.getAdjacentCaret();return As(o)&&Me(o.origin)?Ii(o.origin,n,Li(n)):t}function Zk(e){return Ma(e)&&e.offset!==kr(e.origin,e.direction)}function Ti(e,t){return e.direction===t?e:e.getFlipped()}function Ux(e,t){return e.direction===t?e:Si(Ti(e.focus,t),Ti(e.anchor,t))}function eP(e,t,n){let o=Ra(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Ti(o,n)}function LH(e,t="root"){let n=0,o=e,r=Kl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Kl(o)}return r&&[r,n]}function kH(e){let{origin:t,offset:n,direction:o}=e;if(n===kr(t,o))return e.getSiblingCaret();if(n===kr(t,Li(o)))return Gl(e.getSiblingCaret());let[r]=t.splitText(n);return Me(r)||Z(281),Ti(Zn(r,"next"),o)}function PH(e,t){return!0}function AH(e,{$copyElementNode:t=_x,$splitTextPointCaretNext:n=kH,rootMode:o="shadowRoot",$shouldSplit:r=PH}={}){if(Ma(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Lr(e)&&(!i.canBeEmpty()||!r(i,"first")))return Gl(a);let s=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(s.length>0||i.canBeEmpty()&&r(i,"last"))&&a.insert(t(i).splice(0,0,s))}return a}function EH(e){return e}function MH(...e){return e}function RH(e,t){return[e,t]}function NH(e){return e}function _H(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Jc(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function DH(e,...t){let n=Jc(...t);n.length>0&&e.classList.add(...n)}function OH(e,...t){let n=Jc(...t);n.length>0&&e.classList.remove(...n)}function FH(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Kx,Jte=M.$addUpdateTag,tm=M.$applyNodeReplacement,jl=M.$caretFromPoint,tP=M.$caretRangeFromSelection,nm=M.$cloneWithProperties,nP=M.$cloneWithPropertiesEphemeral,Zte=M.$comparePointCaretNext,ene=M.$copyNode,oP=M.$create,Ms=M.$createLineBreakNode,rP=M.$createNodeSelection,ur=M.$createParagraphNode,tne=M.$createPoint,Rs=M.$createRangeSelection,aP=M.$createRangeSelectionFromDom,iP=M.$createTabNode,Mr=M.$createTextNode,sP=M.$extendCaretToRange,_a=M.$findMatchingParent,qx=M.$getAdjacentChildCaret,nne=M.$getAdjacentNode,Ns=M.$getAdjacentSiblingOrParentSiblingCaret,Vx=M.$getCaretInDirection,lP=M.$getCaretRange,one=M.$getCaretRangeInDirection,dP=M.$getCharacterOffsets,ki=M.$getChildCaret,rne=M.$getChildCaretAtIndex,Wx=M.$getChildCaretOrSelf,cP=M.$getCollapsedCaretRange,ane=M.$getCommonAncestor,ine=M.$getCommonAncestorResultBranchOrder,om=M.$getEditor,sne=M.$getNearestNodeFromDOMNode,lne=M.$getNearestRootOrShadowRoot,rm=M.$getNodeByKey,dne=M.$getNodeByKeyOrThrow,uP=M.$getNodeFromDOMNode,Zc=M.$getPreviousSelection,Ct=M.$getRoot,Oe=M.$getSelection,Da=M.$getSiblingCaret,am=M.$getState,cne=M.$getStateChange,une=M.$getTextContent,fne=M.$getTextNodeOffset,pne=M.$getTextPointCaret,mne=M.$getTextPointCaretSlice,gne=M.$getWritableNodeState,fP=M.$hasAncestor,hne=M.$hasUpdateTag,vne=M.$insertNodes,Ql=M.$isBlockElementNode,eu=M.$isChildCaret,im=M.$isDecoratorNode,pP=M.$isEditorState,Ke=M.$isElementNode,mP=M.$isExtendableTextPointCaret,xne=M.$isInlineElementOrDecoratorNode,gP=M.$isLeafNode,Xl=M.$isLineBreakNode,yne=M.$isNodeCaret,Gx=M.$isNodeSelection,hP=M.$isParagraphNode,we=M.$isRangeSelection,tu=M.$isRootNode,_s=M.$isRootOrShadowRoot,vP=M.$isSiblingCaret,Cne=M.$isTabNode,tt=M.$isTextNode,sm=M.$isTextPointCaret,bne=M.$isTextPointCaretSlice,jx=M.$isTokenOrSegmented,Ine=M.$isTokenOrTab,Sne=M.$nodesOfType,xP=M.$normalizeCaret,yP=M.$normalizeSelection__EXPERIMENTAL,wne=M.$onUpdate,CP=M.$parseSerializedNode,Tne=M.$removeTextFromCaretRange,bP=M.$rewindSiblingCaret,lm=M.$selectAll,Lne=M.$setCompositionKey,kne=M.$setPointFromCaret,Rr=M.$setSelection,IP=M.$setSelectionFromCaretRange,dm=M.$setState,SP=M.$splitAtPointCaretNext,wP=M.$splitNode,Pne=M.$updateRangeSelectionFromCaretRange,Qx=M.ArtificialNode__DO_NOT_USE,Ane=M.BEFORE_INPUT_COMMAND,TP=M.BLUR_COMMAND,nu=M.CAN_REDO_COMMAND,ou=M.CAN_UNDO_COMMAND,cm=M.CLEAR_EDITOR_COMMAND,LP=M.CLEAR_HISTORY_COMMAND,kP=M.CLICK_COMMAND,Ene=M.COLLABORATION_TAG,um=M.COMMAND_PRIORITY_CRITICAL,Xt=M.COMMAND_PRIORITY_EDITOR,Nr=M.COMMAND_PRIORITY_HIGH,Yl=M.COMMAND_PRIORITY_LOW,Mne=M.COMMAND_PRIORITY_NORMAL,Rne=M.COMPOSITION_END_COMMAND,PP=M.COMPOSITION_END_TAG,Nne=M.COMPOSITION_START_COMMAND,AP=M.COMPOSITION_START_TAG,EP=M.CONTROLLED_TEXT_INSERTION_COMMAND,fm=M.COPY_COMMAND,MP=M.CUT_COMMAND,pm=M.DELETE_CHARACTER_COMMAND,RP=M.DELETE_LINE_COMMAND,NP=M.DELETE_WORD_COMMAND,_ne=M.DRAGEND_COMMAND,Dne=M.DRAGOVER_COMMAND,_P=M.DRAGSTART_COMMAND,DP=M.DROP_COMMAND,Oa=M.DecoratorNode,One=M.ElementNode,OP=M.FOCUS_COMMAND,Fne=M.FORMAT_ELEMENT_COMMAND,FP=M.FORMAT_TEXT_COMMAND,mm=M.HISTORIC_TAG,_r=M.HISTORY_MERGE_TAG,BP=M.HISTORY_PUSH_TAG,Xx=M.INDENT_CONTENT_COMMAND,Bne=M.INPUT_COMMAND,Yx=M.INSERT_LINE_BREAK_COMMAND,zP=M.INSERT_PARAGRAPH_COMMAND,$P=M.INSERT_TAB_COMMAND,ru=M.INTERNAL_$isBlock,zne=M.IS_ALL_FORMATTING,$ne=M.IS_BOLD,Hne=M.IS_CODE,Une=M.IS_HIGHLIGHT,Kne=M.IS_ITALIC,qne=M.IS_STRIKETHROUGH,Vne=M.IS_SUBSCRIPT,Wne=M.IS_SUPERSCRIPT,Gne=M.IS_UNDERLINE,HP=M.KEY_ARROW_DOWN_COMMAND,gm=M.KEY_ARROW_LEFT_COMMAND,hm=M.KEY_ARROW_RIGHT_COMMAND,UP=M.KEY_ARROW_UP_COMMAND,vm=M.KEY_BACKSPACE_COMMAND,KP=M.KEY_DELETE_COMMAND,qP=M.KEY_DOWN_COMMAND,xm=M.KEY_ENTER_COMMAND,jne=M.KEY_ESCAPE_COMMAND,Qne=M.KEY_MODIFIER_COMMAND,Xne=M.KEY_SPACE_COMMAND,ym=M.KEY_TAB_COMMAND,VP=M.LineBreakNode,Yne=M.MOVE_TO_END,Jne=M.MOVE_TO_START,Zne=M.NODE_STATE_KEY,WP=M.OUTDENT_CONTENT_COMMAND,Cm=M.PASTE_COMMAND,GP=M.PASTE_TAG,jP=M.ParagraphNode,QP=M.REDO_COMMAND,XP=M.REMOVE_TEXT_COMMAND,YP=M.RootNode,eoe=M.SELECTION_CHANGE_COMMAND,JP=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,ZP=M.SELECT_ALL_COMMAND,toe=M.SKIP_COLLAB_TAG,noe=M.SKIP_DOM_SELECTION_TAG,ooe=M.SKIP_SCROLL_INTO_VIEW_TAG,roe=M.SKIP_SELECTION_FOCUS_TAG,eA=M.TEXT_TYPE_TO_FORMAT,tA=M.TabNode,bm=M.TextNode,nA=M.UNDO_COMMAND,au=M.addClassNamesToElement,aoe=M.buildImportMap,Im=M.configExtension,oA=M.createCommand,Sm=M.createEditor,ioe=M.createSharedNodeState,rA=M.createState,aA=M.declarePeerDependency,Mn=M.defineExtension,soe=M.flipDirection,loe=M.getDOMOwnerDocument,Jx=M.getDOMSelection,doe=M.getDOMSelectionFromTarget,iA=M.getDOMTextNode,coe=M.getEditorPropertyFromDOMNode,uoe=M.getNearestEditorFromDOMNode,sA=M.getRegisteredNode,foe=M.getRegisteredNodeOrThrow,poe=M.getStaticNodeConfig,moe=M.getTextDirection,goe=M.getTransformSetFromKlass,lA=M.isBlockDomNode,hoe=M.isCurrentlyReadOnlyMode,dA=M.isDOMDocumentNode,cA=M.isDOMNode,voe=M.isDOMTextNode,xoe=M.isDOMUnmanaged,Zx=M.isDocumentFragment,yoe=M.isExactShortcutMatch,uA=M.isHTMLAnchorElement,wm=M.isHTMLElement,iu=M.isInlineDomNode,Coe=M.isLexicalEditor,boe=M.isModifierMatch,Ioe=M.isSelectionCapturedInDecoratorInput,fA=M.isSelectionWithinEditor,ey=M.makeStepwiseIterator,ra=M.mergeRegister,Soe=M.normalizeClassNames,Tm=M.removeClassNamesFromElement,woe=M.removeFromParent,Toe=M.resetRandomKey,Dr=M.safeCast,Loe=M.setDOMUnmanaged,koe=M.setNodeIndentFromDOM,Lm=M.shallowMergeConfig,ty=M.toggleTextFormatType;var ny={};An(ny,{LexicalComposer:()=>zH});me();var pA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,BH=pA?ye:q,km={tag:_r};function zH({initialConfig:e,children:t}){let n=z(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=AT(null,o),c=Sm({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>i(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=Ct();if(m.isEmpty()){let h=ur();m.append(h);let g=pA?document.activeElement:null;(Oe()!==null||g!==null&&g===f.getRootElement())&&h.select()}},km);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,km);break}case"object":f.setEditorState(p,km);break;case"function":f.update(()=>{Ct().isEmpty()&&p(f)},km)}}})(c,s),[c,d]},[]);return BH(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(PT.Provider,{value:n,children:t})}var $H=ny,mA=$H.LexicalComposer;var ry={};An(ry,{$canShowPlaceholder:()=>hA,$canShowPlaceholderCurry:()=>UH,$findTextIntersectionFromCharacters:()=>KH,$isRootTextContentEmpty:()=>oy,$isRootTextContentEmptyCurry:()=>HH,$rootTextContent:()=>gA,registerLexicalTextEntity:()=>VH});function gA(){return Ct().getTextContent()}function oy(e,t=!0){if(e)return!1;let n=gA();return t&&(n=n.trim()),n===""}function HH(e,t){return()=>oy(e,t)}function hA(e){if(!oy(e,!1))return!1;let t=Ct().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(im(r))return!1;if(Ke(r)){if(!hP(r)||r.__indent!==0)return!1;let a=r.getChildren(),i=a.length;for(let s=0;s<i;s++){let l=a[o];if(!tt(l))return!1}}}return!0}function UH(e){return()=>hA(e)}function KH(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(Ke(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(tt(n)){let i=n.getTextContentSize();if(o+i>t)return{node:n,offset:t-o};o+=i}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let i=a.getNextSibling();if(i!==null){n=i;continue e}a=a.getParent()}break}return null}function qH(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function VH(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Mr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(bm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(tt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(h=>h.getLatest().__mode)(l)!==0)return void a(l);{let h=m.end-p.length;if(h>0){let g=p+d.slice(0,h);if(l.select(),l.setTextContent(g),h===d.length)i.remove();else{let v=d.slice(h);i.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){s=t(d);let p,m=s===null?"":d.slice(s.end);if(d=m,m===""){let g=c.getNextSibling();if(tt(g)){m=c.getTextContent()+g.getTextContent();let v=t(m);if(v===null)return void(r(g)?a(g):g.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&tt(l)&&l.isTextEntity()){f+=s.end;continue}s.start===0?[p,c]=c.splitText(s.end):[,p,c]=c.splitText(s.start+f,s.end+f),p===void 0&&qH(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),c==null)return;f=0,l=h}}),e.registerNodeTransform(n,i=>{let s=i.getTextContent(),l=t(s);if(l===null||l.start!==0)return void a(i);if(s.length>l.end)return void i.splitText(l.end);let d=i.getPreviousSibling();tt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();tt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Ds=ry,Doe=Ds.$canShowPlaceholder,Pm=Ds.$canShowPlaceholderCurry,Ooe=Ds.$findTextIntersectionFromCharacters,Foe=Ds.$isRootTextContentEmpty,Boe=Ds.$isRootTextContentEmptyCurry,zoe=Ds.$rootTextContent,$oe=Ds.registerLexicalTextEntity;var cy={};An(cy,{$addNodeStyle:()=>YH,$cloneWithProperties:()=>nm,$copyBlockFormatIndent:()=>TA,$ensureForwardRangeSelection:()=>wA,$forEachSelectedTextNode:()=>SA,$getComputedStyleForElement:()=>sy,$getComputedStyleForParent:()=>ly,$getSelectionStyleValueForProperty:()=>aU,$isAtNodeEnd:()=>XH,$isParentElementRTL:()=>dy,$isParentRTL:()=>jH,$moveCaretSelection:()=>PA,$moveCharacter:()=>oU,$patchStyleText:()=>JH,$selectAll:()=>lm,$setBlocksType:()=>ZH,$shouldOverrideDefaultCharacterSelection:()=>nU,$sliceSelectedTextNodeContent:()=>QH,$trimTextContentFromAnchor:()=>IA,$wrapNodes:()=>tU,createDOMRange:()=>WH,createRectsFromDOMRange:()=>GH,getCSSFromStyleObject:()=>bA,getStyleObjectFromCSS:()=>Mm,trimTextContentFromAnchor:()=>iU});function iy(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Em=new Map;function vA(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function xA(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function WH(e,t,n,o,r){let a=t.getKey(),i=o.getKey(),s=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(i),c=n,f=r;if(tt(t)&&(l=vA(l)),tt(o)&&(d=vA(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=xA(l)),d.nodeName==="BR"&&([d,f]=xA(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{s.setStart(l,c),s.setEnd(d,f)}catch{return null}return!s.collapsed||c===f&&a===i||(s.setStart(d,f),s.setEnd(l,c)),s}function GH(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(t.getClientRects()),s,l=i.length;i.sort((d,c)=>{let f=d.top-c.top;return Math.abs(f)<=3?d.left-c.left:f});for(let d=0;d<l;d++){let c=i[d],f=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,p=c.width+a===o.width;f||p?(i.splice(d--,1),l--):s=c}return i}function CA(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Mm(e){let t=Em.get(e);return t===void 0&&(t=CA(e),Em.set(e,t)),t}function bA(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function sy(e){let t=om().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function ly(e){return sy(tu(e)?e:e.getParentOrThrow())}function jH(e){let t=ly(e);return t!==null&&t.direction==="rtl"}function QH(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!jx(t)&&o!==null){let[r,a]=o,i=e.isBackward(),s=r.getNode(),l=a.getNode(),d=t.is(s),c=t.is(l);if(d||c){let[f,p]=dP(e),m=s.is(l),h=t.is(i?l:s),g=t.is(i?s:l),v,x=0;m?(x=f>p?p:f,v=f>p?f:p):h?(x=i?p:f,v=void 0):g&&(x=0,v=i?f:p);let y=t.__text.slice(x,v);y!==t.__text&&(n==="clone"&&(t=nP(t)),t.__text=y)}}return t}function XH(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return Ke(t)||iy(177),e.offset===t.getChildrenSize()}function IA(e,t,n){let o=t.getNode(),r=n;if(Ke(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(Ke(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),i=0;if(a===null){let d=o.getParentOrThrow(),c=d.getPreviousSibling();for(;c===null;){if(d=d.getParent(),d===null){a=null;break}c=d.getPreviousSibling()}d!==null&&(i=d.isInline()?0:2,a=c)}let s=o.getTextContent();s===""&&Ke(o)&&!o.isInline()&&(s=`
3708
3708
 
3709
- `);let l=s.length;if(!nt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||au(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=im(d);return nt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=ou(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=Dr(c);o.replace(g),h=g}if(we(m)&&m.isCollapsed()){let g=m.anchor.offset;h.select(g,g)}}else if(o.isSimpleText()){let m=t.key===d,h=t.offset;h<r&&(h=l);let g=m?h-r:0,v=m?h:f;if(m&&g===0){let[x]=o.splitText(g,v);x.remove()}else{let[,x]=o.splitText(g,v);x.remove()}}else{let m=Dr(p);o.replace(m)}r=0}}}function QH(e){let t=e.getStyle(),n=yA(t);Rm.set(t,n)}function Mm(e,t){(we(e)?e.isCollapsed():nt(e)||Ue(e))||iy(280);let n=Nm(we(e)?e.style:nt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[i,s])=>(typeof s=="function"?a[i]=s(n[i],e):s===null?delete a[i]:a[i]=s,a),{...n}),r=CA(o);we(e)||nt(e)?e.setStyle(r):e.setTextStyle(r),Rm.set(r,o)}function XH(e,t){if(we(e)&&e.isCollapsed()){Mm(e,t);let o=e.anchor.getNode();Ue(o)&&o.isEmpty()&&Mm(o,t)}IA(o=>{Mm(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!Ue(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Mm(r,t))}}}function IA(e){let t=De();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(we(t))for(let a of eP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!nt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(jx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}we(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&SA(t)}function SA(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function wA(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function YH(e,t,n=wA){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=Ns(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=za(i.getNode(),lu),d=za(s.getNode(),lu);Ue(l)&&r.set(l.getKey(),l),Ue(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(Ue(i)&&lu(i))r.set(i.getKey(),i);else if(o===null){let s=za(i,lu);Ue(s)&&r.set(s.getKey(),s)}for(let[i,s]of r){let l=t();n(s,l),s.replace(l,!0),a&&(i===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),i===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(De())&&Or(a)}function xA(e){return e.getNode().isAttached()}function JH(e){let t=e;for(;t!==null&&!Ds(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function ZH(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),i=a.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),c=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),c.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let s=null,l=[];for(let d=0;d<i;d++){let c=a[d];Ds(c)?(ay(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&uP(c,s)?l.push(c):(ay(e,l,l.length,t,n),l=[c])}ay(e,l,l.length,t,n)}function ay(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=Ue(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,d=!0;break}if(l=l.getParentOrThrow(),Ds(l))break}let c=new Set;for(let h=0;h<n;h++){let g=t[h];Ue(g)&&g.getChildrenSize()===0&&c.add(g.getKey())}let f=new Set;for(let h=0;h<n;h++){let g=t[h],v=g.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&mP(g)&&!f.has(g.getKey())){let x=v.getKey();if(i.get(x)===void 0){let y=o();y.setFormat(v.getFormatType()),y.setIndent(v.getIndent()),s.push(y),i.set(x,y),v.getChildren().forEach(C=>{y.append(C),f.add(C.getKey()),Ue(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),JH(v)}}else if(c.has(g.getKey())){Ue(g)||iy(179);let x=o();x.setFormat(g.getFormatType()),x.setIndent(g.getIndent()),s.push(x),g.remove(!0)}}if(r!==null)for(let h=0;h<s.length;h++){let g=s[h];r.append(g)}let p=null;if(Ds(l))if(d)if(r!==null)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g)}else{let h=l.getFirstChild();if(Ue(h)&&(l=h),h===null)if(r)l.append(r);else for(let g=0;g<s.length;g++){let v=s[g];l.append(v),p=v}else if(r!==null)h.insertBefore(r);else for(let g=0;g<s.length;g++){let v=s[g];h.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g),p=g}let m=ou();we(m)&&xA(m.anchor)&&xA(m.focus)?Or(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function TA(e){let t=LA(e);return t!==null&&t.writingMode==="vertical-rl"}function LA(e){let t=e.anchor.getNode();return Ue(t)?sy(t):ly(t)}function eU(e,t){let n=TA(e)?!t:t;dy(e)&&(n=!n);let o=Yl(e.focus,n?"previous":"next");if(pP(o))return!1;for(let r of iP(o)){if(ru(r))return!r.origin.isInline();if(!Ue(r.origin)){if(lm(r.origin))return!0;break}}return!1}function kA(e,t,n,o){e.modify(t?"extend":"move",n,o)}function dy(e){let t=LA(e);return t!==null&&t.direction==="rtl"}function tU(e,t,n){let o=dy(e),r;r=TA(e)||o?!n:n,kA(e,t,r,"character")}function nU(e,t,n){let o=Nm(e.getStyle());return o!==null&&o[t]||n}function oU(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,i=e.focus,s=e.isBackward(),l=s?i.offset:a.offset,d=s?i.getNode():a.getNode();if(we(e)&&e.isCollapsed()&&e.style!==""){let c=Nm(e.style);if(c!==null&&t in c)return c[t]}for(let c=0;c<r.length;c++){let f=r[c];if((c===0||l!==0||!f.is(d))&&nt(f)){let p=nU(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var rU=bA;var rn=cy,PA=rn.$addNodeStyle,Uoe=rn.$cloneWithProperties,Koe=rn.$copyBlockFormatIndent,qoe=rn.$ensureForwardRangeSelection,Voe=rn.$forEachSelectedTextNode,Woe=rn.$getComputedStyleForElement,Goe=rn.$getComputedStyleForParent,joe=rn.$getSelectionStyleValueForProperty,Qoe=rn.$isAtNodeEnd,Xoe=rn.$isParentElementRTL,Yoe=rn.$isParentRTL,Joe=rn.$moveCaretSelection,uy=rn.$moveCharacter,Zoe=rn.$patchStyleText,ere=rn.$selectAll,tre=rn.$setBlocksType,fy=rn.$shouldOverrideDefaultCharacterSelection,_m=rn.$sliceSelectedTextNodeContent,nre=rn.$trimTextContentFromAnchor,ore=rn.$wrapNodes,rre=rn.createDOMRange,AA=rn.createRectsFromDOMRange,are=rn.getCSSFromStyleObject,ire=rn.getStyleObjectFromCSS,sre=rn.trimTextContentFromAnchor;var hy={};Tn(hy,{$descendantsMatching:()=>HU,$dfs:()=>SU,$dfsIterator:()=>zA,$filter:()=>DU,$findMatchingParent:()=>za,$firstToLastIterator:()=>UU,$getAdjacentCaret:()=>wU,$getAdjacentSiblingOrParentSiblingCaret:()=>_s,$getDepth:()=>HA,$getNearestBlockElementAncestorOrThrow:()=>AU,$getNearestNodeOfType:()=>PU,$getNextRightPreorderNode:()=>kU,$getNextSiblingOrParentSibling:()=>LU,$handleIndentAndOutdent:()=>OU,$insertFirst:()=>FU,$insertNodeToNearestRoot:()=>RU,$insertNodeToNearestRootAtCaret:()=>KA,$isEditorIsNestedEditor:()=>zU,$lastToFirstIterator:()=>gy,$restoreEditorState:()=>MU,$reverseDfs:()=>TU,$reverseDfsIterator:()=>UA,$splitNode:()=>SP,$unwrapAndFilterDescendants:()=>$U,$unwrapNode:()=>KU,$wrapNodeInElement:()=>NU,CAN_USE_BEFORE_INPUT:()=>mU,CAN_USE_DOM:()=>OA,IS_ANDROID:()=>gU,IS_ANDROID_CHROME:()=>hU,IS_APPLE:()=>vU,IS_APPLE_WEBKIT:()=>xU,IS_CHROME:()=>yU,IS_FIREFOX:()=>FA,IS_IOS:()=>CU,IS_SAFARI:()=>bU,addClassNamesToElement:()=>du,calculateZoomLevel:()=>BU,isBlockDomNode:()=>sA,isHTMLAnchorElement:()=>cA,isHTMLElement:()=>Lm,isInlineDomNode:()=>cu,isMimeType:()=>BA,makeStateWrapper:()=>qU,markSelection:()=>DA,mediaFileReader:()=>IU,mergeRegister:()=>sa,objectKlassEquals:()=>_U,positionNodeOnRange:()=>_A,registerNestedElementResolver:()=>EU,removeClassNamesFromElement:()=>km,selectionAlwaysOnDisplay:()=>pU});function Dm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var $r=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,aU=$r&&"documentMode"in document?document.documentMode:null,RA=$r&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),iU=$r&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),sU=!(!$r||!("InputEvent"in window)||aU)&&"getTargetRanges"in new window.InputEvent("input"),lU=$r&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),dU=$r&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,NA=$r&&/Android/.test(navigator.userAgent),my=$r&&/^(?=.*Chrome).*/i.test(navigator.userAgent),cU=$r&&NA&&my,uU=$r&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&RA&&!my;function la(e){return`${e}px`}var fU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function _A(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Dm(182),r===null&&Dm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=AA(e,t);var h,g;s.isConnected||(g=s,(h=r).insertBefore(g,h.firstChild));let v=!1;for(let x=0;x<m.length;x++){let y=m[x],C=i[x]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let k=la(y.left-f);w.left!==k&&(w.left=k,v=!0);let S=la(y.top-p);w.top!==S&&(C.style.top=S,v=!0);let L=la(y.width);w.width!==L&&(C.style.width=L,v=!0);let I=la(y.height);w.height!==I&&(C.style.height=I,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[x]=C}for(;i.length>m.length;)i.pop();v&&n(i)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,s.remove();for(let f of i)f.remove();i=[]}s.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!Lm(m))return d();d(),o=p,r=m,a=new MutationObserver(h=>{let g=e.getRootElement(),v=g&&g.parentElement;if(g!==o||v!==r)return f();for(let x of h)if(!s.contains(x.target))return l()}),a.observe(m,fU),l()});return()=>{c(),d()}}function EA(e,t,n){if(e.type!=="text"&&Ue(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[aA(n)||n,e.offset]}function DA(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=De();if(!we(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let T=I.getStartEndPoints();return I.isBackward()?[T[1],T[0]]:T})(f),h=p.getNode(),g=h.getKey(),v=p.offset,x=m.getNode(),y=x.getKey(),C=m.offset,w=e.getElementByKey(g),k=e.getElementByKey(y),S=n===null||w!==o||v!==r||g!==n.getKey(),L=a===null||k!==i||C!==s||y!==a.getKey();if((S||L)&&w!==null&&k!==null){let I=(function(T,E,A,N,R,$,H){let K=(T._window?T._window.document:document).createRange();return K.setStart(...EA(E,A,N)),K.setEnd(...EA(R,$,H)),K})(e,p,h,w,m,x,k);l(),l=_A(e,I,T=>{if(t===void 0)for(let E of T){let A=E.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==la(-1.5)&&(A.marginTop=la(-1.5)),A.paddingTop!==la(4)&&(A.paddingTop=la(4)),A.paddingBottom!==la(0)&&(A.paddingBottom=la(0))}else t(T)})}n=h,o=w,r=v,a=x,i=k,s=C})}return d(e.getEditorState()),sa(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function pU(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,i=e.getRootElement();a!==null&&i!==null&&i.contains(a)?n!==null&&(n(),n=null):n===null&&(n=DA(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var mU=sU,OA=$r,gU=NA,hU=cU,vU=RA,xU=uU,yU=my,FA=iU,CU=dU,bU=lU;function BA(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function IU(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],i=()=>{let{done:s,value:l}=n.next();if(s)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let c=d.result;typeof c=="string"&&a.push({file:l,result:c}),i()}),BA(l,t)?d.readAsDataURL(l):i()};i()})}function SU(e,t){return Array.from(zA(e,t))}function wU(e){return e?e.getAdjacentCaret():null}function TU(e,t){return Array.from(UA(e,t))}function zA(e,t){return $A("next",e,t)}function MA(e,t){let n=_s($a(e,t));return n&&n[0]}function $A(e,t,n){let o=Ct(),r=t||o,a=Ue(r)?Ei(r,e):$a(r,e),i=HA(r),s=n?qx(Wx($a(n,e)))||MA(n,e):MA(r,e),l=i;return ey({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;ru(d)&&l++;let c=_s(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function LU(e){let t=_s($a(e,"next"));return t&&[t[0].origin,t[1]]}function HA(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function kU(e){let t=Wx($a(e,"previous")),n=_s(t,"root");return n&&n[0].origin}function UA(e,t){return $A("previous",e,t)}function PU(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function AU(e){let t=za(e,n=>Ue(n)&&!n.isInline());return Ue(t)||Dm(4,e.__key),t}function EU(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let i=(s=>{let l=s.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=s,c=s;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(i!==null){let{child:s,parent:l}=i;if(s.is(a)){o(l,a);let d=s.getNextSiblings(),c=d.length;if(l.insertAfter(s),c!==0){let f=n(l);s.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function MU(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,rm(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Or(r===null?null:r.clone())}function RU(e){let t=De()||ou(),n;if(we(t))n=Yl(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=$a(s,"next"))}n=n||Ei(Ct(),"previous").getFlipped().insert(pr())}let o=KA(e,n),r=qx(o),a=ru(r)?vP(r):o;return bP(dP(a)),e.getLatest()}function KA(e,t,n){let o=Vx(t,"next");for(let r=o;r;r=IP(r,n))o=r;return dm(o)&&Dm(283),o.insert(e.isInline()?pr().append(e):e),Vx($a(e.getLatest(),"next"),t.direction)}function NU(e,t){let n=t();return e.replace(n),n.append(e),n}function _U(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function DU(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function OU(e){let t=De();if(!we(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],i=a.getKey();if(n.has(i))continue;let s=za(a,d=>Ue(d)&&!d.isInline());if(s===null)continue;let l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function FU(e,t){Ei(e,"next").insert(t)}var py=!(FA||!OA)&&void 0;function BU(e,t=!1){let n=1;if((function(){if(py===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),py=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return py})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function zU(e){return e._parentEditor!==null}function $U(e,t){return qA(e,t,null)}function qA(e,t,n){let o=!1;for(let r of gy(e))t(r)?n!==null&&n(r):(o=!0,Ue(r)&&qA(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function HU(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(Ue(r))for(let a of gy(r))o.push(a);return n}function UU(e){return VA(Ei(e,"next"))}function gy(e){return VA(Ei(e,"previous"))}function VA(e){return ey({hasNext:hP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function KU(e){CP($a(e,"next")).splice(1,e.getChildren())}function qU(e){let t=o=>sm(o,e),n=(o,r)=>um(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Ve=hy,fre=Ve.$descendantsMatching,pre=Ve.$dfs,mre=Ve.$dfsIterator,gre=Ve.$filter,hre=Ve.$findMatchingParent,vre=Ve.$firstToLastIterator,xre=Ve.$getAdjacentCaret,yre=Ve.$getAdjacentSiblingOrParentSiblingCaret,Cre=Ve.$getDepth,WA=Ve.$getNearestBlockElementAncestorOrThrow,bre=Ve.$getNearestNodeOfType,Ire=Ve.$getNextRightPreorderNode,Sre=Ve.$getNextSiblingOrParentSibling,GA=Ve.$handleIndentAndOutdent,wre=Ve.$insertFirst,Tre=Ve.$insertNodeToNearestRoot,Lre=Ve.$insertNodeToNearestRootAtCaret,kre=Ve.$isEditorIsNestedEditor,Pre=Ve.$lastToFirstIterator,Are=Ve.$restoreEditorState,Ere=Ve.$reverseDfs,Mre=Ve.$reverseDfsIterator,Rre=Ve.$splitNode,Nre=Ve.$unwrapAndFilterDescendants,_re=Ve.$unwrapNode,Dre=Ve.$wrapNodeInElement,Ore=Ve.CAN_USE_BEFORE_INPUT,Fre=Ve.CAN_USE_DOM,Bre=Ve.IS_ANDROID,zre=Ve.IS_ANDROID_CHROME,$re=Ve.IS_APPLE,Hre=Ve.IS_APPLE_WEBKIT,Ure=Ve.IS_CHROME,Kre=Ve.IS_FIREFOX,qre=Ve.IS_IOS,Vre=Ve.IS_SAFARI,Wre=Ve.addClassNamesToElement,Gre=Ve.calculateZoomLevel,vy=Ve.isBlockDomNode,jre=Ve.isHTMLAnchorElement,jA=Ve.isHTMLElement,Qre=Ve.isInlineDomNode,Xre=Ve.isMimeType,Yre=Ve.makeStateWrapper,Jre=Ve.markSelection,Zre=Ve.mediaFileReader,Ua=Ve.mergeRegister,uu=Ve.objectKlassEquals,eae=Ve.positionNodeOnRange,tae=Ve.registerNestedElementResolver,nae=Ve.removeClassNamesFromElement,oae=Ve.selectionAlwaysOnDisplay;var xy={};Tn(xy,{ContentEditable:()=>WU,ContentEditableElement:()=>YA});me();var XA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function VU({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:i,ariaInvalid:s,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:h,id:g,role:v="textbox",spellCheck:x=!0,style:y,tabIndex:C,"data-testid":w,...k},S){let[L,I]=G(e.isEditable()),T=B(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),E=z(()=>(function(...A){return N=>{for(let R of A)typeof R=="function"?R(N):R!=null&&(R.current=N)}})(S,T),[T,S]);return XA(()=>(I(e.isEditable()),e.registerEditableListener(A=>{I(A)})),[e]),u("div",{"aria-activedescendant":L?t:void 0,"aria-autocomplete":L?n:"none","aria-controls":L?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":L&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":L?f:void 0,"aria-readonly":!L||void 0,"aria-required":p,autoCapitalize:m,className:h,contentEditable:L,"data-testid":w,id:g,ref:E,role:v,spellCheck:x,style:y,tabIndex:C,...k})}var YA=qn(VU);function QA(e){return e.getEditorState().read(Em(e.isComposing()))}var WU=qn(GU);function GU(e,t){let{placeholder:n,...o}=e,[r]=Cn();return b(be,{children:[u(YA,{editor:r,...o,ref:t}),n!=null&&u(jU,{editor:r,content:n})]})}function jU({content:e,editor:t}){let n=(function(i){let[s,l]=G(()=>QA(i));return XA(()=>{function d(){let c=QA(i);l(c)}return d(),Ua(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=G(t.isEditable());if(ye(()=>(r(t.isEditable()),t.registerEditableListener(i=>{r(i)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:u("div",{"aria-hidden":!0,children:a})}var JA=xy,ZA=JA.ContentEditable,cae=JA.ContentEditableElement;me();var QU=Ht(null),yy={didCatch:!1,error:null},Om=class extends Ki{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=yy}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(yy))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&XU(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(yy))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:i}=this.state,s=t;if(a){let l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")s=n(l);else if(o)s=Te(o,l);else if(r!==void 0)s=r;else throw i}return Te(QU.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function XU(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Cy={};Tn(Cy,{LexicalErrorBoundary:()=>YU});function YU({children:e,onError:t}){return u(Om,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var JU=Cy,eE=JU.LexicalErrorBoundary;var Dy={};Tn(Dy,{$createHorizontalRuleNode:()=>_y,$isDecoratorTextNode:()=>mE,$isHorizontalRuleNode:()=>CE,AutoFocusExtension:()=>t3,ClearEditorExtension:()=>n3,DecoratorTextExtension:()=>l3,DecoratorTextNode:()=>mu,EditorStateExtension:()=>$m,HorizontalRuleExtension:()=>y3,HorizontalRuleNode:()=>Bs,INSERT_HORIZONTAL_RULE_COMMAND:()=>v3,InitialStateExtension:()=>xE,LexicalBuilder:()=>rd,NodeSelectionExtension:()=>Ey,TabIndentationExtension:()=>C3,applyFormatFromStyle:()=>r3,applyFormatToDom:()=>a3,batch:()=>iE,buildEditorFromExtensions:()=>f3,computed:()=>dE,configExtension:()=>wm,declarePeerDependency:()=>rA,defineExtension:()=>kn,effect:()=>Ri,getExtensionDependencyFromEditor:()=>m3,getKnownTypesAndNodes:()=>o3,getPeerDependencyFromEditor:()=>yE,getPeerDependencyFromEditorOrThrow:()=>g3,namedSignals:()=>Um,registerClearEditor:()=>fE,registerTabIndentation:()=>IE,safeCast:()=>zr,shallowMergeConfig:()=>Pm,signal:()=>od,untracked:()=>Ly,watchedSignal:()=>Ry});var ZU=Symbol.for("preact-signals");function Hm(){if(Mi>1)return void Mi--;let e,t=!1;for(;pu!==void 0;){let n=pu;for(pu=void 0,ky++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&sE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(ky=0,Mi--,t)throw e}function iE(e){if(Mi>0)return e();Mi++;try{return e()}finally{Hm()}}var Et,pu;function Ly(e){let t=Et;Et=void 0;try{return e()}finally{Et=t}}var Mi=0,ky=0,zm=0;function tE(e){if(Et===void 0)return;let t=e.n;return t===void 0||t.t!==Et?(t={i:0,S:e,p:Et.s,n:void 0,t:Et,e:void 0,x:void 0,r:t},Et.s!==void 0&&(Et.s.n=t),Et.s=t,e.n=t,32&Et.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Et.s,t.n=void 0,Et.s.n=t,Et.s=t),t):void 0}function wo(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function od(e,t){return new wo(e,t)}function sE(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function nE(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function lE(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Fs(e,t){wo.call(this,void 0),this.x=e,this.s=void 0,this.g=zm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function dE(e,t){return new Fs(e,t)}function cE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Mi++;let n=Et;Et=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,My(e),o}finally{Et=n,Hm()}}}function My(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,cE(e)}function e3(e){if(Et!==this)throw new Error("Out-of-order effect");lE(this),Et=e,this.f&=-2,8&this.f&&My(this),Hm()}function nd(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}function Ri(e,t){let n=new nd(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function Um(e,t={}){let n={};for(let o in e){let r=t[o],a=od(r===void 0?e[o]:r);n[o]=a}return n}wo.prototype.brand=ZU,wo.prototype.h=function(){return!0},wo.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:Ly(()=>{var n;(n=this.W)==null||n.call(this)}))},wo.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Ly(()=>{var o;(o=this.Z)==null||o.call(this)}))}},wo.prototype.subscribe=function(e){return Ri(()=>{let t=this.value,n=Et;Et=void 0;try{e(t)}finally{Et=n}},{name:"sub"})},wo.prototype.valueOf=function(){return this.value},wo.prototype.toString=function(){return this.value+""},wo.prototype.toJSON=function(){return this.value},wo.prototype.peek=function(){let e=Et;Et=void 0;try{return this.value}finally{Et=e}},Object.defineProperty(wo.prototype,"value",{get(){let e=tE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(ky>100)throw new Error("Cycle detected");this.v=e,this.i++,zm++,Mi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Hm()}}}}),Fs.prototype=new wo,Fs.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===zm))return!0;if(this.g=zm,this.f|=1,this.i>0&&!sE(this))return this.f&=-2,!0;let e=Et;try{nE(this),Et=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Et=e,lE(this),this.f&=-2,!0},Fs.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}wo.prototype.S.call(this,e)},Fs.prototype.U=function(e){if(this.t!==void 0&&(wo.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Fs.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Fs.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=tE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),nd.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},nd.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,cE(this),nE(this),Mi++;let e=Et;return Et=this,e3.bind(this,e)},nd.prototype.N=function(){2&this.f||(this.f|=2,this.o=pu,pu=this)},nd.prototype.d=function(){this.f|=8,1&this.f||My(this)},nd.prototype.dispose=function(){this.d()};var t3=kn({build:(e,t,n)=>Um(t),config:zr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Ri(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function uE(){let e=Ct(),t=De(),n=pr();e.clear(),e.append(n),t!==null&&n.select(),we(t)&&(t.format=0)}function fE(e,t=uE){return e.registerCommand(fm,n=>(e.update(t),!0),Xt)}var n3=kn({build:(e,t,n)=>Um(t),config:zr({$onClear:uE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Ri(()=>fE(e,o.value))}});function o3(e){let t=new Set,n=new Set;for(let o of pE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function pE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var by=oA("format",{parse:e=>typeof e=="number"?e:0}),mu=class extends Ha{$config(){return this.config("decorator-text",{extends:Ha,stateConfigs:[{flat:!0,stateConfig:by}]})}getFormat(){return sm(this,by)}getFormatFlags(t,n){return ty(this.getFormat(),t,n)}hasFormat(t){let n=ZP[t];return(this.getFormat()&n)!==0}setFormat(t){return um(this,by,t)}toggleFormat(t){let n=this.getFormat(),o=ty(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function mE(e){return e instanceof mu}function r3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function a3(e,t,n=s3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=i3(t,o));return t}function i3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var s3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},l3=kn({name:"@lexical/extension/DecoratorText",nodes:()=>[mu],register:(e,t,n)=>e.registerCommand(OP,o=>{let r=De();if(Gx(r)||we(r))for(let a of r.getNodes())mE(a)&&a.toggleFormat(o);return!1},ed)});function Ry(e,t){let n;return od(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var $m=kn({build:e=>Ry(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Ft(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function gE(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=gE(n[r],o[r]);return e}return t}var Ny=0,Py=1,hE=2,Iy=3,Fm=4,td=5,Sy=6,fu=7;function wy(e){return e.id===Ny}function vE(e){return e.id===hE}function d3(e){return(function(t){return t.id===Py})(e)||Ft(305,String(e.id),String(Py)),Object.assign(e,{id:hE})}var c3=new Set,Ay=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Ny}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Pm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;vE(n)||Ft(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(s,l,d){return Object.assign(s,{config:l,id:Iy,registerState:d})})(n,this.mergeConfigs(),o),i;this.state=a,this.extension.init&&(i=this.extension.init(t,a.config,o)),this.state=(function(s,l,d){return Object.assign(s,{id:Fm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Fm&&Ft(307,String(n.id),String(td)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,i,s){return Object.assign(a,{id:td,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==td&&Ft(308,String(o.id),String(td));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Sy})})(o),()=>{let a=this.state;a.id!==fu&&Ft(309,String(o.id),String(fu)),this.state=(function(i){return Object.assign(i,{id:td})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Sy&&Ft(310,String(n.id),String(Sy)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:fu})})(n),o}getSignal(){return this._signal===void 0&&Ft(311),this._signal}getInitResult(){this.extension.init===void 0&&Ft(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Fm})(t)||Ft(313,String(t.id),String(Fm)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Iy})(t)||Ft(314,String(t.id),String(Iy)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=fu})(t)||Ft(316,String(t.id),String(fu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||c3}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=td})(t)||Ft(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},oE={tag:Br};function u3(){let e=Ct();e.isEmpty()&&e.append(pr())}var xE=kn({config:zr({setOptions:oE,updateOptions:oE}),init:({$initialEditorState:e=u3})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(fP(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let i=e.parseEditorState(a);e.setEditorState(i,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[XP,Sm,qP,eA,GP]}),rE=Symbol.for("@lexical/extension/LexicalBuilder");function f3(...e){return rd.fromExtensions(e).buildEditor()}function aE(){}function p3(e){throw e}function Bm(e){return Array.isArray(e)?e:[e]}var Ty="0.41.0+prod.esm",rd=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Ty,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Bm(xE)];for(let o of t)n.push(Bm(o));return new e(n)}static maybeFromEditor(t){let n=t[rE];return n&&(n.PACKAGE_VERSION!==Ty&&Ft(292,n.PACKAGE_VERSION,Ty),n instanceof e||Ft(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ft(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Tm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[rE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=aE;function n(){try{t()}finally{t=aE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=sa(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Ft(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Ft(296);let n=Bm(t),[o]=n;typeof o.name!="string"&&Ft(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Ft(298,o.name),!r){r=new Ay(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Ft(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Ft(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Bm(i);this.addEdge(o.name,s[0].name,s.slice(1)),this.addExtension(s)}for(let[i,s]of o.peerDependencies||[])this.addEdge(o.name,i,s?[s]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(vE(a))return;let i=o.extension.name;var s;wy(a)||Ft(300,i,r||"[unknown]"),wy(s=a)||Ft(304,String(s.id),String(Ny)),a=Object.assign(s,{id:Py}),o.state=a;let l=this.outgoingConfigEdges.get(i);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,i)}a=d3(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())wy(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let i=this.extensionNameMap.get(r);if(i)for(let s of a)i.configs.add(s)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Ft(301,o.name);for(let i of r)a.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let i of n){let s=i.register(t,a);s&&r.push(s)}for(let i of n){let s=i.afterRegistration(t);s&&r.push(s)}return sa(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},i={},s=this.sortedExtensionReps();for(let c of s){let{extension:f}=c;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of pE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Ft(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,c)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&gE(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let c of s)c.init(t);return t.onError||(t.onError=p3),t}};function m3(e,t){let n=rd.fromEditor(e).getExtensionRep(t);return n===void 0&&Ft(303,t.name),n.getExtensionDependency()}function yE(e,t){let n=rd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function g3(e,t){let n=yE(e,t);return n===void 0&&Ft(291,t),n}var h3=new Set,Ey=kn({build(e,t,n){let o=n.getDependency($m).output,r=od({watchedNodeKeys:new Map}),a=Ry(()=>{},()=>Ri(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(De())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=im(c),m=p&&p.isSelected()||!1;d=d||m!==(!!i&&i.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&i&&l.size===i.size||(a.value=l)}));return{watchNodeKey:function(i){let s=dE(()=>(a.value||h3).has(i)),{watchedNodeKeys:l}=r.peek(),d=l.get(i),c=d!==void 0;return d=d||new Set,d.add(s),c||(l.set(i,d),r.value={watchedNodeKeys:l}),s}}},dependencies:[$m],name:"@lexical/extension/NodeSelection"}),v3=nA("INSERT_HORIZONTAL_RULE_COMMAND"),Bs=class e extends Ha{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return _y().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:x3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return du(n,t.theme.hr),n}getTextContent(){return`
3710
- `}isInline(){return!1}updateDOM(){return!1}};function x3(){return{node:_y()}}function _y(){return nP(Bs)}function CE(e){return e instanceof Bs}var y3=kn({dependencies:[$m,Ey],name:"@lexical/extension/HorizontalRule",nodes:()=>[Bs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Ey).output,r=od({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return sa(e.registerCommand(LP,i=>{if(dA(i.target)){let s=cP(i.target);if(CE(s))return(function(l,d=!1){let c=De(),f=l.isSelected(),p=l.getKey(),m;d&&Gx(c)?m=c:(m=oP(),Or(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},ed),e.registerMutationListener(Bs,(i,s)=>{iE(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of i.entries())if(f==="destroyed")d.delete(c),l=!0;else{let p=d.get(c),m=e.getElementByKey(c);p?p.domNode.value=m:(l=!0,d.set(c,{domNode:od(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Ri(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Ri(()=>{let d=s.value;d&&(l.value?du(d,a):km(d,a))}));return sa(...i)}))}});function bE(e){return e.canBeEmpty()}function IE(e,t,n=bE){return sa(e.registerCommand(bm,o=>{let r=De();if(!we(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>Jl(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=WA(c);if(f.canIndent()){let p=f.getKey(),m=Ns();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=xP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?VP:Xx:zP;return e.dispatchCommand(a,void 0)},Xt),e.registerCommand(Xx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=De();if(!we(r))return!1;let a=typeof n=="function"?n:n.peek();return GA(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},pm))}var C3=kn({build:(e,t,n)=>Um(t),config:zr({$canIndent:bE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Ri(()=>{if(!o.value)return IE(e,r,a)})}});var mt=Dy,Cae=mt.$createHorizontalRuleNode,bae=mt.$isDecoratorTextNode,Iae=mt.$isHorizontalRuleNode,Sae=mt.AutoFocusExtension,wae=mt.ClearEditorExtension,Tae=mt.DecoratorTextExtension,Lae=mt.DecoratorTextNode,kae=mt.EditorStateExtension,Pae=mt.HorizontalRuleExtension,Aae=mt.HorizontalRuleNode,Eae=mt.INSERT_HORIZONTAL_RULE_COMMAND,Mae=mt.InitialStateExtension,SE=mt.LexicalBuilder,Rae=mt.NodeSelectionExtension,Nae=mt.TabIndentationExtension,_ae=mt.applyFormatFromStyle,Dae=mt.applyFormatToDom,wE=mt.batch,Oae=mt.buildEditorFromExtensions,Fae=mt.computed,Bae=mt.configExtension,zae=mt.declarePeerDependency,$ae=mt.defineExtension,gu=mt.effect,Hae=mt.getExtensionDependencyFromEditor,Uae=mt.getKnownTypesAndNodes,TE=mt.getPeerDependencyFromEditor,Kae=mt.getPeerDependencyFromEditorOrThrow,Km=mt.namedSignals,qae=mt.registerClearEditor,Vae=mt.registerTabIndentation,Wae=mt.safeCast,Gae=mt.shallowMergeConfig,jae=mt.signal,Qae=mt.untracked,Xae=mt.watchedSignal;var Oy={};Tn(Oy,{HistoryExtension:()=>qm,SharedHistoryExtension:()=>S3,createEmptyHistoryState:()=>PE,registerHistory:()=>kE});function b3(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,i=e._selection;if(r)return 1;if(!(we(a)&&we(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(x,y,C){let w=x._nodeMap,k=[];for(let S of y){let L=w.get(S);L!==void 0&&k.push(L)}for(let[S,L]of C){if(!L)continue;let I=w.get(S);I===void 0||au(I)||k.push(I)}return k})(t,n,o);if(s.length===0)return 0;if(s.length>1){let x=t._nodeMap,y=x.get(a.anchor.key),C=x.get(i.anchor.key);return y&&C&&!e._nodeMap.has(y.__key)&&nt(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!nt(d)||!nt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=i.anchor;if(p.key!==m.key||p.type!=="text")return 0;let h=p.offset,g=m.offset,v=f.length-c.length;return v===1&&g===h-1?2:v===-1&&g===h+1?3:v===-1&&g===h?4:0}function I3(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,i=null;return(s,l,d,c,f,p)=>{let m=Date.now();if(p.has(PP)&&(r=n,a=o,i=s),p.has(hm))return o=0,n=m,2;p.has(kP)&&i&&(n=r,o=a,s=i);let h=b3(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(FP);if(!x&&v&&p.has(Br))return 0;if(h===1)return 2;if(s===null)return 1;let y=l._selection;if(!(c.size>0||f.size>0))return y!==null?0:2;let C=typeof t=="number"?t:t.peek();return x===!1&&h!==0&&h===o&&m<n+C&&v||c.size===1&&(function(w,k,S){let L=k._nodeMap.get(w),I=S._nodeMap.get(w),T=k._selection,E=S._selection;return!(we(T)&&we(E)&&T.anchor.type==="element"&&T.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!nt(L)||!nt(I)||L.__parent!==I.__parent)&&JSON.stringify(k.read(()=>L.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=h,g}}function LE(e){e.undoStack=[],e.redoStack=[],e.current=null}function kE(e,t,n){let o=I3(e,n);return Ua(e.registerCommand(tA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(l.length!==0){let d=i.current,c=l.pop();d!==null&&(s.push(d),a.dispatchCommand(iu,!0)),l.length===0&&a.dispatchCommand(su,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:hm})}})(e,t),!0),Xt),e.registerCommand(jP,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(s.length!==0){let d=i.current;d!==null&&(l.push(d),a.dispatchCommand(su,!0));let c=s.pop();s.length===0&&a.dispatchCommand(iu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:hm})}})(e,t),!0),Xt),e.registerCommand(fm,()=>(LE(t),!1),Xt),e.registerCommand(TP,()=>(LE(t),e.dispatchCommand(iu,!1),e.dispatchCommand(su,!1),!0),Xt),e.registerUpdateListener(({editorState:a,prevEditorState:i,dirtyLeaves:s,dirtyElements:l,tags:d})=>{let c=t.current,f=t.redoStack,p=t.undoStack,m=c===null?null:c.editorState;if(c!==null&&a===m)return;let h=o(i,a,c,s,l,d);if(h===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(iu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(su,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function PE(){return{current:null,redoStack:[],undoStack:[]}}var qm=kn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Km({delay:t,disabled:o,historyState:n(e)}),config:zr({createInitialHistoryState:PE,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return gu(()=>o.disabled.value?void 0:kE(e,o.historyState.value,o.delay))}}),S3=kn({dependencies:[wm(qm,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(qm),r=(function(i){return i?TE(i,qm.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return gu(()=>wE(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Vm=Oy,tie=Vm.HistoryExtension,nie=Vm.SharedHistoryExtension,Wm=Vm.createEmptyHistoryState,AE=Vm.registerHistory;var Fy={};Tn(Fy,{HistoryPlugin:()=>w3,createEmptyHistoryState:()=>Wm});me();function w3({delay:e,externalHistoryState:t}){let[n]=Cn();return(function(o,r,a=1e3){let i=z(()=>r||Wm(),[r]);q(()=>AE(o,i,a),[a,o,i])})(n,t,e),null}var EE=Fy,ME=EE.HistoryPlugin,RE=EE.createEmptyHistoryState;var By={};Tn(By,{OnChangePlugin:()=>L3});me();var T3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function L3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Cn();return T3(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:i,prevEditorState:s,tags:l})=>{t&&a.size===0&&i.size===0||e&&l.has(Br)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var k3=By,NE=k3.OnChangePlugin;var zy={};Tn(zy,{useLexicalEditable:()=>E3});me();var P3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function A3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function E3(){return(function(e){let[t]=Cn(),n=z(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=_(o);return P3(()=>{let{initialValueFn:i,subscribe:s}=n,l=i();return a.current!==l&&(a.current=l,r(l)),s(d=>{a.current=d,r(d)})},[n,e]),o})(A3)}var M3=zy,_E=M3.useLexicalEditable;var $y={};Tn($y,{ReactProviderExtension:()=>R3});var R3=kn({name:"@lexical/react/ReactProvider"});var N3=$y,DE=N3.ReactProviderExtension;var Hy={};Tn(Hy,{DragonExtension:()=>_3,registerDragonSupport:()=>OE});function OE(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let i;try{i=JSON.parse(a)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){let s=i.payload;if(s&&s.functionId==="makeChanges"){let l=s.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let h=De();if(we(h)){let g=h.anchor,v=g.getNode(),x=0,y=0;if(nt(v)&&d>=0&&c>=0&&(x=d,y=d+c,h.setTextNodeRange(v,x,v,y)),x===y&&f===""||(h.insertRawText(f),v=g.getNode()),nt(v)){x=p,y=p+m;let C=v.getTextContentSize();x=x>C?C:x,y=y>C?C:y,h.setTextNodeRange(v,x,v,y)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var _3=kn({build:(e,t,n)=>Km(t),config:zr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>gu(()=>n.getOutput().disabled.value?void 0:OE(e))});var FE=Hy,BE=FE.DragonExtension,zE=FE.registerDragonSupport;var Uy={};Tn(Uy,{$generateHtmlFromNodes:()=>O3,$generateNodesFromDOM:()=>D3});function D3(e,t){let n=lA(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!HE.has(a.nodeName)){let i=UE(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof Qx&&i.insertAfter(Rs());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function O3(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Ct().getChildren();for(let r=0;r<o.length;r++)$E(e,o[r],n,t);return n.innerHTML}function $E(e,t,n,o=null){let r=o===null||t.isSelected(o),a=Ue(t)&&t.excludeFromCopy("html"),i=t;o!==null&&nt(t)&&(i=_m(o,t,"clone"));let s=Ue(i)?i.getChildren():[],l=iA(e,i.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,i):i.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<s.length;m++){let h=s[m],g=$E(e,h,p,o);!r&&Ue(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((jA(c)||Zx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(Zx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var HE=new Set(["STYLE","SCRIPT"]);function UE(e,t,n,o,r=new Map,a){let i=[];if(HE.has(e.nodeName))return i;let s=null,l=(function(h,g){let{nodeName:v}=h,x=g._htmlConversions.get(v.toLowerCase()),y=null;if(x!==void 0)for(let C of x){let w=C(h);w!==null&&(y===null||(y.priority||0)<=(w.priority||0))&&(y=w)}return y!==null?y.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let h=d.node;if(s=Array.isArray(h)?h[h.length-1]:h,s!==null){for(let[,g]of r)if(s=g(s,a),!s)break;s&&i.push(...Array.isArray(h)?h:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!Ds(s))&&(s!=null&&Jl(s)||o);for(let h=0;h<f.length;h++)p.push(...UE(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),vy(e)&&(p=F3(e,p,m?()=>{let h=new Qx;return n.push(h),h}:pr)),s==null?p.length>0?i=i.concat(p):vy(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:cu(h.nextSibling)&&cu(h.previousSibling)})(e)&&(i=i.concat(Rs())):Ue(s)&&s.append(...p),i}function F3(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(Jl(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&Jl(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var KE=Uy,qE=KE.$generateHtmlFromNodes,VE=KE.$generateNodesFromDOM;var qy={};Tn(qy,{$generateJSONFromSelectedNodes:()=>XE,$generateNodesFromSerializedNodes:()=>YE,$getClipboardDataFromSelection:()=>ZE,$getHtmlContent:()=>GE,$getLexicalContent:()=>jE,$insertDataTransferForPlainText:()=>B3,$insertDataTransferForRichText:()=>z3,$insertGeneratedNodes:()=>Ky,copyToClipboard:()=>$3,setLexicalClipboardDataTransfer:()=>eM});function Gm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function GE(e,t=De()){return t==null&&Gm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?"":qE(e,t)}function jE(e,t=De()){return t==null&&Gm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(XE(e,t))}function B3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function z3(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let s=JSON.parse(o);if(s.namespace===n._config.namespace&&Array.isArray(s.nodes))return Ky(n,YE(s.nodes),t)}catch(s){console.error(s)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let s=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return Ky(n,VE(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(we(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=De();if(we(d)){let c=s[l];c===`
3709
+ `);let l=s.length;if(!tt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||tu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=rm(d);return tt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=Zc(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=Mr(c);o.replace(g),h=g}if(we(m)&&m.isCollapsed()){let g=m.anchor.offset;h.select(g,g)}}else if(o.isSimpleText()){let m=t.key===d,h=t.offset;h<r&&(h=l);let g=m?h-r:0,v=m?h:f;if(m&&g===0){let[x]=o.splitText(g,v);x.remove()}else{let[,x]=o.splitText(g,v);x.remove()}}else{let m=Mr(p);o.replace(m)}r=0}}}function YH(e){let t=e.getStyle(),n=CA(t);Em.set(t,n)}function Am(e,t){(we(e)?e.isCollapsed():tt(e)||Ke(e))||iy(280);let n=Mm(we(e)?e.style:tt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[i,s])=>(typeof s=="function"?a[i]=s(n[i],e):s===null?delete a[i]:a[i]=s,a),{...n}),r=bA(o);we(e)||tt(e)?e.setStyle(r):e.setTextStyle(r),Em.set(r,o)}function JH(e,t){if(we(e)&&e.isCollapsed()){Am(e,t);let o=e.anchor.getNode();Ke(o)&&o.isEmpty()&&Am(o,t)}SA(o=>{Am(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!Ke(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Am(r,t))}}}function SA(e){let t=Oe();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(we(t))for(let a of tP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!tt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(jx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}we(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&wA(t)}function wA(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function TA(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function ZH(e,t,n=TA){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=Rs(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=_a(i.getNode(),ru),d=_a(s.getNode(),ru);Ke(l)&&r.set(l.getKey(),l),Ke(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(Ke(i)&&ru(i))r.set(i.getKey(),i);else if(o===null){let s=_a(i,ru);Ke(s)&&r.set(s.getKey(),s)}for(let[i,s]of r){let l=t();n(s,l),s.replace(l,!0),a&&(i===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),i===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Oe())&&Rr(a)}function yA(e){return e.getNode().isAttached()}function eU(e){let t=e;for(;t!==null&&!_s(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function tU(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),i=a.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),c=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),c.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let s=null,l=[];for(let d=0;d<i;d++){let c=a[d];_s(c)?(ay(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&fP(c,s)?l.push(c):(ay(e,l,l.length,t,n),l=[c])}ay(e,l,l.length,t,n)}function ay(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=Ke(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,d=!0;break}if(l=l.getParentOrThrow(),_s(l))break}let c=new Set;for(let h=0;h<n;h++){let g=t[h];Ke(g)&&g.getChildrenSize()===0&&c.add(g.getKey())}let f=new Set;for(let h=0;h<n;h++){let g=t[h],v=g.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&gP(g)&&!f.has(g.getKey())){let x=v.getKey();if(i.get(x)===void 0){let y=o();y.setFormat(v.getFormatType()),y.setIndent(v.getIndent()),s.push(y),i.set(x,y),v.getChildren().forEach(C=>{y.append(C),f.add(C.getKey()),Ke(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),eU(v)}}else if(c.has(g.getKey())){Ke(g)||iy(179);let x=o();x.setFormat(g.getFormatType()),x.setIndent(g.getIndent()),s.push(x),g.remove(!0)}}if(r!==null)for(let h=0;h<s.length;h++){let g=s[h];r.append(g)}let p=null;if(_s(l))if(d)if(r!==null)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g)}else{let h=l.getFirstChild();if(Ke(h)&&(l=h),h===null)if(r)l.append(r);else for(let g=0;g<s.length;g++){let v=s[g];l.append(v),p=v}else if(r!==null)h.insertBefore(r);else for(let g=0;g<s.length;g++){let v=s[g];h.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g),p=g}let m=Zc();we(m)&&yA(m.anchor)&&yA(m.focus)?Rr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function LA(e){let t=kA(e);return t!==null&&t.writingMode==="vertical-rl"}function kA(e){let t=e.anchor.getNode();return Ke(t)?sy(t):ly(t)}function nU(e,t){let n=LA(e)?!t:t;dy(e)&&(n=!n);let o=jl(e.focus,n?"previous":"next");if(mP(o))return!1;for(let r of sP(o)){if(eu(r))return!r.origin.isInline();if(!Ke(r.origin)){if(im(r.origin))return!0;break}}return!1}function PA(e,t,n,o){e.modify(t?"extend":"move",n,o)}function dy(e){let t=kA(e);return t!==null&&t.direction==="rtl"}function oU(e,t,n){let o=dy(e),r;r=LA(e)||o?!n:n,PA(e,t,r,"character")}function rU(e,t,n){let o=Mm(e.getStyle());return o!==null&&o[t]||n}function aU(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,i=e.focus,s=e.isBackward(),l=s?i.offset:a.offset,d=s?i.getNode():a.getNode();if(we(e)&&e.isCollapsed()&&e.style!==""){let c=Mm(e.style);if(c!==null&&t in c)return c[t]}for(let c=0;c<r.length;c++){let f=r[c];if((c===0||l!==0||!f.is(d))&&tt(f)){let p=rU(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var iU=IA;var an=cy,AA=an.$addNodeStyle,qoe=an.$cloneWithProperties,Voe=an.$copyBlockFormatIndent,Woe=an.$ensureForwardRangeSelection,Goe=an.$forEachSelectedTextNode,joe=an.$getComputedStyleForElement,Qoe=an.$getComputedStyleForParent,Xoe=an.$getSelectionStyleValueForProperty,Yoe=an.$isAtNodeEnd,Joe=an.$isParentElementRTL,Zoe=an.$isParentRTL,ere=an.$moveCaretSelection,uy=an.$moveCharacter,tre=an.$patchStyleText,nre=an.$selectAll,ore=an.$setBlocksType,fy=an.$shouldOverrideDefaultCharacterSelection,Rm=an.$sliceSelectedTextNodeContent,rre=an.$trimTextContentFromAnchor,are=an.$wrapNodes,ire=an.createDOMRange,EA=an.createRectsFromDOMRange,sre=an.getCSSFromStyleObject,lre=an.getStyleObjectFromCSS,dre=an.trimTextContentFromAnchor;var hy={};An(hy,{$descendantsMatching:()=>KU,$dfs:()=>TU,$dfsIterator:()=>$A,$filter:()=>FU,$findMatchingParent:()=>_a,$firstToLastIterator:()=>qU,$getAdjacentCaret:()=>LU,$getAdjacentSiblingOrParentSiblingCaret:()=>Ns,$getDepth:()=>UA,$getNearestBlockElementAncestorOrThrow:()=>MU,$getNearestNodeOfType:()=>EU,$getNextRightPreorderNode:()=>AU,$getNextSiblingOrParentSibling:()=>PU,$handleIndentAndOutdent:()=>BU,$insertFirst:()=>zU,$insertNodeToNearestRoot:()=>_U,$insertNodeToNearestRootAtCaret:()=>qA,$isEditorIsNestedEditor:()=>HU,$lastToFirstIterator:()=>gy,$restoreEditorState:()=>NU,$reverseDfs:()=>kU,$reverseDfsIterator:()=>KA,$splitNode:()=>wP,$unwrapAndFilterDescendants:()=>UU,$unwrapNode:()=>VU,$wrapNodeInElement:()=>DU,CAN_USE_BEFORE_INPUT:()=>hU,CAN_USE_DOM:()=>FA,IS_ANDROID:()=>vU,IS_ANDROID_CHROME:()=>xU,IS_APPLE:()=>yU,IS_APPLE_WEBKIT:()=>CU,IS_CHROME:()=>bU,IS_FIREFOX:()=>BA,IS_IOS:()=>IU,IS_SAFARI:()=>SU,addClassNamesToElement:()=>au,calculateZoomLevel:()=>$U,isBlockDomNode:()=>lA,isHTMLAnchorElement:()=>uA,isHTMLElement:()=>wm,isInlineDomNode:()=>iu,isMimeType:()=>zA,makeStateWrapper:()=>WU,markSelection:()=>OA,mediaFileReader:()=>wU,mergeRegister:()=>ra,objectKlassEquals:()=>OU,positionNodeOnRange:()=>DA,registerNestedElementResolver:()=>RU,removeClassNamesFromElement:()=>Tm,selectionAlwaysOnDisplay:()=>gU});function Nm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,sU=Or&&"documentMode"in document?document.documentMode:null,NA=Or&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),lU=Or&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),dU=!(!Or||!("InputEvent"in window)||sU)&&"getTargetRanges"in new window.InputEvent("input"),cU=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),uU=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_A=Or&&/Android/.test(navigator.userAgent),my=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),fU=Or&&_A&&my,pU=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&NA&&!my;function aa(e){return`${e}px`}var mU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function DA(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Nm(182),r===null&&Nm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=EA(e,t);var h,g;s.isConnected||(g=s,(h=r).insertBefore(g,h.firstChild));let v=!1;for(let x=0;x<m.length;x++){let y=m[x],C=i[x]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let k=aa(y.left-f);w.left!==k&&(w.left=k,v=!0);let S=aa(y.top-p);w.top!==S&&(C.style.top=S,v=!0);let L=aa(y.width);w.width!==L&&(C.style.width=L,v=!0);let I=aa(y.height);w.height!==I&&(C.style.height=I,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[x]=C}for(;i.length>m.length;)i.pop();v&&n(i)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,s.remove();for(let f of i)f.remove();i=[]}s.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!wm(m))return d();d(),o=p,r=m,a=new MutationObserver(h=>{let g=e.getRootElement(),v=g&&g.parentElement;if(g!==o||v!==r)return f();for(let x of h)if(!s.contains(x.target))return l()}),a.observe(m,mU),l()});return()=>{c(),d()}}function MA(e,t,n){if(e.type!=="text"&&Ke(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[iA(n)||n,e.offset]}function OA(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=Oe();if(!we(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let T=I.getStartEndPoints();return I.isBackward()?[T[1],T[0]]:T})(f),h=p.getNode(),g=h.getKey(),v=p.offset,x=m.getNode(),y=x.getKey(),C=m.offset,w=e.getElementByKey(g),k=e.getElementByKey(y),S=n===null||w!==o||v!==r||g!==n.getKey(),L=a===null||k!==i||C!==s||y!==a.getKey();if((S||L)&&w!==null&&k!==null){let I=(function(T,E,A,N,R,$,H){let K=(T._window?T._window.document:document).createRange();return K.setStart(...MA(E,A,N)),K.setEnd(...MA(R,$,H)),K})(e,p,h,w,m,x,k);l(),l=DA(e,I,T=>{if(t===void 0)for(let E of T){let A=E.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==aa(-1.5)&&(A.marginTop=aa(-1.5)),A.paddingTop!==aa(4)&&(A.paddingTop=aa(4)),A.paddingBottom!==aa(0)&&(A.paddingBottom=aa(0))}else t(T)})}n=h,o=w,r=v,a=x,i=k,s=C})}return d(e.getEditorState()),ra(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function gU(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,i=e.getRootElement();a!==null&&i!==null&&i.contains(a)?n!==null&&(n(),n=null):n===null&&(n=OA(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var hU=dU,FA=Or,vU=_A,xU=fU,yU=NA,CU=pU,bU=my,BA=lU,IU=uU,SU=cU;function zA(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function wU(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],i=()=>{let{done:s,value:l}=n.next();if(s)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let c=d.result;typeof c=="string"&&a.push({file:l,result:c}),i()}),zA(l,t)?d.readAsDataURL(l):i()};i()})}function TU(e,t){return Array.from($A(e,t))}function LU(e){return e?e.getAdjacentCaret():null}function kU(e,t){return Array.from(KA(e,t))}function $A(e,t){return HA("next",e,t)}function RA(e,t){let n=Ns(Da(e,t));return n&&n[0]}function HA(e,t,n){let o=Ct(),r=t||o,a=Ke(r)?ki(r,e):Da(r,e),i=UA(r),s=n?qx(Wx(Da(n,e)))||RA(n,e):RA(r,e),l=i;return ey({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;eu(d)&&l++;let c=Ns(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function PU(e){let t=Ns(Da(e,"next"));return t&&[t[0].origin,t[1]]}function UA(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function AU(e){let t=Wx(Da(e,"previous")),n=Ns(t,"root");return n&&n[0].origin}function KA(e,t){return HA("previous",e,t)}function EU(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function MU(e){let t=_a(e,n=>Ke(n)&&!n.isInline());return Ke(t)||Nm(4,e.__key),t}function RU(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let i=(s=>{let l=s.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=s,c=s;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(i!==null){let{child:s,parent:l}=i;if(s.is(a)){o(l,a);let d=s.getNextSiblings(),c=d.length;if(l.insertAfter(s),c!==0){let f=n(l);s.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function NU(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,nm(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Rr(r===null?null:r.clone())}function _U(e){let t=Oe()||Zc(),n;if(we(t))n=jl(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=Da(s,"next"))}n=n||ki(Ct(),"previous").getFlipped().insert(ur())}let o=qA(e,n),r=qx(o),a=eu(r)?xP(r):o;return IP(cP(a)),e.getLatest()}function qA(e,t,n){let o=Vx(t,"next");for(let r=o;r;r=SP(r,n))o=r;return sm(o)&&Nm(283),o.insert(e.isInline()?ur().append(e):e),Vx(Da(e.getLatest(),"next"),t.direction)}function DU(e,t){let n=t();return e.replace(n),n.append(e),n}function OU(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function FU(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function BU(e){let t=Oe();if(!we(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],i=a.getKey();if(n.has(i))continue;let s=_a(a,d=>Ke(d)&&!d.isInline());if(s===null)continue;let l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function zU(e,t){ki(e,"next").insert(t)}var py=!(BA||!FA)&&void 0;function $U(e,t=!1){let n=1;if((function(){if(py===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),py=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return py})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function HU(e){return e._parentEditor!==null}function UU(e,t){return VA(e,t,null)}function VA(e,t,n){let o=!1;for(let r of gy(e))t(r)?n!==null&&n(r):(o=!0,Ke(r)&&VA(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function KU(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(Ke(r))for(let a of gy(r))o.push(a);return n}function qU(e){return WA(ki(e,"next"))}function gy(e){return WA(ki(e,"previous"))}function WA(e){return ey({hasNext:vP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function VU(e){bP(Da(e,"next")).splice(1,e.getChildren())}function WU(e){let t=o=>am(o,e),n=(o,r)=>dm(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Ve=hy,mre=Ve.$descendantsMatching,gre=Ve.$dfs,hre=Ve.$dfsIterator,vre=Ve.$filter,xre=Ve.$findMatchingParent,yre=Ve.$firstToLastIterator,Cre=Ve.$getAdjacentCaret,bre=Ve.$getAdjacentSiblingOrParentSiblingCaret,Ire=Ve.$getDepth,GA=Ve.$getNearestBlockElementAncestorOrThrow,Sre=Ve.$getNearestNodeOfType,wre=Ve.$getNextRightPreorderNode,Tre=Ve.$getNextSiblingOrParentSibling,jA=Ve.$handleIndentAndOutdent,Lre=Ve.$insertFirst,kre=Ve.$insertNodeToNearestRoot,Pre=Ve.$insertNodeToNearestRootAtCaret,Are=Ve.$isEditorIsNestedEditor,Ere=Ve.$lastToFirstIterator,Mre=Ve.$restoreEditorState,Rre=Ve.$reverseDfs,Nre=Ve.$reverseDfsIterator,_re=Ve.$splitNode,Dre=Ve.$unwrapAndFilterDescendants,Ore=Ve.$unwrapNode,Fre=Ve.$wrapNodeInElement,Bre=Ve.CAN_USE_BEFORE_INPUT,zre=Ve.CAN_USE_DOM,$re=Ve.IS_ANDROID,Hre=Ve.IS_ANDROID_CHROME,Ure=Ve.IS_APPLE,Kre=Ve.IS_APPLE_WEBKIT,qre=Ve.IS_CHROME,Vre=Ve.IS_FIREFOX,Wre=Ve.IS_IOS,Gre=Ve.IS_SAFARI,jre=Ve.addClassNamesToElement,Qre=Ve.calculateZoomLevel,vy=Ve.isBlockDomNode,Xre=Ve.isHTMLAnchorElement,QA=Ve.isHTMLElement,Yre=Ve.isInlineDomNode,Jre=Ve.isMimeType,Zre=Ve.makeStateWrapper,eae=Ve.markSelection,tae=Ve.mediaFileReader,Fa=Ve.mergeRegister,su=Ve.objectKlassEquals,nae=Ve.positionNodeOnRange,oae=Ve.registerNestedElementResolver,rae=Ve.removeClassNamesFromElement,aae=Ve.selectionAlwaysOnDisplay;var xy={};An(xy,{ContentEditable:()=>jU,ContentEditableElement:()=>JA});me();var YA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function GU({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:i,ariaInvalid:s,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:h,id:g,role:v="textbox",spellCheck:x=!0,style:y,tabIndex:C,"data-testid":w,...k},S){let[L,I]=G(e.isEditable()),T=B(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),E=z(()=>(function(...A){return N=>{for(let R of A)typeof R=="function"?R(N):R!=null&&(R.current=N)}})(S,T),[T,S]);return YA(()=>(I(e.isEditable()),e.registerEditableListener(A=>{I(A)})),[e]),u("div",{"aria-activedescendant":L?t:void 0,"aria-autocomplete":L?n:"none","aria-controls":L?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":L&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":L?f:void 0,"aria-readonly":!L||void 0,"aria-required":p,autoCapitalize:m,className:h,contentEditable:L,"data-testid":w,id:g,ref:E,role:v,spellCheck:x,style:y,tabIndex:C,...k})}var JA=Wn(GU);function XA(e){return e.getEditorState().read(Pm(e.isComposing()))}var jU=Wn(QU);function QU(e,t){let{placeholder:n,...o}=e,[r]=In();return b(be,{children:[u(JA,{editor:r,...o,ref:t}),n!=null&&u(XU,{editor:r,content:n})]})}function XU({content:e,editor:t}){let n=(function(i){let[s,l]=G(()=>XA(i));return YA(()=>{function d(){let c=XA(i);l(c)}return d(),Fa(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=G(t.isEditable());if(ye(()=>(r(t.isEditable()),t.registerEditableListener(i=>{r(i)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:u("div",{"aria-hidden":!0,children:a})}var ZA=xy,eE=ZA.ContentEditable,fae=ZA.ContentEditableElement;me();var YU=Ht(null),yy={didCatch:!1,error:null},_m=class extends Ui{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=yy}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(yy))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&JU(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(yy))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:i}=this.state,s=t;if(a){let l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")s=n(l);else if(o)s=Te(o,l);else if(r!==void 0)s=r;else throw i}return Te(YU.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function JU(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Cy={};An(Cy,{LexicalErrorBoundary:()=>ZU});function ZU({children:e,onError:t}){return u(_m,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var e3=Cy,tE=e3.LexicalErrorBoundary;var Dy={};An(Dy,{$createHorizontalRuleNode:()=>_y,$isDecoratorTextNode:()=>gE,$isHorizontalRuleNode:()=>bE,AutoFocusExtension:()=>o3,ClearEditorExtension:()=>r3,DecoratorTextExtension:()=>c3,DecoratorTextNode:()=>cu,EditorStateExtension:()=>Bm,HorizontalRuleExtension:()=>b3,HorizontalRuleNode:()=>Fs,INSERT_HORIZONTAL_RULE_COMMAND:()=>y3,InitialStateExtension:()=>yE,LexicalBuilder:()=>td,NodeSelectionExtension:()=>Ey,TabIndentationExtension:()=>I3,applyFormatFromStyle:()=>i3,applyFormatToDom:()=>s3,batch:()=>sE,buildEditorFromExtensions:()=>m3,computed:()=>cE,configExtension:()=>Im,declarePeerDependency:()=>aA,defineExtension:()=>Mn,effect:()=>Ai,getExtensionDependencyFromEditor:()=>h3,getKnownTypesAndNodes:()=>a3,getPeerDependencyFromEditor:()=>CE,getPeerDependencyFromEditorOrThrow:()=>v3,namedSignals:()=>$m,registerClearEditor:()=>pE,registerTabIndentation:()=>SE,safeCast:()=>Dr,shallowMergeConfig:()=>Lm,signal:()=>ed,untracked:()=>Ly,watchedSignal:()=>Ry});var t3=Symbol.for("preact-signals");function zm(){if(Pi>1)return void Pi--;let e,t=!1;for(;du!==void 0;){let n=du;for(du=void 0,ky++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&lE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(ky=0,Pi--,t)throw e}function sE(e){if(Pi>0)return e();Pi++;try{return e()}finally{zm()}}var At,du;function Ly(e){let t=At;At=void 0;try{return e()}finally{At=t}}var Pi=0,ky=0,Fm=0;function nE(e){if(At===void 0)return;let t=e.n;return t===void 0||t.t!==At?(t={i:0,S:e,p:At.s,n:void 0,t:At,e:void 0,x:void 0,r:t},At.s!==void 0&&(At.s.n=t),At.s=t,e.n=t,32&At.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=At.s,t.n=void 0,At.s.n=t,At.s=t),t):void 0}function Po(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function ed(e,t){return new Po(e,t)}function lE(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function oE(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function dE(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Os(e,t){Po.call(this,void 0),this.x=e,this.s=void 0,this.g=Fm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function cE(e,t){return new Os(e,t)}function uE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Pi++;let n=At;At=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,My(e),o}finally{At=n,zm()}}}function My(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,uE(e)}function n3(e){if(At!==this)throw new Error("Out-of-order effect");dE(this),At=e,this.f&=-2,8&this.f&&My(this),zm()}function Zl(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}function Ai(e,t){let n=new Zl(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function $m(e,t={}){let n={};for(let o in e){let r=t[o],a=ed(r===void 0?e[o]:r);n[o]=a}return n}Po.prototype.brand=t3,Po.prototype.h=function(){return!0},Po.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:Ly(()=>{var n;(n=this.W)==null||n.call(this)}))},Po.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Ly(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Po.prototype.subscribe=function(e){return Ai(()=>{let t=this.value,n=At;At=void 0;try{e(t)}finally{At=n}},{name:"sub"})},Po.prototype.valueOf=function(){return this.value},Po.prototype.toString=function(){return this.value+""},Po.prototype.toJSON=function(){return this.value},Po.prototype.peek=function(){let e=At;At=void 0;try{return this.value}finally{At=e}},Object.defineProperty(Po.prototype,"value",{get(){let e=nE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(ky>100)throw new Error("Cycle detected");this.v=e,this.i++,Fm++,Pi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{zm()}}}}),Os.prototype=new Po,Os.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Fm))return!0;if(this.g=Fm,this.f|=1,this.i>0&&!lE(this))return this.f&=-2,!0;let e=At;try{oE(this),At=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return At=e,dE(this),this.f&=-2,!0},Os.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Po.prototype.S.call(this,e)},Os.prototype.U=function(e){if(this.t!==void 0&&(Po.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Os.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Os.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=nE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Zl.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},Zl.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,uE(this),oE(this),Pi++;let e=At;return At=this,n3.bind(this,e)},Zl.prototype.N=function(){2&this.f||(this.f|=2,this.o=du,du=this)},Zl.prototype.d=function(){this.f|=8,1&this.f||My(this)},Zl.prototype.dispose=function(){this.d()};var o3=Mn({build:(e,t,n)=>$m(t),config:Dr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Ai(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function fE(){let e=Ct(),t=Oe(),n=ur();e.clear(),e.append(n),t!==null&&n.select(),we(t)&&(t.format=0)}function pE(e,t=fE){return e.registerCommand(cm,n=>(e.update(t),!0),Xt)}var r3=Mn({build:(e,t,n)=>$m(t),config:Dr({$onClear:fE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Ai(()=>pE(e,o.value))}});function a3(e){let t=new Set,n=new Set;for(let o of mE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function mE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var by=rA("format",{parse:e=>typeof e=="number"?e:0}),cu=class extends Oa{$config(){return this.config("decorator-text",{extends:Oa,stateConfigs:[{flat:!0,stateConfig:by}]})}getFormat(){return am(this,by)}getFormatFlags(t,n){return ty(this.getFormat(),t,n)}hasFormat(t){let n=eA[t];return(this.getFormat()&n)!==0}setFormat(t){return dm(this,by,t)}toggleFormat(t){let n=this.getFormat(),o=ty(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function gE(e){return e instanceof cu}function i3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function s3(e,t,n=d3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=l3(t,o));return t}function l3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var d3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},c3=Mn({name:"@lexical/extension/DecoratorText",nodes:()=>[cu],register:(e,t,n)=>e.registerCommand(FP,o=>{let r=Oe();if(Gx(r)||we(r))for(let a of r.getNodes())gE(a)&&a.toggleFormat(o);return!1},Yl)});function Ry(e,t){let n;return ed(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Bm=Mn({build:e=>Ry(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Ft(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function hE(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=hE(n[r],o[r]);return e}return t}var Ny=0,Py=1,vE=2,Iy=3,Dm=4,Jl=5,Sy=6,lu=7;function wy(e){return e.id===Ny}function xE(e){return e.id===vE}function u3(e){return(function(t){return t.id===Py})(e)||Ft(305,String(e.id),String(Py)),Object.assign(e,{id:vE})}var f3=new Set,Ay=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Ny}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Lm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;xE(n)||Ft(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(s,l,d){return Object.assign(s,{config:l,id:Iy,registerState:d})})(n,this.mergeConfigs(),o),i;this.state=a,this.extension.init&&(i=this.extension.init(t,a.config,o)),this.state=(function(s,l,d){return Object.assign(s,{id:Dm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Dm&&Ft(307,String(n.id),String(Jl)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,i,s){return Object.assign(a,{id:Jl,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Jl&&Ft(308,String(o.id),String(Jl));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Sy})})(o),()=>{let a=this.state;a.id!==lu&&Ft(309,String(o.id),String(lu)),this.state=(function(i){return Object.assign(i,{id:Jl})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Sy&&Ft(310,String(n.id),String(Sy)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:lu})})(n),o}getSignal(){return this._signal===void 0&&Ft(311),this._signal}getInitResult(){this.extension.init===void 0&&Ft(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Dm})(t)||Ft(313,String(t.id),String(Dm)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Iy})(t)||Ft(314,String(t.id),String(Iy)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=lu})(t)||Ft(316,String(t.id),String(lu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||f3}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=Jl})(t)||Ft(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},rE={tag:_r};function p3(){let e=Ct();e.isEmpty()&&e.append(ur())}var yE=Mn({config:Dr({setOptions:rE,updateOptions:rE}),init:({$initialEditorState:e=p3})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(pP(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let i=e.parseEditorState(a);e.setEditorState(i,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[YP,bm,VP,tA,jP]}),aE=Symbol.for("@lexical/extension/LexicalBuilder");function m3(...e){return td.fromExtensions(e).buildEditor()}function iE(){}function g3(e){throw e}function Om(e){return Array.isArray(e)?e:[e]}var Ty="0.41.0+prod.esm",td=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Ty,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Om(yE)];for(let o of t)n.push(Om(o));return new e(n)}static maybeFromEditor(t){let n=t[aE];return n&&(n.PACKAGE_VERSION!==Ty&&Ft(292,n.PACKAGE_VERSION,Ty),n instanceof e||Ft(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ft(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Sm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[aE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=iE;function n(){try{t()}finally{t=iE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ra(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Ft(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Ft(296);let n=Om(t),[o]=n;typeof o.name!="string"&&Ft(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Ft(298,o.name),!r){r=new Ay(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Ft(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Ft(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Om(i);this.addEdge(o.name,s[0].name,s.slice(1)),this.addExtension(s)}for(let[i,s]of o.peerDependencies||[])this.addEdge(o.name,i,s?[s]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(xE(a))return;let i=o.extension.name;var s;wy(a)||Ft(300,i,r||"[unknown]"),wy(s=a)||Ft(304,String(s.id),String(Ny)),a=Object.assign(s,{id:Py}),o.state=a;let l=this.outgoingConfigEdges.get(i);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,i)}a=u3(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())wy(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let i=this.extensionNameMap.get(r);if(i)for(let s of a)i.configs.add(s)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Ft(301,o.name);for(let i of r)a.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let i of n){let s=i.register(t,a);s&&r.push(s)}for(let i of n){let s=i.afterRegistration(t);s&&r.push(s)}return ra(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},i={},s=this.sortedExtensionReps();for(let c of s){let{extension:f}=c;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of mE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Ft(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,c)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&hE(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let c of s)c.init(t);return t.onError||(t.onError=g3),t}};function h3(e,t){let n=td.fromEditor(e).getExtensionRep(t);return n===void 0&&Ft(303,t.name),n.getExtensionDependency()}function CE(e,t){let n=td.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function v3(e,t){let n=CE(e,t);return n===void 0&&Ft(291,t),n}var x3=new Set,Ey=Mn({build(e,t,n){let o=n.getDependency(Bm).output,r=ed({watchedNodeKeys:new Map}),a=Ry(()=>{},()=>Ai(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(Oe())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=rm(c),m=p&&p.isSelected()||!1;d=d||m!==(!!i&&i.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&i&&l.size===i.size||(a.value=l)}));return{watchNodeKey:function(i){let s=cE(()=>(a.value||x3).has(i)),{watchedNodeKeys:l}=r.peek(),d=l.get(i),c=d!==void 0;return d=d||new Set,d.add(s),c||(l.set(i,d),r.value={watchedNodeKeys:l}),s}}},dependencies:[Bm],name:"@lexical/extension/NodeSelection"}),y3=oA("INSERT_HORIZONTAL_RULE_COMMAND"),Fs=class e extends Oa{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return _y().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:C3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return au(n,t.theme.hr),n}getTextContent(){return`
3710
+ `}isInline(){return!1}updateDOM(){return!1}};function C3(){return{node:_y()}}function _y(){return oP(Fs)}function bE(e){return e instanceof Fs}var b3=Mn({dependencies:[Bm,Ey],name:"@lexical/extension/HorizontalRule",nodes:()=>[Fs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Ey).output,r=ed({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ra(e.registerCommand(kP,i=>{if(cA(i.target)){let s=uP(i.target);if(bE(s))return(function(l,d=!1){let c=Oe(),f=l.isSelected(),p=l.getKey(),m;d&&Gx(c)?m=c:(m=rP(),Rr(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},Yl),e.registerMutationListener(Fs,(i,s)=>{sE(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of i.entries())if(f==="destroyed")d.delete(c),l=!0;else{let p=d.get(c),m=e.getElementByKey(c);p?p.domNode.value=m:(l=!0,d.set(c,{domNode:ed(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Ai(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Ai(()=>{let d=s.value;d&&(l.value?au(d,a):Tm(d,a))}));return ra(...i)}))}});function IE(e){return e.canBeEmpty()}function SE(e,t,n=IE){return ra(e.registerCommand(ym,o=>{let r=Oe();if(!we(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>Ql(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=GA(c);if(f.canIndent()){let p=f.getKey(),m=Rs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=yP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?WP:Xx:$P;return e.dispatchCommand(a,void 0)},Xt),e.registerCommand(Xx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Oe();if(!we(r))return!1;let a=typeof n=="function"?n:n.peek();return jA(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},um))}var I3=Mn({build:(e,t,n)=>$m(t),config:Dr({$canIndent:IE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Ai(()=>{if(!o.value)return SE(e,r,a)})}});var gt=Dy,Iae=gt.$createHorizontalRuleNode,Sae=gt.$isDecoratorTextNode,wae=gt.$isHorizontalRuleNode,Tae=gt.AutoFocusExtension,Lae=gt.ClearEditorExtension,kae=gt.DecoratorTextExtension,Pae=gt.DecoratorTextNode,Aae=gt.EditorStateExtension,Eae=gt.HorizontalRuleExtension,Mae=gt.HorizontalRuleNode,Rae=gt.INSERT_HORIZONTAL_RULE_COMMAND,Nae=gt.InitialStateExtension,wE=gt.LexicalBuilder,_ae=gt.NodeSelectionExtension,Dae=gt.TabIndentationExtension,Oae=gt.applyFormatFromStyle,Fae=gt.applyFormatToDom,TE=gt.batch,Bae=gt.buildEditorFromExtensions,zae=gt.computed,$ae=gt.configExtension,Hae=gt.declarePeerDependency,Uae=gt.defineExtension,uu=gt.effect,Kae=gt.getExtensionDependencyFromEditor,qae=gt.getKnownTypesAndNodes,LE=gt.getPeerDependencyFromEditor,Vae=gt.getPeerDependencyFromEditorOrThrow,Hm=gt.namedSignals,Wae=gt.registerClearEditor,Gae=gt.registerTabIndentation,jae=gt.safeCast,Qae=gt.shallowMergeConfig,Xae=gt.signal,Yae=gt.untracked,Jae=gt.watchedSignal;var Oy={};An(Oy,{HistoryExtension:()=>Um,SharedHistoryExtension:()=>T3,createEmptyHistoryState:()=>AE,registerHistory:()=>PE});function S3(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,i=e._selection;if(r)return 1;if(!(we(a)&&we(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(x,y,C){let w=x._nodeMap,k=[];for(let S of y){let L=w.get(S);L!==void 0&&k.push(L)}for(let[S,L]of C){if(!L)continue;let I=w.get(S);I===void 0||tu(I)||k.push(I)}return k})(t,n,o);if(s.length===0)return 0;if(s.length>1){let x=t._nodeMap,y=x.get(a.anchor.key),C=x.get(i.anchor.key);return y&&C&&!e._nodeMap.has(y.__key)&&tt(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!tt(d)||!tt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=i.anchor;if(p.key!==m.key||p.type!=="text")return 0;let h=p.offset,g=m.offset,v=f.length-c.length;return v===1&&g===h-1?2:v===-1&&g===h+1?3:v===-1&&g===h?4:0}function w3(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,i=null;return(s,l,d,c,f,p)=>{let m=Date.now();if(p.has(AP)&&(r=n,a=o,i=s),p.has(mm))return o=0,n=m,2;p.has(PP)&&i&&(n=r,o=a,s=i);let h=S3(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(BP);if(!x&&v&&p.has(_r))return 0;if(h===1)return 2;if(s===null)return 1;let y=l._selection;if(!(c.size>0||f.size>0))return y!==null?0:2;let C=typeof t=="number"?t:t.peek();return x===!1&&h!==0&&h===o&&m<n+C&&v||c.size===1&&(function(w,k,S){let L=k._nodeMap.get(w),I=S._nodeMap.get(w),T=k._selection,E=S._selection;return!(we(T)&&we(E)&&T.anchor.type==="element"&&T.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!tt(L)||!tt(I)||L.__parent!==I.__parent)&&JSON.stringify(k.read(()=>L.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=h,g}}function kE(e){e.undoStack=[],e.redoStack=[],e.current=null}function PE(e,t,n){let o=w3(e,n);return Fa(e.registerCommand(nA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(l.length!==0){let d=i.current,c=l.pop();d!==null&&(s.push(d),a.dispatchCommand(nu,!0)),l.length===0&&a.dispatchCommand(ou,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:mm})}})(e,t),!0),Xt),e.registerCommand(QP,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(s.length!==0){let d=i.current;d!==null&&(l.push(d),a.dispatchCommand(ou,!0));let c=s.pop();s.length===0&&a.dispatchCommand(nu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:mm})}})(e,t),!0),Xt),e.registerCommand(cm,()=>(kE(t),!1),Xt),e.registerCommand(LP,()=>(kE(t),e.dispatchCommand(nu,!1),e.dispatchCommand(ou,!1),!0),Xt),e.registerUpdateListener(({editorState:a,prevEditorState:i,dirtyLeaves:s,dirtyElements:l,tags:d})=>{let c=t.current,f=t.redoStack,p=t.undoStack,m=c===null?null:c.editorState;if(c!==null&&a===m)return;let h=o(i,a,c,s,l,d);if(h===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(nu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(ou,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function AE(){return{current:null,redoStack:[],undoStack:[]}}var Um=Mn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Hm({delay:t,disabled:o,historyState:n(e)}),config:Dr({createInitialHistoryState:AE,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return uu(()=>o.disabled.value?void 0:PE(e,o.historyState.value,o.delay))}}),T3=Mn({dependencies:[Im(Um,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(Um),r=(function(i){return i?LE(i,Um.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return uu(()=>TE(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Km=Oy,oie=Km.HistoryExtension,rie=Km.SharedHistoryExtension,qm=Km.createEmptyHistoryState,EE=Km.registerHistory;var Fy={};An(Fy,{HistoryPlugin:()=>L3,createEmptyHistoryState:()=>qm});me();function L3({delay:e,externalHistoryState:t}){let[n]=In();return(function(o,r,a=1e3){let i=z(()=>r||qm(),[r]);q(()=>EE(o,i,a),[a,o,i])})(n,t,e),null}var ME=Fy,RE=ME.HistoryPlugin,NE=ME.createEmptyHistoryState;var By={};An(By,{OnChangePlugin:()=>P3});me();var k3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function P3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=In();return k3(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:i,prevEditorState:s,tags:l})=>{t&&a.size===0&&i.size===0||e&&l.has(_r)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var A3=By,_E=A3.OnChangePlugin;var zy={};An(zy,{useLexicalEditable:()=>R3});me();var E3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function M3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function R3(){return(function(e){let[t]=In(),n=z(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=_(o);return E3(()=>{let{initialValueFn:i,subscribe:s}=n,l=i();return a.current!==l&&(a.current=l,r(l)),s(d=>{a.current=d,r(d)})},[n,e]),o})(M3)}var N3=zy,DE=N3.useLexicalEditable;var $y={};An($y,{ReactProviderExtension:()=>_3});var _3=Mn({name:"@lexical/react/ReactProvider"});var D3=$y,OE=D3.ReactProviderExtension;var Hy={};An(Hy,{DragonExtension:()=>O3,registerDragonSupport:()=>FE});function FE(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let i;try{i=JSON.parse(a)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){let s=i.payload;if(s&&s.functionId==="makeChanges"){let l=s.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let h=Oe();if(we(h)){let g=h.anchor,v=g.getNode(),x=0,y=0;if(tt(v)&&d>=0&&c>=0&&(x=d,y=d+c,h.setTextNodeRange(v,x,v,y)),x===y&&f===""||(h.insertRawText(f),v=g.getNode()),tt(v)){x=p,y=p+m;let C=v.getTextContentSize();x=x>C?C:x,y=y>C?C:y,h.setTextNodeRange(v,x,v,y)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var O3=Mn({build:(e,t,n)=>Hm(t),config:Dr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>uu(()=>n.getOutput().disabled.value?void 0:FE(e))});var BE=Hy,zE=BE.DragonExtension,$E=BE.registerDragonSupport;var Uy={};An(Uy,{$generateHtmlFromNodes:()=>B3,$generateNodesFromDOM:()=>F3});function F3(e,t){let n=dA(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!UE.has(a.nodeName)){let i=KE(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof Qx&&i.insertAfter(Ms());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function B3(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Ct().getChildren();for(let r=0;r<o.length;r++)HE(e,o[r],n,t);return n.innerHTML}function HE(e,t,n,o=null){let r=o===null||t.isSelected(o),a=Ke(t)&&t.excludeFromCopy("html"),i=t;o!==null&&tt(t)&&(i=Rm(o,t,"clone"));let s=Ke(i)?i.getChildren():[],l=sA(e,i.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,i):i.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<s.length;m++){let h=s[m],g=HE(e,h,p,o);!r&&Ke(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((QA(c)||Zx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(Zx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var UE=new Set(["STYLE","SCRIPT"]);function KE(e,t,n,o,r=new Map,a){let i=[];if(UE.has(e.nodeName))return i;let s=null,l=(function(h,g){let{nodeName:v}=h,x=g._htmlConversions.get(v.toLowerCase()),y=null;if(x!==void 0)for(let C of x){let w=C(h);w!==null&&(y===null||(y.priority||0)<=(w.priority||0))&&(y=w)}return y!==null?y.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let h=d.node;if(s=Array.isArray(h)?h[h.length-1]:h,s!==null){for(let[,g]of r)if(s=g(s,a),!s)break;s&&i.push(...Array.isArray(h)?h:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!_s(s))&&(s!=null&&Ql(s)||o);for(let h=0;h<f.length;h++)p.push(...KE(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),vy(e)&&(p=z3(e,p,m?()=>{let h=new Qx;return n.push(h),h}:ur)),s==null?p.length>0?i=i.concat(p):vy(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:iu(h.nextSibling)&&iu(h.previousSibling)})(e)&&(i=i.concat(Ms())):Ke(s)&&s.append(...p),i}function z3(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(Ql(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&Ql(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var qE=Uy,VE=qE.$generateHtmlFromNodes,WE=qE.$generateNodesFromDOM;var qy={};An(qy,{$generateJSONFromSelectedNodes:()=>YE,$generateNodesFromSerializedNodes:()=>JE,$getClipboardDataFromSelection:()=>eM,$getHtmlContent:()=>jE,$getLexicalContent:()=>QE,$insertDataTransferForPlainText:()=>$3,$insertDataTransferForRichText:()=>H3,$insertGeneratedNodes:()=>Ky,copyToClipboard:()=>U3,setLexicalClipboardDataTransfer:()=>tM});function Vm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jE(e,t=Oe()){return t==null&&Vm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?"":VE(e,t)}function QE(e,t=Oe()){return t==null&&Vm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(YE(e,t))}function $3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function H3(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let s=JSON.parse(o);if(s.namespace===n._config.namespace&&Array.isArray(s.nodes))return Ky(n,JE(s.nodes),t)}catch(s){console.error(s)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let s=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return Ky(n,WE(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(we(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=Oe();if(we(d)){let c=s[l];c===`
3711
3711
  `||c===`\r
3712
- `?d.insertParagraph():c===" "?d.insertNodes([aP()]):d.insertText(c)}}}else t.insertRawText(i)}function Ky(e,t,n){e.dispatchCommand(YP,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(we(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=Yl(r,"previous");if(i)if(dm(i))a=i.origin;else{let s=sP(i,Ei(Ct(),"next").getFlipped());for(let l of s){if(nt(l.origin)){a=l.origin;break}if(Ue(l.origin)&&!l.origin.isInline())break}}if(a&&nt(a)){let s=a.getFormat(),l=a.getStyle();o.format===s&&o.style===l||(o.format=s,o.style=l,o.dirty=!0)}}})(n))}function QE(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=Ue(n)&&n.excludeFromCopy("html"),i=n;t!==null&&nt(i)&&(i=_m(t,i,"clone"));let s=Ue(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Gm(58,f.name),Ue(d)){let p=c.children;Array.isArray(p)||Gm(59,f.name)}return c})(i);nt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=QE(e,t,c,l.children);!r&&Ue(n)&&f&&n.extractWithChild(c,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let c=l.children[d];o.push(c)}return r}function XE(e,t){let n=[],o=Ct().getChildren();for(let r=0;r<o.length;r++)QE(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function YE(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=yP(o);nt(r)&&PA(r),t.push(r)}return t}var ad=null;async function $3(e,t,n){if(ad!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(WE(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=Jx(r);if(o===null||i===null)return!1;let s=a.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(a.createTextNode("#")),o.append(s);let l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(mm,p=>(uu(p,ClipboardEvent)&&(f(),ad!==null&&(r.clearTimeout(ad),ad=null),d(WE(e,p,n))),!0),pm);ad=r.setTimeout(()=>{f(),ad=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function WE(e,t,n){if(n===void 0){let r=Jx(e._window),a=De();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!uA(e,i,s))return!1;n=ZE(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(eM(o,n),!0)}var JE=[["text/html",GE],["application/x-lexical-editor",jE]];function ZE(e=De()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=am();for(let[o,r]of JE){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function eM(e,t){for(let[n]of JE)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var da=qy,Aie=da.$generateJSONFromSelectedNodes,Eie=da.$generateNodesFromSerializedNodes,Mie=da.$getClipboardDataFromSelection,tM=da.$getHtmlContent,Rie=da.$getLexicalContent,Vy=da.$insertDataTransferForPlainText,Nie=da.$insertDataTransferForRichText,_ie=da.$insertGeneratedNodes,Die=da.copyToClipboard,Oie=da.setLexicalClipboardDataTransfer;var Wy={};Tn(Wy,{PlainTextExtension:()=>G3,registerPlainText:()=>rM});var zs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,H3=zs&&"documentMode"in document?document.documentMode:null,U3=zs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),K3=!(!zs||!("InputEvent"in window)||H3)&&"getTargetRanges"in new window.InputEvent("input"),q3=zs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),nM=zs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,V3=zs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),W3=zs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&U3&&!V3;function oM(e,t){t.update(()=>{if(e!==null){let n=uu(e,KeyboardEvent)?null:e.clipboardData,o=De();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=tM(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function rM(e){return Ua(e.registerCommand(gm,t=>{let n=De();return!!we(n)&&(n.deleteCharacter(t),!0)},Xt),e.registerCommand(RP,t=>{let n=De();return!!we(n)&&(n.deleteWord(t),!0)},Xt),e.registerCommand(MP,t=>{let n=De();return!!we(n)&&(n.deleteLine(t),!0)},Xt),e.registerCommand(AP,t=>{let n=De();if(!we(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Vy(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Xt),e.registerCommand(QP,()=>{let t=De();return!!we(t)&&(t.removeText(),!0)},Xt),e.registerCommand(Yx,t=>{let n=De();return!!we(n)&&(n.insertLineBreak(t),!0)},Xt),e.registerCommand(BP,()=>{let t=De();return!!we(t)&&(t.insertLineBreak(),!0)},Xt),e.registerCommand(vm,t=>{let n=De();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!0)&&(o.preventDefault(),uy(n,r,!0),!0)},Xt),e.registerCommand(xm,t=>{let n=De();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!1)&&(o.preventDefault(),uy(n,r,!1),!0)},Xt),e.registerCommand(ym,t=>{let n=De();return!!we(n)&&(!nM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(gm,!0))},Xt),e.registerCommand(UP,t=>{let n=De();return!!we(n)&&(t.preventDefault(),e.dispatchCommand(gm,!1))},Xt),e.registerCommand(Cm,t=>{let n=De();if(!we(n))return!1;if(t!==null){if((nM||q3||W3)&&K3)return!1;t.preventDefault()}return e.dispatchCommand(Yx,!1)},Xt),e.registerCommand(JP,()=>(cm(),!0),Xt),e.registerCommand(mm,t=>{let n=De();return!!we(n)&&(oM(t,e),!0)},Xt),e.registerCommand(EP,t=>{let n=De();return!!we(n)&&((function(o,r){oM(o,r),r.update(()=>{let a=De();we(a)&&a.removeText()})})(t,e),!0)},Xt),e.registerCommand(Im,t=>{let n=De();return!!we(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=De(),i=uu(o,ClipboardEvent)?o.clipboardData:null;i!=null&&we(a)&&Vy(i,a)},{tag:WP})})(t,e),!0)},Xt),e.registerCommand(_P,t=>{let n=De();return!!we(n)&&(t.preventDefault(),!0)},Xt),e.registerCommand(NP,t=>{let n=De();return!!we(n)&&(t.preventDefault(),!0)},Xt))}var G3=kn({conflictsWith:["@lexical/rich-text"],dependencies:[BE],name:"@lexical/plain-text",register:rM});var aM=Wy,Kie=aM.PlainTextExtension,iM=aM.registerPlainText;var jy={};Tn(jy,{PlainTextPlugin:()=>Y3});me();var jm=kd(vc(),1);function j3(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Gy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function Q3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return Gy(()=>n.registerDecoratorListener(i=>{(0,jm.flushSync)(()=>{a(i)})}),[n]),q(()=>{a(n.getDecorators())},[n]),z(()=>{let i=[],s=Object.keys(r);for(let l=0;l<s.length;l++){let d=s[l],c=u(o,{onError:p=>n._onError(p),children:u(ih,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,jm.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function X3({editor:e,ErrorBoundary:t}){return(function(n){let o=SE.maybeFromEditor(n);if(o&&o.hasExtensionByName(DE.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&j3(320,r);return!0}return!1})(e)?null:u(Q3,{editor:e,ErrorBoundary:t})}function sM(e){return e.getEditorState().read(Em(e.isComposing()))}function Y3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=Cn();return(function(r){Gy(()=>Ua(iM(r),zE(r)),[r])})(o),b(be,{children:[e,u(J3,{content:t}),u(X3,{editor:o,ErrorBoundary:n})]})}function J3({content:e}){let[t]=Cn(),n=(function(r){let[a,i]=G(()=>sM(r));return Gy(()=>{function s(){let l=sM(r);i(l)}return s(),Ua(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=_E();return n?typeof e=="function"?e(o):e:null}var Z3=jy,lM=Z3.PlainTextPlugin;me();function dM(e){return/mac|iphone|ipad|ipod/i.test(e)}function hu(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function vu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function cM(e){let t=vu(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}me();var Qm=ue(function(t){let n=Ot().pierreIcons,o=n.useSpriteReady();Pd(n.ensureSprite,[n]);let r=z(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:F("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(ii,{className:F("size-4 shrink-0 text-icon-muted",t.className)}):u(Bd,{className:F("size-4 shrink-0 text-icon-muted",t.className)})});var uM=vi;function fM(e){return b(be,{children:[u(Qm,{pathValue:e.path,kind:cM(e.path),theme:e.theme,className:na}),u("span",{className:e.selectable?vT:oa,children:e.label})]})}function pM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Xe,{children:[u(Je,{render:b("span",{className:F(vi,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(La,{className:F(na,"size-icon-1",o&&"opacity-100")}),u("span",{className:oa,children:t})]})}),u(Ye,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function mM({context:e}){let{t}=_e(),n=Ww(e),o=Vw(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(pM,{label:n,tooltipText:r,expired:o})}function eK(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function tK(e){return e.replaceAll("\\","/")}function ca(e){let t=e.displayName?.trim();return t||eK(e.name)}function gM(e,t){return t?e.filter(n=>n.enabled):[]}function hM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function vM(e){let t=tK(e.path);if(t.includes("/.codex/plugins/")||t.includes("/.agents/plugins/"))return"app";switch(e.scope?.trim().toLowerCase()){case"repo":case"repository":return"repo";case"project":case"workspace":case"local":return"project";case"user":case"personal":return"personal";case"system":return"system";case void 0:case"":return"other";default:return"other"}}function xM(e,t){return e.registerCommand(Im,n=>{if(!(n instanceof ClipboardEvent)||n.clipboardData===null||n.clipboardData.files.length>0)return!1;let o=n.clipboardData.getData("text/plain");if(o.length===0)return!1;let r=Pc(`${o}
3713
- `).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=De();if(!we(a))return!1;let i=[],s=c=>{let f=c.split(`
3714
- `);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(Dr(m)),p<f.length-1&&i.push(Rs())}},l=r[0];if(l&&l.start===0){let c=a.isBackward()?a.focus:a.anchor,f=t.getExpandedAbsoluteOffsetForPoint(c.getNode(),c.offset),p=Ct().getTextContent().slice(f-1,f);p.length>0&&!/\s/.test(p)&&i.push(Dr(" "))}let d=0;for(let c of r)c.start<d||(c.start>d&&s(o.slice(d,c.start)),i.push(t.createMentionNode(c.value)),d=c.end);return d<o.length?s(o.slice(d)):i.push(Dr(" ")),a.insertNodes(i),n.preventDefault(),!0},Fr)}var id=new Map,nK=32;function yM(e,t){for(id.delete(e),id.set(e,t);id.size>nK;){let n=id.keys().next().value;if(n===void 0)break;id.delete(n)}}function oK(e){return{anchor:e.length,focus:e.length}}function Ka(e,t,n){let o=id.get(e);if(o)return yM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:oK(t),history:RE()};return yM(e,r),r}function sd(e,t,n){let o=Ka(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function CM(e,t,n,o){let r=Ka(e,t);r.cursor=n,r.expandedCursor=o}function bM(e,t){let n=e.current,o=[...e.undoStack],r=[...e.redoStack];t(),e.current=n,e.undoStack.splice(0,e.undoStack.length,...o),e.redoStack.splice(0,e.redoStack.length,...r)}var rK=`composer-editor-${Math.random().toString(36).slice(2)}`,aK=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],LM=new Map(aK),IM=LM.get("`")??null,kM=Ht({onRemoveTerminalContext:()=>{}});function iK(e){let t=cK(),n=u("span",{className:uM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(fM,{path:e.path,label:vu(e.path),theme:t})});return b(Xe,{children:[u(Je,{render:n}),u(Ye,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var xu=class e extends Ha{__path;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__key)}static importJSON(t){return Jy(t.path).updateFromJSON(t)}constructor(t,n){super(n),this.__path=t}exportJSON(){return{...super.exportJSON(),path:this.__path,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=gp,t}updateDOM(){return!1}getTextContent(){return kc(this.__path)}isInline(){return!0}decorate(){return u(iK,{path:this.__path})}};function Jy(e){return om(new xu(e))}function sK(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function yu(e){return new Map(e.map(t=>[t.name,{label:ca(t),description:sK(t)}]))}function lK(e){let t=b("span",{className:xT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:na,dangerouslySetInnerHTML:{__html:yT}}),u("span",{className:oa,children:e.skillLabel})]});return e.skillDescription?b(Xe,{children:[u(Je,{render:t}),u(Ye,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var Cu=class e extends Ha{__skillName;__skillLabel;__skillDescription;static getType(){return"composer-skill"}static clone(t){return new e(t.__skillName,t.__skillLabel,t.__skillDescription,t.__key)}static importJSON(t){return PM(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,n,o,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=n,this.__skillDescription=o}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}createDOM(){let t=document.createElement("span");return t.className=gp,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(lK,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function PM(e,t,n){return om(new Cu(e,t,n))}function dK(e){return u(mM,{context:e.context})}var $s=class e extends Ha{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return AM(t.context)}constructor(t,n){super(n),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}createDOM(){let t=document.createElement("span");return t.className=gp,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(dK,{context:this.__context})}};function AM(e){return om(new $s(e))}function Ni(e){return e instanceof xu||e instanceof Cu||e instanceof $s}function cK(){return document.documentElement.classList.contains("dark")?"dark":"light"}function uK(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function fK(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function Xm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Jm(e){return 1}function EM(e){return e.getTextContentSize()}function pK(e,t,n){return t+(n>0?Jm(e):0)}function mK(e,t,n){return t+(n>0?EM(e):0)}function gK(e,t){let n=e.getParent();if(!n||!Ue(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===Jm(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=Jm(e),null)}function Zm(e){return Ni(e)?Jm(e):nt(e)?e.getTextContentSize():Zl(e)?1:Ue(e)?e.getChildren().reduce((t,n)=>t+Zm(n),0):0}function Xy(e){return Ni(e)?EM(e):nt(e)?e.getTextContentSize():Zl(e)?1:Ue(e)?e.getChildren().reduce((t,n)=>t+Xy(n),0):0}function bu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ue(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Zm(l))}o=r}if(nt(e))return n+Math.min(t,e.getTextContentSize());if(Ni(e))return pK(e,n,t);if(Zl(e))return n+Math.min(t,1);if(Ue(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Zm(s))}return n}return n}function eg(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ue(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Xy(l))}o=r}if(nt(e))return n+Math.min(t,e.getTextContentSize());if(Ni(e))return mK(e,n,t);if(Zl(e))return n+Math.min(t,1);if(Ue(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Xy(s))}return n}return n}function tg(e,t){if(Ni(e))return gK(e,t);if(nt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(Zl(e)){let n=e.getParent();if(!n)return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===1?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=1,null)}if(Ue(e)){let n=e.getChildren();for(let o of n){let r=tg(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function ng(){return Ct().getChildren().reduce((n,o)=>n+Zm(o),0)}function Hs(e){let t=Ct(),n=ng(),r={value:Math.max(0,Math.min(e,n))},a=tg(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=Ns();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Or(i)}function Ym(e,t){let n=Ct(),o=ng(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=tg(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=tg(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=Ns();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Or(c)}function SM(e){if(!we(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=eg(t,e.anchor.offset),r=eg(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function wM(e){return we(e)?e.getNodes().some(t=>Ni(t)):!1}function Iu(e){let t=De();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=bu(n,t.anchor.offset),r=ng();return Math.max(0,Math.min(o,r))}function TM(e){let t=De();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=eg(n,t.anchor.offset),r=Ct().getTextContent().length;return Math.max(0,Math.min(o,r))}function Qy(e){let t=De();return we(t)?{anchor:bu(t.anchor.getNode(),t.anchor.offset),focus:bu(t.focus.getNode(),t.focus.offset)}:e}function hK(e,t){let n=t.split(`
3715
- `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Dr(r)),o<n.length-1&&e.append(Rs())}}function Zy(e,t,n){let o=Ct();o.clear();let r=pr();o.append(r);let a=Cs(e,t);for(let i of a){if(i.type==="mention"){r.append(Jy(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(PM(i.name,s?.label??ca({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(AM(i.context));continue}hK(r,i.text)}}function Yy(e){return e instanceof $s?[e.__context.id]:Ue(e)?e.getChildren().flatMap(t=>Yy(t)):[]}function vK(e){let[t]=Cn();return q(()=>{let n=(s,l)=>{if(!e.onCommandKeyDown||!l)return!1;if(s==="Enter"&&(l.isComposing||l.keyCode===229))return l.stopPropagation(),!0;let d=e.onCommandKeyDown(s,l);return d&&(l.preventDefault(),l.stopPropagation()),d},o=t.registerCommand($P,s=>n("ArrowDown",s),Fr),r=t.registerCommand(HP,s=>n("ArrowUp",s),Fr),a=t.registerCommand(Cm,s=>n("Enter",s),Fr),i=t.registerCommand(bm,s=>n("Tab",s),Fr);return()=>{o(),r(),a(),i()}},[t,e]),null}function xK(){let[e]=Cn();return q(()=>{let t=e.registerCommand(vm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=De();if(!we(i)||!i.isCollapsed())return;let s=Iu(0);if(s<=0)return;let l=Ct().getTextContent();Ac(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Hs(a)}),!0},Fr),n=e.registerCommand(xm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=De();if(!we(i)||!i.isCollapsed())return;let s=Iu(0),l=ng();if(s>=l)return;let d=Ct().getTextContent();Ac(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Hs(a)}),!0},Fr);return()=>{t(),n()}},[e]),null}function yK(){let[e]=Cn();return q(()=>e.registerCommand(KP,t=>{if(!dM(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let n=e.getRootElement(),o=window.getSelection(),r=o?.anchorNode;return!n||!o||!r||!n.contains(r)||o.rangeCount===0||typeof o.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),o.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{Or(rP(o,e))}),!0)},Fr),[e]),null}function CK(){let[e]=Cn();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=De();if(!we(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Ni(r)||o.anchor.offset===0)return;n=bu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Hs(n)})})}),[e]),null}function bK(){let[e]=Cn(),{onRemoveTerminalContext:t}=Ut(kM);return q(()=>e.registerCommand(ym,n=>{let o=De();if(!we(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=Iu(0),i=s=>{if(!Ni(s))return!1;let l=bu(s,0);return s.remove(),s instanceof $s?(t(s.__context.id),Hs(a)):Hs(l),n?.preventDefault(),!0};if(i(r))return!0;if(nt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(Ue(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(Ue(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},Fr),[e,t]),null}function IK(){let[e]=Cn();return q(()=>{let t=new Set,n=e.getRootElement()===document.activeElement,o=l=>{for(let d of t)l.has(d)||e.getElementByKey(d)?.removeAttribute("data-composer-chip-selected");for(let d of l)e.getElementByKey(d)?.setAttribute("data-composer-chip-selected","true");t=l},r=()=>{let l=new Set;return e.getEditorState().read(()=>{let d=De();if(we(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Ha&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(DP,()=>(n=!0,o(r()),!1),ed),s=e.registerCommand(wP,()=>(n=!1,o(new Set),!1),ed);return()=>{a(),i(),s()}},[e]),null}function SK(){let[e]=Cn();return q(()=>xM(e,{createMentionNode:Jy,getExpandedAbsoluteOffsetForPoint:eg}),[e]),null}function wK(e){let[t]=Cn(),n=_(e.terminalContexts),o=_(yu(e.skills)),r=_(null),a=_(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=yu(e.skills)},[e.skills]);let i=lh(s=>{let l=LM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let g=De();if(!we(g)||g.isCollapsed()||wM(g))return null;let v=SM(g);if(!v||v.start===v.end)return null;let x=Ct().getTextContent();return lv(x,v.start,v.end)?null:{value:x,expandedStart:v.start,expandedEnd:v.end}})();if(!f||!l)return;let p=f.value.slice(f.expandedStart,f.expandedEnd),m=`${f.value.slice(0,f.expandedStart)}${s}${p}${l}${f.value.slice(f.expandedEnd)}`;Zy(m,n.current,o.current);let h=dr(m,f.expandedStart);Ym(h+s.length,h+s.length+p.length),c=!0,r.current=null}),c});return q(()=>{let s=h=>{if(a.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;a.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){r.current=null,a.current=null;return}t.getEditorState().read(()=>{let g=De();if(!we(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(wM(g)){r.current=null,a.current=null;return}let v=SM(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=Ct().getTextContent();if(lv(x,v.start,v.end)){r.current=null,a.current=null;return}let y={value:x,expandedStart:v.start,expandedEnd:v.end};r.current=y,a.current=null})},l=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&IM!==null&&r.current){a.current=r.current;return}if(a.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){r.current=null;return}let g=h.inputType==="insertText"?h.data:null;if(!g||g.length!==1){r.current=null;return}i(g)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},d=h=>{queueMicrotask(()=>{t.update(()=>{let g=a.current;if(!g)return;let v=Ct().getTextContent(),x=IM;if(x===null){a.current=null;return}let y=`${g.value.slice(0,g.expandedStart)}\`${g.value.slice(g.expandedEnd)}`;if(v!==y){h?.finalAttempt&&(r.current=null,a.current=null);return}let C=g.value.slice(g.expandedStart,g.expandedEnd),w=dr(v,g.expandedStart);Ym(w,w+1);let k=De();if(!we(k)){r.current=null,a.current=null;return}k.insertText(`\`${C}${x}`),Ym(w+1,w+1+C.length),r.current=null,a.current=null},{tag:Br})})},c=h=>{let g=h;(g.inputType==="insertText"||g.inputType==="insertCompositionText")&&d()},f=()=>{d({finalAttempt:!0})},p=null,m=t.registerRootListener((h,g)=>{g?.removeEventListener("keydown",s),g?.removeEventListener("beforeinput",l,!0),g?.removeEventListener("input",c),g?.removeEventListener("compositionend",f),h?.addEventListener("keydown",s),h?.addEventListener("beforeinput",l,!0),h?.addEventListener("input",c),h?.addEventListener("compositionend",f),p=h});return()=>{p&&(p.removeEventListener("keydown",s),p.removeEventListener("beforeinput",l,!0),p.removeEventListener("input",c),p.removeEventListener("compositionend",f)),m()}},[t]),null}function TK({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let[m]=Cn(),h=_(d);h.current=d;let g=lr(t,n),v=Ka(e,t,{cursor:g,expandedCursor:Lr(t,g)}),x=lr(t,v.cursor),y=uK(o),C=_(y),w=fK(r),k=_(w),S=_(yu(r)),L=_({value:t,cursor:x,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(H=>H.id)}),I=_(e),T=v.history,E=_(!1),A=z(()=>({onRemoveTerminalContext:l}),[l]);ye(()=>{S.current=yu(r)},[r]),q(()=>{m.setEditable(!a)},[a,m]),ye(()=>{let H=lr(t,n),K=L.current,O=I.current,oe=O!==e,te=C.current!==y,W=k.current!==w;if(!oe&&K.value===t&&K.cursor===H&&!te&&!W)return;if(oe){let Ee=K.selection;m.getEditorState().read(()=>{Ee=Qy(Ee)}),sd(O,K.value,{cursor:K.cursor,expandedCursor:K.expandedCursor,selection:Ee})}let Ke=Ka(e,t),ve=oe?Ke.selection:{anchor:H,focus:H};L.current={value:t,cursor:oe?Ke.cursor:H,expandedCursor:oe?Ke.expandedCursor:Lr(t,H),selection:ve,terminalContextIds:o.map(Ee=>Ee.id)},I.current=e,C.current=y,k.current=w;let fe=m.getRootElement(),Ne=!!(fe&&document.activeElement===fe);if(!oe&&K.value===t&&!te&&!W&&!Ne)return;let Ae=oe?Ka(O,K.value).history:null;E.current=!0;let ae=()=>m.update(()=>{let Ee=oe||K.value!==t||te||W;Ee&&Zy(t,o,S.current),oe?Ym(ve.anchor,ve.focus):(Ee||Ne)&&Hs(H)},{discrete:!0,tag:Br});Ae?bM(Ae,ae):ae(),sd(e,t,L.current),queueMicrotask(()=>{E.current=!1})},[n,e,m,w,o,y,t]);let N=B(H=>{let K=m.getRootElement();if(!K)return;let O=lr(L.current.value,H);K.focus({preventScroll:!0}),m.update(()=>{Hs(O)}),L.current={value:L.current.value,cursor:O,expandedCursor:Lr(L.current.value,O),selection:{anchor:O,focus:O},terminalContextIds:L.current.terminalContextIds},sd(I.current,L.current.value,{cursor:L.current.cursor,expandedCursor:L.current.expandedCursor,selection:L.current.selection}),h.current(L.current.value,O,L.current.expandedCursor,!1,L.current.terminalContextIds)},[m]),R=B(()=>{let H=L.current;return m.getEditorState().read(()=>{let K=Ct().getTextContent(),O=lr(K,L.current.cursor),oe=lr(K,Iu(O)),te=Xm(K,L.current.expandedCursor),W=Xm(K,TM(te)),Ke=Yy(Ct()),ve=Qy(L.current.selection);H={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:Ke}}),L.current=H,sd(I.current,H.value,H),H},[m]);Xr(p,()=>({focus:()=>{N(L.current.cursor)},focusAt:N,focusAtEnd:()=>{N(dr(L.current.value,L.current.value.length))},readSnapshot:R}),[N,R]);let $=B(H=>{H.read(()=>{let K=Ct().getTextContent(),O=lr(K,L.current.cursor),oe=lr(K,Iu(O)),te=Xm(K,L.current.expandedCursor),W=Xm(K,TM(te)),Ke=Yy(Ct()),ve=Qy(L.current.selection),fe=L.current;if(fe.value===K&&fe.cursor===oe&&fe.expandedCursor===W&&fe.selection.anchor===ve.anchor&&fe.selection.focus===ve.focus&&fe.terminalContextIds.length===Ke.length&&fe.terminalContextIds.every((Ae,ae)=>Ae===Ke[ae])||E.current)return;L.current={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:Ke},sd(I.current,K,{cursor:oe,expandedCursor:W,selection:ve});let Ne=Ac(K,oe,"left")||Ac(K,oe,"right");h.current(K,oe,W,Ne,Ke)})},[]);return u(kM,{value:A,children:b("div",{className:"relative [font-family:var(--font-composer,var(--font-sans))] [font-size:var(--font-size-prompt,0.875rem)] [@media(max-width:39.999rem)_and_(pointer:coarse)]:[font-size:max(var(--font-size-prompt,1rem),16px)]",children:[u(lM,{contentEditable:u(ZA,{className:F("block max-h-50 min-h-17.5 w-full overflow-y-auto whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none",s),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":i,placeholder:u("span",{}),onPaste:f}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:eE}),u(NE,{onChange:$}),u(vK,{...c?{onCommandKeyDown:c}:{}}),u(wK,{terminalContexts:o,skills:r}),u(yK,{}),u(xK,{}),u(CK,{}),u(bK,{}),u(SK,{}),u(IK,{}),u(ME,{externalHistoryState:T},e)]})})}function LK(e){let[t]=Cn(),n=_(e),o=_(e),[r,a]=G(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,ye(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),q(()=>{let s=null,l=()=>{let c=o.current.documentKey;a(f=>f===c?f:c)},d=t.registerRootListener((c,f)=>{f?.removeEventListener("compositionend",l),c?.addEventListener("compositionend",l),s=c});return()=>{s?.removeEventListener("compositionend",l),d()}},[t]);let i=r===e.documentKey?e:n.current;return u(TK,{...i})}function MM({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let m=_(t),h=_(o),g=_(yu(r)),v=z(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[xu,Cu,$s],editorState:()=>{Zy(m.current,h.current,g.current)},onError:x=>{throw x}}),[]);return u(pA,{initialConfig:v,children:u(LK,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:l,onChange:d,onPaste:f,editorRef:p,...c?{onCommandKeyDown:c}:{},...s?{className:s}:{}})},rK)}me();me();me();var xC=kd(DM(),1),vR=kd(vc(),1),xR=kd(vc(),1);qn(function(t,n){return Te("div",{ref:n,...t})});var fg=qn(function(t,n){return Te("div",{ref:n,...t})}),mr=fg,Ga={OS:"web"};function Us(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function yC(e,t){return t===void 0||!Number.isFinite(t)||!Number.isFinite(e.scrollLength)||t<=e.scrollLength?t!==void 0&&Number.isFinite(t)&&Number.isFinite(e.scrollLength)?0:void 0:Math.max(0,t-e.scrollLength)}function yR(){return"normal"}function OK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:yR()}function FK(e){var t;return(t=e?.rtl)!=null?t:!1}function Qa(e){return CC(e?.props)}function CC(e){return!!e?.horizontal&&FK(e)}function bC(e){return e?.horizontal?(CC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function BK(e,t){var n;return(n=yC(e,t))!=null?n:0}function OM(e,t){return t&&(Qa(e)?t.left:t.right)||0}function zK(e,t,n,o){return!Qa(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function IC(e,t,n){if(!e||!Qa(e))return t;let o=yC(e,n),r=Us(t,o),a=OK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Us(o-r,o):r}function $K(e,t,n){if(!Qa(e))return e.horizontalRTLScrollType=void 0,t;let o=yC(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Us(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let i=e.horizontalRTLScrollType;if(i==="inverted")return Us(a,o);if(i==="normal")return Us(r,o);if(!e.hasScrolled){let f=yR();return e.horizontalRTLScrollType=f,Us(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Us(c?a:r,o)}var HK=e=>e,pg=Ht(null),CR="\0",UK=0;function KK({children:e}){let[t]=G(()=>({animatedScrollY:HK(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:UK++,listeners:new Map,mapViewabilityAmountCallbacks:new Map,mapViewabilityAmountValues:new Map,mapViewabilityCallbacks:new Map,mapViewabilityConfigStates:new Map,mapViewabilityValues:new Map,pendingContainerIds:void 0,positionListeners:new Map,scrollAxisGap:0,state:void 0,values:new Map([["alignItemsAtEndPadding",0],["containerLayoutEpoch",0],["stylePaddingTop",0],["headerSize",0],["numContainers",0],["activeStickyIndex",-1],["isAtEnd",!1],["isAtStart",!1],["isNearEnd",!1],["isNearStart",!1],["isWithinMaintainScrollAtEndThreshold",!1],["adaptiveRender","normal"],["totalSize",0],["scrollAdjustPending",0]]),viewRefs:new Map}));return Te(pg.Provider,{value:t},e)}function Ur(){return sn(pg)}function bR(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let i=0;i<t.length;i++){let s=le(e,t[i]);r.push(s),s!==o[i]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let i of t)a.push(Va(e,i,r));return()=>{for(let i of a)i()}}}}function qK(e){return e.length===1?e[0]:e.join(CR)}function VK(e){return e.split(CR)}function Va(e,t,n){let{listeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function le(e,t){let{values:n}=e;return n.get(t)}function Pe(e,t,n){let{listeners:o,values:r}=e;if(r.get(t)!==n){r.set(t,n);let a=o.get(t);if(a)for(let i of a)i(n)}}function WK(e,t,n){let{positionListeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function GK(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Ko(e){let t=sn(pg),n=qK(e),{subscribe:o,get:r}=z(()=>bR(t,VK(n)),[t,n]);return(0,xC.useSyncExternalStore)(o,r,r)}function jK(e,t){let n=sn(pg),{subscribe:o,get:r}=z(()=>bR(n,[e]),[n,e]),a=B(()=>t(r()[0]),[r,t]);return(0,xC.useSyncExternalStore)(o,a,a)}function QK(e){return Math.max(0,e??0)}function qs(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?OM(o,s):s?.bottom)||0,d=QK(t??r.contentInsetEndAdjustment),c=le(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let h={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?OM(o,h):h.bottom)||0)+d,f)}return Math.max(m,f)}function uo(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,i=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,s=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=qs(e),f=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:o.get("totalSize"),p=Math.max(0,f-(r.props.data.length>0?e.scrollAxisGap:0));return l+d+p+a+s+i+(c||0)}var dd=({children:e})=>Te(fg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ue(function(){let t=Ur(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Ko(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=uo(t),[,c]=ni(f=>f+1,0);return XK(()=>{c()},100),Te(fg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Te(dd,null,Te(mr,null,"TotalSize:"),Te(mr,null,n.toFixed(2))),Te(dd,null,Te(mr,null,"ContentSize:"),Te(mr,null,d.toFixed(2))),Te(dd,null,Te(mr,null,"At end:"),Te(mr,null,String(l))),Te(dd,null,Te(mr,null,"ScrollAdjust:"),Te(mr,null,o.toFixed(2))),Te(dd,null,Te(mr,null,"RawScroll: "),Te(mr,null,r.toFixed(2))),Te(dd,null,Te(mr,null,"ComputedScroll: "),Te(mr,null,a.toFixed(2))))});function XK(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var SC=!0,IR=new WeakMap;function YK(e){return IR.get(e)}function JK(e,t){IR.set(e,t)}var ZK=typeof __DEV__<"u"?__DEV__:void 0,FM,BM=typeof process<"u"&&typeof process.env=="object"&&process.env?(FM="production")!=null?FM:process.env.MODE:void 0,zM=typeof BM=="string"?BM.toLowerCase()!=="production":void 0,$M,Uo=($M=zM??ZK)!=null?$M:!1,cd=-1e7,SR=1,eq=Uo&&!1,tq=Uo&&!1;function mg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function wR(e){var t,n;let o=(n=e.pendingScrollResolve)!=null?n:(t=e.pendingScrollToEnd)==null?void 0:t.resolve;e.pendingScrollResolve=void 0,e.pendingScrollToEnd=void 0,o?.()}function nq(e){mg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,wR(e)}function oq(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function rq(e,t){var n,o,r,a;let i=e.state,s=i.deferredPublicOnScrollEvent;i.deferredPublicOnScrollEvent=void 0,s&&((a=(r=i.props).onScroll)==null||a.call(r,oq(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var tC=1;function aq(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function HM(e){e.initialScrollSession=void 0}function sC(e){let{bootstrap:t,completion:n,kind:o,previousDataLength:r}=e;return o==="offset"?{completion:n,kind:o,previousDataLength:r}:{bootstrap:t,completion:n,kind:o,previousDataLength:r}}function og(e,t=(n=>(n=(o=>(o=e.initialScrollSession)==null?void 0:o.kind)())!=null?n:"bootstrap")()){var n,o;return e.initialScrollSession?e.initialScrollSession.kind!==t&&(e.initialScrollSession=sC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=sC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var gg={didDispatchNativeScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didDispatchNativeScroll)},didRetrySilentInitialScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didRetrySilentInitialScroll)},markInitialScrollNativeDispatch(e){og(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){og(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=og(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},no={clear(e){no.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=tC},get(e){var t,n;return(n=(t=e.initialScrollSession)==null?void 0:t.completion)==null?void 0:n.watchdog},hasNonZeroTargetOffset(e){return e!==void 0&&e>tC},isAtZeroTargetOffset(e){return e<=tC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=og(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function ja(e,t={}){var n,o,r,a;let i=e.initialScrollSession,s=(n=t.kind)!=null?n:i?.kind,l=i?.completion,d=i?.kind==="bootstrap"?i.bootstrap:void 0,c=s==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!s||!e.initialScroll&&!c&&!aq(l))return HM(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=sC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var iq=1.3;function lC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*iq||!t&&n<=0&&o>0}var TR=(e,t,n,o,r,a,i,s)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{s({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?lC(e,t,n)?(s(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(i(e),c(),!0):!1};function sq(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function LR(e){let t=e.state;if(!t.edgeReachedGate)return;let n=uo(e),o=n-t.scroll-t.scrollLength-qs(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=lC(t.scroll,!1,a),l=lC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function kR(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function PR(e){e.state.edgeReachedGate="closed"}function UM(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function lq(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",sq(e,o),o}function Tu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function AR(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:i,scroll:s,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=uo(e);if(LR(e),f>0&&a){let p=qs(e),m=f-s-i-p,h=f<i;Pe(e,"isAtEnd",h||m<=SR),Pe(e,"isNearEnd",h||m<=c*i),Pe(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),Tu(r)||l||(r.isEndReached=TR(m,h,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var x,y;kR(e,"end",t,n)&&(PR(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function dq(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:i},scroll:s,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=i*l;LR(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Pe(e,"isAtStart",s<=SR),Pe(e,"isNearStart",s<=p),Tu(o)||o.scrollingTo||(o.isStartReached=TR(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;kR(e,"start",t,n)&&(PR(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function hg(e,t){let n=!e.state.edgeReachedGate;AR(e,t,n),dq(e,t,n)}function ER(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),hg(e)}var cq=6,uq=3,fq=250;function MR(e){e.state.scheduledWork.cancel("adaptiveRender")}function KM(e,t){let n=e.state;MR(e),t<=0?Au(e,"normal","scroll"):n.scheduledWork.timeout(()=>Au(e,"normal","scroll"),t,"adaptiveRender")}function Au(e,t,n){var o,r;le(e,"adaptiveRender")!==t&&(Pe(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function wC(e){var t,n;MR(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";le(e,"adaptiveRender")!==o&&Au(e,o,"initial")}function pq(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=le(e,"adaptiveRender");if(le(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:cq,c=(r=s.exitVelocity)!=null?r:uq,f=(a=s.exitDelay)!=null?a:fq,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",h=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==h&&(m==="light"?(Au(e,"light","scroll"),KM(e,f)):l==="light"&&KM(e,f))}else wC(e)}var TC=50;function RR(e,t){var n;let o=e.state.props.drawDistance,r=e.state.initialScroll,a=r!==void 0&&((n=r.viewPosition)!=null?n:0)>0;return t==="visible-first"||t!=="full"&&!le(e,"readyToRender")&&!a?Math.min(o,TC):o}function NR(e){let{state:t}=e;t.props.drawDistance<=TC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function LC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Pe(e,"readyToRender",!1),wC(e)}function kC(e,{didLayout:t,didInitialScroll:n}){let{state:o}=e,{loadStartTime:r,props:{onLoad:a}}=o;t&&(o.didContainersLayout=!0),n&&(o.didFinishInitialScroll=!0),o.didContainersLayout&&o.didFinishInitialScroll&&!le(e,"readyToRender")&&(Pe(e,"readyToRender",!0),Au(e,"normal","ready"),o.props.drawDistance>TC&&NR(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var mq=2e3;function qM(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function _R(e){e.scheduledWork.cancel("preservedInitialScroll")}function ud(e){_R(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,ja(e)}function VM(e){var t,n,o;let r=e.state,a=((t=r.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?r.initialScrollSession.bootstrap:void 0;(r.initialScroll||a||(n=r.scrollingTo)!=null&&n.isInitialScroll)&&(a?.frameHandle!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.frameHandle),(o=r.scrollingTo)!=null&&o.isInitialScroll&&(mg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),gg.resetFlags(r),ja(r,{bootstrap:null}),fd(e))}function fd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)qM(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let s=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof s=="number"&&Number.isFinite(s)&&qM(a,s)}let i=()=>{var s,l,d,c,f;let p=((s=a.initialScrollSession)==null?void 0:s.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;no.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,ja(a),_R(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||ud(a)},mq,"preservedInitialScroll")):ud(a),t?.recalculateItems&&ER(e),kC(e,{didInitialScroll:!0}),p&&rq(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function vg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function gq(e){let{state:t}=e;return(t.props.horizontal?(Qa(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:le(e,"stylePaddingTop")||0)+(le(e,"alignItemsAtEndPadding")||0)+(le(e,"headerSize")||0)}function Bt(e,t){let{data:n,keyExtractor:o}=e.props;if(!n)return"";let a=t<n.length?o?o(n[t],t):t:null;return e.idCache[t]=a,a}function hq(e){var t,n,o;let{state:r,values:a}=e;return(a.get("headerSize")||0)+(a.get("footerSize")||0)+((o=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:a.get("totalSize"))!=null?o:0)+(r.props.stylePaddingTop||0)+(r.props.stylePaddingBottom||0)}function vq(e){let{state:t}=e;return!!t.props.alignItemsAtEndPaddingEnabled&&!t.props.horizontal&&t.props.data.length>0&&t.scrollLength>0?Math.max(0,t.scrollLength-hq(e)-qs(e)):0}function js(e){let t=le(e,"alignItemsAtEndPadding")||0,n=vq(e);t!==n&&Pe(e,"alignItemsAtEndPadding",n)}function Lu(e,t,n,o=!0){let r=e.state,a=r.totalSize,i=r.totalSize;t===null?(i=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):i+=n,a!==i?(r.pendingTotalSize=void 0,r.totalSize=i,o&&Pe(e,"totalSize",i),js(e)):o&&e.values.get("totalSize")!==i&&Pe(e,"totalSize",i)}function dC(e,t,n,o=!0){let r=e.state,{sizes:a}=r,i=a.get(t),s=i!==void 0?n-i:n;s!==0&&Lu(e,t,s,o),a.set(t,n)}function DR(e){return typeof e=="function"}function xg(e){return Array.isArray(e)}var WM=new Set;function Ks(e,t){Uo&&!WM.has(e)&&(WM.add(e),console.warn(`[legend-list] ${t}`))}function Eu(e){return Math.floor(e*8)/8}function ku(e){return e==null}function GM(e,t){var n,o,r;let a=t==="Left"||t==="Right"?e.paddingHorizontal:e.paddingVertical;return(r=(o=(n=e[`padding${t}`])!=null?n:a)!=null?o:e.padding)!=null?r:0}function wu(e,t,n){return GM(e,n)+GM(t,n)}function cC(e,t){var n,o;let r=(o=(n=e.state)==null?void 0:n.containerItemKeys)==null?void 0:o.get(t);if(r!==void 0)return r;let a=le(e,"numContainers");for(let i=0;i<a;i++)if(le(e,`containerItemKey${i}`)===t)return i;return-1}function OR(e,t,n,o,r){var a,i;let s=e.state,{getFixedItemSize:l,getItemType:d}=s.props,c=t?s.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(i=r?.itemType)!=null?i:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,s.sizesKnown.set(t,c))}return c}function FR(e,t){let n=Bt(e.state,t);return OR(e,n,t,e.state.props.data[t])}function xq(e,t,n){for(let o=t;o<=n;o++)if(FR(e,o)===void 0)return!1;return!0}function fo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:h,props:{estimatedItemSize:g,getItemType:v},scrollingTo:x}=p,y=p.sizesKnown.get(t);if(y!==void 0)return y;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=OR(e,t,n,o,s),C!==void 0)return dC(e,t,C,i),C;let k=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!x){let S=(c=h[k])==null?void 0:c.avg;S!==void 0&&(C=Eu(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&x){let S=(f=x.averageSizeSnapshot)==null?void 0:f[k];S!==void 0&&(C=Eu(S))}return C===void 0&&(C=g+e.scrollAxisGap),dC(e,t,C,i),C}function PC(e,t){if(t===void 0||t<0)return;let n=Bt(e.state,t);return fo(e,n,t,e.state.props.data[t])}function yg(e,t,n){var o;let r=e.state,{index:a,viewOffset:i,viewPosition:s}=n,l=t;if(i&&(l-=i),a!==void 0){let d=gq(e);d&&(l+=d)}if(s!==void 0&&a!==void 0){let d=r.props.data.length;if(d===0)return l;let c=a<0||a>=d,f=(o=r.props.estimatedItemSize)!=null?o:0,p=c?f:fo(e,Bt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),h=qs(e);if(l-=s*(r.scrollLength-h-m),!c&&a===r.props.data.length-1){let g=le(e,"footerSize")||0;l+=g}}return l}function _i(e,t,n){let o=e.state,r=uo(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&Ga.OS!=="android"){let i=Math.max(0,r-o.scrollLength),s=n?.viewOffset,l=typeof s=="number"&&s<0?-s:0,d=i+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function Mu(e){var t,n;let o=e.state;if(o?.scrollingTo){mg(o);let r=o.pendingScrollResolve;o.pendingScrollResolve=void 0;let a=o.scrollingTo;if(o.scrollHistory.length=0,o.scrollingTo=void 0,o.scrollTargetPinnedRange=void 0,o.pendingTotalSize!==void 0&&Lu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let i=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",s=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;fd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}ER(e),r?.()}}var yq=80,Cq=1500,bq=320,Iq=1;function Sq(e,t){var n,o;let r=e.state,{animated:a,horizontal:i,offset:s}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!i,p=f?uo(e):void 0,m=f?IC(r,s,p):0,h=f?0:s;if(l.scrollTo({animated:c,x:m,y:h}),c){let g=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;wq(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&Mu(e)},100,"platformScrollCompletion")}}function wq(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Mu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),Cq),f=()=>{o.removeEventListener("scroll",h),a&&o.removeEventListener("scrollend",g),i!==void 0&&clearTimeout(i),clearTimeout(c)},p=()=>{s||(s=!0,f())},m=v=>{if(s)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let x=n(),y=Math.abs(x-r)<=Iq;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),Mu(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),yq)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),bq),l.register("platformScrollCompletion",p)}function pd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(le(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,uo(e)<t.scrollLength&&(t.scroll=0),t.maintainingScrollAtEnd)t.pendingMaintainScrollAtEnd=!0;else{let d=a.animated?"pending-animated":"pending-instant",c=a.animated?"animated":"instant",f=t.scroll;t.maintainingScrollAtEnd=d,requestAnimationFrame(()=>{let p=le(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let h=r.current;if(t.props.horizontal&&Qa(t)){let g=uo(e),v=BK(t,g),x=IC(t,v,g);h?.scrollTo({animated:a.animated,x,y:0})}else h?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&pd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function Qs(e,t,n){let o=e.state;if(Math.abs(t)>.1){let r=()=>{o.scrollAdjustHandler.requestAdjust(t),o.adjustingFromInitialMount&&o.adjustingFromInitialMount--};o.scroll+=t,o.scrollForNextCalculateItemsInView=void 0,le(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var To=.1,Tq=300,Lq=2,kq=1;function Pq(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,i=e.indexByKey.get(r.id)===void 0;if(a||i||!n){e.mvcpAnchorLock=void 0;return}return r}function Aq(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:i}=t,s=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!s||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(i)<=To&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=Lq){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+Tq,id:n,position:o,quietPasses:c}}}function Eq(e,t,n,o,r,a){return!1}function Mq(e,t,n){if(Math.abs(t)<=To)return 0;let r=Math.max(0,n-e.scrollLength)-e.scroll;return t<0?Math.max(t,Math.min(0,r)):t>0?Math.min(t,Math.max(0,r)):0}function Rq(e,t){return e<0?-t:t}function nC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>To&&Qs(e,r)}function Nq(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>To)return;let o=uo(e),r=Mq(t,n.amount,o);if(Math.abs(r)<=To)return;let a=n.amount-r;Math.abs(a)<=To||(n.manualApplied=a,Qs(e,a),n.furthestProgressTowardAmount=0)}function _q(e,t){let n=e.state,o=n.pendingNativeMVCPAdjust;if(!o)return!1;let r=o.amount-o.manualApplied,a=t-(o.startScroll+o.manualApplied),i=r<0&&a>To||r>0&&a<-To,s=Rq(r,a);if(Math.abs(r)<=To)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+To>=Math.abs(r))return nC(e,r,a),!0;let l=Math.max(0,uo(e)-n.scrollLength);return Math.abs(t-l)<=kq||n.pendingMaintainScrollAtEnd&&le(e,"isWithinMaintainScrollAtEndThreshold")&&s>To?(nC(e,r,a),!0):s>o.furthestProgressTowardAmount+To?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>To&&s<o.furthestProgressTowardAmount-To&&(n.pendingNativeMVCPAdjust=void 0),!1)}function Dq(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:i,size:s,shouldRestorePosition:l}}=a,d=Date.now(),c=!!t||!!n.mvcpAnchorLock,f=n.scrollingTo;if(t&&n.pendingScrollToEnd&&f===void 0){n.mvcpAnchorLock=void 0;return}let p=Pq(n,c,i,d),m,h,g=[],v=f?.index,x=f?.viewPosition,y=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(x??0)>0,C=t?i:s,w=n.indexByKey,k=n.scroll;if(uo(e),C){if(p&&v===void 0?(h=p.id,m=p.position):v!==void 0?h=Bt(n,v):o.length>0&&n.didContainersLayout&&!t&&(h=o.find(S=>w.get(S)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let S=0;S<o.length;S++){let L=o[S],I=w.get(L);if(I!==void 0){let T=r[I];T!==void 0&&g.push({id:L,position:T})}}if(h!==void 0&&m===void 0){let S=w.get(h);S!==void 0&&(m=r[S])}return()=>{let S=0,L=p?.id,I,T=!1,E=n.props.data;if(t&&i&&v===void 0&&h!==void 0&&p?.id===h&&l!==void 0&&h!==void 0){let R=w.get(h);if(R!==void 0){let $=E[R];T=$===void 0||!l($,R,E),T&&p?.id===h&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(h===void 0||T)return!0;let R=w.get(h);return R===void 0||r[R]===void 0})())for(let R=0;R<g.length;R++){let{id:$,position:H}=g[R],K=w.get($);if(K!==void 0&&l){let oe=E[K];if(oe===void 0||!l(oe,K,E))continue}let O=K!==void 0?r[K]:void 0;if(O!==void 0){S=O-H,L=$,I=O;break}}if(!T&&h!==void 0&&m!==void 0){let R=w.get(h),$=R!==void 0?r[R]:void 0;if($!==void 0){let H=uo(e),K=$-m;if(K!==0&&y&&n.scroll+n.scrollLength>H)if(K>0)K=Math.max(0,H-n.scroll-n.scrollLength);else{let O=Math.max(0,H-n.scrollLength);n.scroll=O,n.scrollPending=O,K=0}S=K,L=h,I=$}}if(x&&x>0){let R=fo(e,h,v,n.props.data[v]),$=f?.itemSize;if(R!==void 0&&$!==void 0&&R!==$){let H=R-$;H!==0&&(S+=H*x,f.itemSize=R)}}if(Aq(n,{anchorId:L,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),Eq()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:k},Nq(e);return}Math.abs(S)>To&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&le(e,"isWithinMaintainScrollAtEndThreshold")||Qs(e,S))}}}var jM=1e3,Oq=200,Cg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>jM)return 0;let r=0,a=0,i=0;for(let s=n;s>0;s--){let l=t[s],d=t[s-1],c=l.scroll-d.scroll,f=l.time-d.time,p=Math.sign(c);if(p!==0){if(r===0)r=p;else if(p!==r)break}if(o.time-d.time>jM)break;if(c===0||f<=0)continue;let m=o.time-l.time,h=Math.exp(-m/Oq);a+=c/f*h,i+=h}return i>0?a/i:0};function Fq(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Ou(e){return e.dataChangeNeedsScrollUpdate||Fq(e)}function Vs(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:i,lastScrollAdjustForHistory:s,scrollAdjustHandler:l,scrollHistory:d,scrollingTo:c}=a,f=a.scroll;o?.markHasScrolled!==!1&&(a.hasScrolled=!0);let p=Date.now();a.lastBatchingAction=p;let m=l.getAdjust(),h=s!==void 0&&Math.abs(m-s)>.1;if(h&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(h||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:T,gt:E}=i;if(T&&t<T||E&&t>E){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let g=Math.abs(t-f),x=!!o?.fromNativeScrollEvent&&g>.1&&!h&&c===void 0&&!a.pendingNativeMVCPAdjust?lq(e,t-f):void 0,y=_q(e,t),C=a.scrollLength,w=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,k=Cg(a);pq(e,k,{forceLight:w});let S=a.scrollLastCalculate;if(Ou(a)||y||x!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=g;let T=()=>{var A;let N={doMVCP:c!==void 0,scrollVelocity:k};w&&(N.drawDistanceMode="visible-first"),(A=a.triggerCalculateItemsInView)==null||A.call(a,N),hg(e,x)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,xR.flushSync)(T),NR(e)):T();let E=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);y&&E&&(a.pendingMaintainScrollAtEnd=!1,pd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function Bq(e){if(Object.keys(e.averageSizes).length===0)return;let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];t[n]=o.avg}return t}function zq(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=no.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&no.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&no.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,no.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&no.clear(e)}function $q(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,i;for(;r<=a;){let s=Math.floor((r+a)/2),l=n.positions[s];l===void 0?a=s-1:l<=t?(i=s,r=s+1):a=s-1}return i}function QM(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=PC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function Hq(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),i=Math.max(a,t+o.scrollLength),s=n!==void 0?Math.max(0,Math.min(r-1,n)):$q(e,a);if(s===void 0)return;if(n!==void 0&&o.positions[s]===void 0)return{end:s,start:s};if(n===void 0){let d=QM(e,s);if(d===void 0||d<=a)return}for(;s>0;){let d=o.positions[s];if(d===void 0||d<=a||o.positions[s-1]===void 0)break;s--}for(;s>0;){let d=QM(e,s-1);if(d===void 0||d<=a)break;s--}let l=s;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>i)break;l++}return{end:l,start:s}}function Uq(e,t,n){let o=Hq(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function bg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:i,...s}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=s,{props:{horizontal:m}}=r;mg(r);let h=f?c:yg(e,c,s),g=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=_i(e,h,s),x=g?h:v;if(r.scrollHistory.length=0,!a){d&&gg.resetFlags(r);let y=Bq(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||Uq(e,v,s.index)}r.scrollPending=v,zq(r,{isInitialScroll:d,requestedOffset:x,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):Vs(e,v,!0,{markHasScrolled:!1})),i||!d||Ga.OS==="android"?Sq(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function BR(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function rg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=BR(t,l.length);let d=PC(e,t),c=vg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,bg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Ig(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?BR(i,e.state.props.data.length):void 0,l=PC(e,s);bg(e,{animated:!1,forceScroll:n,index:s!==void 0&&s>=0?s:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Ws(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&LC(e,{resetInitialScroll:!0}),ja(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Hr(e,t){var n,o;if(((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset")return(o=t.contentOffset)!=null?o:0;let a=t.index!==void 0?vg(e,t.index):0,i=yg(e,a,t);return _i(e,i,t)}function zR(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,i=!!r?.isInitialScroll,s=!!t?.requiresMeasuredLayout&&!o&&!i;if(!(!a||s||n||r&&!i))return{initialScroll:a,isInitialScrollInProgress:i,queuedInitialLayout:o,scrollingTo:r}}function Kq(e,t){var n,o,r;let a=e.state,i=zR(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Hr(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,h=p!==void 0&&Math.abs(p-f)>1,g=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!h||t?.forceScroll&&g)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Ws(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Ig(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function qq(e,t){var n,o;let r=e.state,a=zR(r);if(!a)return!1;let{initialScroll:i,queuedInitialLayout:s}=a,l=(n=i.contentOffset)!=null?n:0,d=Math.abs(r.scroll-l)<=1&&Math.abs(r.scrollPending-l)<=1;if(t?.forceScroll&&d)return!1;let c=!!r.lastLayout&&r.scrollLength>0,f=(o=t?.forceScroll)!=null?o:c||!!s;return Ig(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Ru(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?qq(e,{forceScroll:t?.forceScroll}):Kq(e,{forceScroll:t?.forceScroll})}function Pu(e,t,n){if(t==null||n==null||t<0||n<t)return!1;let o=!1;for(let r of e.containerItemKeys.keys()){let a=e.indexByKey.get(r);if(a!==void 0&&a>=t&&a<=n){o=!0;let i=Bt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var Sg=1,Vq=8,Wq=24,Gq="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function gr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function Xs(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function jq(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qq(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:i}=e,s=o+a,l=[],d=i!==void 0?Math.max(0,Math.min(t-1,i)):0;for(;d>0;){let c=d-1,f=r[c];if(f===void 0){d=c;continue}let p=n(c);if(p===void 0){d=c;continue}if(f+p<=o)break;d=c}for(;d<t;d++){let c=r[d];if(c===void 0)continue;let f=n(d);if(f!==void 0){if(c<s&&c+f>o)l.push(d);else if(l.length>0&&c>=s)break}}return l}function Xq(e){let{mountFrameCount:t,maxFrames:n=Vq,maxPasses:o=Wq,passCount:r}=e;return t>=n||r>=o}function $R(e,t){return Xq(t)?(Uo&&console.warn(Gq),dV(e),!0):!1}function Nu(e){var t;let n=gr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),ja(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function HR(e,t){var n,o,r;let a=gr(e);ja(e,{bootstrap:{frameHandle:a?.frameHandle,mountFrameCount:(n=a?.mountFrameCount)!=null?n:0,passCount:0,previousResolvedOffset:void 0,scroll:t.scroll,seedContentOffset:(r=(o=t.seedContentOffset)!=null?o:a?.seedContentOffset)!=null?r:t.scroll,targetIndexSeed:t.targetIndexSeed,visibleIndices:void 0},kind:"bootstrap"})}function Yq(e,t){var n,o,r;let a=gr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,ja(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&HR(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function uC(e){requestAnimationFrame(()=>{var t;gr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function AC(e){let t=e.state,n=gr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=gr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!$R(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&AC(e))};n.frameHandle=requestAnimationFrame(o)}function lg(e,t){Yq(e.state,t),AC(e),uC(e.state)}function EC(e){let{dataLength:t,footerSize:n,preserveForFooterLayout:o,stylePaddingEnd:r}=e;return{contentOffset:void 0,index:Math.max(0,t-1),preserveForBottomPadding:!0,preserveForFooterLayout:o,viewOffset:-r-n,viewPosition:1}}function Jq(e){return!!e?.preserveForBottomPadding}function Gs(e){return!!e?.preserveForFooterLayout}function UR(e){return!!(e&&e.viewPosition===1&&(Jq(e)||Gs(e)))}function Zq(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=Gs(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:i,viewOffset:-r-(i?n:0),viewPosition:1}}function eV(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function dg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Gs(r))return;let a=EC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Ws(e,a)}function tV(e){ud(e)}function MC(e,t,n=Sg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=_u(o);return Math.abs(r-Hr(e,t))>n}function _u(e){var t,n,o,r;let a=(n=(t=e.refScroller.current)==null?void 0:t.getCurrentScrollOffset)==null?void 0:n.call(t);return typeof a=="number"&&Number.isFinite(a)?a:(r=(o=e.scrollPending)!=null?o:e.scroll)!=null?r:0}function KR(e){var t;let n=e.state,o=n.initialScroll;if(!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||!o||o.viewPosition!==1||n.props.data.length===0||Xs(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:_u(n);return Hr(e,o)-r}function qR(e){return KR(e)===void 0?!1:(VR(e,{}),!0)}function VR(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=KR(e);if(a===void 0||Math.abs(a)<=Sg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Qs(e,a)),VR(e,t)})}function nV(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||MC(e,o)&&(UR(o)&&le(e,"isAtEnd")||(Gs(o)?dg(e,{dataLength:n.props.data.length,stylePaddingEnd:bC(n.props),target:o}):tV(n)))}function oV(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Hr(e,i),d=l===0&&!a&&(Xs(s)?Math.abs((n=i.contentOffset)!=null?n:0)<=1:i.index===0&&((o=i.viewPosition)!=null?o:0)===0&&Math.abs((r=i.viewOffset)!=null?r:0)<=1),c=s.props.data.length===0&&i.index!==void 0;d?(Nu(s),fd(e,{resolvedOffset:l})):c?(Nu(s),fd(e,{preserveTarget:!0,resolvedOffset:l})):(HR(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),AC(e))}function rV(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(Xs(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=gr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){ud(s);return}let p=n>0&&(r||UR(l));if(!(!o&&!d&&!p)){if(p){let m=r?EC({dataLength:n,footerSize:le(e,"footerSize")||0,preserveForFooterLayout:Gs(l),stylePaddingEnd:i}):Zq({dataLength:n,footerSize:le(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&MC(e,l)){dg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!eV(l,m)||c||d||o){Ws(e,m,{resetDidFinish:d}),lg(e,{scroll:Hr(e,m),seedContentOffset:d&&!c?_u(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Ws(e,l,{resetDidFinish:d}),lg(e,{scroll:Hr(e,l),seedContentOffset:d&&!c?_u(s):void 0,targetIndexSeed:l.index}))}}function aV(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(Xs(i)||n===0||!s||!(gr(i)||Gs(s))))if(MC(e,s))dg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=EC({dataLength:n,footerSize:o,preserveForFooterLayout:Gs(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))dg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Ws(e,d,{resetDidFinish:f}),lg(e,{scroll:Hr(e,d),targetIndexSeed:d.index})}}}function iV(e){var t,n,o;let r=e.state,a=r.initialScroll,i=gr(r);if(a&&r.props.data.length>0&&!Xs(r)&&(i||a.viewPosition===1)){let s=Hr(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!i&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:_u(r),c=s-d;if(Math.abs(c)>Sg){if(r.didFinishInitialScroll)qR(e);else if(l){let f=no.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,no.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),Qs(e,c)}}}else lg(e,{scroll:s,targetIndexSeed:a.index})}}function sV(e){var t,n;let o=e.state,r=gr(o),a=o.initialScroll;if(!r||!a||Xs(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,$R(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let i=Hr(e,a),s=Pu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=Qq({dataLength:d.length,getSize:g=>{var v,x;let y=(v=o.idCache[g])!=null?v:Bt(o,g);return(x=o.sizes.get(y))!=null?x:fo(e,y,g,d[g])},offset:i,positions:o.positions,scrollLength:o.scrollLength,startIndex:(n=r.targetIndexSeed)!=null?n:o.startBuffered>=0?o.startBuffered:void 0}),f=c.length>0&&c.every(g=>{var v;let x=(v=o.idCache[g])!=null?v:Bt(o,g);return o.sizesKnown.has(x)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,uC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=Sg&&jq(m,c))){uC(o);return}Nu(o),Ig(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Ga.OS==="web"})}function lV(e,t){var n;let o=e.state;Nu(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;fd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function dV(e){var t,n,o,r;let a=e.state,i=gr(a),s=a.initialScroll;i&&s&&!Xs(a)&&a.refScroller.current?(Nu(a),Ig(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Ga.OS==="web"})):lV(e,(r=(o=(n=(t=gr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function WR(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function cV(e,t,n,o){var r,a;let{getFixedItemSize:i,getItemType:s}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===s&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=s?(r=s(o,n))!=null?r:"":void 0;d=WR(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==i&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=i),i&&!d.didResolveFixedItemSize&&(d.fixedItemSize=i(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function GR(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var uV=20,fV=1,pV=1,oC=16;function RC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!NC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>xV(e),"checkFinishedScrollFrame")}function mV(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=fV}function gV(e,t){return!!t?.isInitialScroll&&gg.didDispatchNativeScroll(e)&&!e.hasScrolled}function jR(e){var t;return(t=no.get(e))==null?void 0:t.targetOffset}function QR(e){let t=jR(e);return!e.didFinishInitialScroll&&no.hasNonZeroTargetOffset(t)}function XM(e,t){var n,o;if(!t.isInitialScroll||t.animated||!e.didContainersLayout||((n=e.initialScrollSession)==null?void 0:n.kind)==="bootstrap")return!1;let r=(o=t.targetOffset)!=null?o:t.offset;return no.hasNonZeroTargetOffset(r)&&gg.didDispatchNativeScroll(e)&&!e.hasScrolled||no.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||QR(e)}function YM(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&uo(e)<=n.scrollLength&&n.scrollPending<=pV}function hV(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function vV(e,t){var n;let o=t.index,a=hV(e,t)&&o!==void 0?yg(e,vg(e,o),t):(n=t.targetOffset)!=null?n:_i(e,t.offset-(t.viewOffset||0),t);return _i(e,a,t)}function NC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=vV(e,t),i=_i(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||Ga.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function xV(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=NC(e,t);o.isAtResolvedTarget&&mV(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Mu(e)}function yV(e,t){var n;(n=e.state.refScroller.current)==null||n.scrollTo({animated:!1,x:e.state.props.horizontal?t:0,y:e.state.props.horizontal?0:t})}function CV(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=YM(e),r=gV(t,n),a=n!==void 0?XM(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?oC:i?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let h=QR(t)&&!t.hasScrolled,g=r?5:h?uV:5,v=YM(e),x=XM(t,m),y=NC(e,m),C=Ga.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||y.isAtResolvedTarget),k=m.isInitialScroll&&!y.isAtResolvedTarget&&l<=g;if(v||w||x||C||l>g)Mu(e);else if((h||k)&&l<=g){let S=(p=(f=jR(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;yV(e,S),d(r?oC:100)}else d(r?oC:100)}};d(s)}function XR(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?qR(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Ru(e,{forceScroll:!0})}function bV(e){var t;if(!e.state.initialScroll)return;let n=()=>Ru(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),RC(e,{onlyIfAligned:!0})}function IV(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:i,initialContentOffset:s,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=s??0,m=d&&l&&i;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Ws(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){oV(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?fd(e,{resolvedOffset:p}):kC(e,{didInitialScroll:!0}))}function SV(e,t){var n,o,r;let{dataLength:a,didDataChange:i,didStartFreshData:s,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,h=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,g=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),g&&(d?(Ws(e,d),ja(m,{kind:c,previousDataLength:h})):ud(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),ja(m),p){rV(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:h,stylePaddingEnd:f});return}let v=h===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;h!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&LC(e,{resetInitialScroll:!0}),Ru(e))}function YR(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function wV(e){var t;let n=e.pendingContainerIds;if(e.pendingContainerIds=void 0,n===void 0)return;let o=e.state,r=n;if(r&&((t=o.userScrollAnchorReset)!=null&&t.keys.size)){r=new Set(r);for(let a of o.userScrollAnchorReset.keys){let i=o.containerItemKeys.get(a);i!==void 0&&r.add(i)}}return r}function cg(e,t){var n;let o=e.pendingContainerIds!==void 0,r=e.pendingContainerIds;if(t===void 0)e.pendingContainerIds=null;else if(r!==null){let a=r;if(!a)a=typeof t=="number"?new Set([t]):new Set(t);else if(typeof t=="number")a.add(t);else for(let i of t)a.add(i);e.pendingContainerIds=a}if(!o){let a=((n=le(e,"containerLayoutEpoch"))!=null?n:0)+1;Pe(e,"containerLayoutEpoch",a)}}function TV(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:h,columnSpans:g,positions:v,props:{data:x,itemsAreEqual:y,keyExtractor:C}}=m,w=x[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let k=(r=m.idCache[n])!=null?r:Bt(m,n),S=(a=o?.updateLayout)!=null?a:!0,L=!1,I=!1;if(S){let N=v[n];if(N===void 0)return Pe(e,`containerPosition${t}`,cd),{didChangePosition:!1,didRefreshData:!1};let R=(N||0)-((i=o?.scrollAdjustPending)!=null?i:0),$=(s=m.sizes.get(k))!=null?s:fo(e,k,n,w),H=zK(m,R,$,le(e,"totalSize")),K=h[n]||1,O=g[n]||1,oe=le(e,`containerPosition${t}`),te=le(e,`containerColumn${t}`),W=le(e,`containerSpan${t}`);H>cd&&H!==oe&&(Pe(e,`containerPosition${t}`,H),L=!0),K>=0&&K!==te&&Pe(e,`containerColumn${t}`,K),O!==W&&Pe(e,`containerSpan${t}`,O)}le(e,`containerItemIndex${t}`)!==n&&Pe(e,`containerItemIndex${t}`,n);let E=le(e,`containerItemData${t}`),A=()=>{Pe(e,`containerItemData${t}`,w),I=!0};if(E!==w){let N=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===x?m.pendingDataComparison:void 0,R=(c=N?.byIndex[n])!=null?c:0;if(R===2)A();else if(R!==1){let $=(f=le(e,`containerItemKey${t}`))!=null?f:k,H=C?.(E,n);if(E===void 0||!C||H!==$)A();else if(!y)A();else{let K=y(E,w,n,x);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==x)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:x,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=K?1:2),K||A()}}}return{didChangePosition:L,didRefreshData:I}}function LV(e,t,n){var o;let r=e.state,a=le(e,"numColumns"),i=t;r.columns[t]!==1&&(i=JM(r,a,t));let l=0,d=r.columns[i];if(i>0){let c=i-1,f=(o=r.positions[c])!=null?o:0,p=JM(r,a,c),m=kV(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function JM(e,t,n){if(t<=1)return Math.max(0,n);let o=Math.max(0,n);for(;o>0&&e.columns[o]!==1;)o--;return o}function kV(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let i=0;for(let s=t;s<=n;s++){if(s<0||s>=a.length)continue;let l=r.idCache[s],d=fo(e,l,s,a[s],o);d>i&&(i=d)}return i}function PV(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=le(e,"numColumns"))!=null?t:1;if(a.length===0)Lu(e,null,0);else{let s=a.length-1,l=Bt(o,s),d=r[s];if(l!==void 0&&d!==void 0)if(i>1){let c=s;for(;c>0;){let p=o.columns[c];if(p===1||p===void 0)break;c-=1}let f=0;for(let p=c;p<=s;p++){let m=(n=o.idCache[p])!=null?n:Bt(o,p),h=fo(e,m,p,a[p]);h>f&&(f=h)}Lu(e,null,d+f)}else{let c=fo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Lu(e,null,f)}}}}function JR(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?uo(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Bt(t,i);let s=t.positions[i];r[a]=IC(t,s,o)}Pe(e,"snapToOffsets",r)}function ZR(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:i,startIndex:s}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,h=e.positionListeners.size>0,{columns:g,columnSpans:v,indexByKey:x,positions:y,idCache:C,sizesKnown:w,props:{data:k,overrideItemLayout:S,snapToIndices:L},scrollingTo:I}=m,T=k.length,E=(l=le(e,"numColumns"))!=null?l:1,A=E>1,N=Uo?new Map:void 0,R=le(e,"extraData"),$=S?{span:1}:void 0,H=m.lastScrollDelta,K=i??Cg(m),O=!o&&!t&&(r||Math.abs(K)>0||m.scrollLength>0&&H>m.scrollLength),oe=a+1e3,te=!0,W=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=le(e,"scrollAdjustPending"))!=null?d:0)!==0,Ke=!1,ve=0,fe=1,Ne=0;if(t&&(v.length=0),A||(g.length&&(g.length=0),v.length&&(v.length=0)),s>0){if(A){let{startIndex:re,currentRowTop:Ie}=LV(e,s,te);s=re,ve=Ie}else if(s<T){let re=s-1,Ie=Bt(m,re),st=(c=y[re])!=null?c:0,dt=(f=w.get(Ie))!=null?f:fo(e,Ie,re,k[re],te,W,Ke);ve=st+dt}}let Ae=t||x.size===0,ae=A&&!!S&&!!$,Ee=!1,xe;for(let re=s;re<T;re++){if(O&&xe!==void 0&&re>xe){Ee=!0;break}O&&xe===void 0&&!I&&!t&&ve>oe&&(xe=re+(A?E:1)+10);let Ie=(p=C[re])!=null?p:Bt(m,re),st=1;if(ae){$.span=1,S($,k[re],re,E,R);let ct=$.span;ct!==void 0&&Number.isFinite(ct)&&(st=Math.max(1,Math.min(E,Math.round(ct))))}A&&fe+st-1>E&&(ve+=Ne,fe=1,Ne=0);let dt=w.get(Ie),lt=dt!==void 0?dt:fo(e,Ie,re,k[re],te,W,Ke);Uo&&Ae&&(N.has(Ie)&&console.error(`[legend-list] Error: Detected overlapping key (${Ie}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),N.set(Ie,re)),ve!==y[re]&&(y[re]=ve,h&&GK(e,Ie,ve)),Ae&&x.set(Ie,re),A?(g[re]=fe,v[re]=st,lt>Ne&&(Ne=lt),fe+=st,fe>E&&(ve+=Ne,fe=1,Ne=0)):ve+=lt}Ee||PV(e),L&&JR(e)}function eN(e,t){let n=e.mapViewabilityConfigStates;n||(n=new Map,e.mapViewabilityConfigStates=n);let o=n.get(t);return o||(o={end:-1,endBuffered:-1,previousEnd:-1,previousStart:-1,start:-1,startBuffered:-1,viewableItems:[]},n.set(t,o)),o}function AV(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function tN(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=eN(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>ZM(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):ZM(l,d,e,t,o)}}function ZM(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=eN(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)nN(n,o,a,y,C.key,r,C.item,C.index).sizeVisible<0&&(h??(h=[]),h.push(y));let g=[],v=new Set;if(d)for(let y of d){v.add(y.key);let C=n.indexByKey.get(y.key),w=C!==void 0?e[C]:void 0,k=cC(o,y.key),S=!1;C!==void 0&&w!==void 0&&(S=tR(n,o,a,k,y.key,r,w,C)),S||g.push({...y,index:C??y.index,isViewable:!1,item:w??y.item})}let x=[];for(let y=c;y<=f;y++){let C=e[y];if(C){let w=Bt(n,y),k=cC(o,w);if(tR(n,o,a,k,w,r,C,y)){let S={containerId:k,index:y,isViewable:!0,item:C,key:w};x.push(S),v.has(S.key)||g.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:x}),g.length>0){l.viewableItems=x;for(let y=0;y<g.length;y++){let C=g[y];EV(o,s,C.containerId,C)}i&&i({changed:g,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:x})}if(h)for(let y of h){let C=o.mapViewabilityAmountValues.get(y);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(y)}}function eR(e,t){return!!e&&e.containerId===t.containerId&&e.index===t.index&&e.isViewable===t.isViewable&&e.item===t.item&&e.key===t.key&&e.percentOfScroller===t.percentOfScroller&&e.percentVisible===t.percentVisible&&e.scrollSize===t.scrollSize&&e.size===t.size&&e.sizeVisible===t.sizeVisible}function nN(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(le(t,"stylePaddingTop")||0)+(le(t,"alignItemsAtEndPadding")||0)+(le(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,h=m?p:f,g=d-c,v=e.positions[s],x=l.get(r)||0;if(v===void 0){let N={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:x,sizeVisible:-1},R=t.mapViewabilityAmountValues.get(o);if(!eR(R,N)){t.mapViewabilityAmountValues.set(o,N);let $=t.mapViewabilityAmountCallbacks.get(o);$&&$(N)}return N}let y=v-g,C=y+x,w=y>=0&&C<=a&&C>y,k=w?x:Math.min(C,a)-Math.max(y,0),S=x?w?100:100*(k/x):0,L=x?100*(k/a):0,T=(w?100:m?L:S)>=h,E={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:L,percentVisible:S,scrollSize:a,size:x,sizeVisible:k},A=t.mapViewabilityAmountValues.get(o);if(!eR(A,E)){t.mapViewabilityAmountValues.set(o,E);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(E)}return E}function tR(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=nN(e,t,n,o,r,a,i,s)),l.isViewable}function EV(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var nR=vR.unstable_batchedUpdates,MV=typeof nR=="function"?nR:e=>e(),RV=32,NV=64,_V=3;function DV(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*_V),o=t+NV,r=Math.max(t,Math.min(n,o),Math.min(e,RV)),a=Math.max(e,t);return Math.min(a,r)}function OV(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function FV(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=le(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,h=r.length>0?new Set(r):void 0,g=t.map((E,A)=>({isSticky:c.props.stickyHeaderIndicesSet.has(E),itemIndex:E,itemType:a?.(E),order:A})),v=g.filter(E=>!E.isSticky),x=g.filter(E=>E.isSticky),y=[],C=[];for(let E=0;E<d;E++){let A=le(e,`containerItemKey${E}`),N=!!h?.has(E);if(!(A&&i?.has(A)&&c.indexByKey.has(A))){if(p.has(E))(A===void 0||N)&&C.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(A===void 0||N)y.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(!m){let $=c.indexByKey.get(A);if($!==void 0&&($<n||$>o)){let H=$<n?n-$:$-o;y.push({containerIndex:E,distance:H})}}}}y.sort(BV);let w=new Array(l),k=d,S=!1,L=(E,A)=>{w[E.order]={containerIndex:A,itemIndex:E.itemIndex,itemType:E.itemType},h?.delete(A)&&(S=!0)},I=(E,A,N)=>{for(let R of E){if(w[R.order])continue;let $=A.findIndex(H=>{var K;return N((K=f.get(H.containerIndex))==null?void 0:K.itemType,R.itemType)});if($!==-1){let[H]=A.splice($,1);L(R,H.containerIndex)}}},T=(E,A,N)=>{a&&I(E,A,(R,$)=>$!==void 0&&R===$),I(E,A,R=>R===void 0),N&&I(E,A,()=>!0)};T(v,y,!0),T(x,C,!1);for(let E of g){if(w[E.order])continue;let A=k++;E.isSticky&&p.add(A),L(E,A)}if(S&&(r.length=0,h))for(let E of h)r.push(E);if(Uo){let E=(s=le(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;k>E&&console.warn("[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",{debugInfo:{numContainers:d,numContainersPooled:E,numNeeded:l,stillNeeded:k-d}})}return w}function BV(e,t){return t.distance-e.distance}function zV(e){let t=e.state;t.queuedInitialLayout=!0,AR(e),kC(e,{didLayout:!0})}var $V=4,HV=100;function UV(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/$V);return Math.sign(e)*t*n}function KV(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},HV,"renderRangeProjection")}function qV(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],i=o[a];if(i!==void 0&&t>=i)return r}return-1}function VV(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=le(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function WV(e,t,n,o,r,a,i){var s;let l=e.state;Pe(e,"activeStickyIndex",n>=0?t[n]:-1);for(let d=0;d<=1;d++){let c=n-d;if(c<0)continue;let f=t[c];if(VV(e,f))continue;let p=(s=l.idCache[f])!=null?s:Bt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function GV(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=le(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||i(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Pe(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let g=t[m+1],v=!1;if(g){let x=d.positions[g];v=x!==void 0&&n>x+o*2}else{let x=(s=d.idCache[p])!=null?s:Bt(d,p);if(x){let y=d.positions[p],C=(l=d.sizes.get(x))!=null?l:fo(e,x,p,d.props.data[p]);v=y!==void 0&&n>y+C+o*3}}v&&a.push(c)}}function oN(e,t,n,o,r,a){let i=!1;return e.startNoBuffer===null&&n+o>r&&(e.startNoBuffer=t),e.firstFullyOnScreenIndex===void 0&&n>=r-10&&n<=a&&(e.firstFullyOnScreenIndex=t),e.startNoBuffer!==null&&(n<=a?e.endNoBuffer=t:i=!0),i}function rN(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let i=a;i<=t.endNoBuffer;i++){let s=(o=e.idCache[i])!=null?o:Bt(e,i);r.push(s)}return r}function fC(e,t){var n;let o=e.props.onFirstVisibleItemChanged;if(!o||t===null||t<0||t>=e.props.data.length)return;let r=(n=e.idCache[t])!=null?n:Bt(e,t),a=e.lastFirstVisibleItemCallback;a?.index===t&&a.key===r||(e.lastFirstVisibleItemCallback={index:t,key:r},o({index:t,item:e.props.data[t],key:r}))}function jV(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:i,positions:s,props:{data:l},sizes:d,startBuffered:c}=r;if(c===null||a===null||c<0||a<c)return null;for(let f=c;f<=a&&f<l.length;f++){let p=(n=i[f])!=null?n:Bt(r,f),m=(o=d.get(p))!=null?o:fo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function QV(e,t,n,o,r){var a,i;let s=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=s;if(m===null||l===null||m<0||l<m)return;let h={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let g=m;g<=l&&g<f.length;g++){let v=(a=d[g])!=null?a:Bt(s,g),x=(i=p.get(v))!=null?i:fo(e,v,g,f[g]),y=c[g];if(oN(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:rN(s,h),startNoBuffer:h.startNoBuffer}),fC(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&tN(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function Wa(e,t={}){let n=e.state;MV(()=>{var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k,S,L;let{columns:I,containerItemKeys:T,enableScrollForNextCalculateItemsInView:E,idCache:A,indexByKey:N,minIndexSizeChanged:R,positions:$,props:{alwaysRenderIndicesArr:H,alwaysRenderIndicesSet:K,getItemType:O,keyExtractor:oe,onStickyHeaderChange:te},scrollForNextCalculateItemsInView:W,scrollLength:Ke,sizes:ve,startBufferedId:fe,viewabilityConfigCallbackPairs:Ne}=n,{data:Ae}=n.props,ae=n.props.stickyHeaderIndicesArr||[],Ee=n.props.stickyHeaderIndicesSet||new Set,xe=RR(e,t.drawDistanceMode),{dataChanged:re,doMVCP:Ie,forceFullItemPositions:st}=t,dt=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,lt=!!dt,ct=le(e,"numContainers");if(!Ae||Ke===0||!ct)return;let Mt=uo(e),at,$e=le(e,"stylePaddingTop")+le(e,"alignItemsAtEndPadding")+le(e,"headerSize"),Se=le(e,"numColumns"),Be=(r=t.scrollVelocity)!=null?r:Cg(n),Ze=0,{initialScroll:qt,queuedInitialLayout:X}=n,nn=lt?(a=dt?.scroll)!=null?a:n.scroll:!X&&Tu(n)&&qt?Hr(e,qt):n.scroll,yt=0,dn=0,Tt=0,Yt=0,Jt=0,Rt=0,On=nn,An=J=>{var qe;On=J,yt=(qe=le(e,"scrollAdjustPending"))!=null?qe:0,dn=yt-$e,Tt=Math.round(J+Ze+dn),Tt+Ke>Mt&&(Tt=Math.max(0,Mt-Ke))};An(nn);let fn=le(e,"activeStickyIndex"),Fn=()=>{let J=ae.length>0?qV(ae,Tt,n):-1,qe=J>=0?ae[J]:-1,xt=fn!==qe;(J>=0||fn>=0)&&Pe(e,"activeStickyIndex",qe);let Qe=!!te&&ae.length>0&&xt;return{currentStickyIdx:J,finishCalculateItemsInView:Qe?()=>{let cn=Ae[qe];cn!==void 0&&te?.({index:qe,item:cn})}:void 0}},Nt=re?void 0:Fn(),Vt=xe,Bn=xe;Be>0||Be===0&&Tt<Math.max(50,xe)?(Vt=xe*.5,Bn=xe*1.5):(Vt=xe*1.5,Bn=xe*.5);let zt=!re&&!st&&!lt&&!Tu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!le(e,"readyToRender")?UV(Be,Math.min(Vt,Bn)):0,D=()=>{let J=Math.max(0,Tt),qe=Math.max(0,-On);Jt=Math.max(J,Tt+Ke+qe),Yt=J-Vt+zt,Rt=Jt+Bn+zt};if(D(),zt!==0&&KV(e),E&&!lt&&!re&&!st&&W){let{top:J,bottom:qe}=W;if(J===null&&qe===null)n.scrollForNextCalculateItemsInView=void 0;else if((J===null||Yt>J)&&(qe===null||Rt<qe)&&!Ou(n)){Ne?QV(e,Ne,Ke,Tt,Jt):n.props.onFirstVisibleItemChanged&&fC(n,jV(e,Tt)),(i=Nt?.finishCalculateItemsInView)==null||i.call(Nt);return}}let Y=Ie&&!lt?Dq(e,re):void 0;re&&YR(n);let de=st||re?0:(s=R??n.startBuffered)!=null?s:0,ie=!st&&!re&&Se>1&&R!==void 0;ZR(e,re,{doMVCP:Ie,forceFullUpdate:!!st,optimizeForVisibleWindow:ie,scrollBottomBuffered:Rt,scrollVelocity:Be,startIndex:de}),Mt=uo(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let pe;if(re&&Ie&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let J=n.props.maintainVisibleContentPosition.shouldRestorePosition;pe=new Set;for(let qe of n.idsInView){let xt=N.get(qe);xt!==void 0&&(J&&!J(Ae[xt],xt,Ae)||pe.add(qe))}}let et=n.scroll,gt=(l=le(e,"scrollAdjustPending"))!=null?l:0;Y?.(),Y&&(n.scroll!==et||((d=le(e,"scrollAdjustPending"))!=null?d:0)!==gt)&&(An(n.scroll),D()),re&&(Nt=Fn());let ht=null,Zt=null,Wt=null,bt=(c=lt?dt?.targetIndexSeed:void 0)!=null?c:!re&&fe&&N.get(fe)||0;for(let J=bt;J>=0;J--){let qe=(f=A[J])!=null?f:Bt(n,J),xt=$[J],Qe=(p=ve.get(qe))!=null?p:fo(e,qe,J,Ae[J]);if(xt+Qe>Yt)bt=J;else break}if(Se>1)for(;bt>0;){let J=I[bt];if(J===1||J===void 0)break;bt-=1}let mn=!1,ge,vt,Lt=0;for(let J=0;J<ct;J++){let qe=le(e,`containerItemKey${J}`);if(qe!==void 0){let xt=N.get(qe);Lt=Math.max(Lt,xt)}}let ut={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},tt=Ae.length;for(let J=Math.max(0,bt);J<tt&&(!mn||J<=Lt);J++){let qe=(m=A[J])!=null?m:Bt(n,J),xt=(h=ve.get(qe))!=null?h:fo(e,qe,J,Ae[J]),Qe=$[J];mn||(oN(ut,J,Qe,xt,Tt,Jt),ht===null&&Qe+xt>Yt&&(ht=J,Zt=qe,Yt<0?ge=null:ge=Qe),ut.startNoBuffer!==null&&(Qe<=Rt?(Wt=J,Rt>Mt?vt=null:vt=Qe+xt):mn=!0))}Object.assign(n,{endBuffered:Wt,endNoBuffer:ut.endNoBuffer,firstFullyOnScreenIndex:ut.firstFullyOnScreenIndex,idsInView:rN(n,ut),startBuffered:ht,startBufferedId:Zt,startNoBuffer:ut.startNoBuffer}),E&&ge!==void 0&&vt!==void 0&&(n.scrollForNextCalculateItemsInView=ku(ge)&&ku(vt)?void 0:{bottom:vt,top:ge});let It=ct,zn=[];if(re)for(let J=0;J<It;J++){let qe=le(e,`containerItemKey${J}`);(!oe||qe&&N.get(qe)===void 0)&&zn.push(J)}let Ge=n.scrollTargetPinnedRange,_t=0,En=-1;Ge&&(_t=Math.max(0,Math.min(Ge.start,Ge.end)),En=Math.min(tt-1,Math.max(Ge.start,Ge.end)));let gn=_t<=En,Lo=J=>K.has(J)||gn&&J>=_t&&J<=En;if(ht!==null&&Wt!==null){let J=[],qe=new Set,xt=Qe=>{var cn;if(Qe>=0&&Qe<tt){let hn=(cn=A[Qe])!=null?cn:Bt(n,Qe),vn=T.get(hn);vn!==void 0?n.stickyContainerPool.add(vn):!ku(hn)&&!qe.has(Qe)&&(qe.add(Qe),J.push(Qe))}};for(let Qe=ht;Qe<=Wt;Qe++){let cn=(g=A[Qe])!=null?g:Bt(n,Qe);T.has(cn)||(qe.add(Qe),J.push(Qe))}for(let Qe of H)xt(Qe);if(gn)for(let Qe=_t;Qe<=En;Qe++)xt(Qe);if(ae.length>0?WV(e,ae,(v=Nt?.currentStickyIdx)!=null?v:-1,J,qe,ht,Wt):fn!==-1&&Pe(e,"activeStickyIndex",-1),J.length>0){let cn=FV(e,J,ht,Wt,zn,O?hn=>{let vn=O(Ae[hn],hn);return vn!==void 0?String(vn):""}:void 0,pe);for(let hn of cn){let vn=hn.itemIndex,$t=hn.containerIndex,$n=(x=A[vn])!=null?x:Bt(n,vn),en=le(e,`containerItemKey${$t}`);en&&en!==$n&&T.delete(en),en!==$n&&(at??(at=new Set),at.add($t),n.containerItemGenerations[$t]=((y=n.containerItemGenerations[$t])!=null?y:0)+1),Pe(e,`containerItemKey${$t}`,$n),Pe(e,`containerItemIndex${$t}`,vn),Pe(e,`containerItemData${$t}`,Ae[vn]),n.containerItemMetadata.set($t,WR(n,vn,Ae[vn],hn.itemType)),T.set($n,$t),(C=n.userScrollAnchorReset)==null||C.keys.add($n);let mo=`containerSticky${$t}`,Ya=Ee.has(vn),fa=Lo(vn);Ya?(Pe(e,mo,!0),n.stickyContainerPool.add($t)):(le(e,mo)&&Pe(e,mo,!1),fa?n.stickyContainerPool.add($t):n.stickyContainerPool.delete($t)),$t>=It&&(It=$t+1)}It!==ct&&(Pe(e,"numContainers",It),It>le(e,"numContainersPooled")&&Pe(e,"numContainersPooled",OV(tt,It)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&GV(e,ae,Tt,xe,(k=Nt?.currentStickyIdx)!=null?k:-1,zn,Lo);let Mn=zn.length>0?new Set(zn):void 0,ro=!1;for(let J=0;J<It;J++){let qe=le(e,`containerItemKey${J}`);if(Mn?.has(J))qe!==void 0&&(T.delete(qe),at??(at=new Set),at.add(J),n.containerItemGenerations[J]=((S=n.containerItemGenerations[J])!=null?S:0)+1),n.containerItemMetadata.delete(J),n.stickyContainerPool.has(J)&&(Pe(e,`containerSticky${J}`,!1),n.stickyContainerPool.delete(J)),Pe(e,`containerItemKey${J}`,void 0),Pe(e,`containerItemIndex${J}`,void 0),Pe(e,`containerItemData${J}`,void 0),Pe(e,`containerPosition${J}`,cd),Pe(e,`containerColumn${J}`,-1),Pe(e,`containerSpan${J}`,1);else{let xt=N.get(qe);xt!==void 0&&(ro=TV(e,J,xt,{scrollAdjustPending:yt,updateLayout:!0}).didChangePosition||ro)}}if(at&&SC&&cg(e,at),ro&&Pe(e,"lastPositionUpdate",Date.now()),lt){sV(e);return}fC(n,ut.startNoBuffer),!X&&!n.didContainersLayout&&(Tu(n)?Pu(n,n.startBuffered,n.endBuffered):Pu(n,n.startNoBuffer,n.endNoBuffer)||Pu(n,n.startBuffered,n.endBuffered))&&(zV(e),bV(e)),Ne&&ut.startNoBuffer!==null&&ut.endNoBuffer!==null&&tN(e.state,e,Ne,Ke,ut.startNoBuffer,ut.endNoBuffer,ht??ut.startNoBuffer,Wt??ut.endNoBuffer),(L=Nt?.finishCalculateItemsInView)==null||L.call(Nt)})}function ug(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=le(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:g,anchorMaxSize:v,anchorOffset:x=0}=r,{data:y}=o.props;if(g>=0&&g<y.length&&o.scrollLength>0){d=Bt(o,g);let C=0,w=!1;for(let S=g;S<y.length;S++){let L=FR(e,S),I=S===g&&v!==void 0?Math.min(L||0,Math.max(0,v)):L;L===void 0&&(w=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+bC(o.props),c=!w;let k=Math.max(0,o.scrollLength-C-x);f=w?Math.min(a||0,k):k}else g>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(i!==l||s!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(js(e),Vs(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Vs(e,o.scroll,!0,{markHasScrolled:!1})),f}function XV(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(Wa(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>Wa(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),Wa(e,{doMVCP:!0}))}function oR(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=le(e,"otherAxisSize");(!a||r>a)&&Pe(e,"otherAxisSize",r)}}var qa;function aN(e){let t=qa===void 0;qa??(qa=new Map);try{e()}finally{if(t){let n=qa;qa=void 0;for(let[o,r]of n)_C(o,r)}}}function YV(e,t){e.didChange||(e.didChange=t.didChange),e.didMeasureUserScrollAnchorResetItem||(e.didMeasureUserScrollAnchorResetItem=t.didMeasureUserScrollAnchorResetItem),e.needsRecalculate||(e.needsRecalculate=t.needsRecalculate),e.shouldMaintainScrollAtEnd||(e.shouldMaintainScrollAtEnd=t.shouldMaintainScrollAtEnd)}function JV(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,XV(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&ug(e),t.didChange&&t.shouldMaintainScrollAtEnd&&pd(e)}function iN(e,t){if(qa){let n=qa.get(e);n?n.push(t):qa.set(e,[t])}else _C(e,[t])}function _C(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||le(e,`containerItemKey${a.containerId}`)===a.itemKey){let s=o.indexByKey.get(a.itemKey),l=s===void 0||(n=o.props.data)==null?void 0:n[s],d=a.containerId!==void 0&&s!==void 0&&l!==void 0?cV(o,a.containerId,s,l):void 0,c=ZV(e,a.itemKey,a.size,d);YV(r,c)}JV(e,r)}function ZV(e,t,n,o){var r,a;let i=e.state,s=i.userScrollAnchorReset,l=!!s?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:h,data:g,maintainScrollAtEnd:v}}=i;if(!g)return{didMeasureUserScrollAnchorResetItem:l};let x=i.indexByKey.get(t);if(f){if(x===void 0)return{didMeasureUserScrollAnchorResetItem:l};let I=i.props.data[x];if(I===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let E=(a=o?.itemType)!=null?a:p&&(r=p(I,x))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,x,E),itemType:E}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return oR(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,w,k=i.sizesKnown.get(t),S=e4(e,t,n,o),L=Eu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,x):x;let{startBuffered:I,endBuffered:T}=i;y||(y=x>=I&&x<=T),!y&&i.containerItemKeys.has(t)&&(y=!0),(k===void 0||Math.abs(k-L)>5)&&(C=!0),h?.({index:x,itemData:i.props.data[x],itemKey:t,previous:L-S,size:L})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),oR(e,n,m),d||Pu(i,i.startBuffered,i.endBuffered)){let I=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:y,shouldMaintainScrollAtEnd:I}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function e4(e,t,n,o){var r,a;let i=e.state,{indexByKey:s,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=i;if(!c)return 0;let h=s.get(t),g=c[h],v=o?.itemType,x=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(g,h))!=null?r:"",x=m(g,h,v));let y=o?.didResolveFixedItemSize||v!==void 0||x!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:x,itemType:v}:void 0,C=fo(e,t,h,g,void 0,void 0,void 0,y),w=f?n.width:n.height,k=l.get(t),S=Math.round(w);if(l.set(t,S),x===void 0&&S>0){v??(v=p&&(a=p(g,h))!=null?a:"");let L=d[v];L||(L=d[v]={avg:0,num:0}),L.num===0?(L.avg=S,L.num++):k!==void 0&&k>0?L.avg+=(S-k)/L.num:(L.avg=(L.avg*L.num+S)/(L.num+1),L.num++)}return!C||Math.abs(C-S)>.1?(dC(e,t,S),S-C):0}function t4(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=le(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();JK(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&_C(e,n)}var sN=qn,ua=ue,n4=ua(function({children:t}){let n=Ur(),[o]=Ko(["containerLayoutEpoch"]);return ye(()=>{{let r=wV(n);r!==void 0&&t4(n,r)}},[n,o]),t}),ag=e=>sh(e)?e:e?Te(e,null):null,o4=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),pC={contain:"paint layout style",...o4?{display:"flex",flexDirection:"column"}:{}},r4=ua(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=cd]=Ko([`containerPosition${t}`]),s=xg(o)?Object.assign({},...o):o,l=n?{...pC,...s,left:i}:{...pC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Te("div",{ref:r,...m,style:l})}),a4=ua(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=cd,p,m]=Ko([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),h=z(()=>{var x;return(x=xg(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=z(()=>{var x;let y={...pC,...h};delete y.transform;let C=(x=i?.offset)!=null?x:0,w=p===m;return y.position=w?"sticky":"absolute",y.zIndex=m+1e3,n?y.left=w?C:f:y.top=w?C:f,y},[h,n,f,m,p,i?.offset]),v=z(()=>i?.backdropComponent?Te("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},ag(i.backdropComponent)):null,[i?.backdropComponent]);return Te("div",{ref:r,style:g,...c},v,d)}),i4=r4;function s4(e){G(()=>e())}var lN=Ht(null),l4=-1;function d4(){return sn(lN)}function c4(){var e;let t=d4(),n=(e=t?.containerId)!=null?e:l4,[o]=Ko([`containerItemKey${n}`]);return jK("lastItemKeys",a=>t&&!ku(o)&&a?.includes(o)||!1)}function u4({ItemSeparatorComponent:e,leadingItem:t}){return c4()?null:Te(e,{leadingItem:t})}var rC=null;function f4(){return rC||(rC=new ResizeObserver(e=>{aN(()=>{for(let t of e){let n=ig.get(t.target);if(n)for(let o of n)o(t)}})})),rC}var ig=new WeakMap;function p4(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=f4(),r=(n=ig.get(e))!=null?n:new Set;return r.size===0&&(ig.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(ig.delete(e),o.unobserve(e))}}function DC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return ye(()=>{var i,s;let l=e.current,c=((s=(i=l?.getScrollableNode)==null?void 0:i.call(l))!=null?s:null)||l;if(!c)return;let f=(m,h)=>{m.height===0&&m.width===0||(o(m,h),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(rR(m),!0),p=m}return p4(c,m=>{var h;let g=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,x=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(h=g?.getBoundingClientRect())!=null?h:m.contentRect,y=p??YK(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let w=!!r?.();(C||w)&&f(rR(x),!1)})},[t,...a||[]]),{}}function rR(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var sg=new Map,aC;function dN(e){sg.delete(e)}function m4(e,t){sg.set(e,t),aC===void 0&&(aC=requestAnimationFrame(()=>{let n=Array.from(sg.values());sg.clear(),aC=void 0,aN(()=>{for(let o of n)o()})}))}function g4({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,i=r.itemKey;r.didLayout=!0;let s=n,l=r.horizontal?"width":"height",d=Eu(n[l]);r.lastSize&&Eu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,iN(t,{containerId:e,itemKey:i,size:s})};!Ou(a)&&f!==void 0&&d+1<f?m4(r,()=>{var h;if(r.itemKey===i){let g=o.current,v=(h=g?.getBoundingClientRect)==null?void 0:h.call(g);v&&(s={height:v.height,width:v.width}),p()}}):(dN(r),p())}function h4({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=_({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=G(0),l=B(f=>{g4({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=B(()=>{cg(t,e)},[e,t]);ye(()=>(t.containerLayoutTriggers.set(e,d),()=>{dN(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),ye(()=>{cg(t,e)});let{onLayout:c}=DC({measureInLayoutEffect:!SC,onLayoutChange:l,ref:r,webLayoutResync:()=>Ou(t.state)},[o,i]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function v4({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:i,otherAxisSize:s}){let l;if(e){let{columnGap:d,rowGap:c,gap:f}=e;n?l={paddingBottom:a>1?(c||f||0)/2:void 0,paddingRight:d||f||void 0,paddingTop:a>1?(c||f||0)/2:void 0}:l={paddingBottom:c||f||void 0,paddingLeft:a>1?(d||f||0)/2:void 0,paddingRight:a>1?(d||f||0)/2:void 0}}return n?{bottom:t==="flex-end"&&a===1?0:void 0,boxSizing:l?"border-box":void 0,direction:r&&Ga.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:s,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:i,...l||{}}:{boxSizing:l?"border-box":void 0,left:i,position:"absolute",right:a>1?null:0,top:0,width:s,...l||{}}}var x4=ua(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Ur(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Qa(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[h=0,g=1,v,x=1,y,C]=Ko([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=_(null),{onLayout:k,triggerLayout:S}=h4({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),L=h>0?h:1,I=Math.min(Math.max(g||1,1),x),T=x>1?`${(L-1)/x*100}%`:0,E=x>1?`${I/x*100}%`:void 0,A=z(()=>v4({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:x,otherAxisPos:T,otherAxisSize:E}),[r,f,T,E,d,l.state.props.contentContainerAlignItems,x,i]),N=z(()=>n!==void 0?a(n):null,[n,v,y]),{renderedItem:R}=N||{},$=z(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return Te(C?m||a4:p||i4,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:k,refView:w,stickyHeaderConfig:s,style:A},Te(lN.Provider,{value:$},R,N&&i&&Te(u4,{ItemSeparatorComponent:i,leadingItem:N.item})))});function y4({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=x4}){let[s]=Ko([`containerItemKey${e}`]);return s===void 0?null:Te(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var C4=ua(function(t){return Te(y4,{...t})});function b4(e,t){let n=Array.from(e.children);if(n.length<=1)return n;let o=n.map(l=>{var d;return[l,(d=t.get(l))!=null?d:null]});o.sort((l,d)=>{let c=l[1],f=d[1];return c===null?1:f===null?-1:c-f});let r=new Map;o.forEach((l,d)=>{r.set(l[0],d)});let a=n.map(l=>r.get(l)),i=I4(a),s=new Set(i);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!s.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],h=n.indexOf(m);if(s.has(h)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function I4(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let s=0;s<t;s++){let l=e[s],d=0,c=n.length;for(;d<c;){let f=Math.floor((d+c)/2);e[r[f]]<l?d=f+1:c=f}d===n.length?(n.push(l),r.push(s)):(n[d]=l,r[d]=s),d>0&&(o[s]=r[d-1])}let a=[],i=r[r.length-1];for(;i!==-1;)a.unshift(i),i=o[i];return a}function S4(e){let t=Ur(),n=_(void 0);q(()=>{let o=Va(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[i,s]of t.viewRefs){let l=s.current,d=le(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}b4(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function w4(e,t){let[n,o]=G(t),r=n!==t;return ye(()=>{o(t)},[t]),e&&!r}var T4=ua(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=_(null),i=Ur(),s=i.columnWrapperStyle,l=Qa(i.state),[d,c,f]=Ko(["otherAxisSize","readyToRender","totalSize"]),p=w4(!!c,t);S4(a);let m=n?{direction:l?"ltr":void 0,flexShrink:0,minHeight:d,opacity:p?1:0,position:"relative",width:f}:{height:f,minWidth:d,opacity:p?1:0,position:"relative"};if(p||(m.pointerEvents="none"),s&&o>1){let{columnGap:h,rowGap:g,gap:v}=s,x=h||v||0,y=g||v||0;n?(y&&(m.marginTop=m.marginBottom=-y/2),x&&(m.marginRight=-x)):y&&(m.marginBottom=-y)}return Te("div",{ref:a,style:m},Te(n4,null,r))}),L4=ua(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Ko(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(Te(C4,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Te(T4,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function k4(e){return xg(e)?Object.assign({},...e.filter(Boolean)):e}var Du={create:e=>e,flatten:e=>k4(e)};function mC(e){let t=_(e);return t.current=e,t}function P4(e){let t=mC(e),n=_(void 0),o=z(()=>({cancel(){n.current!==void 0&&(cancelAnimationFrame(n.current),n.current=void 0)},flush(){o.cancel(),t.current()},schedule(){if(n.current!==void 0)return!1;let r=requestAnimationFrame(()=>{n.current===r&&(n.current=void 0,t.current())});return n.current=r,!0}}),[]);return q(()=>()=>{o.cancel()},[o]),o}var gC="legend-list-content-container",cN="legend-list-scrollbar-x-hidden",uN="legend-list-scrollbar-y-hidden";function A4(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function hC(){var e,t,n,o;return typeof window>"u"?{x:0,y:0}:{x:(t=(e=window.scrollX)!=null?e:window.pageXOffset)!=null?t:0,y:(o=(n=window.scrollY)!=null?n:window.pageYOffset)!=null?o:0}}function aR(e,t){var n,o;let r=e?.getBoundingClientRect();return{left:((n=r?.left)!=null?n:0)+t.x,top:((o=r?.top)!=null?o:0)+t.y}}function fN(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function E4(e,t,n){return fN(n?t:e)}function iR(e,t,n){var o,r,a,i,s,l;if(t&&typeof window<"u"){let d=e?.getBoundingClientRect();return{height:n&&(r=(o=d?.height)!=null?o:e?.clientHeight)!=null?r:window.innerHeight,width:n?window.innerWidth:(i=(a=d?.width)!=null?a:e?.clientWidth)!=null?i:window.innerWidth}}return{height:(s=e?.clientHeight)!=null?s:0,width:(l=e?.clientWidth)!=null?l:0}}function sR(e,t){return Math.max(0,Math.min(e,t))}function lR(e,t){return t?e.width:e.height}function M4(e,t,n){return Math.max(0,lR(e,n)-lR(t,n))}function dR(e,t){return t&&A4()||e}function R4(e,t){return t&&typeof window<"u"?window:e}function N4(e,t,n){let o=e.getBoundingClientRect(),r=hC();return{height:t&&typeof window<"u"&&!n?window.innerHeight:o.height,width:t&&typeof window<"u"&&n?window.innerWidth:o.width,x:t?o.left+r.x:o.left,y:t?o.top+r.y:o.top}}function _4({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var cR="legend-list-scrollbar-axis-hidden-style",D4=200,O4=`.${uN}::-webkit-scrollbar:vertical{width:0;display:none;}.${cN}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function F4(){if(typeof document>"u"||document.getElementById(cR))return;let e=document.createElement("style");e.id=cR,e.textContent=O4,document.head.appendChild(e)}function B4(e){var t,n;let o=(n=(t=e.state)==null?void 0:t.props)==null?void 0:n.contentInsetEndAdjustment;return Math.max(0,o??0)}function z4(e){if(!e?.length)return[];let t=[],n=new Set;for(let o of e)Number.isFinite(o)&&!n.has(o)&&(n.add(o),t.push(o));return t}function $4(e,t){return{height:t?"100%":1,left:t?e:0,pointerEvents:"none",position:"absolute",scrollSnapAlign:"start",top:t?0:e,width:t?1:"100%"}}var uR=qn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:i,maintainVisibleContentPosition:s,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:h=!1,onLayout:g,...v},x){var y,C,w;let k=Ur(),[S]=Ko(["anchoredEndSpaceSize"]),L=_(null),I=_(null),T=h,E=B(()=>R4(L.current,T),[T]),A=B(()=>{let $e=L.current,Se=E4($e,I.current,T),Be=iR($e,T,a);return M4(Se,Be,a)},[a,T]),N=B(()=>{let $e=L.current;if(T){let Se=A(),Be=hC(),Ze=aR($e,Be),qt=a?Be.x-Ze.left:Be.y-Ze.top;return sR(qt,Se)}return $e?a?$e.scrollLeft:$e.scrollTop:0},[A,a,T]),R=B(($e,Se)=>{let Be=L.current,Ze=E();if(!Ze||typeof Ze.scrollTo!="function")return;let qt=A(),X=sR($e,qt),yt={behavior:Se?"smooth":"auto"};if(T){let dn=hC(),Tt=aR(Be,dn),{left:Yt,top:Jt}=_4({clampedOffset:X,horizontal:a,listPos:Tt,scroll:dn});yt.left=Yt,yt.top=Jt}else a?yt.left=X:yt.top=X;Ze.scrollTo(yt)},[A,E,a,T]);Xr(x,()=>({getBoundingClientRect:()=>{var Se;return(Se=L.current)==null?void 0:Se.getBoundingClientRect()},getCurrentScrollOffset:N,getScrollableNode:()=>dR(L.current,T),getScrollEventTarget:()=>E(),getScrollResponder:()=>dR(L.current,T),isWindowScroll:()=>T,scrollBy:(Se,Be)=>{let Ze=E();!Ze||typeof Ze.scrollBy!="function"||Ze.scrollBy({behavior:"auto",left:Se,top:Be})},scrollTo:Se=>{let{x:Be=0,y:Ze=0,animated:qt=!0}=Se;R(a?Be:Ze,qt)},scrollToEnd:(Se={})=>{let{animated:Be=!0}=Se,Ze=A();R(Ze,Be)},scrollToOffset:Se=>{let{offset:Be,animated:Ze=!0}=Se;R(Be,Ze)}}),[N,A,E,a,T,R]);let $=B(()=>{if(!l||!L.current)return;let $e=fN(I.current),Se=iR(L.current,T,a),Be=N(),Ze={nativeEvent:{contentOffset:{x:a?Be:0,y:a?0:Be},contentSize:{height:$e.height,width:$e.width},layoutMeasurement:{height:Se.height,width:Se.width}}};l(Ze)},[N,a,T,l]),H=P4($),K=_(void 0),O=B(()=>{let $e=K.current;$e!==void 0&&(clearTimeout($e),K.current=void 0),H.flush(),d?.()},[d,H]),oe=B($e=>{if(!l)return;let Se=k.state;if(!!Se?.scrollingTo||!!Se?.initialScrollSession&&!Se.didFinishInitialScroll||!!Se?.initialScroll&&!Se.didFinishInitialScroll||!!Se&&Ou(Se)?H.flush():H.schedule(),d){let Ze=K.current;Ze!==void 0&&clearTimeout(Ze),K.current=setTimeout(O,D4)}},[k.state,O,d,l,H]);ye(()=>{let $e=E();if($e)return $e.addEventListener("scroll",oe,{passive:!0}),"onscrollend"in $e&&$e.addEventListener("scrollend",O),()=>{$e.removeEventListener("scroll",oe),"onscrollend"in $e&&$e.removeEventListener("scrollend",O);let Se=K.current;Se!==void 0&&(clearTimeout(Se),K.current=void 0),H.cancel()}},[O,E,oe,H]),q(()=>{let $e=()=>{i&&R(a?i.x||0:i.y||0,!1)};$e(),requestAnimationFrame($e)},[i?.x,i?.y,a,R]),ye(()=>{if(!g||!L.current)return;let $e=L.current,Se=()=>{g({nativeEvent:{layout:N4($e,T,a)}})};Se();let Be=new ResizeObserver(()=>{Se()});Be.observe($e);let Ze=()=>{Se()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",Ze),()=>{Be.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Ze)}},[T,g]);let te=!T&&(a?!f&&cN:!p&&uN);ye(()=>{te&&F4()},[te]);let W={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Du.flatten(n),...s?{overflowAnchor:"none"}:{}},Ke=B4(k),ve=(C=(y=k.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&S?S:0,fe=Math.max(0,Ke-ve),Ne=fe?a?{flexShrink:0,width:fe}:{height:fe}:void 0,Ae={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...Du.flatten(r),...s?{overflowAnchor:"none"}:{}},ae=o?`${gC} ${o}`:gC,{contentContainerClassName:Ee,contentInset:xe,scrollEventThrottle:re,ScrollComponent:Ie,snapToOffsets:st,useWindowScroll:dt,className:lt,...ct}=v,Mt=T?[]:z4(st);Mt.length>0&&(W.scrollSnapType=a?"x mandatory":"y mandatory",Ae.position=(w=Ae.position)!=null?w:"relative");let at=te?lt?`${lt} ${te}`:te:lt;return Uo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${lt??""}`)&&Ks("className-gap","className/contentContainerClassName gap classes are not supported in LegendList because it needs to use exact values internally. Use contentContainerStyle={{ gap: ... }} or columnWrapperStyle instead."),Te("div",{className:at,ref:L,...ct,style:W},m,Te("div",{className:ae,ref:I,style:Ae},Mt.map($e=>Te("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":$e,key:`snap-${$e}`,style:$4($e,a)})),t,Ne?Te("div",{"aria-hidden":!0,style:Ne}):null))});function H4({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function fR(e,t){let n=Ur();ye(()=>Va(n,e,r=>{t(r)}),[t,n,e])}function U4(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function K4(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,i=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,s=null;return i&&(s=t?.isConnected&&t.parentElement===i?t:i.querySelector(`:scope > .${gC}`)),i?{contentNode:s,scrollElement:i}:null}function q4(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function V4(){let e=Ur(),t=_(0),n=_(0),o=_(void 0),r=_(void 0),a=_(null),i=B(()=>{let s=le(e,"scrollAdjust"),l=le(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=K4(e,a.current);if(f){let p=!!e.state.props.horizontal,m=U4(p),{contentNode:h,scrollElement:g}=f,v=p?g.scrollLeft:g.scrollTop,x=(l||0)-n.current,C=(x!==0?v+x:e.state.scroll)-v,w=Math.abs(C)>.01,k=()=>q4(g,m.x*C,m.y*C);if(a.current=h,w&&h){let S=h[m.contentSizeKey],L=g[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+L){let E=h.style[m.paddingEndProp],A=r.current,N=A?.value===E?A.baseline:E,R=(I+L-S)*2,H=`${(Number.parseFloat(window.getComputedStyle(h)[m.paddingEndProp])||0)+R}px`;h.style[m.paddingEndProp]=H,r.current={baseline:N,value:h.style[m.paddingEndProp]},h.offsetHeight,k(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let K=r.current;o.current=void 0,r.current=void 0,h.style[m.paddingEndProp]===K?.value&&(h.style[m.paddingEndProp]=K.baseline)})}else k()}else w&&k()}t.current=d,n.current=l||0}},[e]);return fR("scrollAdjust",i),fR("scrollAdjustUserOffset",i),null}var W4=qn(function({ScrollComponent:t,...n},o){let[r]=Ko(["snapToOffsets"]);return Te(t,{...n,ref:o,snapToOffsets:r})}),vC=.1;function G4(e,t,n){let o=le(e,t)!==n;return o&&(Pe(e,t,n),js(e)),o}function j4(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:i,scrollingTo:s}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!s&&i>=c-vC&&Math.abs(l)>vC}function pR(e,t){let{state:n}=e,o=le(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>vC;r&&(Pe(e,"headerSize",t),js(e),a&&j4(e,o,t)&&Qs(e,t-o)),n.didMeasureHeader=!0}function Q4(e,t){let n=G4(e,"footerSize",t);return n&&ug(e),n}function X4(e,t){var n,o,r,a,i,s,l,d;return((n=e?.top)!=null?n:0)===((o=t?.top)!=null?o:0)&&((r=e?.bottom)!=null?r:0)===((a=t?.bottom)!=null?a:0)&&((i=e?.left)!=null?i:0)===((s=t?.left)!=null?s:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function Y4(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!X4(o,r);return n.contentInsetOverride=r,a&&js(e),a}function J4(e,t){let n=mC(e),o=mC(t);return z(()=>qn((r,a)=>{var i,s;return(s=(i=n.current)==null?void 0:i.call(n,o.current(r,a)))!=null?s:null}),[o,n])}var mR=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=_(null),a=t??r;return DC({onLayoutChange:e,ref:a}),Te("div",{...o,ref:a},n)},Z4=ua(function({horizontal:t}){let[n=0]=Ko(["alignItemsAtEndPadding"]);return n<=0?null:Te(fg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),eW=ua(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:i,recycleItems:s,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:h,ListFooterComponentStyle:g,ListEmptyComponent:v,getRenderedItem:x,refScrollView:y,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:k,onInternalScrollEnd:S,scrollAdjustHandler:L,snapToIndices:I,stickyHeaderConfig:T,stickyHeaderIndices:E,useWindowScroll:A=!1,...N}){let R=Ur(),$=R.state.props.maintainVisibleContentPosition,[H=0,K=0]=Ko(["anchoredEndSpaceSize","otherAxisSize"]),O=R.state.props.alignItemsAtEndPaddingEnabled,oe=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&H>0,te;if(oe){let Ee=a?Qa(R.state)?"Left":"Right":"Bottom",xe=Du.flatten(r);te={[`padding${Ee}`]:wu({},xe||{},Ee)+H}}let W=H4({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:K}),Ke=J4(C,(Ee,xe)=>({...Ee,ref:xe})),ve=C?Ke:uR,fe=I?W4:ve,Ne=B((Ee,xe)=>{var re;let Ie=Q4(R,Ee);xe?.(),Ie&&((re=R.state.props.maintainScrollAtEnd)!=null&&re.onFooterLayout)&&pd(R)},[R]);ye(()=>{p||pR(R,0),h||Ne(0)},[p,h,R,Ne]);let Ae=B(Ee=>{let xe=Ee[a?"width":"height"];pR(R,xe)},[R,a]),ae=B((Ee,xe)=>{let re=Ee[a?"width":"height"];Ne(re,()=>{w?.(Ee,xe)})},[a,w,Ne]);return Te(fe,{...N,...ve===uR?{onInternalScrollEnd:S,useWindowScroll:A}:{},contentContainerStyle:[a?{height:"100%"}:{},r,te,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:$.size||$.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:y,ScrollComponent:I?ve:void 0,style:W?[W,o]:o},Te(V4,null),p&&Te(mR,{onLayoutChange:Ae,style:m},ag(p)),v&&ag(v),O&&Te(Z4,{horizontal:a}),t&&!v&&Te(L4,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),h&&Te(mR,{onLayoutChange:ae,style:g},ag(h)),Uo&&eq)}),tW=100,nW=.9,oW=.9;function rW(e){let t=Ur(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;q(()=>{l&&(a??1)>1&&Ks("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),q(()=>{s&&i&&Ks("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),q(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Ks("keyExtractor","Changing data without a keyExtractor can cause slow performance and resetting scroll. If your list data can change you should use a keyExtractor with a unique id for best performance and behavior.")},[o,t,r]),q(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<tW)return;let p=()=>{let h=le(t,"readyToRender"),g=le(t,"numContainers")||0,v=le(t,"totalSize")||0,x=t.state.scrollLength||0;if(!h||v<=0||x<=0)return;let y=g>=Math.ceil(c*nW),C=x>=v*oW;y&&C&&Ks("webUnboundedOuterSize","LegendList appears to have an unbounded outer height on web, so virtualization is effectively disabled. Set a bounded height or flex: 1 on the list container, or use useWindowScroll.")};p();let m=[Va(t,"numContainers",p),Va(t,"readyToRender",p),Va(t,"totalSize",p)];return()=>{for(let h of m)h()}},[t])}function aW(e){}var iW=Uo?rW:aW;function sW(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),GR(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}Wa(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&pd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||hg(e),delete o.previousData}function lW(e,t,n){var o;if(e.pendingDataComparison=void 0,!n||!t||t.length!==n.length)return!0;let{idCache:r,props:{itemsAreEqual:a,keyExtractor:i}}=e,s;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!i)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:i(n[l],l),c=i(t[l],l);if(d!==c)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;if(!a)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(s??(s=[]),s[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:s,nextData:t,previousData:n},!0}return!1}function pN(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=RR(e),f=le(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let h=0,g=Math.min(20,a.length);for(let v=0;v<g;v++){let x=a[v];if(x!==void 0){let y=(t=s?.(x,v))!=null?t:"";h+=((n=i(x,v,y))!=null?n:d)+e.scrollAxisGap}}p=h/g}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let h=0;h<m;h++)Pe(e,`containerPosition${h}`,cd),Pe(e,`containerColumn${h}`,-1),Pe(e,`containerSpan${h}`,1);return Pe(e,"numContainers",m),Pe(e,"numContainersPooled",DV(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Wa(e,{dataChanged:!0,doMVCP:!0})}):Wa(e,{dataChanged:!0,doMVCP:!0})),!0}}function dW(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function cW(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,i=o.props.horizontal?"width":"height",s=o.props.horizontal?"height":"width",l=t;if(a){let v=dW()[i];l=v>0?{...t,[i]:v}:t}let d=l[i],c=o.scrollLength,f=d>0?d:c,p=l[s],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let h=o.otherAxisSize,g=f!==o.scrollLength||p!==h;if(g){if(o.scrollLength=f,o.otherAxisSize=p,js(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&pN(e),m&&Wa(e,{doMVCP:!0}),(g||p!==h)&&Pe(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&pd(e),hg(e),o){let v=o.props.horizontal?(o.props.stylePaddingTop||0)+(o.props.stylePaddingBottom||0):(o.props.stylePaddingLeft||0)+(o.props.stylePaddingRight||0);o.needsOtherAxisSize=p-v<10}Uo&&d===0&&Ks("height0",`List ${o.props.horizontal?"width":"height"} is 0. You may need to set a style or \`flex: \` for the list, because children are absolutely positioned.`)}n(!0)}function uW(e,t){let n=no.get(e);if(!!n&&no.didReachTarget(t,n)){no.clear(e);return}n&&(e.hasScrolled=!1,no.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function fW(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function pW(e){return{...e,nativeEvent:{...e.nativeEvent}}}function mW(e,t){var n,o,r,a,i,s;let l=e.state,{scrollProcessingEnabled:d}=l;if(d===!1||((o=(n=t.nativeEvent)==null?void 0:n.contentSize)==null?void 0:o.height)===0&&((r=t.nativeEvent.contentSize)==null?void 0:r.width)===0)return;let c=!1;if((a=t.nativeEvent)!=null&&a.contentInset){let{contentInset:p}=t.nativeEvent,m=l.nativeContentInset;(!m||m.top!==p.top||m.bottom!==p.bottom||m.left!==p.left||m.right!==p.right)&&(l.nativeContentInset=p,c=!0)}let f=t.nativeEvent.contentOffset[l.props.horizontal?"x":"y"];if(l.props.horizontal&&(f=$K(l,f,(i=t.nativeEvent.contentSize)==null?void 0:i.width)),l.didFinishInitialScroll&&((s=l.initialScroll)==null?void 0:s.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=_i(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,bg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Vs(e,f,c,{fromNativeScrollEvent:!0}),uW(l,f),nV(e),l.scrollingTo&&RC(e),l.props.onScroll&&(fW(l)?l.deferredPublicOnScrollEvent=pW(t):l.props.onScroll(t))}var gW=class{constructor(){this.work=new Map}timeout(e,t,n){n&&this.cancel(n);let o=[void 0,clearTimeout],r=setTimeout(()=>{let a=n??r;this.work.get(a)===o&&(this.work.delete(a),e())},t);o[0]=r,this.work.set(n??r,o)}frame(e,t){this.cancel(t);let n=[void 0,cancelAnimationFrame];this.work.set(t,n),n[0]=requestAnimationFrame(()=>{this.work.get(t)===n&&(this.work.delete(t),e())})}register(e,t){this.cancel(e),this.work.set(e,[void 0,t])}cancel(e){let t=this.work.get(e);if(t){this.work.delete(e);let[n,o]=t;o(n)}}has(e){return this.work.has(e)}dispose(){for(let[e,t]of this.work.values())t(e);this.work.clear()}},hW=class{constructor(e){this.appliedAdjust=0,this.pendingAdjust=0,this.ctx=e}requestAdjust(e){let t=this.ctx.state.scrollingTo;t?.animated&&!t.isInitialScroll?(this.pendingAdjust+=e,Pe(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&RC(this.ctx)}getAdjust(){return this.appliedAdjust}commitPendingAdjust(e){{let t=this.ctx.state,n=this.pendingAdjust;if(this.pendingAdjust=0,n!==0){let o;if(e?.index!==void 0){let a=vg(this.ctx,e.index);o=yg(this.ctx,a,e),o=_i(this.ctx,o,e)}else o=_i(this.ctx,t.scroll+n);let r=o-t.scroll;(Math.abs(r)>.1||Math.abs(n)>.1)&&(this.appliedAdjust+=r,t.scroll=o,t.scrollForNextCalculateItemsInView=void 0,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),Pe(this.ctx,"scrollAdjustPending",0),Wa(this.ctx)}}}};function vW(e,t){let n=e.state,o=qs(e,t),a=qs(e)-o;if(a!==0){let i=!!le(e,"isWithinMaintainScrollAtEndThreshold");Vs(e,n.scroll,!0,{markHasScrolled:!1}),!XR(e)&&i&&a>0&&Qs(e,a)}}function iC(e){return z(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var xW=(...e)=>B(n=>{for(let o of e)o&&(DR(o)?o(n):o.current=n)},e);function yW(e){return null}function CW(e,t,n,o){return o}function bW(e){let{gap:t,columnGap:n,rowGap:o}=e;if(t||n||o)return e.gap=void 0,e.columnGap=void 0,e.rowGap=void 0,{columnGap:n,gap:t,rowGap:o}}function IW(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=le(e,"footerSize")||0;return rg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var SW="default";function wW(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||SW]={average:o.avg,count:o.num})}return t}function TW(e){cg(e)}function LW(e,t){let n=e.state,o=800,r=2,a=0,i=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,s=(g,v=!1)=>{var x;let y=n.props,C=y.data.length,w=(x=y.anchoredEndSpace)==null?void 0:x.anchorIndex;return g<0?v:g>=C?!1:w===void 0||w<0||w>=C||g<w?!0:xq(e,w,C-1)},l=(g,v,x)=>{let y=Date.now(),C=0,w=()=>{if(g!==a)return;i()||!x()?C=0:C+=1;let k=Date.now()-y>=o;if(C>=r||k){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(g,v,x,y=()=>!0)=>{let C=()=>{if(g!==a)return;(!x()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!y()?l(g,C,y):C()},c=g=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return wR(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);VM(e),d(y,x,g,v)});n.runPendingScrollToEnd=()=>{let g=n.pendingScrollToEnd;g&&(n.pendingScrollToEnd=void 0,g.token===a&&d(g.token,g.resolve,()=>IW(e,g.options),()=>s(n.props.data.length-1,!0)))};let p=g=>{if(n){let{index:v,...x}=g,{startNoBuffer:y,endNoBuffer:C}=n;if(v<y||v>C){let w=v<y?0:1;return rg(e,{...x,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:g=>{var v,x;let y=(v=g?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),GR(n);for(let C in n.averageSizes)delete n.averageSizes[C];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Pe(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),TW(e),(x=n.triggerCalculateItemsInView)==null||x.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var g,v,x;return(x=(v=(g=m.current).getNativeScrollRef)==null?void 0:v.call(g))!=null?x:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:le(e,"activeStickyIndex"),contentLength:uo(e),data:n.props.data,elementAtIndex:g=>{var v;return(v=e.viewRefs.get(cC(e,Bt(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>wW(n),indexByKey:g=>n.indexByKey.get(g),isAtEnd:le(e,"isAtEnd"),isAtStart:le(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:le(e,"isNearEnd"),isNearStart:le(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:le(e,"isWithinMaintainScrollAtEndThreshold"),listen:(g,v)=>Va(e,g,v),listenToPosition:(g,v)=>WK(e,g,v),positionAtIndex:g=>n.positions[g],positionByKey:g=>{let v=n.indexByKey.get(g);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Cg(n),sizeAtIndex:g=>n.sizesKnown.get(Bt(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=Y4(e,g);Vs(e,n.scroll,!0,{markHasScrolled:!1}),v&&XR(e)},scrollIndexIntoView:g=>f(()=>p(g)),scrollItemIntoView:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(p({index:y,...v}),!0):!1}),scrollToEnd:g=>new Promise(v=>{var x;let y=c(v);n.pendingScrollToEnd={options:g,resolve:v,token:y},t?.(),VM(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(rg(e,g),!0),g.index>=0?()=>s(g.index):void 0),scrollToItem:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(rg(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(bg(e,g),!0)),setItemSize:(g,v)=>{iN(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=DR(g)?g(le(e,"scrollAdjustUserOffset")||0):g;Pe(e,"scrollAdjustUserOffset",v)}}}var kW=(e,t)=>e-t,gR=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,Su=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function PW(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=gR(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Su(i,s,f);let d=gR(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)Su(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&Su(i,s,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<s&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(Su(i,s,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:s;p<s;p++)Su(i,s,p)}let c=Array.from(i);return c.sort(kW),c}function AW(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:i,renderItem:s}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=le(e,"extraData"),f=a[l];if(s&&!ku(f)){let p={data:a,extraData:c,index:l,item:f,type:i&&(n=i(f,l))!=null?n:""};d=s(p)}return{index:l,item:a[l],renderedItem:d}}function hR(e,t){var n,o,r,a;return{animated:!1,onDataChange:t?(n=e?.dataChange)!=null?n:!1:!0,onFooterLayout:t?(o=e?.footerLayout)!=null?o:!1:!0,onItemLayout:t?(r=e?.itemLayout)!=null?r:!1:!0,onLayout:t?(a=e?.layout)!=null?a:!1:!0}}function EW(e){var t;return e?e===!0?{...hR(void 0,!1),animated:!1}:{...hR(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function MW(e){var t,n;return e===!0?{data:!0,size:!0}:e&&typeof e=="object"?{data:(t=e.data)!=null?t:!1,shouldRestorePosition:e.shouldRestorePosition,size:(n=e.size)!=null?n:!0}:e===!1?{data:!1,size:!1}:{data:!1,size:!0}}function RW(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=le(e,"stylePaddingTop")||0;if(t<o){let r=le(e,"totalSize")||0;Pe(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=le(e,"totalSize")||0,Pe(e,"totalSize",r-o)},16)}Pe(e,"stylePaddingTop",t)}}function NW(e){let t=_(null),n=_(0),o=_(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return B((i,s,...l)=>{{let d=Date.now();o.current=l,d-n.current>=s?(n.current=d,i(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),i(...o.current),t.current=null,o.current=null)},s-(d-n.current)))}},[e])}function _W(e,t){let n=NW("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var DW=ua(sN(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(xg(o)?o:ah.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Te(KK,null,Te(OW,{...l,ref:n}))})),OW=sN(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k;let S=B(ze=>{},[]);t.recycleItems===void 0&&Ks("recycleItems-omitted","recycleItems was not provided, so it defaults to false. Set recycleItems explicitly to true for better performance with recycling-aware rows, or false to preserve remount-on-reuse behavior.");let{alignItemsAtEnd:L=!1,anchoredEndSpace:I,alwaysRender:T,columnWrapperStyle:E,contentContainerStyle:A,contentInset:N,data:R=[],dataKey:$,dataVersion:H,drawDistance:K=250,contentInsetEndAdjustment:O,estimatedItemSize:oe=100,estimatedListSize:te,extraData:W,getFixedItemSize:Ke,getItemType:ve,horizontal:fe,rtl:Ne,estimatedHeaderSize:Ae,initialScrollAtEnd:ae=!1,initialScrollIndex:Ee,initialScrollOffset:xe,experimental_adaptiveRender:re,itemsAreEqual:Ie,keyExtractor:st,ListEmptyComponent:dt,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Mt,maintainScrollAtEnd:at=!1,maintainScrollAtEndThreshold:$e=.1,maintainVisibleContentPosition:Se,numColumns:Be=1,overrideItemLayout:Ze,onEndReached:qt,onEndReachedThreshold:X=.5,onItemSizeChanged:nn,onMetricsChange:yt,onLayout:dn,onLoad:Tt,onMomentumScrollEnd:Yt,onRefresh:Jt,onScroll:Rt,onScrollBeginDrag:On,onStartReached:An,onStartReachedThreshold:fn=.5,onStickyHeaderChange:Fn,onFirstVisibleItemChanged:Nt,onViewableItemsChanged:Vt,progressViewOffset:Bn,recycleItems:oo=!1,refreshControl:zt,refreshing:D,refScrollView:Y,renderScrollComponent:de,renderItem:ie,scrollEventThrottle:pe,snapToIndices:et,stickyHeaderIndices:gt,style:pn,useWindowScroll:ht=!1,viewabilityConfig:Zt,viewabilityConfigCallbackPairs:Wt,...bt}=t,mn=t.animatedPropsInternal,ge=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",vt=t.positionComponentInternal,Lt=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:ut,positionComponentInternal:tt,stickyPositionComponentInternal:It,...zn}=bt,Ge=Du.flatten(A),_t=L&&!fe&&Ge?.minHeight==null&&R.length>0,En=L&&!_t&&(fe?Ge?.minWidth==null:Ge?.minHeight==null),gn={...Ge,...L&&!_t?{display:"flex",flexDirection:fe?"row":"column",...En?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},Lo={...Du.flatten(pn)},Mn=wu(Lo,gn,"Top"),ro=wu(Lo,gn,"Bottom"),J=wu(Lo,gn,"Left"),qe=wu(Lo,gn,"Right"),xt=bC({horizontal:fe,rtl:Ne,stylePaddingBottom:ro,stylePaddingLeft:J,stylePaddingRight:qe}),Qe=EW(at),cn=MW(Se),hn=Ee!=null,vn=xe!=null,$t=!ae&&!hn&&!vn&&CC({horizontal:fe,rtl:Ne}),$n=!ae&&!hn&&(vn||$t),en=ae||hn,mo=ae?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-xt,viewPosition:1}:hn?typeof Ee=="object"?{index:(r=Ee.index)!=null?r:0,preserveForBottomPadding:Ee.viewOffset===void 0&&Ee.viewPosition===1?!0:void 0,viewOffset:(a=Ee.viewOffset)!=null?a:Ee.viewPosition===1?-xt:0,viewPosition:(i=Ee.viewPosition)!=null?i:0}:{index:Ee??0,viewOffset:xe??0}:$n?{contentOffset:xe??0,index:0,viewOffset:0}:void 0,[Ya,fa]=G(!SC),[,Jn]=ni(ze=>ze+1,0),Re=Ur();Re.columnWrapperStyle=E||(gn?bW(gn):void 0);let pa=fe?(d=(s=Re.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=Re.columnWrapperStyle)==null?void 0:l.gap:(p=(c=Re.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=Re.columnWrapperStyle)==null?void 0:f.gap,vr=typeof pa=="number"&&Number.isFinite(pa)?pa:0,ma=_(null),Oi=xW(ma,Y),qo=st??((ze,ft)=>ft.toString()),kt=gt,Zn=O,Gt=_(Zn),ga=z(()=>{let ze=PW(T,R,qo,I?.anchorIndex);return{arr:ze,set:new Set(ze)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(h=T?.keys)==null?void 0:h.join(","),R,$,H,qo]),tn=!!ht&&!de,Hn=_(void 0),on=!!Ze,Ja=_(on);if(!Hn.current){if(!Re.state){let ze=(te??{height:0,width:0})[fe?"width":"height"];Re.values.set("adaptiveRender",(g=re?.initialMode)!=null?g:"normal"),Re.state={averageSizes:{},columnSpans:[],columns:[],containerItemGenerations:[],containerItemKeys:new Map,containerItemMetadata:new Map,contentInsetOverride:void 0,dataChangeEpoch:0,dataChangeNeedsScrollUpdate:!1,didColumnsChange:!1,didDataChange:!1,didLoad:!1,enableScrollForNextCalculateItemsInView:!0,endBuffered:-1,endNoBuffer:-1,endReachedSnapshot:void 0,firstFullyOnScreenIndex:-1,freshDataTransitionEpoch:0,hasHadNonEmptyData:R.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:mo,initialScrollSession:mo?{kind:$n?"offset":"bootstrap",previousDataLength:R.length}:void 0,isEndReached:null,isFirst:!0,isStartReached:null,lastBatchingAction:Date.now(),lastLayout:void 0,lastScrollDelta:0,loadStartTime:Date.now(),minIndexSizeChanged:0,nativeContentInset:void 0,nativeMarginTop:0,pendingDataComparison:void 0,pendingNativeMVCPAdjust:void 0,positions:[],props:{},queuedCalculateItemsInView:0,refScroller:{current:null},scheduledWork:new gW,scroll:0,scrollAdjustHandler:new hW(Re),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:ze,scrollPending:0,scrollPrev:0,scrollPrevTime:0,scrollProcessingEnabled:!0,scrollTime:0,sizes:new Map,sizesKnown:new Map,startBuffered:-1,startNoBuffer:-1,startReachedSnapshot:void 0,stickyContainerPool:new Set,stickyContainers:new Map,totalSize:0,viewabilityConfigCallbackPairs:void 0};let ft=Re.state;ft.triggerCalculateItemsInView=an=>Wa(Re,an),ft.reprocessCurrentScroll=()=>Vs(Re,ft.scroll,!0),Pe(Re,"maintainVisibleContentPosition",cn),Pe(Re,"extraData",W),Ae!==void 0&&Pe(Re,"headerSize",Ae)}Hn.current=Re.state}let he=Hn.current,bn=he.isFirst,Vo=he.props.adaptiveRender,Fi=he.props.numColumns,xr=!bn&&Re.scrollAxisGap!==vr;Re.scrollAxisGap=vr,he.didColumnsChange=Be!==Fi||xr;let Wo=(x=(v=he.props.data)==null?void 0:v.length)!=null?x:0,yr=he.props.data!==R,Do=he.props.dataKey!==$,Vr=he.props.dataVersion!==H,go=Do||Vr||yr&&lW(he,R,he.props.data),Go=!bn&&go&&he.hasHadNonEmptyData&&(Do||Wo===0)&&R.length>0;go&&!ae&&he.didFinishInitialScroll&&((y=he.initialScroll)==null?void 0:y.viewPosition)===1&&he.props.data.length>0&&ud(he),go&&(he.dataChangeEpoch+=1,he.dataChangeNeedsScrollUpdate=!0,he.didDataChange=!0,he.previousData=he.props.data),Go&&(he.freshDataTransitionEpoch+=1);let Bi=_W(Rt??S,pe??0),zi=pe&&Rt?Bi:Rt,Un=!bn&&!go&&((C=he.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;he.props={adaptiveRender:re,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:_t,alwaysRender:T,alwaysRenderIndicesArr:ga.arr,alwaysRenderIndicesSet:ga.set,anchoredEndSpace:I,anchoredEndSpaceOwner:ge,animatedProps:mn,contentContainerAlignItems:gn.alignItems,contentInset:N,contentInsetEndAdjustment:Zn,data:R,dataKey:$,dataVersion:H,drawDistance:K,estimatedItemSize:oe,getFixedItemSize:iC(Ke),getItemType:iC(ve),horizontal:!!fe,itemsAreEqual:Ie,keyExtractor:iC(qo),maintainScrollAtEnd:Qe,maintainScrollAtEndThreshold:$e,maintainVisibleContentPosition:cn,numColumns:Be,onEndReached:qt,onEndReachedThreshold:X,onFirstVisibleItemChanged:Nt,onItemSizeChanged:nn,onLoad:Tt,onMomentumScrollEnd:Yt,onScroll:zi,onScrollBeginDrag:On,onStartReached:An,onStartReachedThreshold:fn,onStickyHeaderChange:Fn,overrideItemLayout:Ze,positionComponentInternal:vt,recycleItems:!!oo,renderItem:ie,rtl:Ne,snapToIndices:et,stickyHeaderIndicesArr:kt??[],stickyHeaderIndicesSet:z(()=>new Set(kt??[]),[kt?.join(",")]),stickyPositionComponentInternal:Lt,stylePaddingBottom:ro,stylePaddingLeft:J,stylePaddingRight:qe,stylePaddingTop:Mn,useWindowScroll:tn},he.refScroller=ma,!bn&&Vo&&!re&&wC(Re);let Cr=z(()=>R.length?Array.from({length:Math.min(Be,R.length)},(ze,ft)=>Bt(he,R.length-1-ft)):[],[R,$,H,Be]),ha=ze=>{Pe(Re,"lastItemKeys",Cr),Pe(Re,"numColumns",Be);let ft=le(Re,"stylePaddingTop");RW(Re,{stylePaddingTop:Mn}),Hn.current.props.stylePaddingBottom=ro,js(Re);let an=Mn-ft;ze&&cn.size&&an&&ft!==void 0&&Ga.OS};bn&&(ha(!1),YR(he),ZR(Re,!0));let $i=z(()=>{var ze,ft;let an=he.initialScroll;if(!an)return;let xn=(ze=an.contentOffset)!=null?ze:Hr(Re,an);return en&&((ft=he.initialScrollSession)==null?void 0:ft.kind)==="bootstrap"&&Ga.OS==="web"?void 0:xn},[en]);ye(()=>{IV(Re,{alwaysDispatchInitialScroll:$t,dataLength:R.length,hasFooterComponent:!!lt,initialContentOffset:$i,initialScrollAtEnd:ae,useBootstrapInitialScroll:en})},[]),(bn||go||he.didColumnsChange)&&(Hn.current.lastBatchingAction=Date.now(),!st&&!bn&&go&&(Hn.current.sizes.clear(),Hn.current.positions.length=0,Hn.current.totalSize=0,Pe(Re,"totalSize",0))),Uo&&iW(t),ye(()=>{Go&&LC(Re,{resetInitialScroll:!!mo,resetLayout:!0}),SV(Re,{dataLength:R.length,didDataChange:go,didStartFreshData:Go,initialScrollAtEnd:ae,latestInitialScroll:mo,latestInitialScrollSessionKind:$n?"offset":"bootstrap",stylePaddingEnd:xt,useBootstrapInitialScroll:en})},[R.length,$,go,Go,ae,xt,en]),ye(()=>{var ze;Un&&(he.scrollForNextCalculateItemsInView=void 0,(ze=he.triggerCalculateItemsInView)==null||ze.call(he)),ug(Re)},[Re,R,H,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,Un,fe,Be,Ne,ro,J,qe]),ye(()=>{let ze=Gt.current;Gt.current=Zn,vW(Re,ze)},[Re,Zn]);let Oo=B(ze=>{en&&aV(Re,{dataLength:R.length,footerSize:ze[fe?"width":"height"],initialScrollAtEnd:ae,stylePaddingEnd:xt})},[R.length,ae,fe,xt,en]),ko=B((ze,ft)=>{let an=he.scrollLength,xn=he.otherAxisSize;cW(Re,ze,fa),ug(Re);let br=an!==he.scrollLength||xn!==he.otherAxisSize;en&&!ft&&br&&iV(Re),!en&&Ru(Re)},[R.length,ae,xt,en]),{onLayout:jo}=DC({onLayoutChange:ko,onLayoutProp:dn,ref:ma});ye(()=>{et&&JR(Re)},[et]),ye(()=>ha(!0),[$,H,Cr.join(","),Be,vr,ro,Mn,_t]),ye(()=>{let{didColumnsChange:ze,didDataChange:ft,isFirst:an,props:{data:xn}}=he;!(xn.length>0&&pN(Re))&&!an&&(ft||ze)&&sW(Re,xn,{didColumnsChange:ze}),ft&&(he.pendingDataComparison=void 0),he.didColumnsChange=!1,he.didDataChange=!1,he.isFirst=!1},[R,$,H,Be,vr]),ye(()=>{var ze;Pe(Re,"extraData",W);let ft=Ja.current!==on;Ja.current=on,(on||ft)&&Be>1&&((ze=he.triggerCalculateItemsInView)==null||ze.call(he,{forceFullItemPositions:!0}))},[W,on,Be]),q(()=>{if(!yt)return;let ze,ft=()=>{let xn={footerSize:le(Re,"footerSize")||0,headerSize:le(Re,"headerSize")||0};(!ze||xn.headerSize!==ze.headerSize||xn.footerSize!==ze.footerSize)&&(ze=xn,yt(xn))};ft();let an=[Va(Re,"headerSize",ft),Va(Re,"footerSize",ft)];return()=>{for(let xn of an)xn()}},[Re,yt]),q(()=>{let ze=AV({onViewableItemsChanged:Vt,viewabilityConfig:Zt,viewabilityConfigCallbackPairs:Wt});he.viewabilityConfigCallbackPairs=ze,he.enableScrollForNextCalculateItemsInView=!0,ze&&(he.scrollForNextCalculateItemsInView=void 0)},[Zt,Wt,Vt]),s4(()=>{}),Xr(n,()=>LW(Re,Jn),[]),q(()=>()=>{nq(he),he.scheduledWork.dispose()},[he]),ye(()=>{var ze;(ze=he.runPendingScrollToEnd)==null||ze.call(he)}),q(()=>{en||Ru(Re)},[Re,en]);let Qo=z(()=>({getRenderedItem:ze=>AW(Re,ze),onMomentumScrollEnd:ze=>{CV(Re),he.props.onMomentumScrollEnd&&he.props.onMomentumScrollEnd(ze)},onScroll:ze=>mW(Re,ze),onScrollBeginDrag:ze=>{var ft,an;UM(Re),(an=(ft=he.props).onScrollBeginDrag)==null||an.call(ft,ze)},onScrollEnd:()=>UM(Re)}),[]),va=CW(kt,fe,Re,Qo.onScroll),Xo=zt;return Te(ti,null,Te(eW,{...zn,alignItemsAtEnd:L,canRender:Ya,contentContainerStyle:gn,contentInset:N,freshDataTransitionEpoch:he.freshDataTransitionEpoch,getRenderedItem:Qo.getRenderedItem,horizontal:fe,initialContentOffset:$i,ListEmptyComponent:R.length===0?dt:void 0,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Mt,onInternalScrollBeginDrag:Qo.onScrollBeginDrag,onInternalScrollEnd:Qo.onScrollEnd,onLayout:jo,onLayoutFooter:Oo,onMomentumScrollEnd:Qo.onMomentumScrollEnd,onScroll:va,recycleItems:oo,refreshControl:Xo?Mn>0?cf(Xo,{progressViewOffset:((w=Xo.props.progressViewOffset)!=null?w:0)+Mn}):Xo:Jt&&Te(yW,{onRefresh:Jt,progressViewOffset:(Bn||0)+Mn,refreshing:!!D}),refScrollView:Oi,renderScrollComponent:de,scrollAdjustHandler:(k=Hn.current)==null?void 0:k.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:et,stickyHeaderIndices:kt,style:Lo,useWindowScroll:tn}),Uo&&tq)});var FW=DW;var mN=FW;me();me();function BW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zW(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${BW(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function OC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return zW(n,e.subProvider)}function md(e){return OC(e,{preferShortName:!0})}var FC="model:",BC="legacy-models:",zC="action:",gd="pluginActions:manage";function Fu(e,t){return`${FC}${e.length}:${e}${t}`}function HC(e){if(!e.startsWith(FC))return null;let t=e.slice(FC.length),n=t.indexOf(":");if(n===-1)return null;let o=t.slice(0,n);if(!/^\d+$/.test(o))return null;let r=Number(o),a=t.slice(n+1);return!Number.isSafeInteger(r)||r>a.length?null:{instanceId:a.slice(0,r),slug:a.slice(r)}}function UC(e){return`${BC}${e}`}function gN(e){return e.startsWith(BC)?e.slice(BC.length):null}function Bu(e){return`${zC}${e}`}function hN(e){if(!e.startsWith(zC))return null;let t=e.slice(zC.length);return t.length>0?t:null}var $C="choice:";function KC(e){return`${$C}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function vN(e){if(!e.startsWith($C))return null;try{let t=JSON.parse(e.slice($C.length));if(!Array.isArray(t)||t.length!==5)return null;let[n,o,r,a,i]=t;return typeof n!="string"||typeof o!="string"||typeof r!="string"||typeof a!="string"||typeof i!="string"?null:{environmentId:n,runtimeId:o,sourceId:r,profileId:a,...i.length>0?{endpointId:i}:{}}}catch{return null}}var xN=ue(function(t){let{t:n}=_e(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.sourceLabel,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(xl,{hideIndicator:!0,index:t.index,value:t.itemKey??Fu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:F("group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-colors duration-(--control-duration)","hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",t.disabledReason&&"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent"),children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"flex min-w-0 items-center gap-2",children:u("div",{className:"min-w-0 truncate text-xs font-medium leading-snug",children:t.useTriggerLabel?md(t.model):OC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(ka,{providerId:t.providerId,displayName:t.providerDisplayName,accentColor:t.providerAccentColor,className:"size-icon-2",iconClassName:"size-3",indicatorBackground:"var(--popover)"}),u("span",{className:"truncate text-xs font-normal leading-snug text-muted-foreground/70",children:r})]})]}),b("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(Rf,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Xe,{children:[u(Je,{render:u(ne,{size:"icon-xs",variant:"ghost",className:F("-mr-1 shrink-0 text-muted-foreground/70 opacity-64 transition-[color,opacity] hover:text-foreground hover:opacity-100 group-hover:opacity-100",t.isFavorite&&"text-foreground opacity-100"),onClick:s=>{s.stopPropagation(),t.onToggleFavorite()},onKeyDown:s=>{s.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(as,{className:F("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Ye,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Xe,{children:[u(Je,{render:a}),u(Ye,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});function wg(e){return e==="ready"}function yN(e){return e==="ready"||e==="unchecked"||e==="checking"}function CN(e,t){switch(e){case"ready":return t("readiness.ready.title");case"unchecked":return t("readiness.unchecked.title");case"checking":return t("readiness.checking.title");case"disabled":return t("readiness.disabled.title");case"not-installed":return t("readiness.notInstalled.title");case"unauthenticated":return t("readiness.unauthenticated.title");case"error":return t("readiness.error.title");default:return e}}function zu(e){return e.enabled&&yN(e.readiness)}function bN(e){return e.enabled}function IN(e){let t=new Map;for(let n of e){let o=t.get(n.driverKind);o?o.push(n):t.set(n.driverKind,[n])}return[...t.values()].flat()}var Tg=e=>e.enabled;function Lg(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&Tg(n))return n}return e.find(n=>n.enabled&&wg(n.readiness))??e.find(zu)??e.find(n=>Tg(n)&&n.readiness!=="error")}function SN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}me();function $W(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(wg(o))return n;let r=CN(o,t),a=e.snapshot.readiness.detail?.trim();return a?t("instance.statusWithDetail",{name:n,status:r,detail:a}):t("instance.status",{name:n,status:r})}var HW="pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary",UW="pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ",KW=`${UW} text-update-foreground`,wN="left",TN=8,LN="max-w-64 text-balance font-normal leading-snug",kN=ue(function(t){let{t:n}=_e(),{t:o}=_e(),r=Ot().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=G(null),d=_(null),[c,f]=G(null);return ye(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(h=>h.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,i]),u("div",{className:"w-11 shrink-0 overflow-hidden bg-muted/30","data-model-picker-sidebar":"true",children:u("div",{className:"h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:b("div",{ref:d,className:"relative flex min-h-full flex-col gap-1 p-1",children:[c!==null?u("div",{"data-model-picker-selected-indicator":"true",className:F(HW,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(be,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Xe,{children:[u(Je,{render:u("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]"),onClick:()=>a("favorites"),type:"button","aria-label":n("modelPicker.favorites"),children:u(as,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Ye,{side:wN,sideOffset:TN,align:"center",className:LN,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!zu(p),h=t.disabledInstanceIds?.has(p.instanceId)??!1,g=m||h,v=t.selectedInstanceId===p.instanceId,x=s===p.instanceId,y=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?$W(p,o):h?t.getDisabledInstanceTooltip?.(p)??p.displayName:y?`${p.displayName} \u2014 ${C}`:p.displayName,k=b("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",g&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!g&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(L=>L===p.instanceId?null:L),onFocus:()=>l(p.instanceId),onBlur:()=>l(L=>L===p.instanceId?null:L),disabled:g,type:"button","aria-label":g?w:p.displayName,children:[u(ka,{providerId:p.providerId,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:x&&!g?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),y?u("span",{className:KW,"aria-hidden":!0,children:u(yf,{className:"size-2.5"})}):null]}),S=g?u("span",{className:"relative block w-full",children:k}):k;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Xe,{children:[u(Je,{render:S}),b(Ye,{side:wN,sideOffset:TN,align:"center",className:LN,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function po(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function qW(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let i=0;i<e.length;i+=1)if(e[i]===t[n]&&(o===-1&&(o=i),r!==-1&&(a+=i-r-1),r=i,n+=1,n===t.length)){let s=i-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+s+l}return null}function qC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function VW(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let i=a+r.length;(o===null||i<o)&&(o=i)}return o}function Kr(e){let{value:t,query:n}=e;if(!t||!n)return null;if(t===n)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(n))return e.prefixBase+qC(t,n);if(e.boundaryBase!==void 0){let o=VW(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+qC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+qC(t,n)}if(e.fuzzyBase!==void 0){let o=qW(t,n);if(o!==null)return e.fuzzyBase+o}return null}function WW(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function GW(e,t){let n=0,o=e.length;for(;n<o;){let r=n+Math.floor((o-n)/2),a=e[r];if(!a)break;WW(t,a)<0?o=r:n=r+1}return n}function kg(e,t,n){if(n<=0)return;let o=GW(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var jW=24;function QW(e){return[po(e.name),...e.shortName?[po(e.shortName)]:[],...e.subProvider?[po(e.subProvider)]:[],po(e.driverKind),po(e.providerDisplayName),...e.providerAccountEmail?[po(e.providerAccountEmail)]:[],VC(e),...e.slug?[po(e.slug)]:[]]}function XW(e,t,n){return Kr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function VC(e){return po([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function PN(e,t){let n=po(t).split(/\s+/u).filter(r=>r.length>0);if(n.length===0)return 0;let o=0;for(let r of n){let a=[];for(let i=0;i<e.length;i+=1){let s=XW(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function AN(e,t){let n=PN(QW(e),t);return n===null?null:e.isFavorite?n-jW:n}function EN(e,t){return PN([po(e.title),po(e.description??"")],t)}function MN({top:e,bottom:t}){if(!(!e&&!t))return F("virtualized-scroll-fade [--fade-size:1.5rem]",e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size),black_calc(100%-var(--fade-size)),transparent)]",e&&!t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size))]",!e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,black_calc(100%-var(--fade-size)),transparent)]")}function Pg(e,t){return`${e}:${t}`}var RN=new Map,NN=[],YW=[],JW=[];function $u(e){return e.choiceKey??Fu(e.instanceId,e.slug)}function _N(e,t,n){return t.environmentId!==n||t.instanceId!==e.instanceId?!1:t.sourceId&&t.profileId?t.sourceId===e.sourceId&&t.profileId===e.profileId&&t.model===e.slug:e.sourceId&&e.profileId?!1:t.model===e.slug}function ZW(){return u("div",{className:"h-0.5"})}function WC(e){return e?.trim()||null}function DN({label:e}){return u("div",{className:"px-2 pt-2 pb-1 text-[10px] font-medium uppercase leading-none tracking-wide text-muted-foreground/70",children:e})}var eG=ue(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=_e(),i=WC(o.description);return b(be,{children:[r?u(DN,{label:a("modelPicker.plugins")}):null,b(xl,{hideIndicator:!0,index:t,value:n,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(ns,{className:"size-4 shrink-0 text-muted-foreground/70"}),b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"truncate text-xs font-medium leading-snug",children:o.title}),u("div",{className:"mt-1 truncate text-xs font-normal leading-snug text-muted-foreground/70",children:i})]})]})]})}),tG=ue(function({index:t,showSectionHeader:n}){let{t:o}=_e();return b(be,{children:[n?u(DN,{label:o("modelPicker.plugins")}):null,b(xl,{hideIndicator:!0,index:t,value:gd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(Md,{className:"size-4 shrink-0 text-muted-foreground/70"}),u("span",{className:"min-w-0 flex-1 truncate text-left text-xs font-normal leading-snug text-muted-foreground",children:o("modelPicker.managePlugins")})]})]})}),ON=ue(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,getModelDisabledReason:a,getModelContinuationLabel:i,onContinueInModel:s,onInstanceModelChange:l,onChooseExecution:d,composerChoices:c,selectedExecutionSelection:f,onManagePlugins:p,onSelectPluginAction:m}=t,h=t.pluginActions??NN,g=t.selectedPluginActionKey??null,{t:v}=_e(),{t:x}=_e(),y=Ot(),[C,w]=G(""),[k,S]=G(!1),[L,I]=G(!1),T=_(null),E=_(null),A=_(null),N=y.environment.useActiveEnvironmentId(),R=y.settings.useClientSettings(D=>D.favorites??[]),$=z(()=>N===null?JW:R.filter(D=>D.environmentId===N),[N,R]),[H,K]=G(()=>t.lockedProvider!==null?t.activeInstanceId:$.length>0?"favorites":t.activeInstanceId),[O,oe]=G(()=>new Set(o.get(t.activeInstanceId)?.some(D=>D.slug===t.model&&D.isLegacy)?[t.activeInstanceId]:[])),te=z(()=>n??[],[n]),W=y.settings.useUpdateClientSettings(),Ke=B(()=>{T.current?.focus({preventScroll:!0})},[]),ve=B(D=>{K(D),window.requestAnimationFrame(()=>{Ke()})},[Ke]);ye(()=>{Ke();let D=window.requestAnimationFrame(()=>{Ke()}),Y=window.setTimeout(()=>{Ke()},0);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(Y)}},[Ke]);let fe=z(()=>new Set($.map(D=>Pg(D.instanceId,D.model))),[$]),Ne=B(D=>N===null?!1:$.some(Y=>_N(D,Y,N)),[N,$]),Ae=z(()=>new Map(r.map(D=>[D.instanceId,D])),[r]),ae=B(D=>t.lockedProvider===null?!0:D.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?D.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),Ee=z(()=>{let D=new Set;for(let Y of r)zu(Y)&&D.add(Y.instanceId);return D},[r]),xe=z(()=>{let D=[];for(let[Y,de]of o){let ie=Ae.get(Y);if(ie&&Ee.has(Y))for(let pe of de)D.push({slug:pe.slug,name:pe.name,...pe.shortName?{shortName:pe.shortName}:{},...pe.subProvider?{subProvider:pe.subProvider}:{},...pe.isLegacy?{isLegacy:!0}:{},instanceId:Y,driverKind:ie.driverKind,providerId:ie.providerId,instanceDisplayName:ie.displayName,...ie.accentColor?{instanceAccentColor:ie.accentColor}:{},...ie.accountEmail?{instanceAccountEmail:ie.accountEmail}:{},...ie.continuationGroupKey?{continuationGroupKey:ie.continuationGroupKey}:{}})}if(c&&c.length>0){let Y=new Set,de=[];for(let pe of c){let et=pe.legacyInstanceId;if(!et||!Ee.has(et))continue;let gt=Ae.get(et);if(!gt)continue;let ht=o.get(et)?.find(Wt=>Wt.slug===pe.modelId),Zt=KC({environmentId:pe.selection.environmentId,runtimeId:pe.runtimeId,sourceId:pe.sourceId,profileId:pe.profileId,endpointId:pe.endpointId});Y.add(Pg(et,pe.modelId)),de.push({slug:pe.modelId,name:ht?.name??pe.modelLabel,...ht?.shortName?{shortName:ht.shortName}:{},instanceId:et,driverKind:gt.driverKind,providerId:gt.providerId,instanceDisplayName:gt.displayName,...gt.accentColor?{instanceAccentColor:gt.accentColor}:{},...gt.accountEmail?{instanceAccountEmail:gt.accountEmail}:{},...gt.continuationGroupKey?{continuationGroupKey:gt.continuationGroupKey}:{},runtimeId:pe.runtimeId,sourceId:pe.sourceId,sourceLabel:pe.sourceLabel,profileId:pe.profileId,ready:pe.ready,...pe.reasonCode?{reasonCode:pe.reasonCode}:{},choiceKey:Zt})}let ie=D.filter(pe=>!Y.has(Pg(pe.instanceId,pe.slug)));return[...de,...ie]}return D},[c,o,Ae,Ee]),re=t.lockedProvider!==null,Ie=C.trim().length>0,st=z(()=>{if(!re)return;let D=new Set;for(let Y of r)ae(Y)||D.add(Y.instanceId);return D},[r,re,ae]),dt=z(()=>{let D=r.filter(bN);if(!re)return D;let Y=[],de=[];for(let ie of D)ae(ie)?Y.push(ie):de.push(ie);return[...Y,...de]},[r,re,ae]),lt=!Ie&&dt.length>0,ct=z(()=>r.map(D=>D.instanceId),[r]),Mt=z(()=>{let D=xe;if(C.trim()){let Y=D.map(de=>({model:de,score:AN({name:de.name,...de.shortName?{shortName:de.shortName}:{},...de.subProvider?{subProvider:de.subProvider}:{},driverKind:de.driverKind,providerDisplayName:de.instanceDisplayName,...de.instanceAccountEmail?{providerAccountEmail:de.instanceAccountEmail}:{},isFavorite:Ne(de)},C),isFavorite:Ne(de),tieBreaker:VC({name:de.name,...de.shortName?{shortName:de.shortName}:{},...de.subProvider?{subProvider:de.subProvider}:{},driverKind:de.driverKind,providerDisplayName:de.instanceDisplayName,...de.instanceAccountEmail?{providerAccountEmail:de.instanceAccountEmail}:{}})})).filter(de=>de.score!==null);if(t.lockedProvider!==null){let de=[];for(let ie of Y)ae(ie.model)&&de.push(ie);return de.toSorted((ie,pe)=>{let et=ie.score-pe.score;return et!==0?et:ie.isFavorite!==pe.isFavorite?ie.isFavorite?-1:1:ie.tieBreaker.localeCompare(pe.tieBreaker)}).map(ie=>ie.model)}return Y.toSorted((de,ie)=>{let pe=de.score-ie.score;return pe!==0?pe:de.isFavorite!==ie.isFavorite?de.isFavorite?-1:1:de.tieBreaker.localeCompare(ie.tieBreaker)}).map(de=>de.model)}return t.lockedProvider!==null?(D=D.filter(Y=>ae(Y)),H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H)):H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H),y.model.sortProviderModelItems(D,{favoriteModelKeys:fe,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?ct:[]})},[fe,xe,ct,ae,t.lockedProvider,C,H,Ne]),at=z(()=>{if(Ie||H==="favorites")return null;let D=Mt.filter(de=>!de.isLegacy),Y=Mt.filter(de=>de.isLegacy);return Y.length===0?null:{key:UC(H),currentModels:D,legacyModels:Y,isExpanded:O.has(H)}},[O,Mt,Ie,H]),$e=z(()=>at?[...at.currentModels,...at.isExpanded?at.legacyModels:[]]:Mt,[Mt,at]),Se=m!==void 0,Be=z(()=>{if(!Se)return NN;let D=C.trim();return D.length===0?h:h.map(Y=>({action:Y,score:EN(Y,D)})).filter(Y=>Y.score!==null).toSorted((Y,de)=>Y.score-de.score||Y.action.title.localeCompare(de.action.title)).map(Y=>Y.action)},[C,h,Se]),Ze=Se&&(!Ie||Be.length>0),qt=z(()=>Ze?[...Be.map(D=>Bu(D.id)),gd]:YW,[Ze,Be]),X=z(()=>new Map(Be.map(D=>[Bu(D.id),D])),[Be]),nn=qt[0]??null,yt=B(D=>{oe(Y=>{let de=new Set(Y);return de.has(D)?de.delete(D):de.add(D),de})},[]),dn=B((D,Y)=>y.model.resolvePickerRowAction({disabledReason:a?.(D,Y)??null,continuationLabel:s?i?.(D,Y)??null:null}),[i,a,s]),Tt=B((D,Y)=>{let de=dn(Y,D);if(de.kind==="blocked")return;if(de.kind==="continue"){s?.(Y,D);return}let ie=o.get(Y);if(!ie)return;let pe=Ae.get(Y);if(!pe)return;let et=y.model.resolveSelectableModel(pe.driverKind,D,ie);et&&l(Y,et)},[Ae,o,s,l,dn]),Yt=B(D=>{let Y=gN(D);if(Y){yt(Y);return}if(D===gd){p?.();return}let de=hN(D);if(de!==null){m?.(de);return}let ie=vN(D);if(ie){let et=c?.find(gt=>gt.selection.environmentId===ie.environmentId&&gt.runtimeId===ie.runtimeId&&gt.sourceId===ie.sourceId&&gt.profileId===ie.profileId&&(gt.endpointId??void 0)===(ie.endpointId??void 0));if(!et||!et.legacyInstanceId)return;if(d){d(et);return}Tt(et.modelId,et.legacyInstanceId);return}let pe=HC(D);pe&&Tt(pe.slug,pe.instanceId)},[c,Tt,d,p,m,yt]),Jt=B(D=>{if(N===null)return;let Y=R.findIndex(ie=>_N(D,ie,N)),de=[...R];Y>=0?de.splice(Y,1):de.push({environmentId:N,instanceId:D.instanceId,model:D.slug,...D.runtimeId?{runtimeId:D.runtimeId}:{},...D.sourceId?{sourceId:D.sourceId}:{},...D.profileId?{profileId:D.profileId}:{}}),W({favorites:de})},[N,R,W]),Rt=z(()=>{let D=new Map,Y=0;for(let de of $e){if(de.ready===!1||dn(de.instanceId,de.slug).kind==="blocked")continue;let ie=y.keybindings.modelPickerJumpCommandForIndex(Y);if(!ie)return D;D.set($u(de),ie),Y+=1}return D},[dn,$e]),On=z(()=>[...Rt.keys()],[Rt]),An=z(()=>[...xe.map(D=>$u(D)),...new Set(xe.filter(D=>D.isLegacy).map(D=>UC(D.instanceId))),...Se?[...h.map(D=>Bu(D.id)),gd]:[]],[xe,h,Se]),fn=z(()=>{let D=$e.map(Y=>$u(Y));return at&&D.splice(at.currentModels.length,0,at.key),qt.length>0?[...D,...qt]:D},[at,qt,$e]),Fn=z(()=>new Map($e.map(D=>[$u(D),D])),[$e]),Nt=B(()=>{let D=E.current?.getScrollableNode();if(!(D instanceof HTMLElement))return;let Y=Math.max(0,D.scrollHeight-D.clientHeight);S(D.scrollTop>1),I(Y-D.scrollTop>1)},[]),Vt=z(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Bn=z(()=>{if(Rt.size===0)return RN;let D={platform:navigator.platform,context:Vt},Y=new Map;for(let[de,ie]of Rt){let pe=y.keybindings.shortcutLabelForCommand(te,ie,D);pe&&Y.set(de,pe)}return Y.size>0?Y:RN},[te,Rt,Vt]),oo=g===null?f?KC(f):Fu(t.activeInstanceId,t.model):Bu(g),zt=z(()=>({favoritesSet:fe,modelJumpLabelByKey:Bn,selectedItemKey:oo}),[fe,Bn,oo]);return y.pane.useKeydown(D=>{if(D.defaultPrevented||D.repeat)return;let Y=y.keybindings.resolveShortcutCommand(D,te,{platform:navigator.platform,context:Vt}),de=y.keybindings.modelPickerJumpIndexFromCommand(Y??"");if(de===null)return;let ie=On[de];if(!ie)return;let pe=HC(ie);pe&&(D.preventDefault(),D.stopPropagation(),Tt(pe.slug,pe.instanceId))},{capture:!0}),ye(()=>{S(!1),I(fn.length>5);let D=0,Y=window.requestAnimationFrame(()=>{Nt(),D=window.requestAnimationFrame(Nt)});return()=>{window.cancelAnimationFrame(Y),window.cancelAnimationFrame(D)}},[fn,Nt]),u(ZI,{delay:0,children:b("div",{className:"relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden","data-model-picker-content":"true",children:[lt&&u(kN,{selectedInstanceId:H,onSelectInstance:ve,instanceEntries:dt,showFavorites:!0,...st?{disabledInstanceIds:st,getDisabledInstanceTooltip:D=>x("instance.lockedToThread",{name:D.displayName})}:{}}),u(QI,{inline:!0,items:An,filteredItems:fn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:oo,onItemHighlighted:(D,Y)=>{A.current=typeof D=="string"?D:null,Y.reason==="keyboard"&&Y.index>=0&&E.current?.scrollIndexIntoView?.({index:Y.index,animated:!1})},onValueChange:D=>{typeof D=="string"&&Yt(D)},children:b("div",{className:F("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",lt&&"border-l border-border/70"),children:[f&&t.onClearExecutionSelection?u("div",{className:"shrink-0 border-b border-border/70 px-2 py-1",children:u(ne,{size:"sm",variant:"ghost-muted",className:"w-full justify-start",onClick:t.onClearExecutionSelection,children:v("modelPicker.useExecutorAccount")})}):null,u("div",{className:"px-2 pt-2",children:u("div",{className:"border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring",children:u(YI,{ref:T,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:v("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(rs,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:C,onChange:D=>w(D.target.value),onKeyDown:D=>{if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),t.onRequestClose?.();return}if(D.key==="Enter"&&A.current){D.preventBaseUIHandler?.(),D.preventDefault(),D.stopPropagation(),Yt(A.current);return}D.stopPropagation()},onMouseDown:D=>D.stopPropagation(),onTouchStart:D=>D.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(JI,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(mN,{ref:E,data:fn,extraData:zt,keyExtractor:D=>D,renderItem:({item:D,index:Y})=>{if(at?.key===D)return b(xl,{hideIndicator:!0,index:Y,value:D,"aria-expanded":at.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:v("modelPicker.legacyModels")}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:v("modelPicker.legacyModelCount",{count:at.legacyModels.length})})]}),u(zo,{className:F("size-4 transition-transform",at.isExpanded&&"rotate-90")})]});let de=X.get(D);if(de)return u(eG,{index:Y,itemKey:D,action:de,showSectionHeader:D===nn});if(D===gd)return u(tG,{index:Y,showSectionHeader:D===nn});let ie=Fn.get(D);if(!ie)return null;let pe=ie.ready===!1?{kind:"blocked",reason:v("modelPicker.notReady")}:dn(ie.instanceId,ie.slug);return u(xN,{index:Y,model:ie,instanceId:ie.instanceId,itemKey:$u(ie),sourceLabel:ie.sourceLabel,providerId:ie.providerId,providerDisplayName:ie.instanceDisplayName,providerAccentColor:ie.instanceAccentColor,providerAccountEmail:ie.instanceAccountEmail,isFavorite:Ne(ie),isSelected:D===oo,showProvider:!0,preferShortName:!re,useTriggerLabel:!1,jumpLabel:Bn.get(D)??null,disabledReason:pe.kind==="blocked"?pe.reason:null,actionLabel:pe.kind==="continue"?pe.label:null,onToggleFavorite:()=>Jt(ie)},D)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:ZW,onLayout:Nt,onScroll:Nt,className:F("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",MN({top:k,bottom:L}))})})}),u(XI,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:v("modelPicker.noModelsFound")})]})})]})})});var FN="h-7 min-h-7 gap-1.5 rounded-[var(--control-radius)] px-2.5 text-secondary-label transition-none hover:text-foreground [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";function qr({className:e,size:t="sm",variant:n="ghost",...o}){return u(ne,{className:F(FN,e),size:t,variant:n,...o})}function hr({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:F("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function Di(){return u(ln,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function Ag({className:e,size:t="sm",variant:n="ghost",...o}){return u(NI,{className:F(FN,e),icon:u(Di,{}),size:t,variant:n,...o})}function nG(e){let t=e.profileLabel?.trim();if(t)return t;let n=e.profileModelId?.trim();if(n)return n;let o=e.catalogOptions.find(r=>r.slug===e.model);return o?md(o):e.model}function oG(e,t){return!e?.length||!t?null:e.find(n=>n.runtimeId===t.runtimeId&&n.sourceId===t.sourceId&&n.profileId===t.profileId&&(n.endpointId??void 0)===(t.endpointId??void 0))??null}var BN=ue(function(t){let{t:n}=_e(),[o,r]=G(!1),i=ai()&&(t.open??o),s=z(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=oG(t.composerChoices,t.selectedExecutionSelection),f=nG({model:t.model,catalogOptions:d,profileLabel:c?.modelLabel,profileModelId:c?.modelId}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};q(()=>{if(!i)return;let{documentElement:C,body:w}=document,k=C.style.overscrollBehavior,S=w.style.overflow,L=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let T=N=>N instanceof Element&&N.closest("[data-model-picker-content]"),E=N=>{T(N.target)||N.preventDefault()},A=N=>{T(N.target)||N.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",A,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",A,{capture:!0}),C.style.overscrollBehavior=k,w.style.overflow=S,w.style.paddingRight=L}},[i]);let m=(C,w)=>{t.disabled||(t.onInstanceModelChange(C,w),p(!1))},h=(C,w)=>{t.disabled||(t.onContinueInModel?.(C,w),p(!1))},g=C=>{t.disabled||(t.onSelectPluginAction?.(C),p(!1))},v=()=>{t.onManagePlugins?.(),p(!1)},x=t.selectedPluginActionKey==null?null:t.pluginActions?.find(C=>C.id===t.selectedPluginActionKey)??null,y=x?WC(x.description):null;return b(gl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(vl,{render:u(qr,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:F("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-42 shrink-0":"max-w-48 shrink sm:max-w-56",t.triggerClassName),disabled:t.disabled}),children:[u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:x?b(be,{children:[u(ns,{className:"size-4 shrink-0"}),b(Xe,{children:[b(Je,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:x.title}),y?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",y]}):null]}),u(Ye,{side:"top",children:y?`${x.title} \xB7 ${y}`:x.title})]})]}):b(be,{children:[s?u(ka,{providerId:s.providerId,displayName:s.displayName,accentColor:s.accentColor,className:F("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Xe,{children:[u(Je,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}),u(Ye,{side:"top",children:t.executionAppliesTo==="next-message"?`${n("modelPicker.nextMessage")}: ${t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}`:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f})]}),t.executionAppliesTo==="next-message"?u("span",{className:"shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/80",children:n("modelPicker.nextMessage")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(Di,{})})]}),u(hl,{align:"start",className:"before:hidden [--viewport-inline-padding:0]",viewportClassName:"!overflow-hidden rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]",children:u(ON,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>p(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:m,...t.composerChoices?{composerChoices:t.composerChoices}:{},selectedExecutionSelection:t.selectedExecutionSelection??null,...t.onClearExecutionSelection?{onClearExecutionSelection:()=>{t.onClearExecutionSelection?.(),p(!1)}}:{},...t.onChooseExecution?{onChooseExecution:C=>{t.disabled||(t.onChooseExecution?.(C),p(!1))}}:{},...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:g}:{},...t.onManagePlugins?{onManagePlugins:v}:{}})})]})});me();var zN=ue(function(t){let n=_(null);return ye(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Nf,{autoHighlight:!1,mode:"none",onItemHighlighted:o=>{t.onHighlightedItemChange(typeof o=="string"?o:null)},children:u("div",{ref:n,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(Of,{className:"max-h-72 scroll-pb-6",children:u(_f,{children:t.items.map(o=>u(rG,{item:o,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===o.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},o.id))})}):u("div",{className:"px-5 pt-3.5 pb-7",children:u("p",{className:"text-secondary-label text-xs",children:t.isLoading?t.triggerKind==="skill"?"Searching workspace skills...":"Searching workspace files...":t.emptyStateText??(t.triggerKind==="skill"?"No skills found. Try / to browse provider commands.":t.triggerKind==="path"?"No matching files or folders.":"No matching command.")})})})})}),rG=ue(function(t){let n=t.item.type==="skill"?vM(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Df,{value:t.item.id,"data-composer-item-id":t.item.id,className:F("cursor-pointer select-none gap-3 rounded-lg px-3 py-2! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",t.isActive&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{t.isActive||t.onHighlight(t.item.id)},onMouseDown:r=>{r.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Qm,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,b("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:o?b(be,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),ca(o)]}):t.item.label}),u("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),n?u(sG,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),aG={app:Nd,repo:ii,project:ii,personal:ea,system:Jd,other:jd},iG={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function sG(e){let t=aG[e.kind];return b(ml,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),iG[e.kind],e.showSkillSuffix?" Skill":null]})}me();var lG=(e,t)=>t.isResponding?e("primaryActions.submitting"):t.compact?t.isLastQuestion?e("primaryActions.submit"):e("primaryActions.next"):t.isLastQuestion?t.questionIndex>0?e("primaryActions.submitAnswers"):e("primaryActions.submitAnswer"):e("primaryActions.nextQuestion"),dG=e=>{e.preventDefault()},Hu=ue(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isConnecting:l,isEnvironmentUnavailable:d,isPreparingWorktree:c,hasSendableContent:f,preserveComposerFocusOnPointerDown:p=!1,showSendWhileRunning:m=!1,onPreviousPendingQuestion:h,onInterrupt:g,onImplementPlanInNewThread:v}){let{t:x}=_e(),y=Ot(),C=p?{onPointerDown:dG}:void 0,w=y.settings.useEnvironmentIdentificationMode(),k=s!==null,S=y.devBackdrop.useVisible(w==="artwork"),L=T=>u("button",{type:"button",className:F("flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-[background-color,scale] duration-(--control-duration) hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",T?"size-8 sm:size-7":m&&f?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...C,onClick:g,"aria-label":x("primaryActions.stopGeneration"),children:u("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:u("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(n)return b("div",{className:F("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?L(!0):null,n.questionIndex>0?t?u(ne,{size:"icon-sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(Gi,{})}):u(ne,{size:"sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(ne,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...C,disabled:d||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:lG(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(r)return a?u(ne,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ne,{type:"submit",size:"sm",className:"h-9 rounded-l-full rounded-r-none bg-message-action px-4 text-message-action-foreground hover:bg-message-action-hover sm:h-8",...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(er,{children:[u(or,{render:u(ne,{size:"sm",variant:"default",className:"h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 bg-message-action px-2 text-message-action-foreground hover:bg-message-action-hover sm:h-8","aria-label":x("primaryActions.implementationActions"),...C,disabled:i||k||l||d}),children:u(ln,{})}),u(nr,{align:"end",side:"top",children:u(tr,{disabled:i||k||l||d,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let I=b("button",{type:"submit",className:F("relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-[background-color,filter,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",S?"bg-transparent text-white enabled:shadow-black/24 enabled:hover:brightness-110":"bg-message-action text-message-action-foreground enabled:shadow-message-action/24 hover:bg-message-action-hover"),...C,disabled:i||k||l||d||!f,"aria-label":d?x("primaryActions.environmentDisconnected"):s||x(l?"primaryActions.connecting":c?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[S?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(tS,{compact:!0})}):null,l||i?u(yf,{className:"size-3.5","aria-hidden":"true"}):u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return o?b(be,{children:[L(!1),m&&f?I:null]}):I});function $N(e){let t=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:b("div",{"data-chat-composer-mobile-pending-compact":"true",className:F("flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/90",!t&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!t&&"px-3 py-2"),onPointerDown:n=>n.preventDefault(),onClick:e.expandMobileComposer,"aria-label":"Write custom answer",children:e.activePendingProgress?.customAnswer||"Write custom answer"}),e.inlineTasksBadge,e.inlineStashBadge,t?u(Hu,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isConnecting:e.isConnecting,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function HN(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}me();function cG(e){return e!==null&&"tagName"in e&&"closest"in e}function Eg(e){return cG(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function GC(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function UN(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function KN(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return UN(t,"accept");case"Escape":return UN(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=GC(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var uG=2e3,fG="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",pG=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function mG(e,t){let n=[];return t<9&&n.push(String(t+1)),e==="accept"&&n.push("Enter"),e==="cancel"&&n.push("Escape"),n.length>0?n.join(" "):void 0}var qN=ue(function({requestId:t,isResponding:n,options:o=pG,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=_e(),l=Ot(),d=a==="native"||a==="queued",[c,f]=G(""),p=_([]);q(()=>{f("")},[t]);let m=B(g=>{let v=g==="decline"?c.trim():"";i(t,g,v.length>0?v:void 0)},[c,i,t]),h=B(g=>{let v=p.current.filter(C=>C!==null);if(v.length===0)return;let x=v.findIndex(C=>C===document.activeElement),y=x===-1?g===1?0:v.length-1:(x+g+v.length)%v.length;v[y]?.focus()},[]);return l.pane.useKeydown(g=>{if(n||l.terminalFocus.getOwner()!==null||g.isComposing||g.keyCode===229)return;let v=Eg(g.target);if(r&&(!v||g.metaKey||g.ctrlKey||g.altKey)){let C=l.keybindings.approvalDecisionFromCommand(l.keybindings.resolveShortcutCommand(g,r));if(C!==null&&o.some(w=>w.decision===C)){g.preventDefault(),m(C);return}}if(v)return;let x=KN(g,o);if(x===null)return;if(g.preventDefault(),x.type==="move"){h(x.delta);return}let y=o[x.index];y&&m(y.decision)},{target:"document"}),u(be,{children:o.map((g,v)=>{let x=v<9?v+1:null,y=b(ne,{ref:C=>{p.current[v]=C},size:"xs",variant:g.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":mG(g.decision,v),className:`${fG}${g.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>m(g.decision),children:[u("span",{className:"min-w-0 break-words",children:g.label}),x===null?null:u(Rf,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},g.decision);return g.decision!=="decline"||!d?y:b(ti,{children:[u(xf,{type:"text",value:c,disabled:n,maxLength:uG,placeholder:s(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":s("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:C=>f(C.target.value),onKeyDown:C=>{if(C.key==="Enter"){C.preventDefault(),m("decline");return}C.key==="Escape"&&(C.preventDefault(),c.length>0?f(""):C.currentTarget.blur())}}),y]},g.decision)})})});me();var gG=["command","cmd"],hG=["file_path","filePath","path","notebook_path","notebookPath"],vG=["url"],xG=["query","q"],yG=["name","skill","skill_name","skillName"],VN=["toolName","tool_name"],WN=["description"],CG=[],bG=[];function Xa(e,t,n){for(let o of t){let a=e.find(i=>i.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function IG(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function SG(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function jN(e){let t=e.args??CG,n=e.fileChanges??bG,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},i=null,s=a,l=null;switch(e.requestKind){case"command":{let d=Xa(t,gG,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Xa(t,hG,o)??SG(n);d!==null&&(i=IG(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Xa(t,vG,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Xa(t,xG,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Xa(t,yG,o)??Xa(t,VN,o),l=Xa(t,WN,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Xa(t,VN,o),l=Xa(t,WN,o),t.length>0&&(s={shape:"none"});break}case"mcp-elicitation":{i=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:i,body:s,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var wG={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},TG={command:"approval.title.command","file-read":"approval.title.fileReadGeneric","file-change":"approval.title.fileChangeGeneric","web-fetch":"approval.title.webFetch","web-search":"approval.title.webSearch",skill:"approval.title.skillGeneric","mcp-tool":"approval.title.toolGeneric",tool:"approval.title.toolGeneric","mcp-elicitation":"approval.title.appAccessGeneric"},LG={command:"approval.commandLabel","file-read":"approval.fileReadLabel","file-change":"approval.fileChangeLabel","web-fetch":"approval.webFetchLabel","web-search":"approval.webSearchLabel",skill:"approval.skillLabel","mcp-tool":"approval.mcpToolLabel",tool:"approval.toolLabel","mcp-elicitation":"approval.appAccessLabel"},kG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function QN(e,t){let n=e.subject!==null?wG[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(TG[e.kind])}function XN(e,t){return t(LG[e])}function YN(e,t){return t(kG[e])}function JN(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=GN(t.oldText??""),o=GN(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3712
+ `?d.insertParagraph():c===" "?d.insertNodes([iP()]):d.insertText(c)}}}else t.insertRawText(i)}function Ky(e,t,n){e.dispatchCommand(JP,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(we(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=jl(r,"previous");if(i)if(sm(i))a=i.origin;else{let s=lP(i,ki(Ct(),"next").getFlipped());for(let l of s){if(tt(l.origin)){a=l.origin;break}if(Ke(l.origin)&&!l.origin.isInline())break}}if(a&&tt(a)){let s=a.getFormat(),l=a.getStyle();o.format===s&&o.style===l||(o.format=s,o.style=l,o.dirty=!0)}}})(n))}function XE(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=Ke(n)&&n.excludeFromCopy("html"),i=n;t!==null&&tt(i)&&(i=Rm(t,i,"clone"));let s=Ke(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Vm(58,f.name),Ke(d)){let p=c.children;Array.isArray(p)||Vm(59,f.name)}return c})(i);tt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=XE(e,t,c,l.children);!r&&Ke(n)&&f&&n.extractWithChild(c,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let c=l.children[d];o.push(c)}return r}function YE(e,t){let n=[],o=Ct().getChildren();for(let r=0;r<o.length;r++)XE(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function JE(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=CP(o);tt(r)&&AA(r),t.push(r)}return t}var nd=null;async function U3(e,t,n){if(nd!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(GE(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=Jx(r);if(o===null||i===null)return!1;let s=a.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(a.createTextNode("#")),o.append(s);let l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(fm,p=>(su(p,ClipboardEvent)&&(f(),nd!==null&&(r.clearTimeout(nd),nd=null),d(GE(e,p,n))),!0),um);nd=r.setTimeout(()=>{f(),nd=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function GE(e,t,n){if(n===void 0){let r=Jx(e._window),a=Oe();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!fA(e,i,s))return!1;n=eM(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(tM(o,n),!0)}var ZE=[["text/html",jE],["application/x-lexical-editor",QE]];function eM(e=Oe()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=om();for(let[o,r]of ZE){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function tM(e,t){for(let[n]of ZE)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var ia=qy,Mie=ia.$generateJSONFromSelectedNodes,Rie=ia.$generateNodesFromSerializedNodes,Nie=ia.$getClipboardDataFromSelection,nM=ia.$getHtmlContent,_ie=ia.$getLexicalContent,Vy=ia.$insertDataTransferForPlainText,Die=ia.$insertDataTransferForRichText,Oie=ia.$insertGeneratedNodes,Fie=ia.copyToClipboard,Bie=ia.setLexicalClipboardDataTransfer;var Wy={};An(Wy,{PlainTextExtension:()=>Q3,registerPlainText:()=>aM});var Bs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,K3=Bs&&"documentMode"in document?document.documentMode:null,q3=Bs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),V3=!(!Bs||!("InputEvent"in window)||K3)&&"getTargetRanges"in new window.InputEvent("input"),W3=Bs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),oM=Bs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,G3=Bs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),j3=Bs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&q3&&!G3;function rM(e,t){t.update(()=>{if(e!==null){let n=su(e,KeyboardEvent)?null:e.clipboardData,o=Oe();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=nM(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function aM(e){return Fa(e.registerCommand(pm,t=>{let n=Oe();return!!we(n)&&(n.deleteCharacter(t),!0)},Xt),e.registerCommand(NP,t=>{let n=Oe();return!!we(n)&&(n.deleteWord(t),!0)},Xt),e.registerCommand(RP,t=>{let n=Oe();return!!we(n)&&(n.deleteLine(t),!0)},Xt),e.registerCommand(EP,t=>{let n=Oe();if(!we(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Vy(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Xt),e.registerCommand(XP,()=>{let t=Oe();return!!we(t)&&(t.removeText(),!0)},Xt),e.registerCommand(Yx,t=>{let n=Oe();return!!we(n)&&(n.insertLineBreak(t),!0)},Xt),e.registerCommand(zP,()=>{let t=Oe();return!!we(t)&&(t.insertLineBreak(),!0)},Xt),e.registerCommand(gm,t=>{let n=Oe();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!0)&&(o.preventDefault(),uy(n,r,!0),!0)},Xt),e.registerCommand(hm,t=>{let n=Oe();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!1)&&(o.preventDefault(),uy(n,r,!1),!0)},Xt),e.registerCommand(vm,t=>{let n=Oe();return!!we(n)&&(!oM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(pm,!0))},Xt),e.registerCommand(KP,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),e.dispatchCommand(pm,!1))},Xt),e.registerCommand(xm,t=>{let n=Oe();if(!we(n))return!1;if(t!==null){if((oM||W3||j3)&&V3)return!1;t.preventDefault()}return e.dispatchCommand(Yx,!1)},Xt),e.registerCommand(ZP,()=>(lm(),!0),Xt),e.registerCommand(fm,t=>{let n=Oe();return!!we(n)&&(rM(t,e),!0)},Xt),e.registerCommand(MP,t=>{let n=Oe();return!!we(n)&&((function(o,r){rM(o,r),r.update(()=>{let a=Oe();we(a)&&a.removeText()})})(t,e),!0)},Xt),e.registerCommand(Cm,t=>{let n=Oe();return!!we(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Oe(),i=su(o,ClipboardEvent)?o.clipboardData:null;i!=null&&we(a)&&Vy(i,a)},{tag:GP})})(t,e),!0)},Xt),e.registerCommand(DP,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),!0)},Xt),e.registerCommand(_P,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),!0)},Xt))}var Q3=Mn({conflictsWith:["@lexical/rich-text"],dependencies:[zE],name:"@lexical/plain-text",register:aM});var iM=Wy,Vie=iM.PlainTextExtension,sM=iM.registerPlainText;var jy={};An(jy,{PlainTextPlugin:()=>Z3});me();var Wm=Sd(pc(),1);function X3(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Gy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function Y3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return Gy(()=>n.registerDecoratorListener(i=>{(0,Wm.flushSync)(()=>{a(i)})}),[n]),q(()=>{a(n.getDecorators())},[n]),z(()=>{let i=[],s=Object.keys(r);for(let l=0;l<s.length;l++){let d=s[l],c=u(o,{onError:p=>n._onError(p),children:u(ih,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,Wm.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function J3({editor:e,ErrorBoundary:t}){return(function(n){let o=wE.maybeFromEditor(n);if(o&&o.hasExtensionByName(OE.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&X3(320,r);return!0}return!1})(e)?null:u(Y3,{editor:e,ErrorBoundary:t})}function lM(e){return e.getEditorState().read(Pm(e.isComposing()))}function Z3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=In();return(function(r){Gy(()=>Fa(sM(r),$E(r)),[r])})(o),b(be,{children:[e,u(eK,{content:t}),u(J3,{editor:o,ErrorBoundary:n})]})}function eK({content:e}){let[t]=In(),n=(function(r){let[a,i]=G(()=>lM(r));return Gy(()=>{function s(){let l=lM(r);i(l)}return s(),Fa(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=DE();return n?typeof e=="function"?e(o):e:null}var tK=jy,dM=tK.PlainTextPlugin;me();function cM(e){return/mac|iphone|ipad|ipod/i.test(e)}function fu(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function pu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function uM(e){let t=pu(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}me();var Gm=ue(function(t){let n=Ot().pierreIcons,o=n.useSpriteReady();wd(n.ensureSprite,[n]);let r=z(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:F("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(oi,{className:F("size-4 shrink-0 text-icon-muted",t.className)}):u(_d,{className:F("size-4 shrink-0 text-icon-muted",t.className)})});var fM=mi;function pM(e){return b(be,{children:[u(Gm,{pathValue:e.path,kind:uM(e.path),theme:e.theme,className:Zr}),u("span",{className:e.selectable?xT:ea,children:e.label})]})}function mM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Qe,{children:[u(Ye,{render:b("span",{className:F(mi,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(ba,{className:F(Zr,"size-icon-1",o&&"opacity-100")}),u("span",{className:ea,children:t})]})}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function gM({context:e}){let{t}=De(),n=Gw(e),o=Ww(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(mM,{label:n,tooltipText:r,expired:o})}function nK(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function oK(e){return e.replaceAll("\\","/")}function sa(e){let t=e.displayName?.trim();return t||nK(e.name)}function hM(e,t){return t?e.filter(n=>n.enabled):[]}function vM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function xM(e){let t=oK(e.path);if(t.includes("/.codex/plugins/")||t.includes("/.agents/plugins/"))return"app";switch(e.scope?.trim().toLowerCase()){case"repo":case"repository":return"repo";case"project":case"workspace":case"local":return"project";case"user":case"personal":return"personal";case"system":return"system";case void 0:case"":return"other";default:return"other"}}function yM(e,t){return e.registerCommand(Cm,n=>{if(!(n instanceof ClipboardEvent)||n.clipboardData===null||n.clipboardData.files.length>0)return!1;let o=n.clipboardData.getData("text/plain");if(o.length===0)return!1;let r=wc(`${o}
3713
+ `).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=Oe();if(!we(a))return!1;let i=[],s=c=>{let f=c.split(`
3714
+ `);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(Mr(m)),p<f.length-1&&i.push(Ms())}},l=r[0];if(l&&l.start===0){let c=a.isBackward()?a.focus:a.anchor,f=t.getExpandedAbsoluteOffsetForPoint(c.getNode(),c.offset),p=Ct().getTextContent().slice(f-1,f);p.length>0&&!/\s/.test(p)&&i.push(Mr(" "))}let d=0;for(let c of r)c.start<d||(c.start>d&&s(o.slice(d,c.start)),i.push(t.createMentionNode(c.value)),d=c.end);return d<o.length?s(o.slice(d)):i.push(Mr(" ")),a.insertNodes(i),n.preventDefault(),!0},Nr)}var od=new Map,rK=32;function CM(e,t){for(od.delete(e),od.set(e,t);od.size>rK;){let n=od.keys().next().value;if(n===void 0)break;od.delete(n)}}function aK(e){return{anchor:e.length,focus:e.length}}function Ba(e,t,n){let o=od.get(e);if(o)return CM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:aK(t),history:NE()};return CM(e,r),r}function rd(e,t,n){let o=Ba(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function bM(e,t,n,o){let r=Ba(e,t);r.cursor=n,r.expandedCursor=o}function IM(e,t){let n=e.current,o=[...e.undoStack],r=[...e.redoStack];t(),e.current=n,e.undoStack.splice(0,e.undoStack.length,...o),e.redoStack.splice(0,e.redoStack.length,...r)}var iK=`composer-editor-${Math.random().toString(36).slice(2)}`,sK=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],kM=new Map(sK),SM=kM.get("`")??null,PM=Ht({onRemoveTerminalContext:()=>{}});function lK(e){let t=fK(),n=u("span",{className:fM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(pM,{path:e.path,label:pu(e.path),theme:t})});return b(Qe,{children:[u(Ye,{render:n}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var mu=class e extends Oa{__path;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__key)}static importJSON(t){return Jy(t.path).updateFromJSON(t)}constructor(t,n){super(n),this.__path=t}exportJSON(){return{...super.exportJSON(),path:this.__path,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return Sc(this.__path)}isInline(){return!0}decorate(){return u(lK,{path:this.__path})}};function Jy(e){return tm(new mu(e))}function dK(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function gu(e){return new Map(e.map(t=>[t.name,{label:sa(t),description:dK(t)}]))}function cK(e){let t=b("span",{className:yT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:Zr,dangerouslySetInnerHTML:{__html:CT}}),u("span",{className:ea,children:e.skillLabel})]});return e.skillDescription?b(Qe,{children:[u(Ye,{render:t}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var hu=class e extends Oa{__skillName;__skillLabel;__skillDescription;static getType(){return"composer-skill"}static clone(t){return new e(t.__skillName,t.__skillLabel,t.__skillDescription,t.__key)}static importJSON(t){return AM(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,n,o,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=n,this.__skillDescription=o}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(cK,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function AM(e,t,n){return tm(new hu(e,t,n))}function uK(e){return u(gM,{context:e.context})}var zs=class e extends Oa{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return EM(t.context)}constructor(t,n){super(n),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(uK,{context:this.__context})}};function EM(e){return tm(new zs(e))}function Ei(e){return e instanceof mu||e instanceof hu||e instanceof zs}function fK(){return document.documentElement.classList.contains("dark")?"dark":"light"}function pK(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function mK(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function jm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Xm(e){return 1}function MM(e){return e.getTextContentSize()}function gK(e,t,n){return t+(n>0?Xm(e):0)}function hK(e,t,n){return t+(n>0?MM(e):0)}function vK(e,t){let n=e.getParent();if(!n||!Ke(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===Xm(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=Xm(e),null)}function Ym(e){return Ei(e)?Xm(e):tt(e)?e.getTextContentSize():Xl(e)?1:Ke(e)?e.getChildren().reduce((t,n)=>t+Ym(n),0):0}function Xy(e){return Ei(e)?MM(e):tt(e)?e.getTextContentSize():Xl(e)?1:Ke(e)?e.getChildren().reduce((t,n)=>t+Xy(n),0):0}function vu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ke(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Ym(l))}o=r}if(tt(e))return n+Math.min(t,e.getTextContentSize());if(Ei(e))return gK(e,n,t);if(Xl(e))return n+Math.min(t,1);if(Ke(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Ym(s))}return n}return n}function Jm(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ke(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Xy(l))}o=r}if(tt(e))return n+Math.min(t,e.getTextContentSize());if(Ei(e))return hK(e,n,t);if(Xl(e))return n+Math.min(t,1);if(Ke(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Xy(s))}return n}return n}function Zm(e,t){if(Ei(e))return vK(e,t);if(tt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(Xl(e)){let n=e.getParent();if(!n)return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===1?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=1,null)}if(Ke(e)){let n=e.getChildren();for(let o of n){let r=Zm(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function eg(){return Ct().getChildren().reduce((n,o)=>n+Ym(o),0)}function $s(e){let t=Ct(),n=eg(),r={value:Math.max(0,Math.min(e,n))},a=Zm(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=Rs();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Rr(i)}function Qm(e,t){let n=Ct(),o=eg(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=Zm(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=Zm(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=Rs();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Rr(c)}function wM(e){if(!we(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Jm(t,e.anchor.offset),r=Jm(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function TM(e){return we(e)?e.getNodes().some(t=>Ei(t)):!1}function xu(e){let t=Oe();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=vu(n,t.anchor.offset),r=eg();return Math.max(0,Math.min(o,r))}function LM(e){let t=Oe();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Jm(n,t.anchor.offset),r=Ct().getTextContent().length;return Math.max(0,Math.min(o,r))}function Qy(e){let t=Oe();return we(t)?{anchor:vu(t.anchor.getNode(),t.anchor.offset),focus:vu(t.focus.getNode(),t.focus.offset)}:e}function xK(e,t){let n=t.split(`
3715
+ `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Mr(r)),o<n.length-1&&e.append(Ms())}}function Zy(e,t,n){let o=Ct();o.clear();let r=ur();o.append(r);let a=ys(e,t);for(let i of a){if(i.type==="mention"){r.append(Jy(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(AM(i.name,s?.label??sa({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(EM(i.context));continue}xK(r,i.text)}}function Yy(e){return e instanceof zs?[e.__context.id]:Ke(e)?e.getChildren().flatMap(t=>Yy(t)):[]}function yK(e){let[t]=In();return q(()=>{let n=(s,l)=>{if(!e.onCommandKeyDown||!l)return!1;if(s==="Enter"&&(l.isComposing||l.keyCode===229))return l.stopPropagation(),!0;let d=e.onCommandKeyDown(s,l);return d&&(l.preventDefault(),l.stopPropagation()),d},o=t.registerCommand(HP,s=>n("ArrowDown",s),Nr),r=t.registerCommand(UP,s=>n("ArrowUp",s),Nr),a=t.registerCommand(xm,s=>n("Enter",s),Nr),i=t.registerCommand(ym,s=>n("Tab",s),Nr);return()=>{o(),r(),a(),i()}},[t,e]),null}function CK(){let[e]=In();return q(()=>{let t=e.registerCommand(gm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Oe();if(!we(i)||!i.isCollapsed())return;let s=xu(0);if(s<=0)return;let l=Ct().getTextContent();Tc(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{$s(a)}),!0},Nr),n=e.registerCommand(hm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Oe();if(!we(i)||!i.isCollapsed())return;let s=xu(0),l=eg();if(s>=l)return;let d=Ct().getTextContent();Tc(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{$s(a)}),!0},Nr);return()=>{t(),n()}},[e]),null}function bK(){let[e]=In();return q(()=>e.registerCommand(qP,t=>{if(!cM(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let n=e.getRootElement(),o=window.getSelection(),r=o?.anchorNode;return!n||!o||!r||!n.contains(r)||o.rangeCount===0||typeof o.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),o.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{Rr(aP(o,e))}),!0)},Nr),[e]),null}function IK(){let[e]=In();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Oe();if(!we(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Ei(r)||o.anchor.offset===0)return;n=vu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{$s(n)})})}),[e]),null}function SK(){let[e]=In(),{onRemoveTerminalContext:t}=Ut(PM);return q(()=>e.registerCommand(vm,n=>{let o=Oe();if(!we(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=xu(0),i=s=>{if(!Ei(s))return!1;let l=vu(s,0);return s.remove(),s instanceof zs?(t(s.__context.id),$s(a)):$s(l),n?.preventDefault(),!0};if(i(r))return!0;if(tt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(Ke(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(Ke(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},Nr),[e,t]),null}function wK(){let[e]=In();return q(()=>{let t=new Set,n=e.getRootElement()===document.activeElement,o=l=>{for(let d of t)l.has(d)||e.getElementByKey(d)?.removeAttribute("data-composer-chip-selected");for(let d of l)e.getElementByKey(d)?.setAttribute("data-composer-chip-selected","true");t=l},r=()=>{let l=new Set;return e.getEditorState().read(()=>{let d=Oe();if(we(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Oa&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(OP,()=>(n=!0,o(r()),!1),Yl),s=e.registerCommand(TP,()=>(n=!1,o(new Set),!1),Yl);return()=>{a(),i(),s()}},[e]),null}function TK(){let[e]=In();return q(()=>yM(e,{createMentionNode:Jy,getExpandedAbsoluteOffsetForPoint:Jm}),[e]),null}function LK(e){let[t]=In(),n=_(e.terminalContexts),o=_(gu(e.skills)),r=_(null),a=_(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=gu(e.skills)},[e.skills]);let i=lh(s=>{let l=kM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let g=Oe();if(!we(g)||g.isCollapsed()||TM(g))return null;let v=wM(g);if(!v||v.start===v.end)return null;let x=Ct().getTextContent();return lv(x,v.start,v.end)?null:{value:x,expandedStart:v.start,expandedEnd:v.end}})();if(!f||!l)return;let p=f.value.slice(f.expandedStart,f.expandedEnd),m=`${f.value.slice(0,f.expandedStart)}${s}${p}${l}${f.value.slice(f.expandedEnd)}`;Zy(m,n.current,o.current);let h=sr(m,f.expandedStart);Qm(h+s.length,h+s.length+p.length),c=!0,r.current=null}),c});return q(()=>{let s=h=>{if(a.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;a.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){r.current=null,a.current=null;return}t.getEditorState().read(()=>{let g=Oe();if(!we(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(TM(g)){r.current=null,a.current=null;return}let v=wM(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=Ct().getTextContent();if(lv(x,v.start,v.end)){r.current=null,a.current=null;return}let y={value:x,expandedStart:v.start,expandedEnd:v.end};r.current=y,a.current=null})},l=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&SM!==null&&r.current){a.current=r.current;return}if(a.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){r.current=null;return}let g=h.inputType==="insertText"?h.data:null;if(!g||g.length!==1){r.current=null;return}i(g)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},d=h=>{queueMicrotask(()=>{t.update(()=>{let g=a.current;if(!g)return;let v=Ct().getTextContent(),x=SM;if(x===null){a.current=null;return}let y=`${g.value.slice(0,g.expandedStart)}\`${g.value.slice(g.expandedEnd)}`;if(v!==y){h?.finalAttempt&&(r.current=null,a.current=null);return}let C=g.value.slice(g.expandedStart,g.expandedEnd),w=sr(v,g.expandedStart);Qm(w,w+1);let k=Oe();if(!we(k)){r.current=null,a.current=null;return}k.insertText(`\`${C}${x}`),Qm(w+1,w+1+C.length),r.current=null,a.current=null},{tag:_r})})},c=h=>{let g=h;(g.inputType==="insertText"||g.inputType==="insertCompositionText")&&d()},f=()=>{d({finalAttempt:!0})},p=null,m=t.registerRootListener((h,g)=>{g?.removeEventListener("keydown",s),g?.removeEventListener("beforeinput",l,!0),g?.removeEventListener("input",c),g?.removeEventListener("compositionend",f),h?.addEventListener("keydown",s),h?.addEventListener("beforeinput",l,!0),h?.addEventListener("input",c),h?.addEventListener("compositionend",f),p=h});return()=>{p&&(p.removeEventListener("keydown",s),p.removeEventListener("beforeinput",l,!0),p.removeEventListener("input",c),p.removeEventListener("compositionend",f)),m()}},[t]),null}function kK({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let[m]=In(),h=_(d);h.current=d;let g=ir(t,n),v=Ba(e,t,{cursor:g,expandedCursor:Ir(t,g)}),x=ir(t,v.cursor),y=pK(o),C=_(y),w=mK(r),k=_(w),S=_(gu(r)),L=_({value:t,cursor:x,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(H=>H.id)}),I=_(e),T=v.history,E=_(!1),A=z(()=>({onRemoveTerminalContext:l}),[l]);ye(()=>{S.current=gu(r)},[r]),q(()=>{m.setEditable(!a)},[a,m]),ye(()=>{let H=ir(t,n),K=L.current,O=I.current,oe=O!==e,ee=C.current!==y,W=k.current!==w;if(!oe&&K.value===t&&K.cursor===H&&!ee&&!W)return;if(oe){let Ee=K.selection;m.getEditorState().read(()=>{Ee=Qy(Ee)}),rd(O,K.value,{cursor:K.cursor,expandedCursor:K.expandedCursor,selection:Ee})}let qe=Ba(e,t),ve=oe?qe.selection:{anchor:H,focus:H};L.current={value:t,cursor:oe?qe.cursor:H,expandedCursor:oe?qe.expandedCursor:Ir(t,H),selection:ve,terminalContextIds:o.map(Ee=>Ee.id)},I.current=e,C.current=y,k.current=w;let fe=m.getRootElement(),Ne=!!(fe&&document.activeElement===fe);if(!oe&&K.value===t&&!ee&&!W&&!Ne)return;let Ae=oe?Ba(O,K.value).history:null;E.current=!0;let ae=()=>m.update(()=>{let Ee=oe||K.value!==t||ee||W;Ee&&Zy(t,o,S.current),oe?Qm(ve.anchor,ve.focus):(Ee||Ne)&&$s(H)},{discrete:!0,tag:_r});Ae?IM(Ae,ae):ae(),rd(e,t,L.current),queueMicrotask(()=>{E.current=!1})},[n,e,m,w,o,y,t]);let N=B(H=>{let K=m.getRootElement();if(!K)return;let O=ir(L.current.value,H);K.focus({preventScroll:!0}),m.update(()=>{$s(O)}),L.current={value:L.current.value,cursor:O,expandedCursor:Ir(L.current.value,O),selection:{anchor:O,focus:O},terminalContextIds:L.current.terminalContextIds},rd(I.current,L.current.value,{cursor:L.current.cursor,expandedCursor:L.current.expandedCursor,selection:L.current.selection}),h.current(L.current.value,O,L.current.expandedCursor,!1,L.current.terminalContextIds)},[m]),R=B(()=>{let H=L.current;return m.getEditorState().read(()=>{let K=Ct().getTextContent(),O=ir(K,L.current.cursor),oe=ir(K,xu(O)),ee=jm(K,L.current.expandedCursor),W=jm(K,LM(ee)),qe=Yy(Ct()),ve=Qy(L.current.selection);H={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:qe}}),L.current=H,rd(I.current,H.value,H),H},[m]);Gr(p,()=>({focus:()=>{N(L.current.cursor)},focusAt:N,focusAtEnd:()=>{N(sr(L.current.value,L.current.value.length))},readSnapshot:R}),[N,R]);let $=B(H=>{H.read(()=>{let K=Ct().getTextContent(),O=ir(K,L.current.cursor),oe=ir(K,xu(O)),ee=jm(K,L.current.expandedCursor),W=jm(K,LM(ee)),qe=Yy(Ct()),ve=Qy(L.current.selection),fe=L.current;if(fe.value===K&&fe.cursor===oe&&fe.expandedCursor===W&&fe.selection.anchor===ve.anchor&&fe.selection.focus===ve.focus&&fe.terminalContextIds.length===qe.length&&fe.terminalContextIds.every((Ae,ae)=>Ae===qe[ae])||E.current)return;L.current={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:qe},rd(I.current,K,{cursor:oe,expandedCursor:W,selection:ve});let Ne=Tc(K,oe,"left")||Tc(K,oe,"right");h.current(K,oe,W,Ne,qe)})},[]);return u(PM,{value:A,children:b("div",{className:"relative [font-family:var(--font-composer,var(--font-sans))] [font-size:var(--font-size-prompt,0.875rem)] [@media(max-width:39.999rem)_and_(pointer:coarse)]:[font-size:max(var(--font-size-prompt,1rem),16px)]",children:[u(dM,{contentEditable:u(eE,{className:F("block max-h-50 min-h-17.5 w-full overflow-y-auto whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none",s),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":i,placeholder:u("span",{}),onPaste:f}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:tE}),u(_E,{onChange:$}),u(yK,{...c?{onCommandKeyDown:c}:{}}),u(LK,{terminalContexts:o,skills:r}),u(bK,{}),u(CK,{}),u(IK,{}),u(SK,{}),u(TK,{}),u(wK,{}),u(RE,{externalHistoryState:T},e)]})})}function PK(e){let[t]=In(),n=_(e),o=_(e),[r,a]=G(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,ye(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),q(()=>{let s=null,l=()=>{let c=o.current.documentKey;a(f=>f===c?f:c)},d=t.registerRootListener((c,f)=>{f?.removeEventListener("compositionend",l),c?.addEventListener("compositionend",l),s=c});return()=>{s?.removeEventListener("compositionend",l),d()}},[t]);let i=r===e.documentKey?e:n.current;return u(kK,{...i})}function RM({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let m=_(t),h=_(o),g=_(gu(r)),v=z(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[mu,hu,zs],editorState:()=>{Zy(m.current,h.current,g.current)},onError:x=>{throw x}}),[]);return u(mA,{initialConfig:v,children:u(PK,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:l,onChange:d,onPaste:f,editorRef:p,...c?{onCommandKeyDown:c}:{},...s?{className:s}:{}})},iK)}me();me();me();var xC=Sd(OM(),1),xR=Sd(pc(),1),yR=Sd(pc(),1);Wn(function(t,n){return Te("div",{ref:n,...t})});var cg=Wn(function(t,n){return Te("div",{ref:n,...t})}),fr=cg,Ua={OS:"web"};function Hs(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function yC(e,t){return t===void 0||!Number.isFinite(t)||!Number.isFinite(e.scrollLength)||t<=e.scrollLength?t!==void 0&&Number.isFinite(t)&&Number.isFinite(e.scrollLength)?0:void 0:Math.max(0,t-e.scrollLength)}function CR(){return"normal"}function BK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:CR()}function zK(e){var t;return(t=e?.rtl)!=null?t:!1}function qa(e){return CC(e?.props)}function CC(e){return!!e?.horizontal&&zK(e)}function bC(e){return e?.horizontal?(CC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function $K(e,t){var n;return(n=yC(e,t))!=null?n:0}function FM(e,t){return t&&(qa(e)?t.left:t.right)||0}function HK(e,t,n,o){return!qa(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function IC(e,t,n){if(!e||!qa(e))return t;let o=yC(e,n),r=Hs(t,o),a=BK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Hs(o-r,o):r}function UK(e,t,n){if(!qa(e))return e.horizontalRTLScrollType=void 0,t;let o=yC(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Hs(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let i=e.horizontalRTLScrollType;if(i==="inverted")return Hs(a,o);if(i==="normal")return Hs(r,o);if(!e.hasScrolled){let f=CR();return e.horizontalRTLScrollType=f,Hs(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Hs(c?a:r,o)}var KK=e=>e,ug=Ht(null),bR="\0",qK=0;function VK({children:e}){let[t]=G(()=>({animatedScrollY:KK(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:qK++,listeners:new Map,mapViewabilityAmountCallbacks:new Map,mapViewabilityAmountValues:new Map,mapViewabilityCallbacks:new Map,mapViewabilityConfigStates:new Map,mapViewabilityValues:new Map,pendingContainerIds:void 0,positionListeners:new Map,scrollAxisGap:0,state:void 0,values:new Map([["alignItemsAtEndPadding",0],["containerLayoutEpoch",0],["stylePaddingTop",0],["headerSize",0],["numContainers",0],["activeStickyIndex",-1],["isAtEnd",!1],["isAtStart",!1],["isNearEnd",!1],["isNearStart",!1],["isWithinMaintainScrollAtEndThreshold",!1],["adaptiveRender","normal"],["totalSize",0],["scrollAdjustPending",0]]),viewRefs:new Map}));return Te(ug.Provider,{value:t},e)}function Br(){return fn(ug)}function IR(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let i=0;i<t.length;i++){let s=de(e,t[i]);r.push(s),s!==o[i]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let i of t)a.push($a(e,i,r));return()=>{for(let i of a)i()}}}}function WK(e){return e.length===1?e[0]:e.join(bR)}function GK(e){return e.split(bR)}function $a(e,t,n){let{listeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function de(e,t){let{values:n}=e;return n.get(t)}function Pe(e,t,n){let{listeners:o,values:r}=e;if(r.get(t)!==n){r.set(t,n);let a=o.get(t);if(a)for(let i of a)i(n)}}function jK(e,t,n){let{positionListeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function QK(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Wo(e){let t=fn(ug),n=WK(e),{subscribe:o,get:r}=z(()=>IR(t,GK(n)),[t,n]);return(0,xC.useSyncExternalStore)(o,r,r)}function XK(e,t){let n=fn(ug),{subscribe:o,get:r}=z(()=>IR(n,[e]),[n,e]),a=B(()=>t(r()[0]),[r,t]);return(0,xC.useSyncExternalStore)(o,a,a)}function YK(e){return Math.max(0,e??0)}function Ks(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?FM(o,s):s?.bottom)||0,d=YK(t??r.contentInsetEndAdjustment),c=de(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let h={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?FM(o,h):h.bottom)||0)+d,f)}return Math.max(m,f)}function po(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,i=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,s=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=Ks(e),f=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:o.get("totalSize"),p=Math.max(0,f-(r.props.data.length>0?e.scrollAxisGap:0));return l+d+p+a+s+i+(c||0)}var id=({children:e})=>Te(cg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ue(function(){let t=Br(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Wo(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=po(t),[,c]=Za(f=>f+1,0);return JK(()=>{c()},100),Te(cg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Te(id,null,Te(fr,null,"TotalSize:"),Te(fr,null,n.toFixed(2))),Te(id,null,Te(fr,null,"ContentSize:"),Te(fr,null,d.toFixed(2))),Te(id,null,Te(fr,null,"At end:"),Te(fr,null,String(l))),Te(id,null,Te(fr,null,"ScrollAdjust:"),Te(fr,null,o.toFixed(2))),Te(id,null,Te(fr,null,"RawScroll: "),Te(fr,null,r.toFixed(2))),Te(id,null,Te(fr,null,"ComputedScroll: "),Te(fr,null,a.toFixed(2))))});function JK(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var SC=!0,SR=new WeakMap;function ZK(e){return SR.get(e)}function eq(e,t){SR.set(e,t)}var tq=typeof __DEV__<"u"?__DEV__:void 0,BM,zM=typeof process<"u"&&typeof process.env=="object"&&process.env?(BM="production")!=null?BM:process.env.MODE:void 0,$M=typeof zM=="string"?zM.toLowerCase()!=="production":void 0,HM,Vo=(HM=$M??tq)!=null?HM:!1,sd=-1e7,wR=1,nq=Vo&&!1,oq=Vo&&!1;function fg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function TR(e){var t,n;let o=(n=e.pendingScrollResolve)!=null?n:(t=e.pendingScrollToEnd)==null?void 0:t.resolve;e.pendingScrollResolve=void 0,e.pendingScrollToEnd=void 0,o?.()}function rq(e){fg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,TR(e)}function aq(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function iq(e,t){var n,o,r,a;let i=e.state,s=i.deferredPublicOnScrollEvent;i.deferredPublicOnScrollEvent=void 0,s&&((a=(r=i.props).onScroll)==null||a.call(r,aq(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var tC=1;function sq(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function UM(e){e.initialScrollSession=void 0}function sC(e){let{bootstrap:t,completion:n,kind:o,previousDataLength:r}=e;return o==="offset"?{completion:n,kind:o,previousDataLength:r}:{bootstrap:t,completion:n,kind:o,previousDataLength:r}}function tg(e,t=(n=>(n=(o=>(o=e.initialScrollSession)==null?void 0:o.kind)())!=null?n:"bootstrap")()){var n,o;return e.initialScrollSession?e.initialScrollSession.kind!==t&&(e.initialScrollSession=sC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=sC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var pg={didDispatchNativeScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didDispatchNativeScroll)},didRetrySilentInitialScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didRetrySilentInitialScroll)},markInitialScrollNativeDispatch(e){tg(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){tg(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=tg(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},oo={clear(e){oo.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=tC},get(e){var t,n;return(n=(t=e.initialScrollSession)==null?void 0:t.completion)==null?void 0:n.watchdog},hasNonZeroTargetOffset(e){return e!==void 0&&e>tC},isAtZeroTargetOffset(e){return e<=tC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=tg(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Ka(e,t={}){var n,o,r,a;let i=e.initialScrollSession,s=(n=t.kind)!=null?n:i?.kind,l=i?.completion,d=i?.kind==="bootstrap"?i.bootstrap:void 0,c=s==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!s||!e.initialScroll&&!c&&!sq(l))return UM(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=sC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var lq=1.3;function lC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*lq||!t&&n<=0&&o>0}var LR=(e,t,n,o,r,a,i,s)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{s({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?lC(e,t,n)?(s(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(i(e),c(),!0):!1};function dq(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function kR(e){let t=e.state;if(!t.edgeReachedGate)return;let n=po(e),o=n-t.scroll-t.scrollLength-Ks(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=lC(t.scroll,!1,a),l=lC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function PR(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function AR(e){e.state.edgeReachedGate="closed"}function KM(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function cq(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",dq(e,o),o}function bu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function ER(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:i,scroll:s,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=po(e);if(kR(e),f>0&&a){let p=Ks(e),m=f-s-i-p,h=f<i;Pe(e,"isAtEnd",h||m<=wR),Pe(e,"isNearEnd",h||m<=c*i),Pe(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),bu(r)||l||(r.isEndReached=LR(m,h,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var x,y;PR(e,"end",t,n)&&(AR(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function uq(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:i},scroll:s,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=i*l;kR(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Pe(e,"isAtStart",s<=wR),Pe(e,"isNearStart",s<=p),bu(o)||o.scrollingTo||(o.isStartReached=LR(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;PR(e,"start",t,n)&&(AR(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function mg(e,t){let n=!e.state.edgeReachedGate;ER(e,t,n),uq(e,t,n)}function MR(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),mg(e)}var fq=6,pq=3,mq=250;function RR(e){e.state.scheduledWork.cancel("adaptiveRender")}function qM(e,t){let n=e.state;RR(e),t<=0?Tu(e,"normal","scroll"):n.scheduledWork.timeout(()=>Tu(e,"normal","scroll"),t,"adaptiveRender")}function Tu(e,t,n){var o,r;de(e,"adaptiveRender")!==t&&(Pe(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function wC(e){var t,n;RR(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";de(e,"adaptiveRender")!==o&&Tu(e,o,"initial")}function gq(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=de(e,"adaptiveRender");if(de(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:fq,c=(r=s.exitVelocity)!=null?r:pq,f=(a=s.exitDelay)!=null?a:mq,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",h=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==h&&(m==="light"?(Tu(e,"light","scroll"),qM(e,f)):l==="light"&&qM(e,f))}else wC(e)}var TC=50;function NR(e,t){var n;let o=e.state.props.drawDistance,r=e.state.initialScroll,a=r!==void 0&&((n=r.viewPosition)!=null?n:0)>0;return t==="visible-first"||t!=="full"&&!de(e,"readyToRender")&&!a?Math.min(o,TC):o}function _R(e){let{state:t}=e;t.props.drawDistance<=TC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function LC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Pe(e,"readyToRender",!1),wC(e)}function kC(e,{didLayout:t,didInitialScroll:n}){let{state:o}=e,{loadStartTime:r,props:{onLoad:a}}=o;t&&(o.didContainersLayout=!0),n&&(o.didFinishInitialScroll=!0),o.didContainersLayout&&o.didFinishInitialScroll&&!de(e,"readyToRender")&&(Pe(e,"readyToRender",!0),Tu(e,"normal","ready"),o.props.drawDistance>TC&&_R(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var hq=2e3;function VM(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function DR(e){e.scheduledWork.cancel("preservedInitialScroll")}function ld(e){DR(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Ka(e)}function WM(e){var t,n,o;let r=e.state,a=((t=r.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?r.initialScrollSession.bootstrap:void 0;(r.initialScroll||a||(n=r.scrollingTo)!=null&&n.isInitialScroll)&&(a?.frameHandle!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.frameHandle),(o=r.scrollingTo)!=null&&o.isInitialScroll&&(fg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),pg.resetFlags(r),Ka(r,{bootstrap:null}),dd(e))}function dd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)VM(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let s=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof s=="number"&&Number.isFinite(s)&&VM(a,s)}let i=()=>{var s,l,d,c,f;let p=((s=a.initialScrollSession)==null?void 0:s.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;oo.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Ka(a),DR(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||ld(a)},hq,"preservedInitialScroll")):ld(a),t?.recalculateItems&&MR(e),kC(e,{didInitialScroll:!0}),p&&iq(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function gg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function vq(e){let{state:t}=e;return(t.props.horizontal?(qa(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:de(e,"stylePaddingTop")||0)+(de(e,"alignItemsAtEndPadding")||0)+(de(e,"headerSize")||0)}function Bt(e,t){let{data:n,keyExtractor:o}=e.props;if(!n)return"";let a=t<n.length?o?o(n[t],t):t:null;return e.idCache[t]=a,a}function xq(e){var t,n,o;let{state:r,values:a}=e;return(a.get("headerSize")||0)+(a.get("footerSize")||0)+((o=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:a.get("totalSize"))!=null?o:0)+(r.props.stylePaddingTop||0)+(r.props.stylePaddingBottom||0)}function yq(e){let{state:t}=e;return!!t.props.alignItemsAtEndPaddingEnabled&&!t.props.horizontal&&t.props.data.length>0&&t.scrollLength>0?Math.max(0,t.scrollLength-xq(e)-Ks(e)):0}function Gs(e){let t=de(e,"alignItemsAtEndPadding")||0,n=yq(e);t!==n&&Pe(e,"alignItemsAtEndPadding",n)}function Iu(e,t,n,o=!0){let r=e.state,a=r.totalSize,i=r.totalSize;t===null?(i=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):i+=n,a!==i?(r.pendingTotalSize=void 0,r.totalSize=i,o&&Pe(e,"totalSize",i),Gs(e)):o&&e.values.get("totalSize")!==i&&Pe(e,"totalSize",i)}function dC(e,t,n,o=!0){let r=e.state,{sizes:a}=r,i=a.get(t),s=i!==void 0?n-i:n;s!==0&&Iu(e,t,s,o),a.set(t,n)}function OR(e){return typeof e=="function"}function hg(e){return Array.isArray(e)}var GM=new Set;function Us(e,t){Vo&&!GM.has(e)&&(GM.add(e),console.warn(`[legend-list] ${t}`))}function Lu(e){return Math.floor(e*8)/8}function Su(e){return e==null}function jM(e,t){var n,o,r;let a=t==="Left"||t==="Right"?e.paddingHorizontal:e.paddingVertical;return(r=(o=(n=e[`padding${t}`])!=null?n:a)!=null?o:e.padding)!=null?r:0}function Cu(e,t,n){return jM(e,n)+jM(t,n)}function cC(e,t){var n,o;let r=(o=(n=e.state)==null?void 0:n.containerItemKeys)==null?void 0:o.get(t);if(r!==void 0)return r;let a=de(e,"numContainers");for(let i=0;i<a;i++)if(de(e,`containerItemKey${i}`)===t)return i;return-1}function FR(e,t,n,o,r){var a,i;let s=e.state,{getFixedItemSize:l,getItemType:d}=s.props,c=t?s.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(i=r?.itemType)!=null?i:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,s.sizesKnown.set(t,c))}return c}function BR(e,t){let n=Bt(e.state,t);return FR(e,n,t,e.state.props.data[t])}function Cq(e,t,n){for(let o=t;o<=n;o++)if(BR(e,o)===void 0)return!1;return!0}function mo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:h,props:{estimatedItemSize:g,getItemType:v},scrollingTo:x}=p,y=p.sizesKnown.get(t);if(y!==void 0)return y;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=FR(e,t,n,o,s),C!==void 0)return dC(e,t,C,i),C;let k=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!x){let S=(c=h[k])==null?void 0:c.avg;S!==void 0&&(C=Lu(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&x){let S=(f=x.averageSizeSnapshot)==null?void 0:f[k];S!==void 0&&(C=Lu(S))}return C===void 0&&(C=g+e.scrollAxisGap),dC(e,t,C,i),C}function PC(e,t){if(t===void 0||t<0)return;let n=Bt(e.state,t);return mo(e,n,t,e.state.props.data[t])}function vg(e,t,n){var o;let r=e.state,{index:a,viewOffset:i,viewPosition:s}=n,l=t;if(i&&(l-=i),a!==void 0){let d=vq(e);d&&(l+=d)}if(s!==void 0&&a!==void 0){let d=r.props.data.length;if(d===0)return l;let c=a<0||a>=d,f=(o=r.props.estimatedItemSize)!=null?o:0,p=c?f:mo(e,Bt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),h=Ks(e);if(l-=s*(r.scrollLength-h-m),!c&&a===r.props.data.length-1){let g=de(e,"footerSize")||0;l+=g}}return l}function Mi(e,t,n){let o=e.state,r=po(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&Ua.OS!=="android"){let i=Math.max(0,r-o.scrollLength),s=n?.viewOffset,l=typeof s=="number"&&s<0?-s:0,d=i+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function ku(e){var t,n;let o=e.state;if(o?.scrollingTo){fg(o);let r=o.pendingScrollResolve;o.pendingScrollResolve=void 0;let a=o.scrollingTo;if(o.scrollHistory.length=0,o.scrollingTo=void 0,o.scrollTargetPinnedRange=void 0,o.pendingTotalSize!==void 0&&Iu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let i=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",s=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;dd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}MR(e),r?.()}}var bq=80,Iq=1500,Sq=320,wq=1;function Tq(e,t){var n,o;let r=e.state,{animated:a,horizontal:i,offset:s}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!i,p=f?po(e):void 0,m=f?IC(r,s,p):0,h=f?0:s;if(l.scrollTo({animated:c,x:m,y:h}),c){let g=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;Lq(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&ku(e)},100,"platformScrollCompletion")}}function Lq(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){ku(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),Iq),f=()=>{o.removeEventListener("scroll",h),a&&o.removeEventListener("scrollend",g),i!==void 0&&clearTimeout(i),clearTimeout(c)},p=()=>{s||(s=!0,f())},m=v=>{if(s)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let x=n(),y=Math.abs(x-r)<=wq;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),ku(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),bq)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),Sq),l.register("platformScrollCompletion",p)}function cd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(de(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,po(e)<t.scrollLength&&(t.scroll=0),t.maintainingScrollAtEnd)t.pendingMaintainScrollAtEnd=!0;else{let d=a.animated?"pending-animated":"pending-instant",c=a.animated?"animated":"instant",f=t.scroll;t.maintainingScrollAtEnd=d,requestAnimationFrame(()=>{let p=de(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let h=r.current;if(t.props.horizontal&&qa(t)){let g=po(e),v=$K(t,g),x=IC(t,v,g);h?.scrollTo({animated:a.animated,x,y:0})}else h?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&cd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function js(e,t,n){let o=e.state;if(Math.abs(t)>.1){let r=()=>{o.scrollAdjustHandler.requestAdjust(t),o.adjustingFromInitialMount&&o.adjustingFromInitialMount--};o.scroll+=t,o.scrollForNextCalculateItemsInView=void 0,de(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Ao=.1,kq=300,Pq=2,Aq=1;function Eq(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,i=e.indexByKey.get(r.id)===void 0;if(a||i||!n){e.mvcpAnchorLock=void 0;return}return r}function Mq(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:i}=t,s=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!s||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(i)<=Ao&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=Pq){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+kq,id:n,position:o,quietPasses:c}}}function Rq(e,t,n,o,r,a){return!1}function Nq(e,t,n){if(Math.abs(t)<=Ao)return 0;let r=Math.max(0,n-e.scrollLength)-e.scroll;return t<0?Math.max(t,Math.min(0,r)):t>0?Math.min(t,Math.max(0,r)):0}function _q(e,t){return e<0?-t:t}function nC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Ao&&js(e,r)}function Dq(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Ao)return;let o=po(e),r=Nq(t,n.amount,o);if(Math.abs(r)<=Ao)return;let a=n.amount-r;Math.abs(a)<=Ao||(n.manualApplied=a,js(e,a),n.furthestProgressTowardAmount=0)}function Oq(e,t){let n=e.state,o=n.pendingNativeMVCPAdjust;if(!o)return!1;let r=o.amount-o.manualApplied,a=t-(o.startScroll+o.manualApplied),i=r<0&&a>Ao||r>0&&a<-Ao,s=_q(r,a);if(Math.abs(r)<=Ao)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Ao>=Math.abs(r))return nC(e,r,a),!0;let l=Math.max(0,po(e)-n.scrollLength);return Math.abs(t-l)<=Aq||n.pendingMaintainScrollAtEnd&&de(e,"isWithinMaintainScrollAtEndThreshold")&&s>Ao?(nC(e,r,a),!0):s>o.furthestProgressTowardAmount+Ao?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Ao&&s<o.furthestProgressTowardAmount-Ao&&(n.pendingNativeMVCPAdjust=void 0),!1)}function Fq(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:i,size:s,shouldRestorePosition:l}}=a,d=Date.now(),c=!!t||!!n.mvcpAnchorLock,f=n.scrollingTo;if(t&&n.pendingScrollToEnd&&f===void 0){n.mvcpAnchorLock=void 0;return}let p=Eq(n,c,i,d),m,h,g=[],v=f?.index,x=f?.viewPosition,y=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(x??0)>0,C=t?i:s,w=n.indexByKey,k=n.scroll;if(po(e),C){if(p&&v===void 0?(h=p.id,m=p.position):v!==void 0?h=Bt(n,v):o.length>0&&n.didContainersLayout&&!t&&(h=o.find(S=>w.get(S)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let S=0;S<o.length;S++){let L=o[S],I=w.get(L);if(I!==void 0){let T=r[I];T!==void 0&&g.push({id:L,position:T})}}if(h!==void 0&&m===void 0){let S=w.get(h);S!==void 0&&(m=r[S])}return()=>{let S=0,L=p?.id,I,T=!1,E=n.props.data;if(t&&i&&v===void 0&&h!==void 0&&p?.id===h&&l!==void 0&&h!==void 0){let R=w.get(h);if(R!==void 0){let $=E[R];T=$===void 0||!l($,R,E),T&&p?.id===h&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(h===void 0||T)return!0;let R=w.get(h);return R===void 0||r[R]===void 0})())for(let R=0;R<g.length;R++){let{id:$,position:H}=g[R],K=w.get($);if(K!==void 0&&l){let oe=E[K];if(oe===void 0||!l(oe,K,E))continue}let O=K!==void 0?r[K]:void 0;if(O!==void 0){S=O-H,L=$,I=O;break}}if(!T&&h!==void 0&&m!==void 0){let R=w.get(h),$=R!==void 0?r[R]:void 0;if($!==void 0){let H=po(e),K=$-m;if(K!==0&&y&&n.scroll+n.scrollLength>H)if(K>0)K=Math.max(0,H-n.scroll-n.scrollLength);else{let O=Math.max(0,H-n.scrollLength);n.scroll=O,n.scrollPending=O,K=0}S=K,L=h,I=$}}if(x&&x>0){let R=mo(e,h,v,n.props.data[v]),$=f?.itemSize;if(R!==void 0&&$!==void 0&&R!==$){let H=R-$;H!==0&&(S+=H*x,f.itemSize=R)}}if(Mq(n,{anchorId:L,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),Rq()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:k},Dq(e);return}Math.abs(S)>Ao&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&de(e,"isWithinMaintainScrollAtEndThreshold")||js(e,S))}}}var QM=1e3,Bq=200,xg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>QM)return 0;let r=0,a=0,i=0;for(let s=n;s>0;s--){let l=t[s],d=t[s-1],c=l.scroll-d.scroll,f=l.time-d.time,p=Math.sign(c);if(p!==0){if(r===0)r=p;else if(p!==r)break}if(o.time-d.time>QM)break;if(c===0||f<=0)continue;let m=o.time-l.time,h=Math.exp(-m/Bq);a+=c/f*h,i+=h}return i>0?a/i:0};function zq(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Ru(e){return e.dataChangeNeedsScrollUpdate||zq(e)}function qs(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:i,lastScrollAdjustForHistory:s,scrollAdjustHandler:l,scrollHistory:d,scrollingTo:c}=a,f=a.scroll;o?.markHasScrolled!==!1&&(a.hasScrolled=!0);let p=Date.now();a.lastBatchingAction=p;let m=l.getAdjust(),h=s!==void 0&&Math.abs(m-s)>.1;if(h&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(h||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:T,gt:E}=i;if(T&&t<T||E&&t>E){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let g=Math.abs(t-f),x=!!o?.fromNativeScrollEvent&&g>.1&&!h&&c===void 0&&!a.pendingNativeMVCPAdjust?cq(e,t-f):void 0,y=Oq(e,t),C=a.scrollLength,w=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,k=xg(a);gq(e,k,{forceLight:w});let S=a.scrollLastCalculate;if(Ru(a)||y||x!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=g;let T=()=>{var A;let N={doMVCP:c!==void 0,scrollVelocity:k};w&&(N.drawDistanceMode="visible-first"),(A=a.triggerCalculateItemsInView)==null||A.call(a,N),mg(e,x)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,yR.flushSync)(T),_R(e)):T();let E=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);y&&E&&(a.pendingMaintainScrollAtEnd=!1,cd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function $q(e){if(Object.keys(e.averageSizes).length===0)return;let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];t[n]=o.avg}return t}function Hq(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=oo.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&oo.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&oo.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,oo.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&oo.clear(e)}function Uq(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,i;for(;r<=a;){let s=Math.floor((r+a)/2),l=n.positions[s];l===void 0?a=s-1:l<=t?(i=s,r=s+1):a=s-1}return i}function XM(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=PC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function Kq(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),i=Math.max(a,t+o.scrollLength),s=n!==void 0?Math.max(0,Math.min(r-1,n)):Uq(e,a);if(s===void 0)return;if(n!==void 0&&o.positions[s]===void 0)return{end:s,start:s};if(n===void 0){let d=XM(e,s);if(d===void 0||d<=a)return}for(;s>0;){let d=o.positions[s];if(d===void 0||d<=a||o.positions[s-1]===void 0)break;s--}for(;s>0;){let d=XM(e,s-1);if(d===void 0||d<=a)break;s--}let l=s;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>i)break;l++}return{end:l,start:s}}function qq(e,t,n){let o=Kq(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function yg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:i,...s}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=s,{props:{horizontal:m}}=r;fg(r);let h=f?c:vg(e,c,s),g=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Mi(e,h,s),x=g?h:v;if(r.scrollHistory.length=0,!a){d&&pg.resetFlags(r);let y=$q(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||qq(e,v,s.index)}r.scrollPending=v,Hq(r,{isInitialScroll:d,requestedOffset:x,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):qs(e,v,!0,{markHasScrolled:!1})),i||!d||Ua.OS==="android"?Tq(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function zR(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function ng(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=zR(t,l.length);let d=PC(e,t),c=gg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,yg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Cg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?zR(i,e.state.props.data.length):void 0,l=PC(e,s);yg(e,{animated:!1,forceScroll:n,index:s!==void 0&&s>=0?s:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Vs(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&LC(e,{resetInitialScroll:!0}),Ka(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Fr(e,t){var n,o;if(((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset")return(o=t.contentOffset)!=null?o:0;let a=t.index!==void 0?gg(e,t.index):0,i=vg(e,a,t);return Mi(e,i,t)}function $R(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,i=!!r?.isInitialScroll,s=!!t?.requiresMeasuredLayout&&!o&&!i;if(!(!a||s||n||r&&!i))return{initialScroll:a,isInitialScrollInProgress:i,queuedInitialLayout:o,scrollingTo:r}}function Vq(e,t){var n,o,r;let a=e.state,i=$R(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Fr(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,h=p!==void 0&&Math.abs(p-f)>1,g=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!h||t?.forceScroll&&g)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Vs(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Cg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function Wq(e,t){var n,o;let r=e.state,a=$R(r);if(!a)return!1;let{initialScroll:i,queuedInitialLayout:s}=a,l=(n=i.contentOffset)!=null?n:0,d=Math.abs(r.scroll-l)<=1&&Math.abs(r.scrollPending-l)<=1;if(t?.forceScroll&&d)return!1;let c=!!r.lastLayout&&r.scrollLength>0,f=(o=t?.forceScroll)!=null?o:c||!!s;return Cg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Pu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?Wq(e,{forceScroll:t?.forceScroll}):Vq(e,{forceScroll:t?.forceScroll})}function wu(e,t,n){if(t==null||n==null||t<0||n<t)return!1;let o=!1;for(let r of e.containerItemKeys.keys()){let a=e.indexByKey.get(r);if(a!==void 0&&a>=t&&a<=n){o=!0;let i=Bt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var bg=1,Gq=8,jq=24,Qq="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function pr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function Qs(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function Xq(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yq(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:i}=e,s=o+a,l=[],d=i!==void 0?Math.max(0,Math.min(t-1,i)):0;for(;d>0;){let c=d-1,f=r[c];if(f===void 0){d=c;continue}let p=n(c);if(p===void 0){d=c;continue}if(f+p<=o)break;d=c}for(;d<t;d++){let c=r[d];if(c===void 0)continue;let f=n(d);if(f!==void 0){if(c<s&&c+f>o)l.push(d);else if(l.length>0&&c>=s)break}}return l}function Jq(e){let{mountFrameCount:t,maxFrames:n=Gq,maxPasses:o=jq,passCount:r}=e;return t>=n||r>=o}function HR(e,t){return Jq(t)?(Vo&&console.warn(Qq),uV(e),!0):!1}function Au(e){var t;let n=pr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Ka(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function UR(e,t){var n,o,r;let a=pr(e);Ka(e,{bootstrap:{frameHandle:a?.frameHandle,mountFrameCount:(n=a?.mountFrameCount)!=null?n:0,passCount:0,previousResolvedOffset:void 0,scroll:t.scroll,seedContentOffset:(r=(o=t.seedContentOffset)!=null?o:a?.seedContentOffset)!=null?r:t.scroll,targetIndexSeed:t.targetIndexSeed,visibleIndices:void 0},kind:"bootstrap"})}function Zq(e,t){var n,o,r;let a=pr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,Ka(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&UR(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function uC(e){requestAnimationFrame(()=>{var t;pr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function AC(e){let t=e.state,n=pr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=pr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!HR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&AC(e))};n.frameHandle=requestAnimationFrame(o)}function ig(e,t){Zq(e.state,t),AC(e),uC(e.state)}function EC(e){let{dataLength:t,footerSize:n,preserveForFooterLayout:o,stylePaddingEnd:r}=e;return{contentOffset:void 0,index:Math.max(0,t-1),preserveForBottomPadding:!0,preserveForFooterLayout:o,viewOffset:-r-n,viewPosition:1}}function eV(e){return!!e?.preserveForBottomPadding}function Ws(e){return!!e?.preserveForFooterLayout}function KR(e){return!!(e&&e.viewPosition===1&&(eV(e)||Ws(e)))}function tV(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=Ws(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:i,viewOffset:-r-(i?n:0),viewPosition:1}}function nV(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function sg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Ws(r))return;let a=EC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Vs(e,a)}function oV(e){ld(e)}function MC(e,t,n=bg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Eu(o);return Math.abs(r-Fr(e,t))>n}function Eu(e){var t,n,o,r;let a=(n=(t=e.refScroller.current)==null?void 0:t.getCurrentScrollOffset)==null?void 0:n.call(t);return typeof a=="number"&&Number.isFinite(a)?a:(r=(o=e.scrollPending)!=null?o:e.scroll)!=null?r:0}function qR(e){var t;let n=e.state,o=n.initialScroll;if(!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||!o||o.viewPosition!==1||n.props.data.length===0||Qs(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Eu(n);return Fr(e,o)-r}function VR(e){return qR(e)===void 0?!1:(WR(e,{}),!0)}function WR(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=qR(e);if(a===void 0||Math.abs(a)<=bg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),js(e,a)),WR(e,t)})}function rV(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||MC(e,o)&&(KR(o)&&de(e,"isAtEnd")||(Ws(o)?sg(e,{dataLength:n.props.data.length,stylePaddingEnd:bC(n.props),target:o}):oV(n)))}function aV(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Fr(e,i),d=l===0&&!a&&(Qs(s)?Math.abs((n=i.contentOffset)!=null?n:0)<=1:i.index===0&&((o=i.viewPosition)!=null?o:0)===0&&Math.abs((r=i.viewOffset)!=null?r:0)<=1),c=s.props.data.length===0&&i.index!==void 0;d?(Au(s),dd(e,{resolvedOffset:l})):c?(Au(s),dd(e,{preserveTarget:!0,resolvedOffset:l})):(UR(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),AC(e))}function iV(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(Qs(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=pr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){ld(s);return}let p=n>0&&(r||KR(l));if(!(!o&&!d&&!p)){if(p){let m=r?EC({dataLength:n,footerSize:de(e,"footerSize")||0,preserveForFooterLayout:Ws(l),stylePaddingEnd:i}):tV({dataLength:n,footerSize:de(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&MC(e,l)){sg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!nV(l,m)||c||d||o){Vs(e,m,{resetDidFinish:d}),ig(e,{scroll:Fr(e,m),seedContentOffset:d&&!c?Eu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Vs(e,l,{resetDidFinish:d}),ig(e,{scroll:Fr(e,l),seedContentOffset:d&&!c?Eu(s):void 0,targetIndexSeed:l.index}))}}function sV(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(Qs(i)||n===0||!s||!(pr(i)||Ws(s))))if(MC(e,s))sg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=EC({dataLength:n,footerSize:o,preserveForFooterLayout:Ws(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))sg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Vs(e,d,{resetDidFinish:f}),ig(e,{scroll:Fr(e,d),targetIndexSeed:d.index})}}}function lV(e){var t,n,o;let r=e.state,a=r.initialScroll,i=pr(r);if(a&&r.props.data.length>0&&!Qs(r)&&(i||a.viewPosition===1)){let s=Fr(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!i&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:Eu(r),c=s-d;if(Math.abs(c)>bg){if(r.didFinishInitialScroll)VR(e);else if(l){let f=oo.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,oo.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),js(e,c)}}}else ig(e,{scroll:s,targetIndexSeed:a.index})}}function dV(e){var t,n;let o=e.state,r=pr(o),a=o.initialScroll;if(!r||!a||Qs(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,HR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let i=Fr(e,a),s=wu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=Yq({dataLength:d.length,getSize:g=>{var v,x;let y=(v=o.idCache[g])!=null?v:Bt(o,g);return(x=o.sizes.get(y))!=null?x:mo(e,y,g,d[g])},offset:i,positions:o.positions,scrollLength:o.scrollLength,startIndex:(n=r.targetIndexSeed)!=null?n:o.startBuffered>=0?o.startBuffered:void 0}),f=c.length>0&&c.every(g=>{var v;let x=(v=o.idCache[g])!=null?v:Bt(o,g);return o.sizesKnown.has(x)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,uC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=bg&&Xq(m,c))){uC(o);return}Au(o),Cg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Ua.OS==="web"})}function cV(e,t){var n;let o=e.state;Au(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;dd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function uV(e){var t,n,o,r;let a=e.state,i=pr(a),s=a.initialScroll;i&&s&&!Qs(a)&&a.refScroller.current?(Au(a),Cg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Ua.OS==="web"})):cV(e,(r=(o=(n=(t=pr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function GR(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function fV(e,t,n,o){var r,a;let{getFixedItemSize:i,getItemType:s}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===s&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=s?(r=s(o,n))!=null?r:"":void 0;d=GR(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==i&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=i),i&&!d.didResolveFixedItemSize&&(d.fixedItemSize=i(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function jR(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var pV=20,mV=1,gV=1,oC=16;function RC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!NC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>CV(e),"checkFinishedScrollFrame")}function hV(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=mV}function vV(e,t){return!!t?.isInitialScroll&&pg.didDispatchNativeScroll(e)&&!e.hasScrolled}function QR(e){var t;return(t=oo.get(e))==null?void 0:t.targetOffset}function XR(e){let t=QR(e);return!e.didFinishInitialScroll&&oo.hasNonZeroTargetOffset(t)}function YM(e,t){var n,o;if(!t.isInitialScroll||t.animated||!e.didContainersLayout||((n=e.initialScrollSession)==null?void 0:n.kind)==="bootstrap")return!1;let r=(o=t.targetOffset)!=null?o:t.offset;return oo.hasNonZeroTargetOffset(r)&&pg.didDispatchNativeScroll(e)&&!e.hasScrolled||oo.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||XR(e)}function JM(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&po(e)<=n.scrollLength&&n.scrollPending<=gV}function xV(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function yV(e,t){var n;let o=t.index,a=xV(e,t)&&o!==void 0?vg(e,gg(e,o),t):(n=t.targetOffset)!=null?n:Mi(e,t.offset-(t.viewOffset||0),t);return Mi(e,a,t)}function NC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=yV(e,t),i=Mi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||Ua.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function CV(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=NC(e,t);o.isAtResolvedTarget&&hV(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&ku(e)}function bV(e,t){var n;(n=e.state.refScroller.current)==null||n.scrollTo({animated:!1,x:e.state.props.horizontal?t:0,y:e.state.props.horizontal?0:t})}function IV(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=JM(e),r=vV(t,n),a=n!==void 0?YM(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?oC:i?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let h=XR(t)&&!t.hasScrolled,g=r?5:h?pV:5,v=JM(e),x=YM(t,m),y=NC(e,m),C=Ua.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||y.isAtResolvedTarget),k=m.isInitialScroll&&!y.isAtResolvedTarget&&l<=g;if(v||w||x||C||l>g)ku(e);else if((h||k)&&l<=g){let S=(p=(f=QR(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;bV(e,S),d(r?oC:100)}else d(r?oC:100)}};d(s)}function YR(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?VR(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Pu(e,{forceScroll:!0})}function SV(e){var t;if(!e.state.initialScroll)return;let n=()=>Pu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),RC(e,{onlyIfAligned:!0})}function wV(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:i,initialContentOffset:s,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=s??0,m=d&&l&&i;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Vs(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){aV(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?dd(e,{resolvedOffset:p}):kC(e,{didInitialScroll:!0}))}function TV(e,t){var n,o,r;let{dataLength:a,didDataChange:i,didStartFreshData:s,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,h=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,g=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),g&&(d?(Vs(e,d),Ka(m,{kind:c,previousDataLength:h})):ld(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Ka(m),p){iV(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:h,stylePaddingEnd:f});return}let v=h===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;h!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&LC(e,{resetInitialScroll:!0}),Pu(e))}function JR(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function LV(e){var t;let n=e.pendingContainerIds;if(e.pendingContainerIds=void 0,n===void 0)return;let o=e.state,r=n;if(r&&((t=o.userScrollAnchorReset)!=null&&t.keys.size)){r=new Set(r);for(let a of o.userScrollAnchorReset.keys){let i=o.containerItemKeys.get(a);i!==void 0&&r.add(i)}}return r}function lg(e,t){var n;let o=e.pendingContainerIds!==void 0,r=e.pendingContainerIds;if(t===void 0)e.pendingContainerIds=null;else if(r!==null){let a=r;if(!a)a=typeof t=="number"?new Set([t]):new Set(t);else if(typeof t=="number")a.add(t);else for(let i of t)a.add(i);e.pendingContainerIds=a}if(!o){let a=((n=de(e,"containerLayoutEpoch"))!=null?n:0)+1;Pe(e,"containerLayoutEpoch",a)}}function kV(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:h,columnSpans:g,positions:v,props:{data:x,itemsAreEqual:y,keyExtractor:C}}=m,w=x[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let k=(r=m.idCache[n])!=null?r:Bt(m,n),S=(a=o?.updateLayout)!=null?a:!0,L=!1,I=!1;if(S){let N=v[n];if(N===void 0)return Pe(e,`containerPosition${t}`,sd),{didChangePosition:!1,didRefreshData:!1};let R=(N||0)-((i=o?.scrollAdjustPending)!=null?i:0),$=(s=m.sizes.get(k))!=null?s:mo(e,k,n,w),H=HK(m,R,$,de(e,"totalSize")),K=h[n]||1,O=g[n]||1,oe=de(e,`containerPosition${t}`),ee=de(e,`containerColumn${t}`),W=de(e,`containerSpan${t}`);H>sd&&H!==oe&&(Pe(e,`containerPosition${t}`,H),L=!0),K>=0&&K!==ee&&Pe(e,`containerColumn${t}`,K),O!==W&&Pe(e,`containerSpan${t}`,O)}de(e,`containerItemIndex${t}`)!==n&&Pe(e,`containerItemIndex${t}`,n);let E=de(e,`containerItemData${t}`),A=()=>{Pe(e,`containerItemData${t}`,w),I=!0};if(E!==w){let N=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===x?m.pendingDataComparison:void 0,R=(c=N?.byIndex[n])!=null?c:0;if(R===2)A();else if(R!==1){let $=(f=de(e,`containerItemKey${t}`))!=null?f:k,H=C?.(E,n);if(E===void 0||!C||H!==$)A();else if(!y)A();else{let K=y(E,w,n,x);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==x)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:x,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=K?1:2),K||A()}}}return{didChangePosition:L,didRefreshData:I}}function PV(e,t,n){var o;let r=e.state,a=de(e,"numColumns"),i=t;r.columns[t]!==1&&(i=ZM(r,a,t));let l=0,d=r.columns[i];if(i>0){let c=i-1,f=(o=r.positions[c])!=null?o:0,p=ZM(r,a,c),m=AV(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function ZM(e,t,n){if(t<=1)return Math.max(0,n);let o=Math.max(0,n);for(;o>0&&e.columns[o]!==1;)o--;return o}function AV(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let i=0;for(let s=t;s<=n;s++){if(s<0||s>=a.length)continue;let l=r.idCache[s],d=mo(e,l,s,a[s],o);d>i&&(i=d)}return i}function EV(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=de(e,"numColumns"))!=null?t:1;if(a.length===0)Iu(e,null,0);else{let s=a.length-1,l=Bt(o,s),d=r[s];if(l!==void 0&&d!==void 0)if(i>1){let c=s;for(;c>0;){let p=o.columns[c];if(p===1||p===void 0)break;c-=1}let f=0;for(let p=c;p<=s;p++){let m=(n=o.idCache[p])!=null?n:Bt(o,p),h=mo(e,m,p,a[p]);h>f&&(f=h)}Iu(e,null,d+f)}else{let c=mo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Iu(e,null,f)}}}}function ZR(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?po(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Bt(t,i);let s=t.positions[i];r[a]=IC(t,s,o)}Pe(e,"snapToOffsets",r)}function eN(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:i,startIndex:s}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,h=e.positionListeners.size>0,{columns:g,columnSpans:v,indexByKey:x,positions:y,idCache:C,sizesKnown:w,props:{data:k,overrideItemLayout:S,snapToIndices:L},scrollingTo:I}=m,T=k.length,E=(l=de(e,"numColumns"))!=null?l:1,A=E>1,N=Vo?new Map:void 0,R=de(e,"extraData"),$=S?{span:1}:void 0,H=m.lastScrollDelta,K=i??xg(m),O=!o&&!t&&(r||Math.abs(K)>0||m.scrollLength>0&&H>m.scrollLength),oe=a+1e3,ee=!0,W=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=de(e,"scrollAdjustPending"))!=null?d:0)!==0,qe=!1,ve=0,fe=1,Ne=0;if(t&&(v.length=0),A||(g.length&&(g.length=0),v.length&&(v.length=0)),s>0){if(A){let{startIndex:re,currentRowTop:Ie}=PV(e,s,ee);s=re,ve=Ie}else if(s<T){let re=s-1,Ie=Bt(m,re),st=(c=y[re])!=null?c:0,dt=(f=w.get(Ie))!=null?f:mo(e,Ie,re,k[re],ee,W,qe);ve=st+dt}}let Ae=t||x.size===0,ae=A&&!!S&&!!$,Ee=!1,xe;for(let re=s;re<T;re++){if(O&&xe!==void 0&&re>xe){Ee=!0;break}O&&xe===void 0&&!I&&!t&&ve>oe&&(xe=re+(A?E:1)+10);let Ie=(p=C[re])!=null?p:Bt(m,re),st=1;if(ae){$.span=1,S($,k[re],re,E,R);let ct=$.span;ct!==void 0&&Number.isFinite(ct)&&(st=Math.max(1,Math.min(E,Math.round(ct))))}A&&fe+st-1>E&&(ve+=Ne,fe=1,Ne=0);let dt=w.get(Ie),lt=dt!==void 0?dt:mo(e,Ie,re,k[re],ee,W,qe);Vo&&Ae&&(N.has(Ie)&&console.error(`[legend-list] Error: Detected overlapping key (${Ie}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),N.set(Ie,re)),ve!==y[re]&&(y[re]=ve,h&&QK(e,Ie,ve)),Ae&&x.set(Ie,re),A?(g[re]=fe,v[re]=st,lt>Ne&&(Ne=lt),fe+=st,fe>E&&(ve+=Ne,fe=1,Ne=0)):ve+=lt}Ee||EV(e),L&&ZR(e)}function tN(e,t){let n=e.mapViewabilityConfigStates;n||(n=new Map,e.mapViewabilityConfigStates=n);let o=n.get(t);return o||(o={end:-1,endBuffered:-1,previousEnd:-1,previousStart:-1,start:-1,startBuffered:-1,viewableItems:[]},n.set(t,o)),o}function MV(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function nN(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=tN(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>eR(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):eR(l,d,e,t,o)}}function eR(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=tN(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)oN(n,o,a,y,C.key,r,C.item,C.index).sizeVisible<0&&(h??(h=[]),h.push(y));let g=[],v=new Set;if(d)for(let y of d){v.add(y.key);let C=n.indexByKey.get(y.key),w=C!==void 0?e[C]:void 0,k=cC(o,y.key),S=!1;C!==void 0&&w!==void 0&&(S=nR(n,o,a,k,y.key,r,w,C)),S||g.push({...y,index:C??y.index,isViewable:!1,item:w??y.item})}let x=[];for(let y=c;y<=f;y++){let C=e[y];if(C){let w=Bt(n,y),k=cC(o,w);if(nR(n,o,a,k,w,r,C,y)){let S={containerId:k,index:y,isViewable:!0,item:C,key:w};x.push(S),v.has(S.key)||g.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:x}),g.length>0){l.viewableItems=x;for(let y=0;y<g.length;y++){let C=g[y];RV(o,s,C.containerId,C)}i&&i({changed:g,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:x})}if(h)for(let y of h){let C=o.mapViewabilityAmountValues.get(y);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(y)}}function tR(e,t){return!!e&&e.containerId===t.containerId&&e.index===t.index&&e.isViewable===t.isViewable&&e.item===t.item&&e.key===t.key&&e.percentOfScroller===t.percentOfScroller&&e.percentVisible===t.percentVisible&&e.scrollSize===t.scrollSize&&e.size===t.size&&e.sizeVisible===t.sizeVisible}function oN(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(de(t,"stylePaddingTop")||0)+(de(t,"alignItemsAtEndPadding")||0)+(de(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,h=m?p:f,g=d-c,v=e.positions[s],x=l.get(r)||0;if(v===void 0){let N={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:x,sizeVisible:-1},R=t.mapViewabilityAmountValues.get(o);if(!tR(R,N)){t.mapViewabilityAmountValues.set(o,N);let $=t.mapViewabilityAmountCallbacks.get(o);$&&$(N)}return N}let y=v-g,C=y+x,w=y>=0&&C<=a&&C>y,k=w?x:Math.min(C,a)-Math.max(y,0),S=x?w?100:100*(k/x):0,L=x?100*(k/a):0,T=(w?100:m?L:S)>=h,E={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:L,percentVisible:S,scrollSize:a,size:x,sizeVisible:k},A=t.mapViewabilityAmountValues.get(o);if(!tR(A,E)){t.mapViewabilityAmountValues.set(o,E);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(E)}return E}function nR(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=oN(e,t,n,o,r,a,i,s)),l.isViewable}function RV(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var oR=xR.unstable_batchedUpdates,NV=typeof oR=="function"?oR:e=>e(),_V=32,DV=64,OV=3;function FV(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*OV),o=t+DV,r=Math.max(t,Math.min(n,o),Math.min(e,_V)),a=Math.max(e,t);return Math.min(a,r)}function BV(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function zV(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=de(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,h=r.length>0?new Set(r):void 0,g=t.map((E,A)=>({isSticky:c.props.stickyHeaderIndicesSet.has(E),itemIndex:E,itemType:a?.(E),order:A})),v=g.filter(E=>!E.isSticky),x=g.filter(E=>E.isSticky),y=[],C=[];for(let E=0;E<d;E++){let A=de(e,`containerItemKey${E}`),N=!!h?.has(E);if(!(A&&i?.has(A)&&c.indexByKey.has(A))){if(p.has(E))(A===void 0||N)&&C.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(A===void 0||N)y.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(!m){let $=c.indexByKey.get(A);if($!==void 0&&($<n||$>o)){let H=$<n?n-$:$-o;y.push({containerIndex:E,distance:H})}}}}y.sort($V);let w=new Array(l),k=d,S=!1,L=(E,A)=>{w[E.order]={containerIndex:A,itemIndex:E.itemIndex,itemType:E.itemType},h?.delete(A)&&(S=!0)},I=(E,A,N)=>{for(let R of E){if(w[R.order])continue;let $=A.findIndex(H=>{var K;return N((K=f.get(H.containerIndex))==null?void 0:K.itemType,R.itemType)});if($!==-1){let[H]=A.splice($,1);L(R,H.containerIndex)}}},T=(E,A,N)=>{a&&I(E,A,(R,$)=>$!==void 0&&R===$),I(E,A,R=>R===void 0),N&&I(E,A,()=>!0)};T(v,y,!0),T(x,C,!1);for(let E of g){if(w[E.order])continue;let A=k++;E.isSticky&&p.add(A),L(E,A)}if(S&&(r.length=0,h))for(let E of h)r.push(E);if(Vo){let E=(s=de(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;k>E&&console.warn("[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",{debugInfo:{numContainers:d,numContainersPooled:E,numNeeded:l,stillNeeded:k-d}})}return w}function $V(e,t){return t.distance-e.distance}function HV(e){let t=e.state;t.queuedInitialLayout=!0,ER(e),kC(e,{didLayout:!0})}var UV=4,KV=100;function qV(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/UV);return Math.sign(e)*t*n}function VV(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},KV,"renderRangeProjection")}function WV(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],i=o[a];if(i!==void 0&&t>=i)return r}return-1}function GV(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=de(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function jV(e,t,n,o,r,a,i){var s;let l=e.state;Pe(e,"activeStickyIndex",n>=0?t[n]:-1);for(let d=0;d<=1;d++){let c=n-d;if(c<0)continue;let f=t[c];if(GV(e,f))continue;let p=(s=l.idCache[f])!=null?s:Bt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function QV(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=de(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||i(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Pe(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let g=t[m+1],v=!1;if(g){let x=d.positions[g];v=x!==void 0&&n>x+o*2}else{let x=(s=d.idCache[p])!=null?s:Bt(d,p);if(x){let y=d.positions[p],C=(l=d.sizes.get(x))!=null?l:mo(e,x,p,d.props.data[p]);v=y!==void 0&&n>y+C+o*3}}v&&a.push(c)}}function rN(e,t,n,o,r,a){let i=!1;return e.startNoBuffer===null&&n+o>r&&(e.startNoBuffer=t),e.firstFullyOnScreenIndex===void 0&&n>=r-10&&n<=a&&(e.firstFullyOnScreenIndex=t),e.startNoBuffer!==null&&(n<=a?e.endNoBuffer=t:i=!0),i}function aN(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let i=a;i<=t.endNoBuffer;i++){let s=(o=e.idCache[i])!=null?o:Bt(e,i);r.push(s)}return r}function fC(e,t){var n;let o=e.props.onFirstVisibleItemChanged;if(!o||t===null||t<0||t>=e.props.data.length)return;let r=(n=e.idCache[t])!=null?n:Bt(e,t),a=e.lastFirstVisibleItemCallback;a?.index===t&&a.key===r||(e.lastFirstVisibleItemCallback={index:t,key:r},o({index:t,item:e.props.data[t],key:r}))}function XV(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:i,positions:s,props:{data:l},sizes:d,startBuffered:c}=r;if(c===null||a===null||c<0||a<c)return null;for(let f=c;f<=a&&f<l.length;f++){let p=(n=i[f])!=null?n:Bt(r,f),m=(o=d.get(p))!=null?o:mo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function YV(e,t,n,o,r){var a,i;let s=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=s;if(m===null||l===null||m<0||l<m)return;let h={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let g=m;g<=l&&g<f.length;g++){let v=(a=d[g])!=null?a:Bt(s,g),x=(i=p.get(v))!=null?i:mo(e,v,g,f[g]),y=c[g];if(rN(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:aN(s,h),startNoBuffer:h.startNoBuffer}),fC(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&nN(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function Ha(e,t={}){let n=e.state;NV(()=>{var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k,S,L;let{columns:I,containerItemKeys:T,enableScrollForNextCalculateItemsInView:E,idCache:A,indexByKey:N,minIndexSizeChanged:R,positions:$,props:{alwaysRenderIndicesArr:H,alwaysRenderIndicesSet:K,getItemType:O,keyExtractor:oe,onStickyHeaderChange:ee},scrollForNextCalculateItemsInView:W,scrollLength:qe,sizes:ve,startBufferedId:fe,viewabilityConfigCallbackPairs:Ne}=n,{data:Ae}=n.props,ae=n.props.stickyHeaderIndicesArr||[],Ee=n.props.stickyHeaderIndicesSet||new Set,xe=NR(e,t.drawDistanceMode),{dataChanged:re,doMVCP:Ie,forceFullItemPositions:st}=t,dt=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,lt=!!dt,ct=de(e,"numContainers");if(!Ae||qe===0||!ct)return;let Et=po(e),ot,He=de(e,"stylePaddingTop")+de(e,"alignItemsAtEndPadding")+de(e,"headerSize"),Se=de(e,"numColumns"),ze=(r=t.scrollVelocity)!=null?r:xg(n),Je=0,{initialScroll:qt,queuedInitialLayout:X}=n,nn=lt?(a=dt?.scroll)!=null?a:n.scroll:!X&&bu(n)&&qt?Fr(e,qt):n.scroll,xt=0,mn=0,Tt=0,Yt=0,Jt=0,Mt=0,zn=nn,kn=ne=>{var Fe;zn=ne,xt=(Fe=de(e,"scrollAdjustPending"))!=null?Fe:0,mn=xt-He,Tt=Math.round(ne+Je+mn),Tt+qe>Et&&(Tt=Math.max(0,Et-qe))};kn(nn);let vn=de(e,"activeStickyIndex"),$n=()=>{let ne=ae.length>0?WV(ae,Tt,n):-1,Fe=ne>=0?ae[ne]:-1,at=vn!==Fe;(ne>=0||vn>=0)&&Pe(e,"activeStickyIndex",Fe);let je=!!ee&&ae.length>0&&at;return{currentStickyIdx:ne,finishCalculateItemsInView:je?()=>{let wn=Ae[Fe];wn!==void 0&&ee?.({index:Fe,item:wn})}:void 0}},Vt=re?void 0:$n(),Zt=xe,Sn=xe;ze>0||ze===0&&Tt<Math.max(50,xe)?(Zt=xe*.5,Sn=xe*1.5):(Zt=xe*1.5,Sn=xe*.5);let zt=!re&&!st&&!lt&&!bu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!de(e,"readyToRender")?qV(ze,Math.min(Zt,Sn)):0,D=()=>{let ne=Math.max(0,Tt),Fe=Math.max(0,-zn);Jt=Math.max(ne,Tt+qe+Fe),Yt=ne-Zt+zt,Mt=Jt+Sn+zt};if(D(),zt!==0&&VV(e),E&&!lt&&!re&&!st&&W){let{top:ne,bottom:Fe}=W;if(ne===null&&Fe===null)n.scrollForNextCalculateItemsInView=void 0;else if((ne===null||Yt>ne)&&(Fe===null||Mt<Fe)&&!Ru(n)){Ne?YV(e,Ne,qe,Tt,Jt):n.props.onFirstVisibleItemChanged&&fC(n,XV(e,Tt)),(i=Vt?.finishCalculateItemsInView)==null||i.call(Vt);return}}let Y=Ie&&!lt?Fq(e,re):void 0;re&&JR(n);let ce=st||re?0:(s=R??n.startBuffered)!=null?s:0,ie=!st&&!re&&Se>1&&R!==void 0;eN(e,re,{doMVCP:Ie,forceFullUpdate:!!st,optimizeForVisibleWindow:ie,scrollBottomBuffered:Mt,scrollVelocity:ze,startIndex:ce}),Et=po(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let pe;if(re&&Ie&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let ne=n.props.maintainVisibleContentPosition.shouldRestorePosition;pe=new Set;for(let Fe of n.idsInView){let at=N.get(Fe);at!==void 0&&(ne&&!ne(Ae[at],at,Ae)||pe.add(Fe))}}let Ze=n.scroll,pt=(l=de(e,"scrollAdjustPending"))!=null?l:0;Y?.(),Y&&(n.scroll!==Ze||((d=de(e,"scrollAdjustPending"))!=null?d:0)!==pt)&&(kn(n.scroll),D()),re&&(Vt=$n());let ht=null,en=null,tn=null,bt=(c=lt?dt?.targetIndexSeed:void 0)!=null?c:!re&&fe&&N.get(fe)||0;for(let ne=bt;ne>=0;ne--){let Fe=(f=A[ne])!=null?f:Bt(n,ne),at=$[ne],je=(p=ve.get(Fe))!=null?p:mo(e,Fe,ne,Ae[ne]);if(at+je>Yt)bt=ne;else break}if(Se>1)for(;bt>0;){let ne=I[bt];if(ne===1||ne===void 0)break;bt-=1}let yn=!1,sn,ge,Rt=0;for(let ne=0;ne<ct;ne++){let Fe=de(e,`containerItemKey${ne}`);if(Fe!==void 0){let at=N.get(Fe);Rt=Math.max(Rt,at)}}let rt={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},Lt=Ae.length;for(let ne=Math.max(0,bt);ne<Lt&&(!yn||ne<=Rt);ne++){let Fe=(m=A[ne])!=null?m:Bt(n,ne),at=(h=ve.get(Fe))!=null?h:mo(e,Fe,ne,Ae[ne]),je=$[ne];yn||(rN(rt,ne,je,at,Tt,Jt),ht===null&&je+at>Yt&&(ht=ne,en=Fe,Yt<0?sn=null:sn=je),rt.startNoBuffer!==null&&(je<=Mt?(tn=ne,Mt>Et?ge=null:ge=je+at):yn=!0))}Object.assign(n,{endBuffered:tn,endNoBuffer:rt.endNoBuffer,firstFullyOnScreenIndex:rt.firstFullyOnScreenIndex,idsInView:aN(n,rt),startBuffered:ht,startBufferedId:en,startNoBuffer:rt.startNoBuffer}),E&&sn!==void 0&&ge!==void 0&&(n.scrollForNextCalculateItemsInView=Su(sn)&&Su(ge)?void 0:{bottom:ge,top:sn});let et=ct,Nt=[];if(re)for(let ne=0;ne<et;ne++){let Fe=de(e,`containerItemKey${ne}`);(!oe||Fe&&N.get(Fe)===void 0)&&Nt.push(ne)}let ut=n.scrollTargetPinnedRange,ft=0,eo=-1;ut&&(ft=Math.max(0,Math.min(ut.start,ut.end)),eo=Math.min(Lt-1,Math.max(ut.start,ut.end)));let ln=ft<=eo,Nn=ne=>K.has(ne)||ln&&ne>=ft&&ne<=eo;if(ht!==null&&tn!==null){let ne=[],Fe=new Set,at=je=>{var wn;if(je>=0&&je<Lt){let dn=(wn=A[je])!=null?wn:Bt(n,je),Cn=T.get(dn);Cn!==void 0?n.stickyContainerPool.add(Cn):!Su(dn)&&!Fe.has(je)&&(Fe.add(je),ne.push(je))}};for(let je=ht;je<=tn;je++){let wn=(g=A[je])!=null?g:Bt(n,je);T.has(wn)||(Fe.add(je),ne.push(je))}for(let je of H)at(je);if(ln)for(let je=ft;je<=eo;je++)at(je);if(ae.length>0?jV(e,ae,(v=Vt?.currentStickyIdx)!=null?v:-1,ne,Fe,ht,tn):vn!==-1&&Pe(e,"activeStickyIndex",-1),ne.length>0){let wn=zV(e,ne,ht,tn,Nt,O?dn=>{let Cn=O(Ae[dn],dn);return Cn!==void 0?String(Cn):""}:void 0,pe);for(let dn of wn){let Cn=dn.itemIndex,$t=dn.containerIndex,Kn=(x=A[Cn])!=null?x:Bt(n,Cn),Wt=de(e,`containerItemKey${$t}`);Wt&&Wt!==Kn&&T.delete(Wt),Wt!==Kn&&(ot??(ot=new Set),ot.add($t),n.containerItemGenerations[$t]=((y=n.containerItemGenerations[$t])!=null?y:0)+1),Pe(e,`containerItemKey${$t}`,Kn),Pe(e,`containerItemIndex${$t}`,Cn),Pe(e,`containerItemData${$t}`,Ae[Cn]),n.containerItemMetadata.set($t,GR(n,Cn,Ae[Cn],dn.itemType)),T.set(Kn,$t),(C=n.userScrollAnchorReset)==null||C.keys.add(Kn);let vo=`containerSticky${$t}`,Wa=Ee.has(Cn),Ga=Nn(Cn);Wa?(Pe(e,vo,!0),n.stickyContainerPool.add($t)):(de(e,vo)&&Pe(e,vo,!1),Ga?n.stickyContainerPool.add($t):n.stickyContainerPool.delete($t)),$t>=et&&(et=$t+1)}et!==ct&&(Pe(e,"numContainers",et),et>de(e,"numContainersPooled")&&Pe(e,"numContainersPooled",BV(Lt,et)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&QV(e,ae,Tt,xe,(k=Vt?.currentStickyIdx)!=null?k:-1,Nt,Nn);let Hn=Nt.length>0?new Set(Nt):void 0,Un=!1;for(let ne=0;ne<et;ne++){let Fe=de(e,`containerItemKey${ne}`);if(Hn?.has(ne))Fe!==void 0&&(T.delete(Fe),ot??(ot=new Set),ot.add(ne),n.containerItemGenerations[ne]=((S=n.containerItemGenerations[ne])!=null?S:0)+1),n.containerItemMetadata.delete(ne),n.stickyContainerPool.has(ne)&&(Pe(e,`containerSticky${ne}`,!1),n.stickyContainerPool.delete(ne)),Pe(e,`containerItemKey${ne}`,void 0),Pe(e,`containerItemIndex${ne}`,void 0),Pe(e,`containerItemData${ne}`,void 0),Pe(e,`containerPosition${ne}`,sd),Pe(e,`containerColumn${ne}`,-1),Pe(e,`containerSpan${ne}`,1);else{let at=N.get(Fe);at!==void 0&&(Un=kV(e,ne,at,{scrollAdjustPending:xt,updateLayout:!0}).didChangePosition||Un)}}if(ot&&SC&&lg(e,ot),Un&&Pe(e,"lastPositionUpdate",Date.now()),lt){dV(e);return}fC(n,rt.startNoBuffer),!X&&!n.didContainersLayout&&(bu(n)?wu(n,n.startBuffered,n.endBuffered):wu(n,n.startNoBuffer,n.endNoBuffer)||wu(n,n.startBuffered,n.endBuffered))&&(HV(e),SV(e)),Ne&&rt.startNoBuffer!==null&&rt.endNoBuffer!==null&&nN(e.state,e,Ne,qe,rt.startNoBuffer,rt.endNoBuffer,ht??rt.startNoBuffer,tn??rt.endNoBuffer),(L=Vt?.finishCalculateItemsInView)==null||L.call(Vt)})}function dg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=de(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:g,anchorMaxSize:v,anchorOffset:x=0}=r,{data:y}=o.props;if(g>=0&&g<y.length&&o.scrollLength>0){d=Bt(o,g);let C=0,w=!1;for(let S=g;S<y.length;S++){let L=BR(e,S),I=S===g&&v!==void 0?Math.min(L||0,Math.max(0,v)):L;L===void 0&&(w=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+bC(o.props),c=!w;let k=Math.max(0,o.scrollLength-C-x);f=w?Math.min(a||0,k):k}else g>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(i!==l||s!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Gs(e),qs(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&qs(e,o.scroll,!0,{markHasScrolled:!1})),f}function JV(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(Ha(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>Ha(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),Ha(e,{doMVCP:!0}))}function rR(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=de(e,"otherAxisSize");(!a||r>a)&&Pe(e,"otherAxisSize",r)}}var za;function iN(e){let t=za===void 0;za??(za=new Map);try{e()}finally{if(t){let n=za;za=void 0;for(let[o,r]of n)_C(o,r)}}}function ZV(e,t){e.didChange||(e.didChange=t.didChange),e.didMeasureUserScrollAnchorResetItem||(e.didMeasureUserScrollAnchorResetItem=t.didMeasureUserScrollAnchorResetItem),e.needsRecalculate||(e.needsRecalculate=t.needsRecalculate),e.shouldMaintainScrollAtEnd||(e.shouldMaintainScrollAtEnd=t.shouldMaintainScrollAtEnd)}function e4(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,JV(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&dg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&cd(e)}function sN(e,t){if(za){let n=za.get(e);n?n.push(t):za.set(e,[t])}else _C(e,[t])}function _C(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||de(e,`containerItemKey${a.containerId}`)===a.itemKey){let s=o.indexByKey.get(a.itemKey),l=s===void 0||(n=o.props.data)==null?void 0:n[s],d=a.containerId!==void 0&&s!==void 0&&l!==void 0?fV(o,a.containerId,s,l):void 0,c=t4(e,a.itemKey,a.size,d);ZV(r,c)}e4(e,r)}function t4(e,t,n,o){var r,a;let i=e.state,s=i.userScrollAnchorReset,l=!!s?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:h,data:g,maintainScrollAtEnd:v}}=i;if(!g)return{didMeasureUserScrollAnchorResetItem:l};let x=i.indexByKey.get(t);if(f){if(x===void 0)return{didMeasureUserScrollAnchorResetItem:l};let I=i.props.data[x];if(I===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let E=(a=o?.itemType)!=null?a:p&&(r=p(I,x))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,x,E),itemType:E}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return rR(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,w,k=i.sizesKnown.get(t),S=n4(e,t,n,o),L=Lu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,x):x;let{startBuffered:I,endBuffered:T}=i;y||(y=x>=I&&x<=T),!y&&i.containerItemKeys.has(t)&&(y=!0),(k===void 0||Math.abs(k-L)>5)&&(C=!0),h?.({index:x,itemData:i.props.data[x],itemKey:t,previous:L-S,size:L})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),rR(e,n,m),d||wu(i,i.startBuffered,i.endBuffered)){let I=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:y,shouldMaintainScrollAtEnd:I}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function n4(e,t,n,o){var r,a;let i=e.state,{indexByKey:s,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=i;if(!c)return 0;let h=s.get(t),g=c[h],v=o?.itemType,x=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(g,h))!=null?r:"",x=m(g,h,v));let y=o?.didResolveFixedItemSize||v!==void 0||x!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:x,itemType:v}:void 0,C=mo(e,t,h,g,void 0,void 0,void 0,y),w=f?n.width:n.height,k=l.get(t),S=Math.round(w);if(l.set(t,S),x===void 0&&S>0){v??(v=p&&(a=p(g,h))!=null?a:"");let L=d[v];L||(L=d[v]={avg:0,num:0}),L.num===0?(L.avg=S,L.num++):k!==void 0&&k>0?L.avg+=(S-k)/L.num:(L.avg=(L.avg*L.num+S)/(L.num+1),L.num++)}return!C||Math.abs(C-S)>.1?(dC(e,t,S),S-C):0}function o4(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=de(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();eq(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&_C(e,n)}var lN=Wn,la=ue,r4=la(function({children:t}){let n=Br(),[o]=Wo(["containerLayoutEpoch"]);return ye(()=>{{let r=LV(n);r!==void 0&&o4(n,r)}},[n,o]),t}),og=e=>sh(e)?e:e?Te(e,null):null,a4=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),pC={contain:"paint layout style",...a4?{display:"flex",flexDirection:"column"}:{}},i4=la(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=sd]=Wo([`containerPosition${t}`]),s=hg(o)?Object.assign({},...o):o,l=n?{...pC,...s,left:i}:{...pC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Te("div",{ref:r,...m,style:l})}),s4=la(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=sd,p,m]=Wo([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),h=z(()=>{var x;return(x=hg(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=z(()=>{var x;let y={...pC,...h};delete y.transform;let C=(x=i?.offset)!=null?x:0,w=p===m;return y.position=w?"sticky":"absolute",y.zIndex=m+1e3,n?y.left=w?C:f:y.top=w?C:f,y},[h,n,f,m,p,i?.offset]),v=z(()=>i?.backdropComponent?Te("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},og(i.backdropComponent)):null,[i?.backdropComponent]);return Te("div",{ref:r,style:g,...c},v,d)}),l4=i4;function d4(e){G(()=>e())}var dN=Ht(null),c4=-1;function u4(){return fn(dN)}function f4(){var e;let t=u4(),n=(e=t?.containerId)!=null?e:c4,[o]=Wo([`containerItemKey${n}`]);return XK("lastItemKeys",a=>t&&!Su(o)&&a?.includes(o)||!1)}function p4({ItemSeparatorComponent:e,leadingItem:t}){return f4()?null:Te(e,{leadingItem:t})}var rC=null;function m4(){return rC||(rC=new ResizeObserver(e=>{iN(()=>{for(let t of e){let n=rg.get(t.target);if(n)for(let o of n)o(t)}})})),rC}var rg=new WeakMap;function g4(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=m4(),r=(n=rg.get(e))!=null?n:new Set;return r.size===0&&(rg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(rg.delete(e),o.unobserve(e))}}function DC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return ye(()=>{var i,s;let l=e.current,c=((s=(i=l?.getScrollableNode)==null?void 0:i.call(l))!=null?s:null)||l;if(!c)return;let f=(m,h)=>{m.height===0&&m.width===0||(o(m,h),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(aR(m),!0),p=m}return g4(c,m=>{var h;let g=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,x=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(h=g?.getBoundingClientRect())!=null?h:m.contentRect,y=p??ZK(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let w=!!r?.();(C||w)&&f(aR(x),!1)})},[t,...a||[]]),{}}function aR(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var ag=new Map,aC;function cN(e){ag.delete(e)}function h4(e,t){ag.set(e,t),aC===void 0&&(aC=requestAnimationFrame(()=>{let n=Array.from(ag.values());ag.clear(),aC=void 0,iN(()=>{for(let o of n)o()})}))}function v4({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,i=r.itemKey;r.didLayout=!0;let s=n,l=r.horizontal?"width":"height",d=Lu(n[l]);r.lastSize&&Lu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,sN(t,{containerId:e,itemKey:i,size:s})};!Ru(a)&&f!==void 0&&d+1<f?h4(r,()=>{var h;if(r.itemKey===i){let g=o.current,v=(h=g?.getBoundingClientRect)==null?void 0:h.call(g);v&&(s={height:v.height,width:v.width}),p()}}):(cN(r),p())}function x4({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=_({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=G(0),l=B(f=>{v4({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=B(()=>{lg(t,e)},[e,t]);ye(()=>(t.containerLayoutTriggers.set(e,d),()=>{cN(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),ye(()=>{lg(t,e)});let{onLayout:c}=DC({measureInLayoutEffect:!SC,onLayoutChange:l,ref:r,webLayoutResync:()=>Ru(t.state)},[o,i]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function y4({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:i,otherAxisSize:s}){let l;if(e){let{columnGap:d,rowGap:c,gap:f}=e;n?l={paddingBottom:a>1?(c||f||0)/2:void 0,paddingRight:d||f||void 0,paddingTop:a>1?(c||f||0)/2:void 0}:l={paddingBottom:c||f||void 0,paddingLeft:a>1?(d||f||0)/2:void 0,paddingRight:a>1?(d||f||0)/2:void 0}}return n?{bottom:t==="flex-end"&&a===1?0:void 0,boxSizing:l?"border-box":void 0,direction:r&&Ua.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:s,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:i,...l||{}}:{boxSizing:l?"border-box":void 0,left:i,position:"absolute",right:a>1?null:0,top:0,width:s,...l||{}}}var C4=la(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Br(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=qa(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[h=0,g=1,v,x=1,y,C]=Wo([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=_(null),{onLayout:k,triggerLayout:S}=x4({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),L=h>0?h:1,I=Math.min(Math.max(g||1,1),x),T=x>1?`${(L-1)/x*100}%`:0,E=x>1?`${I/x*100}%`:void 0,A=z(()=>y4({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:x,otherAxisPos:T,otherAxisSize:E}),[r,f,T,E,d,l.state.props.contentContainerAlignItems,x,i]),N=z(()=>n!==void 0?a(n):null,[n,v,y]),{renderedItem:R}=N||{},$=z(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return Te(C?m||s4:p||l4,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:k,refView:w,stickyHeaderConfig:s,style:A},Te(dN.Provider,{value:$},R,N&&i&&Te(p4,{ItemSeparatorComponent:i,leadingItem:N.item})))});function b4({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=C4}){let[s]=Wo([`containerItemKey${e}`]);return s===void 0?null:Te(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var I4=la(function(t){return Te(b4,{...t})});function S4(e,t){let n=Array.from(e.children);if(n.length<=1)return n;let o=n.map(l=>{var d;return[l,(d=t.get(l))!=null?d:null]});o.sort((l,d)=>{let c=l[1],f=d[1];return c===null?1:f===null?-1:c-f});let r=new Map;o.forEach((l,d)=>{r.set(l[0],d)});let a=n.map(l=>r.get(l)),i=w4(a),s=new Set(i);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!s.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],h=n.indexOf(m);if(s.has(h)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function w4(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let s=0;s<t;s++){let l=e[s],d=0,c=n.length;for(;d<c;){let f=Math.floor((d+c)/2);e[r[f]]<l?d=f+1:c=f}d===n.length?(n.push(l),r.push(s)):(n[d]=l,r[d]=s),d>0&&(o[s]=r[d-1])}let a=[],i=r[r.length-1];for(;i!==-1;)a.unshift(i),i=o[i];return a}function T4(e){let t=Br(),n=_(void 0);q(()=>{let o=$a(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[i,s]of t.viewRefs){let l=s.current,d=de(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}S4(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function L4(e,t){let[n,o]=G(t),r=n!==t;return ye(()=>{o(t)},[t]),e&&!r}var k4=la(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=_(null),i=Br(),s=i.columnWrapperStyle,l=qa(i.state),[d,c,f]=Wo(["otherAxisSize","readyToRender","totalSize"]),p=L4(!!c,t);T4(a);let m=n?{direction:l?"ltr":void 0,flexShrink:0,minHeight:d,opacity:p?1:0,position:"relative",width:f}:{height:f,minWidth:d,opacity:p?1:0,position:"relative"};if(p||(m.pointerEvents="none"),s&&o>1){let{columnGap:h,rowGap:g,gap:v}=s,x=h||v||0,y=g||v||0;n?(y&&(m.marginTop=m.marginBottom=-y/2),x&&(m.marginRight=-x)):y&&(m.marginBottom=-y)}return Te("div",{ref:a,style:m},Te(r4,null,r))}),P4=la(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Wo(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(Te(I4,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Te(k4,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function A4(e){return hg(e)?Object.assign({},...e.filter(Boolean)):e}var Mu={create:e=>e,flatten:e=>A4(e)};function mC(e){let t=_(e);return t.current=e,t}function E4(e){let t=mC(e),n=_(void 0),o=z(()=>({cancel(){n.current!==void 0&&(cancelAnimationFrame(n.current),n.current=void 0)},flush(){o.cancel(),t.current()},schedule(){if(n.current!==void 0)return!1;let r=requestAnimationFrame(()=>{n.current===r&&(n.current=void 0,t.current())});return n.current=r,!0}}),[]);return q(()=>()=>{o.cancel()},[o]),o}var gC="legend-list-content-container",uN="legend-list-scrollbar-x-hidden",fN="legend-list-scrollbar-y-hidden";function M4(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function hC(){var e,t,n,o;return typeof window>"u"?{x:0,y:0}:{x:(t=(e=window.scrollX)!=null?e:window.pageXOffset)!=null?t:0,y:(o=(n=window.scrollY)!=null?n:window.pageYOffset)!=null?o:0}}function iR(e,t){var n,o;let r=e?.getBoundingClientRect();return{left:((n=r?.left)!=null?n:0)+t.x,top:((o=r?.top)!=null?o:0)+t.y}}function pN(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function R4(e,t,n){return pN(n?t:e)}function sR(e,t,n){var o,r,a,i,s,l;if(t&&typeof window<"u"){let d=e?.getBoundingClientRect();return{height:n&&(r=(o=d?.height)!=null?o:e?.clientHeight)!=null?r:window.innerHeight,width:n?window.innerWidth:(i=(a=d?.width)!=null?a:e?.clientWidth)!=null?i:window.innerWidth}}return{height:(s=e?.clientHeight)!=null?s:0,width:(l=e?.clientWidth)!=null?l:0}}function lR(e,t){return Math.max(0,Math.min(e,t))}function dR(e,t){return t?e.width:e.height}function N4(e,t,n){return Math.max(0,dR(e,n)-dR(t,n))}function cR(e,t){return t&&M4()||e}function _4(e,t){return t&&typeof window<"u"?window:e}function D4(e,t,n){let o=e.getBoundingClientRect(),r=hC();return{height:t&&typeof window<"u"&&!n?window.innerHeight:o.height,width:t&&typeof window<"u"&&n?window.innerWidth:o.width,x:t?o.left+r.x:o.left,y:t?o.top+r.y:o.top}}function O4({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var uR="legend-list-scrollbar-axis-hidden-style",F4=200,B4=`.${fN}::-webkit-scrollbar:vertical{width:0;display:none;}.${uN}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function z4(){if(typeof document>"u"||document.getElementById(uR))return;let e=document.createElement("style");e.id=uR,e.textContent=B4,document.head.appendChild(e)}function $4(e){var t,n;let o=(n=(t=e.state)==null?void 0:t.props)==null?void 0:n.contentInsetEndAdjustment;return Math.max(0,o??0)}function H4(e){if(!e?.length)return[];let t=[],n=new Set;for(let o of e)Number.isFinite(o)&&!n.has(o)&&(n.add(o),t.push(o));return t}function U4(e,t){return{height:t?"100%":1,left:t?e:0,pointerEvents:"none",position:"absolute",scrollSnapAlign:"start",top:t?0:e,width:t?1:"100%"}}var fR=Wn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:i,maintainVisibleContentPosition:s,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:h=!1,onLayout:g,...v},x){var y,C,w;let k=Br(),[S]=Wo(["anchoredEndSpaceSize"]),L=_(null),I=_(null),T=h,E=B(()=>_4(L.current,T),[T]),A=B(()=>{let He=L.current,Se=R4(He,I.current,T),ze=sR(He,T,a);return N4(Se,ze,a)},[a,T]),N=B(()=>{let He=L.current;if(T){let Se=A(),ze=hC(),Je=iR(He,ze),qt=a?ze.x-Je.left:ze.y-Je.top;return lR(qt,Se)}return He?a?He.scrollLeft:He.scrollTop:0},[A,a,T]),R=B((He,Se)=>{let ze=L.current,Je=E();if(!Je||typeof Je.scrollTo!="function")return;let qt=A(),X=lR(He,qt),xt={behavior:Se?"smooth":"auto"};if(T){let mn=hC(),Tt=iR(ze,mn),{left:Yt,top:Jt}=O4({clampedOffset:X,horizontal:a,listPos:Tt,scroll:mn});xt.left=Yt,xt.top=Jt}else a?xt.left=X:xt.top=X;Je.scrollTo(xt)},[A,E,a,T]);Gr(x,()=>({getBoundingClientRect:()=>{var Se;return(Se=L.current)==null?void 0:Se.getBoundingClientRect()},getCurrentScrollOffset:N,getScrollableNode:()=>cR(L.current,T),getScrollEventTarget:()=>E(),getScrollResponder:()=>cR(L.current,T),isWindowScroll:()=>T,scrollBy:(Se,ze)=>{let Je=E();!Je||typeof Je.scrollBy!="function"||Je.scrollBy({behavior:"auto",left:Se,top:ze})},scrollTo:Se=>{let{x:ze=0,y:Je=0,animated:qt=!0}=Se;R(a?ze:Je,qt)},scrollToEnd:(Se={})=>{let{animated:ze=!0}=Se,Je=A();R(Je,ze)},scrollToOffset:Se=>{let{offset:ze,animated:Je=!0}=Se;R(ze,Je)}}),[N,A,E,a,T,R]);let $=B(()=>{if(!l||!L.current)return;let He=pN(I.current),Se=sR(L.current,T,a),ze=N(),Je={nativeEvent:{contentOffset:{x:a?ze:0,y:a?0:ze},contentSize:{height:He.height,width:He.width},layoutMeasurement:{height:Se.height,width:Se.width}}};l(Je)},[N,a,T,l]),H=E4($),K=_(void 0),O=B(()=>{let He=K.current;He!==void 0&&(clearTimeout(He),K.current=void 0),H.flush(),d?.()},[d,H]),oe=B(He=>{if(!l)return;let Se=k.state;if(!!Se?.scrollingTo||!!Se?.initialScrollSession&&!Se.didFinishInitialScroll||!!Se?.initialScroll&&!Se.didFinishInitialScroll||!!Se&&Ru(Se)?H.flush():H.schedule(),d){let Je=K.current;Je!==void 0&&clearTimeout(Je),K.current=setTimeout(O,F4)}},[k.state,O,d,l,H]);ye(()=>{let He=E();if(He)return He.addEventListener("scroll",oe,{passive:!0}),"onscrollend"in He&&He.addEventListener("scrollend",O),()=>{He.removeEventListener("scroll",oe),"onscrollend"in He&&He.removeEventListener("scrollend",O);let Se=K.current;Se!==void 0&&(clearTimeout(Se),K.current=void 0),H.cancel()}},[O,E,oe,H]),q(()=>{let He=()=>{i&&R(a?i.x||0:i.y||0,!1)};He(),requestAnimationFrame(He)},[i?.x,i?.y,a,R]),ye(()=>{if(!g||!L.current)return;let He=L.current,Se=()=>{g({nativeEvent:{layout:D4(He,T,a)}})};Se();let ze=new ResizeObserver(()=>{Se()});ze.observe(He);let Je=()=>{Se()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",Je),()=>{ze.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Je)}},[T,g]);let ee=!T&&(a?!f&&uN:!p&&fN);ye(()=>{ee&&z4()},[ee]);let W={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Mu.flatten(n),...s?{overflowAnchor:"none"}:{}},qe=$4(k),ve=(C=(y=k.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&S?S:0,fe=Math.max(0,qe-ve),Ne=fe?a?{flexShrink:0,width:fe}:{height:fe}:void 0,Ae={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...Mu.flatten(r),...s?{overflowAnchor:"none"}:{}},ae=o?`${gC} ${o}`:gC,{contentContainerClassName:Ee,contentInset:xe,scrollEventThrottle:re,ScrollComponent:Ie,snapToOffsets:st,useWindowScroll:dt,className:lt,...ct}=v,Et=T?[]:H4(st);Et.length>0&&(W.scrollSnapType=a?"x mandatory":"y mandatory",Ae.position=(w=Ae.position)!=null?w:"relative");let ot=ee?lt?`${lt} ${ee}`:ee:lt;return Vo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${lt??""}`)&&Us("className-gap","className/contentContainerClassName gap classes are not supported in LegendList because it needs to use exact values internally. Use contentContainerStyle={{ gap: ... }} or columnWrapperStyle instead."),Te("div",{className:ot,ref:L,...ct,style:W},m,Te("div",{className:ae,ref:I,style:Ae},Et.map(He=>Te("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":He,key:`snap-${He}`,style:U4(He,a)})),t,Ne?Te("div",{"aria-hidden":!0,style:Ne}):null))});function K4({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function pR(e,t){let n=Br();ye(()=>$a(n,e,r=>{t(r)}),[t,n,e])}function q4(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function V4(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,i=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,s=null;return i&&(s=t?.isConnected&&t.parentElement===i?t:i.querySelector(`:scope > .${gC}`)),i?{contentNode:s,scrollElement:i}:null}function W4(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function G4(){let e=Br(),t=_(0),n=_(0),o=_(void 0),r=_(void 0),a=_(null),i=B(()=>{let s=de(e,"scrollAdjust"),l=de(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=V4(e,a.current);if(f){let p=!!e.state.props.horizontal,m=q4(p),{contentNode:h,scrollElement:g}=f,v=p?g.scrollLeft:g.scrollTop,x=(l||0)-n.current,C=(x!==0?v+x:e.state.scroll)-v,w=Math.abs(C)>.01,k=()=>W4(g,m.x*C,m.y*C);if(a.current=h,w&&h){let S=h[m.contentSizeKey],L=g[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+L){let E=h.style[m.paddingEndProp],A=r.current,N=A?.value===E?A.baseline:E,R=(I+L-S)*2,H=`${(Number.parseFloat(window.getComputedStyle(h)[m.paddingEndProp])||0)+R}px`;h.style[m.paddingEndProp]=H,r.current={baseline:N,value:h.style[m.paddingEndProp]},h.offsetHeight,k(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let K=r.current;o.current=void 0,r.current=void 0,h.style[m.paddingEndProp]===K?.value&&(h.style[m.paddingEndProp]=K.baseline)})}else k()}else w&&k()}t.current=d,n.current=l||0}},[e]);return pR("scrollAdjust",i),pR("scrollAdjustUserOffset",i),null}var j4=Wn(function({ScrollComponent:t,...n},o){let[r]=Wo(["snapToOffsets"]);return Te(t,{...n,ref:o,snapToOffsets:r})}),vC=.1;function Q4(e,t,n){let o=de(e,t)!==n;return o&&(Pe(e,t,n),Gs(e)),o}function X4(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:i,scrollingTo:s}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!s&&i>=c-vC&&Math.abs(l)>vC}function mR(e,t){let{state:n}=e,o=de(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>vC;r&&(Pe(e,"headerSize",t),Gs(e),a&&X4(e,o,t)&&js(e,t-o)),n.didMeasureHeader=!0}function Y4(e,t){let n=Q4(e,"footerSize",t);return n&&dg(e),n}function J4(e,t){var n,o,r,a,i,s,l,d;return((n=e?.top)!=null?n:0)===((o=t?.top)!=null?o:0)&&((r=e?.bottom)!=null?r:0)===((a=t?.bottom)!=null?a:0)&&((i=e?.left)!=null?i:0)===((s=t?.left)!=null?s:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function Z4(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!J4(o,r);return n.contentInsetOverride=r,a&&Gs(e),a}function eW(e,t){let n=mC(e),o=mC(t);return z(()=>Wn((r,a)=>{var i,s;return(s=(i=n.current)==null?void 0:i.call(n,o.current(r,a)))!=null?s:null}),[o,n])}var gR=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=_(null),a=t??r;return DC({onLayoutChange:e,ref:a}),Te("div",{...o,ref:a},n)},tW=la(function({horizontal:t}){let[n=0]=Wo(["alignItemsAtEndPadding"]);return n<=0?null:Te(cg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),nW=la(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:i,recycleItems:s,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:h,ListFooterComponentStyle:g,ListEmptyComponent:v,getRenderedItem:x,refScrollView:y,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:k,onInternalScrollEnd:S,scrollAdjustHandler:L,snapToIndices:I,stickyHeaderConfig:T,stickyHeaderIndices:E,useWindowScroll:A=!1,...N}){let R=Br(),$=R.state.props.maintainVisibleContentPosition,[H=0,K=0]=Wo(["anchoredEndSpaceSize","otherAxisSize"]),O=R.state.props.alignItemsAtEndPaddingEnabled,oe=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&H>0,ee;if(oe){let Ee=a?qa(R.state)?"Left":"Right":"Bottom",xe=Mu.flatten(r);ee={[`padding${Ee}`]:Cu({},xe||{},Ee)+H}}let W=K4({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:K}),qe=eW(C,(Ee,xe)=>({...Ee,ref:xe})),ve=C?qe:fR,fe=I?j4:ve,Ne=B((Ee,xe)=>{var re;let Ie=Y4(R,Ee);xe?.(),Ie&&((re=R.state.props.maintainScrollAtEnd)!=null&&re.onFooterLayout)&&cd(R)},[R]);ye(()=>{p||mR(R,0),h||Ne(0)},[p,h,R,Ne]);let Ae=B(Ee=>{let xe=Ee[a?"width":"height"];mR(R,xe)},[R,a]),ae=B((Ee,xe)=>{let re=Ee[a?"width":"height"];Ne(re,()=>{w?.(Ee,xe)})},[a,w,Ne]);return Te(fe,{...N,...ve===fR?{onInternalScrollEnd:S,useWindowScroll:A}:{},contentContainerStyle:[a?{height:"100%"}:{},r,ee,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:$.size||$.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:y,ScrollComponent:I?ve:void 0,style:W?[W,o]:o},Te(G4,null),p&&Te(gR,{onLayoutChange:Ae,style:m},og(p)),v&&og(v),O&&Te(tW,{horizontal:a}),t&&!v&&Te(P4,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),h&&Te(gR,{onLayoutChange:ae,style:g},og(h)),Vo&&nq)}),oW=100,rW=.9,aW=.9;function iW(e){let t=Br(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;q(()=>{l&&(a??1)>1&&Us("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),q(()=>{s&&i&&Us("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),q(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Us("keyExtractor","Changing data without a keyExtractor can cause slow performance and resetting scroll. If your list data can change you should use a keyExtractor with a unique id for best performance and behavior.")},[o,t,r]),q(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<oW)return;let p=()=>{let h=de(t,"readyToRender"),g=de(t,"numContainers")||0,v=de(t,"totalSize")||0,x=t.state.scrollLength||0;if(!h||v<=0||x<=0)return;let y=g>=Math.ceil(c*rW),C=x>=v*aW;y&&C&&Us("webUnboundedOuterSize","LegendList appears to have an unbounded outer height on web, so virtualization is effectively disabled. Set a bounded height or flex: 1 on the list container, or use useWindowScroll.")};p();let m=[$a(t,"numContainers",p),$a(t,"readyToRender",p),$a(t,"totalSize",p)];return()=>{for(let h of m)h()}},[t])}function sW(e){}var lW=Vo?iW:sW;function dW(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),jR(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}Ha(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&cd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||mg(e),delete o.previousData}function cW(e,t,n){var o;if(e.pendingDataComparison=void 0,!n||!t||t.length!==n.length)return!0;let{idCache:r,props:{itemsAreEqual:a,keyExtractor:i}}=e,s;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!i)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:i(n[l],l),c=i(t[l],l);if(d!==c)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;if(!a)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(s??(s=[]),s[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:s,nextData:t,previousData:n},!0}return!1}function mN(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=NR(e),f=de(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let h=0,g=Math.min(20,a.length);for(let v=0;v<g;v++){let x=a[v];if(x!==void 0){let y=(t=s?.(x,v))!=null?t:"";h+=((n=i(x,v,y))!=null?n:d)+e.scrollAxisGap}}p=h/g}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let h=0;h<m;h++)Pe(e,`containerPosition${h}`,sd),Pe(e,`containerColumn${h}`,-1),Pe(e,`containerSpan${h}`,1);return Pe(e,"numContainers",m),Pe(e,"numContainersPooled",FV(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Ha(e,{dataChanged:!0,doMVCP:!0})}):Ha(e,{dataChanged:!0,doMVCP:!0})),!0}}function uW(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function fW(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,i=o.props.horizontal?"width":"height",s=o.props.horizontal?"height":"width",l=t;if(a){let v=uW()[i];l=v>0?{...t,[i]:v}:t}let d=l[i],c=o.scrollLength,f=d>0?d:c,p=l[s],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let h=o.otherAxisSize,g=f!==o.scrollLength||p!==h;if(g){if(o.scrollLength=f,o.otherAxisSize=p,Gs(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&mN(e),m&&Ha(e,{doMVCP:!0}),(g||p!==h)&&Pe(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&cd(e),mg(e),o){let v=o.props.horizontal?(o.props.stylePaddingTop||0)+(o.props.stylePaddingBottom||0):(o.props.stylePaddingLeft||0)+(o.props.stylePaddingRight||0);o.needsOtherAxisSize=p-v<10}Vo&&d===0&&Us("height0",`List ${o.props.horizontal?"width":"height"} is 0. You may need to set a style or \`flex: \` for the list, because children are absolutely positioned.`)}n(!0)}function pW(e,t){let n=oo.get(e);if(!!n&&oo.didReachTarget(t,n)){oo.clear(e);return}n&&(e.hasScrolled=!1,oo.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function mW(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function gW(e){return{...e,nativeEvent:{...e.nativeEvent}}}function hW(e,t){var n,o,r,a,i,s;let l=e.state,{scrollProcessingEnabled:d}=l;if(d===!1||((o=(n=t.nativeEvent)==null?void 0:n.contentSize)==null?void 0:o.height)===0&&((r=t.nativeEvent.contentSize)==null?void 0:r.width)===0)return;let c=!1;if((a=t.nativeEvent)!=null&&a.contentInset){let{contentInset:p}=t.nativeEvent,m=l.nativeContentInset;(!m||m.top!==p.top||m.bottom!==p.bottom||m.left!==p.left||m.right!==p.right)&&(l.nativeContentInset=p,c=!0)}let f=t.nativeEvent.contentOffset[l.props.horizontal?"x":"y"];if(l.props.horizontal&&(f=UK(l,f,(i=t.nativeEvent.contentSize)==null?void 0:i.width)),l.didFinishInitialScroll&&((s=l.initialScroll)==null?void 0:s.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=Mi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,yg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,qs(e,f,c,{fromNativeScrollEvent:!0}),pW(l,f),rV(e),l.scrollingTo&&RC(e),l.props.onScroll&&(mW(l)?l.deferredPublicOnScrollEvent=gW(t):l.props.onScroll(t))}var vW=class{constructor(){this.work=new Map}timeout(e,t,n){n&&this.cancel(n);let o=[void 0,clearTimeout],r=setTimeout(()=>{let a=n??r;this.work.get(a)===o&&(this.work.delete(a),e())},t);o[0]=r,this.work.set(n??r,o)}frame(e,t){this.cancel(t);let n=[void 0,cancelAnimationFrame];this.work.set(t,n),n[0]=requestAnimationFrame(()=>{this.work.get(t)===n&&(this.work.delete(t),e())})}register(e,t){this.cancel(e),this.work.set(e,[void 0,t])}cancel(e){let t=this.work.get(e);if(t){this.work.delete(e);let[n,o]=t;o(n)}}has(e){return this.work.has(e)}dispose(){for(let[e,t]of this.work.values())t(e);this.work.clear()}},xW=class{constructor(e){this.appliedAdjust=0,this.pendingAdjust=0,this.ctx=e}requestAdjust(e){let t=this.ctx.state.scrollingTo;t?.animated&&!t.isInitialScroll?(this.pendingAdjust+=e,Pe(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&RC(this.ctx)}getAdjust(){return this.appliedAdjust}commitPendingAdjust(e){{let t=this.ctx.state,n=this.pendingAdjust;if(this.pendingAdjust=0,n!==0){let o;if(e?.index!==void 0){let a=gg(this.ctx,e.index);o=vg(this.ctx,a,e),o=Mi(this.ctx,o,e)}else o=Mi(this.ctx,t.scroll+n);let r=o-t.scroll;(Math.abs(r)>.1||Math.abs(n)>.1)&&(this.appliedAdjust+=r,t.scroll=o,t.scrollForNextCalculateItemsInView=void 0,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),Pe(this.ctx,"scrollAdjustPending",0),Ha(this.ctx)}}}};function yW(e,t){let n=e.state,o=Ks(e,t),a=Ks(e)-o;if(a!==0){let i=!!de(e,"isWithinMaintainScrollAtEndThreshold");qs(e,n.scroll,!0,{markHasScrolled:!1}),!YR(e)&&i&&a>0&&js(e,a)}}function iC(e){return z(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var CW=(...e)=>B(n=>{for(let o of e)o&&(OR(o)?o(n):o.current=n)},e);function bW(e){return null}function IW(e,t,n,o){return o}function SW(e){let{gap:t,columnGap:n,rowGap:o}=e;if(t||n||o)return e.gap=void 0,e.columnGap=void 0,e.rowGap=void 0,{columnGap:n,gap:t,rowGap:o}}function wW(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=de(e,"footerSize")||0;return ng(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var TW="default";function LW(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||TW]={average:o.avg,count:o.num})}return t}function kW(e){lg(e)}function PW(e,t){let n=e.state,o=800,r=2,a=0,i=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,s=(g,v=!1)=>{var x;let y=n.props,C=y.data.length,w=(x=y.anchoredEndSpace)==null?void 0:x.anchorIndex;return g<0?v:g>=C?!1:w===void 0||w<0||w>=C||g<w?!0:Cq(e,w,C-1)},l=(g,v,x)=>{let y=Date.now(),C=0,w=()=>{if(g!==a)return;i()||!x()?C=0:C+=1;let k=Date.now()-y>=o;if(C>=r||k){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(g,v,x,y=()=>!0)=>{let C=()=>{if(g!==a)return;(!x()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!y()?l(g,C,y):C()},c=g=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return TR(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);WM(e),d(y,x,g,v)});n.runPendingScrollToEnd=()=>{let g=n.pendingScrollToEnd;g&&(n.pendingScrollToEnd=void 0,g.token===a&&d(g.token,g.resolve,()=>wW(e,g.options),()=>s(n.props.data.length-1,!0)))};let p=g=>{if(n){let{index:v,...x}=g,{startNoBuffer:y,endNoBuffer:C}=n;if(v<y||v>C){let w=v<y?0:1;return ng(e,{...x,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:g=>{var v,x;let y=(v=g?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),jR(n);for(let C in n.averageSizes)delete n.averageSizes[C];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Pe(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),kW(e),(x=n.triggerCalculateItemsInView)==null||x.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var g,v,x;return(x=(v=(g=m.current).getNativeScrollRef)==null?void 0:v.call(g))!=null?x:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:de(e,"activeStickyIndex"),contentLength:po(e),data:n.props.data,elementAtIndex:g=>{var v;return(v=e.viewRefs.get(cC(e,Bt(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>LW(n),indexByKey:g=>n.indexByKey.get(g),isAtEnd:de(e,"isAtEnd"),isAtStart:de(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:de(e,"isNearEnd"),isNearStart:de(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:de(e,"isWithinMaintainScrollAtEndThreshold"),listen:(g,v)=>$a(e,g,v),listenToPosition:(g,v)=>jK(e,g,v),positionAtIndex:g=>n.positions[g],positionByKey:g=>{let v=n.indexByKey.get(g);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:xg(n),sizeAtIndex:g=>n.sizesKnown.get(Bt(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=Z4(e,g);qs(e,n.scroll,!0,{markHasScrolled:!1}),v&&YR(e)},scrollIndexIntoView:g=>f(()=>p(g)),scrollItemIntoView:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(p({index:y,...v}),!0):!1}),scrollToEnd:g=>new Promise(v=>{var x;let y=c(v);n.pendingScrollToEnd={options:g,resolve:v,token:y},t?.(),WM(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(ng(e,g),!0),g.index>=0?()=>s(g.index):void 0),scrollToItem:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(ng(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(yg(e,g),!0)),setItemSize:(g,v)=>{sN(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=OR(g)?g(de(e,"scrollAdjustUserOffset")||0):g;Pe(e,"scrollAdjustUserOffset",v)}}}var AW=(e,t)=>e-t,hR=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,yu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function EW(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=hR(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)yu(i,s,f);let d=hR(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)yu(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&yu(i,s,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<s&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(yu(i,s,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:s;p<s;p++)yu(i,s,p)}let c=Array.from(i);return c.sort(AW),c}function MW(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:i,renderItem:s}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=de(e,"extraData"),f=a[l];if(s&&!Su(f)){let p={data:a,extraData:c,index:l,item:f,type:i&&(n=i(f,l))!=null?n:""};d=s(p)}return{index:l,item:a[l],renderedItem:d}}function vR(e,t){var n,o,r,a;return{animated:!1,onDataChange:t?(n=e?.dataChange)!=null?n:!1:!0,onFooterLayout:t?(o=e?.footerLayout)!=null?o:!1:!0,onItemLayout:t?(r=e?.itemLayout)!=null?r:!1:!0,onLayout:t?(a=e?.layout)!=null?a:!1:!0}}function RW(e){var t;return e?e===!0?{...vR(void 0,!1),animated:!1}:{...vR(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function NW(e){var t,n;return e===!0?{data:!0,size:!0}:e&&typeof e=="object"?{data:(t=e.data)!=null?t:!1,shouldRestorePosition:e.shouldRestorePosition,size:(n=e.size)!=null?n:!0}:e===!1?{data:!1,size:!1}:{data:!1,size:!0}}function _W(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=de(e,"stylePaddingTop")||0;if(t<o){let r=de(e,"totalSize")||0;Pe(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=de(e,"totalSize")||0,Pe(e,"totalSize",r-o)},16)}Pe(e,"stylePaddingTop",t)}}function DW(e){let t=_(null),n=_(0),o=_(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return B((i,s,...l)=>{{let d=Date.now();o.current=l,d-n.current>=s?(n.current=d,i(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),i(...o.current),t.current=null,o.current=null)},s-(d-n.current)))}},[e])}function OW(e,t){let n=DW("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var FW=la(lN(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(hg(o)?o:ah.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Te(VK,null,Te(BW,{...l,ref:n}))})),BW=lN(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k;let S=B($e=>{},[]);t.recycleItems===void 0&&Us("recycleItems-omitted","recycleItems was not provided, so it defaults to false. Set recycleItems explicitly to true for better performance with recycling-aware rows, or false to preserve remount-on-reuse behavior.");let{alignItemsAtEnd:L=!1,anchoredEndSpace:I,alwaysRender:T,columnWrapperStyle:E,contentContainerStyle:A,contentInset:N,data:R=[],dataKey:$,dataVersion:H,drawDistance:K=250,contentInsetEndAdjustment:O,estimatedItemSize:oe=100,estimatedListSize:ee,extraData:W,getFixedItemSize:qe,getItemType:ve,horizontal:fe,rtl:Ne,estimatedHeaderSize:Ae,initialScrollAtEnd:ae=!1,initialScrollIndex:Ee,initialScrollOffset:xe,experimental_adaptiveRender:re,itemsAreEqual:Ie,keyExtractor:st,ListEmptyComponent:dt,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Et,maintainScrollAtEnd:ot=!1,maintainScrollAtEndThreshold:He=.1,maintainVisibleContentPosition:Se,numColumns:ze=1,overrideItemLayout:Je,onEndReached:qt,onEndReachedThreshold:X=.5,onItemSizeChanged:nn,onMetricsChange:xt,onLayout:mn,onLoad:Tt,onMomentumScrollEnd:Yt,onRefresh:Jt,onScroll:Mt,onScrollBeginDrag:zn,onStartReached:kn,onStartReachedThreshold:vn=.5,onStickyHeaderChange:$n,onFirstVisibleItemChanged:Vt,onViewableItemsChanged:Zt,progressViewOffset:Sn,recycleItems:ho=!1,refreshControl:zt,refreshing:D,refScrollView:Y,renderScrollComponent:ce,renderItem:ie,scrollEventThrottle:pe,snapToIndices:Ze,stickyHeaderIndices:pt,style:xn,useWindowScroll:ht=!1,viewabilityConfig:en,viewabilityConfigCallbackPairs:tn,...bt}=t,yn=t.animatedPropsInternal,sn=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",ge=t.positionComponentInternal,Rt=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:rt,positionComponentInternal:Lt,stickyPositionComponentInternal:et,...Nt}=bt,ut=Mu.flatten(A),ft=L&&!fe&&ut?.minHeight==null&&R.length>0,eo=L&&!ft&&(fe?ut?.minWidth==null:ut?.minHeight==null),ln={...ut,...L&&!ft?{display:"flex",flexDirection:fe?"row":"column",...eo?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},Nn={...Mu.flatten(xn)},Hn=Cu(Nn,ln,"Top"),Un=Cu(Nn,ln,"Bottom"),ne=Cu(Nn,ln,"Left"),Fe=Cu(Nn,ln,"Right"),at=bC({horizontal:fe,rtl:Ne,stylePaddingBottom:Un,stylePaddingLeft:ne,stylePaddingRight:Fe}),je=RW(ot),wn=NW(Se),dn=Ee!=null,Cn=xe!=null,$t=!ae&&!dn&&!Cn&&CC({horizontal:fe,rtl:Ne}),Kn=!ae&&!dn&&(Cn||$t),Wt=ae||dn,vo=ae?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-at,viewPosition:1}:dn?typeof Ee=="object"?{index:(r=Ee.index)!=null?r:0,preserveForBottomPadding:Ee.viewOffset===void 0&&Ee.viewPosition===1?!0:void 0,viewOffset:(a=Ee.viewOffset)!=null?a:Ee.viewPosition===1?-at:0,viewPosition:(i=Ee.viewPosition)!=null?i:0}:{index:Ee??0,viewOffset:xe??0}:Kn?{contentOffset:xe??0,index:0,viewOffset:0}:void 0,[Wa,Ga]=G(!SC),[,Ni]=Za($e=>$e+1,0),he=Br();he.columnWrapperStyle=E||(ln?SW(ln):void 0);let da=fe?(d=(s=he.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=he.columnWrapperStyle)==null?void 0:l.gap:(p=(c=he.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=he.columnWrapperStyle)==null?void 0:f.gap,Go=typeof da=="number"&&Number.isFinite(da)?da:0,ja=_(null),gd=CW(ja,Y),ca=st??(($e,vt)=>vt.toString()),qn=pt,_t=O,ro=_(_t),on=z(()=>{let $e=EW(T,R,ca,I?.anchorIndex);return{arr:$e,set:new Set($e)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(h=T?.keys)==null?void 0:h.join(","),R,$,H,ca]),_i=!!ht&&!ce,It=_(void 0),xo=!!Je,bn=_(xo);if(!It.current){if(!he.state){let $e=(ee??{height:0,width:0})[fe?"width":"height"];he.values.set("adaptiveRender",(g=re?.initialMode)!=null?g:"normal"),he.state={averageSizes:{},columnSpans:[],columns:[],containerItemGenerations:[],containerItemKeys:new Map,containerItemMetadata:new Map,contentInsetOverride:void 0,dataChangeEpoch:0,dataChangeNeedsScrollUpdate:!1,didColumnsChange:!1,didDataChange:!1,didLoad:!1,enableScrollForNextCalculateItemsInView:!0,endBuffered:-1,endNoBuffer:-1,endReachedSnapshot:void 0,firstFullyOnScreenIndex:-1,freshDataTransitionEpoch:0,hasHadNonEmptyData:R.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:vo,initialScrollSession:vo?{kind:Kn?"offset":"bootstrap",previousDataLength:R.length}:void 0,isEndReached:null,isFirst:!0,isStartReached:null,lastBatchingAction:Date.now(),lastLayout:void 0,lastScrollDelta:0,loadStartTime:Date.now(),minIndexSizeChanged:0,nativeContentInset:void 0,nativeMarginTop:0,pendingDataComparison:void 0,pendingNativeMVCPAdjust:void 0,positions:[],props:{},queuedCalculateItemsInView:0,refScroller:{current:null},scheduledWork:new vW,scroll:0,scrollAdjustHandler:new xW(he),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:$e,scrollPending:0,scrollPrev:0,scrollPrevTime:0,scrollProcessingEnabled:!0,scrollTime:0,sizes:new Map,sizesKnown:new Map,startBuffered:-1,startNoBuffer:-1,startReachedSnapshot:void 0,stickyContainerPool:new Set,stickyContainers:new Map,totalSize:0,viewabilityConfigCallbackPairs:void 0};let vt=he.state;vt.triggerCalculateItemsInView=cn=>Ha(he,cn),vt.reprocessCurrentScroll=()=>qs(he,vt.scroll,!0),Pe(he,"maintainVisibleContentPosition",wn),Pe(he,"extraData",W),Ae!==void 0&&Pe(he,"headerSize",Ae)}It.current=he.state}let _e=It.current,Gt=_e.isFirst,Eo=_e.props.adaptiveRender,gr=_e.props.numColumns,Di=!Gt&&he.scrollAxisGap!==Go;he.scrollAxisGap=Go,_e.didColumnsChange=ze!==gr||Di;let yo=(x=(v=_e.props.data)==null?void 0:v.length)!=null?x:0,Hr=_e.props.data!==R,jo=_e.props.dataKey!==$,hr=_e.props.dataVersion!==H,ao=jo||hr||Hr&&cW(_e,R,_e.props.data),Ur=!Gt&&ao&&_e.hasHadNonEmptyData&&(jo||yo===0)&&R.length>0;ao&&!ae&&_e.didFinishInitialScroll&&((y=_e.initialScroll)==null?void 0:y.viewPosition)===1&&_e.props.data.length>0&&ld(_e),ao&&(_e.dataChangeEpoch+=1,_e.dataChangeNeedsScrollUpdate=!0,_e.didDataChange=!0,_e.previousData=_e.props.data),Ur&&(_e.freshDataTransitionEpoch+=1);let ua=OW(Mt??S,pe??0),Oi=pe&&Mt?ua:Mt,_n=!Gt&&!ao&&((C=_e.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;_e.props={adaptiveRender:re,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:ft,alwaysRender:T,alwaysRenderIndicesArr:on.arr,alwaysRenderIndicesSet:on.set,anchoredEndSpace:I,anchoredEndSpaceOwner:sn,animatedProps:yn,contentContainerAlignItems:ln.alignItems,contentInset:N,contentInsetEndAdjustment:_t,data:R,dataKey:$,dataVersion:H,drawDistance:K,estimatedItemSize:oe,getFixedItemSize:iC(qe),getItemType:iC(ve),horizontal:!!fe,itemsAreEqual:Ie,keyExtractor:iC(ca),maintainScrollAtEnd:je,maintainScrollAtEndThreshold:He,maintainVisibleContentPosition:wn,numColumns:ze,onEndReached:qt,onEndReachedThreshold:X,onFirstVisibleItemChanged:Vt,onItemSizeChanged:nn,onLoad:Tt,onMomentumScrollEnd:Yt,onScroll:Oi,onScrollBeginDrag:zn,onStartReached:kn,onStartReachedThreshold:vn,onStickyHeaderChange:$n,overrideItemLayout:Je,positionComponentInternal:ge,recycleItems:!!ho,renderItem:ie,rtl:Ne,snapToIndices:Ze,stickyHeaderIndicesArr:qn??[],stickyHeaderIndicesSet:z(()=>new Set(qn??[]),[qn?.join(",")]),stickyPositionComponentInternal:Rt,stylePaddingBottom:Un,stylePaddingLeft:ne,stylePaddingRight:Fe,stylePaddingTop:Hn,useWindowScroll:_i},_e.refScroller=ja,!Gt&&Eo&&!re&&wC(he);let Fi=z(()=>R.length?Array.from({length:Math.min(ze,R.length)},($e,vt)=>Bt(_e,R.length-1-vt)):[],[R,$,H,ze]),Oo=$e=>{Pe(he,"lastItemKeys",Fi),Pe(he,"numColumns",ze);let vt=de(he,"stylePaddingTop");_W(he,{stylePaddingTop:Hn}),It.current.props.stylePaddingBottom=Un,Gs(he);let cn=Hn-vt;$e&&wn.size&&cn&&vt!==void 0&&Ua.OS};Gt&&(Oo(!1),JR(_e),eN(he,!0));let Bi=z(()=>{var $e,vt;let cn=_e.initialScroll;if(!cn)return;let rn=($e=cn.contentOffset)!=null?$e:Fr(he,cn);return Wt&&((vt=_e.initialScrollSession)==null?void 0:vt.kind)==="bootstrap"&&Ua.OS==="web"?void 0:rn},[Wt]);ye(()=>{wV(he,{alwaysDispatchInitialScroll:$t,dataLength:R.length,hasFooterComponent:!!lt,initialContentOffset:Bi,initialScrollAtEnd:ae,useBootstrapInitialScroll:Wt})},[]),(Gt||ao||_e.didColumnsChange)&&(It.current.lastBatchingAction=Date.now(),!st&&!Gt&&ao&&(It.current.sizes.clear(),It.current.positions.length=0,It.current.totalSize=0,Pe(he,"totalSize",0))),Vo&&lW(t),ye(()=>{Ur&&LC(he,{resetInitialScroll:!!vo,resetLayout:!0}),TV(he,{dataLength:R.length,didDataChange:ao,didStartFreshData:Ur,initialScrollAtEnd:ae,latestInitialScroll:vo,latestInitialScrollSessionKind:Kn?"offset":"bootstrap",stylePaddingEnd:at,useBootstrapInitialScroll:Wt})},[R.length,$,ao,Ur,ae,at,Wt]),ye(()=>{var $e;_n&&(_e.scrollForNextCalculateItemsInView=void 0,($e=_e.triggerCalculateItemsInView)==null||$e.call(_e)),dg(he)},[he,R,H,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,_n,fe,ze,Ne,Un,ne,Fe]),ye(()=>{let $e=ro.current;ro.current=_t,yW(he,$e)},[he,_t]);let Fo=B($e=>{Wt&&sV(he,{dataLength:R.length,footerSize:$e[fe?"width":"height"],initialScrollAtEnd:ae,stylePaddingEnd:at})},[R.length,ae,fe,at,Wt]),vr=B(($e,vt)=>{let cn=_e.scrollLength,rn=_e.otherAxisSize;fW(he,$e,Ga),dg(he);let Qa=cn!==_e.scrollLength||rn!==_e.otherAxisSize;Wt&&!vt&&Qa&&lV(he),!Wt&&Pu(he)},[R.length,ae,at,Wt]),{onLayout:Qo}=DC({onLayoutChange:vr,onLayoutProp:mn,ref:ja});ye(()=>{Ze&&ZR(he)},[Ze]),ye(()=>Oo(!0),[$,H,Fi.join(","),ze,Go,Un,Hn,ft]),ye(()=>{let{didColumnsChange:$e,didDataChange:vt,isFirst:cn,props:{data:rn}}=_e;!(rn.length>0&&mN(he))&&!cn&&(vt||$e)&&dW(he,rn,{didColumnsChange:$e}),vt&&(_e.pendingDataComparison=void 0),_e.didColumnsChange=!1,_e.didDataChange=!1,_e.isFirst=!1},[R,$,H,ze,Go]),ye(()=>{var $e;Pe(he,"extraData",W);let vt=bn.current!==xo;bn.current=xo,(xo||vt)&&ze>1&&(($e=_e.triggerCalculateItemsInView)==null||$e.call(_e,{forceFullItemPositions:!0}))},[W,xo,ze]),q(()=>{if(!xt)return;let $e,vt=()=>{let rn={footerSize:de(he,"footerSize")||0,headerSize:de(he,"headerSize")||0};(!$e||rn.headerSize!==$e.headerSize||rn.footerSize!==$e.footerSize)&&($e=rn,xt(rn))};vt();let cn=[$a(he,"headerSize",vt),$a(he,"footerSize",vt)];return()=>{for(let rn of cn)rn()}},[he,xt]),q(()=>{let $e=MV({onViewableItemsChanged:Zt,viewabilityConfig:en,viewabilityConfigCallbackPairs:tn});_e.viewabilityConfigCallbackPairs=$e,_e.enableScrollForNextCalculateItemsInView=!0,$e&&(_e.scrollForNextCalculateItemsInView=void 0)},[en,tn,Zt]),d4(()=>{}),Gr(n,()=>PW(he,Ni),[]),q(()=>()=>{rq(_e),_e.scheduledWork.dispose()},[_e]),ye(()=>{var $e;($e=_e.runPendingScrollToEnd)==null||$e.call(_e)}),q(()=>{Wt||Pu(he)},[he,Wt]);let io=z(()=>({getRenderedItem:$e=>MW(he,$e),onMomentumScrollEnd:$e=>{IV(he),_e.props.onMomentumScrollEnd&&_e.props.onMomentumScrollEnd($e)},onScroll:$e=>hW(he,$e),onScrollBeginDrag:$e=>{var vt,cn;KM(he),(cn=(vt=_e.props).onScrollBeginDrag)==null||cn.call(vt,$e)},onScrollEnd:()=>KM(he)}),[]),zi=IW(qn,fe,he,io.onScroll),Bo=zt;return Te(Ja,null,Te(nW,{...Nt,alignItemsAtEnd:L,canRender:Wa,contentContainerStyle:ln,contentInset:N,freshDataTransitionEpoch:_e.freshDataTransitionEpoch,getRenderedItem:io.getRenderedItem,horizontal:fe,initialContentOffset:Bi,ListEmptyComponent:R.length===0?dt:void 0,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Et,onInternalScrollBeginDrag:io.onScrollBeginDrag,onInternalScrollEnd:io.onScrollEnd,onLayout:Qo,onLayoutFooter:Fo,onMomentumScrollEnd:io.onMomentumScrollEnd,onScroll:zi,recycleItems:ho,refreshControl:Bo?Hn>0?lf(Bo,{progressViewOffset:((w=Bo.props.progressViewOffset)!=null?w:0)+Hn}):Bo:Jt&&Te(bW,{onRefresh:Jt,progressViewOffset:(Sn||0)+Hn,refreshing:!!D}),refScrollView:gd,renderScrollComponent:ce,scrollAdjustHandler:(k=It.current)==null?void 0:k.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:Ze,stickyHeaderIndices:qn,style:Nn,useWindowScroll:_i}),Vo&&oq)});var zW=FW;var gN=zW;me();me();function $W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HW(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${$W(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function OC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return HW(n,e.subProvider)}function ud(e){return OC(e,{preferShortName:!0})}var FC="model:",BC="legacy-models:",zC="action:",fd="pluginActions:manage";function Nu(e,t){return`${FC}${e.length}:${e}${t}`}function HC(e){if(!e.startsWith(FC))return null;let t=e.slice(FC.length),n=t.indexOf(":");if(n===-1)return null;let o=t.slice(0,n);if(!/^\d+$/.test(o))return null;let r=Number(o),a=t.slice(n+1);return!Number.isSafeInteger(r)||r>a.length?null:{instanceId:a.slice(0,r),slug:a.slice(r)}}function UC(e){return`${BC}${e}`}function hN(e){return e.startsWith(BC)?e.slice(BC.length):null}function _u(e){return`${zC}${e}`}function vN(e){if(!e.startsWith(zC))return null;let t=e.slice(zC.length);return t.length>0?t:null}var $C="choice:";function KC(e){return`${$C}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function xN(e){if(!e.startsWith($C))return null;try{let t=JSON.parse(e.slice($C.length));if(!Array.isArray(t)||t.length!==5)return null;let[n,o,r,a,i]=t;return typeof n!="string"||typeof o!="string"||typeof r!="string"||typeof a!="string"||typeof i!="string"?null:{environmentId:n,runtimeId:o,sourceId:r,profileId:a,...i.length>0?{endpointId:i}:{}}}catch{return null}}var yN=ue(function(t){let{t:n}=De(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.sourceLabel,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(gl,{hideIndicator:!0,index:t.index,value:t.itemKey??Nu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:F("group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-colors duration-(--control-duration)","hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",t.disabledReason&&"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent"),children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"flex min-w-0 items-center gap-2",children:u("div",{className:"min-w-0 truncate text-xs font-medium leading-snug",children:t.useTriggerLabel?ud(t.model):OC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(Ia,{providerId:t.providerId,displayName:t.providerDisplayName,accentColor:t.providerAccentColor,className:"size-icon-2",iconClassName:"size-3",indicatorBackground:"var(--popover)"}),u("span",{className:"truncate text-xs font-normal leading-snug text-muted-foreground/70",children:r})]})]}),b("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(Ef,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Qe,{children:[u(Ye,{render:u(te,{size:"icon-xs",variant:"ghost",className:F("-mr-1 shrink-0 text-muted-foreground/70 opacity-64 transition-[color,opacity] hover:text-foreground hover:opacity-100 group-hover:opacity-100",t.isFavorite&&"text-foreground opacity-100"),onClick:s=>{s.stopPropagation(),t.onToggleFavorite()},onKeyDown:s=>{s.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(rs,{className:F("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Xe,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Qe,{children:[u(Ye,{render:a}),u(Xe,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});function Ig(e){return e==="ready"}function CN(e){return e==="ready"||e==="unchecked"||e==="checking"}function bN(e,t){switch(e){case"ready":return t("readiness.ready.title");case"unchecked":return t("readiness.unchecked.title");case"checking":return t("readiness.checking.title");case"disabled":return t("readiness.disabled.title");case"not-installed":return t("readiness.notInstalled.title");case"unauthenticated":return t("readiness.unauthenticated.title");case"error":return t("readiness.error.title");default:return e}}function Du(e){return e.enabled&&CN(e.readiness)}function IN(e){return e.enabled}function SN(e){let t=new Map;for(let n of e){let o=t.get(n.driverKind);o?o.push(n):t.set(n.driverKind,[n])}return[...t.values()].flat()}var Sg=e=>e.enabled;function wg(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&Sg(n))return n}return e.find(n=>n.enabled&&Ig(n.readiness))??e.find(Du)??e.find(n=>Sg(n)&&n.readiness!=="error")}function wN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}me();function UW(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(Ig(o))return n;let r=bN(o,t),a=e.snapshot.readiness.detail?.trim();return a?t("instance.statusWithDetail",{name:n,status:r,detail:a}):t("instance.status",{name:n,status:r})}var KW="pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary",qW="pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ",VW=`${qW} text-update-foreground`,TN="left",LN=8,kN="max-w-64 text-balance font-normal leading-snug",PN=ue(function(t){let{t:n}=De(),{t:o}=De(),r=Ot().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=G(null),d=_(null),[c,f]=G(null);return ye(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(h=>h.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,i]),u("div",{className:"w-11 shrink-0 overflow-hidden bg-muted/30","data-model-picker-sidebar":"true",children:u("div",{className:"h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:b("div",{ref:d,className:"relative flex min-h-full flex-col gap-1 p-1",children:[c!==null?u("div",{"data-model-picker-selected-indicator":"true",className:F(KW,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(be,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Qe,{children:[u(Ye,{render:u("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]"),onClick:()=>a("favorites"),type:"button","aria-label":n("modelPicker.favorites"),children:u(rs,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Xe,{side:TN,sideOffset:LN,align:"center",className:kN,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Du(p),h=t.disabledInstanceIds?.has(p.instanceId)??!1,g=m||h,v=t.selectedInstanceId===p.instanceId,x=s===p.instanceId,y=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?UW(p,o):h?t.getDisabledInstanceTooltip?.(p)??p.displayName:y?`${p.displayName} \u2014 ${C}`:p.displayName,k=b("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",g&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!g&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(L=>L===p.instanceId?null:L),onFocus:()=>l(p.instanceId),onBlur:()=>l(L=>L===p.instanceId?null:L),disabled:g,type:"button","aria-label":g?w:p.displayName,children:[u(Ia,{providerId:p.providerId,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:x&&!g?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),y?u("span",{className:VW,"aria-hidden":!0,children:u(vf,{className:"size-2.5"})}):null]}),S=g?u("span",{className:"relative block w-full",children:k}):k;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Qe,{children:[u(Ye,{render:S}),b(Xe,{side:TN,sideOffset:LN,align:"center",className:kN,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function go(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function WW(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let i=0;i<e.length;i+=1)if(e[i]===t[n]&&(o===-1&&(o=i),r!==-1&&(a+=i-r-1),r=i,n+=1,n===t.length)){let s=i-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+s+l}return null}function qC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function GW(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let i=a+r.length;(o===null||i<o)&&(o=i)}return o}function zr(e){let{value:t,query:n}=e;if(!t||!n)return null;if(t===n)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(n))return e.prefixBase+qC(t,n);if(e.boundaryBase!==void 0){let o=GW(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+qC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+qC(t,n)}if(e.fuzzyBase!==void 0){let o=WW(t,n);if(o!==null)return e.fuzzyBase+o}return null}function jW(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function QW(e,t){let n=0,o=e.length;for(;n<o;){let r=n+Math.floor((o-n)/2),a=e[r];if(!a)break;jW(t,a)<0?o=r:n=r+1}return n}function Tg(e,t,n){if(n<=0)return;let o=QW(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var XW=24;function YW(e){return[go(e.name),...e.shortName?[go(e.shortName)]:[],...e.subProvider?[go(e.subProvider)]:[],go(e.driverKind),go(e.providerDisplayName),...e.providerAccountEmail?[go(e.providerAccountEmail)]:[],VC(e),...e.slug?[go(e.slug)]:[]]}function JW(e,t,n){return zr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function VC(e){return go([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function AN(e,t){let n=go(t).split(/\s+/u).filter(r=>r.length>0);if(n.length===0)return 0;let o=0;for(let r of n){let a=[];for(let i=0;i<e.length;i+=1){let s=JW(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function EN(e,t){let n=AN(YW(e),t);return n===null?null:e.isFavorite?n-XW:n}function MN(e,t){return AN([go(e.title),go(e.description??"")],t)}function RN({top:e,bottom:t}){if(!(!e&&!t))return F("virtualized-scroll-fade [--fade-size:1.5rem]",e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size),black_calc(100%-var(--fade-size)),transparent)]",e&&!t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size))]",!e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,black_calc(100%-var(--fade-size)),transparent)]")}function Lg(e,t){return`${e}:${t}`}var NN=new Map,_N=[],ZW=[],eG=[];function Ou(e){return e.choiceKey??Nu(e.instanceId,e.slug)}function DN(e,t,n){return t.environmentId!==n||t.instanceId!==e.instanceId?!1:t.sourceId&&t.profileId?t.sourceId===e.sourceId&&t.profileId===e.profileId&&t.model===e.slug:e.sourceId&&e.profileId?!1:t.model===e.slug}function tG(){return u("div",{className:"h-0.5"})}function WC(e){return e?.trim()||null}function ON({label:e}){return u("div",{className:"px-2 pt-2 pb-1 text-[10px] font-medium uppercase leading-none tracking-wide text-muted-foreground/70",children:e})}var nG=ue(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=De(),i=WC(o.description);return b(be,{children:[r?u(ON,{label:a("modelPicker.plugins")}):null,b(gl,{hideIndicator:!0,index:t,value:n,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(ts,{className:"size-4 shrink-0 text-muted-foreground/70"}),b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"truncate text-xs font-medium leading-snug",children:o.title}),u("div",{className:"mt-1 truncate text-xs font-normal leading-snug text-muted-foreground/70",children:i})]})]})]})}),oG=ue(function({index:t,showSectionHeader:n}){let{t:o}=De();return b(be,{children:[n?u(ON,{label:o("modelPicker.plugins")}):null,b(gl,{hideIndicator:!0,index:t,value:fd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(kd,{className:"size-4 shrink-0 text-muted-foreground/70"}),u("span",{className:"min-w-0 flex-1 truncate text-left text-xs font-normal leading-snug text-muted-foreground",children:o("modelPicker.managePlugins")})]})]})}),FN=ue(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,getModelDisabledReason:a,getModelContinuationLabel:i,onContinueInModel:s,onInstanceModelChange:l,onChooseExecution:d,composerChoices:c,selectedExecutionSelection:f,onManagePlugins:p,onSelectPluginAction:m}=t,h=t.pluginActions??_N,g=t.selectedPluginActionKey??null,{t:v}=De(),{t:x}=De(),y=Ot(),[C,w]=G(""),[k,S]=G(!1),[L,I]=G(!1),T=_(null),E=_(null),A=_(null),N=y.environment.useActiveEnvironmentId(),R=y.settings.useClientSettings(D=>D.favorites??[]),$=z(()=>N===null?eG:R.filter(D=>D.environmentId===N),[N,R]),[H,K]=G(()=>t.lockedProvider!==null?t.activeInstanceId:$.length>0?"favorites":t.activeInstanceId),[O,oe]=G(()=>new Set(o.get(t.activeInstanceId)?.some(D=>D.slug===t.model&&D.isLegacy)?[t.activeInstanceId]:[])),ee=z(()=>n??[],[n]),W=y.settings.useUpdateClientSettings(),qe=B(()=>{T.current?.focus({preventScroll:!0})},[]),ve=B(D=>{K(D),window.requestAnimationFrame(()=>{qe()})},[qe]);ye(()=>{qe();let D=window.requestAnimationFrame(()=>{qe()}),Y=window.setTimeout(()=>{qe()},0);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(Y)}},[qe]);let fe=z(()=>new Set($.map(D=>Lg(D.instanceId,D.model))),[$]),Ne=B(D=>N===null?!1:$.some(Y=>DN(D,Y,N)),[N,$]),Ae=z(()=>new Map(r.map(D=>[D.instanceId,D])),[r]),ae=B(D=>t.lockedProvider===null?!0:D.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?D.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),Ee=z(()=>{let D=new Set;for(let Y of r)Du(Y)&&D.add(Y.instanceId);return D},[r]),xe=z(()=>{let D=[];for(let[Y,ce]of o){let ie=Ae.get(Y);if(ie&&Ee.has(Y))for(let pe of ce)D.push({slug:pe.slug,name:pe.name,...pe.shortName?{shortName:pe.shortName}:{},...pe.subProvider?{subProvider:pe.subProvider}:{},...pe.isLegacy?{isLegacy:!0}:{},instanceId:Y,driverKind:ie.driverKind,providerId:ie.providerId,instanceDisplayName:ie.displayName,...ie.accentColor?{instanceAccentColor:ie.accentColor}:{},...ie.accountEmail?{instanceAccountEmail:ie.accountEmail}:{},...ie.continuationGroupKey?{continuationGroupKey:ie.continuationGroupKey}:{}})}if(c&&c.length>0){let Y=new Set,ce=[];for(let pe of c){let Ze=pe.legacyInstanceId;if(!Ze||!Ee.has(Ze))continue;let pt=Ae.get(Ze);if(!pt)continue;let ht=o.get(Ze)?.find(tn=>tn.slug===pe.modelId),en=KC({environmentId:pe.selection.environmentId,runtimeId:pe.runtimeId,sourceId:pe.sourceId,profileId:pe.profileId,endpointId:pe.endpointId});Y.add(Lg(Ze,pe.modelId)),ce.push({slug:pe.modelId,name:ht?.name??pe.modelLabel,...ht?.shortName?{shortName:ht.shortName}:{},instanceId:Ze,driverKind:pt.driverKind,providerId:pt.providerId,instanceDisplayName:pt.displayName,...pt.accentColor?{instanceAccentColor:pt.accentColor}:{},...pt.accountEmail?{instanceAccountEmail:pt.accountEmail}:{},...pt.continuationGroupKey?{continuationGroupKey:pt.continuationGroupKey}:{},runtimeId:pe.runtimeId,sourceId:pe.sourceId,sourceLabel:pe.sourceLabel,profileId:pe.profileId,ready:pe.ready,...pe.reasonCode?{reasonCode:pe.reasonCode}:{},choiceKey:en})}let ie=D.filter(pe=>!Y.has(Lg(pe.instanceId,pe.slug)));return[...ce,...ie]}return D},[c,o,Ae,Ee]),re=t.lockedProvider!==null,Ie=C.trim().length>0,st=z(()=>{if(!re)return;let D=new Set;for(let Y of r)ae(Y)||D.add(Y.instanceId);return D},[r,re,ae]),dt=z(()=>{let D=r.filter(IN);if(!re)return D;let Y=[],ce=[];for(let ie of D)ae(ie)?Y.push(ie):ce.push(ie);return[...Y,...ce]},[r,re,ae]),lt=!Ie&&dt.length>0,ct=z(()=>r.map(D=>D.instanceId),[r]),Et=z(()=>{let D=xe;if(C.trim()){let Y=D.map(ce=>({model:ce,score:EN({name:ce.name,...ce.shortName?{shortName:ce.shortName}:{},...ce.subProvider?{subProvider:ce.subProvider}:{},driverKind:ce.driverKind,providerDisplayName:ce.instanceDisplayName,...ce.instanceAccountEmail?{providerAccountEmail:ce.instanceAccountEmail}:{},isFavorite:Ne(ce)},C),isFavorite:Ne(ce),tieBreaker:VC({name:ce.name,...ce.shortName?{shortName:ce.shortName}:{},...ce.subProvider?{subProvider:ce.subProvider}:{},driverKind:ce.driverKind,providerDisplayName:ce.instanceDisplayName,...ce.instanceAccountEmail?{providerAccountEmail:ce.instanceAccountEmail}:{}})})).filter(ce=>ce.score!==null);if(t.lockedProvider!==null){let ce=[];for(let ie of Y)ae(ie.model)&&ce.push(ie);return ce.toSorted((ie,pe)=>{let Ze=ie.score-pe.score;return Ze!==0?Ze:ie.isFavorite!==pe.isFavorite?ie.isFavorite?-1:1:ie.tieBreaker.localeCompare(pe.tieBreaker)}).map(ie=>ie.model)}return Y.toSorted((ce,ie)=>{let pe=ce.score-ie.score;return pe!==0?pe:ce.isFavorite!==ie.isFavorite?ce.isFavorite?-1:1:ce.tieBreaker.localeCompare(ie.tieBreaker)}).map(ce=>ce.model)}return t.lockedProvider!==null?(D=D.filter(Y=>ae(Y)),H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H)):H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H),y.model.sortProviderModelItems(D,{favoriteModelKeys:fe,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?ct:[]})},[fe,xe,ct,ae,t.lockedProvider,C,H,Ne]),ot=z(()=>{if(Ie||H==="favorites")return null;let D=Et.filter(ce=>!ce.isLegacy),Y=Et.filter(ce=>ce.isLegacy);return Y.length===0?null:{key:UC(H),currentModels:D,legacyModels:Y,isExpanded:O.has(H)}},[O,Et,Ie,H]),He=z(()=>ot?[...ot.currentModels,...ot.isExpanded?ot.legacyModels:[]]:Et,[Et,ot]),Se=m!==void 0,ze=z(()=>{if(!Se)return _N;let D=C.trim();return D.length===0?h:h.map(Y=>({action:Y,score:MN(Y,D)})).filter(Y=>Y.score!==null).toSorted((Y,ce)=>Y.score-ce.score||Y.action.title.localeCompare(ce.action.title)).map(Y=>Y.action)},[C,h,Se]),Je=Se&&(!Ie||ze.length>0),qt=z(()=>Je?[...ze.map(D=>_u(D.id)),fd]:ZW,[Je,ze]),X=z(()=>new Map(ze.map(D=>[_u(D.id),D])),[ze]),nn=qt[0]??null,xt=B(D=>{oe(Y=>{let ce=new Set(Y);return ce.has(D)?ce.delete(D):ce.add(D),ce})},[]),mn=B((D,Y)=>y.model.resolvePickerRowAction({disabledReason:a?.(D,Y)??null,continuationLabel:s?i?.(D,Y)??null:null}),[i,a,s]),Tt=B((D,Y)=>{let ce=mn(Y,D);if(ce.kind==="blocked")return;if(ce.kind==="continue"){s?.(Y,D);return}let ie=o.get(Y);if(!ie)return;let pe=Ae.get(Y);if(!pe)return;let Ze=y.model.resolveSelectableModel(pe.driverKind,D,ie);Ze&&l(Y,Ze)},[Ae,o,s,l,mn]),Yt=B(D=>{let Y=hN(D);if(Y){xt(Y);return}if(D===fd){p?.();return}let ce=vN(D);if(ce!==null){m?.(ce);return}let ie=xN(D);if(ie){let Ze=c?.find(pt=>pt.selection.environmentId===ie.environmentId&&pt.runtimeId===ie.runtimeId&&pt.sourceId===ie.sourceId&&pt.profileId===ie.profileId&&(pt.endpointId??void 0)===(ie.endpointId??void 0));if(!Ze||!Ze.legacyInstanceId)return;if(d){d(Ze);return}Tt(Ze.modelId,Ze.legacyInstanceId);return}let pe=HC(D);pe&&Tt(pe.slug,pe.instanceId)},[c,Tt,d,p,m,xt]),Jt=B(D=>{if(N===null)return;let Y=R.findIndex(ie=>DN(D,ie,N)),ce=[...R];Y>=0?ce.splice(Y,1):ce.push({environmentId:N,instanceId:D.instanceId,model:D.slug,...D.runtimeId?{runtimeId:D.runtimeId}:{},...D.sourceId?{sourceId:D.sourceId}:{},...D.profileId?{profileId:D.profileId}:{}}),W({favorites:ce})},[N,R,W]),Mt=z(()=>{let D=new Map,Y=0;for(let ce of He){if(ce.ready===!1||mn(ce.instanceId,ce.slug).kind==="blocked")continue;let ie=y.keybindings.modelPickerJumpCommandForIndex(Y);if(!ie)return D;D.set(Ou(ce),ie),Y+=1}return D},[mn,He]),zn=z(()=>[...Mt.keys()],[Mt]),kn=z(()=>[...xe.map(D=>Ou(D)),...new Set(xe.filter(D=>D.isLegacy).map(D=>UC(D.instanceId))),...Se?[...h.map(D=>_u(D.id)),fd]:[]],[xe,h,Se]),vn=z(()=>{let D=He.map(Y=>Ou(Y));return ot&&D.splice(ot.currentModels.length,0,ot.key),qt.length>0?[...D,...qt]:D},[ot,qt,He]),$n=z(()=>new Map(He.map(D=>[Ou(D),D])),[He]),Vt=B(()=>{let D=E.current?.getScrollableNode();if(!(D instanceof HTMLElement))return;let Y=Math.max(0,D.scrollHeight-D.clientHeight);S(D.scrollTop>1),I(Y-D.scrollTop>1)},[]),Zt=z(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Sn=z(()=>{if(Mt.size===0)return NN;let D={platform:navigator.platform,context:Zt},Y=new Map;for(let[ce,ie]of Mt){let pe=y.keybindings.shortcutLabelForCommand(ee,ie,D);pe&&Y.set(ce,pe)}return Y.size>0?Y:NN},[ee,Mt,Zt]),ho=g===null?f?KC(f):Nu(t.activeInstanceId,t.model):_u(g),zt=z(()=>({favoritesSet:fe,modelJumpLabelByKey:Sn,selectedItemKey:ho}),[fe,Sn,ho]);return y.pane.useKeydown(D=>{if(D.defaultPrevented||D.repeat)return;let Y=y.keybindings.resolveShortcutCommand(D,ee,{platform:navigator.platform,context:Zt}),ce=y.keybindings.modelPickerJumpIndexFromCommand(Y??"");if(ce===null)return;let ie=zn[ce];if(!ie)return;let pe=HC(ie);pe&&(D.preventDefault(),D.stopPropagation(),Tt(pe.slug,pe.instanceId))},{capture:!0}),ye(()=>{S(!1),I(vn.length>5);let D=0,Y=window.requestAnimationFrame(()=>{Vt(),D=window.requestAnimationFrame(Vt)});return()=>{window.cancelAnimationFrame(Y),window.cancelAnimationFrame(D)}},[vn,Vt]),u(eS,{delay:0,children:b("div",{className:"relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden","data-model-picker-content":"true",children:[lt&&u(PN,{selectedInstanceId:H,onSelectInstance:ve,instanceEntries:dt,showFavorites:!0,...st?{disabledInstanceIds:st,getDisabledInstanceTooltip:D=>x("instance.lockedToThread",{name:D.displayName})}:{}}),u(XI,{inline:!0,items:kn,filteredItems:vn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:ho,onItemHighlighted:(D,Y)=>{A.current=typeof D=="string"?D:null,Y.reason==="keyboard"&&Y.index>=0&&E.current?.scrollIndexIntoView?.({index:Y.index,animated:!1})},onValueChange:D=>{typeof D=="string"&&Yt(D)},children:b("div",{className:F("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",lt&&"border-l border-border/70"),children:[f&&t.onClearExecutionSelection?u("div",{className:"shrink-0 border-b border-border/70 px-2 py-1",children:u(te,{size:"sm",variant:"ghost-muted",className:"w-full justify-start",onClick:t.onClearExecutionSelection,children:v("modelPicker.useExecutorAccount")})}):null,u("div",{className:"px-2 pt-2",children:u("div",{className:"border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring",children:u(JI,{ref:T,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:v("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(os,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:C,onChange:D=>w(D.target.value),onKeyDown:D=>{if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),t.onRequestClose?.();return}if(D.key==="Enter"&&A.current){D.preventBaseUIHandler?.(),D.preventDefault(),D.stopPropagation(),Yt(A.current);return}D.stopPropagation()},onMouseDown:D=>D.stopPropagation(),onTouchStart:D=>D.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(ZI,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(gN,{ref:E,data:vn,extraData:zt,keyExtractor:D=>D,renderItem:({item:D,index:Y})=>{if(ot?.key===D)return b(gl,{hideIndicator:!0,index:Y,value:D,"aria-expanded":ot.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:v("modelPicker.legacyModels")}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:v("modelPicker.legacyModelCount",{count:ot.legacyModels.length})})]}),u(Uo,{className:F("size-4 transition-transform",ot.isExpanded&&"rotate-90")})]});let ce=X.get(D);if(ce)return u(nG,{index:Y,itemKey:D,action:ce,showSectionHeader:D===nn});if(D===fd)return u(oG,{index:Y,showSectionHeader:D===nn});let ie=$n.get(D);if(!ie)return null;let pe=ie.ready===!1?{kind:"blocked",reason:v("modelPicker.notReady")}:mn(ie.instanceId,ie.slug);return u(yN,{index:Y,model:ie,instanceId:ie.instanceId,itemKey:Ou(ie),sourceLabel:ie.sourceLabel,providerId:ie.providerId,providerDisplayName:ie.instanceDisplayName,providerAccentColor:ie.instanceAccentColor,providerAccountEmail:ie.instanceAccountEmail,isFavorite:Ne(ie),isSelected:D===ho,showProvider:!0,preferShortName:!re,useTriggerLabel:!1,jumpLabel:Sn.get(D)??null,disabledReason:pe.kind==="blocked"?pe.reason:null,actionLabel:pe.kind==="continue"?pe.label:null,onToggleFavorite:()=>Jt(ie)},D)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:tG,onLayout:Vt,onScroll:Vt,className:F("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",RN({top:k,bottom:L}))})})}),u(YI,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:v("modelPicker.noModelsFound")})]})})]})})});var BN="h-7 min-h-7 gap-1.5 rounded-[var(--control-radius)] px-2.5 text-secondary-label transition-none hover:text-foreground [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";function $r({className:e,size:t="sm",variant:n="ghost",...o}){return u(te,{className:F(BN,e),size:t,variant:n,...o})}function mr({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:F("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function Ri(){return u(pn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function kg({className:e,size:t="sm",variant:n="ghost",...o}){return u(_I,{className:F(BN,e),icon:u(Ri,{}),size:t,variant:n,...o})}function rG(e){let t=e.profileLabel?.trim();if(t)return t;let n=e.profileModelId?.trim();if(n)return n;let o=e.catalogOptions.find(r=>r.slug===e.model);return o?ud(o):e.model}function aG(e,t){return!e?.length||!t?null:e.find(n=>n.runtimeId===t.runtimeId&&n.sourceId===t.sourceId&&n.profileId===t.profileId&&(n.endpointId??void 0)===(t.endpointId??void 0))??null}var zN=ue(function(t){let{t:n}=De(),[o,r]=G(!1),i=ni()&&(t.open??o),s=z(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=aG(t.composerChoices,t.selectedExecutionSelection),f=rG({model:t.model,catalogOptions:d,profileLabel:c?.modelLabel,profileModelId:c?.modelId}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};q(()=>{if(!i)return;let{documentElement:C,body:w}=document,k=C.style.overscrollBehavior,S=w.style.overflow,L=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let T=N=>N instanceof Element&&N.closest("[data-model-picker-content]"),E=N=>{T(N.target)||N.preventDefault()},A=N=>{T(N.target)||N.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",A,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",A,{capture:!0}),C.style.overscrollBehavior=k,w.style.overflow=S,w.style.paddingRight=L}},[i]);let m=(C,w)=>{t.disabled||(t.onInstanceModelChange(C,w),p(!1))},h=(C,w)=>{t.disabled||(t.onContinueInModel?.(C,w),p(!1))},g=C=>{t.disabled||(t.onSelectPluginAction?.(C),p(!1))},v=()=>{t.onManagePlugins?.(),p(!1)},x=t.selectedPluginActionKey==null?null:t.pluginActions?.find(C=>C.id===t.selectedPluginActionKey)??null,y=x?WC(x.description):null;return b(fl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(ml,{render:u($r,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:F("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-42 shrink-0":"max-w-48 shrink sm:max-w-56",t.triggerClassName),disabled:t.disabled}),children:[u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:x?b(be,{children:[u(ts,{className:"size-4 shrink-0"}),b(Qe,{children:[b(Ye,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:x.title}),y?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",y]}):null]}),u(Xe,{side:"top",children:y?`${x.title} \xB7 ${y}`:x.title})]})]}):b(be,{children:[s?u(Ia,{providerId:s.providerId,displayName:s.displayName,accentColor:s.accentColor,className:F("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Qe,{children:[u(Ye,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}),u(Xe,{side:"top",children:t.executionAppliesTo==="next-message"?`${n("modelPicker.nextMessage")}: ${t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}`:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f})]}),t.executionAppliesTo==="next-message"?u("span",{className:"shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/80",children:n("modelPicker.nextMessage")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(Ri,{})})]}),u(pl,{align:"start",className:"before:hidden [--viewport-inline-padding:0]",viewportClassName:"!overflow-hidden rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]",children:u(FN,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>p(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:m,...t.composerChoices?{composerChoices:t.composerChoices}:{},selectedExecutionSelection:t.selectedExecutionSelection??null,...t.onClearExecutionSelection?{onClearExecutionSelection:()=>{t.onClearExecutionSelection?.(),p(!1)}}:{},...t.onChooseExecution?{onChooseExecution:C=>{t.disabled||(t.onChooseExecution?.(C),p(!1))}}:{},...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:g}:{},...t.onManagePlugins?{onManagePlugins:v}:{}})})]})});me();var $N=ue(function(t){let n=_(null);return ye(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Mf,{autoHighlight:!1,mode:"none",onItemHighlighted:o=>{t.onHighlightedItemChange(typeof o=="string"?o:null)},children:u("div",{ref:n,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(_f,{className:"max-h-72 scroll-pb-6",children:u(Rf,{children:t.items.map(o=>u(iG,{item:o,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===o.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},o.id))})}):u("div",{className:"px-5 pt-3.5 pb-7",children:u("p",{className:"text-secondary-label text-xs",children:t.isLoading?t.triggerKind==="skill"?"Searching workspace skills...":"Searching workspace files...":t.emptyStateText??(t.triggerKind==="skill"?"No skills found. Try / to browse provider commands.":t.triggerKind==="path"?"No matching files or folders.":"No matching command.")})})})})}),iG=ue(function(t){let n=t.item.type==="skill"?xM(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Nf,{value:t.item.id,"data-composer-item-id":t.item.id,className:F("cursor-pointer select-none gap-3 rounded-lg px-3 py-2! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",t.isActive&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{t.isActive||t.onHighlight(t.item.id)},onMouseDown:r=>{r.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Gm,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,b("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:o?b(be,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),sa(o)]}):t.item.label}),u("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),n?u(dG,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),sG={app:Ad,repo:oi,project:oi,personal:Yr,system:jd,other:qd},lG={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function dG(e){let t=sG[e.kind];return b(ul,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),lG[e.kind],e.showSkillSuffix?" Skill":null]})}me();var cG=(e,t)=>t.isResponding?e("primaryActions.submitting"):t.compact?t.isLastQuestion?e("primaryActions.submit"):e("primaryActions.next"):t.isLastQuestion?t.questionIndex>0?e("primaryActions.submitAnswers"):e("primaryActions.submitAnswer"):e("primaryActions.nextQuestion"),uG=e=>{e.preventDefault()},Fu=ue(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isConnecting:l,isEnvironmentUnavailable:d,isPreparingWorktree:c,hasSendableContent:f,preserveComposerFocusOnPointerDown:p=!1,showSendWhileRunning:m=!1,onPreviousPendingQuestion:h,onInterrupt:g,onImplementPlanInNewThread:v}){let{t:x}=De(),y=Ot(),C=p?{onPointerDown:uG}:void 0,w=y.settings.useEnvironmentIdentificationMode(),k=s!==null,S=y.devBackdrop.useVisible(w==="artwork"),L=T=>u("button",{type:"button",className:F("flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-[background-color,scale] duration-(--control-duration) hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",T?"size-8 sm:size-7":m&&f?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...C,onClick:g,"aria-label":x("primaryActions.stopGeneration"),children:u("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:u("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(n)return b("div",{className:F("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?L(!0):null,n.questionIndex>0?t?u(te,{size:"icon-sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(Wi,{})}):u(te,{size:"sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(te,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...C,disabled:d||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:cG(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(r)return a?u(te,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(te,{type:"submit",size:"sm",className:"h-9 rounded-l-full rounded-r-none bg-message-action px-4 text-message-action-foreground hover:bg-message-action-hover sm:h-8",...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(Jo,{children:[u(tr,{render:u(te,{size:"sm",variant:"default",className:"h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 bg-message-action px-2 text-message-action-foreground hover:bg-message-action-hover sm:h-8","aria-label":x("primaryActions.implementationActions"),...C,disabled:i||k||l||d}),children:u(pn,{})}),u(er,{align:"end",side:"top",children:u(Zo,{disabled:i||k||l||d,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let I=b("button",{type:"submit",className:F("relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-[background-color,filter,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",S?"bg-transparent text-white enabled:shadow-black/24 enabled:hover:brightness-110":"bg-message-action text-message-action-foreground enabled:shadow-message-action/24 hover:bg-message-action-hover"),...C,disabled:i||k||l||d||!f,"aria-label":d?x("primaryActions.environmentDisconnected"):s||x(l?"primaryActions.connecting":c?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[S?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(nS,{compact:!0})}):null,l||i?u(vf,{className:"size-3.5","aria-hidden":"true"}):u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return o?b(be,{children:[L(!1),m&&f?I:null]}):I});function HN(e){let t=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:b("div",{"data-chat-composer-mobile-pending-compact":"true",className:F("flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/90",!t&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!t&&"px-3 py-2"),onPointerDown:n=>n.preventDefault(),onClick:e.expandMobileComposer,"aria-label":"Write custom answer",children:e.activePendingProgress?.customAnswer||"Write custom answer"}),e.inlineTasksBadge,e.inlineStashBadge,t?u(Fu,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isConnecting:e.isConnecting,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function UN(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}me();function fG(e){return e!==null&&"tagName"in e&&"closest"in e}function Pg(e){return fG(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function GC(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function KN(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function qN(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return KN(t,"accept");case"Escape":return KN(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=GC(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var pG=2e3,mG="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",gG=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function hG(e,t){let n=[];return t<9&&n.push(String(t+1)),e==="accept"&&n.push("Enter"),e==="cancel"&&n.push("Escape"),n.length>0?n.join(" "):void 0}var VN=ue(function({requestId:t,isResponding:n,options:o=gG,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=De(),l=Ot(),d=a==="native"||a==="queued",[c,f]=G(""),p=_([]);q(()=>{f("")},[t]);let m=B(g=>{let v=g==="decline"?c.trim():"";i(t,g,v.length>0?v:void 0)},[c,i,t]),h=B(g=>{let v=p.current.filter(C=>C!==null);if(v.length===0)return;let x=v.findIndex(C=>C===document.activeElement),y=x===-1?g===1?0:v.length-1:(x+g+v.length)%v.length;v[y]?.focus()},[]);return l.pane.useKeydown(g=>{if(n||l.terminalFocus.getOwner()!==null||g.isComposing||g.keyCode===229)return;let v=Pg(g.target);if(r&&(!v||g.metaKey||g.ctrlKey||g.altKey)){let C=l.keybindings.approvalDecisionFromCommand(l.keybindings.resolveShortcutCommand(g,r));if(C!==null&&o.some(w=>w.decision===C)){g.preventDefault(),m(C);return}}if(v)return;let x=qN(g,o);if(x===null)return;if(g.preventDefault(),x.type==="move"){h(x.delta);return}let y=o[x.index];y&&m(y.decision)},{target:"document"}),u(be,{children:o.map((g,v)=>{let x=v<9?v+1:null,y=b(te,{ref:C=>{p.current[v]=C},size:"xs",variant:g.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":hG(g.decision,v),className:`${mG}${g.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>m(g.decision),children:[u("span",{className:"min-w-0 break-words",children:g.label}),x===null?null:u(Ef,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},g.decision);return g.decision!=="decline"||!d?y:b(Ja,{children:[u(hf,{type:"text",value:c,disabled:n,maxLength:pG,placeholder:s(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":s("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:C=>f(C.target.value),onKeyDown:C=>{if(C.key==="Enter"){C.preventDefault(),m("decline");return}C.key==="Escape"&&(C.preventDefault(),c.length>0?f(""):C.currentTarget.blur())}}),y]},g.decision)})})});me();var vG=["command","cmd"],xG=["file_path","filePath","path","notebook_path","notebookPath"],yG=["url"],CG=["query","q"],bG=["name","skill","skill_name","skillName"],WN=["toolName","tool_name"],GN=["description"],IG=[],SG=[];function Va(e,t,n){for(let o of t){let a=e.find(i=>i.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function wG(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function TG(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function QN(e){let t=e.args??IG,n=e.fileChanges??SG,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},i=null,s=a,l=null;switch(e.requestKind){case"command":{let d=Va(t,vG,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Va(t,xG,o)??TG(n);d!==null&&(i=wG(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Va(t,yG,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Va(t,CG,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Va(t,bG,o)??Va(t,WN,o),l=Va(t,GN,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Va(t,WN,o),l=Va(t,GN,o),t.length>0&&(s={shape:"none"});break}case"mcp-elicitation":{i=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:i,body:s,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var LG={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},kG={command:"approval.title.command","file-read":"approval.title.fileReadGeneric","file-change":"approval.title.fileChangeGeneric","web-fetch":"approval.title.webFetch","web-search":"approval.title.webSearch",skill:"approval.title.skillGeneric","mcp-tool":"approval.title.toolGeneric",tool:"approval.title.toolGeneric","mcp-elicitation":"approval.title.appAccessGeneric"},PG={command:"approval.commandLabel","file-read":"approval.fileReadLabel","file-change":"approval.fileChangeLabel","web-fetch":"approval.webFetchLabel","web-search":"approval.webSearchLabel",skill:"approval.skillLabel","mcp-tool":"approval.mcpToolLabel",tool:"approval.toolLabel","mcp-elicitation":"approval.appAccessLabel"},AG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function XN(e,t){let n=e.subject!==null?LG[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(kG[e.kind])}function YN(e,t){return t(PG[e])}function JN(e,t){return t(AG[e])}function ZN(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=jN(t.oldText??""),o=jN(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3716
3716
  +++ b/${e.path}
3717
3717
  `,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
3718
3718
  `,i=[...n.map(s=>`-${s}`),...o.map(s=>`+${s}`)];return`${r}${a}${i.join(`
3719
3719
  `)}
3720
- `}function GN(e){if(e.length===0)return[];let t=e.split(`
3721
- `);return t.at(-1)===""?t.slice(0,-1):t}function ZN(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function e_(e){return{additions:e.additions??0,deletions:e.deletions??0}}me();me();var Qde=(()=>{try{return!1}catch{return!1}})(),t_=/(?=^From [a-f0-9]+ .+$)/m,jC=/(?=^diff --git)/gm;var n_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,o_=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,r_=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,a_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var PG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Xde={...PG,hunkLineCount:1};var Yde=Object.freeze({fromStart:0,fromEnd:0});function QC(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var AG=new TextEncoder,EG=new TextDecoder("utf-8",{ignoreBOM:!0}),MG=/[\uD800-\uDFFF]/,XC=1024,hd=new Uint8Array(XC);function i_(){hd.length!==XC&&(hd=new Uint8Array(XC))}function Pn(e){if(e.length===0)return e;if(MG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;hd.length<t&&(hd=new Uint8Array(t));let{written:n}=AG.encodeInto(e,hd);return EG.decode(hd.subarray(0,n))}function l_(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let o=t.hunkContent[n];if(o.type!=="change")continue;let r=NG(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}RG(t,e)}}function RG(e,t){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],a=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||a.type!=="context")continue;let i=r.additions>0,s=i?t.additionLines:t.deletionLines,l=i?r.additionLineIndex:r.deletionLineIndex,d=i?r.additions:r.deletions,c=s[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(s[l+v]!==c){f=!1;break}if(!f)continue;let p=0;for(;p<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-p]===c;)p++;if(p===0)continue;r.additionLineIndex-=p,r.deletionLineIndex-=p;let m=r.additionLineIndex+r.additions,h=r.deletionLineIndex+r.deletions,g=n[o+1];g?.type==="context"?(g.lines+=p,g.additionLineIndex=m,g.deletionLineIndex=h):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:h}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function NG(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,i=Math.min(n,o),s=Math.abs(o-n);if(i===0||s===0||i*(s+1)>4096)return null;let l=[];for(let g=0;g<n;g++)l.push(s_(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(s_(e.additionLines[a+g]??""));let c=o>n,f=0,p=-1;for(let g=0;g<=s;g++){let v=0;for(let x=0;x<i;x++)v+=DG(l[x+(c?0:g)],d[x+(c?g:0)]);g===0?p=v+i*.5:v>p&&(p=v,f=g)}if(f===0)return null;let m=[],h=(g,v,x,y)=>{(g>0||v>0)&&m.push({type:"change",deletions:g,additions:v,deletionLineIndex:x,additionLineIndex:y})};return c?(h(0,f,r,a),h(i,i,r,a+f),h(0,o-i-f,r+i,a+f+i)):(h(f,0,r,a),h(i,i,r+f,a),h(n-i-f,0,r+f+i,a+i)),m}var _G=/\s+/g;function s_(e){return e.replace(_G,"")}function DG(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(;r<o&&e[r]===t[r];)r++;let a=0;for(;a<o-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/n}function OG(e,t,n){try{return FG(e,t,n)}finally{i_()}}function FG(e,t,n=!1){let o=WG(e),r=o?$G(e):HG(e),a,i=[];for(let s of r){if(o&&!jC.test(s)){if(a==null)a=Pn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!UG(s)){if(a==null)a=Pn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=BG(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function BG(e,{cacheKey:t,isGitDiff:n=jC.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=v_(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=m_(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=h_(h),v=0,x=0;if(g==null||l==null){if(l!=null){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&o!=null&&r!=null?d_(r.contents):[],deletionLines:!d&&o!=null&&r!=null?d_(o.contents):[],cacheKey:f_(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let T of m){if(T.startsWith("diff --git")){let A=T.trim().match(r_),N=A?.[1]??A?.[2],R=A?.[3]??A?.[4];if(N==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",T);continue}l.name=Pn(R.trim()),N!==R&&(l.prevName=Pn(N.trim()));continue}let E=T.startsWith("---")||T.startsWith("+++")?T.match(n?o_:n_):null;if(E!=null){let[,A,N]=E;if(A==="---"&&N!=="/dev/null"){let R=Pn(N.trim());l.prevName=R,l.name=R}else A==="+++"&&N!=="/dev/null"&&(l.name=Pn(N.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=Pn(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=Pn(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=Pn(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Pn(T.slice(17).trim())),T.startsWith("similarity index")&&(T.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),T.startsWith("index ")){let[,A,N,R]=T.trim().match(a_)??[];A!=null&&(l.prevObjectId=Pn(A)),N!=null&&(l.newObjectId=Pn(N)),R!=null&&(l.mode=Pn(R))}T.startsWith("rename from ")&&(l.prevName=Pn(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=Pn(T.slice(10).trim()))}}continue}let y,C;for(;m.length>0&&(m[m.length-1]===`
3720
+ `}function jN(e){if(e.length===0)return[];let t=e.split(`
3721
+ `);return t.at(-1)===""?t.slice(0,-1):t}function e_(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function t_(e){return{additions:e.additions??0,deletions:e.deletions??0}}me();me();var Yde=(()=>{try{return!1}catch{return!1}})(),n_=/(?=^From [a-f0-9]+ .+$)/m,jC=/(?=^diff --git)/gm;var o_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,r_=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,a_=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,i_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var EG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Jde={...EG,hunkLineCount:1};var Zde=Object.freeze({fromStart:0,fromEnd:0});function QC(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var MG=new TextEncoder,RG=new TextDecoder("utf-8",{ignoreBOM:!0}),NG=/[\uD800-\uDFFF]/,XC=1024,pd=new Uint8Array(XC);function s_(){pd.length!==XC&&(pd=new Uint8Array(XC))}function Rn(e){if(e.length===0)return e;if(NG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;pd.length<t&&(pd=new Uint8Array(t));let{written:n}=MG.encodeInto(e,pd);return RG.decode(pd.subarray(0,n))}function d_(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let o=t.hunkContent[n];if(o.type!=="change")continue;let r=DG(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}_G(t,e)}}function _G(e,t){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],a=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||a.type!=="context")continue;let i=r.additions>0,s=i?t.additionLines:t.deletionLines,l=i?r.additionLineIndex:r.deletionLineIndex,d=i?r.additions:r.deletions,c=s[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(s[l+v]!==c){f=!1;break}if(!f)continue;let p=0;for(;p<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-p]===c;)p++;if(p===0)continue;r.additionLineIndex-=p,r.deletionLineIndex-=p;let m=r.additionLineIndex+r.additions,h=r.deletionLineIndex+r.deletions,g=n[o+1];g?.type==="context"?(g.lines+=p,g.additionLineIndex=m,g.deletionLineIndex=h):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:h}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function DG(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,i=Math.min(n,o),s=Math.abs(o-n);if(i===0||s===0||i*(s+1)>4096)return null;let l=[];for(let g=0;g<n;g++)l.push(l_(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(l_(e.additionLines[a+g]??""));let c=o>n,f=0,p=-1;for(let g=0;g<=s;g++){let v=0;for(let x=0;x<i;x++)v+=FG(l[x+(c?0:g)],d[x+(c?g:0)]);g===0?p=v+i*.5:v>p&&(p=v,f=g)}if(f===0)return null;let m=[],h=(g,v,x,y)=>{(g>0||v>0)&&m.push({type:"change",deletions:g,additions:v,deletionLineIndex:x,additionLineIndex:y})};return c?(h(0,f,r,a),h(i,i,r,a+f),h(0,o-i-f,r+i,a+f+i)):(h(f,0,r,a),h(i,i,r+f,a),h(n-i-f,0,r+f+i,a+i)),m}var OG=/\s+/g;function l_(e){return e.replace(OG,"")}function FG(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(;r<o&&e[r]===t[r];)r++;let a=0;for(;a<o-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/n}function BG(e,t,n){try{return zG(e,t,n)}finally{s_()}}function zG(e,t,n=!1){let o=jG(e),r=o?UG(e):KG(e),a,i=[];for(let s of r){if(o&&!jC.test(s)){if(a==null)a=Rn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!qG(s)){if(a==null)a=Rn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=$G(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function $G(e,{cacheKey:t,isGitDiff:n=jC.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=x_(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=g_(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=v_(h),v=0,x=0;if(g==null||l==null){if(l!=null){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&o!=null&&r!=null?c_(r.contents):[],deletionLines:!d&&o!=null&&r!=null?c_(o.contents):[],cacheKey:p_(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let T of m){if(T.startsWith("diff --git")){let A=T.trim().match(a_),N=A?.[1]??A?.[2],R=A?.[3]??A?.[4];if(N==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",T);continue}l.name=Rn(R.trim()),N!==R&&(l.prevName=Rn(N.trim()));continue}let E=T.startsWith("---")||T.startsWith("+++")?T.match(n?r_:o_):null;if(E!=null){let[,A,N]=E;if(A==="---"&&N!=="/dev/null"){let R=Rn(N.trim());l.prevName=R,l.name=R}else A==="+++"&&N!=="/dev/null"&&(l.name=Rn(N.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=Rn(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=Rn(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=Rn(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Rn(T.slice(17).trim())),T.startsWith("similarity index")&&(T.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),T.startsWith("index ")){let[,A,N,R]=T.trim().match(i_)??[];A!=null&&(l.prevObjectId=Rn(A)),N!=null&&(l.newObjectId=Rn(N)),R!=null&&(l.mode=Rn(R))}T.startsWith("rename from ")&&(l.prevName=Rn(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=Rn(T.slice(10).trim()))}}continue}let y,C;for(;m.length>0&&(m[m.length-1]===`
3722
3722
  `||m[m.length-1]==="\r"||m[m.length-1]===`\r
3723
- `||m[m.length-1]==="");)m.pop();let{additionStart:w,deletionStart:k}=g;c=d?c:k-1,f=d?f:w-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:w,additionLines:v,deletionCount:g.deletionCount,deletionStart:k,deletionLines:x,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:f_(g.hunkContext),hunkSpecs:Pn(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},L=0,I=0;for(let T=1;T<m.length;T++){let E=m[T];if(L>=S.additionCount&&I>=S.deletionCount&&!E.startsWith("\\")){if(a&&KG(E)&&!qG(E))throw Error("parsePatchContent: hunk has more lines than expected");break}let A=E[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${E}"`),console.error("processFile: invalid rawLine:",E);continue}let N=GG(A);if(N==="addition"){if(a&&L>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),f++,L++,d&&l.additionLines.push(R),y.additions++,v++,C="addition"}else if(N==="deletion"){if(a&&I>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),c++,I++,d&&l.deletionLines.push(R),y.deletions++,x++,C="deletion"}else if(N==="context"){if(a&&(I>=S.deletionCount||L>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=YC(E);(y==null||y.type!=="context")&&(y=JC("context",c,f),S.hunkContent.push(y)),f++,c++,L++,I++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),y.lines++,C="context"}else if(N==="metadata"&&y!=null){if(y.type==="context"?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):C==="deletion"?S.noEOFCRDeletions=!0:C==="addition"&&(S.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=QC(l.additionLines[R]))}if(d&&(C==="deletion"||C==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=QC(l.deletionLines[R]))}}}if(a&&(L!==S.additionCount||I!==S.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");S.additionLines=v,S.deletionLines=x,S.collapsedBefore=Math.max(S.additionStart-1-i,0),l.hunks.push(S),i=S.additionStart+S.additionCount-1;for(let T of S.hunkContent)T.type==="context"?(S.splitLineCount+=T.lines,S.unifiedLineCount+=T.lines):(S.splitLineCount+=Math.max(T.additions,T.deletions),S.unifiedLineCount+=T.deletions+T.additions);S.splitLineStart=l.splitLineCount+S.collapsedBefore,S.unifiedLineStart=l.unifiedLineCount+S.collapsedBefore,l.splitLineCount+=S.collapsedBefore+S.splitLineCount,l.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(l!=null){if(a&&d&&!n&&l.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(l.hunks.length>0&&!d&&l.additionLines.length>0&&l.deletionLines.length>0){let p=l.hunks[l.hunks.length-1],m=p.additionStart+p.additionCount-1,h=l.additionLines.length,g=Math.max(h-m,0);l.splitLineCount+=g,l.unifiedLineCount+=g}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":(o==null||o.contents==="")&&r!=null&&r.contents!==""?l.type="new":o!=null&&o.contents!==""&&(r==null||r.contents==="")&&(l.type="deleted")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),l_(l),l}}function p_(e,t,n=!1){let o=[],r=zG(e)?e.split(t_):[e];for(let a of r)try{o.push(OG(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function zG(e){return e.startsWith("From ")||e.includes(`
3724
- From `)}function d_(e){let t=m_(e);for(let n=0;n<t.length;n++)t[n]=Pn(t[n]);return t}function m_(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3725
- `,n);if(o===-1)break;t.push(e.slice(n,o+1)),n=o+1}return n<e.length&&t.push(e.slice(n)),t}function $G(e){return v_(e,"diff --git")}function HG(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=ZC(e,o);if(r<=0&&a<=0){if(g_(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=ZC(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=h_(e.slice(o,s));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=s;continue}let l=e[o];if(l==="\\"){o=s;continue}l===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):l==="-"?r=Math.max(r-1,0):l==="+"&&(a=Math.max(a-1,0)),o=s}return t.push(e.slice(n)),t}function UG(e){return g_(e,0)}function g_(e,t){let n=ZC(e,t);return c_(e,t,"---")&&c_(e,n,"+++")}function c_(e,t,n){if(!e.startsWith(n,t))return!1;let o=e[t+n.length];if(o!==" "&&o!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){let a=e[r];if(a===`
3723
+ `||m[m.length-1]==="");)m.pop();let{additionStart:w,deletionStart:k}=g;c=d?c:k-1,f=d?f:w-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:w,additionLines:v,deletionCount:g.deletionCount,deletionStart:k,deletionLines:x,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:p_(g.hunkContext),hunkSpecs:Rn(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},L=0,I=0;for(let T=1;T<m.length;T++){let E=m[T];if(L>=S.additionCount&&I>=S.deletionCount&&!E.startsWith("\\")){if(a&&VG(E)&&!WG(E))throw Error("parsePatchContent: hunk has more lines than expected");break}let A=E[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${E}"`),console.error("processFile: invalid rawLine:",E);continue}let N=QG(A);if(N==="addition"){if(a&&L>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),f++,L++,d&&l.additionLines.push(R),y.additions++,v++,C="addition"}else if(N==="deletion"){if(a&&I>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),c++,I++,d&&l.deletionLines.push(R),y.deletions++,x++,C="deletion"}else if(N==="context"){if(a&&(I>=S.deletionCount||L>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=YC(E);(y==null||y.type!=="context")&&(y=JC("context",c,f),S.hunkContent.push(y)),f++,c++,L++,I++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),y.lines++,C="context"}else if(N==="metadata"&&y!=null){if(y.type==="context"?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):C==="deletion"?S.noEOFCRDeletions=!0:C==="addition"&&(S.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=QC(l.additionLines[R]))}if(d&&(C==="deletion"||C==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=QC(l.deletionLines[R]))}}}if(a&&(L!==S.additionCount||I!==S.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");S.additionLines=v,S.deletionLines=x,S.collapsedBefore=Math.max(S.additionStart-1-i,0),l.hunks.push(S),i=S.additionStart+S.additionCount-1;for(let T of S.hunkContent)T.type==="context"?(S.splitLineCount+=T.lines,S.unifiedLineCount+=T.lines):(S.splitLineCount+=Math.max(T.additions,T.deletions),S.unifiedLineCount+=T.deletions+T.additions);S.splitLineStart=l.splitLineCount+S.collapsedBefore,S.unifiedLineStart=l.unifiedLineCount+S.collapsedBefore,l.splitLineCount+=S.collapsedBefore+S.splitLineCount,l.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(l!=null){if(a&&d&&!n&&l.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(l.hunks.length>0&&!d&&l.additionLines.length>0&&l.deletionLines.length>0){let p=l.hunks[l.hunks.length-1],m=p.additionStart+p.additionCount-1,h=l.additionLines.length,g=Math.max(h-m,0);l.splitLineCount+=g,l.unifiedLineCount+=g}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":(o==null||o.contents==="")&&r!=null&&r.contents!==""?l.type="new":o!=null&&o.contents!==""&&(r==null||r.contents==="")&&(l.type="deleted")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),d_(l),l}}function m_(e,t,n=!1){let o=[],r=HG(e)?e.split(n_):[e];for(let a of r)try{o.push(BG(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function HG(e){return e.startsWith("From ")||e.includes(`
3724
+ From `)}function c_(e){let t=g_(e);for(let n=0;n<t.length;n++)t[n]=Rn(t[n]);return t}function g_(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3725
+ `,n);if(o===-1)break;t.push(e.slice(n,o+1)),n=o+1}return n<e.length&&t.push(e.slice(n)),t}function UG(e){return x_(e,"diff --git")}function KG(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=ZC(e,o);if(r<=0&&a<=0){if(h_(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=ZC(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=v_(e.slice(o,s));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=s;continue}let l=e[o];if(l==="\\"){o=s;continue}l===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):l==="-"?r=Math.max(r-1,0):l==="+"&&(a=Math.max(a-1,0)),o=s}return t.push(e.slice(n)),t}function qG(e){return h_(e,0)}function h_(e,t){let n=ZC(e,t);return u_(e,t,"---")&&u_(e,n,"+++")}function u_(e,t,n){if(!e.startsWith(n,t))return!1;let o=e[t+n.length];if(o!==" "&&o!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){let a=e[r];if(a===`
3726
3726
  `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function ZC(e,t){let n=e.indexOf(`
3727
- `,t);return n===-1?e.length:n+1}function KG(e){let t=e[0];return t==="+"||t==="-"||t===" "}function qG(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3728
- `&&n!=="\r")return!1}return!0}function h_(e){if(!e.startsWith("@@ -"))return;let t=4,n=Mg(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Mg(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Mg(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=Mg(e,t+1);if(c==null)return;s=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=VG(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function Mg(e,t){let n=t,o=0;for(;n<e.length;n++){let r=e.charCodeAt(n)-48;if(r<0||r>9)break;o=o*10+r}if(n!==t)return{value:o,endIndex:n}}function VG(e){return e.endsWith(`\r
3727
+ `,t);return n===-1?e.length:n+1}function VG(e){let t=e[0];return t==="+"||t==="-"||t===" "}function WG(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3728
+ `&&n!=="\r")return!1}return!0}function v_(e){if(!e.startsWith("@@ -"))return;let t=4,n=Ag(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Ag(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Ag(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=Ag(e,t+1);if(c==null)return;s=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=GG(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function Ag(e,t){let n=t,o=0;for(;n<e.length;n++){let r=e.charCodeAt(n)-48;if(r<0||r>9)break;o=o*10+r}if(n!==t)return{value:o,endIndex:n}}function GG(e){return e.endsWith(`\r
3729
3729
  `)?e.slice(0,-2):e.endsWith(`
3730
- `)?e.slice(0,-1):e}function WG(e){return e.startsWith("diff --git")||e.includes(`
3731
- diff --git`)}function v_(e,t){if(e.length===0)return[""];let n=`
3732
- ${t}`,o=e.startsWith(t)?0:u_(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=u_(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function u_(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function f_(e){return e==null?e:Pn(e)}function GG(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function YC(e){let t=e.slice(1);return Pn(t===""?`
3733
- `:t)}function JC(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var x_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function C_(e){return e==="dark"?x_.dark:x_.light}var b_=2166136261,I_=16777619,jG=2654435769,QG=2246822507;function y_(e,t=b_,n=I_){let o=t>>>0;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,n)>>>0;return o>>>0}function XG(e,t="diff-panel"){let n=e.trim(),o=y_(n,b_,I_).toString(36),r=y_(n,jG,QG).toString(36);return`${t}:${n.length}:${o}:${r}`}function eb(e){if(!e.isPartial)return e;let t=0,n=0,o=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:n};return t+=r.splitLineCount,n+=r.unifiedLineCount,a});return{...e,hunks:o,splitLineCount:t,unifiedLineCount:n,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function S_(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=p_(o,XG(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(eb):i.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:o,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:o,reason:"Failed to parse patch. Showing raw patch."}}}function w_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function T_({fileChange:e,onOpenDiff:t}){let{t:n}=_e(),[o,r]=G(!1),a=z(()=>JN(e),[e]),i=e_(e);return b("div",{className:"min-w-0",children:[b("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[u("span",{className:"min-w-0 shrink truncate font-mono text-[11px] text-foreground/85",children:e.path}),u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:n("approval.diff.stat",{additions:i.additions,deletions:i.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):b(ne,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(ln,{className:"size-3 shrink-0"}):u(zo,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(ne,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(YG,{path:e.path,unifiedDiff:a}):null]})}function YG({path:e,unifiedDiff:t}){let n=Ot().theme.useResolvedTheme(),o=z(()=>{let r=S_(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:w_(eb(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[n,t]);return o.length===0?u("pre",{"aria-label":e,className:"mt-1 max-h-56 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):u("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:u(eS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:C_(n),themeType:n,stickyHeaders:!1}})})}var JG="block max-h-20 min-w-0 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",L_=ue(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=_e(),i=jN(t),{body:s}=i,l=ZN(i.fileChanges);return b("div",{"aria-label":XN(i.kind,a),className:F("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:QN(i,a)}),n>1?b("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),s.shape==="none"?null:u("code",{"aria-label":YN(s.shape,a),className:F(JG,s.shape==="path"||s.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:s.shape==="command"?s.command:s.shape==="path"?s.path:s.shape==="url"?s.url:s.shape==="query"?s.query:s.text}),i.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:i.description}),i.fileChanges.map((d,c)=>u(T_,{fileChange:d,onOpenDiff:o},l[c])),i.args.length===0?null:b("details",{className:"min-w-0","data-approval-args":"true",children:[u("summary",{className:"cursor-pointer text-[11px] text-muted-foreground",children:a("approval.body.detailsSummary")}),u("dl",{"aria-label":a("approval.body.argumentsLabel"),className:"mt-1 grid max-h-32 min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 text-[11px] [scrollbar-width:thin]",tabIndex:0,children:i.args.map(d=>b("div",{className:"col-span-2 grid grid-cols-subgrid",children:[u("dt",{className:"font-mono text-muted-foreground",children:d.name}),u("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:d.value})]},d.name))})]})]})});var tb=ue(function(t){return u(L_,{...t})});me();var nb=ue(function(t){let{t:n}=_e(),[o,r]=G(!1),[a,i]=G(!1),s=t.decision,l=s.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=s.askedBy.kind==="plugin"?s.askedBy.pluginId:null;return b("div",{className:F("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:d(s.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),s.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),s.detail===null?null:u("button",{type:"button",className:"min-w-0 truncate text-left font-mono text-[11px] text-muted-foreground",onClick:()=>r(f=>!f),children:o?s.detail.text.slice(0,4e3):s.detail.text.split(`
3734
- `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(ne,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{i(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function Rg(e){return e.id??e.label}function ob(e,t){return Array.from(new Set((t??[]).flatMap(n=>{let o=e.options.find(r=>r.id!==void 0?r.id===n:r.label===n.trim());return o?[Rg(o)]:[]})))}function ZG(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function rb(e,t){let n=ZG(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=ob(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function e6(e,t){let n={};for(let o of e){let r=rb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function t6(e,t){return e.reduce((n,o)=>rb(o,t[o.id])?n+1:n,0)}function k_(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,i=r?rb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=t6(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?ob(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:e6(e,t)!==null,canAdvance:!!i}}me();var P_=ue(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){if(t.length===0)return null;let s=t[0];return s?u(n6,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),n6=ue(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=_e(),l=Ot(),d=k_(t.questions,o,r),c=d.activeQuestion,f=_(null),p=_(i),[m,h]=G(null),[g,v]=G(null),x=g!==null&&g===c?.id;q(()=>{p.current=i},[i]),q(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){h(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&h(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),q(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=B((w,k)=>{if(c?.multiSelect){a(w,k);return}h({questionId:w,optionLabel:k}),a(w,k),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(w=>{if(!c||n||x||w.metaKey||w.ctrlKey||w.altKey||w.isComposing||w.keyCode===229||Eg(w.target))return;let k=GC(w.key,c.options.length);if(k===null)return;let S=c.options[k];S&&(w.preventDefault(),y(c.id,Rg(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(WI,{className:"py-2",open:!x,onOpenChange:w=>{v(w?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(jI,{title:s(x?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":x?"collapsed":"expanded",className:"group -my-1 flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-(--control-duration) hover:bg-muted/40",children:[u("span",{className:"text-xs font-medium text-muted-foreground group-hover:text-foreground/85",children:c.header}),t.questions.length>1?b("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,x?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(ln,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",x&&"rotate-180")})]})}),u(GI,{className:"px-3 sm:px-4",children:b("div",{className:"pt-2 pb-0.5",children:[u("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-sm text-foreground/85","data-pending-user-input-body":c.kind??"question",tabIndex:0,children:c.kind==="plan"?u(rr,{text:c.question,cwd:void 0,isStreaming:!1}):u("p",{className:"whitespace-pre-wrap",children:c.question})}),c.multiSelect?u("p",{className:"mt-1 text-secondary-label text-xs",children:s("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((w,k)=>{let S=Rg(w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),T=k<9?k+1:null,E=F("group relative flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors duration-(--control-duration) pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",I?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),A=b(be,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:w.label}),w.description&&w.description!==w.label?u("span",{className:"text-secondary-label text-[11px]",children:w.description}):null]}),I?u(xo,{className:"size-icon-2 shrink-0 text-primary"}):T!==null?u("kbd",{className:F("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:T}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{y(c.id,S)},className:E,children:A},`${c.id}:${S}`)})})]})})]})});me();var A_=ue(function({planTitle:t}){let{t:n}=_e();return u("div",{className:"px-3 py-2 sm:px-4",children:b("div",{className:"flex flex-wrap items-center gap-2",children:[u("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?u("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function E_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(qN,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function M_(e){return e.occupant.kind!=="user-input"?null:u(P_,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var R_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:b("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:E_(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,className:"px-3 pt-2 sm:px-4"}),u("div",{className:"flex flex-wrap items-center justify-end gap-1 px-3 pt-2 pb-3 sm:px-4",children:E_(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:u("div",{"data-chat-composer-collapsed-controls":"true",children:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:M_,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[M_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(A_,{planTitle:HN(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function N_(e,t){let n=R_[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var aue=Object.keys(R_);me();me();var Ng=["approval-required","auto-accept-edits","auto","full-access"];var o6={"approval-required":Wd,"auto-accept-edits":Zr,auto:li,"full-access":si},r6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function _g(){let{t:e}=_e();return B(t=>{let n=r6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:o6[t]}},[e])}var __=ue(function(t){let{t:n}=_e(),o=_g();return b(er,{children:[u(or,{render:u(ne,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":"More composer controls"}),children:u(Zo,{"aria-hidden":"true",className:"size-4"})}),b(nr,{align:"start",children:[t.traitsMenuContent?b(be,{children:[t.traitsMenuContent,u(di,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Mode"}),b(Pa,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(wr,{value:"default",children:"Chat"}),u(wr,{value:"plan",children:"Plan"})]}),u(di,{})]}):null,t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),u(Pa,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Ng.map(r=>u(wr,{value:r,children:o(r).label},r))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?u(Pa,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(wr,{value:r.id,children:r.name},r.id))}):u("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});me();function D_(e,t){let n=e?.nativeModes??[];if(n.length===0)return null;let o=n.find(r=>r.id===t)??n.find(r=>r.id===e?.currentNativeModeId);return o?{modes:n,current:o}:null}function O_(e){return e.description??e.name}var F_=ue(function(t){let{current:n,modes:o}=t.nativeMode,r=O_(n);return!t.canSwitch||o.length<2?b(Xe,{children:[b(Je,{render:u(qr,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(hr,{icon:pl}),u("span",{children:n.name})]}),b(Ye,{side:"top",children:[u("span",{className:"block font-medium",children:r}),o.length>1?b("span",{className:"mt-1 block text-muted-foreground text-xs",children:["Agent modes: ",o.map(a=>a.name).join(", ")]}):null]})]}):b(Xe,{children:[b(Cf,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[b(Je,{render:u(Ag,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(hr,{icon:pl}),u(Sf,{children:n.name})]}),u(If,{alignItemWithTrigger:!1,children:o.map(a=>u(bf,{value:a.id,hideIndicator:!0,className:"min-w-56 py-2",children:b("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:a.name}),a.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:a.description}):null]})},a.id))})]}),u(Ye,{side:"top",children:r})]})});function ab(e){return e.items.length===0?null:e.currentSearchKey===e.highlightedSearchKey&&e.highlightedItemId&&e.items.some(t=>t.id===e.highlightedItemId)?e.highlightedItemId:e.items[0]?.id??null}function ib(e,t){let n=e.name.toLowerCase(),o=ca(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[Kr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Kr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Kr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Kr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Kr({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function B_(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=po(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=ib(i,r);s!==null&&kg(a,{item:i,score:s,tieBreaker:`${ca(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function a6(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?ib(e.skill,a):0;return i!==null?i:"skill".startsWith(t)?Number.MAX_SAFE_INTEGER:null}let n=e.type==="slash-command"?e.command.toLowerCase():e.command.name.toLowerCase(),o=e.description.toLowerCase(),r=[Kr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Kr({value:o,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26})].filter(a=>a!==null);return r.length===0?null:Math.min(...r)}function z_(e,t){let n=po(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=a6(r,n);a!==null&&kg(o,{item:r,score:a,tieBreaker:r.type==="slash-command"?`0\0${r.command}`:r.type==="provider-slash-command"?`1\0${r.command.name}\0${r.provider}`:`2\0${r.skill.name}\0${r.provider}`},Number.POSITIVE_INFINITY)}return o.map(r=>r.item)}function i6(e){return typeof e!="string"?null:e.trim()||null}function s6(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function l6(e,t){return e?.find(o=>o.id===t)?.value}function $_(e,t){let n=i6(t);return n?e.options.length===0?n:e.promptInjectedValues?.includes(n)&&e.options.some(o=>o.id===n)?e.options.find(o=>o.isDefault)?.id:e.options.some(o=>o.id===n)?n:e.currentValue??e.options.find(o=>o.isDefault)?.id:e.currentValue??e.options.find(o=>o.isDefault)?.id}function d6(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?$_(e,t):$_(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function Dg(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(s6).map(r=>d6(r,l6(n,r.id)??r.currentValue))}function Ys(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function sb(e){if(!e)return;if(e.type==="boolean")return typeof e.currentValue=="boolean"?e.currentValue?"On":"Off":void 0;let t=Ys(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function Og(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Ys(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function Uu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function H_(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3735
- ${n}`}me();var c6=`Ultrathink:
3736
- `;function u6(){let{t:e}=_e();return u(ml,{variant:"outline",className:"inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4",children:e("traits.default")})}function U_(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function Fg(e){if(!e)return null;let t=Ys(e);return typeof t=="string"?t:null}function f6(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=Dg({caps:l,selections:a}),c=d.filter(I=>I.type==="select"),f=d.filter(I=>I.type==="boolean"),p=c[0]??null,m=c.find(I=>I.id==="contextWindow")??null,h=c.find(I=>I.id==="agent")??null,g=f.find(I=>I.id==="fastMode")??null,v=f.find(I=>I.id==="thinking")??null,x=i&&(p?.promptInjectedValues?.length??0)>0&&Uu(r),y=x&&Uu(r.replace(/^Ultrathink:\s*/i,"")),C=(x?"ultrathink":Fg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,k=Fg(m),S=Fg(h),L=h?sb(h):null;return{caps:l,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:h,fastModeDescriptor:g,thinkingDescriptor:v,effort:C,thinkingEnabled:w,contextWindow:k,ultrathinkPromptControlled:x,ultrathinkInBodyText:y,selectedAgent:S,selectedAgentLabel:L}}function lb(e){let t=f6(e.modelApi,e.provider,e.models,e.model,e.prompt,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,i=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:i,hasAnyControls:n||o||r||a||i}}function db(e){return lb(e).hasAnyControls}var cb=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=_e(),p=Ot(),m=p.draft.useStore(I=>I.setProviderModelOptions),h=B(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let T=c.threadRef??c.draftId;T&&m(T,t,I,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,m]),{descriptors:g,selectDescriptors:v,booleanDescriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,hasAnyControls:k}=lb({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{h(Og(I))},L=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){let E=a.trim().length===0?c6:H_(a,"ultrathink");i(E);return}if(!(w&&I.id===y?.id)){if(C&&I.id===y?.id){let E=a.replace(/^Ultrathink:\s*/i,"");i(E)}S(U_(g,I.id,T))}}};return k?b(be,{children:[v.map((I,T)=>{let E=C&&I.id===y?.id?"ultrathink":Fg(I)??"";return b("div",{children:[T>0?u(di,{}):null,b(rc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:I.label}),w&&I.id===y?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Pa,{value:E,onValueChange:A=>L(I,A),children:I.options.map(A=>u(wr,{value:A.id,hideIndicator:!0,closeOnClick:!0,disabled:w&&I.id===y?.id,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:b("span",{className:"min-w-0 truncate",children:[A.label,A.isDefault?b(be,{children:[" ",u(u6,{})]}):null]})}),A.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:A.description}):null]})},A.id))})]})]},I.id)}),x.map((I,T)=>{let E=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(di,{}):null,b(rc,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Pa,{value:E,onValueChange:A=>{S(U_(g,I.id,A==="on"))},children:["on","off"].map(A=>u(wr,{value:A,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:f(A==="on"?"traits.on":"traits.off")})})},A))})]})]},I.id)})]}):null});function p6(e,t){let n=null,o=!1,r=[];for(let a of t.descriptors){if(a.id==="fastMode"&&a.type==="boolean"){o=a.currentValue===!0,n=e(o?"traits.fast":"traits.normal");continue}if(t.provider==="codex"&&a.id==="serviceTier"&&a.type==="select"){let s=Ys(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(s==="default"||s===l.id)){o=s===l.id,n=a.options.find(({id:d})=>d===s)?.label??e(o?"traits.fast":"traits.normal");continue}}let i=t.ultrathinkPromptControlled&&a.id===t.primarySelectDescriptorId?e("traits.ultrathink"):a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):sb(a);typeof i=="string"&&i.length>0&&r.push(i)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var K_=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,h]=G(!1),{t:g}=_e(),v=Ot().model,{descriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C}=lb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!db({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:k}=p6(g,{provider:t,descriptors:x,primarySelectDescriptorId:y?.id??null,ultrathinkPromptControlled:C}),S=k?b(be,{children:[u(hr,{icon:is,className:F("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:g("traits.fastModeOn")})]}):null,L=t==="codex";return b(er,{open:m,onOpenChange:I=>{h(I)},children:[u(or,{render:u(qr,{variant:c??"ghost",className:F(L?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:L?b("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[S,u("span",{className:"min-w-0 truncate",children:w}),u(Di,{})]}):b(be,{children:[S,u("span",{children:w}),u(Di,{})]})}),u(nr,{align:"start",children:u(cb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function q_(e){return Uu(e)?"ultrathink":"none"}function V_(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,n,s),d=Dg({caps:l,selections:a}),c=d.find(h=>h.type==="select"),f=Ys(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i==="ultrathink";return{provider:n,promptEffort:p,modelOptionsForDispatch:Og(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function W_(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!db({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,prompt:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f})}function G_(e){return W_(cb,e)}function j_(e){return W_(K_,e)}me();var Q_=e=>{let t,n=new Set,o=(d,c)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let p=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,s);return s},X_=(e=>e?Q_(e):Q_);me();var m6=e=>e;function g6(e,t=m6){let n=un.useSyncExternalStore(e.subscribe,un.useCallback(()=>t(e.getState()),[e,t]),un.useCallback(()=>t(e.getInitialState()),[e,t]));return un.useDebugValue(n),n}var Y_=e=>{let t=X_(e),n=o=>g6(t,o);return Object.assign(n,t),n},J_=(e=>e?Y_(e):Y_);var ub=J_(e=>({presetIdByDraftId:{},setDraftPresetId:(t,n)=>{e(o=>{if((o.presetIdByDraftId[t]??null)===n)return o;let r={...o.presetIdByDraftId};return n===null?delete r[t]:r[t]=n,{presetIdByDraftId:r}})},clearDraftPresetId:t=>{e(n=>{if(n.presetIdByDraftId[t]===void 0)return n;let o={...n.presetIdByDraftId};return delete o[t],{presetIdByDraftId:o}})}}));function Z_(e){return ub(t=>e===null?null:t.presetIdByDraftId[e]??null)}function fb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var pb="__none__",eD=ue(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=_e(),i=Ot().presets.useThreadPresets(t),s=Z_(n),l=ub(c=>c.setDraftPresetId);if(n===null){let f=fb(i,o)?.displayName??o;return f===null?null:b(qr,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(hr,{icon:Ta}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=fb(i,s);return b(er,{children:[u(or,{render:u(qr,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:b("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(hr,{icon:Ta}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(Di,{})]})}),u(nr,{align:"start",children:b(rc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Pa,{value:s??pb,onValueChange:c=>{l(n,c===pb?null:c)},children:[u(wr,{value:pb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(wr,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"min-w-0 truncate",children:c.displayName}),c.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:c.description}):null]})},c.presetId))]})]})})]})});me();function tD(e){let t=e.credentialIdentity,n=e.selection.expectedRevisions;return[e.queryKey,e.selection.environmentId,e.selection.runtimeId,e.selection.sourceId,e.selection.profileId,e.selection.endpointId??"",String(n.runtime),String(n.source),String(n.profile),String(n.endpoint??""),String(e.sourceConfigRevision),t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function h6(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.sourceId===t.sourceId&&e.sourceConfigRevision===t.sourceConfigRevision&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function nD(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function v6(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function mb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function gb(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=864e5,n=36e5,o=6e4,r=1e3;return e%t===0?{unit:"days",count:e/t}:e%n===0?{unit:"hours",count:e/n}:e%o===0?{unit:"minutes",count:e/o}:e%r===0?{unit:"seconds",count:e/r}:null}function hb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function x6(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?{kind:"money",amount:n,currency:e.unit.currency}:e.unit.kind==="percent"?{kind:"percent",amount:n,direction:e.unit.direction}:{kind:"quantity",amount:n,nativeUnit:e.unit.nativeUnit}}function oD(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=x6(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:v6(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:hb(o,t)})}return n}function rD(e){return e.snapshot===null||e.credentialIdentity===null?null:h6(e.snapshot,e)?e.snapshot:null}function aD(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function iD(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}me();function sD(e,t){let n=_(e),o=_(0),r=_(!1),[a,i]=G(e),[s,l]=G(null),[d,c]=G(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=B(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let h=await t();if(o.current!==p||n.current!==m)return;l(h)}catch{if(o.current!==p||n.current!==m)return;l({outcome:"error",retryAt:null})}finally{o.current===p&&n.current===m&&(r.current=!1,c(!1))}},[e,t]);return{feedback:s,refreshing:d,refresh:f}}function lD(e,t){switch(e.unit){case"days":return t("sourceMetrics.windowDays",{count:e.count});case"hours":return t("sourceMetrics.windowHours",{count:e.count});case"minutes":return t("sourceMetrics.windowMinutes",{count:e.count});case"seconds":return t("sourceMetrics.windowSeconds",{count:e.count})}}function dD(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=gb(e.durationMs);return o!==null?lD(o,t):b6(e.kind,t)}function y6(e,t){switch(e.kind){case"unlimited":return t("sourceMetrics.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("sourceMetrics.percentUsed",{value:e.amount}):t("sourceMetrics.percentRemaining",{value:e.amount})}}function C6(e,t){let n=y6(e.display,t);if(e.kind==="quota-window")return`${dD(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function b6(e,t){switch(e){case"balance":return t("sourceMetrics.kindBalance");case"credits":return t("sourceMetrics.kindCredits");case"quota-window":return t("sourceMetrics.kindQuotaWindow");case"spend-cap":return t("sourceMetrics.kindSpendCap");case"rate-limit":return t("sourceMetrics.kindRateLimit")}}function I6(e,t){switch(e){case"account":return t("sourceMetrics.scopeAccount");case"org":return t("sourceMetrics.scopeOrg");case"project":return t("sourceMetrics.scopeProject");case"key":return t("sourceMetrics.scopeKey");case"endpoint":return t("sourceMetrics.scopeEndpoint");case"model-group":return t("sourceMetrics.scopeModelGroup");case"model":return t("sourceMetrics.scopeModel");case"unknown":return t("sourceMetrics.scopeUnknown")}}function Ku(e){return ta(e,"locale")||e}function S6(e,t){switch(e.outcome){case"fresh":return t("sourceMetrics.outcomeFresh");case"partial":return t("sourceMetrics.outcomePartial");case"joined-inflight":return t("sourceMetrics.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("sourceMetrics.outcomeRateLimited"):t("sourceMetrics.outcomeRateLimitedUntil",{time:Ku(e.retryAt)});case"offline":return t("sourceMetrics.outcomeOffline");case"unsupported":return t("sourceMetrics.outcomeUnsupported");case"error":return t("sourceMetrics.outcomeError")}}function w6(e,t,n){return e.capability.status==="unsupported"?n("sourceMetrics.unsupported"):e.credentialIdentity===null||e.capability.status==="unknown"?n("sourceMetrics.unknown"):t.length>0?null:e.loading?n("sourceMetrics.loading"):e.error!==null?n("sourceMetrics.outcomeError"):n("sourceMetrics.noData")}function vb(e,t){let n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?`${e.unit.currency} ${n}`:e.unit.kind==="percent"?`${n}%`:`${n} ${e.unit.nativeUnit}`}function cD(e){let[t,n]=G(!1);return u(T6,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function T6(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=_e(),i=tD(r),{feedback:s,refreshing:l,refresh:d}=sD(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?rD(r):null,f=c?.metrics??[],p=oD(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,h=aD(p),g=iD(f),v=l,x=w6(r,p,a),y=nD(r),w=`${Qr()}-source-metrics-details`,k=[...p.map(S=>({key:`${S.metricId}\0${S.poolKey}`,text:C6(S,a)})),...h===null?[]:[{key:"resets-at",text:a("sourceMetrics.resetsAt",{time:Ku(h)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-source-metrics":"true","data-source-id":r.sourceId,"data-next-message":r.isNextMessage?"true":"false","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ne,{type:"button",variant:"ghost",size:"sm",className:"h-auto min-h-control-3 min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal","aria-expanded":t,"aria-controls":w,"aria-label":a(t?"sourceMetrics.hideDetails":"sourceMetrics.showDetails"),onClick:n,children:b("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[b("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:r.sourceLabel}),r.isNextMessage?u("span",{className:"text-[11px] text-muted-foreground",children:a("modelPicker.nextMessage")}):null,m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-source-metrics-stale":"true",children:a("sourceMetrics.stale")}):null,u(ln,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label",t?"rotate-180":"rotate-0")})]}),u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] tabular-nums text-secondary-label",children:k.length>0?k.map((S,L)=>b("span",{children:[L>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):x})]})}),y?u(ne,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("sourceMetrics.refreshAria",{source:r.sourceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"sourceMetrics.refreshing":"sourceMetrics.refresh")}):null]}),t?b("div",{id:w,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-source-metrics-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:x??a("sourceMetrics.noData")}):f.map(S=>u(L6,{metric:S,queryError:r.error,t:a},S.metricId)),g!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("sourceMetrics.collectedAt",{time:Ku(g)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:S6(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("sourceMetrics.errorKeepLast")}):null]})}function L6({metric:e,queryError:t,t:n}){let o=vb(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):vb(e,e.remaining),a=vb(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:I6(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=hb(e,t),d=e.window?.durationMs??null,c=gb(d),f=dD({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-quota-pool":e.scope.quotaPoolId??"","data-window-ms":d===null?void 0:String(d),children:[b("div",{className:"font-medium text-foreground",children:[f,e.provenance==="estimated"?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.estimated")}):null,l?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("sourceMetrics.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("sourceMetrics.remaining")]}):null,a!==null?b("span",{children:[a," ",n("sourceMetrics.limit")]}):null]}),b("div",{className:"mt-0.5",children:[i,e.scope.identity!==null?` \xB7 ${e.scope.identity}`:null,s!==null?` \xB7 ${s}`:null]}),e.fetchedAt!==null?u("div",{children:n("sourceMetrics.collectedAt",{time:Ku(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("sourceMetrics.resetsAt",{time:Ku(e.resetsAt)})}):null,c!==null?u("div",{children:lD(c,n)}):null,e.window?.nativePeriod!==null&&e.window?.nativePeriod!==void 0?u("div",{children:e.window.nativePeriod}):null]})}function vd(e){return e===null||!Number.isFinite(e)?"0":e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function uD(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?md(n):e.model}function fD(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}function k6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function pD(e){let{t}=_e(),{usage:n,modelDisplayName:o,onCompact:r,compactDisabled:a,compactDisabledReason:i}=e,s=k6(n.usedPercentage),l=Math.max(0,Math.min(100,n.usedPercentage??0)),d=9.75,c=2*Math.PI*d,f=c*(1-l/100),p=n.totalProcessedTokens??null,m=p!==null&&p>0,g=l>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(gl,{children:[u(vl,{openOnHover:!0,delay:150,closeDelay:r?150:0,render:u(ne,{size:"icon-sm",variant:"ghost-muted",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&s?`Context window ${s} used`:`Context window ${vd(n.usedTokens)} tokens used`,children:u("span",{className:"relative flex size-5 items-center justify-center",children:b("svg",{viewBox:"0 0 24 24",className:"-rotate-90 absolute inset-0 size-full transform-gpu mx-0!","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:g,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f})]})})})}),u(hl,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:b("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[b("div",{className:"flex items-center justify-between gap-3",children:[u("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&s?b("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:s}),u("span",{className:"mx-1",children:"\xB7"}),b("span",{children:[vd(n.usedTokens),"/",vd(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:vd(n.usedTokens)})]}),n.maxTokens!==null?u("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted/60",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),"aria-label":t("contextWindow.usage"),children:u("div",{className:"h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none",style:{width:`${l}%`,backgroundColor:g}})}):null,m?b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:vd(p)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:fD(t,o,n.autoCompactThreshold)}):null,r?b(be,{children:[b(ne,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:a,onClick:r,children:[u(Gd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),a&&i?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:i}):null]}):null]})})]})}function xb(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function yb(e,t){let n=e.trim().length-t;if(n<=0)return null;let o=n===1?"character":"characters";return`Prompt is ${n.toLocaleString("en-US")} ${o} over the ${t.toLocaleString("en-US")}-character limit. Shorten or split it before sending.`}function Cb(e){return e.submissionTarget==="provider-turn"?yb(e.providerInput??e.prompt,e.maxInputChars):null}function mD(e){let t=e.disabledReason??Cb(e);return t?(e.event?.preventDefault(),{validationMessage:t,didDispatch:!1}):e.onSend(e.event)===!1?(e.event?.preventDefault(),{validationMessage:null,didDispatch:!1}):{validationMessage:null,didDispatch:!0}}function gD({message:e}){return e?u("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function P6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function hD(e){let t=Ot(),n=ff(),o=t.pane.useActive(),[r,a]=G(null);return ye(()=>{if(!o)return;let i=e.anchor;if(!i){a(null);return}let s=!0,l=()=>{if(!s)return;let c=i.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??i).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,g=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,x={bottom:window.innerHeight-p.top-v,left:p.left+g,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-g*2)};a(y=>y&&P6(y,x)?y:x)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(i);for(let c=i.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{s=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:F(n,"pointer-events-auto fixed z-[70]"),"data-composer-drawer-layer":"true",style:{bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var A6=['[data-composer-drawer-layer="true"]','[data-slot="popover-popup"]','[data-slot="menu-popup"]','[data-slot="select-popup"]','[data-slot="combobox-popup"]','[data-slot="autocomplete-popup"]'].join(","),bb=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,E6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},M6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function R6(e){return e.closest(A6)!==null}var N6=ue(function(t){let{t:n}=_e(),o=_g(),r=o(t.runtimeMode),a=r.icon,i=t.runtimeModeSwitch==="next-turn",s=t.interactionMode==="plan"?"Plan mode \u2014 click to return to normal build mode":"Default mode \u2014 click to enter plan mode",l=t.nativeMode!==null,d=t.showInteractionModeToggle&&!l?b(be,{children:[u(nc,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Xe,{children:[b(Je,{render:u(qr,{className:F("shrink-0 whitespace-nowrap",t.interactionMode==="plan"?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:t.onToggleInteractionMode,"aria-label":s}),children:[t.interactionMode==="plan"?u(hr,{icon:Qd,className:"text-current opacity-100"}):u(hr,{icon:Wi,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t.interactionMode==="plan"?"Plan":"Build"})]}),u(Ye,{side:"top",children:s})]})]}):null,c=b(be,{children:[u(nc,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Xe,{children:[b(Cf,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[b(Je,{render:u(Ag,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(hr,{icon:a}),u(Sf,{children:r.label})]}),b(If,{alignItemWithTrigger:!1,children:[Ng.map(f=>{let p=o(f),m=p.icon;return u(bf,{value:f,hideIndicator:!0,className:"min-w-64 py-2",children:u("div",{className:"flex min-w-0 items-center gap-3",children:b("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[b("span",{className:"inline-flex items-center gap-1.5 font-medium text-foreground",children:[u(m,{className:"size-icon-2 shrink-0 text-muted-foreground"}),p.label]}),u("span",{className:"text-muted-foreground text-xs leading-4",children:p.description})]})})},f)}),i?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Ye,{side:"top",children:i?`${r.description} ${n("runtimeMode.appliesNextTurnHint")}`:r.description})]}),i?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline",children:n("runtimeMode.appliesNextTurn")}):null]});return b(be,{children:[t.nativeMode?b(be,{children:[u(nc,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),u(F_,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),_6=ue(function(t){return b(be,{children:[t.activeContextWindow?u(pD,{usage:t.activeContextWindow,modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}):null,t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:"Preparing worktree..."}):null,u(Hu,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isConnecting:t.isConnecting,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,onImplementPlanInNewThread:t.onImplementPlanInNewThread})]})}),vD=ue(function(t){let{composerDraftTarget:n,environmentId:o,attachmentUploadsCapabilityKnown:r,supportsAttachmentUploads:a,routeKind:i,routeThreadRef:s,draftId:l,activeThreadId:d,activeThreadEnvironmentId:c,activeThread:f,isServerThread:p,isLocalDraftThread:m,forceExpandedOnMobile:h,projectSelectionRequired:g,phase:v,isConnecting:x,isSendBusy:y,sendDisabledReason:C,isPreparingWorktree:w,environmentUnavailable:k,activePendingApproval:S,onRespondToComposerDecision:L,pendingUserInputs:I,activePendingProgress:T,activePendingResolvedAnswers:E,activePendingIsResponding:A,activePendingDraftAnswers:N,activePendingQuestionIndex:R,respondingRequestIds:$,occupants:H,showPlanFollowUpPrompt:K,activeProposedPlan:O,activeTasksProgress:oe,activeTaskSteps:te,runtimeMode:W,interactionMode:Ke,lockedProvider:ve,providerStatuses:fe,activeProjectDefaultModelSelection:Ne,projectId:Ae=null,activeThreadModelSelection:ae,selectedExecutionSelection:Ee,composerChoices:xe,selectedExecutionReady:re,selectedModelOptionDescriptors:Ie,onModelPickerOpenChange:st,onClearExecutionSelection:dt,executionAppliesTo:lt,activeContextWindow:ct,compactDisabled:Mt,compactDisabledReason:at,resolvedTheme:$e,settings:Se,keybindings:Be,terminalOpen:Ze,gitCwd:qt,promptRef:X,composerRef:nn,composerImagesRef:yt,composerTerminalContextsRef:dn,composerElementContextsRef:Tt,onSend:Yt,onInterrupt:Jt,onCompactContext:Rt,onImplementPlanInNewThread:On,onRespondToApproval:An,onSelectActivePendingUserInputOption:fn,onAdvanceActivePendingUserInput:Fn,onPreviousActivePendingUserInputQuestion:Nt,onChangeActivePendingUserInputCustomAnswer:Vt,onProviderModelSelect:Bn,onModelSelectionChosen:oo,onExecutionSelectionChosen:zt,onSelectPluginAction:D,onManagePlugins:Y,getModelDisabledReason:de,getModelContinuationLabel:ie,onContinueInModel:pe,toggleInteractionMode:et,handleRuntimeModeChange:gt,handleInteractionModeChange:pn,handleNativeModeChange:ht,focusComposer:Zt,scheduleComposerFocus:Wt,setThreadError:bt,onExpandImage:mn}=t,ge=t.api,{limits:vt}=t.attachments,{t:Lt}=_e(),ut=ge.draft.useThreadDraft(n),tt=ut.prompt,It=ut.images,zn=z(()=>It.filter(P=>av(P)==="image"),[It]),Ge=ut.terminalContexts,_t=ut.elementContexts,En=ut.previewAnnotations,gn=ut.reviewComments,Lo=ut.nonPersistedImageIds,Mn=ge.uploads.useStore(P=>P.uploadsByImageId),ro=a?pT({imageIds:It.map(P=>P.id),uploadsByImageId:Mn,environmentId:o}):null,J=ge.draft.useStore,qe=J(P=>P.setPrompt),xt=J(P=>P.setNativeMode),Qe=J(P=>P.addImage),cn=J(P=>P.addImages),hn=J(P=>P.removeImage),vn=J(P=>P.insertTerminalContext),$t=J(P=>P.removeTerminalContext),$n=J(P=>P.setTerminalContexts),en=J(P=>P.removeElementContext),mo=J(P=>P.removePreviewAnnotation),Ya=J(P=>P.removeReviewComment),fa=J(P=>P.clearComposerPromptAndImages);q(()=>{if(r){if(!a){for(let P of It)ge.uploads.release(P.id);return}ge.draft.restoreAttachments();for(let P of It)ge.uploads.start({environmentId:o,image:P})}},[r,It,o,a]);let Jn=z(()=>IN(ge.model.applyInstanceSettings(ge.model.deriveInstanceEntries(fe),Se)),[ge.model,fe,Se]),Re=ut.activeProvider??null,pa=f?.session?.providerInstanceId??ae?.instanceId??Ne?.instanceId??null,ma=SN(Jn,Re??pa)??Jn[0]?.driverKind??ge.model.makeDriverKind("unconfigured"),Oi=ve??ma,qo=z(()=>{if(!ve||!f)return null;let P=f.session?.providerInstanceId??ae?.instanceId;return P?Jn.find(V=>V.instanceId===P)?.continuationGroupKey??null:null},[f,ae?.instanceId,ve,Jn]),kt=z(()=>{let P=[ut.activeProvider,f?.session?.providerInstanceId,ae?.instanceId,Ne?.instanceId];for(let Fe of P){if(!Fe)continue;let We=Jn.find(ot=>ot.instanceId===Fe&&Tg(ot));if(We){if(ve&&We.driverKind!==ve||qo&&We.continuationGroupKey!==qo)continue;return We.instanceId}}let V=Jn.filter(Fe=>(!ve||Fe.driverKind===ve)&&(!qo||Fe.continuationGroupKey===qo)),se=V.filter(Fe=>Fe.driverKind===Oi);return Lg(se,void 0)?.instanceId??Lg(V,void 0)?.instanceId??ge.model.noProviderSelection.instanceId},[Ne?.instanceId,f?.session?.providerInstanceId,ae?.instanceId,ut.activeProvider,qo,ve,Jn,Oi]),Zn=z(()=>Jn.find(P=>P.instanceId===kt),[Jn,kt]),Gt=Zn===void 0,ga=at??(Gt?"Compacting is unavailable right now":null),tn=Zn?.driverKind??Oi,{modelOptions:Hn,selectedModel:on,executionSelection:Ja}=ge.draft.useEffectiveModelState({threadRef:n,providers:fe,selectedProvider:tn,selectedInstanceId:kt,threadModelSelection:ae,projectModelSelection:Ne,settings:Se}),he=Ee===void 0?Ja:Ee,bn=z(()=>Zn?.snapshot??null,[Zn]),Vo=z(()=>{let P=Zn?.models??[];if(!he||Ie===void 0)return P;let V=P.find(se=>se.slug===on);return[...P.filter(se=>se.slug!==on),{...V??{slug:on,name:on},capabilities:{...V?.capabilities,optionDescriptors:Ie}}]},[Zn,he,Ie,on]),Fi=z(()=>q_(tt),[tt]),xr=z(()=>V_({provider:tn,model:on,models:Vo,promptInjectionState:Fi,modelOptions:Hn?.[kt],planModeEnabled:Se.planModeEnabled},ge.model),[Hn,Fi,kt,on,tn,Vo,Se.planModeEnabled]),Wo=xr.promptEffort,yr=he?Hn?.[kt]??he.optionOverrides:xr.modelOptionsForDispatch,Do=Se.planModeEnabled,Vr=z(()=>({showInteractionModeToggle:Do&&ge.model.getInteractionModeToggle(fe,tn),runtimeModeSwitch:qw(tn)}),[Do,fe,tn]),go=bn?.supportsNativeModeSwitch===!0,Go=m&&go?ut.nativeModeByProvider?.[kt]??null:null,Bi=z(()=>D_(bn,m?Go:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,bn,m,Go]),zi=Go&&Bi?.current.id===Go?Go:void 0,Un=B(P=>{m&&xt(n,kt,P),ht(P)},[m,xt,n,kt,ht]),Cr=z(()=>ge.model.createSelection(kt,on,yr),[ge.model,kt,on,yr]),ha=z(()=>!he||!xe?.length?null:xe.find(P=>P.runtimeId===he.runtimeId&&P.sourceId===he.sourceId&&P.profileId===he.profileId&&(P.endpointId??void 0)===(he.endpointId??void 0))??null,[xe,he]),$i=re??ha?.ready===!0,Oo=_(null);q(()=>{let P=f?.id??null,V=Oo.current;Oo.current={threadId:P,selection:Cr},!(V===null||V.threadId!==P||m)&&V.selection!==Cr&&oo?.(Cr)},[f?.id,m,oo,Cr]);let ko=on,jo=z(()=>{let P=new Map;for(let V of Jn)P.set(V.instanceId,ge.model.getAppModelOptionsForInstance(Se,V));return P},[Jn,Se]),Qo=z(()=>(jo.get(kt)??[]).some(V=>V.slug===ko)?ko:ge.model.normalizeSlug(ko,tn)??ko,[ge.model,jo,kt,ko,tn]),va=m&&ve===null,Xo=ge.pluginComposer.useOptions(va?o:null,Ae),ze=Xo.options,ft=va?ut.selectedPluginActionKey:null,an=z(()=>ft===null?null:ze.find(P=>P.id===ft)??null,[ft,ze]),xn=ft!==null,br=xn&&an===null?Lt(Xo.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,Wr=C??br??(T?null:ro),Yo=Wr!==null,Js=z(()=>uD(ae,jo),[ae,jo]),yn=`${String(o)}\0${String(n)}`,xd=dr(tt,tt.length),Zs=Ka(yn,tt,{cursor:xd,expandedCursor:tt.length}),[qu,Bg]=G(()=>({documentKey:yn,cursor:Zs.cursor})),xa=qu.documentKey===yn?qu.cursor:Zs.cursor,Po=B(P=>{Bg(V=>{let se=V.documentKey===yn?V.cursor:Ka(yn,X.current).cursor,Fe=typeof P=="function"?P(se):P,We=X.current,ot=Lr(We,Fe);return CM(yn,We,Fe,ot),V.documentKey===yn&&V.cursor===Fe?V:{documentKey:yn,cursor:Fe}})},[yn,X]),[U,ce]=G(()=>cr(tt,tt.length)),[Oe,rt]=G(null),[ho,Ir]=G(null),[Ao,Vu]=G(!1),[el,yd]=G(!1);q(()=>{st?.(el)},[el,st]);let[bD,Wu]=G(!1),[Gu,zg]=G(null),[ID,$g]=G(null),[Ib,SD]=G(null),[Hg,ya]=G(!1),[Cd,tl]=G(!1),[wD,Sb]=G(null),[nl,Ug]=G({key:0,active:!1}),wb=_(yn);ye(()=>{wb.current!==yn&&(wb.current=yn,ce(cr(tt,Zs.expandedCursor)),rt(null),Ir(null),Vu(!1),yd(!1),zg(null),$g(null),ya(!1),tl(!1),Sb(null),Ug({key:nl.key,active:!1}))},[yn,Zs.expandedCursor,tt,nl.key]);let Sr=cp("max-sm"),ao=Sr&&!h&&!bD,Ca=_(null),Tb=_(null),Kg=_(null),Lb=_(null),qg=_(!1),Vg=_(!1),Wg=_(!1),kb=_([]),Pb=_(null),vo=_(null),ol=_(null),rl=_(null),ju=_(!1),Ab=_(0),al=_(null),Gg=_(new Set),Hi=_(new Map),il=z(()=>ge.chat.deriveComposerSendState({prompt:tt,imageCount:It.length,terminalContexts:Ge,elementContextCount:_t.length+En.length+gn.length}),[_t.length,It.length,En.length,gn.length,Ge,tt]),sl=U?.kind??null,Eb=U?.kind==="path"?U.query:"",Mb=sl==="path",jg=ge.pathSearch.useComposerPathSearch({environmentId:o,cwd:Mb?qt:null,query:Mb?Eb:null}),Fo=z(()=>{if(!U)return[];if(U.kind==="path")return jg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:vu(P.path),description:P.path.slice(0,Math.max(0,P.path.lastIndexOf("/")))}));if(U.kind==="slash-command"){let P=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:"Switch response model for this thread"},...Do?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:"Switch this thread into plan mode"},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:"Switch this thread back to normal build mode"}]:[]],V=gM(bn?.skills??[],Se.showSkillsInSlashMenu),se=hM(bn?.slashCommands??[],V).map(Pt=>({id:`provider-slash-command:${tn}:${Pt.name}`,type:"provider-slash-command",provider:tn,command:Pt,label:`/${Pt.name}`,description:Pt.description??Pt.input?.hint??"Run provider command"})),Fe=U.query.trim().toLowerCase(),We=V.map(Pt=>({id:`skill:${tn}:${Pt.name}`,type:"skill",provider:tn,skill:Pt,label:`/skill:${Pt.name}`,description:Pt.shortDescription??Pt.description??(Pt.scope?`${Pt.scope} skill`:"")})),ot=[...P,...se,...We];return z_(ot,Fe)}return U.kind==="skill"?B_(bn?.skills??[],U.query).map(P=>({id:`skill:${tn}:${P.name}`,type:"skill",provider:tn,skill:P,label:ca(P),description:P.shortDescription??P.description??(P.scope?`${P.scope} skill`:"Run provider skill")})):[]},[U,Do,tn,bn,Se.showSkillsInSlashMenu,jg.entries]),Ui=!!U,Za=U?`${U.kind}:${U.query.trim().toLowerCase()}`:null,Rb=z(()=>{let P=ab({items:Fo,highlightedItemId:Oe,currentSearchKey:Za,highlightedSearchKey:ho});return Fo.find(V=>V.id===P)??null},[Oe,ho,Fo,Za]);Wg.current=Ui,kb.current=Fo,Pb.current=Rb;let TD=z(()=>new Set(Lo),[Lo]),Kn=S!==null,Qu=I[0]??null,Nb=T?.activeQuestion?.allowFreeform===!1,bd=H[0]??null,{showTopDrawer:Xu,showCollapsedPromptRow:LD,hasBlocking:Id}=Kw(bd?.kind??null,ao),kD=K||T!==null,{isComposerFooterCompact:Sd,isComposerPrimaryActionsCompact:_b}=TT(Kg,kD),PD=sl==="path"&&Eb.length>0&&jg.isPending,AD=z(()=>sl==="skill"?"No skills found. Try / to browse provider commands.":sl==="path"?"No matching files or folders.":"No matching command.",[sl]),Db=B(P=>{if(P===X.current){Wt();return}X.current=P,qe(n,P);let V=dr(P,P.length);Po(V),ce(cr(P,P.length)),Wt()},[n,X,Wt,qe]),ED=G_({modelApi:ge.model,provider:tn,instanceId:kt,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:on,models:Vo,modelOptions:Hn?.[kt],prompt:tt,onPromptChange:Db,planModeEnabled:Se.planModeEnabled}),Ob=j_({modelApi:ge.model,provider:tn,instanceId:kt,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:on,models:Vo,modelOptions:Hn?.[kt],prompt:tt,onPromptChange:Db,planModeEnabled:Se.planModeEnabled}),Yu=z(()=>T?{questionIndex:T.questionIndex,isLastQuestion:T.isLastQuestion,canAdvance:T.canAdvance,isResponding:A,isComplete:!!E}:null,[A,T,E]),MD=v==="running"||y||Yo||x||Gt||g||k!==null||!il.hasSendableContent,RD="Send message",wd=Sr&&!ao&&Yu!==null,ll=B(P=>{qe(n,P)},[n,qe]),ND=B(P=>{Qe(n,P)},[n,Qe]),_D=B(P=>{cn(n,P)},[n,cn]),DD=B(P=>{ge.uploads.release(P),hn(n,P)},[ge.uploads,n,hn]),OD=B(P=>{let V=Ge.findIndex(We=>We.id===P);if(V<0)return;let se=ge.terminalContext.removeInlinePlaceholder(X.current,V);X.current=se.prompt,ll(se.prompt),$t(n,P);let Fe=dr(se.prompt,se.cursor);Po(Fe),ce(cr(se.prompt,se.cursor))},[n,Ge,X,$t,ll]);ye(()=>{X.current=tt,Po(P=>lr(tt,P))},[yn,tt,X,Po]),q(()=>{if(Gu===null)return;let P=yb(tt,vt.maxInputChars);P!==Gu&&zg(P)},[Gu,vt.maxInputChars,tt]),q(()=>{$g(null)},[_t,En,gn,Ge,tt,on,Wo,tn]),ye(()=>{yt.current=It},[It,yt]),ye(()=>{dn.current=Ge},[Ge,dn]),ye(()=>{Tt.current=_t},[_t,Tt]),q(()=>{if(!Ui){rt(null),Ir(null);return}let P=ab({items:Fo,highlightedItemId:Oe,currentSearchKey:Za,highlightedSearchKey:ho});rt(V=>V===P?V:P),Ir(V=>V===Za?V:Za)},[Oe,ho,Fo,Ui,Za]);let Ju=_(null);q(()=>{let P=T?.customAnswer;if(typeof P!="string"){Ju.current=null;return}let V=Qu?.requestId??null,se=T?.activeQuestion?.id??null,Fe=Ju.current?.requestId!==V||Ju.current?.questionId!==se,We=X.current!==P;if(Ju.current={requestId:V,questionId:se},!Fe&&!We)return;X.current=P;let ot=dr(P,P.length);Po(ot),ce(cr(P,Lr(P,ot))),rt(null)},[T?.customAnswer,T?.activeQuestion?.id,Qu?.requestId,X]);let FD=B((P,V,se,Fe,We)=>{if(T?.activeQuestion&&I.length>0){if(T.activeQuestion.allowFreeform===!1)return;Po(V),ce(Fe?null:cr(P,se)),Vt(T.activeQuestion.id,P,V,se,Fe);return}X.current=P,ll(P),M6(Ge,We)||$n(n,E6(Ge,We)),Po(V),ce(Fe?null:cr(P,se))},[T?.activeQuestion,I.length,Vt,X,ll,n,Ge,$n]),ei=B((P,V,se,Fe)=>{let We=X.current,ot=Math.max(0,Math.min(We.length,P)),Pt=Math.max(ot,Math.min(We.length,V));if(Fe?.expectedText!==void 0&&We.slice(ot,Pt)!==Fe.expectedText)return!1;let wt=eT(X.current,P,V,se),Eo=dr(wt.text,wt.cursor),wn=Lr(wt.text,Eo);X.current=wt.text;let Ia=T?.activeQuestion;return Ia&&Qu?Vt(Ia.id,wt.text,Eo,wn,!1):ll(wt.text),Po(Eo),ce(cr(wt.text,wn)),Fe?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{Ca.current?.focusAt(Eo)}),!0},[T?.activeQuestion,Qu,Vt,X,ll]),Zu=B(()=>{let P=Ca.current?.readSnapshot();return P||{value:X.current,cursor:xa,expandedCursor:Lr(X.current,xa),terminalContextIds:Ge.map(V=>V.id)}},[xa,Ge,X]),Qg=B(()=>{let P=Zu();return{snapshot:P,trigger:cr(P.value,P.expandedCursor)}},[Zu]),Fb=B(P=>{if(Vg.current)return;Vg.current=!0,window.requestAnimationFrame(()=>{Vg.current=!1});let{snapshot:V,trigger:se}=Qg();if(se){if(P.type==="path"){let Fe=`${kc(P.path)} `,We=bb(V.value,se.rangeEnd,Fe);ei(se.rangeStart,We,Fe,{expectedText:V.value.slice(se.rangeStart,We)})&&rt(null);return}if(P.type==="slash-command"){if(P.command==="model"){ei(se.rangeStart,se.rangeEnd,"",{expectedText:V.value.slice(se.rangeStart,se.rangeEnd),focusEditorAfterReplace:!1})&&(rt(null),yd(!0));return}pn(P.command==="plan"?"plan":"default"),ei(se.rangeStart,se.rangeEnd,"",{expectedText:V.value.slice(se.rangeStart,se.rangeEnd)})&&rt(null);return}if(P.type==="provider-slash-command"){let Fe=`/${P.command.name} `,We=bb(V.value,se.rangeEnd,Fe);ei(se.rangeStart,We,Fe,{expectedText:V.value.slice(se.rangeStart,We)})&&rt(null);return}if(P.type==="skill"){let Fe=`$${P.skill.name} `,We=bb(V.value,se.rangeEnd,Fe);ei(se.rangeStart,We,Fe,{expectedText:V.value.slice(se.rangeStart,We)})&&rt(null);return}}},[ei,pn,Qg]),BD=B(P=>{rt(P),Ir(Za)},[Za]),Bb=B(P=>{if(Fo.length===0)return;let V=Fo.findIndex(Pt=>Pt.id===Oe),We=((V>=0?V:P==="ArrowDown"?-1:0)+(P==="ArrowDown"?1:-1)+Fo.length)%Fo.length,ot=Fo[We];rt(ot?.id??null)},[Oe,Fo]),zb=B(()=>{if(!Sr)return;vo.current!==null&&(window.cancelAnimationFrame(vo.current),vo.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),Wu(!1)},[Sr]),$b=B(()=>!Sr||y||Yo||x||Gt||k!==null||v==="running"?!1:T?T.isLastQuestion&&!!E:K||il.hasSendableContent,[T,E,il.hasSendableContent,k,x,Sr,y,Yo,Gt,v,K]),Xg=B((P,V="foreground")=>{if(Gt||Yo){P?.preventDefault();return}if(d&&(Hi.current.get(yn)??0)>0){P?.preventDefault(),ge.notify.info("Still compressing a pasted image.","Send again once its thumbnail appears.");return}let se=mD({prompt:X.current,submissionTarget:T?"pending-user-input":"provider-turn",maxInputChars:vt.maxInputChars,disabledReason:Wr,event:P,onSend:Fe=>(qg.current=!1,Yt(Fe,V),!qg.current)});zg(se.validationMessage),se.didDispatch&&$b()&&zb()},[d,T,zb,yn,Yo,vt.maxInputChars,Gt,Yt,X,Wr,$b]),Yg=B(()=>{if(!(Mt||Gt||il.hasSendableContent||S!==null||I.length>0||v==="running"||y||x||!d)){if((Hi.current.get(yn)??0)>0){ge.notify.info("Still compressing a pasted image.","Compact again once its thumbnail appears.");return}Rt()}},[S,d,Mt,yn,il.hasSendableContent,x,y,Gt,Rt,I.length,v]),ef=B(()=>{vo.current!==null&&(window.cancelAnimationFrame(vo.current),vo.current=null),ol.current!==null&&window.cancelAnimationFrame(ol.current),rl.current!==null&&window.cancelAnimationFrame(rl.current),ju.current=!0,Wu(!0),ol.current=window.requestAnimationFrame(()=>{ol.current=null,Ca.current?.focusAtEnd(),rl.current=window.requestAnimationFrame(()=>{rl.current=null,ju.current=!1})})},[]),zD=(P,V)=>{if(P==="Tab"&&V.shiftKey)return Do?(et(),!0):!1;let{trigger:se}=Qg();if(Wg.current||se!==null){let ot=kb.current,Pt=Pb.current??ot[0];if(P==="ArrowDown"&&ot.length>0)return Bb("ArrowDown"),!0;if(P==="ArrowUp"&&ot.length>0)return Bb("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&Pt)return Fb(Pt),!0}let We=P==="Enter"?Yw({isMobileViewport:Sr,shiftKey:V.shiftKey,modifierKey:V.metaKey||V.ctrlKey,isDraftThread:i==="draft"}):null;return We?(Xg(void 0,We),!0):!1},tf=ge.stash.useStore,dl=tf(P=>P.entries),Hb=tf(P=>P.stashEntry),nf=tf(P=>P.takeEntry),Ub=tf(P=>P.finalizeEntryImages);q(()=>()=>{al.current!==null&&window.clearTimeout(al.current)},[]);let Kb=B(()=>{Ab.current+=1,Ug({key:Ab.current,active:!0}),al.current!==null&&window.clearTimeout(al.current),al.current=window.setTimeout(()=>{al.current=null,Ug(P=>({...P,active:!1}))},1200)},[]),$D=B(P=>{let{entry:V,durable:se}=nf(P.id);if(!V)return;se||ge.notify.warning("Restored prompt may reappear in the stash","Browser storage rejected the update, so this entry could still be there after a reload."),ya(!1);let Fe=X.current,We=P.prompt.length===0?Fe:Fe.trim().length?`${Fe.replace(/\s+$/,"")}
3730
+ `)?e.slice(0,-1):e}function jG(e){return e.startsWith("diff --git")||e.includes(`
3731
+ diff --git`)}function x_(e,t){if(e.length===0)return[""];let n=`
3732
+ ${t}`,o=e.startsWith(t)?0:f_(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=f_(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function f_(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function p_(e){return e==null?e:Rn(e)}function QG(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function YC(e){let t=e.slice(1);return Rn(t===""?`
3733
+ `:t)}function JC(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var y_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function b_(e){return e==="dark"?y_.dark:y_.light}var I_=2166136261,S_=16777619,XG=2654435769,YG=2246822507;function C_(e,t=I_,n=S_){let o=t>>>0;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,n)>>>0;return o>>>0}function JG(e,t="diff-panel"){let n=e.trim(),o=C_(n,I_,S_).toString(36),r=C_(n,XG,YG).toString(36);return`${t}:${n.length}:${o}:${r}`}function eb(e){if(!e.isPartial)return e;let t=0,n=0,o=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:n};return t+=r.splitLineCount,n+=r.unifiedLineCount,a});return{...e,hunks:o,splitLineCount:t,unifiedLineCount:n,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function w_(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=m_(o,JG(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(eb):i.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:o,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:o,reason:"Failed to parse patch. Showing raw patch."}}}function T_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function L_({fileChange:e,onOpenDiff:t}){let{t:n}=De(),[o,r]=G(!1),a=z(()=>ZN(e),[e]),i=t_(e);return b("div",{className:"min-w-0",children:[b("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[u("span",{className:"min-w-0 shrink truncate font-mono text-[11px] text-foreground/85",children:e.path}),u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:n("approval.diff.stat",{additions:i.additions,deletions:i.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):b(te,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(pn,{className:"size-3 shrink-0"}):u(Uo,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(te,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(ZG,{path:e.path,unifiedDiff:a}):null]})}function ZG({path:e,unifiedDiff:t}){let n=Ot().theme.useResolvedTheme(),o=z(()=>{let r=w_(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:T_(eb(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[n,t]);return o.length===0?u("pre",{"aria-label":e,className:"mt-1 max-h-56 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):u("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:u(tS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:b_(n),themeType:n,stickyHeaders:!1}})})}var e6="block max-h-20 min-w-0 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",k_=ue(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=De(),i=QN(t),{body:s}=i,l=e_(i.fileChanges);return b("div",{"aria-label":YN(i.kind,a),className:F("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:XN(i,a)}),n>1?b("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),s.shape==="none"?null:u("code",{"aria-label":JN(s.shape,a),className:F(e6,s.shape==="path"||s.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:s.shape==="command"?s.command:s.shape==="path"?s.path:s.shape==="url"?s.url:s.shape==="query"?s.query:s.text}),i.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:i.description}),i.fileChanges.map((d,c)=>u(L_,{fileChange:d,onOpenDiff:o},l[c])),i.args.length===0?null:b("details",{className:"min-w-0","data-approval-args":"true",children:[u("summary",{className:"cursor-pointer text-[11px] text-muted-foreground",children:a("approval.body.detailsSummary")}),u("dl",{"aria-label":a("approval.body.argumentsLabel"),className:"mt-1 grid max-h-32 min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 text-[11px] [scrollbar-width:thin]",tabIndex:0,children:i.args.map(d=>b("div",{className:"col-span-2 grid grid-cols-subgrid",children:[u("dt",{className:"font-mono text-muted-foreground",children:d.name}),u("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:d.value})]},d.name))})]})]})});var tb=ue(function(t){return u(k_,{...t})});me();var nb=ue(function(t){let{t:n}=De(),[o,r]=G(!1),[a,i]=G(!1),s=t.decision,l=s.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=s.askedBy.kind==="plugin"?s.askedBy.pluginId:null;return b("div",{className:F("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:d(s.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),s.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),s.detail===null?null:u("button",{type:"button",className:"min-w-0 truncate text-left font-mono text-[11px] text-muted-foreground",onClick:()=>r(f=>!f),children:o?s.detail.text.slice(0,4e3):s.detail.text.split(`
3734
+ `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(te,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{i(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function Eg(e){return e.id??e.label}function ob(e,t){return Array.from(new Set((t??[]).flatMap(n=>{let o=e.options.find(r=>r.id!==void 0?r.id===n:r.label===n.trim());return o?[Eg(o)]:[]})))}function t6(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function rb(e,t){let n=t6(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=ob(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function n6(e,t){let n={};for(let o of e){let r=rb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function o6(e,t){return e.reduce((n,o)=>rb(o,t[o.id])?n+1:n,0)}function P_(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,i=r?rb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=o6(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?ob(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:n6(e,t)!==null,canAdvance:!!i}}me();var A_=ue(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){if(t.length===0)return null;let s=t[0];return s?u(r6,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),r6=ue(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=De(),l=Ot(),d=P_(t.questions,o,r),c=d.activeQuestion,f=_(null),p=_(i),[m,h]=G(null),[g,v]=G(null),x=g!==null&&g===c?.id;q(()=>{p.current=i},[i]),q(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){h(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&h(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),q(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=B((w,k)=>{if(c?.multiSelect){a(w,k);return}h({questionId:w,optionLabel:k}),a(w,k),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(w=>{if(!c||n||x||w.metaKey||w.ctrlKey||w.altKey||w.isComposing||w.keyCode===229||Pg(w.target))return;let k=GC(w.key,c.options.length);if(k===null)return;let S=c.options[k];S&&(w.preventDefault(),y(c.id,Eg(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(GI,{className:"py-2",open:!x,onOpenChange:w=>{v(w?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(QI,{title:s(x?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":x?"collapsed":"expanded",className:"group -my-1 flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-(--control-duration) hover:bg-muted/40",children:[u("span",{className:"text-xs font-medium text-muted-foreground group-hover:text-foreground/85",children:c.header}),t.questions.length>1?b("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,x?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(pn,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",x&&"rotate-180")})]})}),u(jI,{className:"px-3 sm:px-4",children:b("div",{className:"pt-2 pb-0.5",children:[u("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-sm text-foreground/85","data-pending-user-input-body":c.kind??"question",tabIndex:0,children:c.kind==="plan"?u(nr,{text:c.question,cwd:void 0,isStreaming:!1}):u("p",{className:"whitespace-pre-wrap",children:c.question})}),c.multiSelect?u("p",{className:"mt-1 text-secondary-label text-xs",children:s("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((w,k)=>{let S=Eg(w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),T=k<9?k+1:null,E=F("group relative flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors duration-(--control-duration) pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",I?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),A=b(be,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:w.label}),w.description&&w.description!==w.label?u("span",{className:"text-secondary-label text-[11px]",children:w.description}):null]}),I?u(Io,{className:"size-icon-2 shrink-0 text-primary"}):T!==null?u("kbd",{className:F("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:T}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{y(c.id,S)},className:E,children:A},`${c.id}:${S}`)})})]})})]})});me();var E_=ue(function({planTitle:t}){let{t:n}=De();return u("div",{className:"px-3 py-2 sm:px-4",children:b("div",{className:"flex flex-wrap items-center gap-2",children:[u("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?u("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function M_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(VN,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function R_(e){return e.occupant.kind!=="user-input"?null:u(A_,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var N_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:b("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:M_(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,className:"px-3 pt-2 sm:px-4"}),u("div",{className:"flex flex-wrap items-center justify-end gap-1 px-3 pt-2 pb-3 sm:px-4",children:M_(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:u("div",{"data-chat-composer-collapsed-controls":"true",children:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:R_,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[R_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(E_,{planTitle:UN(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function __(e,t){let n=N_[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var sue=Object.keys(N_);me();me();var Mg=["approval-required","auto-accept-edits","auto","full-access"];var a6={"approval-required":Ud,"auto-accept-edits":Xr,auto:ai,"full-access":ri},i6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Rg(){let{t:e}=De();return B(t=>{let n=i6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:a6[t]}},[e])}var D_=ue(function(t){let{t:n}=De(),o=Rg();return b(Jo,{children:[u(tr,{render:u(te,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":"More composer controls"}),children:u(Yo,{"aria-hidden":"true",className:"size-4"})}),b(er,{align:"start",children:[t.traitsMenuContent?b(be,{children:[t.traitsMenuContent,u(ii,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Mode"}),b(Sa,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Cr,{value:"default",children:"Chat"}),u(Cr,{value:"plan",children:"Plan"})]}),u(ii,{})]}):null,t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),u(Sa,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Mg.map(r=>u(Cr,{value:r,children:o(r).label},r))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?u(Sa,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Cr,{value:r.id,children:r.name},r.id))}):u("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});me();function O_(e,t){let n=e?.nativeModes??[];if(n.length===0)return null;let o=n.find(r=>r.id===t)??n.find(r=>r.id===e?.currentNativeModeId);return o?{modes:n,current:o}:null}function F_(e){return e.description??e.name}var B_=ue(function(t){let{current:n,modes:o}=t.nativeMode,r=F_(n);return!t.canSwitch||o.length<2?b(Qe,{children:[b(Ye,{render:u($r,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(mr,{icon:cl}),u("span",{children:n.name})]}),b(Xe,{side:"top",children:[u("span",{className:"block font-medium",children:r}),o.length>1?b("span",{className:"mt-1 block text-muted-foreground text-xs",children:["Agent modes: ",o.map(a=>a.name).join(", ")]}):null]})]}):b(Qe,{children:[b(xf,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[b(Ye,{render:u(kg,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(mr,{icon:cl}),u(bf,{children:n.name})]}),u(Cf,{alignItemWithTrigger:!1,children:o.map(a=>u(yf,{value:a.id,hideIndicator:!0,className:"min-w-56 py-2",children:b("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:a.name}),a.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:a.description}):null]})},a.id))})]}),u(Xe,{side:"top",children:r})]})});function ab(e){return e.items.length===0?null:e.currentSearchKey===e.highlightedSearchKey&&e.highlightedItemId&&e.items.some(t=>t.id===e.highlightedItemId)?e.highlightedItemId:e.items[0]?.id??null}function ib(e,t){let n=e.name.toLowerCase(),o=sa(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[zr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),zr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),zr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),zr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),zr({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function z_(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=go(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=ib(i,r);s!==null&&Tg(a,{item:i,score:s,tieBreaker:`${sa(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function s6(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?ib(e.skill,a):0;return i!==null?i:"skill".startsWith(t)?Number.MAX_SAFE_INTEGER:null}let n=e.type==="slash-command"?e.command.toLowerCase():e.command.name.toLowerCase(),o=e.description.toLowerCase(),r=[zr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),zr({value:o,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26})].filter(a=>a!==null);return r.length===0?null:Math.min(...r)}function $_(e,t){let n=go(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=s6(r,n);a!==null&&Tg(o,{item:r,score:a,tieBreaker:r.type==="slash-command"?`0\0${r.command}`:r.type==="provider-slash-command"?`1\0${r.command.name}\0${r.provider}`:`2\0${r.skill.name}\0${r.provider}`},Number.POSITIVE_INFINITY)}return o.map(r=>r.item)}function l6(e){return typeof e!="string"?null:e.trim()||null}function d6(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function c6(e,t){return e?.find(o=>o.id===t)?.value}function H_(e,t){let n=l6(t);return n?e.options.length===0?n:e.promptInjectedValues?.includes(n)&&e.options.some(o=>o.id===n)?e.options.find(o=>o.isDefault)?.id:e.options.some(o=>o.id===n)?n:e.currentValue??e.options.find(o=>o.isDefault)?.id:e.currentValue??e.options.find(o=>o.isDefault)?.id}function u6(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?H_(e,t):H_(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function Ng(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(d6).map(r=>u6(r,c6(n,r.id)??r.currentValue))}function Xs(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function sb(e){if(!e)return;if(e.type==="boolean")return typeof e.currentValue=="boolean"?e.currentValue?"On":"Off":void 0;let t=Xs(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function _g(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Xs(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function Bu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function U_(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3735
+ ${n}`}me();var f6=`Ultrathink:
3736
+ `;function p6(){let{t:e}=De();return u(ul,{variant:"outline",className:"inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4",children:e("traits.default")})}function K_(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function Dg(e){if(!e)return null;let t=Xs(e);return typeof t=="string"?t:null}function m6(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=Ng({caps:l,selections:a}),c=d.filter(I=>I.type==="select"),f=d.filter(I=>I.type==="boolean"),p=c[0]??null,m=c.find(I=>I.id==="contextWindow")??null,h=c.find(I=>I.id==="agent")??null,g=f.find(I=>I.id==="fastMode")??null,v=f.find(I=>I.id==="thinking")??null,x=i&&(p?.promptInjectedValues?.length??0)>0&&Bu(r),y=x&&Bu(r.replace(/^Ultrathink:\s*/i,"")),C=(x?"ultrathink":Dg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,k=Dg(m),S=Dg(h),L=h?sb(h):null;return{caps:l,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:h,fastModeDescriptor:g,thinkingDescriptor:v,effort:C,thinkingEnabled:w,contextWindow:k,ultrathinkPromptControlled:x,ultrathinkInBodyText:y,selectedAgent:S,selectedAgentLabel:L}}function lb(e){let t=m6(e.modelApi,e.provider,e.models,e.model,e.prompt,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,i=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:i,hasAnyControls:n||o||r||a||i}}function db(e){return lb(e).hasAnyControls}var cb=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=De(),p=Ot(),m=p.draft.useStore(I=>I.setProviderModelOptions),h=B(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let T=c.threadRef??c.draftId;T&&m(T,t,I,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,m]),{descriptors:g,selectDescriptors:v,booleanDescriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,hasAnyControls:k}=lb({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{h(_g(I))},L=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){let E=a.trim().length===0?f6:U_(a,"ultrathink");i(E);return}if(!(w&&I.id===y?.id)){if(C&&I.id===y?.id){let E=a.replace(/^Ultrathink:\s*/i,"");i(E)}S(K_(g,I.id,T))}}};return k?b(be,{children:[v.map((I,T)=>{let E=C&&I.id===y?.id?"ultrathink":Dg(I)??"";return b("div",{children:[T>0?u(ii,{}):null,b(ec,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:I.label}),w&&I.id===y?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Sa,{value:E,onValueChange:A=>L(I,A),children:I.options.map(A=>u(Cr,{value:A.id,hideIndicator:!0,closeOnClick:!0,disabled:w&&I.id===y?.id,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:b("span",{className:"min-w-0 truncate",children:[A.label,A.isDefault?b(be,{children:[" ",u(p6,{})]}):null]})}),A.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:A.description}):null]})},A.id))})]})]},I.id)}),x.map((I,T)=>{let E=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(ii,{}):null,b(ec,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Sa,{value:E,onValueChange:A=>{S(K_(g,I.id,A==="on"))},children:["on","off"].map(A=>u(Cr,{value:A,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:f(A==="on"?"traits.on":"traits.off")})})},A))})]})]},I.id)})]}):null});function g6(e,t){let n=null,o=!1,r=[];for(let a of t.descriptors){if(a.id==="fastMode"&&a.type==="boolean"){o=a.currentValue===!0,n=e(o?"traits.fast":"traits.normal");continue}if(t.provider==="codex"&&a.id==="serviceTier"&&a.type==="select"){let s=Xs(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(s==="default"||s===l.id)){o=s===l.id,n=a.options.find(({id:d})=>d===s)?.label??e(o?"traits.fast":"traits.normal");continue}}let i=t.ultrathinkPromptControlled&&a.id===t.primarySelectDescriptorId?e("traits.ultrathink"):a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):sb(a);typeof i=="string"&&i.length>0&&r.push(i)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var q_=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,h]=G(!1),{t:g}=De(),v=Ot().model,{descriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C}=lb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!db({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:k}=g6(g,{provider:t,descriptors:x,primarySelectDescriptorId:y?.id??null,ultrathinkPromptControlled:C}),S=k?b(be,{children:[u(mr,{icon:as,className:F("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:g("traits.fastModeOn")})]}):null,L=t==="codex";return b(Jo,{open:m,onOpenChange:I=>{h(I)},children:[u(tr,{render:u($r,{variant:c??"ghost",className:F(L?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:L?b("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[S,u("span",{className:"min-w-0 truncate",children:w}),u(Ri,{})]}):b(be,{children:[S,u("span",{children:w}),u(Ri,{})]})}),u(er,{align:"start",children:u(cb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function V_(e){return Bu(e)?"ultrathink":"none"}function W_(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,n,s),d=Ng({caps:l,selections:a}),c=d.find(h=>h.type==="select"),f=Xs(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i==="ultrathink";return{provider:n,promptEffort:p,modelOptionsForDispatch:_g(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function G_(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!db({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,prompt:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f})}function j_(e){return G_(cb,e)}function Q_(e){return G_(q_,e)}me();var X_=e=>{let t,n=new Set,o=(d,c)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let p=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,s);return s},Y_=(e=>e?X_(e):X_);me();var h6=e=>e;function v6(e,t=h6){let n=hn.useSyncExternalStore(e.subscribe,hn.useCallback(()=>t(e.getState()),[e,t]),hn.useCallback(()=>t(e.getInitialState()),[e,t]));return hn.useDebugValue(n),n}var J_=e=>{let t=Y_(e),n=o=>v6(t,o);return Object.assign(n,t),n},Z_=(e=>e?J_(e):J_);var ub=Z_(e=>({presetIdByDraftId:{},setDraftPresetId:(t,n)=>{e(o=>{if((o.presetIdByDraftId[t]??null)===n)return o;let r={...o.presetIdByDraftId};return n===null?delete r[t]:r[t]=n,{presetIdByDraftId:r}})},clearDraftPresetId:t=>{e(n=>{if(n.presetIdByDraftId[t]===void 0)return n;let o={...n.presetIdByDraftId};return delete o[t],{presetIdByDraftId:o}})}}));function eD(e){return ub(t=>e===null?null:t.presetIdByDraftId[e]??null)}function fb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var pb="__none__",tD=ue(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=De(),i=Ot().presets.useThreadPresets(t),s=eD(n),l=ub(c=>c.setDraftPresetId);if(n===null){let f=fb(i,o)?.displayName??o;return f===null?null:b($r,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(mr,{icon:Ca}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=fb(i,s);return b(Jo,{children:[u(tr,{render:u($r,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:b("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(mr,{icon:Ca}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(Ri,{})]})}),u(er,{align:"start",children:b(ec,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Sa,{value:s??pb,onValueChange:c=>{l(n,c===pb?null:c)},children:[u(Cr,{value:pb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Cr,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"min-w-0 truncate",children:c.displayName}),c.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:c.description}):null]})},c.presetId))]})]})})]})});me();function nD(e){let t=e.credentialIdentity,n=e.selection.expectedRevisions;return[e.queryKey,e.selection.environmentId,e.selection.runtimeId,e.selection.sourceId,e.selection.profileId,e.selection.endpointId??"",String(n.runtime),String(n.source),String(n.profile),String(n.endpoint??""),String(e.sourceConfigRevision),t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function x6(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.sourceId===t.sourceId&&e.sourceConfigRevision===t.sourceConfigRevision&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function oD(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function y6(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function mb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function gb(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=864e5,n=36e5,o=6e4,r=1e3;return e%t===0?{unit:"days",count:e/t}:e%n===0?{unit:"hours",count:e/n}:e%o===0?{unit:"minutes",count:e/o}:e%r===0?{unit:"seconds",count:e/r}:null}function hb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function C6(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?{kind:"money",amount:n,currency:e.unit.currency}:e.unit.kind==="percent"?{kind:"percent",amount:n,direction:e.unit.direction}:{kind:"quantity",amount:n,nativeUnit:e.unit.nativeUnit}}function rD(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=C6(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:y6(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:hb(o,t)})}return n}function aD(e){return e.snapshot===null||e.credentialIdentity===null?null:x6(e.snapshot,e)?e.snapshot:null}function iD(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function sD(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}me();function lD(e,t){let n=_(e),o=_(0),r=_(!1),[a,i]=G(e),[s,l]=G(null),[d,c]=G(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=B(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let h=await t();if(o.current!==p||n.current!==m)return;l(h)}catch{if(o.current!==p||n.current!==m)return;l({outcome:"error",retryAt:null})}finally{o.current===p&&n.current===m&&(r.current=!1,c(!1))}},[e,t]);return{feedback:s,refreshing:d,refresh:f}}function dD(e,t){switch(e.unit){case"days":return t("sourceMetrics.windowDays",{count:e.count});case"hours":return t("sourceMetrics.windowHours",{count:e.count});case"minutes":return t("sourceMetrics.windowMinutes",{count:e.count});case"seconds":return t("sourceMetrics.windowSeconds",{count:e.count})}}function cD(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=gb(e.durationMs);return o!==null?dD(o,t):S6(e.kind,t)}function b6(e,t){switch(e.kind){case"unlimited":return t("sourceMetrics.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("sourceMetrics.percentUsed",{value:e.amount}):t("sourceMetrics.percentRemaining",{value:e.amount})}}function I6(e,t){let n=b6(e.display,t);if(e.kind==="quota-window")return`${cD(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function S6(e,t){switch(e){case"balance":return t("sourceMetrics.kindBalance");case"credits":return t("sourceMetrics.kindCredits");case"quota-window":return t("sourceMetrics.kindQuotaWindow");case"spend-cap":return t("sourceMetrics.kindSpendCap");case"rate-limit":return t("sourceMetrics.kindRateLimit")}}function w6(e,t){switch(e){case"account":return t("sourceMetrics.scopeAccount");case"org":return t("sourceMetrics.scopeOrg");case"project":return t("sourceMetrics.scopeProject");case"key":return t("sourceMetrics.scopeKey");case"endpoint":return t("sourceMetrics.scopeEndpoint");case"model-group":return t("sourceMetrics.scopeModelGroup");case"model":return t("sourceMetrics.scopeModel");case"unknown":return t("sourceMetrics.scopeUnknown")}}function zu(e){return Jr(e,"locale")||e}function T6(e,t){switch(e.outcome){case"fresh":return t("sourceMetrics.outcomeFresh");case"partial":return t("sourceMetrics.outcomePartial");case"joined-inflight":return t("sourceMetrics.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("sourceMetrics.outcomeRateLimited"):t("sourceMetrics.outcomeRateLimitedUntil",{time:zu(e.retryAt)});case"offline":return t("sourceMetrics.outcomeOffline");case"unsupported":return t("sourceMetrics.outcomeUnsupported");case"error":return t("sourceMetrics.outcomeError")}}function L6(e,t,n){return e.capability.status==="unsupported"?n("sourceMetrics.unsupported"):e.credentialIdentity===null||e.capability.status==="unknown"?n("sourceMetrics.unknown"):t.length>0?null:e.loading?n("sourceMetrics.loading"):e.error!==null?n("sourceMetrics.outcomeError"):n("sourceMetrics.noData")}function vb(e,t){let n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?`${e.unit.currency} ${n}`:e.unit.kind==="percent"?`${n}%`:`${n} ${e.unit.nativeUnit}`}function uD(e){let[t,n]=G(!1);return u(k6,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function k6(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=De(),i=nD(r),{feedback:s,refreshing:l,refresh:d}=lD(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?aD(r):null,f=c?.metrics??[],p=rD(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,h=iD(p),g=sD(f),v=l,x=L6(r,p,a),y=oD(r),w=`${Wr()}-source-metrics-details`,k=[...p.map(S=>({key:`${S.metricId}\0${S.poolKey}`,text:I6(S,a)})),...h===null?[]:[{key:"resets-at",text:a("sourceMetrics.resetsAt",{time:zu(h)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-source-metrics":"true","data-source-id":r.sourceId,"data-next-message":r.isNextMessage?"true":"false","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(te,{type:"button",variant:"ghost",size:"sm",className:"h-auto min-h-control-3 min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal","aria-expanded":t,"aria-controls":w,"aria-label":a(t?"sourceMetrics.hideDetails":"sourceMetrics.showDetails"),onClick:n,children:b("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[b("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:r.sourceLabel}),r.isNextMessage?u("span",{className:"text-[11px] text-muted-foreground",children:a("modelPicker.nextMessage")}):null,m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-source-metrics-stale":"true",children:a("sourceMetrics.stale")}):null,u(pn,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label",t?"rotate-180":"rotate-0")})]}),u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] tabular-nums text-secondary-label",children:k.length>0?k.map((S,L)=>b("span",{children:[L>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):x})]})}),y?u(te,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("sourceMetrics.refreshAria",{source:r.sourceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"sourceMetrics.refreshing":"sourceMetrics.refresh")}):null]}),t?b("div",{id:w,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-source-metrics-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:x??a("sourceMetrics.noData")}):f.map(S=>u(P6,{metric:S,queryError:r.error,t:a},S.metricId)),g!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("sourceMetrics.collectedAt",{time:zu(g)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:T6(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("sourceMetrics.errorKeepLast")}):null]})}function P6({metric:e,queryError:t,t:n}){let o=vb(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):vb(e,e.remaining),a=vb(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:w6(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=hb(e,t),d=e.window?.durationMs??null,c=gb(d),f=cD({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-quota-pool":e.scope.quotaPoolId??"","data-window-ms":d===null?void 0:String(d),children:[b("div",{className:"font-medium text-foreground",children:[f,e.provenance==="estimated"?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.estimated")}):null,l?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("sourceMetrics.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("sourceMetrics.remaining")]}):null,a!==null?b("span",{children:[a," ",n("sourceMetrics.limit")]}):null]}),b("div",{className:"mt-0.5",children:[i,e.scope.identity!==null?` \xB7 ${e.scope.identity}`:null,s!==null?` \xB7 ${s}`:null]}),e.fetchedAt!==null?u("div",{children:n("sourceMetrics.collectedAt",{time:zu(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("sourceMetrics.resetsAt",{time:zu(e.resetsAt)})}):null,c!==null?u("div",{children:dD(c,n)}):null,e.window?.nativePeriod!==null&&e.window?.nativePeriod!==void 0?u("div",{children:e.window.nativePeriod}):null]})}function md(e){return e===null||!Number.isFinite(e)?"0":e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function fD(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?ud(n):e.model}function pD(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}function A6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function mD(e){let{t}=De(),{usage:n,modelDisplayName:o,onCompact:r,compactDisabled:a,compactDisabledReason:i}=e,s=A6(n.usedPercentage),l=Math.max(0,Math.min(100,n.usedPercentage??0)),d=9.75,c=2*Math.PI*d,f=c*(1-l/100),p=n.totalProcessedTokens??null,m=p!==null&&p>0,g=l>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(fl,{children:[u(ml,{openOnHover:!0,delay:150,closeDelay:r?150:0,render:u(te,{size:"icon-sm",variant:"ghost-muted",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&s?`Context window ${s} used`:`Context window ${md(n.usedTokens)} tokens used`,children:u("span",{className:"relative flex size-5 items-center justify-center",children:b("svg",{viewBox:"0 0 24 24",className:"-rotate-90 absolute inset-0 size-full transform-gpu mx-0!","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:g,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f})]})})})}),u(pl,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:b("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[b("div",{className:"flex items-center justify-between gap-3",children:[u("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&s?b("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:s}),u("span",{className:"mx-1",children:"\xB7"}),b("span",{children:[md(n.usedTokens),"/",md(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:md(n.usedTokens)})]}),n.maxTokens!==null?u("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted/60",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),"aria-label":t("contextWindow.usage"),children:u("div",{className:"h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none",style:{width:`${l}%`,backgroundColor:g}})}):null,m?b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:md(p)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:pD(t,o,n.autoCompactThreshold)}):null,r?b(be,{children:[b(te,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:a,onClick:r,children:[u(Kd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),a&&i?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:i}):null]}):null]})})]})}function xb(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function yb(e,t){let n=e.trim().length-t;if(n<=0)return null;let o=n===1?"character":"characters";return`Prompt is ${n.toLocaleString("en-US")} ${o} over the ${t.toLocaleString("en-US")}-character limit. Shorten or split it before sending.`}function Cb(e){return e.submissionTarget==="provider-turn"?yb(e.providerInput??e.prompt,e.maxInputChars):null}function gD(e){let t=e.disabledReason??Cb(e);return t?(e.event?.preventDefault(),{validationMessage:t,didDispatch:!1}):e.onSend(e.event)===!1?(e.event?.preventDefault(),{validationMessage:null,didDispatch:!1}):{validationMessage:null,didDispatch:!0}}function hD({message:e}){return e?u("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function E6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function vD(e){let t=Ot(),n=cf(),o=t.pane.useActive(),[r,a]=G(null);return ye(()=>{if(!o)return;let i=e.anchor;if(!i){a(null);return}let s=!0,l=()=>{if(!s)return;let c=i.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??i).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,g=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,x={bottom:window.innerHeight-p.top-v,left:p.left+g,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-g*2)};a(y=>y&&E6(y,x)?y:x)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(i);for(let c=i.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{s=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:F(n,"pointer-events-auto fixed z-[70]"),"data-composer-drawer-layer":"true",style:{bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var M6=['[data-composer-drawer-layer="true"]','[data-slot="popover-popup"]','[data-slot="menu-popup"]','[data-slot="select-popup"]','[data-slot="combobox-popup"]','[data-slot="autocomplete-popup"]'].join(","),bb=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,R6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},N6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function _6(e){return e.closest(M6)!==null}var D6=ue(function(t){let{t:n}=De(),o=Rg(),r=o(t.runtimeMode),a=r.icon,i=t.runtimeModeSwitch==="next-turn",s=t.interactionMode==="plan"?"Plan mode \u2014 click to return to normal build mode":"Default mode \u2014 click to enter plan mode",l=t.nativeMode!==null,d=t.showInteractionModeToggle&&!l?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Qe,{children:[b(Ye,{render:u($r,{className:F("shrink-0 whitespace-nowrap",t.interactionMode==="plan"?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:t.onToggleInteractionMode,"aria-label":s}),children:[t.interactionMode==="plan"?u(mr,{icon:Vd,className:"text-current opacity-100"}):u(mr,{icon:Vi,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t.interactionMode==="plan"?"Plan":"Build"})]}),u(Xe,{side:"top",children:s})]})]}):null,c=b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Qe,{children:[b(xf,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[b(Ye,{render:u(kg,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(mr,{icon:a}),u(bf,{children:r.label})]}),b(Cf,{alignItemWithTrigger:!1,children:[Mg.map(f=>{let p=o(f),m=p.icon;return u(yf,{value:f,hideIndicator:!0,className:"min-w-64 py-2",children:u("div",{className:"flex min-w-0 items-center gap-3",children:b("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[b("span",{className:"inline-flex items-center gap-1.5 font-medium text-foreground",children:[u(m,{className:"size-icon-2 shrink-0 text-muted-foreground"}),p.label]}),u("span",{className:"text-muted-foreground text-xs leading-4",children:p.description})]})})},f)}),i?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Xe,{side:"top",children:i?`${r.description} ${n("runtimeMode.appliesNextTurnHint")}`:r.description})]}),i?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline",children:n("runtimeMode.appliesNextTurn")}):null]});return b(be,{children:[t.nativeMode?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),u(B_,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),O6=ue(function(t){return b(be,{children:[t.activeContextWindow?u(mD,{usage:t.activeContextWindow,modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}):null,t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:"Preparing worktree..."}):null,u(Fu,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isConnecting:t.isConnecting,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,onImplementPlanInNewThread:t.onImplementPlanInNewThread})]})}),xD=ue(function(t){let{composerDraftTarget:n,environmentId:o,attachmentUploadsCapabilityKnown:r,supportsAttachmentUploads:a,routeKind:i,routeThreadRef:s,draftId:l,activeThreadId:d,activeThreadEnvironmentId:c,activeThread:f,isServerThread:p,isLocalDraftThread:m,forceExpandedOnMobile:h,projectSelectionRequired:g,phase:v,isConnecting:x,isSendBusy:y,sendDisabledReason:C,isPreparingWorktree:w,environmentUnavailable:k,activePendingApproval:S,onRespondToComposerDecision:L,pendingUserInputs:I,activePendingProgress:T,activePendingResolvedAnswers:E,activePendingIsResponding:A,activePendingDraftAnswers:N,activePendingQuestionIndex:R,respondingRequestIds:$,occupants:H,showPlanFollowUpPrompt:K,activeProposedPlan:O,activeTasksProgress:oe,activeTaskSteps:ee,runtimeMode:W,interactionMode:qe,lockedProvider:ve,providerStatuses:fe,activeProjectDefaultModelSelection:Ne,projectId:Ae=null,activeThreadModelSelection:ae,selectedExecutionSelection:Ee,composerChoices:xe,selectedExecutionReady:re,selectedModelOptionDescriptors:Ie,onModelPickerOpenChange:st,onClearExecutionSelection:dt,executionAppliesTo:lt,activeContextWindow:ct,compactDisabled:Et,compactDisabledReason:ot,resolvedTheme:He,settings:Se,keybindings:ze,terminalOpen:Je,gitCwd:qt,promptRef:X,composerRef:nn,composerImagesRef:xt,composerTerminalContextsRef:mn,composerElementContextsRef:Tt,sendContextRef:Yt,onSend:Jt,onInterrupt:Mt,onCompactContext:zn,onImplementPlanInNewThread:kn,onRespondToApproval:vn,onSelectActivePendingUserInputOption:$n,onAdvanceActivePendingUserInput:Vt,onPreviousActivePendingUserInputQuestion:Zt,onChangeActivePendingUserInputCustomAnswer:Sn,onProviderModelSelect:ho,onModelSelectionChosen:zt,onExecutionSelectionChosen:D,onSelectPluginAction:Y,onManagePlugins:ce,getModelDisabledReason:ie,getModelContinuationLabel:pe,onContinueInModel:Ze,toggleInteractionMode:pt,handleRuntimeModeChange:xn,handleInteractionModeChange:ht,handleNativeModeChange:en,focusComposer:tn,scheduleComposerFocus:bt,setThreadError:yn,onExpandImage:sn}=t,ge=t.api,{limits:Rt}=t.attachments,{t:rt}=De(),Lt=ge.draft.useThreadDraft(n),et=Lt.prompt,Nt=Lt.images,ut=z(()=>Nt.filter(P=>av(P)==="image"),[Nt]),ft=Lt.terminalContexts,eo=Lt.elementContexts,ln=Lt.previewAnnotations,Nn=Lt.reviewComments,Hn=Lt.nonPersistedImageIds,Un=ge.uploads.useStore(P=>P.uploadsByImageId),ne=a?mT({imageIds:Nt.map(P=>P.id),uploadsByImageId:Un,environmentId:o}):null,Fe=ge.draft.useStore,at=Fe(P=>P.setPrompt),je=Fe(P=>P.setNativeMode),wn=Fe(P=>P.addImage),dn=Fe(P=>P.addImages),Cn=Fe(P=>P.removeImage),$t=Fe(P=>P.insertTerminalContext),Kn=Fe(P=>P.removeTerminalContext),Wt=Fe(P=>P.setTerminalContexts),vo=Fe(P=>P.removeElementContext),Wa=Fe(P=>P.removePreviewAnnotation),Ga=Fe(P=>P.removeReviewComment),Ni=Fe(P=>P.clearComposerPromptAndImages);q(()=>{if(r){if(!a){for(let P of Nt)ge.uploads.release(P.id);return}ge.draft.restoreAttachments();for(let P of Nt)ge.uploads.start({environmentId:o,image:P})}},[r,Nt,o,a]);let he=z(()=>SN(ge.model.applyInstanceSettings(ge.model.deriveInstanceEntries(fe),Se)),[ge.model,fe,Se]),da=Lt.activeProvider??null,Go=f?.session?.providerInstanceId??ae?.instanceId??Ne?.instanceId??null,gd=wN(he,da??Go)??he[0]?.driverKind??ge.model.makeDriverKind("unconfigured"),ca=ve??gd,qn=z(()=>{if(!ve||!f)return null;let P=f.session?.providerInstanceId??ae?.instanceId;return P?he.find(V=>V.instanceId===P)?.continuationGroupKey??null:null},[f,ae?.instanceId,ve,he]),_t=z(()=>{let P=[Lt.activeProvider,f?.session?.providerInstanceId,ae?.instanceId,Ne?.instanceId];for(let Be of P){if(!Be)continue;let We=he.find(nt=>nt.instanceId===Be&&Sg(nt));if(We){if(ve&&We.driverKind!==ve||qn&&We.continuationGroupKey!==qn)continue;return We.instanceId}}let V=he.filter(Be=>(!ve||Be.driverKind===ve)&&(!qn||Be.continuationGroupKey===qn)),le=V.filter(Be=>Be.driverKind===ca);return wg(le,void 0)?.instanceId??wg(V,void 0)?.instanceId??ge.model.noProviderSelection.instanceId},[Ne?.instanceId,f?.session?.providerInstanceId,ae?.instanceId,Lt.activeProvider,qn,ve,he,ca]),ro=z(()=>he.find(P=>P.instanceId===_t),[he,_t]),on=ro===void 0,_i=ot??(on?"Compacting is unavailable right now":null),It=ro?.driverKind??ca,{modelOptions:xo,selectedModel:bn,executionSelection:_e}=ge.draft.useEffectiveModelState({threadRef:n,providers:fe,selectedProvider:It,selectedInstanceId:_t,threadModelSelection:ae,projectModelSelection:Ne,settings:Se}),Gt=Ee===void 0?_e:Ee,Eo=z(()=>ro?.snapshot??null,[ro]),gr=z(()=>{let P=ro?.models??[];if(!Gt||Ie===void 0)return P;let V=P.find(le=>le.slug===bn);return[...P.filter(le=>le.slug!==bn),{...V??{slug:bn,name:bn},capabilities:{...V?.capabilities,optionDescriptors:Ie}}]},[ro,Gt,Ie,bn]),Di=z(()=>V_(et),[et]),yo=z(()=>W_({provider:It,model:bn,models:gr,promptInjectionState:Di,modelOptions:xo?.[_t],planModeEnabled:Se.planModeEnabled},ge.model),[xo,Di,_t,bn,It,gr,Se.planModeEnabled]),Hr=yo.promptEffort,jo=Gt?xo?.[_t]??Gt.optionOverrides:yo.modelOptionsForDispatch,hr=Se.planModeEnabled,ao=z(()=>({showInteractionModeToggle:hr&&ge.model.getInteractionModeToggle(fe,It),runtimeModeSwitch:Vw(It)}),[hr,fe,It]),Ur=Eo?.supportsNativeModeSwitch===!0,ua=m&&Ur?Lt.nativeModeByProvider?.[_t]??null:null,Oi=z(()=>O_(Eo,m?ua:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,Eo,m,ua]),_n=ua&&Oi?.current.id===ua?ua:void 0,Fi=B(P=>{m&&je(n,_t,P),en(P)},[m,je,n,_t,en]),Oo=z(()=>ge.model.createSelection(_t,bn,jo),[ge.model,_t,bn,jo]),Bi=z(()=>!Gt||!xe?.length?null:xe.find(P=>P.runtimeId===Gt.runtimeId&&P.sourceId===Gt.sourceId&&P.profileId===Gt.profileId&&(P.endpointId??void 0)===(Gt.endpointId??void 0))??null,[xe,Gt]),Fo=re??Bi?.ready===!0,vr=_(null);q(()=>{let P=f?.id??null,V=vr.current;vr.current={threadId:P,selection:Oo},!(V===null||V.threadId!==P||m)&&V.selection!==Oo&&zt?.(Oo)},[f?.id,m,zt,Oo]);let Qo=bn,io=z(()=>{let P=new Map;for(let V of he)P.set(V.instanceId,ge.model.getAppModelOptionsForInstance(Se,V));return P},[he,Se]),zi=z(()=>(io.get(_t)??[]).some(V=>V.slug===Qo)?Qo:ge.model.normalizeSlug(Qo,It)??Qo,[ge.model,io,_t,Qo,It]),Bo=m&&ve===null,$e=ge.pluginComposer.useOptions(Bo?o:null,Ae),vt=$e.options,cn=Bo?Lt.selectedPluginActionKey:null,rn=z(()=>cn===null?null:vt.find(P=>P.id===cn)??null,[cn,vt]),Qa=cn!==null,fa=Qa&&rn===null?rt($e.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,zo=C??fa??(T?null:ne),Kr=zo!==null,Og=z(()=>fD(ae,io),[ae,io]),un=`${String(o)}\0${String(n)}`,Fg=sr(et,et.length),Ys=Ba(un,et,{cursor:Fg,expandedCursor:et.length}),[$u,Bg]=G(()=>({documentKey:un,cursor:Ys.cursor})),pa=$u.documentKey===un?$u.cursor:Ys.cursor,U=B(P=>{Bg(V=>{let le=V.documentKey===un?V.cursor:Ba(un,X.current).cursor,Be=typeof P=="function"?P(le):P,We=X.current,nt=Ir(We,Be);return bM(un,We,Be,nt),V.documentKey===un&&V.cursor===Be?V:{documentKey:un,cursor:Be}})},[un,X]),[se,Re]=G(()=>lr(et,et.length)),[yt,gn]=G(null),[xr,Co]=G(null),[zg,Hu]=G(!1),[Uu,Ku]=G(!1);q(()=>{st?.(Uu)},[Uu,st]);let[ID,qu]=G(!1),[Vu,$g]=G(null),[SD,Hg]=G(null),[Ib,wD]=G(null),[Ug,ma]=G(!1),[hd,Js]=G(!1),[TD,Sb]=G(null),[Zs,Kg]=G({key:0,active:!1}),wb=_(un);ye(()=>{wb.current!==un&&(wb.current=un,Re(lr(et,Ys.expandedCursor)),gn(null),Co(null),Hu(!1),Ku(!1),$g(null),Hg(null),ma(!1),Js(!1),Sb(null),Kg({key:Zs.key,active:!1}))},[un,Ys.expandedCursor,et,Zs.key]);let yr=lp("max-sm"),so=yr&&!h&&!ID,ga=_(null),Tb=_(null),qg=_(null),Lb=_(null),Vg=_(!1),Wg=_(!1),kb=_(!1),Pb=_([]),Ab=_(null),bo=_(null),el=_(null),tl=_(null),Wu=_(!1),Eb=_(0),nl=_(null),Gg=_(new Set),$i=_(new Map),ol=z(()=>ge.chat.deriveComposerSendState({prompt:et,imageCount:Nt.length,terminalContexts:ft,elementContextCount:eo.length+ln.length+Nn.length}),[eo.length,Nt.length,ln.length,Nn.length,ft,et]),rl=se?.kind??null,Mb=se?.kind==="path"?se.query:"",Rb=rl==="path",jg=ge.pathSearch.useComposerPathSearch({environmentId:o,cwd:Rb?qt:null,query:Rb?Mb:null}),$o=z(()=>{if(!se)return[];if(se.kind==="path")return jg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:pu(P.path),description:P.path.slice(0,Math.max(0,P.path.lastIndexOf("/")))}));if(se.kind==="slash-command"){let P=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:"Switch response model for this thread"},...hr?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:"Switch this thread into plan mode"},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:"Switch this thread back to normal build mode"}]:[]],V=hM(Eo?.skills??[],Se.showSkillsInSlashMenu),le=vM(Eo?.slashCommands??[],V).map(kt=>({id:`provider-slash-command:${It}:${kt.name}`,type:"provider-slash-command",provider:It,command:kt,label:`/${kt.name}`,description:kt.description??kt.input?.hint??"Run provider command"})),Be=se.query.trim().toLowerCase(),We=V.map(kt=>({id:`skill:${It}:${kt.name}`,type:"skill",provider:It,skill:kt,label:`/skill:${kt.name}`,description:kt.shortDescription??kt.description??(kt.scope?`${kt.scope} skill`:"")})),nt=[...P,...le,...We];return $_(nt,Be)}return se.kind==="skill"?z_(Eo?.skills??[],se.query).map(P=>({id:`skill:${It}:${P.name}`,type:"skill",provider:It,skill:P,label:sa(P),description:P.shortDescription??P.description??(P.scope?`${P.scope} skill`:"Run provider skill")})):[]},[se,hr,It,Eo,Se.showSkillsInSlashMenu,jg.entries]),Hi=!!se,Xa=se?`${se.kind}:${se.query.trim().toLowerCase()}`:null,Nb=z(()=>{let P=ab({items:$o,highlightedItemId:yt,currentSearchKey:Xa,highlightedSearchKey:xr});return $o.find(V=>V.id===P)??null},[yt,xr,$o,Xa]);kb.current=Hi,Pb.current=$o,Ab.current=Nb;let LD=z(()=>new Set(Hn),[Hn]),Vn=S!==null,Gu=I[0]??null,_b=T?.activeQuestion?.allowFreeform===!1,vd=H[0]??null,{showTopDrawer:ju,showCollapsedPromptRow:kD,hasBlocking:xd}=qw(vd?.kind??null,so),PD=K||T!==null,{isComposerFooterCompact:yd,isComposerPrimaryActionsCompact:Db}=LT(qg,PD),AD=rl==="path"&&Mb.length>0&&jg.isPending,ED=z(()=>rl==="skill"?"No skills found. Try / to browse provider commands.":rl==="path"?"No matching files or folders.":"No matching command.",[rl]),Ob=B(P=>{if(P===X.current){bt();return}X.current=P,at(n,P);let V=sr(P,P.length);U(V),Re(lr(P,P.length)),bt()},[n,X,bt,at]),MD=j_({modelApi:ge.model,provider:It,instanceId:_t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:bn,models:gr,modelOptions:xo?.[_t],prompt:et,onPromptChange:Ob,planModeEnabled:Se.planModeEnabled}),Fb=Q_({modelApi:ge.model,provider:It,instanceId:_t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:bn,models:gr,modelOptions:xo?.[_t],prompt:et,onPromptChange:Ob,planModeEnabled:Se.planModeEnabled}),Qu=z(()=>T?{questionIndex:T.questionIndex,isLastQuestion:T.isLastQuestion,canAdvance:T.canAdvance,isResponding:A,isComplete:!!E}:null,[A,T,E]),RD=v==="running"||y||Kr||x||on||g||k!==null||!ol.hasSendableContent,ND="Send message",Cd=yr&&!so&&Qu!==null,al=B(P=>{at(n,P)},[n,at]),_D=B(P=>{wn(n,P)},[n,wn]),DD=B(P=>{dn(n,P)},[n,dn]),OD=B(P=>{ge.uploads.release(P),Cn(n,P)},[ge.uploads,n,Cn]),FD=B(P=>{let V=ft.findIndex(We=>We.id===P);if(V<0)return;let le=ge.terminalContext.removeInlinePlaceholder(X.current,V);X.current=le.prompt,al(le.prompt),Kn(n,P);let Be=sr(le.prompt,le.cursor);U(Be),Re(lr(le.prompt,le.cursor))},[n,ft,X,Kn,al]);ye(()=>{X.current=et,U(P=>ir(et,P))},[un,et,X,U]),q(()=>{if(Vu===null)return;let P=yb(et,Rt.maxInputChars);P!==Vu&&$g(P)},[Vu,Rt.maxInputChars,et]),q(()=>{Hg(null)},[eo,ln,Nn,ft,et,bn,Hr,It]),ye(()=>{xt.current=Nt},[Nt,xt]),ye(()=>{mn.current=ft},[ft,mn]),ye(()=>{Tt.current=eo},[eo,Tt]),q(()=>{if(!Hi){gn(null),Co(null);return}let P=ab({items:$o,highlightedItemId:yt,currentSearchKey:Xa,highlightedSearchKey:xr});gn(V=>V===P?V:P),Co(V=>V===Xa?V:Xa)},[yt,xr,$o,Hi,Xa]);let Xu=_(null);q(()=>{let P=T?.customAnswer;if(typeof P!="string"){Xu.current=null;return}let V=Gu?.requestId??null,le=T?.activeQuestion?.id??null,Be=Xu.current?.requestId!==V||Xu.current?.questionId!==le,We=X.current!==P;if(Xu.current={requestId:V,questionId:le},!Be&&!We)return;X.current=P;let nt=sr(P,P.length);U(nt),Re(lr(P,Ir(P,nt))),gn(null)},[T?.customAnswer,T?.activeQuestion?.id,Gu?.requestId,X]);let BD=B((P,V,le,Be,We)=>{if(T?.activeQuestion&&I.length>0){if(T.activeQuestion.allowFreeform===!1)return;U(V),Re(Be?null:lr(P,le)),Sn(T.activeQuestion.id,P,V,le,Be);return}X.current=P,al(P),N6(ft,We)||Wt(n,R6(ft,We)),U(V),Re(Be?null:lr(P,le))},[T?.activeQuestion,I.length,Sn,X,al,n,ft,Wt]),Ya=B((P,V,le,Be)=>{let We=X.current,nt=Math.max(0,Math.min(We.length,P)),kt=Math.max(nt,Math.min(We.length,V));if(Be?.expectedText!==void 0&&We.slice(nt,kt)!==Be.expectedText)return!1;let wt=tT(X.current,P,V,le),Mo=sr(wt.text,wt.cursor),Pn=Ir(wt.text,Mo);X.current=wt.text;let va=T?.activeQuestion;return va&&Gu?Sn(va.id,wt.text,Mo,Pn,!1):al(wt.text),U(Mo),Re(lr(wt.text,Pn)),Be?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{ga.current?.focusAt(Mo)}),!0},[T?.activeQuestion,Gu,Sn,X,al]),Yu=B(()=>{let P=ga.current?.readSnapshot();return P||{value:X.current,cursor:pa,expandedCursor:Ir(X.current,pa),terminalContextIds:ft.map(V=>V.id)}},[pa,ft,X]),Qg=B(()=>{let P=Yu();return{snapshot:P,trigger:lr(P.value,P.expandedCursor)}},[Yu]),Bb=B(P=>{if(Wg.current)return;Wg.current=!0,window.requestAnimationFrame(()=>{Wg.current=!1});let{snapshot:V,trigger:le}=Qg();if(le){if(P.type==="path"){let Be=`${Sc(P.path)} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}if(P.type==="slash-command"){if(P.command==="model"){Ya(le.rangeStart,le.rangeEnd,"",{expectedText:V.value.slice(le.rangeStart,le.rangeEnd),focusEditorAfterReplace:!1})&&(gn(null),Ku(!0));return}ht(P.command==="plan"?"plan":"default"),Ya(le.rangeStart,le.rangeEnd,"",{expectedText:V.value.slice(le.rangeStart,le.rangeEnd)})&&gn(null);return}if(P.type==="provider-slash-command"){let Be=`/${P.command.name} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}if(P.type==="skill"){let Be=`$${P.skill.name} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}}},[Ya,ht,Qg]),zD=B(P=>{gn(P),Co(Xa)},[Xa]),zb=B(P=>{if($o.length===0)return;let V=$o.findIndex(kt=>kt.id===yt),We=((V>=0?V:P==="ArrowDown"?-1:0)+(P==="ArrowDown"?1:-1)+$o.length)%$o.length,nt=$o[We];gn(nt?.id??null)},[yt,$o]),$b=B(()=>{if(!yr)return;bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),qu(!1)},[yr]),Hb=B(()=>!yr||y||Kr||x||on||k!==null||v==="running"?!1:T?T.isLastQuestion&&!!E:K||ol.hasSendableContent,[T,E,ol.hasSendableContent,k,x,yr,y,Kr,on,v,K]),Xg=B((P,V="foreground")=>{if(on||Kr){P?.preventDefault();return}if(d&&($i.current.get(un)??0)>0){P?.preventDefault(),ge.notify.info("Still compressing a pasted image.","Send again once its thumbnail appears.");return}let le=gD({prompt:X.current,submissionTarget:T?"pending-user-input":"provider-turn",maxInputChars:Rt.maxInputChars,disabledReason:zo,event:P,onSend:Be=>(Vg.current=!1,Jt(Be,V),!Vg.current)});$g(le.validationMessage),le.didDispatch&&Hb()&&$b()},[d,T,$b,un,Kr,Rt.maxInputChars,on,Jt,X,zo,Hb]),$D=B(()=>{if(!(Et||on||ol.hasSendableContent||S!==null||I.length>0||v==="running"||y||x||!d)){if(($i.current.get(un)??0)>0){ge.notify.info("Still compressing a pasted image.","Compact again once its thumbnail appears.");return}zn()}},[S,d,Et,un,ol.hasSendableContent,x,y,on,zn,I.length,v]),Ju=B(()=>{bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),el.current!==null&&window.cancelAnimationFrame(el.current),tl.current!==null&&window.cancelAnimationFrame(tl.current),Wu.current=!0,qu(!0),el.current=window.requestAnimationFrame(()=>{el.current=null,ga.current?.focusAtEnd(),tl.current=window.requestAnimationFrame(()=>{tl.current=null,Wu.current=!1})})},[]),HD=(P,V)=>{if(P==="Tab"&&V.shiftKey)return hr?(pt(),!0):!1;let{trigger:le}=Qg();if(kb.current||le!==null){let nt=Pb.current,kt=Ab.current??nt[0];if(P==="ArrowDown"&&nt.length>0)return zb("ArrowDown"),!0;if(P==="ArrowUp"&&nt.length>0)return zb("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&kt)return Bb(kt),!0}let We=P==="Enter"?Jw({isMobileViewport:yr,shiftKey:V.shiftKey,modifierKey:V.metaKey||V.ctrlKey,isDraftThread:i==="draft"}):null;return We?(Xg(void 0,We),!0):!1},Zu=ge.stash.useStore,il=Zu(P=>P.entries),Ub=Zu(P=>P.stashEntry),ef=Zu(P=>P.takeEntry),Kb=Zu(P=>P.finalizeEntryImages);q(()=>()=>{nl.current!==null&&window.clearTimeout(nl.current)},[]);let qb=B(()=>{Eb.current+=1,Kg({key:Eb.current,active:!0}),nl.current!==null&&window.clearTimeout(nl.current),nl.current=window.setTimeout(()=>{nl.current=null,Kg(P=>({...P,active:!1}))},1200)},[]),UD=B(P=>{let{entry:V,durable:le}=ef(P.id);if(!V)return;le||ge.notify.warning("Restored prompt may reappear in the stash","Browser storage rejected the update, so this entry could still be there after a reload."),ma(!1);let Be=X.current,We=P.prompt.length===0?Be:Be.trim().length?`${Be.replace(/\s+$/,"")}
3737
3737
 
3738
- ${P.prompt}`:P.prompt,ot=We!==Fe;ot&&(X.current=We,qe(n,We),Po(dr(We,We.length)),ce(null));let Pt=[];if(P.attachments.length>0){let Eo=new Set(yt.current.map(io=>io.id)),wn=new Set(yt.current.map(io=>`${io.mimeType}\0${io.sizeBytes}\0${io.name}`)),Ia=Math.max(0,vt.maxAttachments-yt.current.length),Bo=P.attachments.filter(io=>!Eo.has(io.id)&&!wn.has(`${io.mimeType}\0${io.sizeBytes}\0${io.name}`));Pt=Bo.slice(Ia).map(io=>io.name);let jr=ge.draft.hydrateImagesFromPersisted(Bo.slice(0,Ia));jr.length>0&&cn(n,jr)}let wt=[];P.droppedImageNames.length>0&&wt.push(`${P.droppedImageNames.join(", ")} exceeded the stash size limit when this prompt was saved.`),P.unreadableImageNames&&P.unreadableImageNames.length>0&&wt.push(`${P.unreadableImageNames.join(", ")} could not be read when this prompt was saved.`),Pt.length>0&&wt.push(`${Pt.join(", ")} could not be restored: the composer is at its ${vt.maxAttachments}-image limit.`),wt.length>0&&ge.notify.warning("Some images were not restored",wt.join(" ")),ot&&window.requestAnimationFrame(()=>{Ca.current?.focusAtEnd()})},[cn,n,yt,vt.maxAttachments,X,qe,nf]),HD=B(P=>{let{durable:V}=nf(P.id);V||ge.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[nf]),UD=B(async()=>{let P=X.current.split("\uFFFC").join("").trim(),V=[...yt.current];if(P.length===0&&V.length===0){ya(ot=>!ot);return}let se=`${String(n)}\0${P}\0${V.map(ot=>ot.id).join(",")}`;if(Gg.current.has(se))return;Gg.current.add(se);let Fe=n,We=hu();try{let{evicted:ot,written:Pt,durable:wt}=Hb({id:We,createdAt:new Date().toISOString(),prompt:P,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:V.length});if(!Pt){ge.notify.error("Could not stash this prompt","Browser storage rejected the write, so the composer was left as-is. Free up site data and try again.");return}wt||ge.notify.warning("Stashed prompt will not survive a reload","Browser storage is unavailable, so this stash is kept in memory only for this session."),X.current="",fa(Fe);for(let cl of V)ge.uploads.release(cl.id);Po(0),ce(null),Kb(),ot&&ge.notify.warning("Oldest stashed prompt discarded",`The stash holds ${ge.stash.maxEntries} prompts; the oldest was removed to make room.`);let Eo=[],wn=[],Ia=[];for(let cl of V){let Ld=await ge.imageCompression.compressForStash(cl.file);if(!Ld.ok){(Ld.reason==="too-large"?wn:Ia).push(cl.name);continue}Eo.push({id:cl.id,name:cl.name,mimeType:Ld.image.mimeType,sizeBytes:Ld.image.sizeBytes,dataUrl:Ld.image.dataUrl})}let{kept:Bo,droppedNames:jr}=ge.stash.partitionAttachments(Eo),{attached:io,durable:sf}=Ub(We,{attachments:Bo,droppedImageNames:[...wn,...jr],unreadableImageNames:Ia});io?!sf&&wt&&V.length>0&&ge.notify.warning("Stashed images were not saved","The prompt was stashed, but browser storage rejected its images. They will be missing if you reload."):Bo.length>0&&ge.notify.warning("Stashed images did not attach",`That prompt was restored or deleted before ${Bo.length} image${Bo.length===1?"":"s"} finished saving. Re-attach ${Bo.length===1?"it":"them"} if you still need ${Bo.length===1?"it":"them"}.`)}finally{Gg.current.delete(se)}},[fa,n,yt,Ub,X,Kb,Hb]),Jg=B(()=>{ya(P=>!P)},[]),KD=B(()=>{if(ao){ef(),ya(!0);return}Jg()},[ef,ao,Jg]),Zg=B(()=>{tl(P=>!P)},[]),Td=f?.latestTurn?.turnId??null,qb=Td!==null&&wD===Td,Gr=qb?null:oe,ba=qb?null:te,eh=B(()=>{Td!==null&&Sb(Td),tl(!1)},[Td]),of=dl.length>0&&!Kn&&(t.externalDrawerAttached||Xu||Cd||ao)?u(uv,{count:dl.length,menuOpen:Hg,placement:"inline",pulseKey:nl.key,pulsing:nl.active,onToggleMenu:KD}):null,rf=Gr!==null&&ba!==null&&!Cd&&!Id&&(t.externalDrawerAttached||Xu||ao)?u(fv,{expanded:!1,onDismiss:eh,onToggle:Zg,placement:"inline",progress:Gr,steps:ba}):null,th=!t.externalDrawerAttached&&!Xu&&!Cd&&!ao,qD=th&&(dl.length>0||Gr!==null&&ba!==null&&Gr.totalSteps>0);q(()=>{(Gr===null||ba===null)&&tl(!1)},[ba,Gr]),q(()=>{Id&&tl(!1)},[Id]),q(()=>{tl(!1)},[d]),q(()=>{Ui&&ya(!1)},[Ui]),q(()=>{ya(!1)},[tt]),ge.pane.useKeydown(P=>{if(ge.keybindings.resolveShortcutCommand(P,Be,{context:{terminalFocus:ge.terminalFocus.getOwner()!==null,terminalOpen:Ze,modelPickerOpen:el}})==="composer.stash"&&(P.preventDefault(),P.stopPropagation(),!ge.commandPalette.isOpen())){if(I.length>0&&!Kn){ya(se=>!se);return}Kn||g||T!==null||UD()}},{capture:!0});let af=async P=>{if(!d||P.length===0)return;if(I.length>0){ge.notify.error(Lt("attachments.answerQuestionsFirst"));return}let V=d,se=yn,Fe=Hi.current.get(se)??0,We=yt.current.length+Fe,ot=[],Pt=null;for(let wt of P){if(We>=vt.maxAttachments){Pt=Lt("attachments.limitReached",{count:vt.maxAttachments});break}if(wt.size<=0){Pt=Lt("attachments.empty",{name:wt.name});continue}ot.push(wt),We+=1}if(bt(V,Pt),ot.length!==0){Hi.current.set(se,Fe+ot.length);try{let wt=[],Eo=null;for(let wn of ot){if(!(ge.imageCompression.isHeicFile(wn)||rv(wn.type))){let sf=a?vt.maxFileBytes:vt.maxImageBytes;if(wn.size>sf){Eo=Lt("attachments.tooLarge",{name:wn.name,limit:iv(sf)});continue}wt.push({...sv({id:hu(),name:wn.name||"file",mimeType:wn.type||"application/octet-stream",sizeBytes:wn.size}),previewUrl:URL.createObjectURL(wn),file:wn});continue}let Bo=await ge.imageCompression.prepareForAttachment(wn,vt.maxImageBytes);if(!Bo.ok){Eo=Bo.reason==="unreadable"?Lt("attachments.unreadableImage",{name:wn.name}):Lt("attachments.imageTooLarge",{name:wn.name});continue}let jr=Bo.file,io=URL.createObjectURL(jr);wt.push({...sv({id:hu(),name:jr.name||"image",mimeType:jr.type,sizeBytes:jr.size}),previewUrl:io,file:jr})}wt.length===1&&wt[0]?ND(wt[0]):wt.length>1&&_D(wt),Eo!==null&&bt(V,Eo)}finally{let wt=(Hi.current.get(se)??0)-ot.length;wt>0?Hi.current.set(se,wt):Hi.current.delete(se)}}},VD=P=>{DD(P)},WD=P=>{let V=Array.from(P.target.files??[]);P.target.value="",V.length!==0&&af(V)},GD=P=>{let V=Array.from(P.clipboardData.files);V.length!==0&&(P.preventDefault(),af(V))},Vb=(P,V)=>{if(P.length===0||x||Kn||I.length>0||g)return!1;let se=X.current,Fe=(V?.ensureLeadingBoundary??!1)&&se.length>0&&!/\s$/.test(se);return ei(se.length,se.length,Fe?` ${P}`:P)},nh=oT({insertMentionAtEnd:P=>Vb(P,{ensureLeadingBoundary:!0}),setDragActive:Vu,onInsertRejected:()=>{ge.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),jD=P=>{if(!cv(P.dataTransfer.types))return;P.stopPropagation();let V=P.relatedTarget;V instanceof Node&&P.currentTarget.contains(V)||Vu(!1)};q(()=>{if(!Ao)return;let P=()=>{Vu(!1)};return window.addEventListener("dragend",P),()=>window.removeEventListener("dragend",P)},[Ao]);let oh=B(()=>{Jt()},[Jt]),rh=B(()=>{On()},[On]),QD=B(()=>{Sr&&(ju.current||(vo.current!==null&&window.cancelAnimationFrame(vo.current),vo.current=window.requestAnimationFrame(()=>{if(vo.current=null,ju.current)return;let P=Lb.current,V=Kg.current,se=document.activeElement;se instanceof Element&&R6(se)||se instanceof Node&&(P&&P.contains(se)||V&&V.contains(se))||Wu(!1)})))},[Sr]);return q(()=>()=>{vo.current!==null&&window.cancelAnimationFrame(vo.current),ol.current!==null&&window.cancelAnimationFrame(ol.current),rl.current!==null&&window.cancelAnimationFrame(rl.current)},[]),Xr(nn,()=>({focusAtEnd:()=>{Ca.current?.focusAtEnd()},focusAt:P=>{Ca.current?.focusAt(P)},addDroppedFiles:P=>{af(P),Zt()},insertTextAtEnd:Vb,openModelPicker:()=>{yd(!0)},toggleModelPicker:()=>{yd(P=>!P)},compactContext:Yg,isModelPickerOpen:()=>el,isMentionMenuOpen:()=>Wg.current,readSnapshot:()=>Zu(),resetCursorState:P=>{let V=P?.prompt??X.current,se=lr(V,P?.cursor??0);rt(null),Po(se),ce(P?.detectTrigger?cr(V,Lr(V,se)):null)},addTerminalContext:P=>{if(!f)return;let V=Ca.current?.readSnapshot()??{value:X.current,cursor:xa,expandedCursor:Lr(X.current,xa),terminalContextIds:Ge.map(ot=>ot.id)},se=ge.terminalContext.insertInlinePlaceholder(V.value,V.expandedCursor),Fe=dr(se.prompt,se.cursor);vn(n,se.prompt,{id:hu(),threadId:f.id,createdAt:new Date().toISOString(),...P},se.contextIndex)&&(X.current=se.prompt,Po(Fe),ce(cr(se.prompt,se.cursor)),window.requestAnimationFrame(()=>{Ca.current?.focusAt(Fe)}))},getSendContext:()=>({prompt:X.current,images:yt.current,terminalContexts:dn.current,elementContexts:Tt.current,previewAnnotations:En,reviewComments:gn,selectedPromptEffort:Wo,selectedModelOptionsForDispatch:yr,selectedModelSelection:Cr,...he?{executionSelection:he}:{},executionReady:$i,...zi?{selectedNativeModeId:zi}:{},providerAvailable:!Gt,selectedProvider:tn,selectedModel:on,selectedProviderModels:Vo,selectedPluginAction:an}),validateProviderInput:P=>{let V=br??Cb({prompt:X.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:vt.maxInputChars});return qg.current=V!==null,$g(V),V===null}}),[f,af,n,xa,Ge,vn,X,yt,dn,Tt,En,gn,Zt,x,Kn,I.length,g,ei,el,Zu,on,yr,Cr,he,$i,zi,Gt,Wo,tn,Vo,an,br,Yg,vt.maxInputChars]),b("form",{ref:Kg,onSubmit:Xg,onFocusCapture:P=>{let V=P.target;ao&&V instanceof HTMLElement&&V.closest('[data-chat-composer-collapsed-controls="true"]')||(vo.current!==null&&(window.cancelAnimationFrame(vo.current),vo.current=null),Wu(!0))},onBlurCapture:()=>{QD()},onDragEnterCapture:nh.onDragEnter,onDragOverCapture:nh.onDragOver,onDragLeaveCapture:jD,onDropCapture:nh.onDrop,className:F("mx-auto w-full min-w-0 max-w-3xl",qD&&"pt-7"),"data-chat-composer-form":"true",children:[Xu&&(!Cd||Id)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":bd?.kind==="approval"?"warning":"info","data-occupant":bd?.kind??"none",children:bd===null?null:N_({occupant:bd,respondingRequestIds:$,keybindings:Be,onRespondToApproval:An,onRespondToDecision:L,activePendingDraftAnswers:N,activePendingQuestionIndex:R,onSelectActivePendingUserInputOption:fn,onAdvanceActivePendingUserInput:Fn,activeProposedPlan:O,collapsedPendingRow:u($N,{activePendingProgress:T,isPendingUserInputChoiceOnly:Nb,expandMobileComposer:ef,inlineTasksBadge:rf,inlineStashBadge:of,pendingPrimaryAction:Yu,isSendBusy:y,sendDisabledReason:Wr,isConnecting:x,isEnvironmentUnavailable:k!==null||Gt||g,onPreviousActivePendingUserInputQuestion:Nt,handleInterruptPrimaryAction:oh,handleImplementPlanInNewThreadPrimaryAction:rh})},ao)}):null,Cd&&!Id&&Gr&&ba?u(fT,{onDismiss:eh,onCollapse:Zg,progress:Gr,steps:ba}):null,b("div",{className:"relative",children:[th&&Gr&&ba?u(fv,{expanded:!1,hasTrailingShoulder:dl.length>0,onDismiss:eh,onToggle:Zg,progress:Gr,steps:ba}):null,th?u(uv,{count:dl.length,menuOpen:Hg,pulseKey:nl.key,pulsing:nl.active,onToggleMenu:Jg}):null,u("div",{"data-chat-composer-main-surface":"true",className:F("group relative z-10 rounded-[22px] p-px transition-colors duration-200",xr.composerFrameClassName),children:b("div",{ref:Lb,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":ao?"true":"false",className:F("rounded-[20px] transition-[background-color] duration-200",Ao?"bg-accent/45 ring-1 ring-primary/70":null,g?"opacity-75":null,xr.composerSurfaceClassName),children:[t.firstRow?u("div",{className:"flex items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:t.firstRow}):null,t.sourceMetrics&&!Kn?u(cD,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,LD?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(T?T.customAnswer:tt.trim())?"text-foreground":"text-placeholder"),onPointerDown:P=>P.preventDefault(),onClick:ef,"aria-label":"Expand composer",children:T?T.customAnswer||"Type your own answer, or leave this blank to use the selected option":tt.trim()||(Gt?"Enable a provider in Settings":"Ask anything...")}),rf,of,u("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:MD,"aria-label":RD,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),Xg()},children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):null,b("div",{ref:SD,className:F("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Kn&&"pb-3 sm:pb-4",ao&&"hidden"),children:[Hg&&!Ui&&!Kn&&u(hD,{anchor:Ib,children:u(dT,{entries:dl,onRestore:$D,onDelete:HD,onClose:()=>ya(!1)})}),Ui&&!Kn&&u(hD,{anchor:Ib,children:u(zN,{items:Fo,resolvedTheme:$e,isLoading:PD,triggerKind:sl,emptyStateText:AD,activeItemId:Rb?.id??null,onHighlightedItemChange:BD,onSelect:Fb})}),!ao&&!Kn&&I.length===0&&En.length>0&&u(IT,{annotations:En,images:It,...a?{uploadsByImageId:Mn,onRetryUpload:P=>ge.uploads.retry({environmentId:o,image:P})}:{},onRemove:P=>{ge.uploads.release(P),mo(n,P)},onExpandImage:P=>{let V=xb(zn,P);V&&mn(V)},className:"mb-3"}),!ao&&!Kn&&I.length===0&&gn.length>0&&u(bT,{comments:gn,onRemove:P=>Ya(n,P),className:"mb-3"}),!ao&&!Kn&&I.length===0&&_t.length>0&&u(CT,{contexts:_t,onRemove:P=>en(n,P),className:"mb-3"}),!ao&&!Kn&&I.length===0&&It.some(P=>!En.some(V=>V.id===P.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:It.filter(P=>!En.some(V=>V.id===P.id)).map(P=>{let V=a?Mn[P.id]:void 0,se=av(P),Fe=mT(se),We=se==="image"&&!!P.previewUrl;return b("div",{className:F("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",We?"w-16":"w-44 max-w-full"),children:[We?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":Lt("attachments.preview",{name:P.name}),onClick:()=>{let ot=xb(zn,P.id);ot&&mn(ot)},children:u("img",{src:P.previewUrl,alt:P.name,className:"h-full w-full object-cover"})}):b("a",{href:P.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":Lt("attachments.open",{name:P.name}),children:[u(Fe,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:P.name}),u("span",{className:"block text-[10px] text-secondary-label",children:iv(P.sizeBytes)})]})]}),TD.has(P.id)&&b(Xe,{children:[u(Je,{render:u("span",{role:"img","aria-label":Lt("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-amber-600",children:u(yo,{className:"size-3"})})}),u(Ye,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Lt("attachments.draftMayNotPersistDetail")})]}),V?.status==="uploading"&&u("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-[10px] text-foreground",children:mp(V.progress)}),V?.status==="failed"&&b(Xe,{children:[u(Je,{render:u(ne,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>ge.uploads.retry({environmentId:o,image:P}),"aria-label":Lt("attachments.retryUpload",{name:P.name})}),children:u(os,{})}),u(Ye,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:V.reason})]}),u(ne,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>VD(P.id),"aria-label":Lt("attachments.remove",{name:P.name}),children:u(jt,{})})]},P.id)})}),b("div",{className:"relative",children:[Nb?null:u(MM,{editorRef:Ca,documentKey:yn,value:Kn?"":T?T.customAnswer:tt,cursor:xa,terminalContexts:!Kn&&I.length===0?Ge:[],skills:bn?.skills??[],...wd?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:OD,onChange:FD,onCommandKeyDown:zD,onPaste:GD,placeholder:Kn?S?.detail??"Resolve this approval request to continue":T?"Type your own answer, or leave this blank to use the selected option":K&&O?"Add feedback to refine the plan, or leave this blank to implement it":g?"Choose a project above to start a thread":Gt?"Enable a provider in Settings to send a message":v==="disconnected"?tT:"Ask anything, @tag files/folders, $use skills, or / for commands",disabled:x||Kn||g}),wd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[rf,of,u(Hu,{compact:!0,pendingAction:Yu,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:Wr,isConnecting:x,isEnvironmentUnavailable:k!==null||Gt||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Nt,onInterrupt:oh,onImplementPlanInNewThread:rh})]}):null]})]}),u(gD,{message:ID??Gu}),br===null?null:u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-plugin-blocked":"true",children:br}),ao||Kn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":Sd?"true":"false",className:F("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",I.length>0&&"pt-2",Sd?"gap-1.5":"gap-2 sm:gap-0",wd&&"hidden sm:flex"),children:[b("div",{className:"-m-1 -ms-3.5 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto p-1 ps-3.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[u("input",{ref:Tb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:WD}),b(Xe,{children:[u(Je,{render:u(ne,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:x||g||I.length>0,"aria-label":Lt("attachments.add"),onClick:()=>Tb.current?.click()}),children:u(Mo,{})}),u(Ye,{side:"top",children:Lt("attachments.add")})]}),Gt?b(ne,{type:"button",size:"sm",variant:"ghost",disabled:!0,"data-chat-provider-unavailable":"true",className:"shrink-0 gap-2 px-2 text-secondary-label sm:px-3",children:[u(yo,{className:"size-4"}),"No provider available"]}):u(BN,{compact:Sd,activeInstanceId:kt,model:Qo,lockedProvider:ve,lockedContinuationGroupKey:qo,instanceEntries:Jn,keybindings:Be,modelOptionsByInstance:jo,triggerClassName:"-ms-2.5",terminalOpen:Ze,open:el,...xr.modelPickerIconClassName?{activeProviderIconClassName:xr.modelPickerIconClassName}:{},onOpenChange:P=>{yd(P)},getModelDisabledReason:de,getModelContinuationLabel:ie,onContinueInModel:pe,onInstanceModelChange:Bn,...xe?{composerChoices:xe}:{},selectedExecutionSelection:he??null,onClearExecutionSelection:dt,executionAppliesTo:lt,sourceLabel:ha?.sourceLabel,...zt?{onChooseExecution:P=>{zt(P.selection,P)}}:{},...va?{pluginActions:ze,selectedPluginActionKey:an?.id??null,onSelectPluginAction:D,onManagePlugins:Y}:{}}),xn?null:b(be,{children:[u(eD,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:Sd}),Sd?u(__,{interactionMode:Ke,runtimeMode:W,runtimeModeSwitch:Vr.runtimeModeSwitch,nativeMode:Bi,canSwitchNativeMode:go,showInteractionModeToggle:Vr.showInteractionModeToggle,traitsMenuContent:ED,onToggleInteractionMode:et,onRuntimeModeChange:gt,onNativeModeChange:Un}):b(be,{children:[Ob?b(be,{children:[u(nc,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),Ob]}):null,u(N6,{showInteractionModeToggle:Vr.showInteractionModeToggle,interactionMode:Ke,runtimeMode:W,runtimeModeSwitch:Vr.runtimeModeSwitch,nativeMode:Bi,canSwitchNativeMode:go,onToggleInteractionMode:et,onRuntimeModeChange:gt,onNativeModeChange:Un})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":_b?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[wd?null:rf,wd?null:of,u(_6,{compact:_b,activeContextWindow:ct,activeThreadModelDisplayName:Js,pendingAction:Yu,isRunning:v==="running",showPlanFollowUpPrompt:I.length===0&&K,promptHasText:tt.trim().length>0,isSendBusy:y,sendDisabledReason:Wr,isConnecting:x,isEnvironmentUnavailable:k!==null||Gt||g,isPreparingWorktree:w,hasSendableContent:il.hasSendableContent,preserveComposerFocusOnPointerDown:Sr,showSendWhileRunning:Sr,onPreviousPendingQuestion:Nt,onInterrupt:oh,onImplementPlanInNewThread:rh,compactDisabled:Mt||Gt||y||x,compactDisabledReason:ga,onCompactContext:Yg})]})]})]})})]})]})});function xD(e){let{composerRef:t,...n}=e,o=n;return u(iT,{value:o.api,children:u(vD,{...o,composerRef:t})})}function yD(e){return u(gh.Provider,{value:e.scope.active,children:u(D6,{...e})})}function D6(e){let{scope:t,mode:n,timeline:o,trajectory:r,queue:a,composer:i}=e,[s,l]=Sn("turn-navigator",t.threadKey,null),d=u(xD,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:b(be,{children:[u(oS,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(sS,{...s,placement:"inline",onSelect:c=>{n.onModeChange("chat"),s.onSelect(c)}}):null]})});return b("div",{className:F("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(rS,{chat:u(v0,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u(b0,{...r,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(Uw,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:d,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:b(be,{children:[u(Fw,{inputKey:t.threadKey,actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(nv,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var O6=".ycodium-conversation-ui";function F6(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function CD(e,t="conversation"){let n=F6(),o=e.replaceAll(O6,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function B6(e){let t=CD(jb);return{views:{[dh]:z6(t,e)},viewCapabilities:{[dh]:[eI]}}}function z6(e,t){return function(o){let a=o[ch]??t,i={...o};return delete i[ch],b(Yb,{value:a,children:[u($6,{retain:e.retain}),u(Zb,{value:e.scopeClass,children:u(yD,{...i,scopeClass:e.scopeClass})})]})}}function $6({retain:e}){return Pd(()=>e(),[e]),null}export{B6 as default};
3738
+ ${P.prompt}`:P.prompt,nt=We!==Be;nt&&(X.current=We,at(n,We),U(sr(We,We.length)),Re(null));let kt=[];if(P.attachments.length>0){let Mo=new Set(xt.current.map(lo=>lo.id)),Pn=new Set(xt.current.map(lo=>`${lo.mimeType}\0${lo.sizeBytes}\0${lo.name}`)),va=Math.max(0,Rt.maxAttachments-xt.current.length),Ho=P.attachments.filter(lo=>!Mo.has(lo.id)&&!Pn.has(`${lo.mimeType}\0${lo.sizeBytes}\0${lo.name}`));kt=Ho.slice(va).map(lo=>lo.name);let Vr=ge.draft.hydrateImagesFromPersisted(Ho.slice(0,va));Vr.length>0&&dn(n,Vr)}let wt=[];P.droppedImageNames.length>0&&wt.push(`${P.droppedImageNames.join(", ")} exceeded the stash size limit when this prompt was saved.`),P.unreadableImageNames&&P.unreadableImageNames.length>0&&wt.push(`${P.unreadableImageNames.join(", ")} could not be read when this prompt was saved.`),kt.length>0&&wt.push(`${kt.join(", ")} could not be restored: the composer is at its ${Rt.maxAttachments}-image limit.`),wt.length>0&&ge.notify.warning("Some images were not restored",wt.join(" ")),nt&&window.requestAnimationFrame(()=>{ga.current?.focusAtEnd()})},[dn,n,xt,Rt.maxAttachments,X,at,ef]),KD=B(P=>{let{durable:V}=ef(P.id);V||ge.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[ef]),qD=B(async()=>{let P=X.current.split("\uFFFC").join("").trim(),V=[...xt.current];if(P.length===0&&V.length===0){ma(nt=>!nt);return}let le=`${String(n)}\0${P}\0${V.map(nt=>nt.id).join(",")}`;if(Gg.current.has(le))return;Gg.current.add(le);let Be=n,We=fu();try{let{evicted:nt,written:kt,durable:wt}=Ub({id:We,createdAt:new Date().toISOString(),prompt:P,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:V.length});if(!kt){ge.notify.error("Could not stash this prompt","Browser storage rejected the write, so the composer was left as-is. Free up site data and try again.");return}wt||ge.notify.warning("Stashed prompt will not survive a reload","Browser storage is unavailable, so this stash is kept in memory only for this session."),X.current="",Ni(Be);for(let sl of V)ge.uploads.release(sl.id);U(0),Re(null),qb(),nt&&ge.notify.warning("Oldest stashed prompt discarded",`The stash holds ${ge.stash.maxEntries} prompts; the oldest was removed to make room.`);let Mo=[],Pn=[],va=[];for(let sl of V){let Id=await ge.imageCompression.compressForStash(sl.file);if(!Id.ok){(Id.reason==="too-large"?Pn:va).push(sl.name);continue}Mo.push({id:sl.id,name:sl.name,mimeType:Id.image.mimeType,sizeBytes:Id.image.sizeBytes,dataUrl:Id.image.dataUrl})}let{kept:Ho,droppedNames:Vr}=ge.stash.partitionAttachments(Mo),{attached:lo,durable:rf}=Kb(We,{attachments:Ho,droppedImageNames:[...Pn,...Vr],unreadableImageNames:va});lo?!rf&&wt&&V.length>0&&ge.notify.warning("Stashed images were not saved","The prompt was stashed, but browser storage rejected its images. They will be missing if you reload."):Ho.length>0&&ge.notify.warning("Stashed images did not attach",`That prompt was restored or deleted before ${Ho.length} image${Ho.length===1?"":"s"} finished saving. Re-attach ${Ho.length===1?"it":"them"} if you still need ${Ho.length===1?"it":"them"}.`)}finally{Gg.current.delete(le)}},[Ni,n,xt,Kb,X,qb,Ub]),Yg=B(()=>{ma(P=>!P)},[]),VD=B(()=>{if(so){Ju(),ma(!0);return}Yg()},[Ju,so,Yg]),Jg=B(()=>{Js(P=>!P)},[]),bd=f?.latestTurn?.turnId??null,Vb=bd!==null&&TD===bd,qr=Vb?null:oe,ha=Vb?null:ee,Zg=B(()=>{bd!==null&&Sb(bd),Js(!1)},[bd]),tf=il.length>0&&!Vn&&(t.externalDrawerAttached||ju||hd||so)?u(uv,{count:il.length,menuOpen:Ug,placement:"inline",pulseKey:Zs.key,pulsing:Zs.active,onToggleMenu:VD}):null,nf=qr!==null&&ha!==null&&!hd&&!xd&&(t.externalDrawerAttached||ju||so)?u(fv,{expanded:!1,onDismiss:Zg,onToggle:Jg,placement:"inline",progress:qr,steps:ha}):null,eh=!t.externalDrawerAttached&&!ju&&!hd&&!so,WD=eh&&(il.length>0||qr!==null&&ha!==null&&qr.totalSteps>0);q(()=>{(qr===null||ha===null)&&Js(!1)},[ha,qr]),q(()=>{xd&&Js(!1)},[xd]),q(()=>{Js(!1)},[d]),q(()=>{Hi&&ma(!1)},[Hi]),q(()=>{ma(!1)},[et]),ge.pane.useKeydown(P=>{if(ge.keybindings.resolveShortcutCommand(P,ze,{context:{terminalFocus:ge.terminalFocus.getOwner()!==null,terminalOpen:Je,modelPickerOpen:Uu}})==="composer.stash"&&(P.preventDefault(),P.stopPropagation(),!ge.commandPalette.isOpen())){if(I.length>0&&!Vn){ma(le=>!le);return}Vn||g||T!==null||qD()}},{capture:!0});let of=async P=>{if(!d||P.length===0)return;if(I.length>0){ge.notify.error(rt("attachments.answerQuestionsFirst"));return}let V=d,le=un,Be=$i.current.get(le)??0,We=xt.current.length+Be,nt=[],kt=null;for(let wt of P){if(We>=Rt.maxAttachments){kt=rt("attachments.limitReached",{count:Rt.maxAttachments});break}if(wt.size<=0){kt=rt("attachments.empty",{name:wt.name});continue}nt.push(wt),We+=1}if(yn(V,kt),nt.length!==0){$i.current.set(le,Be+nt.length);try{let wt=[],Mo=null;for(let Pn of nt){if(!(ge.imageCompression.isHeicFile(Pn)||rv(Pn.type))){let rf=a?Rt.maxFileBytes:Rt.maxImageBytes;if(Pn.size>rf){Mo=rt("attachments.tooLarge",{name:Pn.name,limit:iv(rf)});continue}wt.push({...sv({id:fu(),name:Pn.name||"file",mimeType:Pn.type||"application/octet-stream",sizeBytes:Pn.size}),previewUrl:URL.createObjectURL(Pn),file:Pn});continue}let Ho=await ge.imageCompression.prepareForAttachment(Pn,Rt.maxImageBytes);if(!Ho.ok){Mo=Ho.reason==="unreadable"?rt("attachments.unreadableImage",{name:Pn.name}):rt("attachments.imageTooLarge",{name:Pn.name});continue}let Vr=Ho.file,lo=URL.createObjectURL(Vr);wt.push({...sv({id:fu(),name:Vr.name||"image",mimeType:Vr.type,sizeBytes:Vr.size}),previewUrl:lo,file:Vr})}wt.length===1&&wt[0]?_D(wt[0]):wt.length>1&&DD(wt),Mo!==null&&yn(V,Mo)}finally{let wt=($i.current.get(le)??0)-nt.length;wt>0?$i.current.set(le,wt):$i.current.delete(le)}}},GD=P=>{OD(P)},jD=P=>{let V=Array.from(P.target.files??[]);P.target.value="",V.length!==0&&of(V)},QD=P=>{let V=Array.from(P.clipboardData.files);V.length!==0&&(P.preventDefault(),of(V))},Wb=(P,V)=>{if(P.length===0||x||Vn||I.length>0||g)return!1;let le=X.current,Be=(V?.ensureLeadingBoundary??!1)&&le.length>0&&!/\s$/.test(le);return Ya(le.length,le.length,Be?` ${P}`:P)},th=rT({insertMentionAtEnd:P=>Wb(P,{ensureLeadingBoundary:!0}),setDragActive:Hu,onInsertRejected:()=>{ge.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),XD=P=>{if(!cv(P.dataTransfer.types))return;P.stopPropagation();let V=P.relatedTarget;V instanceof Node&&P.currentTarget.contains(V)||Hu(!1)};q(()=>{if(!zg)return;let P=()=>{Hu(!1)};return window.addEventListener("dragend",P),()=>window.removeEventListener("dragend",P)},[zg]);let nh=B(()=>{Mt()},[Mt]),oh=B(()=>{kn()},[kn]),YD=B(()=>{yr&&(Wu.current||(bo.current!==null&&window.cancelAnimationFrame(bo.current),bo.current=window.requestAnimationFrame(()=>{if(bo.current=null,Wu.current)return;let P=Lb.current,V=qg.current,le=document.activeElement;le instanceof Element&&_6(le)||le instanceof Node&&(P&&P.contains(le)||V&&V.contains(le))||qu(!1)})))},[yr]);q(()=>()=>{bo.current!==null&&window.cancelAnimationFrame(bo.current),el.current!==null&&window.cancelAnimationFrame(el.current),tl.current!==null&&window.cancelAnimationFrame(tl.current)},[]);let rh=()=>({prompt:X.current,images:xt.current,terminalContexts:mn.current,elementContexts:Tt.current,previewAnnotations:ln,reviewComments:Nn,selectedPromptEffort:Hr,selectedModelOptionsForDispatch:jo,selectedModelSelection:Oo,...Gt?{executionSelection:Gt}:{},executionReady:Fo,..._n?{selectedNativeModeId:_n}:{},providerAvailable:!on,selectedProvider:It,selectedModel:bn,selectedProviderModels:gr,selectedPluginAction:rn});return Yt.current=rh,Gr(nn,()=>({focusAtEnd:()=>{ga.current?.focusAtEnd()},focusAt:P=>{ga.current?.focusAt(P)},addDroppedFiles:P=>{of(P),tn()},insertTextAtEnd:Wb,toggleModelPicker:()=>{Ku(P=>!P)},readSnapshot:()=>Yu(),resetCursorState:P=>{let V=P?.prompt??X.current,le=ir(V,P?.cursor??0);gn(null),U(le),Re(P?.detectTrigger?lr(V,Ir(V,le)):null)},addTerminalContext:P=>{if(!f)return;let V=ga.current?.readSnapshot()??{value:X.current,cursor:pa,expandedCursor:Ir(X.current,pa),terminalContextIds:ft.map(nt=>nt.id)},le=ge.terminalContext.insertInlinePlaceholder(V.value,V.expandedCursor),Be=sr(le.prompt,le.cursor);$t(n,le.prompt,{id:fu(),threadId:f.id,createdAt:new Date().toISOString(),...P},le.contextIndex)&&(X.current=le.prompt,U(Be),Re(lr(le.prompt,le.cursor)),window.requestAnimationFrame(()=>{ga.current?.focusAt(Be)}))},readSendIdentity:()=>({pluginActionId:rn?.id??null,prompt:X.current}),getSendContext:rh,validateProviderInput:P=>{let V=fa??Cb({prompt:X.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:Rt.maxInputChars});return Vg.current=V!==null,Hg(V),V===null}}),[f,of,n,pa,ft,$t,X,xt,mn,Tt,ln,Nn,tn,x,Vn,I.length,g,Ya,Yu,bn,jo,Oo,Gt,Fo,_n,on,Hr,It,gr,rn,fa,rh,Yt,Rt.maxInputChars]),b("form",{ref:qg,onSubmit:Xg,onFocusCapture:P=>{let V=P.target;so&&V instanceof HTMLElement&&V.closest('[data-chat-composer-collapsed-controls="true"]')||(bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),qu(!0))},onBlurCapture:()=>{YD()},onDragEnterCapture:th.onDragEnter,onDragOverCapture:th.onDragOver,onDragLeaveCapture:XD,onDropCapture:th.onDrop,className:F("mx-auto w-full min-w-0 max-w-3xl",WD&&"pt-7"),"data-chat-composer-form":"true",children:[ju&&(!hd||xd)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":vd?.kind==="approval"?"warning":"info","data-occupant":vd?.kind??"none",children:vd===null?null:__({occupant:vd,respondingRequestIds:$,keybindings:ze,onRespondToApproval:vn,onRespondToDecision:L,activePendingDraftAnswers:N,activePendingQuestionIndex:R,onSelectActivePendingUserInputOption:$n,onAdvanceActivePendingUserInput:Vt,activeProposedPlan:O,collapsedPendingRow:u(HN,{activePendingProgress:T,isPendingUserInputChoiceOnly:_b,expandMobileComposer:Ju,inlineTasksBadge:nf,inlineStashBadge:tf,pendingPrimaryAction:Qu,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,onPreviousActivePendingUserInputQuestion:Zt,handleInterruptPrimaryAction:nh,handleImplementPlanInNewThreadPrimaryAction:oh})},so)}):null,hd&&!xd&&qr&&ha?u(pT,{onDismiss:Zg,onCollapse:Jg,progress:qr,steps:ha}):null,b("div",{className:"relative",children:[eh&&qr&&ha?u(fv,{expanded:!1,hasTrailingShoulder:il.length>0,onDismiss:Zg,onToggle:Jg,progress:qr,steps:ha}):null,eh?u(uv,{count:il.length,menuOpen:Ug,pulseKey:Zs.key,pulsing:Zs.active,onToggleMenu:Yg}):null,u("div",{"data-chat-composer-main-surface":"true",className:F("group relative z-10 rounded-[22px] p-px transition-colors duration-200",yo.composerFrameClassName),children:b("div",{ref:Lb,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":so?"true":"false",className:F("rounded-[20px] transition-[background-color] duration-200",zg?"bg-accent/45 ring-1 ring-primary/70":null,g?"opacity-75":null,yo.composerSurfaceClassName),children:[t.firstRow?u("div",{className:"flex items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:t.firstRow}):null,t.sourceMetrics&&!Vn?u(uD,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,kD?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(T?T.customAnswer:et.trim())?"text-foreground":"text-placeholder"),onPointerDown:P=>P.preventDefault(),onClick:Ju,"aria-label":"Expand composer",children:T?T.customAnswer||"Type your own answer, or leave this blank to use the selected option":et.trim()||(on?"Enable a provider in Settings":"Ask anything...")}),nf,tf,u("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:RD,"aria-label":ND,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),Xg()},children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):null,b("div",{ref:wD,className:F("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Vn&&"pb-3 sm:pb-4",so&&"hidden"),children:[Ug&&!Hi&&!Vn&&u(vD,{anchor:Ib,children:u(cT,{entries:il,onRestore:UD,onDelete:KD,onClose:()=>ma(!1)})}),Hi&&!Vn&&u(vD,{anchor:Ib,children:u($N,{items:$o,resolvedTheme:He,isLoading:AD,triggerKind:rl,emptyStateText:ED,activeItemId:Nb?.id??null,onHighlightedItemChange:zD,onSelect:Bb})}),!so&&!Vn&&I.length===0&&ln.length>0&&u(ST,{annotations:ln,images:Nt,...a?{uploadsByImageId:Un,onRetryUpload:P=>ge.uploads.retry({environmentId:o,image:P})}:{},onRemove:P=>{ge.uploads.release(P),Wa(n,P)},onExpandImage:P=>{let V=xb(ut,P);V&&sn(V)},className:"mb-3"}),!so&&!Vn&&I.length===0&&Nn.length>0&&u(IT,{comments:Nn,onRemove:P=>Ga(n,P),className:"mb-3"}),!so&&!Vn&&I.length===0&&eo.length>0&&u(bT,{contexts:eo,onRemove:P=>vo(n,P),className:"mb-3"}),!so&&!Vn&&I.length===0&&Nt.some(P=>!ln.some(V=>V.id===P.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:Nt.filter(P=>!ln.some(V=>V.id===P.id)).map(P=>{let V=a?Un[P.id]:void 0,le=av(P),Be=gT(le),We=le==="image"&&!!P.previewUrl;return b("div",{className:F("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",We?"w-16":"w-44 max-w-full"),children:[We?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":rt("attachments.preview",{name:P.name}),onClick:()=>{let nt=xb(ut,P.id);nt&&sn(nt)},children:u("img",{src:P.previewUrl,alt:P.name,className:"h-full w-full object-cover"})}):b("a",{href:P.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":rt("attachments.open",{name:P.name}),children:[u(Be,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:P.name}),u("span",{className:"block text-[10px] text-secondary-label",children:iv(P.sizeBytes)})]})]}),LD.has(P.id)&&b(Qe,{children:[u(Ye,{render:u("span",{role:"img","aria-label":rt("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-amber-600",children:u(So,{className:"size-3"})})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:rt("attachments.draftMayNotPersistDetail")})]}),V?.status==="uploading"&&u("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-[10px] text-foreground",children:fp(V.progress)}),V?.status==="failed"&&b(Qe,{children:[u(Ye,{render:u(te,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>ge.uploads.retry({environmentId:o,image:P}),"aria-label":rt("attachments.retryUpload",{name:P.name})}),children:u(ns,{})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:V.reason})]}),u(te,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>GD(P.id),"aria-label":rt("attachments.remove",{name:P.name}),children:u(jt,{})})]},P.id)})}),b("div",{className:"relative",children:[_b?null:u(RM,{editorRef:ga,documentKey:un,value:Vn?"":T?T.customAnswer:et,cursor:pa,terminalContexts:!Vn&&I.length===0?ft:[],skills:Eo?.skills??[],...Cd?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:FD,onChange:BD,onCommandKeyDown:HD,onPaste:QD,placeholder:Vn?S?.detail??"Resolve this approval request to continue":T?"Type your own answer, or leave this blank to use the selected option":K&&O?"Add feedback to refine the plan, or leave this blank to implement it":g?"Choose a project above to start a thread":on?"Enable a provider in Settings to send a message":v==="disconnected"?nT:"Ask anything, @tag files/folders, $use skills, or / for commands",disabled:x||Vn||g}),Cd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[nf,tf,u(Fu,{compact:!0,pendingAction:Qu,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Zt,onInterrupt:nh,onImplementPlanInNewThread:oh})]}):null]})]}),u(hD,{message:SD??Vu}),fa===null?null:u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-plugin-blocked":"true",children:fa}),so||Vn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":yd?"true":"false",className:F("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",I.length>0&&"pt-2",yd?"gap-1.5":"gap-2 sm:gap-0",Cd&&"hidden sm:flex"),children:[b("div",{className:"-m-1 -ms-3.5 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto p-1 ps-3.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[u("input",{ref:Tb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:jD}),b(Qe,{children:[u(Ye,{render:u(te,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:x||g||I.length>0,"aria-label":rt("attachments.add"),onClick:()=>Tb.current?.click()}),children:u(Ro,{})}),u(Xe,{side:"top",children:rt("attachments.add")})]}),on?b(te,{type:"button",size:"sm",variant:"ghost",disabled:!0,"data-chat-provider-unavailable":"true",className:"shrink-0 gap-2 px-2 text-secondary-label sm:px-3",children:[u(So,{className:"size-4"}),"No provider available"]}):u(zN,{compact:yd,activeInstanceId:_t,model:zi,lockedProvider:ve,lockedContinuationGroupKey:qn,instanceEntries:he,keybindings:ze,modelOptionsByInstance:io,triggerClassName:"-ms-2.5",terminalOpen:Je,open:Uu,...yo.modelPickerIconClassName?{activeProviderIconClassName:yo.modelPickerIconClassName}:{},onOpenChange:P=>{Ku(P)},getModelDisabledReason:ie,getModelContinuationLabel:pe,onContinueInModel:Ze,onInstanceModelChange:ho,...xe?{composerChoices:xe}:{},selectedExecutionSelection:Gt??null,onClearExecutionSelection:dt,executionAppliesTo:lt,sourceLabel:Bi?.sourceLabel,...D?{onChooseExecution:P=>{D(P.selection,P)}}:{},...Bo?{pluginActions:vt,selectedPluginActionKey:rn?.id??null,onSelectPluginAction:Y,onManagePlugins:ce}:{}}),Qa?null:b(be,{children:[u(tD,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:yd}),yd?u(D_,{interactionMode:qe,runtimeMode:W,runtimeModeSwitch:ao.runtimeModeSwitch,nativeMode:Oi,canSwitchNativeMode:Ur,showInteractionModeToggle:ao.showInteractionModeToggle,traitsMenuContent:MD,onToggleInteractionMode:pt,onRuntimeModeChange:xn,onNativeModeChange:Fi}):b(be,{children:[Fb?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),Fb]}):null,u(D6,{showInteractionModeToggle:ao.showInteractionModeToggle,interactionMode:qe,runtimeMode:W,runtimeModeSwitch:ao.runtimeModeSwitch,nativeMode:Oi,canSwitchNativeMode:Ur,onToggleInteractionMode:pt,onRuntimeModeChange:xn,onNativeModeChange:Fi})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":Db?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Cd?null:nf,Cd?null:tf,u(O6,{compact:Db,activeContextWindow:ct,activeThreadModelDisplayName:Og,pendingAction:Qu,isRunning:v==="running",showPlanFollowUpPrompt:I.length===0&&K,promptHasText:et.trim().length>0,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,isPreparingWorktree:w,hasSendableContent:ol.hasSendableContent,preserveComposerFocusOnPointerDown:yr,showSendWhileRunning:yr,onPreviousPendingQuestion:Zt,onInterrupt:nh,onImplementPlanInNewThread:oh,compactDisabled:Et||on||y||x,compactDisabledReason:_i,onCompactContext:$D})]})]})]})})]})]})});function yD(e){let{composerRef:t,...n}=e,o=n;return u(sT,{value:o.api,children:u(xD,{...o,composerRef:t})})}function CD(e){return u(gh.Provider,{value:e.scope.active,children:u(F6,{...e})})}function F6(e){let{scope:t,mode:n,timeline:o,trajectory:r,queue:a,composer:i}=e,[s,l]=Ln("turn-navigator",t.threadKey,null),d=u(yD,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:b(be,{children:[u(rS,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(lS,{...s,placement:"inline",onSelect:c=>{n.onModeChange("chat"),s.onSelect(c)}}):null]})});return b("div",{className:F("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(aS,{chat:u(x0,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u(I0,{...r,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(Kw,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:d,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:b(be,{children:[u(Bw,{inputKey:t.threadKey,actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(nv,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var B6=".ycodium-conversation-ui";function z6(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function bD(e,t="conversation"){let n=z6(),o=e.replaceAll(B6,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function $6(e){let t=bD(Qb);return{views:{[dh]:H6(t,e)},viewCapabilities:{[dh]:[tI]}}}function H6(e,t){return function(o){let a=o[ch]??t,i={...o};return delete i[ch],b(Jb,{value:a,children:[u(U6,{retain:e.retain}),u(eI,{value:e.scopeClass,children:u(CD,{...i,scopeClass:e.scopeClass})})]})}}function U6({retain:e}){return wd(()=>e(),[e]),null}export{$6 as default};