@ycodium-ai/plugin-conversation 0.2.1991 → 0.2.2009

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 tD=Object.create;var Ou=Object.defineProperty;var nD=Object.getOwnPropertyDescriptor;var oD=Object.getOwnPropertyNames;var rD=Object.getPrototypeOf,aD=Object.prototype.hasOwnProperty;var iD=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Fu=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},wn=(e,t)=>{for(var n in t)Ou(e,n,{get:t[n],enumerable:!0})},gb=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of oD(t))!aD.call(e,r)&&r!==n&&Ou(e,r,{get:()=>t[r],enumerable:!(o=nD(t,r))||o.enumerable});return e};var ad=(e,t,n)=>(n=e!=null?tD(rD(e)):{},gb(t||!e||!e.__esModule?Ou(n,"default",{value:e,enumerable:!0}):n,e)),hb=e=>gb(Ou({},"__esModule",{value:!0}),e);var zu={};wn(zu,{Activity:()=>lD,Children:()=>_g,Component:()=>id,Fragment:()=>Ha,Profiler:()=>dD,PureComponent:()=>cD,StrictMode:()=>uD,Suspense:()=>Dg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>fD,__COMPILER_RUNTIME:()=>pD,act:()=>mD,cache:()=>gD,cacheSignal:()=>hD,captureOwnerStack:()=>vD,cloneElement:()=>Bu,createContext:()=>Ot,createElement:()=>Ce,createRef:()=>xD,default:()=>fn,forwardRef:()=>zn,isValidElement:()=>Og,lazy:()=>yD,memo:()=>de,startTransition:()=>CD,unstable_useCacheRefresh:()=>bD,use:()=>Ft,useActionState:()=>ID,useCallback:()=>U,useContext:()=>sn,useDebugValue:()=>SD,useDeferredValue:()=>wD,useEffect:()=>V,useEffectEvent:()=>Fg,useId:()=>Fr,useImperativeHandle:()=>Br,useInsertionEffect:()=>sd,useLayoutEffect:()=>Me,useMemo:()=>$,useOptimistic:()=>TD,useReducer:()=>Pi,useRef:()=>_,useState:()=>K,useSyncExternalStore:()=>ld,useTransition:()=>LD,version:()=>kD});var xb,fn,lD,_g,id,Ha,dD,cD,uD,Dg,fD,pD,mD,gD,hD,vD,Bu,Ot,Ce,xD,zn,Og,yD,de,CD,bD,Ft,ID,U,sn,SD,wD,V,Fg,Fr,Br,sd,Me,$,TD,Pi,_,K,ld,LD,kD,ue=iD(()=>{xb=window.__ycodiumPluginHost.react,fn=xb,{Activity:lD,Children:_g,Component:id,Fragment:Ha,Profiler:dD,PureComponent:cD,StrictMode:uD,Suspense:Dg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:fD,__COMPILER_RUNTIME:pD,act:mD,cache:gD,cacheSignal:hD,captureOwnerStack:vD,cloneElement:Bu,createContext:Ot,createElement:Ce,createRef:xD,forwardRef:zn,isValidElement:Og,lazy:yD,memo:de,startTransition:CD,unstable_useCacheRefresh:bD,use:Ft,useActionState:ID,useCallback:U,useContext:sn,useDebugValue:SD,useDeferredValue:wD,useEffect:V,useEffectEvent:Fg,useId:Fr,useImperativeHandle:Br,useInsertionEffect:sd,useLayoutEffect:Me,useMemo:$,useOptimistic:TD,useReducer:Pi,useRef:_,useState:K,useSyncExternalStore:ld,useTransition:LD,version:kD}=xb});var US=Fu(go=>{"use strict";var v2=(ue(),hb(zu));function HS(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 Ja(){}var mo={d:{f:Ja,r:function(){throw Error(HS(522))},D:Ja,C:Ja,L:Ja,m:Ja,X:Ja,S:Ja,M:Ja},p:0,findDOMNode:null},x2=Symbol.for("react.portal");function y2(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:x2,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var Wd=v2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Pf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}go.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=mo;go.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(HS(299));return y2(e,t,null,n)};go.flushSync=function(e){var t=Wd.T,n=mo.p;try{if(Wd.T=null,mo.p=2,e)return e()}finally{Wd.T=t,mo.p=n,mo.d.f()}};go.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,mo.d.C(e,t))};go.prefetchDNS=function(e){typeof e=="string"&&mo.d.D(e)};go.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=Pf(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?mo.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&mo.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};go.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Pf(t.as,t.crossOrigin);mo.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&&mo.d.M(e)};go.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=Pf(n,t.crossOrigin);mo.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})}};go.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Pf(t.as,t.crossOrigin);mo.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 mo.d.m(e)};go.requestFormReset=function(e){mo.d.r(e)};go.unstable_batchedUpdates=function(e,t){return e(t)};go.useFormState=function(e,t,n){return Wd.H.useFormState(e,t,n)};go.useFormStatus=function(){return Wd.H.useHostTransitionStatus()};go.version="19.2.6"});var Gd=Fu((WY,VS)=>{"use strict";function KS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(KS)}catch(e){console.error(e)}}KS(),VS.exports=US()});var KE=Fu(UE=>{"use strict";var Hl=(ue(),hb(zu));function CK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bK=typeof Object.is=="function"?Object.is:CK,IK=Hl.useState,SK=Hl.useEffect,wK=Hl.useLayoutEffect,TK=Hl.useDebugValue;function LK(e,t){var n=t(),o=IK({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return wK(function(){r.value=n,r.getSnapshot=t,Sy(r)&&a({inst:r})},[e,n,t]),SK(function(){return Sy(r)&&a({inst:r}),e(function(){Sy(r)&&a({inst:r})})},[e]),TK(n),n}function Sy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!bK(e,n)}catch{return!0}}function kK(e,t){return t()}var PK=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?kK:LK;UE.useSyncExternalStore=Hl.useSyncExternalStore!==void 0?Hl.useSyncExternalStore:PK});var qE=Fu((Oie,VE)=>{"use strict";VE.exports=KE()});var vb=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
1
+ var zD=Object.create;var nf=Object.defineProperty;var $D=Object.getOwnPropertyDescriptor;var HD=Object.getOwnPropertyNames;var UD=Object.getPrototypeOf,KD=Object.prototype.hasOwnProperty;var qD=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var of=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Mn=(e,t)=>{for(var n in t)nf(e,n,{get:t[n],enumerable:!0})},qb=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of HD(t))!KD.call(e,r)&&r!==n&&nf(e,r,{get:()=>t[r],enumerable:!(o=$D(t,r))||o.enumerable});return e};var Td=(e,t,n)=>(n=e!=null?zD(UD(e)):{},qb(t||!e||!e.__esModule?nf(n,"default",{value:e,enumerable:!0}):n,e)),Vb=e=>qb(nf({},"__esModule",{value:!0}),e);var af={};Mn(af,{Activity:()=>WD,Children:()=>nh,Component:()=>Ki,Fragment:()=>oi,Profiler:()=>GD,PureComponent:()=>jD,StrictMode:()=>QD,Suspense:()=>oh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>XD,__COMPILER_RUNTIME:()=>YD,act:()=>JD,cache:()=>ZD,cacheSignal:()=>e1,captureOwnerStack:()=>t1,cloneElement:()=>rf,createContext:()=>Ut,createElement:()=>Le,createRef:()=>n1,default:()=>mn,forwardRef:()=>qn,isValidElement:()=>rh,lazy:()=>o1,memo:()=>ce,startTransition:()=>r1,unstable_useCacheRefresh:()=>a1,use:()=>Kt,useActionState:()=>i1,useCallback:()=>$,useContext:()=>cn,useDebugValue:()=>s1,useDeferredValue:()=>l1,useEffect:()=>q,useEffectEvent:()=>ah,useId:()=>jr,useImperativeHandle:()=>Qr,useInsertionEffect:()=>Ld,useLayoutEffect:()=>he,useMemo:()=>H,useOptimistic:()=>d1,useReducer:()=>ri,useRef:()=>_,useState:()=>G,useSyncExternalStore:()=>Ca,useTransition:()=>c1,version:()=>u1});var Gb,mn,WD,nh,Ki,oi,GD,jD,QD,oh,XD,YD,JD,ZD,e1,t1,rf,Ut,Le,n1,qn,rh,o1,ce,r1,a1,Kt,i1,$,cn,s1,l1,q,ah,jr,Qr,Ld,he,H,d1,ri,_,G,Ca,c1,u1,pe=qD(()=>{Gb=window.__ycodiumPluginHost.react,mn=Gb,{Activity:WD,Children:nh,Component:Ki,Fragment:oi,Profiler:GD,PureComponent:jD,StrictMode:QD,Suspense:oh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:XD,__COMPILER_RUNTIME:YD,act:JD,cache:ZD,cacheSignal:e1,captureOwnerStack:t1,cloneElement:rf,createContext:Ut,createElement:Le,createRef:n1,forwardRef:qn,isValidElement:rh,lazy:o1,memo:ce,startTransition:r1,unstable_useCacheRefresh:a1,use:Kt,useActionState:i1,useCallback:$,useContext:cn,useDebugValue:s1,useDeferredValue:l1,useEffect:q,useEffectEvent:ah,useId:jr,useImperativeHandle:Qr,useInsertionEffect:Ld,useLayoutEffect:he,useMemo:H,useOptimistic:d1,useReducer:ri,useRef:_,useState:G,useSyncExternalStore:Ca,useTransition:c1,version:u1}=Gb});var C0=of(To=>{"use strict";var lB=(pe(),Vb(af));function y0(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 gi(){}var wo={d:{f:gi,r:function(){throw Error(y0(522))},D:gi,C:gi,L:gi,m:gi,X:gi,S:gi,M:gi},p:0,findDOMNode:null},dB=Symbol.for("react.portal");function cB(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:dB,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var pc=lB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Vf(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(y0(299));return cB(e,t,null,n)};To.flushSync=function(e){var t=pc.T,n=wo.p;try{if(pc.T=null,wo.p=2,e)return e()}finally{pc.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=Vf(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=Vf(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=Vf(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=Vf(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 pc.H.useFormState(e,t,n)};To.useFormStatus=function(){return pc.H.useHostTransitionStatus()};To.version="19.2.6"});var mc=of((QJ,I0)=>{"use strict";function b0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(b0)}catch(e){console.error(e)}}b0(),I0.exports=C0()});var EM=of(PM=>{"use strict";var ld=(pe(),Vb(af));function hK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var vK=typeof Object.is=="function"?Object.is:hK,xK=ld.useState,yK=ld.useEffect,CK=ld.useLayoutEffect,bK=ld.useDebugValue;function IK(e,t){var n=t(),o=xK({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return CK(function(){r.value=n,r.getSnapshot=t,Yy(r)&&a({inst:r})},[e,n,t]),yK(function(){return Yy(r)&&a({inst:r}),e(function(){Yy(r)&&a({inst:r})})},[e]),bK(n),n}function Yy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vK(e,n)}catch{return!0}}function SK(e,t){return t()}var wK=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?SK:IK;PM.useSyncExternalStore=ld.useSyncExternalStore!==void 0?ld.useSyncExternalStore:wK});var MM=of((Vse,AM)=>{"use strict";AM.exports=EM()});var Wb=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  :root, :host {
4
4
  --radius-lg: var(--radius);
@@ -3662,73 +3662,73 @@ var tD=Object.create;var Ou=Object.defineProperty;var nD=Object.getOwnPropertyDe
3662
3662
  }
3663
3663
  }
3664
3664
  }
3665
- `;ue();ue();var yb=Ot(null),Cb=yb.Provider,bb=Ot(""),Ib=bb.Provider;function $u(){return sn(bb)}function Ho(){let e=sn(yb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var Sb="conversation";ue();function wb(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=wb(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Tb(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=wb(e))&&(o&&(o+=" "),o+=t);return o}var Lb=Tb;var PD=(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},AD=(e,t)=>({classGroupId:e,validator:t}),_b=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var kb=[],ED="arbitrary..",MD=e=>{let t=ND(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return RD(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return Db(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?PD(d,l):l:d||kb}return n[i]||kb}}},Db=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=Db(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}},RD=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?ED+o:void 0})(),ND=e=>{let{theme:t,classGroups:n}=e;return _D(n,t)},_D=(e,t)=>{let n=_b();for(let o in e){let r=e[o];$g(r,n,o,t)}return n},$g=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];DD(i,t,n,o)}},DD=(e,t,n,o)=>{if(typeof e=="string"){OD(e,t,n);return}if(typeof e=="function"){FD(e,t,n,o);return}BD(e,t,n,o)},OD=(e,t,n)=>{let o=e===""?t:Ob(t,e);o.classGroupId=n},FD=(e,t,n,o)=>{if(zD(e)){$g(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(AD(n,e))},BD=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];$g(l,Ob(t,s),n,o)}},Ob=(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=_b(),n.nextPart.set(i,s)),n=s}return n},zD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,$D=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 HD=[],Pb=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),UD=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 Pb(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):Pb(HD,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},KD=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}},VD=e=>({cache:$D(e.cacheSize),parseClassName:UD(e),sortModifiers:KD(e),postfixLookupClassGroupIds:qD(e),...MD(e)}),qD=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},WD=/\s+/,GD=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(WD),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 b=y&&i[y]?o(g):void 0;b&&b!==y&&(y=b,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 T=r(y,x);for(let L=0;L<T.length;++L){let b=T[L];s.push(w+b)}d=f+(d.length>0?" "+d:d)}return d},jD=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Fb(n))&&(r&&(r+=" "),r+=o);return r},Fb=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Fb(e[o]))&&(n&&(n+=" "),n+=t);return n},Ab=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=VD(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=GD(l,n);return r(l,c),c};return a=i,(...l)=>a(jD(...l))},QD=[],Mn=e=>{let t=n=>n[e]||QD;return t.isThemeGetter=!0,t},Bb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,XD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,YD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JD=/\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$/,ZD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,e1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,t1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>XD.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),zr=e=>!!e&&Number.isInteger(Number(e)),Bg=e=>e.endsWith("%")&&st(e.slice(0,-1)),da=e=>YD.test(e),$b=()=>!0,n1=e=>JD.test(e)&&!ZD.test(e),Hg=()=>!1,o1=e=>e1.test(e),r1=e=>t1.test(e),a1=e=>!be(e)&&!Te(e),i1=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)),s1=e=>Ka(e,Kb,Hg),be=e=>Bb.test(e),Ai=e=>Ka(e,Vb,n1),Eb=e=>Ka(e,g1,st),l1=e=>Ka(e,Wb,$b),d1=e=>Ka(e,qb,Hg),Mb=e=>Ka(e,Hb,Hg),c1=e=>Ka(e,Ub,r1),Hu=e=>Ka(e,Gb,o1),Te=e=>zb.test(e),dd=e=>Ei(e,Vb),u1=e=>Ei(e,qb),Rb=e=>Ei(e,Hb),f1=e=>Ei(e,Kb),p1=e=>Ei(e,Ub),Uu=e=>Ei(e,Gb,!0),m1=e=>Ei(e,Wb,!0),Ka=(e,t,n)=>{let o=Bb.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Ei=(e,t,n=!1)=>{let o=zb.exec(e);return o?o[1]?t(o[1]):n:!1},Hb=e=>e==="position"||e==="percentage",Ub=e=>e==="image"||e==="url",Kb=e=>e==="length"||e==="size"||e==="bg-size",Vb=e=>e==="length",g1=e=>e==="number",qb=e=>e==="family-name",Wb=e=>e==="number"||e==="weight",Gb=e=>e==="shadow";var Nb=()=>{let e=Mn("color"),t=Mn("font"),n=Mn("text"),o=Mn("font-weight"),r=Mn("tracking"),a=Mn("leading"),i=Mn("breakpoint"),s=Mn("container"),l=Mn("spacing"),d=Mn("radius"),c=Mn("shadow"),f=Mn("inset-shadow"),p=Mn("text-shadow"),m=Mn("drop-shadow"),h=Mn("blur"),g=Mn("perspective"),v=Mn("aspect"),x=Mn("ease"),y=Mn("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(),Te,be],T=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],b=()=>[Te,be,l],S=()=>[Ua,"full","auto",...b()],A=()=>[zr,"none","subgrid",Te,be],E=()=>["auto",{span:["full",zr,Te,be]},zr,Te,be],B=()=>[zr,"auto",Te,be],R=()=>["auto","min","max","fr",Te,be],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...b()],W=()=>[Ua,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...b()],xe=()=>[Ua,"screen","full","dvw","lvw","svw","min","max","fit",...b()],ie=()=>[Ua,"screen","full","lh","dvh","lvh","svh","min","max","fit",...b()],Q=()=>[e,Te,be],Ye=()=>[...w(),Rb,Mb,{position:[Te,be]}],Oe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ke=()=>["auto","cover","contain",f1,s1,{size:[Te,be]}],Be=()=>[Bg,dd,Ai],Se=()=>["","none","full",d,Te,be],ce=()=>["",st,dd,Ai],Ne=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[st,Bg,Rb,Mb],ye=()=>["","none",h,Te,be],ct=()=>["none",st,Te,be],ut=()=>["none",st,Te,be],lt=()=>[st,Te,be],ft=()=>[Ua,"full",...b()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[da],breakpoint:[da],color:[$b],container:[da],"drop-shadow":[da],ease:["in","out","in-out"],font:[a1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[da],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[da],shadow:[da],spacing:["px",st],text:[da],"text-shadow":[da],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ua,be,Te,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Te,be]}],"container-named":[i1],columns:[{columns:[st,be,Te,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:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[zr,"auto",Te,be]}],basis:[{basis:[Ua,"full","auto",s,...b()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[st,Ua,"auto","initial","none",be]}],grow:[{grow:["",st,Te,be]}],shrink:[{shrink:["",st,Te,be]}],order:[{order:[zr,"first","last","none",Te,be]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:E()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:b()}],"gap-x":[{"gap-x":b()}],"gap-y":[{"gap-y":b()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:b()}],px:[{px:b()}],py:[{py:b()}],ps:[{ps:b()}],pe:[{pe:b()}],pbs:[{pbs:b()}],pbe:[{pbe:b()}],pt:[{pt:b()}],pr:[{pr:b()}],pb:[{pb:b()}],pl:[{pl:b()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":b()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":b()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...xe()]}],"min-inline-size":[{"min-inline":["auto",...xe()]}],"max-inline-size":[{"max-inline":["none",...xe()]}],"block-size":[{block:["auto",...ie()]}],"min-block-size":[{"min-block":["auto",...ie()]}],"max-block-size":[{"max-block":["none",...ie()]}],w:[{w:[s,"screen",...W()]}],"min-w":[{"min-w":[s,"screen","none",...W()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,dd,Ai]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,m1,l1]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Bg,be]}],"font-family":[{font:[u1,d1,t]}],"font-features":[{"font-features":[be]}],"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,Te,be]}],"line-clamp":[{"line-clamp":[st,"none",Te,Eb]}],leading:[{leading:[a,...b()]}],"list-image":[{"list-image":["none",Te,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Te,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Q()}],"text-color":[{text:Q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[st,"from-font","auto",Te,Ai]}],"text-decoration-color":[{decoration:Q()}],"underline-offset":[{"underline-offset":[st,"auto",Te,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"tab-size":[{tab:[zr,Te,be]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te,be]}],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",Te,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ye()}],"bg-repeat":[{bg:Oe()}],"bg-size":[{bg:ke()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zr,Te,be],radial:["",Te,be],conic:[zr,Te,be]},p1,c1]}],"bg-color":[{bg:Q()}],"gradient-from-pos":[{from:Be()}],"gradient-via-pos":[{via:Be()}],"gradient-to-pos":[{to:Be()}],"gradient-from":[{from:Q()}],"gradient-via":[{via:Q()}],"gradient-to":[{to:Q()}],rounded:[{rounded:Se()}],"rounded-s":[{"rounded-s":Se()}],"rounded-e":[{"rounded-e":Se()}],"rounded-t":[{"rounded-t":Se()}],"rounded-r":[{"rounded-r":Se()}],"rounded-b":[{"rounded-b":Se()}],"rounded-l":[{"rounded-l":Se()}],"rounded-ss":[{"rounded-ss":Se()}],"rounded-se":[{"rounded-se":Se()}],"rounded-ee":[{"rounded-ee":Se()}],"rounded-es":[{"rounded-es":Se()}],"rounded-tl":[{"rounded-tl":Se()}],"rounded-tr":[{"rounded-tr":Se()}],"rounded-br":[{"rounded-br":Se()}],"rounded-bl":[{"rounded-bl":Se()}],"border-w":[{border:ce()}],"border-w-x":[{"border-x":ce()}],"border-w-y":[{"border-y":ce()}],"border-w-s":[{"border-s":ce()}],"border-w-e":[{"border-e":ce()}],"border-w-bs":[{"border-bs":ce()}],"border-w-be":[{"border-be":ce()}],"border-w-t":[{"border-t":ce()}],"border-w-r":[{"border-r":ce()}],"border-w-b":[{"border-b":ce()}],"border-w-l":[{"border-l":ce()}],"divide-x":[{"divide-x":ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:Q()}],"border-color-x":[{"border-x":Q()}],"border-color-y":[{"border-y":Q()}],"border-color-s":[{"border-s":Q()}],"border-color-e":[{"border-e":Q()}],"border-color-bs":[{"border-bs":Q()}],"border-color-be":[{"border-be":Q()}],"border-color-t":[{"border-t":Q()}],"border-color-r":[{"border-r":Q()}],"border-color-b":[{"border-b":Q()}],"border-color-l":[{"border-l":Q()}],"divide-color":[{divide:Q()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Te,be]}],"outline-w":[{outline:["",st,dd,Ai]}],"outline-color":[{outline:Q()}],shadow:[{shadow:["","none",c,Uu,Hu]}],"shadow-color":[{shadow:Q()}],"inset-shadow":[{"inset-shadow":["none",f,Uu,Hu]}],"inset-shadow-color":[{"inset-shadow":Q()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Q()}],"ring-offset-w":[{"ring-offset":[st,Ai]}],"ring-offset-color":[{"ring-offset":Q()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":Q()}],"text-shadow":[{"text-shadow":["none",p,Uu,Hu]}],"text-shadow-color":[{"text-shadow":Q()}],opacity:[{opacity:[st,Te,be]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"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":[st]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"mask-image-linear-from-color":[{"mask-linear-from":Q()}],"mask-image-linear-to-color":[{"mask-linear-to":Q()}],"mask-image-t-from-pos":[{"mask-t-from":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"mask-image-t-from-color":[{"mask-t-from":Q()}],"mask-image-t-to-color":[{"mask-t-to":Q()}],"mask-image-r-from-pos":[{"mask-r-from":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"mask-image-r-from-color":[{"mask-r-from":Q()}],"mask-image-r-to-color":[{"mask-r-to":Q()}],"mask-image-b-from-pos":[{"mask-b-from":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"mask-image-b-from-color":[{"mask-b-from":Q()}],"mask-image-b-to-color":[{"mask-b-to":Q()}],"mask-image-l-from-pos":[{"mask-l-from":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"mask-image-l-from-color":[{"mask-l-from":Q()}],"mask-image-l-to-color":[{"mask-l-to":Q()}],"mask-image-x-from-pos":[{"mask-x-from":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"mask-image-x-from-color":[{"mask-x-from":Q()}],"mask-image-x-to-color":[{"mask-x-to":Q()}],"mask-image-y-from-pos":[{"mask-y-from":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":Q()}],"mask-image-y-to-color":[{"mask-y-to":Q()}],"mask-image-radial":[{"mask-radial":[Te,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"mask-image-radial-from-color":[{"mask-radial-from":Q()}],"mask-image-radial-to-color":[{"mask-radial-to":Q()}],"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":[st]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"mask-image-conic-from-color":[{"mask-conic-from":Q()}],"mask-image-conic-to-color":[{"mask-conic-to":Q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ye()}],"mask-repeat":[{mask:Oe()}],"mask-size":[{mask:ke()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Te,be]}],filter:[{filter:["","none",Te,be]}],blur:[{blur:ye()}],brightness:[{brightness:[st,Te,be]}],contrast:[{contrast:[st,Te,be]}],"drop-shadow":[{"drop-shadow":["","none",m,Uu,Hu]}],"drop-shadow-color":[{"drop-shadow":Q()}],grayscale:[{grayscale:["",st,Te,be]}],"hue-rotate":[{"hue-rotate":[st,Te,be]}],invert:[{invert:["",st,Te,be]}],saturate:[{saturate:[st,Te,be]}],sepia:[{sepia:["",st,Te,be]}],"backdrop-filter":[{"backdrop-filter":["","none",Te,be]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[st,Te,be]}],"backdrop-contrast":[{"backdrop-contrast":[st,Te,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",st,Te,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[st,Te,be]}],"backdrop-invert":[{"backdrop-invert":["",st,Te,be]}],"backdrop-opacity":[{"backdrop-opacity":[st,Te,be]}],"backdrop-saturate":[{"backdrop-saturate":[st,Te,be]}],"backdrop-sepia":[{"backdrop-sepia":["",st,Te,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":b()}],"border-spacing-x":[{"border-spacing-x":b()}],"border-spacing-y":[{"border-spacing-y":b()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Te,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[st,"initial",Te,be]}],ease:[{ease:["linear","initial",x,Te,be]}],delay:[{delay:[st,Te,be]}],animate:[{animate:["none",y,Te,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Te,be]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ct()}],"rotate-x":[{"rotate-x":ct()}],"rotate-y":[{"rotate-y":ct()}],"rotate-z":[{"rotate-z":ct()}],scale:[{scale:ut()}],"scale-x":[{"scale-x":ut()}],"scale-y":[{"scale-y":ut()}],"scale-z":[{"scale-z":ut()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[Te,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ft()}],"translate-x":[{"translate-x":ft()}],"translate-y":[{"translate-y":ft()}],"translate-z":[{"translate-z":ft()}],"translate-none":["translate-none"],zoom:[{zoom:[zr,Te,be]}],accent:[{accent:Q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Q()}],"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",Te,be]}],"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":Q()}],"scrollbar-track-color":[{"scrollbar-track":Q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mbs":[{"scroll-mbs":b()}],"scroll-mbe":[{"scroll-mbe":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pbs":[{"scroll-pbs":b()}],"scroll-pbe":[{"scroll-pbe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"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",Te,be]}],fill:[{fill:["none",...Q()]}],"stroke-w":[{stroke:[st,dd,Ai,Eb]}],stroke:[{stroke:["none",...Q()]}],"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"]}},h1=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(Gs(e,"cacheSize",t),Gs(e,"prefix",n),Gs(e,"experimentalParseClassName",o),Ku(e.theme,a.theme),Ku(e.classGroups,a.classGroups),Ku(e.conflictingClassGroups,a.conflictingClassGroups),Ku(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Gs(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Gs(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Vu(e.theme,r.theme),Vu(e.classGroups,r.classGroups),Vu(e.conflictingClassGroups,r.conflictingClassGroups),Vu(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),zg(e,r,"postfixLookupClassGroups"),zg(e,r,"orderSensitiveModifiers"),e),Gs=(e,t,n)=>{n!==void 0&&(e[t]=n)},Ku=(e,t)=>{if(t)for(let n in t)Gs(e,n,t[n])},Vu=(e,t)=>{if(t)for(let n in t)zg(e,t,n)},zg=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},jb=(e,...t)=>typeof e=="function"?Ab(Nb,e,...t):Ab(()=>h1(Nb(),e),...t);var v1=jb({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 z(...e){return v1(Lb(e))}ue();var Ug=Ot(!0);var qu=Ot(void 0);function Wu(){let e=Ft(Ug);return Ft(qu)??e}ue();var Gu=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var Qb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Xb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Kg=e=>{let t=Xb(e);return t.charAt(0).toUpperCase()+t.slice(1)};ue();var Yb={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 Jb=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var Zb=zn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Ce("svg",{ref:l,...Yb,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Gu("lucide",r),...!a&&!Jb(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>Ce(d,c)),...Array.isArray(a)?a:[a]]));var G=(e,t)=>{let n=zn(({className:o,...r},a)=>Ce(Zb,{ref:a,iconNode:t,className:Gu(`lucide-${Qb(Kg(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Kg(e),n};var x1=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],cd=G("arrow-down",x1);var y1=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],ud=G("arrow-up-right",y1);var C1=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],fd=G("arrow-up",C1);var b1=[["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"}]],pd=G("blocks",b1);var I1=[["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"}]],js=G("bookmark",I1);var S1=[["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"}]],Mi=G("bot",S1);var w1=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],fo=G("check",w1);var T1=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ln=G("chevron-down",T1);var L1=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ri=G("chevron-left",L1);var k1=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Eo=G("chevron-right",k1);var P1=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],md=G("chevron-up",P1);var A1=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],gd=G("chevrons-left",A1);var E1=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],hd=G("chevrons-right",E1);var M1=[["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"}]],po=G("circle-alert",M1);var R1=[["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"}]],Ni=G("copy",R1);var N1=[["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"}]],Uo=G("ellipsis",N1);var _1=[["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"}]],vd=G("eye",_1);var D1=[["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"}]],_i=G("file-code",D1);var O1=[["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"}]],Di=G("file-text",O1);var F1=[["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"}]],xd=G("file",F1);var B1=[["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"}]],Va=G("folder",B1);var z1=[["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"}]],yd=G("frame",z1);var $1=[["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"}]],Cd=G("git-branch-plus",$1);var H1=[["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"}]],bd=G("globe",H1);var U1=[["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"}]],Id=G("grip-vertical",U1);var K1=[["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"}]],Sd=G("hammer",K1);var V1=[["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"}]],Oi=G("image",V1);var q1=[["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=G("layers",q1);var W1=[["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"}]],wd=G("list-ordered",W1);var G1=[["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"}]],Fi=G("list-todo",G1);var j1=[["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"}]],Td=G("list",j1);var Q1=[["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"}]],qa=G("lock-open",Q1);var X1=[["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"}]],Ld=G("lock",X1);var Y1=[["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"}]],Bi=G("message-circle",Y1);var J1=[["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=G("message-square",J1);var Z1=[["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=G("minimize-2",Z1);var eO=[["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"}]],$r=G("mouse-pointer-click",eO);var tO=[["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"}]],Pd=G("package",tO);var nO=[["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"}]],$i=G("paintbrush",nO);var oO=[["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"}]],Io=G("paperclip",oO);var rO=[["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"}]],Hr=G("pen-line",rO);var aO=[["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"}]],Ad=G("pencil-ruler",aO);var iO=[["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"}]],Ed=G("pencil",iO);var sO=[["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"}]],Hi=G("puzzle",sO);var lO=[["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"}]],Ui=G("rotate-ccw",lO);var dO=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ki=G("search",dO);var cO=[["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"}]],Md=G("send",cO);var uO=[["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"}]],Rd=G("settings",uO);var fO=[["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"}]],Qs=G("sliders-horizontal",fO);var pO=[["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"}]],Wa=G("sparkles",pO);var mO=[["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"}]],So=G("square-pen",mO);var gO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Nd=G("square",gO);var hO=[["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"}]],Vi=G("star",hO);var vO=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ua=G("terminal",vO);var xO=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],_d=G("text-quote",xO);var yO=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Ur=G("user-round",yO);var CO=[["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"}]],Dd=G("wrench",CO);var bO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Vt=G("x",bO);var IO=[["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"}]],qi=G("zap",IO);ue();function _e(){return{t:Ho().i18n.usePluginTranslation()}}ue();function X(e){let t=n=>{let o=Ho(),r=$u(),a=o.ui[e];return Ce(a,{...n,className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var N7=X("useLinkContextMenu"),fa=X("ProviderInstanceIcon"),eI=X("UserAvatar"),Xs=X("Badge"),ne=X("Button"),_7=X("Label"),ju=X("Input"),tI=X("Textarea"),D7=X("Switch"),Od=X("Separator"),O7=X("Skeleton"),Qu=X("Spinner"),F7=X("ScrollArea"),B7=X("Card"),z7=X("CardAction"),$7=X("CardContent"),H7=X("CardDescription"),U7=X("CardFooter"),K7=X("CardHeader"),V7=X("CardTitle"),q7=X("Empty"),W7=X("EmptyContent"),G7=X("EmptyDescription"),j7=X("EmptyHeader"),Q7=X("EmptyMedia"),X7=X("EmptyTitle"),Y7=X("InputGroup"),J7=X("InputGroupAddon"),Z7=X("InputGroupInput"),e9=X("DocumentPanel"),t9=X("MasterDetail"),Xu=X("Select"),n9=X("SelectContent"),Yu=X("SelectItem"),Ju=X("SelectPopup"),nI=X("SelectTrigger"),Zu=X("SelectValue"),Fd=X("Toggle"),oI=X("ToggleGroup"),rI=X("AlertDialog"),aI=X("AlertDialogClose"),iI=X("AlertDialogDescription"),sI=X("AlertDialogFooter"),lI=X("AlertDialogHeader"),dI=X("AlertDialogPopup"),cI=X("AlertDialogTitle"),ef=X("Dialog"),o9=X("DialogClose"),tf=X("DialogDescription"),nf=X("DialogFooter"),of=X("DialogHeader"),rf=X("DialogPopup"),uI=X("DialogPanel"),af=X("DialogTitle"),r9=X("DialogTrigger"),a9=X("DropdownMenu"),i9=X("DropdownMenuContent"),s9=X("DropdownMenuItem"),l9=X("DropdownMenuTrigger"),Ko=X("Menu"),Bd=X("MenuGroup"),d9=X("MenuGroupLabel"),Vo=X("MenuItem"),qo=X("MenuPopup"),pa=X("MenuRadioGroup"),dr=X("MenuRadioItem"),Ga=X("MenuSeparator"),Wo=X("MenuTrigger"),Ys=X("Popover"),Js=X("PopoverPopup"),Zs=X("PopoverTrigger"),fI=X("Table"),pI=X("TableBody"),ja=X("TableCell"),Wi=X("TableHead"),mI=X("TableHeader"),sf=X("TableRow"),je=X("Tooltip"),Qe=X("TooltipPopup"),Xe=X("TooltipTrigger"),gI=X("Collapsible"),hI=X("CollapsiblePanel"),vI=X("CollapsibleTrigger"),zd=X("Alert"),$d=X("AlertAction"),lf=X("AlertDescription"),Vg=X("AlertTitle"),df=X("Kbd"),cf=X("Command"),uf=X("CommandGroup"),ff=X("CommandItem"),pf=X("CommandList"),xI=X("Combobox"),yI=X("ComboboxEmpty"),CI=X("ComboboxInput"),el=X("ComboboxItem"),bI=X("ComboboxListVirtualized"),II=X("TooltipProvider"),SI=X("StyledDiffCodeView"),wI=X("DevBackdropArt"),Go=X("Markdown"),TI=X("DiffView");var{jsx:u,jsxs:I,Fragment:pe}=window.__ycodiumPluginHost.jsxRuntime;function kI({mode:e,onModeChange:t}){let{t:n}=_e();return I(oI,{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:[I(Fd,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(zi,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),I(Fd,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(wd,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}var LI={visibility:"hidden",pointerEvents:"none"};function PI({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat",a=!r&&t,[i,s]=K(a);return a&&!i&&s(!0),I(pe,{children:[u("div",{className:"relative flex min-h-0 flex-1 flex-col",style:r?void 0:LI,"aria-hidden":r?void 0:!0,inert:r?void 0:!0,"data-chat-view-pane":"chat","data-pane-visible":r?"true":"false",children:u(qu,{value:r&&t,children:n})}),u("div",{className:"absolute inset-0 flex min-h-0 flex-col",style:r?LI:void 0,"aria-hidden":r?!0:void 0,inert:r?!0:void 0,"data-chat-view-pane":"trajectory","data-pane-visible":r?"false":"true",children:u(qu,{value:a,children:i||a?o:null})})]})}ue();function Jn(){return{t:Ho().i18n.usePluginTranslation()}}function AI(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 SO=de(function({item:t,ordinal:n,usage:o,onSelect:r}){return I("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}),I("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?I("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:AI(o.outputTokens)}):null]}):null]})]})});function wO({totals:e}){let{t}=Jn();if(!e)return null;let n=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:e.outputTokens},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:e.inputTokens},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:e.cachedInputTokens}].filter(o=>o!==null);return n.length===0?null:I("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")}),n.map(o=>I("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[o.label," ",AI(o.value)]},o.label))]})}var TO=de(function({text:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=Jn(),i=Ho().writeClipboard,[s,l]=K(!1),d=a("turnNavigator.copyMarkdown");return I(je,{children:[u(Xe,{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:z("text-muted-foreground hover:text-foreground",r)}),children:s?u(fo,{className:"size-3 text-primary"}):u(Ni,{className:"size-3"})}),u(Qe,{children:u("p",{children:d})})]})});function EI({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=Jn(),[d,c]=K(!1),f=$(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=$(()=>{let g,v,x;for(let{item:y}of f){let C=y.turnId===null?void 0:o.get(y.turnId);C?.outputTokens!==void 0&&(g=(g??0)+C.outputTokens),C?.inputTokens!==void 0&&(v=(v??0)+C.inputTokens),C?.cachedInputTokens!==void 0&&(x=(x??0)+C.cachedInputTokens)}if(!(g===void 0&&v===void 0&&x===void 0))return{...g!==void 0?{outputTokens:g}:{},...v!==void 0?{inputTokens:v}:{},...x!==void 0?{cachedInputTokens:x}:{}}},[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return I(Ys,{onOpenChange:c,open:d,children:[I(Zs,{render:u(ne,{"aria-label":h,className:z("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(Td,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(Js,{align:"end",className:"w-80 flex-col",side:"top",children:I("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[I("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:z("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>u(SO,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(wO,{totals:p}),I("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(TO,{size:"icon-xs",text: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"})})]})]})})]})}ue();function MI(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}}ue();function Gi(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 LO(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function kO(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function PO(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var qg=kO(PO()),RI=new Map;function NI(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=RI.get(n);if(o)return o;let r=new Intl.DateTimeFormat(qg,LO(e,t));return RI.set(n,r),r}function Wg(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var AO=new Intl.DateTimeFormat(void 0,{month:"long"});function EO(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 MO(e,t){let n=Wg(e);return n?NI(t,!1).format(n):""}function Kr(e,t){let n=Wg(e);if(!n)return"";let o=MO(e,t),r=n.getDate(),a=AO.format(n),i=n.getFullYear();return`${o}, ${r}${EO(r)} ${a} ${i}`}var RO=new Intl.DateTimeFormat(qg,{month:"numeric",day:"numeric"}),NO=new Intl.DateTimeFormat(qg,{month:"numeric",day:"numeric",year:"numeric"});function Qa(e,t,n=Date.now()){let o=Wg(e);if(!o)return"";let r=NI(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()?RO:NO).format(o)} ${r}`}ue();ue();async function _O(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 mf({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=K(!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=U((p,m)=>{_O(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 V(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function Et(){let e=Ho().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var _I=1e3;function DO({title:e,description:t}){return I("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 tl=de(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=Et(),s=_(null),[l,d]=K(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),_I))};V(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=mf({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:_I});return I(je,{children:[u(Xe,{render:u(ne,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:z("text-muted-foreground hover:text-foreground",r)}),children:m?u(fo,{className:"size-3 text-primary"}):u(Ni,{className:"size-3"})}),u(Qe,{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(DO,{title:l.title,description:l.description})})}):null]})});function OO(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 gf({label:e,children:t}){let[n,o]=K(!1);return I(je,{open:n,onOpenChange:o,children:[u(Xe,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Qe,{children:e})]})}var DI=de(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=Et(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return I("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[I("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?I(gf,{label:i,children:[a==="completed"?u(fo,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(Vt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Nd,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(gf,{label:Kr(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:Qa(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?I(gf,{label:r("timeline.workingTime",{duration:Gi(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),Gi(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?I(gf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),OO(t.outputTokens)]}):null]}),o?u(tl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});ue();ue();function OI(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 FI=de(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=Et(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return I(pe,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),I("span",{role:"group","aria-label":l,className:z(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:[I("span",{"aria-hidden":"true",className:"font-mono text-success",children:["+",OI(n)]}),I("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",OI(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function BI(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function FO(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 zI(e){return e.replaceAll("\\","/")}function $I(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function BO(e){return e.replace(/[\\/]+$/,"")}function zO(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function $O(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function HO(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function hf(e,t){let{path:n,line:o,column:r}=FO(e),a=$I(zI(n)),i=a;if(t){let s=$I(zI(BO(t))),l=zO(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(!HO(a)){let m=$O(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function HI(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function UI(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var vf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function Hd({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function Ud({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:z("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function xf({state:e,variant:t="inline",className:n,children:o}){return I("div",{"data-process-state":e,"data-process-kind":t,className:z("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]})}ue();var nl=new Map,KI=24,UO=4e3;function Gg(e){let t=nl.get(e);if(t)return t;let n={values:new Map,listeners:new Set};if(nl.set(e,n),nl.size>KI){for(let[o,r]of nl)if(r.listeners.size===0&&o!==e&&(nl.delete(o),nl.size<=KI))break}return n}function jg(e,t,n){return Gg(e).values.get(t)??n}function Kd(e,t,n,o=!0){let r=Gg(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>UO){let a=r.values.keys().next().value;a!==void 0&&r.values.delete(a)}o&&r.listeners.forEach(a=>a())}}function ol(e,t,n){let o=U(s=>{let l=Gg(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=U(()=>jg(e,t,n),[e,t,n]),a=ld(o,r,r),i=U(s=>Kd(e,t,s),[e,t]);return[a,i]}function yf({name:e,className:t}){switch(e){case"bot":return u(Mi,{className:t,"aria-hidden":!0});case"check":return u(fo,{className:t,"aria-hidden":!0});case"circle-alert":return u(po,{className:t,"aria-hidden":!0});case"eye":return u(vd,{className:t,"aria-hidden":!0});case"globe":return u(bd,{className:t,"aria-hidden":!0});case"hammer":return u(Sd,{className:t,"aria-hidden":!0});case"message-circle":return u(Bi,{className:t,"aria-hidden":!0});case"search":return u(Ki,{className:t,"aria-hidden":!0});case"square-pen":return u(So,{className:t,"aria-hidden":!0});case"terminal":return u(ua,{className:t,"aria-hidden":!0});case"wrench":return u(Dd,{className:t,"aria-hidden":!0});case"x":return u(Vt,{className:t,"aria-hidden":!0});case"zap":return u(qi,{className:t,"aria-hidden":!0})}}function KO(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 Qg(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:KO(o),count:r}))}function Xg(e,t){let n;for(let o of Qg(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var rl=20;function al(e){return BI(e)}function VI(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?hf(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 qI({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Yg(e)?null:u(FI,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Yg(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function VO({entry:e,failed:t=!1,derive:n}){return t?u(po,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u(yf,{name:Xg([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function qO({entries:e,failed:t,derive:n}){let{t:o}=Et(),r=$(()=>Qg(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})=>I("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u(yf,{name:s,className:z("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function WI({entry:e}){let t=Ft(vn),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(pe,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var WO=de(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=Ft(vn).derive,{t:l}=Et(),[d,c]=ol(o,`call:${al(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Yg(n),m=s.resolveWorkEntryStatus(n),h=m==="failed"||m==="running"?m:null,g=Fr();return I("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":al(n),className:"border-b border-border/50 last:border-b-0",children:[I("button",{type:"button","aria-expanded":d,"aria-controls":g,onClick:()=>{a?.(),c(!d)},className:z("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(Ud,{status:h}),u(Hd,{children:u(VO,{entry:n,failed:f,derive:s})}),I("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:VI(n,r,s)??l("toolGroup.calls",{count:1})}),u(qI,{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:z("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:g,children:u(WI,{entry:n})}):null]})});function GO({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=_(null);return Me(()=>{let a=r.current;if(!a)return;a.scrollTop=jg(e,`${t}:scroll`,0);let i=()=>{Kd(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 GI=de(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=Ft(vn).derive,{t:l}=Et(),[d,c]=ol(o,`group:${n}`,!1),[f,p]=ol(o,`group-page:${n}`,0),m=Fr(),h=_(null),[g,v]=K(null),x=t.at(-1),y=$(()=>t.filter(W=>s.workEntryIndicatesFailure(W)),[t,s]),C=$(()=>t.filter(Yg),[t]),w=t.filter(W=>W.toolLifecycleStatus==="inProgress").length,k=y[0]??C[0],T=k??x,L=Math.max(0,Math.ceil(t.length/rl)-1),b=Math.min(f,L),S=b*rl,A=t.slice(S,S+rl),E=t.length>1;if(Me(()=>{if(!g)return;let W=h.current,xe=Array.from(W?.querySelectorAll("[data-tool-identity]")??[]).find(Q=>Q.dataset.toolIdentity===g.id);if(!xe)return;let ie=xe.closest('[data-slot="scroll-area-viewport"]');ie&&(ie.scrollTop+=xe.getBoundingClientRect().top-ie.getBoundingClientRect().top),xe.querySelector("button")?.focus({preventScroll:!0})},[g]),!x||!T)return null;let B=W=>{a?.(),p(W)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},N=UI(t.map(W=>HI(s.resolveWorkEntryStatus(W)))),H=Xg(t,s.toolGroupAction),D=N==="failed"?"failed":N==="running"?"running":"success";return u(xf,{state:N,variant:"tool",children:I("section",{ref:h,"data-tool-group-id":n,className:"min-w-0",children:[I("div",{className:"flex min-w-0 items-center",children:[I("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!E&&!d&&Kd(o,`call:${al(x)}`,!0)},className:z(vf,"flex-1",k?"text-destructive":"text-muted-foreground"),children:[u(Ud,{status:D}),u(Hd,{children:u(yf,{name:H,className:z("size-icon-1 shrink-0 stroke-[1.8] opacity-70",y.length>0?"text-destructive":"text-icon-muted")})}),I("span",{className:z("flex min-w-0 flex-1 items-center",d&&E?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&E?l("toolGroup.calls",{count:t.length}):VI(T,r,s)??l("toolGroup.calls",{count:1})}),d&&E?null:u(qI,{entry:T,failed:s.workEntryIndicatesFailure(T)})]}),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&&E?null:u(qO,{entries:t,failed:y.length>0,derive:s}),u(ln,{"aria-hidden":!0,className:z("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),k&&E?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)/rl)),Kd(o,`call:${al(k)}`,!0),v({id:al(k)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:E?I(pe,{children:[t.length>rl?I("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:S+1,to:Math.min(S+rl,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:b===0,Icon:gd},{label:l("toolGroup.previousPage"),target:b-1,disabled:b===0,Icon:Ri},{label:l("toolGroup.nextPage"),target:b+1,disabled:b===L,Icon:Eo},{label:l("toolGroup.lastPage"),target:L,disabled:b===L,Icon:hd}].map(({label:W,target:xe,disabled:ie,Icon:Q})=>u("button",{type:"button","aria-label":W,disabled:ie,onClick:()=>B(xe),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(Q,{"aria-hidden":!0,className:"size-icon-1"})},W))]}):null,u(GO,{threadKey:o,stateKey:`group-scroll:${n}:${b}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:A.map(W=>u(WO,{entry:W,...R},al(W)))})})]}):u(WI,{entry:x})}):null]})})});function jO(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 jI(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=jO(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}}}ue();function Jg(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function QI(e,t,n){let o=0,r=t.length,a=null;for(;o<r;){let i=Math.floor((o+r)/2),s=t[i],l=Zg(s,e);l+Math.max(1,s.offsetHeight)>n?(a={element:s,index:i,top:l},r=i):o=i+1}return a}function QO(e,t){let n=e.querySelectorAll("[data-timeline-turn-section]"),o=QI(e,n,t),r=a=>{let i=QI(e,a.querySelectorAll("[data-timeline-row-id]"),t),s=i?.element.dataset.timelineRowId;return i&&s!==void 0?{rowId:s,offsetPx:Math.max(0,t-i.top)}:null};if(n.length===0)return r(e);if(!o)return null;for(let a=o.index;a<n.length;a+=1){let i=r(n[a]);if(i)return i}return null}function Zg(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}function XI({handleRef:e,onAttach:t,className:n,children:o,onScroll:r}){let a=_(null);Br(e,()=>({get node(){return a.current},measure:()=>{let s=a.current;return s?{scroll:s.scrollTop,scrollLength:s.clientHeight,contentLength:s.scrollHeight,topOf:l=>{let d=Jg(s,l);return d===null?null:Zg(d,s)},heightOf:l=>{let d=Jg(s,l);return d===null?null:d.offsetHeight},rowAtScroll:()=>QO(s,s.scrollTop)}:null},scrollToEnd:s=>{let l=a.current;if(l){if(s?.animated){l.scrollTo({top:l.scrollHeight,behavior:"smooth"});return}l.scrollTop=l.scrollHeight-l.clientHeight}},scrollToRow:(s,l)=>{let d=a.current;if(!d)return!1;let c=Jg(d,s);return c?(d.scrollTop=Math.max(0,Zg(c,d)-(l?.viewOffset??0)),!0):!1},scrollToOffset:s=>{let l=a.current;l&&(l.scrollTop=Math.max(0,s))}}),[]);let i=U(s=>{a.current=s,t(s)},[t]);return u("div",{ref:i,className:n,style:{position:"relative"},onScroll:r,children:o})}ue();var YI=de(function({sectionKey:t,rows:n,renderRow:o,sectionRef:r}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:r,children:n.map(a=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:o(a)},a.id))})});function XO(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 JI(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:XO(r),firstRowIndex:o.start,rows:r})}return n}function ZI(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function Cf(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)}ue();var Xa=3,YO=Xa;function eS(e){let[t,n]=K(Xa),o=_(e);o.current!==e&&(o.current=e,n(Xa));let r=U(()=>{n(l=>l+YO)},[]),a=U(l=>{n(d=>l>d?l:d)},[]),i=U(()=>{n(Xa)},[]),s=U(l=>{n(d=>Math.min(d,Math.max(Xa,l)))},[]);return{revealedCount:t,revealOlder:r,revealAtLeast:a,compactTo:s,reset:i}}function tS({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),b=y[L].getBoundingClientRect().bottom;if(!Number.isFinite(b))return;b<=C?w=L+1:k=L}if(w===0)return;let T=r.activeElement;if(T){for(let L=0;L<w;L+=1)if(y[L].contains(T))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)}}}ue();ue();function nS(e){let t=_(e);t.current=e;let n=_(!1),o=_(null),r=_(null),a=_(0),i=U(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=U(()=>{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=U(c=>{o.current=c,s()},[s]),d=U(()=>{o.current=null,i()},[i]);return Me(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),$(()=>({request:l,cancel:d}),[l,d])}function oS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=_(o);r.current=o;let a=nS(o),i=_(new Map),s=_(null),l=_(null),d=_(n);d.current=n;let c=U(()=>{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,T]of i.current){if(!T.isConnected)continue;let L=T.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=U(()=>{r.current&&a.request(c)},[a,c]);V(()=>{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=U(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=U(()=>{r.current&&(l.current=null,f())},[f]);return $(()=>({observeSection:m,refresh:h}),[m,h])}function Vd(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?I(pe,{children:[e,t]}):I(pe,{children:[i[0],t,i[1]]})}ue();function rS(){let e=Ho(),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 bf(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(`
3666
- `)}function aS(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?bf(e)??"Plan preview unavailable.":(i&&r.push("","..."),r.join(`
3667
- `))}function JO(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function iS(e){let t=bf(e);return`${JO(t??"plan")}.md`}function sS(e){return`${e.trimEnd()}
3668
- `}function lS(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 dS=de(function({planMarkdown:t,environmentId:n,threadRef:o,cwd:r,workspaceRoot:a,onSavePlanToWorkspace:i}){let{t:s}=Et(),l=rS(),[d,c]=K(!1),[f,p]=K(!1),[m,h]=K(""),[g,v]=K(!1),{copyToClipboard:x,isCopied:y}=mf({target:"plan",onError:H=>{l.error(s("proposedPlan.couldNotCopy"),H,{description:s("proposedPlan.copyErrorDescription")})}}),C=Fr(),w=bf(t)??s("proposedPlan.defaultTitle"),k=t.split(`
3669
- `).length,T=t.length>900||k>20,L=eh(t),b=T?aS(t,{maxLines:10}):null,S=iS(t),A=sS(t),E=()=>{lS(S,A)},B=()=>{x(A)},R=()=>{if(!a){l.error(s("proposedPlan.workspacePathUnavailable"),s("proposedPlan.workspacePathUnavailableDescription"));return}h(H=>H.length>0?H:S),p(!0)},N=()=>{let H=m.trim();if(!(!a||i===null)){if(!H){l.warning(s("proposedPlan.enterWorkspacePath"));return}v(!0),(async()=>{let D=await i({environmentId:n,workspaceRoot:a,relativePath:H,contents:A});if(v(!1),D.ok){p(!1),l.success(s("proposedPlan.savedToWorkspace"),D.relativePath);return}l.error(s("proposedPlan.couldNotSave"),void 0,{description:s("proposedPlan.saveErrorDescription")})})()}};return I("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[I("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[I("div",{className:"flex min-w-0 items-center gap-2",children:[u(Xs,{variant:"secondary",children:s("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:w})]}),I(Ko,{children:[u(Wo,{render:u(ne,{"aria-label":s("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(Uo,{"aria-hidden":"true",className:"size-4"})}),I(qo,{align:"end",children:[u(Vo,{onClick:B,children:s(y?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(Vo,{onClick:E,children:s("proposedPlan.downloadAsMarkdown")}),i!==null?u(Vo,{onClick:R,disabled:!a||g,children:s("proposedPlan.saveToWorkspace")}):null]})]})]}),I("div",{className:"mt-4",children:[I("div",{className:z("relative",T&&!d&&"max-h-104 overflow-hidden"),children:[T&&!d?u(Go,{text:b??"",cwd:r,threadRef:o,isStreaming:!1}):u(Go,{text:L,cwd:r,threadRef:o,isStreaming:!1}),T&&!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]}),T?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(ef,{open:f,onOpenChange:H=>{g||p(H)},children:I(rf,{className:"max-w-xl",children:[I(of,{children:[u(af,{children:s("proposedPlan.saveToWorkspace")}),u(tf,{children:Vd(s("proposedPlan.pathHint"),u("code",{children:a??s("proposedPlan.theWorkspace")}),"path")})]}),u(uI,{className:"space-y-3",children:I("label",{htmlFor:C,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:s("proposedPlan.workspacePath")}),u(ju,{id:C,value:m,onChange:H=>h(H.target.value),placeholder:S,spellCheck:!1,disabled:g})]})}),I(nf,{children:[u(ne,{variant:"outline",size:"sm",onClick:()=>p(!1),disabled:g,children:s("proposedPlan.cancel")}),u(ne,{size:"sm",onClick:()=>{N()},disabled:g,children:s(g?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function cS({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function uS({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}ue();var If=class extends id{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 ZO({error:e,className:t}){let{t:n}=Et();return I(je,{children:[I(Xe,{render:u("div",{className:z("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(po,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Qe,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function fS(e){return u(ZO,{error:e})}ue();function th(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 Ya(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||eF.has(t)?"text":"file"}var eF=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function pS(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 tF="<ycodium-system>";function nh(e){return e.startsWith(tF)}var nF=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function mS(e){let t=e.match(nF);return t&&t.length>0?t:[e]}function gS(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 hS(e){switch(e){case"image":return Oi;case"pdf":return Di;case"text":return _i;case"file":return Io}}var oF=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function qd(e){let t=oF.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=rF(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function rF(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3665
+ `;pe();pe();var jb=Ut(null),Qb=jb.Provider,Xb=Ut(""),Yb=Xb.Provider;function sf(){return cn(Xb)}function Yo(){let e=cn(jb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var ih="conversation";var sh="__ycodiumConversationBridge",Jb="ycodium.conversation.rebindable-bridge.v1";pe();function Zb(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=Zb(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function eI(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Zb(e))&&(o&&(o+=" "),o+=t);return o}var tI=eI;var f1=(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},p1=(e,t)=>({classGroupId:e,validator:t}),dI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var nI=[],m1="arbitrary..",g1=e=>{let t=v1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return h1(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return cI(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?f1(d,l):l:d||nI}return n[i]||nI}}},cI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=cI(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}},h1=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?m1+o:void 0})(),v1=e=>{let{theme:t,classGroups:n}=e;return x1(n,t)},x1=(e,t)=>{let n=dI();for(let o in e){let r=e[o];ch(r,n,o,t)}return n},ch=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];y1(i,t,n,o)}},y1=(e,t,n,o)=>{if(typeof e=="string"){C1(e,t,n);return}if(typeof e=="function"){b1(e,t,n,o);return}I1(e,t,n,o)},C1=(e,t,n)=>{let o=e===""?t:uI(t,e);o.classGroupId=n},b1=(e,t,n,o)=>{if(S1(e)){ch(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(p1(n,e))},I1=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];ch(l,uI(t,s),n,o)}},uI=(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=dI(),n.nextPart.set(i,s)),n=s}return n},S1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,w1=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 T1=[],oI=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),L1=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 oI(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):oI(T1,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},k1=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}},P1=e=>({cache:w1(e.cacheSize),parseClassName:L1(e),sortModifiers:k1(e),postfixLookupClassGroupIds:E1(e),...g1(e)}),E1=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},A1=/\s+/,M1=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(A1),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},R1=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=fI(n))&&(r&&(r+=" "),r+=o);return r},fI=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=fI(e[o]))&&(n&&(n+=" "),n+=t);return n},rI=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=P1(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=M1(l,n);return r(l,c),c};return a=i,(...l)=>a(R1(...l))},N1=[],Bn=e=>{let t=n=>n[e]||N1;return t.isThemeGetter=!0,t},pI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,mI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,D1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,O1=/\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$/,F1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,B1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,z1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ai=e=>_1.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),Xr=e=>!!e&&Number.isInteger(Number(e)),lh=e=>e.endsWith("%")&&st(e.slice(0,-1)),ba=e=>D1.test(e),gI=()=>!0,$1=e=>O1.test(e)&&!F1.test(e),uh=()=>!1,H1=e=>B1.test(e),U1=e=>z1.test(e),K1=e=>!ke(e)&&!Pe(e),q1=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)),V1=e=>ii(e,xI,uh),ke=e=>pI.test(e),qi=e=>ii(e,yI,$1),aI=e=>ii(e,Z1,st),W1=e=>ii(e,bI,gI),G1=e=>ii(e,CI,uh),iI=e=>ii(e,hI,uh),j1=e=>ii(e,vI,U1),lf=e=>ii(e,II,H1),Pe=e=>mI.test(e),kd=e=>Vi(e,yI),Q1=e=>Vi(e,CI),sI=e=>Vi(e,hI),X1=e=>Vi(e,xI),Y1=e=>Vi(e,vI),df=e=>Vi(e,II,!0),J1=e=>Vi(e,bI,!0),ii=(e,t,n)=>{let o=pI.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Vi=(e,t,n=!1)=>{let o=mI.exec(e);return o?o[1]?t(o[1]):n:!1},hI=e=>e==="position"||e==="percentage",vI=e=>e==="image"||e==="url",xI=e=>e==="length"||e==="size"||e==="bg-size",yI=e=>e==="length",Z1=e=>e==="number",CI=e=>e==="family-name",bI=e=>e==="number"||e==="weight",II=e=>e==="shadow";var lI=()=>{let e=Bn("color"),t=Bn("font"),n=Bn("text"),o=Bn("font-weight"),r=Bn("tracking"),a=Bn("leading"),i=Bn("breakpoint"),s=Bn("container"),l=Bn("spacing"),d=Bn("radius"),c=Bn("shadow"),f=Bn("inset-shadow"),p=Bn("text-shadow"),m=Bn("drop-shadow"),h=Bn("blur"),g=Bn("perspective"),v=Bn("aspect"),x=Bn("ease"),y=Bn("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(),Pe,ke],S=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],I=()=>[Pe,ke,l],T=()=>[ai,"full","auto",...I()],A=()=>[Xr,"none","subgrid",Pe,ke],E=()=>["auto",{span:["full",Xr,Pe,ke]},Xr,Pe,ke],N=()=>[Xr,"auto",Pe,ke],R=()=>["auto","min","max","fr",Pe,ke],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...I()],O=()=>[ai,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],ne=()=>[ai,"screen","full","dvw","lvw","svw","min","max","fit",...I()],ee=()=>[ai,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,Pe,ke],De=()=>[...w(),sI,iI,{position:[Pe,ke]}],Ce=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ue=()=>["auto","cover","contain",X1,V1,{size:[Pe,ke]}],Be=()=>[lh,kd,qi],ge=()=>["","none","full",d,Pe,ke],le=()=>["",st,kd,qi],Se=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[st,lh,sI,iI],we=()=>["","none",h,Pe,ke],dt=()=>["none",st,Pe,ke],ct=()=>["none",st,Pe,ke],lt=()=>[st,Pe,ke],at=()=>[ai,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ba],breakpoint:[ba],color:[gI],container:[ba],"drop-shadow":[ba],ease:["in","out","in-out"],font:[K1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ba],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ba],shadow:[ba],spacing:["px",st],text:[ba],"text-shadow":[ba],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ai,ke,Pe,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Pe,ke]}],"container-named":[q1],columns:[{columns:[st,ke,Pe,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:[Xr,"auto",Pe,ke]}],basis:[{basis:[ai,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[st,ai,"auto","initial","none",ke]}],grow:[{grow:["",st,Pe,ke]}],shrink:[{shrink:["",st,Pe,ke]}],order:[{order:[Xr,"first","last","none",Pe,ke]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:E()}],"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:[...B(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],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:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"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",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"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,kd,qi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,J1,W1]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lh,ke]}],"font-family":[{font:[Q1,G1,t]}],"font-features":[{"font-features":[ke]}],"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,Pe,ke]}],"line-clamp":[{"line-clamp":[st,"none",Pe,aI]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",Pe,ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Pe,ke]}],"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:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[st,"from-font","auto",Pe,qi]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[st,"auto",Pe,ke]}],"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:[Xr,Pe,ke]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Pe,ke]}],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",Pe,ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:De()}],"bg-repeat":[{bg:Ce()}],"bg-size":[{bg:ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xr,Pe,ke],radial:["",Pe,ke],conic:[Xr,Pe,ke]},Y1,j1]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Be()}],"gradient-via-pos":[{via:Be()}],"gradient-to-pos":[{to:Be()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:ge()}],"rounded-s":[{"rounded-s":ge()}],"rounded-e":[{"rounded-e":ge()}],"rounded-t":[{"rounded-t":ge()}],"rounded-r":[{"rounded-r":ge()}],"rounded-b":[{"rounded-b":ge()}],"rounded-l":[{"rounded-l":ge()}],"rounded-ss":[{"rounded-ss":ge()}],"rounded-se":[{"rounded-se":ge()}],"rounded-ee":[{"rounded-ee":ge()}],"rounded-es":[{"rounded-es":ge()}],"rounded-tl":[{"rounded-tl":ge()}],"rounded-tr":[{"rounded-tr":ge()}],"rounded-br":[{"rounded-br":ge()}],"rounded-bl":[{"rounded-bl":ge()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-bs":[{"border-bs":le()}],"border-w-be":[{"border-be":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":le()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"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:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Pe,ke]}],"outline-w":[{outline:["",st,kd,qi]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,df,lf]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,df,lf]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[st,qi]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",p,df,lf]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[st,Pe,ke]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"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":[st]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"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":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"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":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"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":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"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":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"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":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"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":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Pe,ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"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":[st]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"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:De()}],"mask-repeat":[{mask:Ce()}],"mask-size":[{mask:ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Pe,ke]}],filter:[{filter:["","none",Pe,ke]}],blur:[{blur:we()}],brightness:[{brightness:[st,Pe,ke]}],contrast:[{contrast:[st,Pe,ke]}],"drop-shadow":[{"drop-shadow":["","none",m,df,lf]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",st,Pe,ke]}],"hue-rotate":[{"hue-rotate":[st,Pe,ke]}],invert:[{invert:["",st,Pe,ke]}],saturate:[{saturate:[st,Pe,ke]}],sepia:[{sepia:["",st,Pe,ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Pe,ke]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[st,Pe,ke]}],"backdrop-contrast":[{"backdrop-contrast":[st,Pe,ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",st,Pe,ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[st,Pe,ke]}],"backdrop-invert":[{"backdrop-invert":["",st,Pe,ke]}],"backdrop-opacity":[{"backdrop-opacity":[st,Pe,ke]}],"backdrop-saturate":[{"backdrop-saturate":[st,Pe,ke]}],"backdrop-sepia":[{"backdrop-sepia":["",st,Pe,ke]}],"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",Pe,ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[st,"initial",Pe,ke]}],ease:[{ease:["linear","initial",x,Pe,ke]}],delay:[{delay:[st,Pe,ke]}],animate:[{animate:["none",y,Pe,ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Pe,ke]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:dt()}],"rotate-x":[{"rotate-x":dt()}],"rotate-y":[{"rotate-y":dt()}],"rotate-z":[{"rotate-z":dt()}],scale:[{scale:ct()}],"scale-x":[{"scale-x":ct()}],"scale-y":[{"scale-y":ct()}],"scale-z":[{"scale-z":ct()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[Pe,ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:at()}],"translate-x":[{"translate-x":at()}],"translate-y":[{"translate-y":at()}],"translate-z":[{"translate-z":at()}],"translate-none":["translate-none"],zoom:[{zoom:[Xr,Pe,ke]}],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",Pe,ke]}],"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",Pe,ke]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[st,kd,qi,aI]}],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"]}},eO=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(ul(e,"cacheSize",t),ul(e,"prefix",n),ul(e,"experimentalParseClassName",o),cf(e.theme,a.theme),cf(e.classGroups,a.classGroups),cf(e.conflictingClassGroups,a.conflictingClassGroups),cf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ul(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),ul(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),uf(e.theme,r.theme),uf(e.classGroups,r.classGroups),uf(e.conflictingClassGroups,r.conflictingClassGroups),uf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),dh(e,r,"postfixLookupClassGroups"),dh(e,r,"orderSensitiveModifiers"),e),ul=(e,t,n)=>{n!==void 0&&(e[t]=n)},cf=(e,t)=>{if(t)for(let n in t)ul(e,n,t[n])},uf=(e,t)=>{if(t)for(let n in t)dh(e,t,n)},dh=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},SI=(e,...t)=>typeof e=="function"?rI(lI,e,...t):rI(()=>eO(lI(),e),...t);var tO=SI({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 tO(tI(e))}pe();var fh=Ut(!0);var ph=Ut(void 0);function si(){let e=Kt(fh);return Kt(ph)??e}pe();var ff=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var wI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var TI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var mh=e=>{let t=TI(e);return t.charAt(0).toUpperCase()+t.slice(1)};pe();var LI={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 kI=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var PI=qn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Le("svg",{ref:l,...LI,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:ff("lucide",r),...!a&&!kI(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>Le(d,c)),...Array.isArray(a)?a:[a]]));var j=(e,t)=>{let n=qn(({className:o,...r},a)=>Le(PI,{ref:a,iconNode:t,className:ff(`lucide-${wI(mh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=mh(e),n};var nO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Pd=j("arrow-down",nO);var oO=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Ed=j("arrow-up-right",oO);var rO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ad=j("arrow-up",rO);var aO=[["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"}]],Md=j("blocks",aO);var iO=[["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",iO);var sO=[["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",sO);var lO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Io=j("check",lO);var dO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],un=j("chevron-down",dO);var cO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Gi=j("chevron-left",cO);var uO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Uo=j("chevron-right",uO);var fO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Rd=j("chevron-up",fO);var pO=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Nd=j("chevrons-left",pO);var mO=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],_d=j("chevrons-right",mO);var gO=[["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",gO);var hO=[["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",hO);var vO=[["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"}]],Jo=j("ellipsis",vO);var xO=[["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"}]],Dd=j("eye",xO);var yO=[["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",yO);var CO=[["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",CO);var bO=[["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"}]],Od=j("file",bO);var IO=[["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"}]],li=j("folder",IO);var SO=[["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"}]],Fd=j("frame",SO);var wO=[["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"}]],Bd=j("git-branch-plus",wO);var TO=[["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"}]],zd=j("globe",TO);var LO=[["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"}]],$d=j("grip-vertical",LO);var kO=[["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"}]],Hd=j("hammer",kO);var PO=[["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",PO);var EO=[["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"}]],Ia=j("layers",EO);var AO=[["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"}]],Ud=j("list-ordered",AO);var MO=[["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",MO);var RO=[["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"}]],Kd=j("list",RO);var NO=[["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"}]],di=j("lock-open",NO);var _O=[["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"}]],qd=j("lock",_O);var DO=[["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",DO);var OO=[["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",OO);var FO=[["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"}]],Vd=j("minimize-2",FO);var BO=[["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"}]],Yr=j("mouse-pointer-click",BO);var zO=[["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"}]],Wd=j("package",zO);var $O=[["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",$O);var HO=[["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"}]],_o=j("paperclip",HO);var UO=[["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"}]],Jr=j("pen-line",UO);var KO=[["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"}]],Gd=j("pencil-ruler",KO);var qO=[["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"}]],jd=j("pencil",qO);var VO=[["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",VO);var WO=[["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",WO);var GO=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],rs=j("search",GO);var jO=[["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"}]],Qd=j("send",jO);var QO=[["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"}]],Xd=j("settings",QO);var XO=[["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",XO);var YO=[["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"}]],ci=j("sparkles",YO);var JO=[["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"}]],Do=j("square-pen",JO);var ZO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Yd=j("square",ZO);var eF=[["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",eF);var tF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Sa=j("terminal",tF);var nF=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Jd=j("text-quote",nF);var oF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Zr=j("user-round",oF);var rF=[["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"}]],Zd=j("wrench",rF);var aF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Yt=j("x",aF);var iF=[["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",iF);pe();function ze(){return{t:Yo().i18n.usePluginTranslation()}}pe();var sF=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function Y(e){let t=n=>{let o=Yo(),r=sf(),a=si(),i=o.ui[e];return Le(i,{...n,...sF.has(e)&&!a?{open:!1}:{},className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var M9=Y("useLinkContextMenu"),wa=Y("ProviderInstanceIcon"),EI=Y("UserAvatar"),ml=Y("Badge"),oe=Y("Button"),R9=Y("Label"),pf=Y("Input"),AI=Y("Textarea"),N9=Y("Switch"),ec=Y("Separator"),_9=Y("Skeleton"),mf=Y("Spinner"),D9=Y("ScrollArea"),O9=Y("Card"),F9=Y("CardAction"),B9=Y("CardContent"),z9=Y("CardDescription"),$9=Y("CardFooter"),H9=Y("CardHeader"),U9=Y("CardTitle"),K9=Y("Empty"),q9=Y("EmptyContent"),V9=Y("EmptyDescription"),W9=Y("EmptyHeader"),G9=Y("EmptyMedia"),j9=Y("EmptyTitle"),Q9=Y("InputGroup"),X9=Y("InputGroupAddon"),Y9=Y("InputGroupInput"),J9=Y("DocumentPanel"),Z9=Y("MasterDetail"),gf=Y("Select"),eQ=Y("SelectContent"),hf=Y("SelectItem"),vf=Y("SelectPopup"),MI=Y("SelectTrigger"),xf=Y("SelectValue"),tc=Y("Toggle"),RI=Y("ToggleGroup"),NI=Y("AlertDialog"),_I=Y("AlertDialogClose"),DI=Y("AlertDialogDescription"),OI=Y("AlertDialogFooter"),FI=Y("AlertDialogHeader"),BI=Y("AlertDialogPopup"),zI=Y("AlertDialogTitle"),yf=Y("Dialog"),tQ=Y("DialogClose"),Cf=Y("DialogDescription"),bf=Y("DialogFooter"),If=Y("DialogHeader"),Sf=Y("DialogPopup"),$I=Y("DialogPanel"),wf=Y("DialogTitle"),nQ=Y("DialogTrigger"),oQ=Y("DropdownMenu"),rQ=Y("DropdownMenuContent"),aQ=Y("DropdownMenuItem"),iQ=Y("DropdownMenuTrigger"),Zo=Y("Menu"),nc=Y("MenuGroup"),sQ=Y("MenuGroupLabel"),er=Y("MenuItem"),tr=Y("MenuPopup"),Ta=Y("MenuRadioGroup"),Ir=Y("MenuRadioItem"),ui=Y("MenuSeparator"),nr=Y("MenuTrigger"),gl=Y("Popover"),hl=Y("PopoverPopup"),vl=Y("PopoverTrigger"),HI=Y("Table"),UI=Y("TableBody"),fi=Y("TableCell"),ss=Y("TableHead"),KI=Y("TableHeader"),Tf=Y("TableRow"),Xe=Y("Tooltip"),Ye=Y("TooltipPopup"),Je=Y("TooltipTrigger"),qI=Y("Collapsible"),VI=Y("CollapsiblePanel"),WI=Y("CollapsibleTrigger"),oc=Y("Alert"),rc=Y("AlertAction"),Lf=Y("AlertDescription"),gh=Y("AlertTitle"),kf=Y("Kbd"),Pf=Y("Command"),Ef=Y("CommandGroup"),Af=Y("CommandItem"),Mf=Y("CommandList"),GI=Y("Combobox"),jI=Y("ComboboxEmpty"),QI=Y("ComboboxInput"),xl=Y("ComboboxItem"),XI=Y("ComboboxListVirtualized"),YI=Y("TooltipProvider"),JI=Y("StyledDiffCodeView"),ZI=Y("DevBackdropArt"),or=Y("Markdown"),eS=Y("DiffView");var{jsx:u,jsxs:b,Fragment:xe}=window.__ycodiumPluginHost.jsxRuntime;function tS({mode:e,onModeChange:t}){let{t:n}=ze();return b(RI,{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(tc,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(es,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(tc,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(Ud,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function nS({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(ph,{value:t,children:r==="chat"?n:o})})}pe();function uo(){return{t:Yo().i18n.usePluginTranslation()}}function oS(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 lF=ce(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:oS(o.outputTokens)}):null]}):null]})]})});function dF({totals:e}){let{t}=uo();if(!e)return null;let n=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:e.outputTokens},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:e.inputTokens},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:e.cachedInputTokens}].filter(o=>o!==null);return n.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")}),n.map(o=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[o.label," ",oS(o.value)]},o.label))]})}var cF=ce(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=uo(),i=Yo().writeClipboard,[s,l]=G(!1),d=a("turnNavigator.copyMarkdown");return b(Xe,{children:[u(Je,{render:u(oe,{"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(ji,{className:"size-3"})}),u(Ye,{children:u("p",{children:d})})]})});function rS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=uo(),[d,c]=G(!1),f=H(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=H(()=>{let g,v,x;for(let{item:y}of f){let C=y.turnId===null?void 0:o.get(y.turnId);C?.outputTokens!==void 0&&(g=(g??0)+C.outputTokens),C?.inputTokens!==void 0&&(v=(v??0)+C.inputTokens),C?.cachedInputTokens!==void 0&&(x=(x??0)+C.cachedInputTokens)}if(!(g===void 0&&v===void 0&&x===void 0))return{...g!==void 0?{outputTokens:g}:{},...v!==void 0?{inputTokens:v}:{},...x!==void 0?{cachedInputTokens:x}:{}}},[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(oe,{"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(Kd,{"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(lF,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(dF,{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(cF,{size:"icon-xs",getText:a,variant:"ghost"}),u(oe,{"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(oe,{"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"})})]})]})})]})}pe();function aS(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}}pe();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 uF(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function fF(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function pF(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var hh=fF(pF()),iS=new Map;function sS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=iS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(hh,uF(e,t));return iS.set(n,r),r}function vh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var mF=new Intl.DateTimeFormat(void 0,{month:"long"});function gF(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 hF(e,t){let n=vh(e);return n?sS(t,!1).format(n):""}function ea(e,t){let n=vh(e);if(!n)return"";let o=hF(e,t),r=n.getDate(),a=mF.format(n),i=n.getFullYear();return`${o}, ${r}${gF(r)} ${a} ${i}`}var vF=new Intl.DateTimeFormat(hh,{month:"numeric",day:"numeric"}),xF=new Intl.DateTimeFormat(hh,{month:"numeric",day:"numeric",year:"numeric"});function pi(e,t,n=Date.now()){let o=vh(e);if(!o)return"";let r=sS(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()?vF:xF).format(o)} ${r}`}pe();pe();async function yF(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 Rf({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=$((p,m)=>{yF(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 Nt(){let e=Yo().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var lS=1e3;function CF({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=ce(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=Nt(),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),lS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Rf({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:lS});return b(Xe,{children:[u(Je,{render:u(oe,{"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(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(CF,{title:l.title,description:l.description})})}):null]})});function bF(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 Nf({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 dS=ce(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=Nt(),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(Nf,{label:i,children:[a==="completed"?u(Io,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(Yt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Yd,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(Nf,{label:ea(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:pi(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?b(Nf,{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(Nf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),bF(t.outputTokens)]}):null]}),o?u(yl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});pe();pe();function cS(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 uS=ce(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=Nt(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(xe,{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:["+",cS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",cS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function fS(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function IF(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 pS(e){return e.replaceAll("\\","/")}function mS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function SF(e){return e.replace(/[\\/]+$/,"")}function wF(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function TF(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function LF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function _f(e,t){let{path:n,line:o,column:r}=IF(e),a=mS(pS(n)),i=a;if(t){let s=mS(pS(SF(t))),l=wF(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(!LF(a)){let m=TF(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function gS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function hS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Df="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function ac({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function ic({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 Of({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]})}pe();var Cl=new Map,vS=24,kF=4e3;function xh(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>vS){for(let[o,r]of Cl)if(r.listeners.size===0&&o!==e&&(Cl.delete(o),Cl.size<=vS))break}return n}function yh(e,t,n){return xh(e).values.get(t)??n}function sc(e,t,n,o=!0){let r=xh(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>kF){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=$(s=>{let l=xh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=$(()=>yh(e,t,n),[e,t,n]),a=Ca(o,r,r),i=$(s=>sc(e,t,s),[e,t]);return[a,i]}function Ff({name:e,className:t}){switch(e){case"bot":return u(Wi,{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(Dd,{className:t,"aria-hidden":!0});case"globe":return u(zd,{className:t,"aria-hidden":!0});case"hammer":return u(Hd,{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(Do,{className:t,"aria-hidden":!0});case"terminal":return u(Sa,{className:t,"aria-hidden":!0});case"wrench":return u(Zd,{className:t,"aria-hidden":!0});case"x":return u(Yt,{className:t,"aria-hidden":!0});case"zap":return u(is,{className:t,"aria-hidden":!0})}}function PF(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 Ch(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:PF(o),count:r}))}function bh(e,t){let n;for(let o of Ch(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var Il=20;function Sl(e){return fS(e)}function xS(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?_f(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 yS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Ih(e)?null:u(uS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Ih(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function EF({entry:e,failed:t=!1,derive:n}){return t?u(So,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u(Ff,{name:bh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function AF({entries:e,failed:t,derive:n}){let{t:o}=Nt(),r=H(()=>Ch(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(Ff,{name:s,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function CS({entry:e}){let t=Kt(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(xe,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var MF=ce(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=Kt(Tn).derive,{t:l}=Nt(),[d,c]=bl(o,`call:${Sl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Ih(n),m=s.resolveWorkEntryStatus(n),h=m==="failed"||m==="running"?m:null,g=jr();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(ic,{status:h}),u(ac,{children:u(EF,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:xS(n,r,s)??l("toolGroup.calls",{count:1})}),u(yS,{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(un,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:g,children:u(CS,{entry:n})}):null]})});function RF({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=_(null);return he(()=>{let a=r.current;if(!a)return;a.scrollTop=yh(e,`${t}:scroll`,0);let i=()=>{sc(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 bS=ce(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=Kt(Tn).derive,{t:l}=Nt(),[d,c]=bl(o,`group:${n}`,!1),[f,p]=bl(o,`group-page:${n}`,0),m=jr(),h=_(null),[g,v]=G(null),x=t.at(-1),y=H(()=>t.filter(O=>s.workEntryIndicatesFailure(O)),[t,s]),C=H(()=>t.filter(Ih),[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,A=t.slice(T,T+Il),E=t.length>1;if(he(()=>{if(!g)return;let O=h.current,ne=Array.from(O?.querySelectorAll("[data-tool-identity]")??[]).find(W=>W.dataset.toolIdentity===g.id);if(!ne)return;let ee=ne.closest('[data-slot="scroll-area-viewport"]');ee&&(ee.scrollTop+=ne.getBoundingClientRect().top-ee.getBoundingClientRect().top),ne.querySelector("button")?.focus({preventScroll:!0})},[g]),!x||!S)return null;let N=O=>{a?.(),p(O)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},B=hS(t.map(O=>gS(s.resolveWorkEntryStatus(O)))),z=bh(t,s.toolGroupAction),U=B==="failed"?"failed":B==="running"?"running":"success";return u(Of,{state:B,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),!E&&!d&&sc(o,`call:${Sl(x)}`,!0)},className:F(Df,"flex-1",k?"text-destructive":"text-muted-foreground"),children:[u(ic,{status:U}),u(ac,{children:u(Ff,{name:z,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&&E?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&E?l("toolGroup.calls",{count:t.length}):xS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&E?null:u(yS,{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&&E?null:u(AF,{entries:t,failed:y.length>0,derive:s}),u(un,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),k&&E?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)),sc(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:E?b(xe,{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:Nd},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Gi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===L,Icon:Uo},{label:l("toolGroup.lastPage"),target:L,disabled:I===L,Icon:_d}].map(({label:O,target:ne,disabled:ee,Icon:W})=>u("button",{type:"button","aria-label":O,disabled:ee,onClick:()=>N(ne),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(RF,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:A.map(O=>u(MF,{entry:O,...R},Sl(O)))})})]}):u(CS,{entry:x})}):null]})})});function NF(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 IS(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=NF(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}}}pe();function Sh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function SS(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 _F(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=SS(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=SS(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 wS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var wh=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 TS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i}){let s=_(null);Qr(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=Sh(d,c);return f===null?null:wS(f,d)},heightOf:c=>{let f=Sh(d,c);return f===null?null:f.offsetHeight},rowAtScroll:()=>_F(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=Sh(f,d);return p?(f.scrollTop=Math.max(0,wS(p,f)-(c?.viewOffset??0)),!0):!1},scrollToOffset:d=>{let c=s.current;c&&(c.scrollTop=Math.max(0,d))}}),[]);let l=$(d=>{s.current=d,o(d)},[o]);return u(wh,{inputKey:e,onBeforeInputChange:t,children:u("div",{ref:l,className:r,style:{position:"relative"},onScroll:i,children:a})})}pe();var LS=ce(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 DF(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 kS(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:DF(r),firstRowIndex:o.start,rows:r})}return n}function PS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function lc(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)}pe();pe();var AS=100,OF=new Map,ES=new Map,Lh=e=>typeof e=="function"?e():e,FF=(e,t)=>typeof t=="function"?t(e):t;function BF(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 zF(e,t){let n=ES.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},ES.set(e,n)),n}function $F(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 Th(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function MS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:Lh(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function dc(e){queueMicrotask(()=>$F(e))}function Ln(e,t,n,o=AS){let r=Math.max(1,o),a=BF(OF,e,r),i=MS(a,t,n),s=$(f=>i.alive?(a.limit=r,i.committed=!0,Th(a,t,i),i.leases+=1,i.subscribers.add(f),dc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),dc(a)}):()=>{},[r,i,a,t]),l=$(()=>i.value,[i]),d=Ca(s,l,l),c=$(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=FF(p,f);if(!Object.is(m,p)){i.value=m,Th(a,t,i);for(let h of i.subscribers)h();dc(a)}},[i,a,t]);return[d,c]}function Rn(e,t,n,o=AS){let r=Math.max(1,o),a=zF(e,r),i=MS(a,t,()=>({current:Lh(n)}));return q(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Th(a,t,i),i.leases+=1,dc(a),()=>{i.leases=Math.max(0,i.leases-1),dc(a)}},[r,i,a,t]),i.value}function cc(e,t){let n=_(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:Lh(t)}}),n.current.ref}var ds=3,HF=ds;function RS(e){let[t,n]=Ln("timeline-reveal-window",e,ds),o=$(()=>{n(s=>s+HF)},[n]),r=$(s=>{n(l=>s>l?s:l)},[n]),a=$(()=>{n(ds)},[n]),i=$(s=>{n(l=>Math.min(l,Math.max(ds,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function NS({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)}}}pe();pe();function _S(e){let t=_(e);t.current=e;let n=_(!1),o=_(null),r=_(null),a=_(0),i=$(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=$(()=>{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=$(c=>{o.current=c,s()},[s]),d=$(()=>{o.current=null,i()},[i]);return he(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),H(()=>({request:l,cancel:d}),[l,d])}function DS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=_(o);r.current=o;let a=_S(o),i=_(new Map),s=_(null),l=_(null),d=_(n);d.current=n;let c=$(()=>{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=$(()=>{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=$(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=$(()=>{r.current&&(l.current=null,f())},[f]);return H(()=>({observeSection:m,refresh:h}),[m,h])}function uc(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(xe,{children:[e,t]}):b(xe,{children:[i[0],t,i[1]]})}pe();function OS(){let e=Yo(),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 Bf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function kh(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(`
3666
+ `)}function FS(e,t){let n=t?.maxLines??8,o=kh(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?Bf(e)??"Plan preview unavailable.":(i&&r.push("","..."),r.join(`
3667
+ `))}function UF(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function BS(e){let t=Bf(e);return`${UF(t??"plan")}.md`}function zS(e){return`${e.trimEnd()}
3668
+ `}function $S(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 HS=ce(function({planMarkdown:t,environmentId:n,threadRef:o,cwd:r,workspaceRoot:a,onSavePlanToWorkspace:i}){let{t:s}=Nt(),l=OS(),[d,c]=G(!1),[f,p]=G(!1),[m,h]=G(""),[g,v]=G(!1),{copyToClipboard:x,isCopied:y}=Rf({target:"plan",onError:z=>{l.error(s("proposedPlan.couldNotCopy"),z,{description:s("proposedPlan.copyErrorDescription")})}}),C=jr(),w=Bf(t)??s("proposedPlan.defaultTitle"),k=t.split(`
3669
+ `).length,S=t.length>900||k>20,L=kh(t),I=S?FS(t,{maxLines:10}):null,T=BS(t),A=zS(t),E=()=>{$S(T,A)},N=()=>{x(A)},R=()=>{if(!a){l.error(s("proposedPlan.workspacePathUnavailable"),s("proposedPlan.workspacePathUnavailableDescription"));return}h(z=>z.length>0?z:T),p(!0)},B=()=>{let z=m.trim();if(!(!a||i===null)){if(!z){l.warning(s("proposedPlan.enterWorkspacePath"));return}v(!0),(async()=>{let U=await i({environmentId:n,workspaceRoot:a,relativePath:z,contents:A});if(v(!1),U.ok){p(!1),l.success(s("proposedPlan.savedToWorkspace"),U.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(Zo,{children:[u(nr,{render:u(oe,{"aria-label":s("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(Jo,{"aria-hidden":"true",className:"size-4"})}),b(tr,{align:"end",children:[u(er,{onClick:N,children:s(y?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(er,{onClick:E,children:s("proposedPlan.downloadAsMarkdown")}),i!==null?u(er,{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(or,{text:I??"",cwd:r,threadRef:o,isStreaming:!1}):u(or,{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(oe,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>c(z=>!z),children:s(d?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(yf,{open:f,onOpenChange:z=>{g||p(z)},children:b(Sf,{className:"max-w-xl",children:[b(If,{children:[u(wf,{children:s("proposedPlan.saveToWorkspace")}),u(Cf,{children:uc(s("proposedPlan.pathHint"),u("code",{children:a??s("proposedPlan.theWorkspace")}),"path")})]}),u($I,{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(pf,{id:C,value:m,onChange:z=>h(z.target.value),placeholder:T,spellCheck:!1,disabled:g})]})}),b(bf,{children:[u(oe,{variant:"outline",size:"sm",onClick:()=>p(!1),disabled:g,children:s("proposedPlan.cancel")}),u(oe,{size:"sm",onClick:()=>{B()},disabled:g,children:s(g?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function US({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function KS({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}pe();var zf=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 KF({error:e,className:t}){let{t:n}=Nt();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(So,{"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 qS(e){return u(KF,{error:e})}pe();function Ph(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 mi(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||qF.has(t)?"text":"file"}var qF=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function VS(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 VF="<ycodium-system>";function Eh(e){return e.startsWith(VF)}var WF=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function WS(e){let t=e.match(WF);return t&&t.length>0?t:[e]}function GS(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 Yi;case"pdf":return Xi;case"text":return Qi;case"file":return _o}}var GF=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function fc(e){let t=GF.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=jF(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function jF(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3670
3670
  `).trimEnd()}),n=null)};for(let r of e.split(`
3671
- `)){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 aF=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function oh(e){let t=aF.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3672
- `),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 iF=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,sF=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,lF=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function dF(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function cF(e){let t={};for(let n of e.matchAll(sF))t[n[1]]=dF(n[2]??"");return t}function vS(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function uF(e){let n=Array.from(e.matchAll(lF)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function fF(e,t,n){let o=cF(e),r=vS(o.startIndex),a=vS(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=uF(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 rh(e){let t=[],n=0,o=0;for(let a of e.matchAll(iF)){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=fF(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 xS(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(`
3673
- `)}function yS(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(`
3674
- `)}var pF="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",mF=`${pF} border border-border/70 bg-accent/40 text-foreground`,Sf=`${mF} text-[12px]`,wf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Tf="truncate leading-tight",CS='<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 gF=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function hF(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function vF(e){let t=e.displayName?.trim();return t||hF(e.name)}function bS(e){let t=[],n=0;for(let o of e.text.matchAll(gF)){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(xF,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(pe,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(pe,{children:t}))}function xF(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:I("span",{className:z(Sf,"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:CS}}),u("span",{className:Tf,children:vF(e.skill)})]})})}function IS(e){let{label:t,tooltipText:n,expired:o=!1}=e;return I(je,{children:[I(Xe,{render:u("span",{className:z(Sf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(ua,{className:z(wf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Tf,children:t})]}),u(Qe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var yF=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function CF(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3671
+ `)){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 QF=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function Ah(e){let t=QF.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3672
+ `),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 XF=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,YF=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,JF=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function ZF(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function e2(e){let t={};for(let n of e.matchAll(YF))t[n[1]]=ZF(n[2]??"");return t}function QS(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function t2(e){let n=Array.from(e.matchAll(JF)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function n2(e,t,n){let o=e2(e),r=QS(o.startIndex),a=QS(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=t2(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 Mh(e){let t=[],n=0,o=0;for(let a of e.matchAll(XF)){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=n2(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 XS(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(`
3673
+ `)}function YS(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(`
3674
+ `)}var o2="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",r2=`${o2} border border-border/70 bg-accent/40 text-foreground`,$f=`${r2} text-[12px]`,Hf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Uf="truncate leading-tight",JS='<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 a2=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function i2(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function s2(e){let t=e.displayName?.trim();return t||i2(e.name)}function ZS(e){let t=[],n=0;for(let o of e.text.matchAll(a2)){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(l2,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(xe,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(xe,{children:t}))}function l2(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:F($f,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:Hf,dangerouslySetInnerHTML:{__html:JS}}),u("span",{className:Uf,children:s2(e.skill)})]})})}function e0(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Xe,{children:[b(Je,{render:u("span",{className:F($f,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(Sa,{className:F(Hf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Uf,children:t})]}),u(Ye,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var d2=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function c2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3675
3675
  `).trimEnd()}),n=null)};for(let r of e.split(`
3676
- `)){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 bF(e){let t=yF.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=CF(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3676
+ `)){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 u2(e){let t=d2.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=c2(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3677
3677
  ${a}`:r).join(`
3678
3678
 
3679
- `):null,contexts:o}}function SS(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 ah(e){let t=qd(e),n=bF(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var IF=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function wS(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Lf(o))}return t.join(" ")}function Lf(e){let t=e.trim(),n=IF.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,"-")}`:SS({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function TS(e,t){let n=0;for(let o of t){let r=Lf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function ih({row:e}){let t=Ft(vn).derive;if(nh(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?I(pe,{children:[u(TF,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(ih,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(kF,{row:e})}return u(SF,{row:e,text:e.message.text})}function sh({images:e}){let t=Ft(vn),{t:n}=Et();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=th(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 SF({row:e,text:t}){let{t:n}=Et(),o=Ft(vn),r=e.message.attachments??[],a=ah(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=oh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=qd(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=>Ya(v)==="image"),h=p.filter(v=>Ya(v)!=="image"),g=e.message.author??null;return I("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(wF,{author:g}),I("div",{className:"min-w-0 flex-1 space-y-2",children:[I("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")}),I(je,{children:[u(Xe,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:Qa(e.message.createdAt,o.timestampFormat)}),u(Qe,{children:Kr(e.message.createdAt,o.timestampFormat)})]}),I("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(PF,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(tl,{text:a.copyText,variant:"ghost"})]})]}),I("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(sh,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(dh,{attachment:v},v.id))}),s.map((v,x)=>u(MF,{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(EF,{context:v},`${v.header}:${v.body}`))}):null,u(OF,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function wF({author:e}){let t=e;return t!==null?u(eI,{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(Ur,{className:"size-4"})})}function kf({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 TF({parsed:e}){let{t}=Et();return I(kf,{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 LF={"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 kF({row:e}){let{t}=Et(),n=Ft(vn).derive,o=e.message.attachments??[],r=o.filter(l=>Ya(l)==="image"),a=o.filter(l=>Ya(l)!=="image"),i=l=>{let d=gS(l);if(d)return I(kf,{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 I(kf,{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?I(kf,{children:[u("p",{className:"font-medium text-foreground/80",children:t(LF[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=mS(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:I(pe,{children:[s.map((l,d)=>u(Ha,{children:l},d)),o.length>0?I("div",{className:"min-w-0 px-3 py-2",children:[u(sh,{images:r}),a.map(l=>u(dh,{attachment:l},l.id))]}):null]})}function PS(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&nh(e??""))return null;let r=ah(n??e??"").visibleText;for(;;){let s=oh(r);if(!s.annotation)break;r=s.promptText}let a=qd(r).promptText,i=rh(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var AS=34,ES=8,lh=AS+ES,MS=de(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=Et(),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:ES},"data-timeline-turn-header":"true","data-truncated":"false",children:I("div",{className:z("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:AS}},children:[u("span",{ref:n,className:z("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),I(je,{children:[u(Xe,{render:u(ne,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(md,{}):u(ln,{})}),u(Qe,{side:"bottom",children:s})]})]})})});function PF({messageId:e,onFork:t}){let{t:n}=Et(),o=n("fork.action");return I(je,{children:[u(Xe,{render:u(ne,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Cd,{className:"size-3"})}),u(Qe,{side:"top",children:o})]})}function RS({row:e}){let t=Ft(vn),{t:n}=Et(),[o,r]=ol(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(xf,{state:"idle",children:I("button",{type:"button",className:z(vf,"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(Ud,{status:null}),u(Hd,{children:u(_d,{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=>Ya(c)==="image"),l=i.filter(c=>Ya(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":"(empty response)");return u(pe,{children:I("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"?I("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(tl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(ch,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(Go,{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(sh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(dh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?I("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(AF,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&I(je,{children:[u(Xe,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:Qa(e.message.updatedAt,t.timestampFormat)}),u(Qe,{children:Kr(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function AF({row:e}){let n=Ft(vn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(tl,{text:n.text??"",variant:"ghost"}):null}var LS=de(function(t){let n=t.context.body.length>0?`${t.context.header}
3680
- ${t.context.body}`:t.context.header;return u(IS,{label:t.context.header,tooltipText:n})}),EF=de(function(t){let n=t.context.body?`${t.context.header}
3681
- ${t.context.body}`:t.context.header;return I(je,{children:[I(Xe,{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($r,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Qe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function dh(e){let{t}=Et(),n=Ya(e.attachment),o=hS(n),r=t("attachments.open",{name:e.attachment.name}),a=I(pe,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),I("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:pS(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 MF(e){let t=Ft(vn),{t:n}=Et();return I("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=th([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,I("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,I("div",{className:z("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?I("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u($i,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var RF=8,NF=600,_F=1.75,kS=`linear-gradient(to bottom, black calc(100% - ${_F}rem), transparent)`;function DF(e){return e.trim().length===0?!1:e.length>NF||e.split(`
3682
- `).length>RF}var OF=de(function(t){let[n,o]=K(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&DF(t.text),i=a&&!n;return I("div",{children:[r?u("div",{className:z("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:kS,maskImage:kS}:void 0,children:u(FF,{text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,a||t.footer?I("div",{className:z("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]})}),FF=de(function(t){let n=Ft(vn),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 I(Ha,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(Go,{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=rh(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(Go,{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(BF,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=TS(t.text,t.terminalContexts),i=wS(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Lf(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(LS,{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(LS,{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(Go,{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(Go,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function BF({comment:e}){let t=Ft(vn),n=e.fenceLanguage??"diff",o=yS(e);return I("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[I("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:hf(e.filePath,t.workspaceRoot)}),I("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(bS,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(Go,{text:xS(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(TI,{patch:o}):null]})}function zF({badge:e}){return I(pe,{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(fa,{providerId:e.providerId,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,I("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?I("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function ch({badge:e,createdAt:t}){let n=Ft(vn);return I("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(zF,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),I(je,{children:[u(Xe,{render:u("span",{className:"shrink-0 tabular-nums"}),children:Qa(t,n.timestampFormat)}),u(Qe,{children:Kr(t,n.timestampFormat)})]})]})}function NS({row:e}){let{t}=Et(),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 I("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"}),I("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.providerId?u(fa,{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 vn=Ot(null),DS=Ot(null),$F=u("div",{className:"h-3 sm:h-4"}),HF=u("div",{className:"h-10 sm:h-12"}),UF=Object.freeze([]);function KF({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 VF({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 qF=u("div",{className:"h-3 sm:h-4"}),WF=[],GF=new Set,jF=200,QF=1e4,XF=600,YF=()=>{},JF=[],OS=de(function({derive:t,activities:n=JF,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=UF,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=YF,timelineEntries:y,latestTurn:C,latestAssistantMessageId:w=null,runningTurnId:k,resolveModelBadge:T,pendingModelSelection:L,onOpenFileDiff:b,onForkFromUserMessage:S,onImageExpand:A,markdownCwd:E,resolvedTheme:B,timestampFormat:R,workspaceRoot:N,skills:H=WF,anchorMessageId:D,onAnchorReady:W,onRowsChange:xe,contentInsetEndAdjustment:ie,liveFollowEnabled:Q,awaitingUserDecision:Ye=!1,onIsAtEndChange:Oe,onManualNavigation:ke,onDisclosureNavigation:Be=ke,hideEmptyPlaceholder:Se=!1,topFadeEnabled:ce=!1,scrollerRef:Ne,loadEarlier:ge=null,revealMessageRequest:ee=null,onRevealMessageHandled:ye,usageByTurnId:ct,renderWorkGroup:ut,renderToolCallDetail:lt,loadScrollAnchor:ft,saveScrollAnchor:zt,disclosure:it,useVisibleThreadCompletion:Pe,export:Re,onSavePlanToWorkspace:Fe,paneActive:Ze,onTurnNavigatorChange:we}){let et=Wu(),ht=_(et);ht.current=et;let $t=it.usePersistedExpandedTurnIds(o),[dn,_t]=K(GF),Ht=$(()=>t.resolveExpandedTurnIds($t??[],dn),[dn,t,$t]),[Gt,Dt]=K(!1),oo=_(o);oo.current=o;let yn=_(Ht);yn.current=Ht;let kn=_(null),Dn=_(null),kt=_(null),Cn=_(ie),St=_(null),ro=U(O=>{if(St.current=O,typeof Ne=="function"){Ne(O);return}Ne.current=O},[Ne]);Me(()=>{cS({timeline:St.current,previousOverlayHeight:Cn.current,overlayHeight:ie,followingEnd:et&&Q&&!Gt&&D===null}),Cn.current=ie},[D,ie,Gt,Q,et]),V(()=>()=>{Dn.current?.stop()},[]);let cn=U(()=>{Dn.current?.stop(),Dn.current=null,kn.current=null,Dt(!1)},[]),F=U(O=>{Be(),kn.current=O,Dt(!0),Dn.current?.stop();let Z=St.current?.node??null;if(!Z)return;let ve=Array.from(Z.querySelectorAll("[data-timeline-row-id]")).find(Bn=>Bn.dataset.timelineRowId===O);if(!ve)return;let at=kt.current;Dn.current=jI({viewport:Z,row:ve,anchor:at&&ve.contains(at)?at:ve,scrollToOffset:Bn=>{Z.scrollTop=Bn}})},[Be]),J=_(Q);Me(()=>{Q&&!J.current&&cn(),J.current=Q},[Q,cn]);let ae=_(C);V(()=>{let O=ae.current;if(ae.current=C,!(!C||O?.turnId===void 0)){if(C.turnId===O.turnId){O.state==="running"&&C.state==="interrupted"&&_t(Z=>{let ve=new Set(Z);return ve.add(C.turnId),ve});return}_t(Z=>{if(!Z.has(O.turnId))return Z;let ve=new Set(Z);return ve.delete(O.turnId),ve})}},[C]);let oe=_(null);oe.current??=t.createRowsCache();let le=oe.current.deriveGroups,Je=$(()=>le({activities:n,timelineEntries:y,latestTurn:C,runningTurnId:k,expandedTurnIds:Ht,isWorking:i,activeTurnStartedAt:h,resolveModelBadge:T,pendingModelSelection:L}),[le,n,y,C,k,Ht,i,h,T,L]),Ve=u2(Je.rows,t),wt=$(()=>JI(Ve,Je.turnGroups),[Je.turnGroups,Ve]),vt=_(Ve);vt.current=Ve;let Yt=U(O=>{let Z=vt.current.find(ve=>ve.id===O||ve.kind==="work"&&ve.groupedEntries.some(at=>at.id===O)||ve.kind==="tool-group"&&ve.entries.some(at=>at.id===O));F(Z?.id??O)},[F]),jt=_(Ve);jt.current=Ve;let Ct=_(!0);Ct.current=Q&&D===null;let fe=_(null),dt=U(O=>{O.scrollLength<=0||(fe.current={threadKey:oo.current,anchor:uS({measurement:O,followingEnd:Ct.current})})},[]),rt=U(()=>{let O=fe.current;O&&zt(O.threadKey,O.anchor)},[zt]),Pt=eS(o),ze=_(Pt);ze.current=Pt;let{startIndex:bt,hasHiddenOlder:un}=ZI(wt.length,Pt.revealedCount),At=$(()=>wt.slice(bt),[bt,wt]),Qt=_(wt);Qt.current=wt;let nn=_(null),mn=U(()=>{if(!ht.current)return;let O=St.current?.node;O&&(nn.current={scrollHeight:O.scrollHeight,scrollTop:O.scrollTop,until:Date.now()+QF})},[]);Me(()=>{if(!et)return;let O=nn.current;if(!O)return;nn.current=null;let Z=St.current?.node;if(!Z||Date.now()>O.until)return;let ve=O.scrollTop+(Z.scrollHeight-O.scrollHeight);Z.scrollTop=ve},[et,bt,Ve.length]);let Pn=U(()=>{mn(),ze.current.revealOlder()},[mn]),ao=_(Pn);ao.current=Pn;let io=_(un);io.current=un;let Jt=_(null),te=_(void 0);if(te.current===void 0&&Ve.length>0){let O=ft(o);te.current=O!==null&&Ve.some(Z=>Z.id===O.rowId)?O:null}let Ge=te.current??null,xt=_(()=>{}),[tt,An]=K(!1),Zt=Ge!==null&&!tt,on=_(Zt);on.current=Zt;let rn=U(()=>{if(!ht.current||on.current)return;let O=St.current?.measure();O&&(dt(O),rt())},[dt,rt]),Co=_(0);V(()=>{let O=Ge;if(!et||tt||O===null)return;let Z=null,ve=requestAnimationFrame(()=>{ht.current&&(ke(),ze.current.revealAtLeast(Cf(Qt.current,O.rowId,ze.current.revealedCount)),Z=requestAnimationFrame(()=>{ht.current&&(An(!0),xt.current(O.rowId,-O.offsetPx))}))});return()=>{cancelAnimationFrame(ve),Z!==null&&cancelAnimationFrame(Z)}},[ke,et,Ge,tt]),Me(()=>()=>rn(),[rn]);let an=$(()=>ZF(wt,t),[wt,t]),Lo=$(()=>{let O=new Map;for(let Z of wt)for(let ve of Z.rows){let at=ve.kind==="message"?ve.message.turnId??null:ve.kind==="turn-summary"?ve.footer.turnId:null;if(at!==null){O.set(Z.key,at);break}}return an.filter(Z=>Z.userText!==null).map(Z=>({...Z,turnId:O.get(Z.sectionKey)??null}))},[an,wt]),na=U(O=>{cn(),ke(),ze.current.revealAtLeast(Cf(Qt.current,O.anchorRowId,ze.current.revealedCount)),requestAnimationFrame(()=>xt.current(O.anchorRowId,24))},[ke,cn]);V(()=>(we({items:Lo,totalTurnCount:g,bottomInset:ie,usageByTurnId:ct,onSelect:na,exportMarkdown:Re.markdown,onDownload:Re.download}),()=>we(null)),[ie,Re,na,we,g,Lo,ct]),V(()=>{if(ee===null||!et)return;cn(),ke();let O=t.resolveToolGroupRevealRowId(jt.current,ee.rowId);ze.current.revealAtLeast(Cf(Qt.current,O,ze.current.revealedCount));let Z=requestAnimationFrame(()=>{xt.current(O,24),ye?.()});return()=>cancelAnimationFrame(Z)},[ee,et,ke,cn,ye,t]);let bn=$(()=>an.flatMap(O=>O.headerText===null?[]:[{sectionKey:O.sectionKey,text:O.headerText}]),[an]),bi=_(bn);bi.current=bn;let Ee=_(null),Da=bn.at(-1)?.text??null,oa=Da!==null,Ar=_(null),so=_(null),[Ut,On]=K(!1),Xt=_(Ut);Xt.current=Ut;let Ii=U(()=>{if(!ht.current)return;let O=Ar.current,Z=so.current;!O||!Z||(O.dataset.truncated=Xt.current||Z.scrollWidth>Z.clientWidth+1?"true":"false")},[]),[en,Er]=K(null),Kt=$(()=>t.hasSettledAssistantMessage(y,w),[t,y,w]),[In,En]=K(null),he=U(()=>{mn(),ge?.onLoadEarlier()},[mn,ge]);Jt.current=ge===null||ge.loading?null:he;let Yn=U((O,Z)=>{if(!ht.current)return;let ve=St.current?.node;if(!ve)return;let at=Array.from(ve.querySelectorAll("[data-timeline-turn-section]")),Bn=at.findIndex(Dr=>Dr.querySelector(`[data-timeline-row-id="${CSS.escape(O)}"]`)),_r=Bn<0?at:at.slice(0,Bn+1);for(let Dr of _r)Dr.style.contentVisibility="visible";ve.offsetHeight,St.current?.scrollToRow(O,{viewOffset:Z}),requestAnimationFrame(()=>{for(let Dr of _r)Dr.style.removeProperty("content-visibility")})},[]);xt.current=Yn;let ko=$(()=>MI(Ve,D,O=>O.kind==="message"&&O.message.role==="user"?O.message.id:null),[D,Ve]),lo=et&&Q&&!Gt&&ko===void 0&&!Zt,ra=_(lo);ra.current=lo;let aa=_({followEnabled:lo,scrollRestorePending:Zt,loadEarlier:ge});aa.current={followEnabled:lo,scrollRestorePending:Zt,loadEarlier:ge};let or=_(null);V(()=>{if(!In||!et)return;let O=tS({root:In,minimumCount:Xa,canCompact:()=>{let Z=aa.current,ve=nn.current;return Z.followEnabled&&!Z.scrollRestorePending&&!Z.loadEarlier?.loading&&!(ve&&ve.until>Date.now())&&ze.current.revealedCount>Xa},onCompact:Z=>{Mr.current=!0,mn(),ze.current.compactTo(Z)}});return or.current=O,()=>{O.disconnect(),or.current=null}},[mn,et,In]),V(()=>{or.current?.schedule()},[lo,ge?.loading,Pt.revealedCount,wt.length]),V(()=>{if(!In||!et||typeof ResizeObserver>"u")return;let O=()=>{if(!ht.current||!ra.current)return;let at=In.scrollHeight-In.clientHeight;Math.abs(In.scrollTop-at)>.5&&(In.scrollTop=at)},Z=new ResizeObserver(O);Z.observe(In);let ve=In.firstElementChild;return ve&&Z.observe(ve),()=>Z.disconnect()},[et,In]),Pe({viewport:en,viewActive:Ze&&et,threadKey:o,completedAt:!Zt&&C?.state==="completed"&&Kt?C.completedAt:null,messageId:w,bottomInset:ie});let[Oo,Oa]=K(0),Fn=_(null);Me(()=>{if(!et)return;if(ko===void 0||D===null){Oa(0),Fn.current=null;return}let O=St.current?.node,Z=Ve[ko.anchorIndex],ve=St.current?.measure();if(!O||!Z||!ve||ve.scrollLength<=0)return;let at=ve.topOf(Z.id);if(at===null)return;let Bn=ve.contentLength-Oo-at,_r=Math.max(0,ve.scrollLength-ie-ko.anchorOffset),Dr=Math.max(0,Math.round(_r-Bn));if(Math.abs(Dr-Oo)>1){Oa(Dr);return}Fn.current!==D&&(Fn.current=D,W(D,{rowId:Z.id,lastRowId:Ve.at(-1)?.id??null}))},[D,ko,Oo,ie,W,et,Ve]);let rr=Ve.at(-1)?.id??null;V(()=>{xe?.(rr)},[rr,xe]);let Mr=_(!0),Si=U(O=>{if(O>XF){Mr.current=!0;return}if(Mr.current){if(Mr.current=!1,io.current){ao.current();return}Jt.current?.()}},[]),Po=U(()=>{if(!ht.current)return;let O=St.current?.measure();O&&!on.current&&dt(O);let Z=t.resolveIsAtEnd(O==null?void 0:{contentLength:O.contentLength,scroll:O.scroll,scrollLength:O.scrollLength},ie);if(Z!==void 0&&Oe(Z),!O)return;O.contentLength-O.scrollLength-O.scroll>2&&Si(O.scroll);let ve=Date.now();ve-Co.current>=jF&&(Co.current=ve,rt())},[dt,ie,t,Si,Oe,rt]),Fo=_(null),Rr=U(()=>{ht.current&&Fo.current===null&&(Fo.current=requestAnimationFrame(()=>{Fo.current=null,Ii()}))},[Ii]);V(()=>()=>{Fo.current!==null&&(cancelAnimationFrame(Fo.current),Fo.current=null)},[]);let wi=U(O=>{if(O===null||O===Ee.current)return;Ee.current=O;let Z=bi.current.find(ve=>ve.sectionKey===O);Z&&so.current&&(so.current.textContent=Z.text),Xt.current&&On(!1),Rr()},[Rr]),ar=oS({root:In,topInsetPx:lh,onActiveSectionChange:wi,active:et});V(()=>{if(!et){rt();return}let O=requestAnimationFrame(()=>{if(!ht.current)return;let Z=St.current?.node;Z&&ra.current&&(Z.scrollTop=Z.scrollHeight-Z.clientHeight),ar.refresh()});return()=>cancelAnimationFrame(O)},[rt,ar,et]);let ia=U(()=>{On(O=>!O)},[]);Me(()=>{if(!et)return;let O=Ee.current,Z=O===null?void 0:bi.current.find(ve=>ve.sectionKey===O);Z&&so.current&&(so.current.textContent=Z.text),Rr()},[et,Rr,Ut]);let Yl=$(()=>{let O=un?u(VF,{onReveal:Pn,fade:ce}):ge!==null?u(KF,{loading:ge.loading,onLoadEarlier:he,fade:ce}):ce?HF:$F;return oa?I(pe,{children:[u("div",{style:{height:lh}}),O]}):O},[he,un,oa,ge,Pn,ce]);V(()=>{if(!et)return;let O=requestAnimationFrame(Po);return()=>cancelAnimationFrame(O)},[Po,et,Ve.length,Zt]);let ir=$(()=>({timestampFormat:R,threadKey:o,threadRef:r,markdownCwd:E,resolvedTheme:B,workspaceRoot:N,skills:H,activeThreadEnvironmentId:a,onForkFromUserMessage:S,onImageExpand:A,onOpenFileDiff:b,onProcessDisclosureChange:Yt,agentPanelModel:v,onOpenAgents:x,onInterrupt:c,onRespondToDecision:f,scheduledWakes:p,onCancelScheduledWake:m,derive:t,renderWorkGroup:ut,renderToolCallDetail:lt,onSavePlanToWorkspace:Fe}),[R,o,r,E,B,N,H,a,S,A,b,Yt,v,x,c,f,p,m,t,ut,lt,Fe]),Ds=$(()=>({isWorking:i,latestTurnId:C?.turnId??null,workingStepLabel:s,stall:l,retry:d}),[i,C?.turnId,d,l,s]),Nr=U(O=>u(e2,{row:O}),[]);return Ve.length===0&&!i?Se?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(vn,{value:ir,children:u(DS,{value:Ds,children:I("div",{ref:Er,onClickCapture:O=>{kt.current=O.target instanceof Element?O.target.closest("button"):null},onWheelCapture:cn,onTouchMoveCapture:cn,onPointerDownCapture:O=>{O.target===St.current?.node&&cn()},onKeyDownCapture:O=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(O.key)&&cn()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":Ye?"true":"false","data-disclosure-reading":Gt?"true":void 0,"data-timeline-follow-end":lo?"true":"false","data-timeline-anchor-row":ko===void 0?void 0:Ve[ko.anchorIndex]?.id??void 0,"data-timeline-end-inset":ie,children:[u(XI,{handleRef:ro,onAttach:En,onScroll:Po,className:z("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",ce&&"topbar-scroll-fade"),children:I("div",{style:{paddingBottom:ie},children:[Yl,At.map(O=>u(YI,{sectionKey:O.key,rows:O.rows,renderRow:Nr,sectionRef:ar.observeSection(O.key)},O.key)),qF,ko?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:Oo}}):null]})}),Da!==null?u(MS,{ref:Ar,textRef:so,initialText:Da,expanded:Ut,onToggleExpanded:ia}):null]})})})});function ZF(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:_S(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:_S(a),headerText:r===null?null:PS(r.text,t)}})}function _S(e){let t=e?.replace(/\s+/g," ").trim()??"";return t.length>0?t:null}var e2=de(function({row:t}){let n=Ft(vn);return u("div",{className:z("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:I(If,{resetKey:t.id,fallback:fS,children:[t.kind==="turn-summary"?u(DI,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(GI,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(t2,{row:t}):null,t.kind==="model-switch"?u(NS,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u(ch,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(ih,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(RS,{row:t}):null,t.kind==="proposed-plan"?u(o2,{row:t}):null,t.kind==="turn-plan"?u(r2,{row:t}):null,t.kind==="working"?u(a2,{row:t}):null]})})});function t2({row:e}){let t=Ft(vn),n=Wu(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(pe,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(n2,{entry:r},r.id))})}function n2({entry:e}){let[t,n]=K(!1),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return I("div",{children:[I("button",{type:"button","aria-expanded":t,className:z("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:z("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:z("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 o2({row:e}){let t=Ft(vn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(dS,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var r2=de(function({row:t}){let[n,o]=K(!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 I("div",{className:"min-w-0 px-1 py-0.5",children:[I("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:Eo,{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:z("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:z("min-w-0 truncate",i?"text-muted-foreground/65":"font-medium text-foreground/85"),children:s}),r.length>1?I("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=>I("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:z("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:z("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 a2({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Ft(DS),{t:r}=Et();return I("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:I("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?Vd(r("activity.workingForLive"),u(c2,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?I("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(i2,{retry:o}):n&&!e.compacting?u(l2,{stall:n}):null]})}function i2({retry:e}){let{t}=Et(),n=Ft(vn);return I(zd,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(lf,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u($d,{children:u(ne,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var s2={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function l2({stall:e}){let{t}=Et(),{onInterrupt:n}=Ft(vn),o=t(s2[e.reason]);return I("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:Vd(t("stall.noOutputForLive"),u(d2,{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 FS(e,t){let n=Wu();V(()=>{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 d2({since:e}){let t=_(null);return FS(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:uh(e)})}function c2({createdAt:e}){let t=_(null);return FS(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:uh(e)})}function u2(e,t){let n=_({byId:new Map,result:[]}),o=_(t);return o.current=t,$(()=>{let r=new Map,a=e.map(i=>{let s=n.current.byId.get(i.id),l=s&&f2(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function f2(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 p2(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 p2(e,new Date().toISOString())??"0s"}ue();var BS=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var zS=50,m2=32;function g2(e){let t=[];for(let n=0;n<e.length;n+=zS)t.push(e.slice(n,n+zS));return t}function h2({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(`
3679
+ `):null,contexts:o}}function t0(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 Rh(e){let t=fc(e),n=u2(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var f2=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function n0(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Kf(o))}return t.join(" ")}function Kf(e){let t=e.trim(),n=f2.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,"-")}`:t0({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function o0(e,t){let n=0;for(let o of t){let r=Kf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function Nh({row:e}){let t=Kt(Tn).derive;if(Eh(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(xe,{children:[u(g2,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Nh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(v2,{row:e})}return u(p2,{row:e,text:e.message.text})}function _h({images:e}){let t=Kt(Tn),{t:n}=Nt();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=Ph(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 p2({row:e,text:t}){let{t:n}=Nt(),o=Kt(Tn),r=e.message.attachments??[],a=Rh(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Ah(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=fc(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=>mi(v)==="image"),h=p.filter(v=>mi(v)!=="image"),g=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(m2,{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:pi(e.message.createdAt,o.timestampFormat)}),u(Ye,{children:ea(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(x2,{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(_h,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(Oh,{attachment:v},v.id))}),s.map((v,x)=>u(b2,{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(C2,{context:v},`${v.header}:${v.body}`))}):null,u(L2,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function m2({author:e}){let t=e;return t!==null?u(EI,{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(Zr,{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 g2({parsed:e}){let{t}=Nt();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 h2={"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 v2({row:e}){let{t}=Nt(),n=Kt(Tn).derive,o=e.message.attachments??[],r=o.filter(l=>mi(l)==="image"),a=o.filter(l=>mi(l)!=="image"),i=l=>{let d=GS(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(h2[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=WS(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(xe,{children:[s.map((l,d)=>u(oi,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(_h,{images:r}),a.map(l=>u(Oh,{attachment:l},l.id))]}):null]})}function i0(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Eh(e??""))return null;let r=Rh(n??e??"").visibleText;for(;;){let s=Ah(r);if(!s.annotation)break;r=s.promptText}let a=fc(r).promptText,i=Mh(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var s0=34,l0=8,Dh=s0+l0,d0=ce(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=Nt(),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:l0},"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:s0}},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(oe,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Rd,{}):u(un,{})}),u(Ye,{side:"bottom",children:s})]})]})})});function x2({messageId:e,onFork:t}){let{t:n}=Nt(),o=n("fork.action");return b(Xe,{children:[u(Je,{render:u(oe,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Bd,{className:"size-3"})}),u(Ye,{side:"top",children:o})]})}function c0({row:e}){let t=Kt(Tn),{t:n}=Nt(),[o,r]=bl(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Of,{state:"idle",children:b("button",{type:"button",className:F(Df,"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(ic,{status:null}),u(ac,{children:u(Jd,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(un,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>mi(c)==="image"),l=i.filter(c=>mi(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":"(empty response)");return u(xe,{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(Fh,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(or,{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(_h,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(Oh,{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(y2,{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:pi(e.message.updatedAt,t.timestampFormat)}),u(Ye,{children:ea(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function y2({row:e}){let n=Kt(Tn).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 r0=ce(function(t){let n=t.context.body.length>0?`${t.context.header}
3680
+ ${t.context.body}`:t.context.header;return u(e0,{label:t.context.header,tooltipText:n})}),C2=ce(function(t){let n=t.context.body?`${t.context.header}
3681
+ ${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(Yr,{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 Oh(e){let{t}=Nt(),n=mi(e.attachment),o=jS(n),r=t("attachments.open",{name:e.attachment.name}),a=b(xe,{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:VS(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 b2(e){let t=Kt(Tn),{t:n}=Nt();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=Ph([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 I2=8,S2=600,w2=1.75,a0=`linear-gradient(to bottom, black calc(100% - ${w2}rem), transparent)`;function T2(e){return e.trim().length===0?!1:e.length>S2||e.split(`
3682
+ `).length>I2}var L2=ce(function(t){let[n,o]=G(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&T2(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:a0,maskImage:a0}:void 0,children:u(k2,{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(oe,{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]})}),k2=ce(function(t){let n=Kt(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(oi,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(or,{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=Mh(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(or,{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(P2,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=o0(t.text,t.terminalContexts),i=n0(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Kf(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(r0,{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(r0,{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(or,{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(or,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function P2({comment:e}){let t=Kt(Tn),n=e.fenceLanguage??"diff",o=YS(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:_f(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(ZS,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(or,{text:XS(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(eS,{patch:o}):null]})}function E2({badge:e}){return b(xe,{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(wa,{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 Fh({badge:e,createdAt:t}){let n=Kt(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(E2,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Xe,{children:[u(Je,{render:u("span",{className:"shrink-0 tabular-nums"}),children:pi(t,n.timestampFormat)}),u(Ye,{children:ea(t,n.timestampFormat)})]})]})}function u0({row:e}){let{t}=Nt(),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(wa,{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=Ut(null),p0=Ut(null),A2=u("div",{className:"h-3 sm:h-4"}),M2=u("div",{className:"h-10 sm:h-12"}),R2=Object.freeze([]);function N2({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 _2({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 D2=u("div",{className:"h-3 sm:h-4"}),O2=[],F2=new Set,B2=200,z2=1e4,$2=600,H2=()=>{};function rr(e,t){let n=_(e);return t&&(n.current=e),n.current}var U2=[],m0=ce(function({derive:t,activities:n=U2,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=R2,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=H2,timelineEntries:y,latestTurn:C,latestAssistantMessageId:w=null,runningTurnId:k,resolveModelBadge:S,pendingModelSelection:L,onOpenFileDiff:I,onForkFromUserMessage:T,onImageExpand:A,markdownCwd:E,resolvedTheme:N,timestampFormat:R,workspaceRoot:B,skills:z=O2,anchorMessageId:U,onAnchorReady:O,onRowsChange:ne,contentInsetEndAdjustment:ee,liveFollowEnabled:W,awaitingUserDecision:De=!1,onIsAtEndChange:Ce,onManualNavigation:ue,onDisclosureNavigation:Be=ue,hideEmptyPlaceholder:ge=!1,topFadeEnabled:le=!1,scrollerRef:Se,loadEarlier:ye=null,revealMessageRequest:te=null,onRevealMessageHandled:we,usageByTurnId:dt,renderWorkGroup:ct,renderToolCallDetail:lt,loadScrollAnchor:at,saveScrollAnchor:Vt,disclosure:it,useVisibleThreadCompletion:Ae,export:Oe,onSavePlanToWorkspace:Ue,paneActive:et,onTurnNavigatorChange:Me}){let Te=si(),ht=_(Te);ht.current=Te;let Wt=it.usePersistedExpandedTurnIds(o),[fn,Ft]=Ln("timeline-auto-expanded-turns",o,F2),en=H(()=>t.resolveExpandedTurnIds(Wt??[],fn),[fn,t,Wt]),[tn,Rt]=Ln("timeline-disclosure-reading",o,!1),Un=_(o);Un.current=o;let kn=_(en);kn.current=en;let pn=Rn("timeline-following-end",o,!0);pn.current=W&&U===null;let Pn=Rn("timeline-scroll-restore-pending",o,!1),Pt=cc(o,null),ln=cc(o,null),Dn=cc(o,null),io=Rn("timeline-content-inset",o,ee),Gt=_(null),D=$(K=>{if(K!==null&&(Gt.current=K),typeof Se=="function"){Se(K);return}Se.current=K},[Se]);he(()=>{US({timeline:Gt.current,previousOverlayHeight:io.current,overlayHeight:ee,followingEnd:Te&&W&&!tn&&U===null}),io.current=ee},[U,ee,tn,W,Te]),q(()=>()=>{ln.current?.stop()},[]);let X=$(()=>{ln.current?.stop(),ln.current=null,Pt.current=null,Rt(!1)},[Pt,ln,Rt]),se=$(K=>{Be(),Pt.current=K,Rt(!0),ln.current?.stop();let fe=Gt.current?.node??null;if(!fe)return;let Re=Array.from(fe.querySelectorAll("[data-timeline-row-id]")).find(yo=>yo.dataset.timelineRowId===K);if(!Re)return;let It=Dn.current;ln.current=IS({viewport:fe,row:Re,anchor:It&&Re.contains(It)?It:Re,scrollToOffset:yo=>{fe.scrollTop=yo}})},[Be]),re=Rn("timeline-live-follow-previous",o,W);he(()=>{W&&!re.current&&X(),re.current=W},[W,X]);let de=Rn("timeline-latest-turn-previous",o,C);q(()=>{let K=de.current;if(de.current=C,!(!C||K?.turnId===void 0)){if(C.turnId===K.turnId){K.state==="running"&&C.state==="interrupted"&&Ft(fe=>{let Re=new Set(fe);return Re.add(C.turnId),Re});return}Ft(fe=>{if(!fe.has(K.turnId))return fe;let Re=new Set(fe);return Re.delete(K.turnId),Re})}},[C]);let tt=Rn("timeline-rows-cache",o,null,3);tt.current??=t.createRowsCache();let vt=tt.current.deriveGroups,gn=rr(n,Te),xt=rr(y,Te),jt=rr(C,Te),nn=rr(k,Te),bt=rr(en,Te),me=rr(i,Te),ut=rr(h,Te),ft=rr(S,Te),Qt=rr(L,Te),Qe=rr(s,Te),wt=rr(l,Te),bn=rr(d,Te),Tt=H(()=>vt({activities:gn,timelineEntries:xt,latestTurn:jt,runningTurnId:nn,expandedTurnIds:bt,isWorking:me,activeTurnStartedAt:ut,resolveModelBadge:ft,pendingModelSelection:Qt}),[vt,gn,xt,jt,nn,bt,me,ut,ft,Qt]),nt=nB(Tt.rows,t),Lt=H(()=>kS(nt,Tt.turnGroups),[Tt.turnGroups,nt]),Jn=_(nt);Jn.current=nt;let Zn=$(K=>{let fe=Jn.current.find(Re=>Re.id===K||Re.kind==="work"&&Re.groupedEntries.some(It=>It.id===K)||Re.kind==="tool-group"&&Re.entries.some(It=>It.id===K));se(fe?.id??K)},[se]),vo=_(nt);vo.current=nt;let eo=Rn("timeline-scroll-snapshot",o,null),Xt=$((K,fe=pn.current)=>{K.scrollLength<=0||(eo.current={threadKey:o,anchor:KS({measurement:K,followingEnd:fe})})},[pn,o,eo]),Z=$(()=>{let K=eo.current;K&&Vt(K.threadKey,K.anchor)},[Vt,eo]),Ze=$(()=>{if(!Te||Pn.current)return;let K=Gt.current?.measure();K&&K.scrollLength>0&&(Xt(K,pn.current&&t.resolveIsAtEnd(K,ee)!==!1),Z())},[Xt,ee,t,pn,Te,Z,Pn]),yt=RS(o),We=_(yt);We.current=yt;let{startIndex:In,hasHiddenOlder:hn}=PS(Lt.length,yt.revealedCount),vn=H(()=>Lt.slice(In),[In,Lt]),Bt=_(Lt);Bt.current=Lt;let to=cc(o,null),on=$(()=>{if(!ht.current)return;let K=Gt.current?.node;K&&(to.current={scrollHeight:K.scrollHeight,scrollTop:K.scrollTop,until:Date.now()+z2})},[to]);he(()=>{if(!Te)return;let K=to.current;if(!K)return;to.current=null;let fe=Gt.current?.node;if(!fe||Date.now()>K.until)return;let Re=K.scrollTop+(fe.scrollHeight-K.scrollHeight);fe.scrollTop=Re},[Te,In,nt.length]);let xo=$(()=>{on(),We.current.revealOlder()},[on]),ua=_(xo);ua.current=xo;let On=_(hn);On.current=hn;let Js=_(null),_e=Rn("timeline-scroll-restore",o,void 0);if(_e.current===void 0&&nt.length>0){let K=at(o);_e.current=K!==null&&nt.some(fe=>fe.id===K.rowId)?K:null}let ja=_e.current??null,Go=_(()=>{}),[hr,Kr]=Ln("timeline-scroll-restore-settled",o,!1),dn=ja!==null&&!hr,Kn=Rn("timeline-last-anchor-save",o,0);q(()=>{let K=ja;if(!Te||hr||K===null)return;let fe=null,Re=requestAnimationFrame(()=>{ht.current&&(ue(),We.current.revealAtLeast(lc(Bt.current,K.rowId,We.current.revealedCount)),fe=requestAnimationFrame(()=>{ht.current&&(Kr(!0),Go.current(K.rowId,-K.offsetPx))}))});return()=>{cancelAnimationFrame(Re),fe!==null&&cancelAnimationFrame(fe)}},[ue,Te,ja,hr]);let zt=Rn("timeline-restore-after-presentation",o,!1),vr=dn||zt.current;Pn.current=vr,he(()=>{if(Te)return()=>{Un.current!==o?Z():Ze(),zt.current=!0}},[Te,o]),he(()=>{if(!Te||!zt.current)return;let K=null,fe=null,Re=()=>{Gt.current?.scrollToEnd(),zt.current=!1,Pn.current=!1,pn.current=!0,Ya.current=!0,Mo.current={...Mo.current,followEnabled:!0,restoreInProgress:!1},Ce(!0)},It=at(o),yo=It!==null&&Bt.current.some(Vr=>Vr.rows.some(Co=>Co.id===It.rowId));return It===null?K=requestAnimationFrame(Re):yo?(ue(),We.current.revealAtLeast(lc(Bt.current,It.rowId,We.current.revealedCount)),K=requestAnimationFrame(()=>{fe=requestAnimationFrame(()=>{ht.current&&(Go.current(It.rowId,-It.offsetPx),zt.current=!1,Pn.current=!1)})})):nt.length>0&&(K=requestAnimationFrame(Re)),()=>{K!==null&&cancelAnimationFrame(K),fe!==null&&cancelAnimationFrame(fe)}},[at,Ce,ue,Te,o,nt.length,Lt.length]);let $t=H(()=>Te?K2(Lt,t):[],[t,Te,Lt]),xr=H(()=>{if(!Te)return[];let K=new Map;for(let fe of Lt)for(let Re of fe.rows){let It=Re.kind==="message"?Re.message.turnId??null:Re.kind==="turn-summary"?Re.footer.turnId:null;if(It!==null){K.set(fe.key,It);break}}return $t.filter(fe=>fe.userText!==null).map(fe=>({...fe,turnId:K.get(fe.sectionKey)??null}))},[Te,$t,Lt]),Ht=$(K=>{X(),ue(),We.current.revealAtLeast(lc(Bt.current,K.anchorRowId,We.current.revealedCount));let fe=o;requestAnimationFrame(()=>{Un.current===fe&&Go.current(K.anchorRowId,24)})},[ue,X,o]),yr=H(()=>Te?{items:xr,totalTurnCount:g,bottomInset:ee,usageByTurnId:dt,onSelect:Ht,exportMarkdown:Oe.markdown,onDownload:Oe.download}:null,[ee,Oe,Ht,Te,g,xr,dt]);q(()=>{if(yr!==null)return Me(yr),()=>Me(null)},[Me,yr]),q(()=>{if(te===null||!Te)return;X(),ue();let K=t.resolveToolGroupRevealRowId(vo.current,te.rowId);We.current.revealAtLeast(lc(Bt.current,K,We.current.revealedCount));let fe=requestAnimationFrame(()=>{Un.current===o&&(Go.current(K,24),we?.())});return()=>cancelAnimationFrame(fe)},[te,Te,ue,X,we,t,o]);let Sn=H(()=>$t.flatMap(K=>K.headerText===null?[]:[{sectionKey:K.sectionKey,text:K.headerText}]),[$t]),be=_(Sn);be.current=Sn;let Fn=Rn("timeline-active-header",o,null),Qa=Sn.at(-1)?.text??null,Cr=Qa!==null,Xa=_(null),Bo=_(null),[jo,Qo]=Ln("timeline-pinned-header-expanded",o,!1),fa=_(jo);fa.current=jo;let no=$(()=>{if(!ht.current)return;let K=Xa.current,fe=Bo.current;!K||!fe||(K.dataset.truncated=fa.current||fe.scrollWidth>fe.clientWidth+1?"true":"false")},[]),[qr,Bi]=G(null),Zs=H(()=>t.hasSettledAssistantMessage(y,w),[t,y,w]),[xn,zi]=G(null),pa=$(()=>{on(),ye?.onLoadEarlier()},[on,ye]);Js.current=ye===null||ye.loading?null:pa;let $i=$((K,fe)=>{if(!ht.current)return;let Re=Gt.current?.node;if(!Re)return;let It=Array.from(Re.querySelectorAll("[data-timeline-turn-section]")),yo=It.findIndex(Co=>Co.querySelector(`[data-timeline-row-id="${CSS.escape(K)}"]`)),Vr=yo<0?It:It.slice(0,yo+1);for(let Co of Vr)Co.style.contentVisibility="visible";Re.offsetHeight,Gt.current?.scrollToRow(K,{viewOffset:fe}),requestAnimationFrame(()=>{for(let Co of Vr)Co.style.removeProperty("content-visibility")})},[]);Go.current=$i;let so=H(()=>aS(nt,U,K=>K.kind==="message"&&K.message.role==="user"?K.message.id:null),[U,nt]),Ao=Te&&W&&!tn&&so===void 0&&!vr,Ya=_(Ao);Ya.current=Ao;let Mo=_({followEnabled:Ao,restoreInProgress:vr,loadEarlier:ye});Mo.current={followEnabled:Ao,restoreInProgress:vr,loadEarlier:ye};let Ja=_(null);q(()=>{if(!xn||!Te)return;let K=NS({root:xn,minimumCount:ds,canCompact:()=>{let fe=Mo.current,Re=to.current;return fe.followEnabled&&!fe.restoreInProgress&&!fe.loadEarlier?.loading&&!(Re&&Re.until>Date.now())&&We.current.revealedCount>ds},onCompact:fe=>{rn.current=!0,on(),We.current.compactTo(fe)}});return Ja.current=K,()=>{K.disconnect(),Ja.current=null}},[on,Te,xn]),q(()=>{Ja.current?.schedule()},[Ao,ye?.loading,yt.revealedCount,Lt.length]),q(()=>{if(!xn||!Te||typeof ResizeObserver>"u")return;let K=()=>{if(!ht.current||!Ya.current)return;let It=xn.scrollHeight-xn.clientHeight;Math.abs(xn.scrollTop-It)>.5&&(xn.scrollTop=It)},fe=new ResizeObserver(K);fe.observe(xn);let Re=xn.firstElementChild;return Re&&fe.observe(Re),()=>fe.disconnect()},[Te,xn]),Ae({viewport:qr,viewActive:et&&Te,threadKey:o,completedAt:!vr&&C?.state==="completed"&&Zs?C.completedAt:null,messageId:w,bottomInset:ee});let[zo,He]=Ln("timeline-anchored-end-height",o,0),pt=Rn("timeline-anchored-ready",o,null);he(()=>{if(!Te)return;if(so===void 0||U===null){He(0),pt.current=null;return}let K=Gt.current?.node,fe=nt[so.anchorIndex],Re=Gt.current?.measure();if(!K||!fe||!Re||Re.scrollLength<=0)return;let It=Re.topOf(fe.id);if(It===null)return;let yo=Re.contentLength-zo-It,Vr=Math.max(0,Re.scrollLength-ee-so.anchorOffset),Co=Math.max(0,Math.round(Vr-yo));if(Math.abs(Co-zo)>1){He(Co);return}pt.current!==U&&(pt.current=U,O(U,{rowId:fe.id,lastRowId:nt.at(-1)?.id??null}))},[U,so,zo,ee,O,Te,nt]);let yn=nt.at(-1)?.id??null;q(()=>{ne?.(yn)},[yn,ne,o]);let rn=Rn("timeline-top-reveal-armed",o,!0),Xo=$(K=>{if(K>$2){rn.current=!0;return}if(rn.current){if(rn.current=!1,On.current){ua.current();return}Js.current?.()}},[rn]),ma=$(()=>{if(!ht.current||Un.current!==o)return;let K=Gt.current?.measure();if(!K||Pn.current)return;Xt(K);let fe=t.resolveIsAtEnd({contentLength:K.contentLength,scroll:K.scroll,scrollLength:K.scrollLength},ee);fe!==void 0&&Ce(fe),K.contentLength-K.scrollLength-K.scroll>2&&Xo(K.scroll);let Re=Date.now();Re-Kn.current>=B2&&(Kn.current=Re,Z())},[Xt,ee,t,Xo,Ce,Z,o,Pn]),Za=_(null),an=$(()=>{ht.current&&Za.current===null&&(Za.current=requestAnimationFrame(()=>{Za.current=null,no()}))},[no]);q(()=>()=>{Za.current!==null&&(cancelAnimationFrame(Za.current),Za.current=null)},[o]);let _g=$(K=>{if(K===null||K===Fn.current)return;Fn.current=K;let fe=be.current.find(Re=>Re.sectionKey===K);fe&&Bo.current&&(Bo.current.textContent=fe.text),fa.current&&Qo(!1),an()},[Fn,an,Qo]),ei=DS({root:xn,topInsetPx:Dh,onActiveSectionChange:_g,active:Te});q(()=>{if(!Te){Z();return}let K=requestAnimationFrame(()=>{if(!ht.current)return;let fe=Gt.current?.node;fe&&Ya.current&&(fe.scrollTop=fe.scrollHeight-fe.clientHeight),ei.refresh()});return()=>cancelAnimationFrame(K)},[Z,ei,Te]);let $u=$(()=>{Qo(K=>!K)},[Qo]);he(()=>{if(!Te)return;let K=Fn.current,fe=K===null?void 0:be.current.find(Re=>Re.sectionKey===K);fe&&Bo.current&&(Bo.current.textContent=fe.text),an()},[Te,an,jo]);let Dg=H(()=>{let K=hn?u(_2,{onReveal:xo,fade:le}):ye!==null?u(N2,{loading:ye.loading,onLoadEarlier:pa,fade:le}):le?M2:A2;return Cr?b(xe,{children:[u("div",{style:{height:Dh}}),K]}):K},[pa,hn,Cr,ye,xo,le]);q(()=>{if(!Te)return;let K=requestAnimationFrame(ma);return()=>cancelAnimationFrame(K)},[ma,Te,vr,nt.length]);let ga=H(()=>({timestampFormat:R,threadKey:o,threadRef:r,markdownCwd:E,resolvedTheme:N,workspaceRoot:B,skills:z,activeThreadEnvironmentId:a,onForkFromUserMessage:T,onImageExpand:A,onOpenFileDiff:I,onProcessDisclosureChange:Zn,agentPanelModel:v,onOpenAgents:x,onInterrupt:c,onRespondToDecision:f,scheduledWakes:p,onCancelScheduledWake:m,derive:t,renderWorkGroup:ct,renderToolCallDetail:lt,onSavePlanToWorkspace:Ue}),[R,o,r,E,N,B,z,a,T,A,I,Zn,v,x,c,f,p,m,t,ct,lt,Ue]),Ro=H(()=>({isWorking:me,latestTurnId:jt?.turnId??null,workingStepLabel:Qe,stall:wt,retry:bn}),[me,jt?.turnId,bn,wt,Qe]),lo=$(K=>u(V2,{row:K}),[]);return nt.length===0&&!i?ge?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:ga,children:u(p0,{value:Ro,children:b("div",{ref:Bi,onClickCapture:K=>{Dn.current=K.target instanceof Element?K.target.closest("button"):null},onWheelCapture:X,onTouchMoveCapture:X,onPointerDownCapture:K=>{K.target===Gt.current?.node&&X()},onKeyDownCapture:K=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(K.key)&&X()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":De?"true":"false","data-disclosure-reading":tn?"true":void 0,"data-timeline-follow-end":Ao?"true":"false","data-timeline-anchor-row":so===void 0?void 0:nt[so.anchorIndex]?.id??void 0,"data-timeline-end-inset":ee,children:[u(TS,{inputKey:o,onBeforeInputChange:Ze,handleRef:D,onAttach:zi,onScroll:ma,className:F("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",le&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:ee},children:[Dg,vn.map(K=>u(LS,{sectionKey:K.key,rowKeyPrefix:o,rows:K.rows,renderRow:lo,sectionRef:ei.observeSection(K.key)},`${o}:${K.key}`)),D2,so?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:zo}}):null]})}),Qa!==null?u(d0,{ref:Xa,textRef:Bo,initialText:Qa,expanded:jo,onToggleExpanded:$u}):null]})})})});function K2(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:f0(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:f0(a),headerText:r===null?null:i0(r.text,t)}})}var Bh=240,q2=/\s/u;function f0(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Bh-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(q2.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Bh)||(t.push(a),n+=a.length,n>Bh))return r()}return t.length>0?t.join(""):null}var V2=ce(function({row:t}){let n=Kt(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(zf,{resetKey:t.id,fallback:qS,children:[t.kind==="turn-summary"?u(dS,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(bS,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(W2,{row:t}):null,t.kind==="model-switch"?u(u0,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u(Fh,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(Nh,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(c0,{row:t}):null,t.kind==="proposed-plan"?u(j2,{row:t}):null,t.kind==="turn-plan"?u(Q2,{row:t}):null,t.kind==="working"?u(X2,{row:t}):null]})})});function W2({row:e}){let t=Kt(Tn),n=si(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(xe,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(G2,{entry:r},r.id))})}function G2({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(un,{"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 j2({row:e}){let t=Kt(Tn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(HS,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var Q2=ce(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?un: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 X2({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Kt(p0),{t:r}=Nt();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?uc(r("activity.workingForLive"),u(tB,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(Y2,{retry:o}):n&&!e.compacting?u(Z2,{stall:n}):null]})}function Y2({retry:e}){let{t}=Nt(),n=Kt(Tn);return b(oc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Lf,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(rc,{children:u(oe,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var J2={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function Z2({stall:e}){let{t}=Nt(),{onInterrupt:n}=Kt(Tn),o=t(J2[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:uc(t("stall.noOutputForLive"),u(eB,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(oe,{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 g0(e,t){let n=si();q(()=>{let o=()=>{t.current&&(t.current.textContent=zh(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 eB({since:e}){let t=_(null);return g0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:zh(e)})}function tB({createdAt:e}){let t=_(null);return g0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:zh(e)})}function nB(e,t){let n=_({byId:new Map,result:[]}),o=_(t);return o.current=t,H(()=>{let r=new Map,a=e.map(i=>{let s=n.current.byId.get(i.id),l=s&&oB(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function oB(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 rB(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 zh(e){return rB(e,new Date().toISOString())??"0s"}pe();var h0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var v0=50,aB=32;function iB(e){let t=[];for(let n=0;n<e.length;n+=v0)t.push(e.slice(n,n+v0));return t}function sB({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(`
3683
3683
 
3684
3684
  `):[r,...s].filter(Boolean).join(`
3685
3685
 
3686
- `);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 $S=de(function({rows:t,loadEarlier:n,timestampFormat:o,paneVisible:r,useToolCallDetail:a,threadRef:i,resolveChatAnchorMessageId:s,onOpenInChat:l}){let{t:d}=Jn(),[c,f]=K("all"),[p,m]=K(()=>new Set),[h,g]=K(!0),v=$(()=>{let b=new Set(t.map(S=>S.kind));return BS.filter(S=>b.has(S))},[t]),x=$(()=>c==="all"?t:t.filter(b=>b.kind===c),[t,c]),y=$(()=>g2(x),[x]),C=b=>m(S=>{let A=new Set(S);return A.has(b)?A.delete(b):A.add(b),A}),w=_(null),k=_(!0),T=()=>{if(!r)return;let b=w.current;b&&(k.current=b.scrollHeight-b.scrollTop-b.clientHeight<=m2)},L=b=>{b&&(k.current=!0),g(b)};return Me(()=>{if(!r||!h||!k.current)return;let b=w.current;b&&(b.scrollTop=b.scrollHeight)},[r,h,t,x]),I("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[I("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[I("div",{role:"group","aria-label":d("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ne,{size:"xs",variant:c==="all"?"secondary":"ghost","aria-pressed":c==="all",onClick:()=>f("all"),children:d("trajectory.filterAll")}),v.map(b=>u(ne,{size:"xs",variant:c===b?"secondary":"ghost","aria-pressed":c===b,onClick:()=>f(b),children:d(`trajectory.kinds.${b}`)},b))]}),u(Fd,{className:"ml-auto",size:"xs",variant:"outline",pressed:h,onPressedChange:L,"aria-label":d("trajectory.followLatest"),children:d("trajectory.followLatest")})]}),I("div",{ref:w,className:"min-h-0 flex-1 overflow-auto",onScroll:T,"data-trajectory-scroll":!0,children:[n!==null?I("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:d("trajectory.loadEarlier")}),u(ne,{size:"xs",variant:"outline",disabled:n.loading,onClick:n.onLoadEarlier,children:n.loading?d("trajectory.loadingEarlier"):d("trajectory.loadEarlierAction")})]}):null,x.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:d("trajectory.empty")}):I(fI,{children:[u(mI,{className:"sticky top-0 z-10 bg-background",children:I(sf,{className:"hover:bg-transparent",children:[u(Wi,{className:"w-px whitespace-nowrap",children:d("trajectory.columnTime")}),u(Wi,{className:"w-px whitespace-nowrap",children:d("trajectory.columnType")}),u(Wi,{children:d("trajectory.columnSummary")}),u(Wi,{className:"w-px whitespace-nowrap",children:d("trajectory.columnStatus")}),u(Wi,{className:"w-px whitespace-nowrap",children:d("trajectory.columnDuration")}),u(Wi,{className:"w-px",children:u("span",{className:"sr-only",children:d("trajectory.openInChat")})})]})}),y.map((b,S)=>u(pI,{className:"trajectory-chunk [&_tr:last-child]:border-b",children:b.map(A=>{let E=p.has(A.id),B=A.detail!==void 0||A.toolCallId!==void 0,R=s(A);return[I(sf,{"data-trajectory-row-id":A.id,className:z(B&&"cursor-pointer"),onClick:B?()=>C(A.id):void 0,children:[u(ja,{className:"whitespace-nowrap text-muted-foreground",title:Kr(A.createdAt,o),children:Qa(A.createdAt,o)}),u(ja,{className:"whitespace-nowrap",children:d(`trajectory.kinds.${A.kind}`)}),u(ja,{className:"max-w-0 whitespace-normal",children:I("span",{className:"inline-flex items-start gap-1",children:[B?u(ne,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":d(E?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":E,onClick:N=>{N.stopPropagation(),C(A.id)},children:E?u(ln,{"aria-hidden":!0}):u(Eo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:A.summary})]})}),u(ja,{className:"whitespace-nowrap",children:d(`trajectory.status.${A.status}`)}),u(ja,{className:"whitespace-nowrap text-muted-foreground",children:A.durationMs!==void 0?Gi(A.durationMs):d("trajectory.valueUnknown")}),u(ja,{className:"whitespace-nowrap",children:R!==null?I(je,{children:[u(Xe,{render:u(ne,{size:"xs",variant:"ghost","aria-label":d("trajectory.openInChat"),onClick:N=>{N.stopPropagation(),l(R)}}),children:u(zi,{"aria-hidden":!0})}),u(Qe,{side:"top",children:d("trajectory.openInChat")})]}):null})]},A.id),E&&B?u(sf,{className:"hover:bg-transparent","data-trajectory-detail-row":A.id,children:I(ja,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:d("trajectory.detailTitle")}),A.kind==="tool-call"&&A.toolCallId!==void 0?u(h2,{threadRef:i,useToolCallDetail:a,toolCallId:A.toolCallId,turnId:A.turnId,fallback:A.detail,revision:`${A.status}:${A.updatedActivityId??A.activityId??A.id}`}):A.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:A.detail}):null]})},`${A.id}:detail`):null]})},b[0]?.id??S))]})]})]})});ue();var Zi=ad(Gd());ue();function WS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return $(()=>o=>{t.forEach(r=>r(o))},t)}var jd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ji(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Af(e){return"nodeType"in e}function ho(e){var t,n;return e?ji(e)?e:Af(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Ef(e){let{Document:t}=ho(e);return e instanceof t}function il(e){return ji(e)?!1:e instanceof ho(e).HTMLElement}function ph(e){return e instanceof ho(e).SVGElement}function Qi(e){return e?ji(e)?e.document:Af(e)?Ef(e)?e:il(e)||ph(e)?e.ownerDocument:document:document:document}var jo=jd?Me:V;function Mf(e){let t=_(e);return jo(()=>{t.current=e}),U(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 GS(){let e=_(null),t=U((o,r)=>{e.current=setInterval(o,r)},[]),n=U(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function sl(e,t){t===void 0&&(t=[e]);let n=_(e);return jo(()=>{n.current!==e&&(n.current=e)},t),n}function ll(e,t){let n=_();return $(()=>{let o=e(n.current);return n.current=o,o},[...t])}function Qd(e){let t=Mf(e),n=_(null),o=U(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Rf(e){let t=_();return V(()=>{t.current=e},[e]),t.current}var fh={};function Xi(e,t){return $(()=>{if(t)return t;let n=fh[e]==null?0:fh[e]+1;return fh[e]=n,e+"-"+n},[e,t])}function jS(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 Yi=jS(1),Ji=jS(-1);function C2(e){return"clientX"in e&&"clientY"in e}function Xd(e){if(!e)return!1;let{KeyboardEvent:t}=ho(e.target);return t&&e instanceof t}function b2(e){if(!e)return!1;let{TouchEvent:t}=ho(e.target);return t&&e instanceof t}function Yd(e){if(b2(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 C2(e)?{x:e.clientX,y:e.clientY}:null}var Za=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[Za.Translate.toString(e),Za.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),qS="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function QS(e){return e.matches(qS)?e:e.querySelector(qS)}ue();var I2={display:"none"};function XS(e){let{id:t,value:n}=e;return fn.createElement("div",{id:t,style:I2},n)}function YS(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 fn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function JS(){let[e,t]=K("");return{announce:U(o=>{o!=null&&t(o)},[]),announcement:e}}var u0=Ot(null);function S2(e){let t=sn(u0);V(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function w2(){let[e]=K(()=>new Set),t=U(o=>(e.add(o),()=>e.delete(o)),[e]);return[U(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 T2={draggable:`
3686
+ `);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 x0=ce(function({inputKey:t,rows:n,loadEarlier:o,timestampFormat:r,paneVisible:a,useToolCallDetail:i,threadRef:s,resolveChatAnchorMessageId:l,onOpenInChat:d}){let{t:c}=uo(),[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=H(()=>{let A=new Set(n.map(E=>E.kind));return h0.filter(E=>A.has(E))},[n]),y=H(()=>f==="all"?n:n.filter(A=>A.kind===f),[n,f]),C=H(()=>iB(y),[y]),w=A=>h(E=>{let N=new Set(E);return N.has(A)?N.delete(A):N.add(A),N}),k=_(null),S=Rn("trajectory-at-end",t,!0),L=Rn("trajectory-scroll-top",t,0),I=()=>{if(!a)return;let A=k.current;A&&(L.current=A.scrollTop,S.current=A.scrollHeight-A.scrollTop-A.clientHeight<=aB)},T=A=>{A&&(S.current=!0),v(A)};return he(()=>{if(!a)return;let A=k.current;if(A)return(!g||!S.current)&&(A.scrollTop=L.current),()=>{L.current=A.scrollTop}},[S,g,t,a,L]),he(()=>{if(!a||!g||!S.current)return;let A=k.current;A&&(A.scrollTop=A.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(oe,{size:"xs",variant:f==="all"?"secondary":"ghost","aria-pressed":f==="all",onClick:()=>p("all"),children:c("trajectory.filterAll")}),x.map(A=>u(oe,{size:"xs",variant:f===A?"secondary":"ghost","aria-pressed":f===A,onClick:()=>p(A),children:c(`trajectory.kinds.${A}`)},A))]}),u(tc,{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(oe,{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(HI,{children:[u(KI,{className:"sticky top-0 z-10 bg-background",children:b(Tf,{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((A,E)=>u(UI,{className:"trajectory-chunk [&_tr:last-child]:border-b",children:A.map(N=>{let R=m.has(N.id),B=N.detail!==void 0||N.toolCallId!==void 0,z=l(N);return[b(Tf,{"data-trajectory-row-id":N.id,className:F(B&&"cursor-pointer"),onClick:B?()=>w(N.id):void 0,children:[u(fi,{className:"whitespace-nowrap text-muted-foreground",title:ea(N.createdAt,r),children:pi(N.createdAt,r)}),u(fi,{className:"whitespace-nowrap",children:c(`trajectory.kinds.${N.kind}`)}),u(fi,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[B?u(oe,{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:U=>{U.stopPropagation(),w(N.id)},children:R?u(un,{"aria-hidden":!0}):u(Uo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:N.summary})]})}),u(fi,{className:"whitespace-nowrap",children:c(`trajectory.status.${N.status}`)}),u(fi,{className:"whitespace-nowrap text-muted-foreground",children:N.durationMs!==void 0?ls(N.durationMs):c("trajectory.valueUnknown")}),u(fi,{className:"whitespace-nowrap",children:z!==null?b(Xe,{children:[u(Je,{render:u(oe,{size:"xs",variant:"ghost","aria-label":c("trajectory.openInChat"),onClick:U=>{U.stopPropagation(),d(z)}}),children:u(es,{"aria-hidden":!0})}),u(Ye,{side:"top",children:c("trajectory.openInChat")})]}):null})]},`${t}:${N.id}`),R&&B?u(Tf,{className:"hover:bg-transparent","data-trajectory-detail-row":N.id,children:b(fi,{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(sB,{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}:${A[0]?.id??E}`))]})]})]})});pe();var gs=Td(mc());pe();function w0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return H(()=>o=>{t.forEach(r=>r(o))},t)}var gc=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 Wf(e){return"nodeType"in e}function Lo(e){var t,n;return e?cs(e)?e:Wf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Gf(e){let{Document:t}=Lo(e);return e instanceof t}function wl(e){return cs(e)?!1:e instanceof Lo(e).HTMLElement}function Hh(e){return e instanceof Lo(e).SVGElement}function us(e){return e?cs(e)?e.document:Wf(e)?Gf(e)?e:wl(e)||Hh(e)?e.ownerDocument:document:document:document}var ar=gc?he:q;function jf(e){let t=_(e);return ar(()=>{t.current=e}),$(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 T0(){let e=_(null),t=$((o,r)=>{e.current=setInterval(o,r)},[]),n=$(()=>{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 ar(()=>{n.current!==e&&(n.current=e)},t),n}function Ll(e,t){let n=_();return H(()=>{let o=e(n.current);return n.current=o,o},[...t])}function hc(e){let t=jf(e),n=_(null),o=$(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Qf(e){let t=_();return q(()=>{t.current=e},[e]),t.current}var $h={};function fs(e,t){return H(()=>{if(t)return t;let n=$h[e]==null?0:$h[e]+1;return $h[e]=n,e+"-"+n},[e,t])}function L0(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=L0(1),ms=L0(-1);function uB(e){return"clientX"in e&&"clientY"in e}function vc(e){if(!e)return!1;let{KeyboardEvent:t}=Lo(e.target);return t&&e instanceof t}function fB(e){if(!e)return!1;let{TouchEvent:t}=Lo(e.target);return t&&e instanceof t}function xc(e){if(fB(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 uB(e)?{x:e.clientX,y:e.clientY}:null}var hi=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[hi.Translate.toString(e),hi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),S0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function k0(e){return e.matches(S0)?e:e.querySelector(S0)}pe();var pB={display:"none"};function P0(e){let{id:t,value:n}=e;return mn.createElement("div",{id:t,style:pB},n)}function E0(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 mn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function A0(){let[e,t]=G("");return{announce:$(o=>{o!=null&&t(o)},[]),announcement:e}}var K0=Ut(null);function mB(e){let t=cn(K0);q(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function gB(){let[e]=G(()=>new Set),t=$(o=>(e.add(o),()=>e.delete(o)),[e]);return[$(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 hB={draggable:`
3687
3687
  To pick up a draggable item, press the space bar.
3688
3688
  While dragging, use the arrow keys to move the item.
3689
3689
  Press space again to drop the item in its new position, or press escape to cancel.
3690
- `},L2={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 k2(e){let{announcements:t=L2,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=T2}=e,{announce:a,announcement:i}=JS(),s=Xi("DndLiveRegion"),[l,d]=K(!1);if(V(()=>{d(!0)},[]),S2($(()=>({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=fn.createElement(fn.Fragment,null,fn.createElement(XS,{id:o,value:r.draggable}),fn.createElement(YS,{id:s,announcement:i}));return n?(0,Zi.createPortal)(c,n):c}var Rn;(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"})(Rn||(Rn={}));function _f(){}function Ih(e,t){return $(()=>({sensor:e,options:t??{}}),[e,t])}function f0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return $(()=>[...t].filter(o=>o!=null),[...t])}var cr=Object.freeze({x:0,y:0});function p0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function m0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function P2(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function ZS(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 Sh(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function e0(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 g0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=e0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=p0(e0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(m0)},h0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=ZS(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=ZS(l),c=r.reduce((p,m,h)=>p+p0(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(m0)};function A2(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 E2=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=A2(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(P2)};function M2(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function v0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cr}function R2(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 N2=R2(1);function _2(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 D2(e,t,n){let o=_2(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 O2={ignoreTransform:!1};function ns(e,t){t===void 0&&(t=O2);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=ho(e).getComputedStyle(e);d&&(n=D2(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 t0(e){return ns(e,{ignoreTransform:!0})}function F2(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function B2(e,t){return t===void 0&&(t=ho(e).getComputedStyle(e)),t.position==="fixed"}function z2(e,t){t===void 0&&(t=ho(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 nc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(Ef(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!il(r)||ph(r)||n.includes(r))return n;let a=ho(e).getComputedStyle(r);return r!==e&&z2(r,a)&&n.push(r),B2(r,a)?n:o(r.parentNode)}return e?o(e):n}function x0(e){let[t]=nc(e,1);return t??null}function mh(e){return!jd||!e?null:ji(e)?e:Af(e)?Ef(e)||e===Qi(e).scrollingElement?window:il(e)?e:null:null}function y0(e){return ji(e)?e.scrollX:e.scrollLeft}function C0(e){return ji(e)?e.scrollY:e.scrollTop}function vh(e){return{x:y0(e),y:C0(e)}}var $n;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($n||($n={}));function b0(e){return!jd||!e?!1:e===document.scrollingElement}function I0(e){let t={x:0,y:0},n=b0(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 $2={x:.2,y:.2};function H2(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=$2);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=I0(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=$n.Backward,h.y=o*Math.abs((t.top+g.height-a)/g.height)):!c&&l>=t.bottom-g.height&&(m.y=$n.Forward,h.y=o*Math.abs((t.bottom-g.height-l)/g.height)),!p&&s>=t.right-g.width?(m.x=$n.Forward,h.x=o*Math.abs((t.right-g.width-s)/g.width)):!f&&i<=t.left+g.width&&(m.x=$n.Backward,h.x=o*Math.abs((t.left+g.width-i)/g.width)),{direction:m,speed:h}}function U2(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 S0(e){return e.reduce((t,n)=>Yi(t,vh(n)),cr)}function K2(e){return e.reduce((t,n)=>t+y0(n),0)}function V2(e){return e.reduce((t,n)=>t+C0(n),0)}function q2(e,t){if(t===void 0&&(t=ns),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);x0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var W2=[["x",["left","right"],K2],["y",["top","bottom"],V2]],Zd=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=nc(n),r=S0(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of W2)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})}},es=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 G2(e){let{EventTarget:t}=ho(e);return e instanceof t?e:Qi(e)}function gh(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 Qo;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Qo||(Qo={}));function n0(e){e.preventDefault()}function j2(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 w0={start:[mt.Space,mt.Enter],cancel:[mt.Esc],end:[mt.Space,mt.Enter,mt.Tab]},Q2=(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}}},dl=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 es(Qi(n)),this.windowListeners=new es(ho(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Qo.Resize,this.handleCancel),this.windowListeners.add(Qo.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Qo.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&q2(o),n(cr)}handleKeyDown(t){if(Xd(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=w0,coordinateGetter:i=Q2,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}:cr;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=Ji(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:T}=I0(g),L=U2(g),b={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))},S=v===mt.Right&&!y||v===mt.Left&&!C,A=v===mt.Down&&!w||v===mt.Up&&!x;if(S&&b.x!==f.x){let E=g.scrollLeft+p.x,B=v===mt.Right&&E<=k.x||v===mt.Left&&E>=T.x;if(B&&!p.y){g.scrollTo({left:E,behavior:s});return}B?m.x=g.scrollLeft-E:m.x=v===mt.Right?g.scrollLeft-k.x:g.scrollLeft-T.x,m.x&&g.scrollBy({left:-m.x,behavior:s});break}else if(A&&b.y!==f.y){let E=g.scrollTop+p.y,B=v===mt.Down&&E<=k.y||v===mt.Up&&E>=T.y;if(B&&!p.x){g.scrollTo({top:E,behavior:s});return}B?m.y=g.scrollTop-E:m.y=v===mt.Down?g.scrollTop-k.y:g.scrollTop-T.y,m.y&&g.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,Yi(Ji(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()}};dl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=w0,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 o0(e){return!!(e&&"distance"in e)}function r0(e){return!!(e&&"delay"in e)}var ec=class{constructor(t,n,o){var r;o===void 0&&(o=G2(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=Qi(i),this.documentListeners=new es(this.document),this.listeners=new es(o),this.windowListeners=new es(ho(i)),this.initialCoordinates=(r=Yd(a))!=null?r:cr,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(Qo.Resize,this.handleCancel),this.windowListeners.add(Qo.DragStart,n0),this.windowListeners.add(Qo.VisibilityChange,this.handleCancel),this.windowListeners.add(Qo.ContextMenu,n0),this.documentListeners.add(Qo.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(r0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(o0(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(Qo.Click,j2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Qo.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=Yd(t))!=null?n:cr,d=Ji(r,l);if(!o&&s){if(o0(s)){if(s.tolerance!=null&&gh(d,s.tolerance))return this.handleCancel();if(gh(d,s.distance))return this.handleStart()}if(r0(s)&&gh(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()}},X2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},cl=class extends ec{constructor(t){let{event:n}=t,o=Qi(n.target);super(t,X2,o)}};cl.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 Y2={move:{name:"mousemove"},end:{name:"mouseup"}},xh;(function(e){e[e.RightClick=2]="RightClick"})(xh||(xh={}));var yh=class extends ec{constructor(t){super(t,Y2,Qi(t.event.target))}};yh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===xh.RightClick?!1:(o?.({event:n}),!0)}}];var hh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Ch=class extends ec{constructor(t){super(t,hh)}static setup(){return window.addEventListener(hh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(hh.move.name,t)};function t(){}}};Ch.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 Jd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Jd||(Jd={}));var Df;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Df||(Df={}));function J2(e){let{acceleration:t,activator:n=Jd.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=Df.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=eB({delta:f,disabled:!a}),[h,g]=GS(),v=_({x:0,y:0}),x=_({x:0,y:0}),y=$(()=>{switch(n){case Jd.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Jd.DraggableRect:return r}},[n,r,l]),C=_(null),w=U(()=>{let T=C.current;if(!T)return;let L=v.current.x*x.current.x,b=v.current.y*x.current.y;T.scrollBy(L,b)},[]),k=$(()=>s===Df.TreeOrder?[...d].reverse():d,[s,d]);V(()=>{if(!a||!d.length||!y){g();return}for(let T of k){if(o?.(T)===!1)continue;let L=d.indexOf(T),b=c[L];if(!b)continue;let{direction:S,speed:A}=H2(T,b,y,t,p);for(let E of["x","y"])m[E][S[E]]||(A[E]=0,S[E]=0);if(A.x>0||A.y>0){g(),C.current=T,h(w,i),v.current=A,x.current=S;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 Z2={x:{[$n.Backward]:!1,[$n.Forward]:!1},y:{[$n.Backward]:!1,[$n.Forward]:!1}};function eB(e){let{delta:t,disabled:n}=e,o=Rf(t);return ll(r=>{if(n||!o||!r)return Z2;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[$n.Backward]:r.x[$n.Backward]||a.x===-1,[$n.Forward]:r.x[$n.Forward]||a.x===1},y:{[$n.Backward]:r.y[$n.Backward]||a.y===-1,[$n.Forward]:r.y[$n.Forward]||a.y===1}}},[n,t,o])}function tB(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 nB(e,t){return $(()=>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 bh;(function(e){e.Optimized="optimized"})(bh||(bh={}));var a0=new Map;function oB(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=K(null),{frequency:s,measure:l,strategy:d}=r,c=_(e),f=v(),p=sl(f),m=U(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 a0;if(!x||x===a0||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 Zd(l(w),w):null;C.rect.current=k,k&&y.set(C.id,k)}return y}return x},[e,a,n,f,l]);return V(()=>{c.current=e},[e]),V(()=>{f||m()},[n,f]),V(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),V(()=>{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 T0(e,t){return ll(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function rB(e,t){return T0(e,t)}function aB(e){let{callback:t,disabled:n}=e,o=Mf(t),r=$(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return V(()=>()=>r?.disconnect(),[r]),r}function Of(e){let{callback:t,disabled:n}=e,o=Mf(t),r=$(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return V(()=>()=>r?.disconnect(),[r]),r}function iB(e){return new Zd(ns(e),e)}function i0(e,t,n){t===void 0&&(t=iB);let[o,r]=K(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=aB({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=Of({callback:a});return jo(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function sB(e){let t=T0(e);return v0(e,t)}var s0=[];function lB(e){let t=_(e),n=ll(o=>e?o&&o!==s0&&e&&t.current&&e.parentNode===t.current.parentNode?o:nc(e):s0,[e]);return V(()=>{t.current=e},[e]),n}function dB(e){let[t,n]=K(null),o=_(e),r=U(a=>{let i=mh(a.target);i&&n(s=>s?(s.set(i,vh(i)),new Map(s)):null)},[]);return V(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=mh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,vh(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=mh(l);d?.removeEventListener("scroll",r)})}},[r,e]),$(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Yi(a,i),cr):S0(e):cr,[e,t])}function l0(e,t){t===void 0&&(t=[]);let n=_(null);return V(()=>{n.current=null},t),V(()=>{let o=e!==cr;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?Ji(e,n.current):cr}function cB(e){V(()=>{if(!jd)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 uB(e,t){return $(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function L0(e){return $(()=>e?F2(e):null,[e])}var d0=[];function fB(e,t){t===void 0&&(t=ns);let[n]=e,o=L0(n?ho(n):null),[r,a]=K(d0);function i(){a(()=>e.length?e.map(l=>b0(l)?o:new Zd(t(l),l)):d0)}let s=Of({callback:i});return jo(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function pB(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return il(t)?t:e}function mB(e){let{measure:t}=e,[n,o]=K(null),r=U(d=>{for(let{target:c}of d)if(il(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=Of({callback:r}),i=U(d=>{let c=pB(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=Qd(i);return $(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var gB=[{sensor:cl,options:{}},{sensor:dl,options:{}}],hB={current:{}},Nf={draggable:{measure:t0},droppable:{measure:t0,strategy:tc.WhileDragging,frequency:bh.Optimized},dragOverlay:{measure:ns}},ts=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}},vB={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ts,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_f},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nf,measureDroppableContainers:_f,windowRect:null,measuringScheduled:!1},xB={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_f,draggableNodes:new Map,over:null,measureDroppableContainers:_f},Ff=Ot(xB),k0=Ot(vB);function yB(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ts}}}function CB(e,t){switch(t.type){case Rn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Rn.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 Rn.DragEnd:case Rn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Rn.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new ts(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Rn.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 ts(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case Rn.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new ts(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function bB(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=sn(Ff),a=Rf(o),i=Rf(n?.id);return V(()=>{if(!t&&!o&&a&&i!=null){if(!Xd(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=QS(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function IB(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function SB(e){return $(()=>({draggable:{...Nf.draggable,...e?.draggable},droppable:{...Nf.droppable,...e?.droppable},dragOverlay:{...Nf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function wB(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;jo(()=>{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=v0(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=x0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var P0=Ot({...cr,scaleX:1,scaleY:1}),ei;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ei||(ei={}));var A0=de(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=gB,collisionDetection:f=E2,measuring:p,modifiers:m,...h}=t,g=Pi(CB,void 0,yB),[v,x]=g,[y,C]=w2(),[w,k]=K(ei.Uninitialized),T=w===ei.Initialized,{draggable:{active:L,nodes:b,translate:S},droppable:{containers:A}}=v,E=L!=null?b.get(L):null,B=_({initial:null,translated:null}),R=$(()=>{var oe;return L!=null?{id:L,data:(oe=E?.data)!=null?oe:hB,rect:B}:null},[L,E]),N=_(null),[H,D]=K(null),[W,xe]=K(null),ie=sl(h,Object.values(h)),Q=Xi("DndDescribedBy",i),Ye=$(()=>A.getEnabled(),[A]),Oe=SB(p),{droppableRects:ke,measureDroppableContainers:Be,measuringScheduled:Se}=oB(Ye,{dragging:T,dependencies:[S.x,S.y],config:Oe.droppable}),ce=tB(b,L),Ne=$(()=>W?Yd(W):null,[W]),ge=ae(),ee=rB(ce,Oe.draggable.measure);wB({activeNode:L!=null?b.get(L):null,config:ge.layoutShiftCompensation,initialRect:ee,measure:Oe.draggable.measure});let ye=i0(ce,Oe.draggable.measure,ee),ct=i0(ce?ce.parentElement:null),ut=_({activatorEvent:null,active:null,activeNode:ce,collisionRect:null,collisions:null,droppableRects:ke,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=A.getNodeFor((n=ut.current.over)==null?void 0:n.id),ft=mB({measure:Oe.dragOverlay.measure}),zt=(o=ft.nodeRef.current)!=null?o:ce,it=T?(r=ft.rect)!=null?r:ye:null,Pe=!!(ft.nodeRef.current&&ft.rect),Re=sB(Pe?null:ye),Fe=L0(zt?ho(zt):null),Ze=lB(T?lt??ce:null),we=fB(Ze),et=IB(m,{transform:{x:S.x-Re.x,y:S.y-Re.y,scaleX:1,scaleY:1},activatorEvent:W,active:R,activeNodeRect:ye,containerNodeRect:ct,draggingNodeRect:it,over:ut.current.over,overlayNodeRect:ft.rect,scrollableAncestors:Ze,scrollableAncestorRects:we,windowRect:Fe}),ht=Ne?Yi(Ne,S):null,$t=dB(Ze),dn=l0($t),_t=l0($t,[ye]),Ht=Yi(et,dn),Gt=it?N2(it,et):null,Dt=R&&Gt?f({active:R,collisionRect:Gt,droppableRects:ke,droppableContainers:Ye,pointerCoordinates:ht}):null,oo=Sh(Dt,"id"),[yn,kn]=K(null),Dn=Pe?et:Yi(et,_t),kt=M2(Dn,(a=yn?.rect)!=null?a:null,ye),Cn=_(null),St=U((oe,le)=>{let{sensor:Je,options:Ve}=le;if(N.current==null)return;let wt=b.get(N.current);if(!wt)return;let vt=oe.nativeEvent,Yt=new Je({active:N.current,activeNode:wt,event:vt,options:Ve,context:ut,onAbort(Ct){if(!b.get(Ct))return;let{onDragAbort:dt}=ie.current,rt={id:Ct};dt?.(rt),y({type:"onDragAbort",event:rt})},onPending(Ct,fe,dt,rt){if(!b.get(Ct))return;let{onDragPending:ze}=ie.current,bt={id:Ct,constraint:fe,initialCoordinates:dt,offset:rt};ze?.(bt),y({type:"onDragPending",event:bt})},onStart(Ct){let fe=N.current;if(fe==null)return;let dt=b.get(fe);if(!dt)return;let{onDragStart:rt}=ie.current,Pt={activatorEvent:vt,active:{id:fe,data:dt.data,rect:B}};(0,Zi.unstable_batchedUpdates)(()=>{rt?.(Pt),k(ei.Initializing),x({type:Rn.DragStart,initialCoordinates:Ct,active:fe}),y({type:"onDragStart",event:Pt}),D(Cn.current),xe(vt)})},onMove(Ct){x({type:Rn.DragMove,coordinates:Ct})},onEnd:jt(Rn.DragEnd),onCancel:jt(Rn.DragCancel)});Cn.current=Yt;function jt(Ct){return async function(){let{active:dt,collisions:rt,over:Pt,scrollAdjustedTranslate:ze}=ut.current,bt=null;if(dt&&ze){let{cancelDrop:un}=ie.current;bt={activatorEvent:vt,active:dt,collisions:rt,delta:ze,over:Pt},Ct===Rn.DragEnd&&typeof un=="function"&&await Promise.resolve(un(bt))&&(Ct=Rn.DragCancel)}N.current=null,(0,Zi.unstable_batchedUpdates)(()=>{x({type:Ct}),k(ei.Uninitialized),kn(null),D(null),xe(null),Cn.current=null;let un=Ct===Rn.DragEnd?"onDragEnd":"onDragCancel";if(bt){let At=ie.current[un];At?.(bt),y({type:un,event:bt})}})}}},[b]),ro=U((oe,le)=>(Je,Ve)=>{let wt=Je.nativeEvent,vt=b.get(Ve);if(N.current!==null||!vt||wt.dndKit||wt.defaultPrevented)return;let Yt={active:vt};oe(Je,le.options,Yt)===!0&&(wt.dndKit={capturedBy:le.sensor},N.current=Ve,St(Je,le))},[b,St]),cn=nB(c,ro);cB(c),jo(()=>{ye&&w===ei.Initializing&&k(ei.Initialized)},[ye,w]),V(()=>{let{onDragMove:oe}=ie.current,{active:le,activatorEvent:Je,collisions:Ve,over:wt}=ut.current;if(!le||!Je)return;let vt={active:le,activatorEvent:Je,collisions:Ve,delta:{x:Ht.x,y:Ht.y},over:wt};(0,Zi.unstable_batchedUpdates)(()=>{oe?.(vt),y({type:"onDragMove",event:vt})})},[Ht.x,Ht.y]),V(()=>{let{active:oe,activatorEvent:le,collisions:Je,droppableContainers:Ve,scrollAdjustedTranslate:wt}=ut.current;if(!oe||N.current==null||!le||!wt)return;let{onDragOver:vt}=ie.current,Yt=Ve.get(oo),jt=Yt&&Yt.rect.current?{id:Yt.id,rect:Yt.rect.current,data:Yt.data,disabled:Yt.disabled}:null,Ct={active:oe,activatorEvent:le,collisions:Je,delta:{x:wt.x,y:wt.y},over:jt};(0,Zi.unstable_batchedUpdates)(()=>{kn(jt),vt?.(Ct),y({type:"onDragOver",event:Ct})})},[oo]),jo(()=>{ut.current={activatorEvent:W,active:R,activeNode:ce,collisionRect:Gt,collisions:Dt,droppableRects:ke,draggableNodes:b,draggingNode:zt,draggingNodeRect:it,droppableContainers:A,over:yn,scrollableAncestors:Ze,scrollAdjustedTranslate:Ht},B.current={initial:it,translated:Gt}},[R,ce,Dt,Gt,b,zt,it,ke,A,yn,Ze,Ht]),J2({...ge,delta:S,draggingRect:Gt,pointerCoordinates:ht,scrollableAncestors:Ze,scrollableAncestorRects:we});let F=$(()=>({active:R,activeNode:ce,activeNodeRect:ye,activatorEvent:W,collisions:Dt,containerNodeRect:ct,dragOverlay:ft,draggableNodes:b,droppableContainers:A,droppableRects:ke,over:yn,measureDroppableContainers:Be,scrollableAncestors:Ze,scrollableAncestorRects:we,measuringConfiguration:Oe,measuringScheduled:Se,windowRect:Fe}),[R,ce,ye,W,Dt,ct,ft,b,A,ke,yn,Be,Ze,we,Oe,Se,Fe]),J=$(()=>({activatorEvent:W,activators:cn,active:R,activeNodeRect:ye,ariaDescribedById:{draggable:Q},dispatch:x,draggableNodes:b,over:yn,measureDroppableContainers:Be}),[W,cn,R,ye,x,Q,b,yn,Be]);return fn.createElement(u0.Provider,{value:C},fn.createElement(Ff.Provider,{value:J},fn.createElement(k0.Provider,{value:F},fn.createElement(P0.Provider,{value:kt},d)),fn.createElement(bB,{disabled:s?.restoreFocus===!1})),fn.createElement(k2,{...s,hiddenTextDescribedById:Q}));function ae(){let oe=H?.autoScrollEnabled===!1,le=typeof l=="object"?l.enabled===!1:l===!1,Je=T&&!oe&&!le;return typeof l=="object"?{...l,enabled:Je}:{enabled:Je}}}),TB=Ot(null),c0="button",LB="Draggable";function E0(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=Xi(LB),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=sn(Ff),{role:m=c0,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=sn(v?P0:TB),[y,C]=Qd(),[w,k]=Qd(),T=uB(i,t),L=sl(n);jo(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:w,data:L}),()=>{let S=f.get(t);S&&S.key===a&&f.delete(t)}),[f,t]);let b=$(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":v&&m===c0?!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:b,isDragging:v,listeners:o?void 0:T,node:y,over:p,setNodeRef:C,setActivatorNodeRef:k,transform:x}}function M0(){return sn(k0)}var kB="Droppable",PB={timeout:25};function R0(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=Xi(kB),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=sn(Ff),c=_({disabled:n}),f=_(!1),p=_(null),m=_(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...PB,...r},x=sl(g??o),y=U(()=>{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=Of({callback:y,disabled:h||!i}),w=U((b,S)=>{C&&(S&&(C.unobserve(S),f.current=!1),b&&C.observe(b))},[C]),[k,T]=Qd(w),L=sl(t);return V(()=>{!C||!k.current||(C.disconnect(),f.current=!1,C.observe(k.current))},[k,C]),V(()=>(s({type:Rn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:k,rect:p,data:L}}),()=>s({type:Rn.UnregisterDroppable,key:a,id:o})),[o]),V(()=>{n!==c.current.disabled&&(s({type:Rn.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:T}}ue();function N0(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function AB(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function Bf(e){return e!==null&&e>=0}function EB(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 MB(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var _0=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=N0(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 zf={scaleX:1,scaleY:1},D0=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,...zf}:null}let l=RB(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...zf}:r<n&&r>=i?{x:0,y:s.height+l,...zf}:{x:0,y:0,...zf}};function RB(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 O0="Sortable",F0=fn.createContext({activeIndex:-1,containerId:O0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:_0,disabled:{draggable:!1,droppable:!1}});function B0(e){let{children:t,id:n,items:o,strategy:r=_0,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=M0(),f=Xi(O0,n),p=s.rect!==null,m=$(()=>o.map(T=>typeof T=="object"&&"id"in T?T.id:T),[o]),h=i!=null,g=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,x=_(m),y=!EB(m,x.current),C=v!==-1&&g===-1||y,w=MB(a);jo(()=>{y&&h&&c(m)},[y,m,h,c]),V(()=>{x.current=m},[m]);let k=$(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:AB(m,l),strategy:r}),[g,f,w.draggable,w.droppable,C,m,v,l,p,r]);return fn.createElement(F0.Provider,{value:k},t)}var NB=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return N0(n,o,r).indexOf(t)},_B=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},DB={duration:200,easing:"ease"},z0="transform",OB=Za.Transition.toString({property:z0,duration:0,easing:"linear"}),FB={roleDescription:"sortable"};function BB(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=K(null),s=_(n);return jo(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=ns(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]),V(()=>{a&&i(null)},[a]),a}function $0(e){let{animateLayoutChanges:t=_B,attributes:n,disabled:o,data:r,getNewIndex:a=NB,id:i,strategy:s,resizeObserverConfig:l,transition:d=DB}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=sn(F0),C=zB(o,m),w=c.indexOf(i),k=$(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),T=$(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:b,isOver:S,setNodeRef:A}=R0({id:i,data:k,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...l}}),{active:E,activatorEvent:B,activeNodeRect:R,attributes:N,setNodeRef:H,listeners:D,isDragging:W,over:xe,setActivatorNodeRef:ie,transform:Q}=E0({id:i,data:k,attributes:{...FB,...n},disabled:C.draggable}),Ye=WS(A,H),Oe=!!E,ke=Oe&&!h&&Bf(p)&&Bf(v),Be=!x&&W,Se=Be&&ke?Q:null,Ne=ke?Se??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:w}):null,ge=Bf(p)&&Bf(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,ee=E?.id,ye=_({activeId:ee,items:c,newIndex:ge,containerId:f}),ct=c!==ye.current.items,ut=t({active:E,containerId:f,isDragging:W,isSorting:Oe,id:i,index:w,items:c,newIndex:ye.current.newIndex,previousItems:ye.current.items,previousContainerId:ye.current.containerId,transition:d,wasDragging:ye.current.activeId!=null}),lt=BB({disabled:!ut,index:w,node:b,rect:L});return V(()=>{Oe&&ye.current.newIndex!==ge&&(ye.current.newIndex=ge),f!==ye.current.containerId&&(ye.current.containerId=f),c!==ye.current.items&&(ye.current.items=c)},[Oe,ge,f,c]),V(()=>{if(ee===ye.current.activeId)return;if(ee!=null&&ye.current.activeId==null){ye.current.activeId=ee;return}let zt=setTimeout(()=>{ye.current.activeId=ee},50);return()=>clearTimeout(zt)},[ee]),{active:E,activeIndex:p,attributes:N,data:k,rect:L,index:w,newIndex:ge,items:c,isOver:S,isSorting:Oe,isDragging:W,listeners:D,node:b,overIndex:v,over:xe,setNodeRef:Ye,setActivatorNodeRef:ie,setDroppableNodeRef:A,setDraggableNodeRef:H,transform:lt??Ne,transition:ft()};function ft(){if(lt||ct&&ye.current.newIndex===w)return OB;if(!(Be&&!Xd(B)||!d)&&(Oe||ut))return Za.Transition.toString({...d,property:z0})}}function zB(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 $f(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 $B=[mt.Down,mt.Right,mt.Up,mt.Left],H0=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if($B.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=h0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=Sh(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=nc(h).some((T,L)=>s[L]!==T),x=U0(f,p),y=HB(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:Ji(w,C)}}}};function U0(e,t){return!$f(e)||!$f(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function HB(e,t){return!$f(e)||!$f(t)||!U0(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function UB(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 K0=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:UB(n,t,r)},V0=e=>{let{transform:t}=e;return{...t,x:0}};ue();ue();var Hf={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function q0(e){return`(min-width: ${typeof e=="number"?e:Hf[e]}px)`}function W0(e){return`(max-width: ${(typeof e=="number"?e:Hf[e])-1}px)`}function KB(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(q0(e.min)),e.max!=null&&n.push(W0(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 Hf&&t.push(W0(o))}else n in Hf&&t.push(q0(n));return t.length>0?t.join(" and "):e}function VB(){return!1}function Uf(e){let t=KB(e),n=U(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=U(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return ld(n,o,VB)}ue();function G0({entry:e,current:t,environmentId:n,unavailable:o,attachments:r,onEdit:a,onClose:i}){let{t:s}=Jn(),[l,d]=K(e.text??""),[c,f]=K(e.management?.attachments??[]),[p,m]=K([]),h=_(p);h.current=p;let[g,v]=K(!1),x=_(!1),y=_(!0),[C,w]=K(null),k=_(null),T=r.useUploadStatuses(),L=$(()=>c.map(N=>N.id),[c]),b=r.useAssetUrls(n,L),S=!t?.management||t.management.revision!==e.management?.revision,A=()=>{for(let N of h.current)r.releaseUpload(N.id),URL.revokeObjectURL(N.previewUrl);h.current=[]};V(()=>(y.current=!0,()=>{y.current=!1,x.current||A()}),[]);let E=N=>{if(x.current||o||S)return;w(null);let H=[...h.current];for(let D of N){let W=D.type||"application/octet-stream";if(c.length+H.length>=r.limits.maxAttachments||D.size===0||D.size>r.maxAttachmentBytes(W)){w(s("turnQueue.attachmentLimit",{name:D.name,count:r.limits.maxAttachments,size:r.formatAttachmentSize(r.maxAttachmentBytes(W))}));continue}let xe=r.makeImageAttachment({id:r.randomUUID(),name:D.name,mimeType:W,sizeBytes:D.size,file:D});H.push(xe),r.startUpload({environmentId:n,image:xe})}h.current=H,m(H)},B=async()=>{if(!(x.current||o||S||!l.trim()&&c.length+p.length===0)){x.current=!0,v(!0),w(null);try{await r.awaitUploads(p.map(H=>H.id));let N=r.getUploadedAttachments({environmentId:n,images:p});if(!N)throw new Error(s("turnQueue.uploadFailed"));await a(e,{text:l,attachments:[...c,...N]}),y.current&&i()}catch(N){y.current&&w(N instanceof Error?N.message:s("turnQueue.actionFailed"))}finally{x.current=!1,y.current?v(!1):A()}}},R=[...c.map((N,H)=>({...N,previewUrl:b[H],added:!1})),...p.map(N=>({...N,added:!0}))];return u(ef,{open:!0,onOpenChange:N=>{!N&&!x.current&&i()},children:I(rf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[I(of,{children:[u(af,{children:s("turnQueue.editTitle")}),u(tf,{children:s("turnQueue.editDescription")})]}),I("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:N=>{N.dataTransfer.types.includes("Files")&&N.preventDefault()},onDrop:N=>{N.dataTransfer.files.length&&(N.preventDefault(),N.stopPropagation(),E(Array.from(N.dataTransfer.files)))},children:[u(tI,{"aria-label":s("turnQueue.editText"),autoFocus:!0,value:l,maxLength:r.limits.maxInputChars,disabled:g,onChange:N=>d(N.target.value),onPaste:N=>{N.clipboardData.files.length&&(N.preventDefault(),E(Array.from(N.clipboardData.files)))},onKeyDown:N=>{(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&!N.nativeEvent.isComposing&&(N.preventDefault(),B())}}),u("ul",{className:"flex flex-wrap gap-2",children:R.map(N=>I("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[N.type==="image"&&N.previewUrl?u("img",{src:N.previewUrl,alt:N.name,className:"size-12 rounded object-cover"}):u(Io,{className:"size-4 shrink-0"}),I("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:N.name}),u("p",{className:"text-muted-foreground",children:r.formatAttachmentSize(N.sizeBytes)}),N.added&&T.get(N.id)!=="ready"?u("p",{children:s(T.get(N.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,N.added&&T.get(N.id)==="failed"?u(ne,{size:"xs",variant:"ghost",disabled:g||o||S,onClick:()=>{let H=p.find(D=>D.id===N.id);H&&r.retryUpload({environmentId:n,image:H})},children:s("turnQueue.retryUpload")}):null]}),u(ne,{size:"icon-xs",variant:"ghost","aria-label":s("turnQueue.removeAttachment",{name:N.name}),disabled:g||S,onClick:()=>{N.added?(r.releaseUpload(N.id),N.previewUrl&&URL.revokeObjectURL(N.previewUrl),h.current=h.current.filter(H=>H.id!==N.id),m(h.current)):f(H=>H.filter(D=>D.id!==N.id))},children:u(Vt,{className:"size-3.5"})})]},N.id))}),u("input",{ref:k,type:"file",multiple:!0,className:"hidden","aria-label":s("turnQueue.addAttachments"),onChange:N=>{E(Array.from(N.target.files??[])),N.target.value=""}}),I(ne,{size:"sm",variant:"outline",disabled:g||o||S,onClick:()=>k.current?.click(),children:[u(Io,{className:"size-4"}),s("turnQueue.addAttachments")]}),S?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:s("turnQueue.editStale")}):null,C?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:C}):null]}),I(nf,{children:[u(ne,{variant:"ghost",disabled:g,onClick:i,children:s("turnQueue.discardEdit")}),u(ne,{disabled:g||o||S||!l.trim()&&R.length===0,onClick:()=>{B()},children:s(g?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function j0(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 Q0(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return j0(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function X0(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:j0(e,t),settled:!1}}ue();ue();function qB({entry:e,unavailable:t,onCancel:n}){let{t:o}=Jn(),r=_(!1),[a,i]=K(!1),[s,l]=K(!1),[d,c]=K(!1);V(()=>{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 I("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"?I("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),I("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 Y0({entries:e,unavailable:t,onCancel:n}){let{t:o}=Jn(),[r,a]=K(!1),i=Fr();return e.length===0?null:I("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(qB,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function wh({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=Jn(),i=_(!1),[s,l]=K(!1),[d,c]=K(!1),f=_(!1),[p,m]=K(!1),[h,g]=K(!1),[v,x]=K(null);V(()=>{e.paused||c(!1)},[e.paused]);let y=o?.[0];V(()=>{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 S=y;f.current=!0,g(!0),x(null);try{await r(S),m(!1)}catch{x(S.intentId)}finally{f.current=!1,g(!1)}},T=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"),b=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 I("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:[I("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[I("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:T}),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:()=>{b()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?I(pe,{children:[u(ne,{size:"xs",variant:"outline",disabled:h,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(rI,{open:p,onOpenChange:S=>{S||m(!1)},children:I(dI,{className:"max-w-lg",children:[I(lI,{children:[u(cI,{children:a("turnQueue.stopWaiting")}),u(iI,{children:a("turnQueue.abandonDescription")})]}),I(sI,{children:[u(aI,{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(Y0,{entries:o.filter(S=>S.status!=="queued"),unavailable:t,onCancel:r}):null]})}var WB=[V0,K0];function GB({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=Jn(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:h}=$0({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return I("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:Za.Transform.toString(p),transition:m},className:z("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:z("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:z("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(fo,{className:"size-3.5"}):u(Id,{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 J0({entries:e,environmentId:t,unavailable:n,attachments:o,actions:r,onCancel:a}){let{t:i}=Jn(),s=Uf("(prefers-reduced-motion: reduce)"),[l,d]=K(null),[c,f]=K(!1),p=_(!1),[m,h]=K(null),[g,v]=K(null),[x,y]=K(null),C=_(!1),[w,k]=K(null),T=f0(Ih(cl,{activationConstraint:{distance:5}}),Ih(dl,{coordinateGetter:H0,scrollBehavior:s?"auto":"smooth"})),L=$(()=>e.filter(D=>D.waiting),[e]),b=x?X0(L,x.preview):null,S=b?.entries??L,A=n||c||x!==null,E=S.findIndex(D=>D.intentId===g?.activeId),B=S.findIndex(D=>D.intentId===g?.overId);V(()=>{x!==null&&(n||x.acknowledged&&b?.settled)&&(C.current=!1,y(null),!n&&L.some(D=>D.intentId===x.preview.intentId)&&k({intentId:x.preview.intentId,kind:"saved"}))},[L,x,b?.settled,n]),V(()=>{if(w===null||w.kind==="failed")return;let D=window.setTimeout(()=>k(W=>W===w?null:W),1600);return()=>window.clearTimeout(D)},[w]);let R=async D=>{if(!(p.current||C.current||n)){p.current=!0,f(!0),h(null),k(null);try{await D()}catch(W){h(W instanceof Error?W.message:i("turnQueue.actionFailed"))}finally{p.current=!1,f(!1)}}},N=(D,W)=>R(async()=>{let xe=Q0(L,D.intentId,W);if(!(xe===null||!D.management?.canReorder)){C.current=!0,y({preview:xe,acknowledged:!1});try{await r.onReorder(D,W),y(ie=>ie?.preview===xe?{...ie,acknowledged:!0}:ie)}catch(ie){throw C.current=!1,y(null),k({intentId:D.intentId,kind:"failed"}),ie}}}),H=n?i("turnQueue.disconnected"):x!==null?i("turnQueue.saving"):g!==null?`${i("turnQueue.dragStarted")} ${B+1}/${S.length}`:w?.kind==="saved"?i("common.action.done"):w?.kind==="cancelled"?i("turnQueue.dragCancelled"):"";return I(pe,{children:[S.length>0?I("section",{"aria-label":i("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:[I("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:i("turnQueue.queued",{count:S.length})}),u("span",{role:"status","aria-live":g===null?"polite":"off","data-queue-reorder-status":x?"saving":w?.kind,className:z("min-w-0 truncate",w?.kind==="saved"&&"text-primary"),children:H})]}),u(A0,{sensors:T,collisionDetection:g0,modifiers:WB,accessibility:{screenReaderInstructions:{draggable:i("turnQueue.dragInstructions")},announcements:{onDragStart:()=>i("turnQueue.dragStarted"),onDragOver:({over:D})=>{let W=S.findIndex(xe=>xe.intentId===D?.id);return W<0?void 0:`${i("turnQueue.dragStarted")} ${W+1}/${S.length}`},onDragEnd:()=>i("turnQueue.dragFinished"),onDragCancel:()=>i("turnQueue.dragCancelled")}},onDragStart:({active:D})=>{let W=S.find(xe=>xe.intentId===D.id);!W?.management?.canReorder||A||(h(null),k(null),v({activeId:W.intentId,overId:W.intentId}))},onDragOver:({over:D})=>{let W=S.find(xe=>xe.intentId===D?.id);W&&v(xe=>xe&&{...xe,overId:W.intentId})},onDragCancel:()=>{g&&k({intentId:g.activeId,kind:"cancelled"}),v(null)},onDragEnd:({active:D,over:W})=>{if(v(null),!W||D.id===W.id)return;let xe=S.findIndex(Oe=>Oe.intentId===D.id),ie=S.findIndex(Oe=>Oe.intentId===W.id),Q=S[xe];if(!Q?.management?.canReorder||ie<0)return;let Ye=S[ie+(xe<ie?1:0)]?.intentId??null;N(Q,Ye)},children:u(B0,{items:S.map(D=>D.intentId),strategy:D0,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:S.map((D,W)=>I(GB,{entry:D,disabled:!D.management?.canReorder||A,reducedMotion:s,feedback:w?.intentId===D.intentId?w.kind:void 0,dropPosition:D.intentId===g?.overId&&E!==B?E<B?"after":"before":void 0,dragPosition:D.intentId===g?.activeId?`${B+1}/${S.length}`:void 0,children:[I("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:D.text||i("turnQueue.attachmentsOnly")}),D.attachmentNames.length?I("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(Io,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:D.attachmentNames.join(", ")})]}):null,D.pendingAction?u("p",{className:"text-muted-foreground",children:i(D.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,D.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:D.failure}):null]}),I("div",{className:z("flex shrink-0 items-center gap-0.5",D.intentId===g?.activeId&&"invisible"),children:[u(ne,{size:"icon-xs",variant:"ghost",disabled:!D.management||A||g!==null,"aria-label":i("turnQueue.editMessage"),title:i("turnQueue.editMessage"),onClick:()=>d(D),children:u(Ed,{className:"size-3.5"})}),D.management?.canSteer?u(ne,{size:"icon-xs",variant:"ghost",disabled:A||g!==null,"aria-label":i("turnQueue.steer"),title:i("turnQueue.steerDescription"),onClick:()=>{R(()=>r.onRun(D,"steer"))},children:u(Md,{className:"size-3.5"})}):null,I(Ko,{children:[u(Wo,{render:u(ne,{size:"icon-xs",variant:"ghost",disabled:A||!D.management||g!==null,"aria-label":i("turnQueue.messageActions")}),children:u(Uo,{className:"size-4"})}),I(qo,{align:"end",children:[I(Vo,{disabled:!D.management?.canReorder||W===0,onClick:()=>{N(D,S[W-1].intentId)},children:[u(fd,{className:"size-4"}),i("turnQueue.moveUp")]}),I(Vo,{disabled:!D.management?.canReorder||W===S.length-1,onClick:()=>{N(D,S[W+2]?.intentId??null)},children:[u(cd,{className:"size-4"}),i("turnQueue.moveDown")]}),D.management?.canSteer?u(Vo,{onClick:()=>{R(()=>r.onRun(D,"steer"))},children:i("turnQueue.steer")}):null,u(Vo,{disabled:!D.management?.canRun,onClick:()=>{R(()=>r.onRun(D,"interrupt"))},children:i(D.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(Ga,{}),u(Vo,{disabled:D.action!=="cancel",onClick:()=>{R(()=>a(D))},children:i("turnQueue.cancelMessage")})]})]})]})]},D.intentId))})})}),m?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:m}):null]}):null,l?u(G0,{entry:l,current:e.find(D=>D.intentId===l.intentId),environmentId:t,unavailable:A,attachments:o,onEdit:r.onEdit,onClose:()=>d(null)},l.intentId):null]})}ue();var Th=220,jB={opacity:0,transform:"translate3d(0, 4rem, 0)"},QB={opacity:0,transform:"translate3d(0, 7rem, 0)"},Z0={opacity:1,transform:"none"},ew={transition:`transform ${Th}ms ease-in, opacity ${Th}ms ease-in`},XB={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function nw({className:e,items:t}){let[n,o]=K(null),r=_(null),a=n!==null&&t.some(p=>p.id===n)?n:null;if(V(()=>()=>{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?.()},Th))};return u("div",{className:z("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:I("div",{className:z("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:z("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)]",XB[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:z("relative z-10",a===i.id?"pointer-events-none":null),style:{...ew,...a===i.id?jB:Z0},children:u(tw,{item:i,attached:!0,exiting:a===i.id,onDismissRequest:()=>f(i)})}),l?u("div",{"data-composer-banner-stack-expanded-items":"true",className:z("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:z("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:z(a===p.id?"pointer-events-none":null),style:{...ew,...a===p.id?QB:Z0},children:u(tw,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function tw({item:e,attached:t,exiting:n,onDismissRequest:o}){let r=e.onDismiss&&!e.actions;return e.presentation==="compact"?I(zd,{variant:e.variant,role:"status",className:z("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,I(Vg,{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?I($d,{className:z("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(Vt,{})}):null]}):null]}):I(zd,{variant:e.variant,className:z(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(Vg,{children:e.title}),e.description?u(lf,{children:e.description}):null,e.actions||e.onDismiss?I($d,{className:z(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(Vt,{})}):null]}):null]})}function ow({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u(nw,{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:I("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:[I("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?I("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,I("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)]"})]})})}var YB=["image/gif","image/jpeg","image/png","image/webp"],JB=new Set(YB);function Lh(e){return JB.has(e.toLowerCase())}function ZB(e){return Lh(e)?"image":"file"}var ez=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function kh(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||ez.has(t)?"text":"file"}function Ph(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 Ah(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return ZB(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var tz=new Set(["claudeAgent","cursor","grok","dsh","acp"]),rw=e=>tz.has(e)?"in-session":"next-turn";function nz(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function oz(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function rz(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function oc(e){return`[${oz(nz(e))}](${rz(e)})`}ue();var az=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,iz=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var sz=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),lz=/^[A-Za-z][A-Za-z0-9+.-]*:/,dz=/^[A-Za-z]:[\\/]/,cz=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function uz(e){let t=[];for(let n of e.matchAll(sz)){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=lz.test(s)&&!dz.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(iz)){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&&cz.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 rc(e,t={}){let n=uz(e);for(let o of e.matchAll(az)){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 fz(e){return e.replace(/\r\n/g,`
3691
- `).replace(/^\n+|\n+$/g,"")}function pz(e){return fz(e.text).length>0}function aw(e){return!pz(e)}function mz(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function iw(e){return`${e.terminalLabel} (${mz(e)})`}function sw(e,t,n){return e<=n&&n<t}function lw(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 dw(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 gz(e,t){return dw(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function hz(e,t){return gz(e,(n,o)=>{for(let r of rc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function vz(e){let t=[];if(!e)return t;let n=rc(e),o=0;for(let r of n)r.start<o||(r.start>o&&lw(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&&lw(t,e.slice(o)),t}function Eh(e,t,n){return!e||t>=n?!1:hz(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&sw(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&sw(t,n,l))})}function os(e,t=[]){if(!e)return[];let n=[],o=0;return dw(e,r=>r.type==="text"?(n.push(...vz(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function uw(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:"foreground"}var cw=e=>e.type!=="text";function Mh(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function xz(e){return e===" "||e===`
3692
- `||e===" "||e==="\r"||e==="\uFFFC"}function yz(e,t){let n=t-1;for(;n>=0&&!xz(e[n]??"");)n-=1;return n+1}function Vr(e,t){let n=Mh(e,t),o=os(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 fw(e){return e.type==="text"?e.text.length:1}function pw(e,t){let n=e.reduce((o,r)=>o+fw(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function ur(e,t){return pw(os(e),t)}function Mo(e,t){let n=Mh(e,t),o=os(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=os(e);if(!o.some(cw))return!1;let r=pw(o,t),a=0;for(let i of o){if(cw(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=fw(i)}return!1}function Xo(e,t){let n=Mh(e,t),o=e.lastIndexOf(`
3693
- `,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=yz(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 mw(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 gw="Ask for changes, send follow-ups, or attach images";var hw="application/x-ycodium-composer-mention";function Rh(e){return e.includes(hw)}function vw(e){let t=n=>Rh(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(hw);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}ue();var Nh=de(function(t){let{t:n}=_e();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:z("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?I(ne,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:z("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(js,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):I("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:z("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(js,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});ue();function Cz(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function bz(e){let t=Cz(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 xw(e){let t=bz(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}ue();var yw=Ot(null),Cw=yw.Provider;function Mt(){let e=sn(yw);if(e===null)throw new Error("Composer API has not been provided.");return e}var bw=90;function Iw(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function Iz(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>bw?`${n.slice(0,bw)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var Sw=de(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=_e(),s=Mt(),l=_(null),[d,c]=K(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return V(()=>{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]),V(()=>{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(cf,{autoHighlight:!1,mode:"none",children:I("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(Vt,{className:"size-3"})})}),u(pf,{className:"max-h-64 scroll-pb-6",children:u(uf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>I(ff,{value:p.id,className:z("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:Iz(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):Iw(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:Iw(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:xw(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(Vt,{className:"stroke-2"})})]},p.id))})})]})})});ue();function Tw(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 ww({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:z("flex w-10 shrink-0 items-center gap-0.5",e),children:Tw(t).map(({key:n,step:o})=>u("span",{className:z("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 _h=de(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"?I("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[I(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(Fi,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(ww,{steps:s}),I("span",{className:z("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(Vt,{"aria-hidden":!0,className:"size-2.5"})})]}):I("div",{className:z("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:[I("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(Fi,{"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}),I("span",{className:z("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(ww,{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(Vt,{"aria-hidden":!0,className:"size-3"})})]})}),Lw=de(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=_e();return I("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[I("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[I("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(Fi,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),I("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(Vt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:Tw(r).map(({key:i,step:s})=>I("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:z("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:z("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?Gi(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function kw(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 Kf(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function Pw(e){switch(e){case"image":return Oi;case"pdf":return Di;case"text":return _i;case"file":return Io}}var Aw="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",Ew=`${Aw} border border-border/70 bg-accent/40 text-foreground`,Sz=`${Ew} text-[12px]`,ni=`${Ew} text-[0.86em] select-none`,Vf="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-['']",qr="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Mw="truncate leading-tight",Wr="block self-center truncate leading-tight select-none",Rw=`${Aw} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,Nw='<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>',qf="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 wz(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(`
3694
- `)}function Tz({context:e,onRemove:t}){let{t:n}=_e(),o=Mt().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return I(je,{children:[u(Xe,{render:I("span",{className:z(ni,"pr-1"),children:[u($r,{className:z(qr,"size-icon-1")}),u("span",{className:Wr,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:qf,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(Vt,{className:"size-3","aria-hidden":!0})})]})}),u(Qe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:wz(e,o.formatLabel,o.formatSourceLabel)})]})}function _w({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:z("flex flex-wrap gap-1.5",n),children:e.map(o=>u(Tz,{context:o,onRemove:t},o.id))})}function Dw({comments:e,onRemove:t,className:n}){let{t:o}=_e();return e.length===0?null:u("div",{className:z("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=I("span",{className:z(ni,"pr-1"),children:[u(Bi,{className:z(qr,"size-icon-1")}),u("span",{className:Wr,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:qf,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(Vt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:I(je,{children:[u(Xe,{render:i}),u(Qe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Wf(e){let t=`${e.count} ${e.label}${e.count===1?"":"s"}`;return I(je,{children:[u(Xe,{render:I("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Qe,{side:"top",children:t})]})}function Ow({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=_e(),l=Mt().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:z("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 I("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($r,{className:"size-icon-2"})}),I("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,I("div",{className:z("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?I("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?I("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,I("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(Wf,{icon:u($r,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(Wf,{icon:u(yd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(Wf,{icon:u(Hr,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(Wf,{icon:u($i,{className:"size-3"}),count:c.styleChanges.length,label:"style change"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:Kf(p.progress)}):null,p?.status==="failed"&&f&&a?I(je,{children:[u(Xe,{render:u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":`Retry upload for ${f.name}`,onClick:()=>a(f)}),children:u(Ui,{className:"size-3"})}),u(Qe,{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(Vt,{className:"size-3"})})]},c.id)})})}ue();function Fw(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function Bw(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function zw(e,t){let n=Mt().pane.useVisible(),[o,r]=K(null);Me(()=>{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=Fw(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&Bw(o,{hasWideActions:t})}}var Dh={};wn(Dh,{LexicalComposerContext:()=>$w,createLexicalComposerContext:()=>Lz,useLexicalComposerContext:()=>kz});ue();var $w=Ot(null);function Lz(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function kz(){let e=sn($w);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 Oh=Dh,Hw=Oh.LexicalComposerContext,Uw=Oh.createLexicalComposerContext,xn=Oh.useLexicalComposerContext;var ux={};wn(ux,{$addUpdateTag:()=>Mp,$applyNodeReplacement:()=>Ec,$caretFromPoint:()=>fi,$caretRangeFromSelection:()=>Sv,$cloneWithProperties:()=>rx,$cloneWithPropertiesEphemeral:()=>c$,$comparePointCaretNext:()=>lx,$copyNode:()=>nx,$create:()=>f$,$createLineBreakNode:()=>yl,$createNodeSelection:()=>Hv,$createParagraphNode:()=>Ca,$createPoint:()=>vr,$createRangeSelection:()=>RL,$createRangeSelectionFromDom:()=>z5,$createTabNode:()=>Tp,$createTextNode:()=>Hn,$extendCaretToRange:()=>ix,$findMatchingParent:()=>uc,$getAdjacentChildCaret:()=>kl,$getAdjacentNode:()=>JL,$getAdjacentSiblingOrParentSiblingCaret:()=>C$,$getCaretInDirection:()=>pi,$getCaretRange:()=>ui,$getCaretRangeInDirection:()=>cx,$getCharacterOffsets:()=>gv,$getChildCaret:()=>Ia,$getChildCaretAtIndex:()=>pk,$getChildCaretOrSelf:()=>lk,$getCollapsedCaretRange:()=>dk,$getCommonAncestor:()=>fc,$getCommonAncestorResultBranchOrder:()=>dx,$getEditor:()=>ox,$getNearestNodeFromDOMNode:()=>Ep,$getNearestRootOrShadowRoot:()=>tk,$getNodeByKey:()=>_n,$getNodeByKeyOrThrow:()=>nk,$getNodeFromDOMNode:()=>Qv,$getPreviousSelection:()=>ms,$getRoot:()=>Ro,$getSelection:()=>It,$getSiblingCaret:()=>Wn,$getState:()=>rp,$getStateChange:()=>a5,$getTextContent:()=>U5,$getTextNodeOffset:()=>hr,$getTextPointCaret:()=>ci,$getTextPointCaretSlice:()=>bv,$getWritableNodeState:()=>kv,$hasAncestor:()=>yp,$hasUpdateTag:()=>a$,$insertNodes:()=>H5,$isBlockElementNode:()=>B5,$isChildCaret:()=>gr,$isDecoratorNode:()=>qt,$isEditorState:()=>W5,$isElementNode:()=>j,$isExtendableTextPointCaret:()=>fk,$isInlineElementOrDecoratorNode:()=>i$,$isLeafNode:()=>n$,$isLineBreakNode:()=>ss,$isNodeCaret:()=>g$,$isNodeSelection:()=>Lc,$isParagraphNode:()=>zL,$isRangeSelection:()=>$e,$isRootNode:()=>jn,$isRootOrShadowRoot:()=>Jo,$isSiblingCaret:()=>ps,$isTabNode:()=>$v,$isTextNode:()=>Ae,$isTextPointCaret:()=>ba,$isTextPointCaretSlice:()=>y$,$isTokenOrSegmented:()=>va,$isTokenOrTab:()=>ai,$nodesOfType:()=>r$,$normalizeCaret:()=>pr,$normalizeSelection__EXPERIMENTAL:()=>ap,$onUpdate:()=>ek,$parseSerializedNode:()=>q5,$removeTextFromCaretRange:()=>uk,$rewindSiblingCaret:()=>Ml,$selectAll:()=>o$,$setCompositionKey:()=>Kn,$setPointFromCaret:()=>Pl,$setSelection:()=>To,$setSelectionFromCaretRange:()=>ck,$setState:()=>i5,$splitAtPointCaretNext:()=>S$,$splitNode:()=>s$,$updateRangeSelectionFromCaretRange:()=>pc,ArtificialNode__DO_NOT_USE:()=>vp,BEFORE_INPUT_COMMAND:()=>Av,BLUR_COMMAND:()=>uL,CAN_REDO_COMMAND:()=>x5,CAN_UNDO_COMMAND:()=>y5,CLEAR_EDITOR_COMMAND:()=>h5,CLEAR_HISTORY_COMMAND:()=>v5,CLICK_COMMAND:()=>jT,COLLABORATION_TAG:()=>IL,COMMAND_PRIORITY_CRITICAL:()=>Y5,COMMAND_PRIORITY_EDITOR:()=>pl,COMMAND_PRIORITY_HIGH:()=>X5,COMMAND_PRIORITY_LOW:()=>j5,COMMAND_PRIORITY_NORMAL:()=>Q5,COMPOSITION_END_COMMAND:()=>Rv,COMPOSITION_END_TAG:()=>LL,COMPOSITION_START_COMMAND:()=>Mv,COMPOSITION_START_TAG:()=>TL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>gl,COPY_COMMAND:()=>Fv,CUT_COMMAND:()=>Bv,DELETE_CHARACTER_COMMAND:()=>vc,DELETE_LINE_COMMAND:()=>yc,DELETE_WORD_COMMAND:()=>xc,DRAGEND_COMMAND:()=>dL,DRAGOVER_COMMAND:()=>lL,DRAGSTART_COMMAND:()=>sL,DROP_COMMAND:()=>iL,DecoratorNode:()=>bc,ElementNode:()=>li,FOCUS_COMMAND:()=>cL,FORMAT_ELEMENT_COMMAND:()=>g5,FORMAT_TEXT_COMMAND:()=>oi,HISTORIC_TAG:()=>k5,HISTORY_MERGE_TAG:()=>tp,HISTORY_PUSH_TAG:()=>P5,INDENT_CONTENT_COMMAND:()=>p5,INPUT_COMMAND:()=>Ev,INSERT_LINE_BREAK_COMMAND:()=>lc,INSERT_PARAGRAPH_COMMAND:()=>av,INSERT_TAB_COMMAND:()=>f5,INTERNAL_$isBlock:()=>ya,IS_ALL_FORMATTING:()=>$z,IS_BOLD:()=>Nz,IS_CODE:()=>Fz,IS_HIGHLIGHT:()=>wv,IS_ITALIC:()=>_z,IS_STRIKETHROUGH:()=>Dz,IS_SUBSCRIPT:()=>Bz,IS_SUPERSCRIPT:()=>zz,IS_UNDERLINE:()=>Oz,KEY_ARROW_DOWN_COMMAND:()=>eL,KEY_ARROW_LEFT_COMMAND:()=>YT,KEY_ARROW_RIGHT_COMMAND:()=>QT,KEY_ARROW_UP_COMMAND:()=>ZT,KEY_BACKSPACE_COMMAND:()=>nL,KEY_DELETE_COMMAND:()=>rL,KEY_DOWN_COMMAND:()=>Ov,KEY_ENTER_COMMAND:()=>cp,KEY_ESCAPE_COMMAND:()=>oL,KEY_MODIFIER_COMMAND:()=>fL,KEY_SPACE_COMMAND:()=>tL,KEY_TAB_COMMAND:()=>aL,LineBreakNode:()=>xl,MOVE_TO_END:()=>XT,MOVE_TO_START:()=>JT,NODE_STATE_KEY:()=>Zz,OUTDENT_CONTENT_COMMAND:()=>m5,PASTE_COMMAND:()=>Nv,PASTE_TAG:()=>A5,ParagraphNode:()=>Il,REDO_COMMAND:()=>Dv,REMOVE_TEXT_COMMAND:()=>iv,RootNode:()=>bl,SELECTION_CHANGE_COMMAND:()=>Pv,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>u5,SELECT_ALL_COMMAND:()=>sv,SKIP_COLLAB_TAG:()=>E5,SKIP_DOM_SELECTION_TAG:()=>wL,SKIP_SCROLL_INTO_VIEW_TAG:()=>SL,SKIP_SELECTION_FOCUS_TAG:()=>pv,TEXT_TYPE_TO_FORMAT:()=>Zn,TabNode:()=>Cl,TextNode:()=>cs,UNDO_COMMAND:()=>_v,addClassNamesToElement:()=>A$,buildImportMap:()=>L5,configExtension:()=>T$,createCommand:()=>We,createEditor:()=>J5,createSharedNodeState:()=>UT,createState:()=>r5,declarePeerDependency:()=>L$,defineExtension:()=>w$,flipDirection:()=>mi,getDOMOwnerDocument:()=>ex,getDOMSelection:()=>yr,getDOMSelectionFromTarget:()=>ok,getDOMTextNode:()=>fs,getEditorPropertyFromDOMNode:()=>Pc,getNearestEditorFromDOMNode:()=>jv,getRegisteredNode:()=>Wv,getRegisteredNodeOrThrow:()=>qv,getStaticNodeConfig:()=>Mc,getTextDirection:()=>t$,getTransformSetFromKlass:()=>HL,isBlockDomNode:()=>yv,isCurrentlyReadOnlyMode:()=>Al,isDOMDocumentNode:()=>VL,isDOMNode:()=>El,isDOMTextNode:()=>Qr,isDOMUnmanaged:()=>sk,isDocumentFragment:()=>rk,isExactShortcutMatch:()=>Tt,isHTMLAnchorElement:()=>l$,isHTMLElement:()=>vo,isInlineDomNode:()=>ak,isLexicalEditor:()=>Pp,isModifierMatch:()=>YL,isSelectionCapturedInDecoratorInput:()=>Gv,isSelectionWithinEditor:()=>kc,makeStepwiseIterator:()=>sx,mergeRegister:()=>M$,normalizeClassNames:()=>Rc,removeClassNamesFromElement:()=>E$,removeFromParent:()=>ii,resetRandomKey:()=>Z5,safeCast:()=>k$,setDOMUnmanaged:()=>u$,setNodeIndentFromDOM:()=>ik,shallowMergeConfig:()=>P$,toggleTextFormatType:()=>Sc});function Y(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 _T(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 xr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pz=xr&&"documentMode"in document?document.documentMode:null,fr=xr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),si=xr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),op=!(!xr||!("InputEvent"in window)||Pz)&&"getTargetRanges"in new window.InputEvent("input"),bp=xr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Tc=xr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Az=xr&&/Android/.test(navigator.userAgent),DT=xr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Gh=xr&&Az&&DT,Ip=xr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&fr&&!DT,Ez=0,Mz=1,Rz=2,Nz=1,_z=2,Dz=4,Oz=8,Fz=16,Bz=32,zz=64,wv=128,$z=2047,Hz=1,Uz=2,Kz=3,Vz=4,qz=5,Wz=6,mc=bp||Tc||Ip?"\xA0":"\u200B",Sp=`
3690
+ `},vB={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 xB(e){let{announcements:t=vB,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=hB}=e,{announce:a,announcement:i}=A0(),s=fs("DndLiveRegion"),[l,d]=G(!1);if(q(()=>{d(!0)},[]),mB(H(()=>({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=mn.createElement(mn.Fragment,null,mn.createElement(P0,{id:o,value:r.draggable}),mn.createElement(E0,{id:s,announcement:i}));return n?(0,gs.createPortal)(c,n):c}var zn;(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"})(zn||(zn={}));function Yf(){}function Xh(e,t){return H(()=>({sensor:e,options:t??{}}),[e,t])}function q0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return H(()=>[...t].filter(o=>o!=null),[...t])}var Sr=Object.freeze({x:0,y:0});function V0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function W0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function yB(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function M0(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 Yh(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function R0(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 G0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=R0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=V0(R0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(W0)},j0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=M0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=M0(l),c=r.reduce((p,m,h)=>p+V0(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(W0)};function CB(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 bB=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=CB(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(yB)};function IB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Q0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Sr}function SB(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 wB=SB(1);function TB(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 LB(e,t,n){let o=TB(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 kB={ignoreTransform:!1};function xs(e,t){t===void 0&&(t=kB);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Lo(e).getComputedStyle(e);d&&(n=LB(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 N0(e){return xs(e,{ignoreTransform:!0})}function PB(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function EB(e,t){return t===void 0&&(t=Lo(e).getComputedStyle(e)),t.position==="fixed"}function AB(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 Sc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(Gf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!wl(r)||Hh(r)||n.includes(r))return n;let a=Lo(e).getComputedStyle(r);return r!==e&&AB(r,a)&&n.push(r),EB(r,a)?n:o(r.parentNode)}return e?o(e):n}function X0(e){let[t]=Sc(e,1);return t??null}function Uh(e){return!gc||!e?null:cs(e)?e:Wf(e)?Gf(e)||e===us(e).scrollingElement?window:wl(e)?e:null:null}function Y0(e){return cs(e)?e.scrollX:e.scrollLeft}function J0(e){return cs(e)?e.scrollY:e.scrollTop}function Vh(e){return{x:Y0(e),y:J0(e)}}var Vn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Vn||(Vn={}));function Z0(e){return!gc||!e?!1:e===document.scrollingElement}function ew(e){let t={x:0,y:0},n=Z0(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 MB={x:.2,y:.2};function RB(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=MB);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=ew(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 NB(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 tw(e){return e.reduce((t,n)=>ps(t,Vh(n)),Sr)}function _B(e){return e.reduce((t,n)=>t+Y0(n),0)}function DB(e){return e.reduce((t,n)=>t+J0(n),0)}function OB(e,t){if(t===void 0&&(t=xs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);X0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var FB=[["x",["left","right"],_B],["y",["top","bottom"],DB]],Cc=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=Sc(n),r=tw(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of FB)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 BB(e){let{EventTarget:t}=Lo(e);return e instanceof t?e:us(e)}function Kh(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 ir;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ir||(ir={}));function _0(e){e.preventDefault()}function zB(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 nw={start:[mt.Space,mt.Enter],cancel:[mt.Esc],end:[mt.Space,mt.Enter,mt.Tab]},$B=(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}}},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(Lo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ir.Resize,this.handleCancel),this.windowListeners.add(ir.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ir.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&OB(o),n(Sr)}handleKeyDown(t){if(vc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=nw,coordinateGetter:i=$B,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}:Sr;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}=ew(g),L=NB(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,A=v===mt.Down&&!w||v===mt.Up&&!x;if(T&&I.x!==f.x){let E=g.scrollLeft+p.x,N=v===mt.Right&&E<=k.x||v===mt.Left&&E>=S.x;if(N&&!p.y){g.scrollTo({left:E,behavior:s});return}N?m.x=g.scrollLeft-E: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(A&&I.y!==f.y){let E=g.scrollTop+p.y,N=v===mt.Down&&E<=k.y||v===mt.Up&&E>=S.y;if(N&&!p.x){g.scrollTo({top:E,behavior:s});return}N?m.y=g.scrollTop-E: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,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=nw,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 D0(e){return!!(e&&"distance"in e)}function O0(e){return!!(e&&"delay"in e)}var bc=class{constructor(t,n,o){var r;o===void 0&&(o=BB(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(Lo(i)),this.initialCoordinates=(r=xc(a))!=null?r:Sr,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(ir.Resize,this.handleCancel),this.windowListeners.add(ir.DragStart,_0),this.windowListeners.add(ir.VisibilityChange,this.handleCancel),this.windowListeners.add(ir.ContextMenu,_0),this.documentListeners.add(ir.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(O0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(D0(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(ir.Click,zB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ir.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=xc(t))!=null?n:Sr,d=ms(r,l);if(!o&&s){if(D0(s)){if(s.tolerance!=null&&Kh(d,s.tolerance))return this.handleCancel();if(Kh(d,s.distance))return this.handleStart()}if(O0(s)&&Kh(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()}},HB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Pl=class extends bc{constructor(t){let{event:n}=t,o=us(n.target);super(t,HB,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 UB={move:{name:"mousemove"},end:{name:"mouseup"}},Wh;(function(e){e[e.RightClick=2]="RightClick"})(Wh||(Wh={}));var Gh=class extends bc{constructor(t){super(t,UB,us(t.event.target))}};Gh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Wh.RightClick?!1:(o?.({event:n}),!0)}}];var qh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},jh=class extends bc{constructor(t){super(t,qh)}static setup(){return window.addEventListener(qh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(qh.move.name,t)};function t(){}}};jh.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 yc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(yc||(yc={}));var Jf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Jf||(Jf={}));function KB(e){let{acceleration:t,activator:n=yc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=Jf.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=VB({delta:f,disabled:!a}),[h,g]=T0(),v=_({x:0,y:0}),x=_({x:0,y:0}),y=H(()=>{switch(n){case yc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case yc.DraggableRect:return r}},[n,r,l]),C=_(null),w=$(()=>{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=H(()=>s===Jf.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:A}=RB(S,I,y,t,p);for(let E of["x","y"])m[E][T[E]]||(A[E]=0,T[E]=0);if(A.x>0||A.y>0){g(),C.current=S,h(w,i),v.current=A,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 qB={x:{[Vn.Backward]:!1,[Vn.Forward]:!1},y:{[Vn.Backward]:!1,[Vn.Forward]:!1}};function VB(e){let{delta:t,disabled:n}=e,o=Qf(t);return Ll(r=>{if(n||!o||!r)return qB;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 WB(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 GB(e,t){return H(()=>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 Ic;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ic||(Ic={}));var Qh;(function(e){e.Optimized="optimized"})(Qh||(Qh={}));var F0=new Map;function jB(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=$(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 F0;if(!x||x===F0||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 Cc(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 Ic.Always:return!1;case Ic.BeforeDragging:return n;default:return!n}}}function ow(e,t){return Ll(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function QB(e,t){return ow(e,t)}function XB(e){let{callback:t,disabled:n}=e,o=jf(t),r=H(()=>{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 Zf(e){let{callback:t,disabled:n}=e,o=jf(t),r=H(()=>{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 YB(e){return new Cc(xs(e),e)}function B0(e,t,n){t===void 0&&(t=YB);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=XB({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=Zf({callback:a});return ar(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function JB(e){let t=ow(e);return Q0(e,t)}var z0=[];function ZB(e){let t=_(e),n=Ll(o=>e?o&&o!==z0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Sc(e):z0,[e]);return q(()=>{t.current=e},[e]),n}function ez(e){let[t,n]=G(null),o=_(e),r=$(a=>{let i=Uh(a.target);i&&n(s=>s?(s.set(i,Vh(i)),new Map(s)):null)},[]);return q(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Uh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,Vh(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=Uh(l);d?.removeEventListener("scroll",r)})}},[r,e]),H(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ps(a,i),Sr):tw(e):Sr,[e,t])}function $0(e,t){t===void 0&&(t=[]);let n=_(null);return q(()=>{n.current=null},t),q(()=>{let o=e!==Sr;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ms(e,n.current):Sr}function tz(e){q(()=>{if(!gc)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 nz(e,t){return H(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function rw(e){return H(()=>e?PB(e):null,[e])}var H0=[];function oz(e,t){t===void 0&&(t=xs);let[n]=e,o=rw(n?Lo(n):null),[r,a]=G(H0);function i(){a(()=>e.length?e.map(l=>Z0(l)?o:new Cc(t(l),l)):H0)}let s=Zf({callback:i});return ar(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function rz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return wl(t)?t:e}function az(e){let{measure:t}=e,[n,o]=G(null),r=$(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=Zf({callback:r}),i=$(d=>{let c=rz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=hc(i);return H(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var iz=[{sensor:Pl,options:{}},{sensor:kl,options:{}}],sz={current:{}},Xf={draggable:{measure:N0},droppable:{measure:N0,strategy:Ic.WhileDragging,frequency:Qh.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}},lz={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:Yf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xf,measureDroppableContainers:Yf,windowRect:null,measuringScheduled:!1},dz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Yf,draggableNodes:new Map,over:null,measureDroppableContainers:Yf},ep=Ut(dz),aw=Ut(lz);function cz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vs}}}function uz(e,t){switch(t.type){case zn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case zn.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 zn.DragEnd:case zn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case zn.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 zn.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 zn.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 fz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=cn(ep),a=Qf(o),i=Qf(n?.id);return q(()=>{if(!t&&!o&&a&&i!=null){if(!vc(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=k0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function pz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function mz(e){return H(()=>({draggable:{...Xf.draggable,...e?.draggable},droppable:{...Xf.droppable,...e?.droppable},dragOverlay:{...Xf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function gz(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;ar(()=>{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=Q0(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=X0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var iw=Ut({...Sr,scaleX:1,scaleY:1}),vi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(vi||(vi={}));var sw=ce(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=iz,collisionDetection:f=bB,measuring:p,modifiers:m,...h}=t,g=ri(uz,void 0,cz),[v,x]=g,[y,C]=gB(),[w,k]=G(vi.Uninitialized),S=w===vi.Initialized,{draggable:{active:L,nodes:I,translate:T},droppable:{containers:A}}=v,E=L!=null?I.get(L):null,N=_({initial:null,translated:null}),R=H(()=>{var re;return L!=null?{id:L,data:(re=E?.data)!=null?re:sz,rect:N}:null},[L,E]),B=_(null),[z,U]=G(null),[O,ne]=G(null),ee=Tl(h,Object.values(h)),W=fs("DndDescribedBy",i),De=H(()=>A.getEnabled(),[A]),Ce=mz(p),{droppableRects:ue,measureDroppableContainers:Be,measuringScheduled:ge}=jB(De,{dragging:S,dependencies:[T.x,T.y],config:Ce.droppable}),le=WB(I,L),Se=H(()=>O?xc(O):null,[O]),ye=se(),te=QB(le,Ce.draggable.measure);gz({activeNode:L!=null?I.get(L):null,config:ye.layoutShiftCompensation,initialRect:te,measure:Ce.draggable.measure});let we=B0(le,Ce.draggable.measure,te),dt=B0(le?le.parentElement:null),ct=_({activatorEvent:null,active:null,activeNode:le,collisionRect:null,collisions:null,droppableRects:ue,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=A.getNodeFor((n=ct.current.over)==null?void 0:n.id),at=az({measure:Ce.dragOverlay.measure}),Vt=(o=at.nodeRef.current)!=null?o:le,it=S?(r=at.rect)!=null?r:we:null,Ae=!!(at.nodeRef.current&&at.rect),Oe=JB(Ae?null:we),Ue=rw(Vt?Lo(Vt):null),et=ZB(S?lt??le:null),Me=oz(et),Te=pz(m,{transform:{x:T.x-Oe.x,y:T.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:O,active:R,activeNodeRect:we,containerNodeRect:dt,draggingNodeRect:it,over:ct.current.over,overlayNodeRect:at.rect,scrollableAncestors:et,scrollableAncestorRects:Me,windowRect:Ue}),ht=Se?ps(Se,T):null,Wt=ez(et),fn=$0(Wt),Ft=$0(Wt,[we]),en=ps(Te,fn),tn=it?wB(it,Te):null,Rt=R&&tn?f({active:R,collisionRect:tn,droppableRects:ue,droppableContainers:De,pointerCoordinates:ht}):null,Un=Yh(Rt,"id"),[kn,pn]=G(null),Pn=Ae?Te:ps(Te,Ft),Pt=IB(Pn,(a=kn?.rect)!=null?a:null,we),ln=_(null),Dn=$((re,de)=>{let{sensor:tt,options:vt}=de;if(B.current==null)return;let gn=I.get(B.current);if(!gn)return;let xt=re.nativeEvent,jt=new tt({active:B.current,activeNode:gn,event:xt,options:vt,context:ct,onAbort(bt){if(!I.get(bt))return;let{onDragAbort:ut}=ee.current,ft={id:bt};ut?.(ft),y({type:"onDragAbort",event:ft})},onPending(bt,me,ut,ft){if(!I.get(bt))return;let{onDragPending:Qe}=ee.current,wt={id:bt,constraint:me,initialCoordinates:ut,offset:ft};Qe?.(wt),y({type:"onDragPending",event:wt})},onStart(bt){let me=B.current;if(me==null)return;let ut=I.get(me);if(!ut)return;let{onDragStart:ft}=ee.current,Qt={activatorEvent:xt,active:{id:me,data:ut.data,rect:N}};(0,gs.unstable_batchedUpdates)(()=>{ft?.(Qt),k(vi.Initializing),x({type:zn.DragStart,initialCoordinates:bt,active:me}),y({type:"onDragStart",event:Qt}),U(ln.current),ne(xt)})},onMove(bt){x({type:zn.DragMove,coordinates:bt})},onEnd:nn(zn.DragEnd),onCancel:nn(zn.DragCancel)});ln.current=jt;function nn(bt){return async function(){let{active:ut,collisions:ft,over:Qt,scrollAdjustedTranslate:Qe}=ct.current,wt=null;if(ut&&Qe){let{cancelDrop:bn}=ee.current;wt={activatorEvent:xt,active:ut,collisions:ft,delta:Qe,over:Qt},bt===zn.DragEnd&&typeof bn=="function"&&await Promise.resolve(bn(wt))&&(bt=zn.DragCancel)}B.current=null,(0,gs.unstable_batchedUpdates)(()=>{x({type:bt}),k(vi.Uninitialized),pn(null),U(null),ne(null),ln.current=null;let bn=bt===zn.DragEnd?"onDragEnd":"onDragCancel";if(wt){let Tt=ee.current[bn];Tt?.(wt),y({type:bn,event:wt})}})}}},[I]),io=$((re,de)=>(tt,vt)=>{let gn=tt.nativeEvent,xt=I.get(vt);if(B.current!==null||!xt||gn.dndKit||gn.defaultPrevented)return;let jt={active:xt};re(tt,de.options,jt)===!0&&(gn.dndKit={capturedBy:de.sensor},B.current=vt,Dn(tt,de))},[I,Dn]),Gt=GB(c,io);tz(c),ar(()=>{we&&w===vi.Initializing&&k(vi.Initialized)},[we,w]),q(()=>{let{onDragMove:re}=ee.current,{active:de,activatorEvent:tt,collisions:vt,over:gn}=ct.current;if(!de||!tt)return;let xt={active:de,activatorEvent:tt,collisions:vt,delta:{x:en.x,y:en.y},over:gn};(0,gs.unstable_batchedUpdates)(()=>{re?.(xt),y({type:"onDragMove",event:xt})})},[en.x,en.y]),q(()=>{let{active:re,activatorEvent:de,collisions:tt,droppableContainers:vt,scrollAdjustedTranslate:gn}=ct.current;if(!re||B.current==null||!de||!gn)return;let{onDragOver:xt}=ee.current,jt=vt.get(Un),nn=jt&&jt.rect.current?{id:jt.id,rect:jt.rect.current,data:jt.data,disabled:jt.disabled}:null,bt={active:re,activatorEvent:de,collisions:tt,delta:{x:gn.x,y:gn.y},over:nn};(0,gs.unstable_batchedUpdates)(()=>{pn(nn),xt?.(bt),y({type:"onDragOver",event:bt})})},[Un]),ar(()=>{ct.current={activatorEvent:O,active:R,activeNode:le,collisionRect:tn,collisions:Rt,droppableRects:ue,draggableNodes:I,draggingNode:Vt,draggingNodeRect:it,droppableContainers:A,over:kn,scrollableAncestors:et,scrollAdjustedTranslate:en},N.current={initial:it,translated:tn}},[R,le,Rt,tn,I,Vt,it,ue,A,kn,et,en]),KB({...ye,delta:T,draggingRect:tn,pointerCoordinates:ht,scrollableAncestors:et,scrollableAncestorRects:Me});let D=H(()=>({active:R,activeNode:le,activeNodeRect:we,activatorEvent:O,collisions:Rt,containerNodeRect:dt,dragOverlay:at,draggableNodes:I,droppableContainers:A,droppableRects:ue,over:kn,measureDroppableContainers:Be,scrollableAncestors:et,scrollableAncestorRects:Me,measuringConfiguration:Ce,measuringScheduled:ge,windowRect:Ue}),[R,le,we,O,Rt,dt,at,I,A,ue,kn,Be,et,Me,Ce,ge,Ue]),X=H(()=>({activatorEvent:O,activators:Gt,active:R,activeNodeRect:we,ariaDescribedById:{draggable:W},dispatch:x,draggableNodes:I,over:kn,measureDroppableContainers:Be}),[O,Gt,R,we,x,W,I,kn,Be]);return mn.createElement(K0.Provider,{value:C},mn.createElement(ep.Provider,{value:X},mn.createElement(aw.Provider,{value:D},mn.createElement(iw.Provider,{value:Pt},d)),mn.createElement(fz,{disabled:s?.restoreFocus===!1})),mn.createElement(xB,{...s,hiddenTextDescribedById:W}));function se(){let re=z?.autoScrollEnabled===!1,de=typeof l=="object"?l.enabled===!1:l===!1,tt=S&&!re&&!de;return typeof l=="object"?{...l,enabled:tt}:{enabled:tt}}}),hz=Ut(null),U0="button",vz="Draggable";function lw(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=fs(vz),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=cn(ep),{role:m=U0,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=cn(v?iw:hz),[y,C]=hc(),[w,k]=hc(),S=nz(i,t),L=Tl(n);ar(()=>(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=H(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":v&&m===U0?!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 dw(){return cn(aw)}var xz="Droppable",yz={timeout:25};function cw(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=fs(xz),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=cn(ep),c=_({disabled:n}),f=_(!1),p=_(null),m=_(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...yz,...r},x=Tl(g??o),y=$(()=>{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=Zf({callback:y,disabled:h||!i}),w=$((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[k,S]=hc(w),L=Tl(t);return q(()=>{!C||!k.current||(C.disconnect(),f.current=!1,C.observe(k.current))},[k,C]),q(()=>(s({type:zn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:k,rect:p,data:L}}),()=>s({type:zn.UnregisterDroppable,key:a,id:o})),[o]),q(()=>{n!==c.current.disabled&&(s({type:zn.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}}pe();function uw(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Cz(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function tp(e){return e!==null&&e>=0}function bz(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 Iz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var fw=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=uw(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 np={scaleX:1,scaleY:1},pw=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,...np}:null}let l=Sz(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...np}:r<n&&r>=i?{x:0,y:s.height+l,...np}:{x:0,y:0,...np}};function Sz(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 mw="Sortable",gw=mn.createContext({activeIndex:-1,containerId:mw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fw,disabled:{draggable:!1,droppable:!1}});function hw(e){let{children:t,id:n,items:o,strategy:r=fw,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=dw(),f=fs(mw,n),p=s.rect!==null,m=H(()=>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=!bz(m,x.current),C=v!==-1&&g===-1||y,w=Iz(a);ar(()=>{y&&h&&c(m)},[y,m,h,c]),q(()=>{x.current=m},[m]);let k=H(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:Cz(m,l),strategy:r}),[g,f,w.draggable,w.droppable,C,m,v,l,p,r]);return mn.createElement(gw.Provider,{value:k},t)}var wz=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return uw(n,o,r).indexOf(t)},Tz=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},Lz={duration:200,easing:"ease"},vw="transform",kz=hi.Transition.toString({property:vw,duration:0,easing:"linear"}),Pz={roleDescription:"sortable"};function Ez(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=G(null),s=_(n);return ar(()=>{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 xw(e){let{animateLayoutChanges:t=Tz,attributes:n,disabled:o,data:r,getNewIndex:a=wz,id:i,strategy:s,resizeObserverConfig:l,transition:d=Lz}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=cn(gw),C=Az(o,m),w=c.indexOf(i),k=H(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=H(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:I,isOver:T,setNodeRef:A}=cw({id:i,data:k,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:E,activatorEvent:N,activeNodeRect:R,attributes:B,setNodeRef:z,listeners:U,isDragging:O,over:ne,setActivatorNodeRef:ee,transform:W}=lw({id:i,data:k,attributes:{...Pz,...n},disabled:C.draggable}),De=w0(A,z),Ce=!!E,ue=Ce&&!h&&tp(p)&&tp(v),Be=!x&&O,ge=Be&&ue?W:null,Se=ue?ge??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:w}):null,ye=tp(p)&&tp(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,te=E?.id,we=_({activeId:te,items:c,newIndex:ye,containerId:f}),dt=c!==we.current.items,ct=t({active:E,containerId:f,isDragging:O,isSorting:Ce,id:i,index:w,items:c,newIndex:we.current.newIndex,previousItems:we.current.items,previousContainerId:we.current.containerId,transition:d,wasDragging:we.current.activeId!=null}),lt=Ez({disabled:!ct,index:w,node:I,rect:L});return q(()=>{Ce&&we.current.newIndex!==ye&&(we.current.newIndex=ye),f!==we.current.containerId&&(we.current.containerId=f),c!==we.current.items&&(we.current.items=c)},[Ce,ye,f,c]),q(()=>{if(te===we.current.activeId)return;if(te!=null&&we.current.activeId==null){we.current.activeId=te;return}let Vt=setTimeout(()=>{we.current.activeId=te},50);return()=>clearTimeout(Vt)},[te]),{active:E,activeIndex:p,attributes:B,data:k,rect:L,index:w,newIndex:ye,items:c,isOver:T,isSorting:Ce,isDragging:O,listeners:U,node:I,overIndex:v,over:ne,setNodeRef:De,setActivatorNodeRef:ee,setDroppableNodeRef:A,setDraggableNodeRef:z,transform:lt??Se,transition:at()};function at(){if(lt||dt&&we.current.newIndex===w)return kz;if(!(Be&&!vc(N)||!d)&&(Ce||ct))return hi.Transition.toString({...d,property:vw})}}function Az(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 op(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 Mz=[mt.Down,mt.Right,mt.Up,mt.Left],yw=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(Mz.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=Yh(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=Sc(h).some((S,L)=>s[L]!==S),x=Cw(f,p),y=Rz(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 Cw(e,t){return!op(e)||!op(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Rz(e,t){return!op(e)||!op(t)||!Cw(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Nz(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 bw=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:Nz(n,t,r)},Iw=e=>{let{transform:t}=e;return{...t,x:0}};pe();pe();var rp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function Sw(e){return`(min-width: ${typeof e=="number"?e:rp[e]}px)`}function ww(e){return`(max-width: ${(typeof e=="number"?e:rp[e])-1}px)`}function _z(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(Sw(e.min)),e.max!=null&&n.push(ww(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 rp&&t.push(ww(o))}else n in rp&&t.push(Sw(n));return t.length>0?t.join(" and "):e}function Dz(){return!1}function ap(e){let t=_z(e),n=$(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=$(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return Ca(n,o,Dz)}pe();var fo=new Map;function Oz(e,t,n){return`${e}\0${t}\0${n??"none"}`}function Jh(e,t){fo.delete(e),fo.set(e,t)}function El(e,t){if(fo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,fo.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 Fz(e){if(fo.size<=100)return;let t=Array.from(fo);for(let[n,o]of t){if(fo.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||El(n,o)}for(let[n,o]of t){if(fo.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||El(n,o)}}function ip(){queueMicrotask(()=>Fz())}function Tw(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Oz(e,n.intentId,a),s=fo.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 fo.set(i,d),l}function Lw(e,t){let n=fo.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:()=>El(e,n)})),n.committed=!0,Jh(e,n),n.listeners.add(t),ip(),()=>{n.listeners.delete(t),ip()}):()=>{}}function ys(e,t){let n=fo.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,Jh(e,n);for(let r of n.listeners)r()}}function sp(e){return fo.get(e)?.state}function kw(e){let t=fo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,Jh(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){El(e,t);return}ip()}}}function lp(e){let t=fo.get(e);t&&El(e,t)}function Pw(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 fo)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&El(o,r);ip()}function Ew({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=uo(),c=Tw(n,o,e,a,i),f=Ca(E=>Lw(c.key,E),()=>sp(c.key)??c,()=>sp(c.key)??c),{key:p,text:m,retained:h,added:g,saving:v,error:x}=f,y=_(null),C=a.useUploadStatuses(),w=H(()=>h.map(E=>E.id),[h]),k=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;q(()=>{t===void 0&&(lp(p),l())},[t,p,l]);let L=()=>{v||(lp(p),l())},I=E=>{if(v||r||S)return;let N=null,R=[...g];for(let B of E){let z=B.type||"application/octet-stream";if(h.length+R.length>=a.limits.maxAttachments||B.size===0||B.size>a.maxAttachmentBytes(z)){N=d("turnQueue.attachmentLimit",{name:B.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(z))});continue}let U=a.makeImageAttachment({id:a.randomUUID(),name:B.name,mimeType:z,sizeBytes:B.size,file:B});R.push(U),a.startUpload({environmentId:o,image:U})}ys(p,B=>({...B,added:R,error:N}))},T=async()=>{let E=sp(p);if(!E||E.saving||r||S||!E.text.trim()&&E.retained.length+E.added.length===0)return;let N=kw(p);if(N!==null){ys(p,R=>({...R,saving:!0,error:null}));try{await a.awaitUploads(E.added.map(B=>B.id));let R=a.getUploadedAttachments({environmentId:o,images:E.added});if(!R)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:E.text,attachments:[...E.retained,...R]}),lp(p),l()}catch(R){ys(p,B=>({...B,saving:!1,error:R instanceof Error?R.message:d("turnQueue.actionFailed")}))}finally{N()}}},A=[...h.map((E,N)=>({...E,previewUrl:k[N],added:!1})),...g.map(E=>({...E,added:!0}))];return u(yf,{open:!0,onOpenChange:E=>{E||L()},children:b(Sf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(If,{children:[u(wf,{children:d("turnQueue.editTitle")}),u(Cf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:E=>{E.dataTransfer.types.includes("Files")&&E.preventDefault()},onDrop:E=>{E.dataTransfer.files.length&&(E.preventDefault(),E.stopPropagation(),I(Array.from(E.dataTransfer.files)))},children:[u(AI,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:E=>ys(p,N=>({...N,text:E.target.value})),onPaste:E=>{E.clipboardData.files.length&&(E.preventDefault(),I(Array.from(E.clipboardData.files)))},onKeyDown:E=>{(E.metaKey||E.ctrlKey)&&E.key==="Enter"&&!E.nativeEvent.isComposing&&(E.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:A.map(E=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[E.type==="image"&&E.previewUrl?u("img",{src:E.previewUrl,alt:E.name,className:"size-12 rounded object-cover"}):u(_o,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:E.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(E.sizeBytes)}),E.added&&C.get(E.id)!=="ready"?u("p",{children:d(C.get(E.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,E.added&&C.get(E.id)==="failed"?u(oe,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let N=g.find(R=>R.id===E.id);N&&a.retryUpload({environmentId:o,image:N})},children:d("turnQueue.retryUpload")}):null]}),u(oe,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:E.name}),disabled:v||S,onClick:()=>{E.added?(a.releaseUpload(E.id),E.previewUrl&&URL.revokeObjectURL(E.previewUrl),ys(p,N=>({...N,added:N.added.filter(R=>R.id!==E.id)}))):ys(p,N=>({...N,retained:N.retained.filter(R=>R.id!==E.id)}))},children:u(Yt,{className:"size-3.5"})})]},E.id))}),u("input",{ref:y,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:E=>{I(Array.from(E.target.files??[])),E.target.value=""}}),b(oe,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>y.current?.click(),children:[u(_o,{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(bf,{children:[u(oe,{variant:"ghost",disabled:v,onClick:L,children:d("turnQueue.discardEdit")}),u(oe,{disabled:v||r||S||!m.trim()&&A.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function Aw(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 Mw(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return Aw(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function Rw(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:Aw(e,t),settled:!1}}pe();pe();function Bz({entry:e,unavailable:t,onCancel:n}){let{t:o}=uo(),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(oe,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(oe,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(oe,{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 Nw({entries:e,unavailable:t,onCancel:n}){let{t:o}=uo(),[r,a]=G(!1),i=jr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(oe,{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(Bz,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function Zh({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=uo(),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(oe,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(xe,{children:[u(oe,{size:"xs",variant:"outline",disabled:h,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(NI,{open:p,onOpenChange:T=>{T||m(!1)},children:b(BI,{className:"max-w-lg",children:[b(FI,{children:[u(zI,{children:a("turnQueue.stopWaiting")}),u(DI,{children:a("turnQueue.abandonDescription")})]}),b(OI,{children:[u(_I,{render:u(oe,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(oe,{variant:"outline",disabled:h||t,onClick:()=>{k()},children:a(h?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(Nw,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var zz=[Iw,bw];function $z({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=uo(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:h}=xw({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:hi.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(oe,{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($d,{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 _w({inputKey:e,entries:t,environmentId:n,unavailable:o,attachments:r,actions:a,onCancel:i}){let{t:s}=uo(),l=ap("(prefers-reduced-motion: reduce)"),[d,c]=Ln("turn-queue:editing",e,null),[f,p]=Ln("turn-queue:pending",e,!1),m=Rn("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=Rn("turn-queue:reorder-ref",e,!1),[k,S]=Ln("turn-queue:feedback",e,null),L=q0(Xh(Pl,{activationConstraint:{distance:5}}),Xh(kl,{coordinateGetter:yw,scrollBehavior:l?"auto":"smooth"})),I=H(()=>t.filter(O=>O.waiting),[t]),T=y?Rw(I,y.preview):null,A=T?.entries??I,E=o||f||y!==null,N=A.findIndex(O=>O.intentId===v?.activeId),R=A.findIndex(O=>O.intentId===v?.overId);q(()=>{Pw(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(ne=>ne===k?null:ne),1600);return()=>window.clearTimeout(O)},[k]);let B=async O=>{if(!(m.current||w.current||o)){m.current=!0,p(!0),g(null),S(null);try{await O()}catch(ne){g(ne instanceof Error?ne.message:s("turnQueue.actionFailed"))}finally{m.current=!1,p(!1)}}},z=(O,ne)=>B(async()=>{let ee=Mw(I,O.intentId,ne);if(!(ee===null||!O.management?.canReorder)){w.current=!0,C({preview:ee,acknowledged:!1});try{await a.onReorder(O,ne),C(W=>W?.preview===ee?{...W,acknowledged:!0}:W)}catch(W){throw w.current=!1,C(null),S({intentId:O.intentId,kind:"failed"}),W}}}),U=o?s("turnQueue.disconnected"):y!==null?s("turnQueue.saving"):v!==null?`${s("turnQueue.dragStarted")} ${R+1}/${A.length}`:k?.kind==="saved"?s("common.action.done"):k?.kind==="cancelled"?s("turnQueue.dragCancelled"):"";return b(xe,{children:[A.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:A.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:U})]}),u(sw,{sensors:L,collisionDetection:G0,modifiers:zz,accessibility:{screenReaderInstructions:{draggable:s("turnQueue.dragInstructions")},announcements:{onDragStart:()=>s("turnQueue.dragStarted"),onDragOver:({over:O})=>{let ne=A.findIndex(ee=>ee.intentId===O?.id);return ne<0?void 0:`${s("turnQueue.dragStarted")} ${ne+1}/${A.length}`},onDragEnd:()=>s("turnQueue.dragFinished"),onDragCancel:()=>s("turnQueue.dragCancelled")}},onDragStart:({active:O})=>{let ne=A.find(ee=>ee.intentId===O.id);!ne?.management?.canReorder||E||(g(null),S(null),x({activeId:ne.intentId,overId:ne.intentId}))},onDragOver:({over:O})=>{let ne=A.find(ee=>ee.intentId===O?.id);ne&&x(ee=>ee&&{...ee,overId:ne.intentId})},onDragCancel:()=>{v&&S({intentId:v.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:O,over:ne})=>{if(x(null),!ne||O.id===ne.id)return;let ee=A.findIndex(ue=>ue.intentId===O.id),W=A.findIndex(ue=>ue.intentId===ne.id),De=A[ee];if(!De?.management?.canReorder||W<0)return;let Ce=A[W+(ee<W?1:0)]?.intentId??null;z(De,Ce)},children:u(hw,{items:A.map(O=>O.intentId),strategy:pw,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:A.map((O,ne)=>b($z,{entry:O,disabled:!O.management?.canReorder||E,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}/${A.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(_o,{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(oe,{size:"icon-xs",variant:"ghost",disabled:!O.management||E||v!==null,"aria-label":s("turnQueue.editMessage"),title:s("turnQueue.editMessage"),onClick:()=>c(O),children:u(jd,{className:"size-3.5"})}),O.management?.canSteer?u(oe,{size:"icon-xs",variant:"ghost",disabled:E||v!==null,"aria-label":s("turnQueue.steer"),title:s("turnQueue.steerDescription"),onClick:()=>{B(()=>a.onRun(O,"steer"))},children:u(Qd,{className:"size-3.5"})}):null,b(Zo,{children:[u(nr,{render:u(oe,{size:"icon-xs",variant:"ghost",disabled:E||!O.management||v!==null,"aria-label":s("turnQueue.messageActions")}),children:u(Jo,{className:"size-4"})}),b(tr,{align:"end",children:[b(er,{disabled:!O.management?.canReorder||ne===0,onClick:()=>{z(O,A[ne-1].intentId)},children:[u(Ad,{className:"size-4"}),s("turnQueue.moveUp")]}),b(er,{disabled:!O.management?.canReorder||ne===A.length-1,onClick:()=>{z(O,A[ne+2]?.intentId??null)},children:[u(Pd,{className:"size-4"}),s("turnQueue.moveDown")]}),O.management?.canSteer?u(er,{onClick:()=>{B(()=>a.onRun(O,"steer"))},children:s("turnQueue.steer")}):null,u(er,{disabled:!O.management?.canRun,onClick:()=>{B(()=>a.onRun(O,"interrupt"))},children:s(O.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(ui,{}),u(er,{disabled:O.action!=="cancel",onClick:()=>{B(()=>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(Ew,{entry:d,current:t.find(O=>O.intentId===d.intentId),inputKey:e,environmentId:n,unavailable:E,attachments:r,watchEditorAuthority:a.watchEditorAuthority,onEdit:a.onEdit,onClose:()=>c(null)},`${e}\0${d.intentId}\0${d.management?.revision??"none"}`):null]})}pe();var ev=220,Hz={opacity:0,transform:"translate3d(0, 4rem, 0)"},Uz={opacity:0,transform:"translate3d(0, 7rem, 0)"},Dw={opacity:1,transform:"none"},Ow={transition:`transform ${ev}ms ease-in, opacity ${ev}ms ease-in`},Kz={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function Bw({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?.()},ev))};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)]",Kz[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:{...Ow,...a===i.id?Hz:Dw},children:u(Fw,{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:{...Ow,...a===p.id?Uz:Dw},children:u(Fw,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function Fw({item:e,attached:t,exiting:n,onDismissRequest:o}){let r=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(oc,{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(gh,{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(rc,{className:F("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(oe,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss notice",disabled:n,onClick:o,children:u(Yt,{})}):null]}):null]}):b(oc,{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(gh,{children:e.title}),e.description?u(Lf,{children:e.description}):null,e.actions||e.onDismiss?b(rc,{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(oe,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss warning",disabled:n,onClick:o,children:u(Yt,{})}):null]}):null]})}function zw({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u(Bw,{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)]"})]})})}var qz=["image/gif","image/jpeg","image/png","image/webp"],Vz=new Set(qz);function tv(e){return Vz.has(e.toLowerCase())}function Wz(e){return tv(e)?"image":"file"}var Gz=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function nv(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||Gz.has(t)?"text":"file"}function ov(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 rv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return Wz(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var jz=new Set(["claudeAgent","cursor","grok","dsh","acp"]),$w=e=>jz.has(e)?"in-session":"next-turn";function Qz(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function Xz(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function Yz(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function wc(e){return`[${Xz(Qz(e))}](${Yz(e)})`}pe();var Jz=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,Zz=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var e5=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),t5=/^[A-Za-z][A-Za-z0-9+.-]*:/,n5=/^[A-Za-z]:[\\/]/,o5=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function r5(e){let t=[];for(let n of e.matchAll(e5)){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=t5.test(s)&&!n5.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(Zz)){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&&o5.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 Tc(e,t={}){let n=r5(e);for(let o of e.matchAll(Jz)){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 a5(e){return e.replace(/\r\n/g,`
3691
+ `).replace(/^\n+|\n+$/g,"")}function i5(e){return a5(e.text).length>0}function Hw(e){return!i5(e)}function s5(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function Uw(e){return`${e.terminalLabel} (${s5(e)})`}function Kw(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 Vw(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 l5(e,t){return Vw(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function d5(e,t){return l5(e,(n,o)=>{for(let r of Tc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function c5(e){let t=[];if(!e)return t;let n=Tc(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 av(e,t,n){return!e||t>=n?!1:d5(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&Kw(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&Kw(t,n,l))})}function Cs(e,t=[]){if(!e)return[];let n=[],o=0;return Vw(e,r=>r.type==="text"?(n.push(...c5(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function Gw(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:"foreground"}var Ww=e=>e.type!=="text";function iv(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function u5(e){return e===" "||e===`
3692
+ `||e===" "||e==="\r"||e==="\uFFFC"}function f5(e,t){let n=t-1;for(;n>=0&&!u5(e[n]??"");)n-=1;return n+1}function wr(e,t){let n=iv(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 Qw(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 sr(e,t){return Qw(Cs(e),t)}function lr(e,t){let n=iv(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 Lc(e,t,n){let o=Cs(e);if(!o.some(Ww))return!1;let r=Qw(o,t),a=0;for(let i of o){if(Ww(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=jw(i)}return!1}function dr(e,t){let n=iv(e,t),o=e.lastIndexOf(`
3693
+ `,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=f5(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 Xw(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 Yw="Ask for changes, send follow-ups, or attach images";var Jw="application/x-ycodium-composer-mention";function sv(e){return e.includes(Jw)}function Zw(e){let t=n=>sv(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(Jw);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}pe();var lv=ce(function(t){let{t:n}=ze();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(oe,{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]})});pe();function p5(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function m5(e){let t=p5(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 eT(e){let t=m5(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}pe();var tT=Ut(null),nT=tT.Provider;function _t(){let e=cn(tT);if(e===null)throw new Error("Composer API has not been provided.");return e}var oT=90;function rT(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function g5(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>oT?`${n.slice(0,oT)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var aT=ce(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=ze(),s=_t(),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(Pf,{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(oe,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(Yt,{className:"size-3"})})}),u(Mf,{className:"max-h-64 scroll-pb-6",children:u(Ef,{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(Af,{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:g5(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):rT(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:rT(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:eT(p.createdAt)}),u(oe,{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(Yt,{className:"stroke-2"})})]},p.id))})})]})})});pe();function sT(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 iT({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:sT(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 dv=ce(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=ze();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(oe,{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(iT,{steps:s}),b("span",{className:F("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(oe,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Yt,{"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(iT,{className:"w-20",steps:s})]}),u(oe,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Yt,{"aria-hidden":!0,className:"size-3"})})]})}),lT=ce(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=ze();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(oe,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(Yt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:sT(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 dT(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 dp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function cT(e){switch(e){case"image":return Yi;case"pdf":return Xi;case"text":return Qi;case"file":return _o}}var uT="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",fT=`${uT} border border-border/70 bg-accent/40 text-foreground`,h5=`${fT} text-[12px]`,yi=`${fT} text-[0.86em] select-none`,cp="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-['']",ta="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",pT="truncate leading-tight",na="block self-center truncate leading-tight select-none",mT=`${uT} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,gT='<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>',up="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 v5(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(`
3694
+ `)}function x5({context:e,onRemove:t}){let{t:n}=ze(),o=_t().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Xe,{children:[u(Je,{render:b("span",{className:F(yi,"pr-1"),children:[u(Yr,{className:F(ta,"size-icon-1")}),u("span",{className:na,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:up,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(Yt,{className:"size-3","aria-hidden":!0})})]})}),u(Ye,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:v5(e,o.formatLabel,o.formatSourceLabel)})]})}function hT({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(x5,{context:o,onRemove:t},o.id))})}function vT({comments:e,onRemove:t,className:n}){let{t:o}=ze();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(yi,"pr-1"),children:[u(Zi,{className:F(ta,"size-icon-1")}),u("span",{className:na,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:up,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(Yt,{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 fp(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 xT({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=ze(),l=_t().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(Yr,{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(fp,{icon:u(Yr,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(fp,{icon:u(Fd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(fp,{icon:u(Jr,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(fp,{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:dp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Xe,{children:[u(Je,{render:u(oe,{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(oe,{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(Yt,{className:"size-3"})})]},c.id)})})}pe();function yT(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function CT(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function bT(e,t){let n=_t().pane.useVisible(),[o,r]=G(null);he(()=>{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=yT(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&CT(o,{hasWideActions:t})}}var cv={};Mn(cv,{LexicalComposerContext:()=>IT,createLexicalComposerContext:()=>y5,useLexicalComposerContext:()=>C5});pe();var IT=Ut(null);function y5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function C5(){let e=cn(IT);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 uv=cv,ST=uv.LexicalComposerContext,wT=uv.createLexicalComposerContext,Cn=uv.useLexicalComposerContext;var $x={};Mn($x,{$addUpdateTag:()=>Yp,$applyNodeReplacement:()=>Yc,$caretFromPoint:()=>Ei,$caretRangeFromSelection:()=>Jv,$cloneWithProperties:()=>Nx,$cloneWithPropertiesEphemeral:()=>oH,$comparePointCaretNext:()=>Fx,$copyNode:()=>Mx,$create:()=>aH,$createLineBreakNode:()=>Bl,$createNodeSelection:()=>hx,$createParagraphNode:()=>Ra,$createPoint:()=>Ar,$createRangeSelection:()=>mk,$createRangeSelectionFromDom:()=>R$,$createTabNode:()=>Vp,$createTextNode:()=>Wn,$extendCaretToRange:()=>Dx,$findMatchingParent:()=>Rc,$getAdjacentChildCaret:()=>Wl,$getAdjacentNode:()=>_k,$getAdjacentSiblingOrParentSiblingCaret:()=>pH,$getCaretInDirection:()=>Ai,$getCaretRange:()=>Pi,$getCaretRangeInDirection:()=>zx,$getCharacterOffsets:()=>qv,$getChildCaret:()=>_a,$getChildCaretAtIndex:()=>Qk,$getChildCaretOrSelf:()=>qk,$getCollapsedCaretRange:()=>Vk,$getCommonAncestor:()=>Nc,$getCommonAncestorResultBranchOrder:()=>Bx,$getEditor:()=>Rx,$getNearestNodeFromDOMNode:()=>Xp,$getNearestRootOrShadowRoot:()=>Fk,$getNodeByKey:()=>Hn,$getNodeByKeyOrThrow:()=>Bk,$getNodeFromDOMNode:()=>wx,$getPreviousSelection:()=>Ms,$getRoot:()=>Ko,$getSelection:()=>St,$getSiblingCaret:()=>Yn,$getState:()=>wp,$getStateChange:()=>J5,$getTextContent:()=>D$,$getTextNodeOffset:()=>Er,$getTextPointCaret:()=>ki,$getTextPointCaretSlice:()=>Xv,$getWritableNodeState:()=>nx,$hasAncestor:()=>zp,$hasUpdateTag:()=>J$,$insertNodes:()=>_$,$isBlockElementNode:()=>M$,$isChildCaret:()=>Pr,$isDecoratorNode:()=>Jt,$isEditorState:()=>z$,$isElementNode:()=>Q,$isExtendableTextPointCaret:()=>jk,$isInlineElementOrDecoratorNode:()=>Z$,$isLeafNode:()=>Q$,$isLineBreakNode:()=>ws,$isNodeCaret:()=>lH,$isNodeSelection:()=>Gc,$isParagraphNode:()=>bk,$isRangeSelection:()=>Ke,$isRootNode:()=>oo,$isRootOrShadowRoot:()=>ur,$isSiblingCaret:()=>As,$isTabNode:()=>gx,$isTextNode:()=>Ne,$isTextPointCaret:()=>Na,$isTextPointCaretSlice:()=>fH,$isTokenOrSegmented:()=>Ea,$isTokenOrTab:()=>Ii,$nodesOfType:()=>Y$,$normalizeCaret:()=>Lr,$normalizeSelection__EXPERIMENTAL:()=>Tp,$onUpdate:()=>Ok,$parseSerializedNode:()=>B$,$removeTextFromCaretRange:()=>Gk,$rewindSiblingCaret:()=>Xl,$selectAll:()=>X$,$setCompositionKey:()=>jn,$setPointFromCaret:()=>Gl,$setSelection:()=>Fo,$setSelectionFromCaretRange:()=>Wk,$setState:()=>Z5,$splitAtPointCaretNext:()=>hH,$splitNode:()=>eH,$updateRangeSelectionFromCaretRange:()=>_c,ArtificialNode__DO_NOT_USE:()=>Fp,BEFORE_INPUT_COMMAND:()=>rx,BLUR_COMMAND:()=>GL,CAN_REDO_COMMAND:()=>u$,CAN_UNDO_COMMAND:()=>f$,CLEAR_EDITOR_COMMAND:()=>d$,CLEAR_HISTORY_COMMAND:()=>c$,CLICK_COMMAND:()=>AL,COLLABORATION_TAG:()=>rk,COMMAND_PRIORITY_CRITICAL:()=>q$,COMMAND_PRIORITY_EDITOR:()=>Rl,COMMAND_PRIORITY_HIGH:()=>K$,COMMAND_PRIORITY_LOW:()=>H$,COMMAND_PRIORITY_NORMAL:()=>U$,COMPOSITION_END_COMMAND:()=>sx,COMPOSITION_END_TAG:()=>lk,COMPOSITION_START_COMMAND:()=>ix,COMPOSITION_START_TAG:()=>sk,CONTROLLED_TEXT_INSERTION_COMMAND:()=>_l,COPY_COMMAND:()=>fx,CUT_COMMAND:()=>px,DELETE_CHARACTER_COMMAND:()=>Bc,DELETE_LINE_COMMAND:()=>$c,DELETE_WORD_COMMAND:()=>zc,DRAGEND_COMMAND:()=>VL,DRAGOVER_COMMAND:()=>qL,DRAGSTART_COMMAND:()=>KL,DROP_COMMAND:()=>UL,DecoratorNode:()=>Uc,ElementNode:()=>Ti,FOCUS_COMMAND:()=>WL,FORMAT_ELEMENT_COMMAND:()=>l$,FORMAT_TEXT_COMMAND:()=>Ci,HISTORIC_TAG:()=>C$,HISTORY_MERGE_TAG:()=>bp,HISTORY_PUSH_TAG:()=>b$,INDENT_CONTENT_COMMAND:()=>i$,INPUT_COMMAND:()=>ax,INSERT_LINE_BREAK_COMMAND:()=>Ec,INSERT_PARAGRAPH_COMMAND:()=>_v,INSERT_TAB_COMMAND:()=>a$,INTERNAL_$isBlock:()=>Ma,IS_ALL_FORMATTING:()=>N5,IS_BOLD:()=>L5,IS_CODE:()=>A5,IS_HIGHLIGHT:()=>Zv,IS_ITALIC:()=>k5,IS_STRIKETHROUGH:()=>P5,IS_SUBSCRIPT:()=>M5,IS_SUPERSCRIPT:()=>R5,IS_UNDERLINE:()=>E5,KEY_ARROW_DOWN_COMMAND:()=>OL,KEY_ARROW_LEFT_COMMAND:()=>NL,KEY_ARROW_RIGHT_COMMAND:()=>ML,KEY_ARROW_UP_COMMAND:()=>DL,KEY_BACKSPACE_COMMAND:()=>BL,KEY_DELETE_COMMAND:()=>$L,KEY_DOWN_COMMAND:()=>ux,KEY_ENTER_COMMAND:()=>Ap,KEY_ESCAPE_COMMAND:()=>zL,KEY_MODIFIER_COMMAND:()=>jL,KEY_SPACE_COMMAND:()=>FL,KEY_TAB_COMMAND:()=>HL,LineBreakNode:()=>Fl,MOVE_TO_END:()=>RL,MOVE_TO_START:()=>_L,NODE_STATE_KEY:()=>W5,OUTDENT_CONTENT_COMMAND:()=>s$,PASTE_COMMAND:()=>lx,PASTE_TAG:()=>I$,ParagraphNode:()=>Hl,REDO_COMMAND:()=>cx,REMOVE_TEXT_COMMAND:()=>Dv,RootNode:()=>$l,SELECTION_CHANGE_COMMAND:()=>ox,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>r$,SELECT_ALL_COMMAND:()=>Ov,SKIP_COLLAB_TAG:()=>S$,SKIP_DOM_SELECTION_TAG:()=>ik,SKIP_SCROLL_INTO_VIEW_TAG:()=>ak,SKIP_SELECTION_FOCUS_TAG:()=>Uv,TEXT_TYPE_TO_FORMAT:()=>po,TabNode:()=>zl,TextNode:()=>ks,UNDO_COMMAND:()=>dx,addClassNamesToElement:()=>IH,buildImportMap:()=>y$,configExtension:()=>xH,createCommand:()=>je,createEditor:()=>V$,createSharedNodeState:()=>wL,createState:()=>Y5,declarePeerDependency:()=>yH,defineExtension:()=>vH,flipDirection:()=>Mi,getDOMOwnerDocument:()=>Ex,getDOMSelection:()=>Rr,getDOMSelectionFromTarget:()=>zk,getDOMTextNode:()=>Es,getEditorPropertyFromDOMNode:()=>Qc,getNearestEditorFromDOMNode:()=>Sx,getRegisteredNode:()=>bx,getRegisteredNodeOrThrow:()=>Cx,getStaticNodeConfig:()=>Jc,getTextDirection:()=>j$,getTransformSetFromKlass:()=>Sk,isBlockDomNode:()=>jv,isCurrentlyReadOnlyMode:()=>jl,isDOMDocumentNode:()=>Lk,isDOMNode:()=>Ql,isDOMTextNode:()=>aa,isDOMUnmanaged:()=>Kk,isDocumentFragment:()=>$k,isExactShortcutMatch:()=>At,isHTMLAnchorElement:()=>tH,isHTMLElement:()=>ko,isInlineDomNode:()=>Hk,isLexicalEditor:()=>jp,isModifierMatch:()=>Nk,isSelectionCapturedInDecoratorInput:()=>Ix,isSelectionWithinEditor:()=>jc,makeStepwiseIterator:()=>Ox,mergeRegister:()=>wH,normalizeClassNames:()=>Zc,removeClassNamesFromElement:()=>SH,removeFromParent:()=>Si,resetRandomKey:()=>W$,safeCast:()=>CH,setDOMUnmanaged:()=>rH,setNodeIndentFromDOM:()=>Uk,shallowMergeConfig:()=>bH,toggleTextFormatType:()=>qc});function J(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 hL(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 Mr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,b5=Mr&&"documentMode"in document?document.documentMode:null,Tr=Mr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),wi=Mr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Sp=!(!Mr||!("InputEvent"in window)||b5)&&"getTargetRanges"in new window.InputEvent("input"),Hp=Mr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Wc=Mr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,I5=Mr&&/Android/.test(navigator.userAgent),vL=Mr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Iv=Mr&&I5&&vL,Up=Mr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Tr&&!vL,S5=0,w5=1,T5=2,L5=1,k5=2,P5=4,E5=8,A5=16,M5=32,R5=64,Zv=128,N5=2047,_5=1,D5=2,O5=3,F5=4,B5=5,z5=6,Dc=Hp||Wc||Up?"\xA0":"\u200B",Kp=`
3695
3695
 
3696
- `,Tv=si?"\xA0":mc,OT="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",FT="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Gz=new RegExp("^[^"+FT+"]*["+OT+"]"),jz=new RegExp("^[^"+OT+"]*["+FT+"]"),Zn={bold:1,capitalize:1024,code:16,highlight:wv,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Qz={directionless:1,unmergeable:2},jh={center:2,end:6,justify:4,left:1,right:3,start:5},Xz={[Uz]:"center",[Wz]:"end",[Vz]:"justify",[Hz]:"left",[Kz]:"right",[qz]:"start"},Yz={normal:0,segmented:2,token:1},Jz={[Ez]:"normal",[Rz]:"segmented",[Mz]:"token"},Zz="$",Kw="$config";function BT(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(j(i)&&BT(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var Qh=!1,Lv=0;function e5(e){Lv=e.timeStamp}function Fh(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&Ap(e,n)!==void 0}function t5(e,t,n){let o=yr(No(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Jv(t,i,r,a,!1)}function n5(e,t,n){if($e(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return Qr(t)&&n.isAttached()}function o5(e,t,n,o){for(let r=e;r&&!sk(r);r=Ac(r)){let a=Ap(r,t);if(a!==void 0){let i=_n(a,n);if(i)return qt(i)||!vo(r)?void 0:[r,i]}else if(r===o)return[o,GL(n)]}}function zT(e,t,n){Qh=!0;let o=performance.now()-Lv>100;try{jr(e,()=>{let r=It()||(function(p){return p.getEditorState().read(()=>{let m=It();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=o5(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Ae(y)&&Qr(g)&&n5(r,g,y)&&t5(g,y,e);else if(h==="childList"){d=!0;let C=m.addedNodes;for(let T=0;T<C.length;T++){let L=C[T],b=Qv(L),S=L.parentNode;if(S!=null&&L!==l&&b===null&&!Fh(L,S,e)){if(si){let A=(vo(L)?L.innerText:null)||L.nodeValue;A&&(c+=A)}S.removeChild(L)}}let w=m.removedNodes,k=w.length;if(k>0){let T=0;for(let L=0;L<k;L++){let b=w[L];(Fh(b,g,e)||l===b)&&(g.appendChild(b),T++)}k!==T&&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"||Fh(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&To(r),si&&ZL(e)&&r.insertRawText(c))})}finally{Qh=!1}}function $T(e){let t=e._observer;t!==null&&zT(e,t.takeRecords(),t)}function HT(e){(function(t){Lv===0&&No(t).addEventListener("textInput",e5,!0)})(e),e._observer=new MutationObserver((t,n)=>{zT(e,t,n)})}var Xh=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||s5).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function r5(e,t){return new Xh(e,t)}function rp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function a5(e,t,n){let o=rp(e,n,"direct"),r=rp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function i5(e,t,n){let o;if(Un(),typeof n=="function"){let a=e.getLatest(),i=rp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return kv(r).updateFromKnown(t,o),r}function UT(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}=Mc(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 Yh=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 Vw(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=Vw(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 kv(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Yh(t,KT(t));return t.__state=n,n}function KT(e){return e.__state?e.__state.sharedNodeState:qv(ox(),e.getType()).sharedNodeState}function Vw(e){if(e)for(let t in e)return e}function s5(e){return e}function qw(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 Ww(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 Gw(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function jw(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&&qw(p,c,f)||f&&qw(p,f,c)||c&&Ww(p,c,f)||f&&Ww(p,f,c))})(l,d))}function Qw(e,t){let n=e.mergeWithSibling(t),o=Bt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function Xw(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Ae(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(jw(t,o)){o=Qw(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Ae(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(jw(o,n)){o=Qw(o,n);break}break}n.remove()}}else o.remove()}function ap(e){return Yw(e.anchor),Yw(e.focus),e}function Yw(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),Ae(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!j(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var ls,Qn,gc,wp,Jh,Zh,ds,mr,ev,hc,Nn="",Gr=null,as=null,ul=!1,ip=!1;function sp(e,t){let n=ds.get(e);if(t!==null){let o=rv(e);o.parentNode===t&&t.removeChild(o)}if(mr.has(e)||Qn._keyToDOMMap.delete(e),j(n)){let o=dp(n,ds);tv(o,0,o.length-1,null)}n!==void 0&&Zv(hc,gc,wp,n,"destroyed")}function tv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&sp(a,o)}}function rs(e,t){e.setProperty("text-align",t)}var l5="40px";function VT(e,t){let n=ls.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(Qn._rootElement||e).getPropertyValue("--lexical-indent-base-value")||l5;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function qT(e,t){let n=e.style;t===0?rs(n,""):t===1?rs(n,"left"):t===2?rs(n,"center"):t===3?rs(n,"right"):t===4?rs(n,"justify"):t===5?rs(n,"start"):t===6&&rs(n,"end")}function nv(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(jn(o))return null;let a=o.getParentOrThrow();return jn(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function lp(e,t){let n=mr.get(e);n===void 0&&Y(60);let o=n.createDOM(ls,Qn);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,Qn),Ae(n)?o.setAttribute("data-lexical-text","true"):qt(n)&&o.setAttribute("data-lexical-decorator","true"),j(n)){let r=n.__indent,a=n.__size;if(nv(o,n),r!==0&&VT(o,r),a!==0){let s=a-1;ov(dp(n,mr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&qT(o,i),n.isInline()||WT(null,n,o)}else{let r=n.getTextContent();if(qt(n)){let a=n.decorate(Qn,ls);a!==null&&GT(e,a),o.contentEditable="false"}Nn+=r}return t!==null&&t.insertChild(o),Zv(hc,gc,wp,n,"created"),o}function ov(e,t,n,o,r){let a=Nn;Nn="";let i=n;for(;i<=o;++i){lp(e[i],r);let s=mr.get(e[i]);s!==null&&Ae(s)?Gr===null&&(Gr=s.getFormat(),as=s.getStyle()):j(s)&&i<o&&!s.isInline()&&(Nn+=Sp)}r.element.__lexicalTextContent=Nn,Nn=a+Nn}function Jw(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 WT(e,t,n){let o=Jw(e,ds),r=Jw(t,mr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function d5(e,t,n){var o;Gr=null,as=null,(function(r,a,i){let s=Nn,l=r.__size,d=a.__size;Nn="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Yf(f,c);else{let h=rv(f),g=lp(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}sp(f,null)}let m=mr.get(p);Ae(m)&&Gr===null&&(Gr=m.getFormat(),as=m.getStyle())}else{let f=dp(r,ds),p=dp(a,mr);if(f.length!==l&&Y(227),p.length!==d&&Y(228),l===0)d!==0&&ov(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;tv(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,T,L=y.getFirstChild(),b=0,S=0;for(;b<=C&&S<=w;){let B=h[b],R=g[S];if(B===R)L=Bh(Yf(R,y.element)),b++,S++;else{if(T===void 0&&(T=Zw(g,S)),k===void 0)k=Zw(h,b);else if(!k.has(B)){b++;continue}if(!T.has(B)){L=Bh(rv(B)),sp(B,y.element),b++,k.delete(B);continue}if(k.has(R)){let H=Sl(Qn,R);H!==L&&y.withBefore(L).insertChild(H),L=Bh(Yf(R,y.element)),b++,S++}else lp(R,y.withBefore(L)),S++}let N=mr.get(R);N!==null&&Ae(N)?Gr===null&&(Gr=N.getFormat(),as=N.getStyle()):j(N)&&S<=w&&!N.isInline()&&(Nn+=Sp)}let A=b>C,E=S>w;if(A&&!E){let B=g[w+1],R=B===void 0?null:Qn.getElementByKey(B);ov(g,0,S,w,y.withBefore(R))}else E&&!A&&tv(h,b,C,y.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=Nn,Nn=s+Nn})(e,t,t.getDOMSlot(n)),o=t,Gr==null||Gr===o.__textFormat||ip||o.setTextFormat(Gr),(function(r){as==null||as===r.__textStyle||ip||r.setTextStyle(as)})(t)}function dp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&Y(101),n.push(o),o=r.__next}return n}function Yf(e,t){let n=ds.get(e),o=mr.get(e);n!==void 0&&o!==void 0||Y(61);let r=ul||Zh.has(e)||Jh.has(e),a=Sl(Qn,e);if(n===o&&!r){let i;if(j(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return Nn+=i,a}if(n!==o&&r&&Zv(hc,gc,wp,o,"updated"),o.updateDOM(n,a,ls)){let i=lp(e,null);return t===null&&Y(62),t.replaceChild(i,a),sp(e,null),i}if(j(n)){j(o)||Y(334,e);let i=o.__indent;(ul||i!==n.__indent)&&VT(a,i);let s=o.__format;if((ul||s!==n.__format)&&qT(a,s),r)d5(n,o,a),jn(o)||o.isInline()||WT(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),Nn+=d}if((ul||o.__dir!==n.__dir)&&(nv(a,o),jn(o)&&!ul))for(let l of o.getChildren())j(l)&&nv(Sl(Qn,l.getKey()),l)}else{let i=o.getTextContent();if(qt(o)){let s=o.decorate(Qn,ls);s!==null&&GT(e,s)}Nn+=i}if(!ip&&jn(o)&&o.__cachedText!==Nn){let i=o.getWritable();i.__cachedText=Nn,o=i}return a}function GT(e,t){let n=Qn._pendingDecorators,o=Qn._decorators;if(n===null){if(o[e]===t)return;n=WL(Qn)}n[e]=t}function Bh(e){let t=e.nextSibling;return t!==null&&t===Qn._blockCursorElement&&(t=t.nextSibling),t}function Zw(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function c5(e,t,n,o,r,a){Nn="",ul=o===2,Qn=n,ls=n._config,gc=n._nodes,wp=Qn._listeners.mutation,Jh=r,Zh=a,ds=e._nodeMap,mr=t._nodeMap,ip=t._readOnly,ev=new Map(n._keyToDOMMap);let i=new Map;return hc=i,Yf("root",null),Qn=void 0,gc=void 0,Jh=void 0,Zh=void 0,ds=void 0,mr=void 0,ls=void 0,ev=void 0,hc=void 0,i}function rv(e){let t=ev.get(e);return t===void 0&&Y(75,e),t}function We(e){return{type:e}}var Pv=We("SELECTION_CHANGE_COMMAND"),u5=We("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),jT=We("CLICK_COMMAND"),Av=We("BEFORE_INPUT_COMMAND"),Ev=We("INPUT_COMMAND"),Mv=We("COMPOSITION_START_COMMAND"),Rv=We("COMPOSITION_END_COMMAND"),vc=We("DELETE_CHARACTER_COMMAND"),lc=We("INSERT_LINE_BREAK_COMMAND"),av=We("INSERT_PARAGRAPH_COMMAND"),gl=We("CONTROLLED_TEXT_INSERTION_COMMAND"),Nv=We("PASTE_COMMAND"),iv=We("REMOVE_TEXT_COMMAND"),xc=We("DELETE_WORD_COMMAND"),yc=We("DELETE_LINE_COMMAND"),oi=We("FORMAT_TEXT_COMMAND"),_v=We("UNDO_COMMAND"),Dv=We("REDO_COMMAND"),Ov=We("KEYDOWN_COMMAND"),QT=We("KEY_ARROW_RIGHT_COMMAND"),XT=We("MOVE_TO_END"),YT=We("KEY_ARROW_LEFT_COMMAND"),JT=We("MOVE_TO_START"),ZT=We("KEY_ARROW_UP_COMMAND"),eL=We("KEY_ARROW_DOWN_COMMAND"),cp=We("KEY_ENTER_COMMAND"),tL=We("KEY_SPACE_COMMAND"),nL=We("KEY_BACKSPACE_COMMAND"),oL=We("KEY_ESCAPE_COMMAND"),rL=We("KEY_DELETE_COMMAND"),aL=We("KEY_TAB_COMMAND"),f5=We("INSERT_TAB_COMMAND"),p5=We("INDENT_CONTENT_COMMAND"),m5=We("OUTDENT_CONTENT_COMMAND"),iL=We("DROP_COMMAND"),g5=We("FORMAT_ELEMENT_COMMAND"),sL=We("DRAGSTART_COMMAND"),lL=We("DRAGOVER_COMMAND"),dL=We("DRAGEND_COMMAND"),Fv=We("COPY_COMMAND"),Bv=We("CUT_COMMAND"),sv=We("SELECT_ALL_COMMAND"),h5=We("CLEAR_EDITOR_COMMAND"),v5=We("CLEAR_HISTORY_COMMAND"),x5=We("CAN_REDO_COMMAND"),y5=We("CAN_UNDO_COMMAND"),cL=We("FOCUS_COMMAND"),uL=We("BLUR_COMMAND"),fL=We("KEY_MODIFIER_COMMAND"),ma=Object.freeze({}),lv=[["keydown",function(e,t){Cc=e.timeStamp,pL=e.key,!t.isComposing()&&me(t,Ov,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;El(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&jr(t,()=>{KL(n)||(uv=!0)})}],["compositionstart",function(e,t){me(t,Mv,e)}],["compositionend",function(e,t){si?sc=!0:Tc||!bp&&!Ip?me(t,Rv,e):(Jf=!0,Zf=e.data)}],["input",function(e,t){e.stopPropagation(),jr(t,()=>{t.dispatchCommand(Ev,e)},{event:e}),fl=null}],["click",function(e,t){jr(t,()=>{let n=It(),o=yr(No(t)),r=ms();if(o){if($e(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!jn(i)&&Ro().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=uc(i,l=>j(l)&&!l.isInline());j(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(vo(a)||Qr(a))&&To(Lp(r,o,t,e))}}me(t,jT,e)})}],["cut",ma],["copy",ma],["dragstart",ma],["dragover",ma],["dragend",ma],["paste",ma],["focus",ma],["blur",ma],["drop",ma]];op&&lv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||si&&ZL(o)||r!=="insertCompositionText"&&me(o,Av,n)})(e,t)]);var Cc=0,pL=null,mL=0,fl=null,dv=new WeakMap,up=new WeakMap,cv=!1,uv=!1,dc=!1,sc=!1,Jf=!1,Zf="",is=null,gL=[0,"",0,"root",0];function hL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Bt(),d=yr(No(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Ae(s)||(!r&&(!op||mL<o+50)||s.isDirty()&&m<2||jL(n))&&a.offset!==i.offset&&!s.isComposing()||va(s)||s.isDirty()&&m>1||(r||!op)&&p!==null&&!s.isComposing()&&c!==fs(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=ai(g);return v===0?!g.canInsertTextBefore()||!x.canInsertTextBefore()&&!g.isComposing()||y||(function(C){let w=C.getPreviousSibling();return(Ae(w)||j(w)&&w.isInline())&&!w.canInsertTextAfter()})(g):v===g.getTextContentSize()&&(!g.canInsertTextAfter()||!x.canInsertTextAfter()&&!g.isComposing()||y)})(e,s)}function eT(e,t){return Qr(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function tT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;cv&&(cv=!1,eT(o,r)&&eT(a,i)&&!is)||jr(t,()=>{if(!n)return void To(null);if(!kc(t,o,a))return;let s=It();if(is&&$e(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(),To(s))}if(is=null,$e(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=No(t).event,f=c?c.timeStamp:performance.now(),[p,m,h,g,v]=gL,x=Ro(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)ep(s,p,m);else if(l.type==="text")Ae(d)||Y(141),vL(s,d);else if(l.type==="element"&&!y){j(d)||Y(259);let C=l.getNode();C.isEmpty()?(function(w,k){let T=k.getTextFormat(),L=k.getTextStyle();ep(w,T,L)})(s,C):ep(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 T=p[k],L=T.getTextContentSize();if(Ae(T)&&L!==0&&!(k===0&&T.__key===x&&g===L||k===m-1&&T.__key===y&&v===0)&&(w=!0,C&=T.getFormat(),C===0))break}s.format=w?C:0}}me(t,Pv,void 0)})}function ep(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function vL(e,t){ep(e,t.getFormat(),t.getStyle())}function xL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function C5(e){let t=e.inputType,n=xL(e),o=Bt(),r=It();if(t==="deleteContentBackward"){if(r===null){let f=ms();if(!$e(f))return!0;To(f.clone())}if($e(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,pL==="MediaLast"&&a<Cc+30&&o.isComposing()&&f){if(Kn(null),Cc=0,setTimeout(()=>{jr(o,()=>{Kn(null)})},30),$e(r)){let p=r.anchor.getNode();p.markDirty(),Ae(p)||Y(142),vL(r,p)}}else{Kn(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=Gh&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!qt(JL(r.anchor,!0))),!v){me(o,vc,!0);let x=It();Gh&&$e(x)&&x.isCollapsed()&&(is=x,setTimeout(()=>is=null))}}return!0}}var a;if(!$e(r))return!0;let i=e.data;fl!==null&&Yv(!1,o,fl),r.dirty&&fl===null||!r.isCollapsed()||jn(r.anchor.getNode())||n===null||r.applyDOMRange(n),fl=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
3697
- `)e.preventDefault(),me(o,lc,!1);else if(i===Sp)e.preventDefault(),me(o,av,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&hL(r,n,i,e.timeStamp,!0)?(e.preventDefault(),me(o,gl,i)):fl=i;return mL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":me(o,gl,e);break;case"insertFromComposition":Kn(null),me(o,gl,e);break;case"insertLineBreak":Kn(null),me(o,lc,!1);break;case"insertParagraph":Kn(null),dc&&!Tc?(dc=!1,me(o,lc,!1)):me(o,av,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":me(o,Nv,e);break;case"deleteByComposition":(function(f,p){return f!==p||j(f)||j(p)||!ai(f)||!ai(p)})(d,c)&&me(o,iv,e);break;case"deleteByDrag":case"deleteByCut":me(o,iv,e);break;case"deleteContent":me(o,vc,!1);break;case"deleteWordBackward":me(o,xc,!0);break;case"deleteWordForward":me(o,xc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":me(o,yc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":me(o,yc,!1);break;case"formatStrikeThrough":me(o,oi,"strikethrough");break;case"formatBold":me(o,oi,"bold");break;case"formatItalic":me(o,oi,"italic");break;case"formatUnderline":me(o,oi,"underline");break;case"historyUndo":me(o,_v,void 0);break;case"historyRedo":me(o,Dv,void 0)}return!0}function b5(e){if(vo(e.target)&&KL(e.target))return!0;let t=Bt(),n=It(),o=e.data,r=xL(e);if(o!=null&&$e(n)&&hL(n,r,o,e.timeStamp,!1)){sc&&(fp(t,o),sc=!1);let a=n.anchor.getNode(),i=yr(No(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;op&&!n.isCollapsed()&&Ae(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===XL(i.anchorNode)||me(t,gl,o);let c=o.length;si&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Gh&&t.isComposing()&&(Cc=0,Kn(null))}else Yv(!1,t,o!==null?o:void 0),sc&&(fp(t,o||void 0),sc=!1);return(function(){Un();let a=Bt();$T(a)})(),!0}function I5(e){let t=Bt(),n=It();if($e(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Kn(o.key),Mp(TL),(e.timeStamp<Cc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Ae(r)&&r.getStyle()!==n.style)&&me(t,gl,Tv)}return!0}function S5(e){return fp(Bt(),e.data),Mp(LL),!0}function fp(e,t){let n=e._compositionKey;if(Kn(null),n!==null&&t!=null){if(t===""){let o=_n(n),r=fs(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Ae(o)){let a=yr(No(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Jv(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3698
- `){let o=It();if($e(o)||Lc(o)){if($e(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void me(e,cp,null)}}}Yv(!0,e,t)}function w5(e){let t=Bt();if(e.key==null)return!0;if(Jf){if(PT(e))return jr(t,()=>{fp(t,Zf)}),Jf=!1,Zf="",!0;Jf=!1,Zf=""}if((function(n){return Tt(n,"ArrowRight",{shiftKey:"any"})})(e))me(t,QT,e);else if((function(n){return Tt(n,"ArrowRight",ha)})(e))me(t,XT,e);else if((function(n){return Tt(n,"ArrowLeft",{shiftKey:"any"})})(e))me(t,YT,e);else if((function(n){return Tt(n,"ArrowLeft",ha)})(e))me(t,JT,e);else if((function(n){return Tt(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))me(t,ZT,e);else if((function(n){return Tt(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))me(t,eL,e);else if((function(n){return Tt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))dc=!0,me(t,cp,e);else if((function(n){return n.key===" "})(e))me(t,tL,e);else if((function(n){return fr&&Tt(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),dc=!0,me(t,lc,!0);else if((function(n){return Tt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))dc=!1,me(t,cp,e);else if((function(n){return Tt(n,"Backspace",{shiftKey:"any"})||fr&&Tt(n,"h",{ctrlKey:!0})})(e))PT(e)?me(t,nL,e):(e.preventDefault(),me(t,vc,!0));else if((function(n){return n.key==="Escape"})(e))me(t,oL,e);else if((function(n){return Tt(n,"Delete",{})||fr&&Tt(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?me(t,rL,e):(e.preventDefault(),me(t,vc,!1));else if((function(n){return Tt(n,"Backspace",kT)})(e))e.preventDefault(),me(t,xc,!0);else if((function(n){return Tt(n,"Delete",kT)})(e))e.preventDefault(),me(t,xc,!1);else if((function(n){return fr&&Tt(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),me(t,yc,!0);else if((function(n){return fr&&(Tt(n,"Delete",{metaKey:!0})||Tt(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),me(t,yc,!1);else if((function(n){return Tt(n,"b",ha)})(e))e.preventDefault(),me(t,oi,"bold");else if((function(n){return Tt(n,"u",ha)})(e))e.preventDefault(),me(t,oi,"underline");else if((function(n){return Tt(n,"i",ha)})(e))e.preventDefault(),me(t,oi,"italic");else if((function(n){return Tt(n,"Tab",{shiftKey:"any"})})(e))me(t,aL,e);else if((function(n){return Tt(n,"z",ha)})(e))e.preventDefault(),me(t,_v,void 0);else if((function(n){return fr?Tt(n,"z",{metaKey:!0,shiftKey:!0}):Tt(n,"y",{ctrlKey:!0})||Tt(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),me(t,Dv,void 0);else{let n=t._editorState._selection;n===null||$e(n)?AT(e)&&(e.preventDefault(),me(t,sv,e)):(function(o){return Tt(o,"c",ha)})(e)?(e.preventDefault(),me(t,Fv,e)):(function(o){return Tt(o,"x",ha)})(e)?(e.preventDefault(),me(t,Bv,e)):AT(e)&&(e.preventDefault(),me(t,sv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(fL,e),!0}function yL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var hl=new Map;function CL(e){let t=ok(e.target);if(t===null)return;let n=jv(t.anchorNode);if(n===null)return;uv&&(uv=!1,jr(n,()=>{let l=ms(),d=t.anchorNode;(vo(d)||Qr(d))&&To(Lp(l,t,n,e))}));let o=Xv(n),r=o[o.length-1],a=r._key,i=hl.get(a),s=i||r;s!==n&&tT(t,s,!1),tT(t,n,!0),n!==r?hl.set(a,n):i&&hl.delete(a)}function nT(e){e._lexicalHandled=!0}function oT(e){return e._lexicalHandled===!0}var rT=()=>{};function T5(e){let t=dv.get(e);if(t===void 0)return void rT();let n=up.get(t);if(n===void 0)return void rT();let o=n-1;o>=0||Y(164),dv.delete(e),up.set(t,o),o===0&&t.removeEventListener("selectionchange",CL);let r=Pc(e);Pp(r)?((function(i){if(i._parentEditor!==null){let s=Xv(i),l=s[s.length-1]._key;hl.get(l)===i&&hl.delete(l)}else hl.delete(i._key)})(r),e.__lexicalEditor=null):r&&Y(198);let a=yL(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function fv(e,t,n){Un();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=It();if(!$e(l)||!j(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return yp(f,s)&&d.set(s.__key,0,"element"),yp(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if($e(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 Lc(a)&&t&&e.isSelected()&&e.selectPrevious();if($e(a)&&t&&!i){let s=e.getIndexWithinParent();ii(e),gp(a,r,s,-1)}else ii(e);n||Jo(r)||r.canBeEmpty()||!r.isEmpty()||fv(r,t),t&&a&&jn(r)&&r.isEmpty()&&r.selectEnd()}function L5(e){return e}var bL=Symbol.for("ephemeral");function pp(e){return e[bL]||!1}var Yo=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Mc(this);return t===void 0&&Y(64,this.name),t}static clone(t){Y(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}),qL(this,t)}getType(){return this.__type}isInline(){Y(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=_n(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||It();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Ae(this))return o;if($e(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:_n(t)}getParentOrThrow(){let t=this.getParent();return t===null&&Y(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(Jo(n))return j(t)||t===this&&qt(t)||Y(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&Y(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:_n(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:_n(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=j(this)?this:this.getParent(),o=j(t)?t:t.getParent(),r=n&&o?fc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=fc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?dx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&Y(279),!1)))}isParentOf(t){let n=fc(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=j(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&&Y(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=Bt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(pp(this))return this;let t=_n(this.__key);return t===null&&Y(113),t}getWritable(){if(pp(this))return this;Un();let t=Sa(),n=Bt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=It();if(s!==null&&s.setCachedNodes(null),i.has(r))return xp(a),a;let l=rx(a);return i.add(r),xp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){Y(70)}updateDOM(t,n,o){Y(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){Y(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of KT(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&kv(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){fv(this,!0,t)}replace(t,n){Un();let o=It();o!==null&&(o=o.clone()),Vh(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;ii(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;if(fv(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&&(j(this)&&j(s)||Y(139),this.getChildren().forEach(g=>{s.append(g)})),$e(o)){To(o);let g=o.anchor,v=o.focus;g.key===a&&lT(g,s),v.key===a&&lT(v,s)}return ri()===a&&Kn(i),s}insertAfter(t,n=!0){Un(),Vh(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=It(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(ii(r),$e(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&&$e(i)){let m=this.getIndexWithinParent();gp(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){Un(),Vh(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;ii(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=It();return n&&$e(c)&&gp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Ca()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){Un();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(j(o))return o.select();if(!Ae(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){Un();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(j(o))return o.select(0,0);if(!Ae(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},k5="historic",P5="history-push",tp="history-merge",A5="paste",IL="collaboration",E5="skip-collab",SL="skip-scroll-into-view",wL="skip-dom-selection",pv="skip-selection-focus",TL="composition-start",LL="composition-end",xl=class e extends Yo{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3699
- `}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&&Gf(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&Gf(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&&Gf(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&Gf(a))return!0}return!1})(t)?null:{conversion:M5,priority:0}}}static importJSON(t){return yl().updateFromJSON(t)}};function M5(e){return{node:yl()}}function yl(){return Ec(new xl)}function ss(e){return e instanceof xl}function Gf(e){return Qr(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function zh(e,t){return 16&t?"code":t&wv?"mark":32&t?"sub":64&t?"sup":null}function $h(e,t){return 1&t?"strong":2&t?"em":"span"}function kL(e,t,n,o,r){let a=o.classList,i=vl(r,"base");i!==void 0&&a.add(...i),i=vl(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 Zn){let c=Zn[d];if(i=vl(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 PL(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?mc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||si){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 aT(e,t,n,o,r,a){PL(r,e,t);let i=a.theme.text;i!==void 0&&kL(0,0,o,e,i)}function jf(e,t){let n=document.createElement(t);return n.appendChild(e),n}var cs=class e extends Yo{__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 Jz[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ri()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=Zn[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Sc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=zh(0,o),a=$h(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)),aT(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=zh(0,a),l=zh(0,i),d=$h(0,a),c=$h(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let g=n.firstChild;g==null&&Y(48);let v=document.createElement(c);return aT(v,this,0,i,r,o),n.replaceChild(v,g),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&Y(49)),PL(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&kL(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:D5,priority:0}),b:()=>({conversion:N5,priority:0}),code:()=>({conversion:ga,priority:0}),em:()=>({conversion:ga,priority:0}),i:()=>({conversion:ga,priority:0}),mark:()=>({conversion:ga,priority:0}),s:()=>({conversion:ga,priority:0}),span:()=>({conversion:R5,priority:0}),strong:()=>({conversion:ga,priority:0}),sub:()=>({conversion:ga,priority:0}),sup:()=>({conversion:ga,priority:0}),u:()=>({conversion:ga,priority:0})}}static importJSON(t){return Hn().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 vo(n)||Y(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=jf(n,"b")),this.hasFormat("italic")&&(n=jf(n,"i")),this.hasFormat("strikethrough")&&(n=jf(n,"s")),this.hasFormat("underline")&&(n=jf(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"?Zn[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?Qz[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Sc(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=Yz[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){Un();let o=t,r=n,a=It(),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(!$e(a))return ML(s,o,s,r,"text","text");{let l=ri();l!==a.anchor.key&&l!==a.focus.key||Kn(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=It();if(r&&$e(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){Un();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=ri(),i=o.length;t.sort((b,S)=>b-S),t.push(i);let s=[],l=t.length;for(let b=0,S=0;b<i&&S<=l;S++){let A=t[S];A>b&&(s.push(o.slice(b,A)),b=A)}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=It();if($e(C)){let[b,S]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];b.type==="text"&&b.key===r&&(x=b),S.type==="text"&&S.key===r&&(y=S)}n.isSegmented()?(p=Hn(c),p.__format=m,p.__style=h,p.__detail=g,p.__state=Gw(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let b=1;b<d;b++){let S=Hn(s[b]);S.__format=m,S.__style=h,S.__detail=g,S.__state=Gw(n,S);let A=S.__key;a===r&&Kn(A),w.push(S)}let k=x?x.offset:null,T=y?y.offset:null,L=0;for(let b of w){if(!x&&!y)break;let S=L+b.getTextContentSize();if(x!==null&&k!==null&&k<=S&&k>=L&&(x.set(b.getKey(),k-L,"text"),k<S&&(x=null)),y!==null&&T!==null&&T<=S&&T>=L){y.set(b.getKey(),T-L,"text");break}L=S}if(f!==null){(function(A){let E=A.getPreviousSibling(),B=A.getNextSibling();E!==null&&xp(E),B!==null&&xp(B)})(this);let b=f.getWritable(),S=this.getIndexWithinParent();v?(b.splice(S,0,w),this.remove()):b.splice(S,1,w),$e(C)&&gp(C,f,S,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||Y(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;ri()===r&&Kn(o);let s=It();if($e(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&gT(f,n,o,t,i),p!==null&&p.key===r&&gT(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 R5(e){return{forChild:zv(e.style),node:null}}function N5(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:zv(t.style,n?void 0:"bold"),node:null}}var iT=new WeakMap;function _5(e){if(!vo(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function D5(e){let t=e;e.parentElement===null&&Y(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=iT.get(a))===void 0&&!_5(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)iT.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===`
3696
+ `,ex=wi?"\xA0":Dc,xL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",yL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",$5=new RegExp("^[^"+yL+"]*["+xL+"]"),H5=new RegExp("^[^"+xL+"]*["+yL+"]"),po={bold:1,capitalize:1024,code:16,highlight:Zv,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},U5={directionless:1,unmergeable:2},Sv={center:2,end:6,justify:4,left:1,right:3,start:5},K5={[D5]:"center",[z5]:"end",[F5]:"justify",[_5]:"left",[O5]:"right",[B5]:"start"},q5={normal:0,segmented:2,token:1},V5={[S5]:"normal",[T5]:"segmented",[w5]:"token"},W5="$",TT="$config";function CL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(Q(i)&&CL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var wv=!1,tx=0;function G5(e){tx=e.timeStamp}function fv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&Qp(e,n)!==void 0}function j5(e,t,n){let o=Rr(qo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&kx(t,i,r,a,!1)}function Q5(e,t,n){if(Ke(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return aa(t)&&n.isAttached()}function X5(e,t,n,o){for(let r=e;r&&!Kk(r);r=Xc(r)){let a=Qp(r,t);if(a!==void 0){let i=Hn(a,n);if(i)return Jt(i)||!ko(r)?void 0:[r,i]}else if(r===o)return[o,Ek(n)]}}function bL(e,t,n){wv=!0;let o=performance.now()-tx>100;try{ra(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=X5(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Ne(y)&&aa(g)&&Q5(r,g,y)&&j5(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=wx(L),T=L.parentNode;if(T!=null&&L!==l&&I===null&&!fv(L,T,e)){if(wi){let A=(ko(L)?L.innerText:null)||L.nodeValue;A&&(c+=A)}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];(fv(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"||fv(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&Fo(r),wi&&Dk(e)&&r.insertRawText(c))})}finally{wv=!1}}function IL(e){let t=e._observer;t!==null&&bL(e,t.takeRecords(),t)}function SL(e){(function(t){tx===0&&qo(t).addEventListener("textInput",G5,!0)})(e),e._observer=new MutationObserver((t,n)=>{bL(e,t,n)})}var Tv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||e$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function Y5(e,t){return new Tv(e,t)}function wp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function J5(e,t,n){let o=wp(e,n,"direct"),r=wp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function Z5(e,t,n){let o;if(Gn(),typeof n=="function"){let a=e.getLatest(),i=wp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return nx(r).updateFromKnown(t,o),r}function wL(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}=Jc(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 Lv=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 LT(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=LT(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 nx(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Lv(t,TL(t));return t.__state=n,n}function TL(e){return e.__state?e.__state.sharedNodeState:Cx(Rx(),e.getType()).sharedNodeState}function LT(e){if(e)for(let t in e)return e}function e$(e){return e}function kT(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 PT(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 ET(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function AT(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&&kT(p,c,f)||f&&kT(p,f,c)||c&&PT(p,c,f)||f&&PT(p,f,c))})(l,d))}function MT(e,t){let n=e.mergeWithSibling(t),o=qt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function RT(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Ne(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(AT(t,o)){o=MT(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Ne(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(AT(o,n)){o=MT(o,n);break}break}n.remove()}}else o.remove()}function Tp(e){return NT(e.anchor),NT(e.focus),e}function NT(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),Ne(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,ro,Oc,qp,kv,Pv,Ls,kr,Ev,Fc,$n="",oa=null,Is=null,Al=!1,Lp=!1;function kp(e,t){let n=Ls.get(e);if(t!==null){let o=Nv(e);o.parentNode===t&&t.removeChild(o)}if(kr.has(e)||ro._keyToDOMMap.delete(e),Q(n)){let o=Ep(n,Ls);Av(o,0,o.length-1,null)}n!==void 0&&Px(Fc,Oc,qp,n,"destroyed")}function Av(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&kp(a,o)}}function bs(e,t){e.setProperty("text-align",t)}var t$="40px";function LL(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(ro._rootElement||e).getPropertyValue("--lexical-indent-base-value")||t$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function kL(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 Mv(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(oo(o))return null;let a=o.getParentOrThrow();return oo(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Pp(e,t){let n=kr.get(e);n===void 0&&J(60);let o=n.createDOM(Ts,ro);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,ro),Ne(n)?o.setAttribute("data-lexical-text","true"):Jt(n)&&o.setAttribute("data-lexical-decorator","true"),Q(n)){let r=n.__indent,a=n.__size;if(Mv(o,n),r!==0&&LL(o,r),a!==0){let s=a-1;Rv(Ep(n,kr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&kL(o,i),n.isInline()||PL(null,n,o)}else{let r=n.getTextContent();if(Jt(n)){let a=n.decorate(ro,Ts);a!==null&&EL(e,a),o.contentEditable="false"}$n+=r}return t!==null&&t.insertChild(o),Px(Fc,Oc,qp,n,"created"),o}function Rv(e,t,n,o,r){let a=$n;$n="";let i=n;for(;i<=o;++i){Pp(e[i],r);let s=kr.get(e[i]);s!==null&&Ne(s)?oa===null&&(oa=s.getFormat(),Is=s.getStyle()):Q(s)&&i<o&&!s.isInline()&&($n+=Kp)}r.element.__lexicalTextContent=$n,$n=a+$n}function _T(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return ws(o)?"line-break":Jt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function PL(e,t,n){let o=_T(e,Ls),r=_T(t,kr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function n$(e,t,n){var o;oa=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)vp(f,c);else{let h=Nv(f),g=Pp(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}kp(f,null)}let m=kr.get(p);Ne(m)&&oa===null&&(oa=m.getFormat(),Is=m.getStyle())}else{let f=Ep(r,Ls),p=Ep(a,kr);if(f.length!==l&&J(227),p.length!==d&&J(228),l===0)d!==0&&Rv(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;Av(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=pv(vp(R,y.element)),I++,T++;else{if(S===void 0&&(S=DT(g,T)),k===void 0)k=DT(h,I);else if(!k.has(N)){I++;continue}if(!S.has(N)){L=pv(Nv(N)),kp(N,y.element),I++,k.delete(N);continue}if(k.has(R)){let z=Ul(ro,R);z!==L&&y.withBefore(L).insertChild(z),L=pv(vp(R,y.element)),I++,T++}else Pp(R,y.withBefore(L)),T++}let B=kr.get(R);B!==null&&Ne(B)?oa===null&&(oa=B.getFormat(),Is=B.getStyle()):Q(B)&&T<=w&&!B.isInline()&&($n+=Kp)}let A=I>C,E=T>w;if(A&&!E){let N=g[w+1],R=N===void 0?null:ro.getElementByKey(N);Rv(g,0,T,w,y.withBefore(R))}else E&&!A&&Av(h,I,C,y.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=$n,$n=s+$n})(e,t,t.getDOMSlot(n)),o=t,oa==null||oa===o.__textFormat||Lp||o.setTextFormat(oa),(function(r){Is==null||Is===r.__textStyle||Lp||r.setTextStyle(Is)})(t)}function Ep(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&J(101),n.push(o),o=r.__next}return n}function vp(e,t){let n=Ls.get(e),o=kr.get(e);n!==void 0&&o!==void 0||J(61);let r=Al||Pv.has(e)||kv.has(e),a=Ul(ro,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&&Px(Fc,Oc,qp,o,"updated"),o.updateDOM(n,a,Ts)){let i=Pp(e,null);return t===null&&J(62),t.replaceChild(i,a),kp(e,null),i}if(Q(n)){Q(o)||J(334,e);let i=o.__indent;(Al||i!==n.__indent)&&LL(a,i);let s=o.__format;if((Al||s!==n.__format)&&kL(a,s),r)n$(n,o,a),oo(o)||o.isInline()||PL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),$n+=d}if((Al||o.__dir!==n.__dir)&&(Mv(a,o),oo(o)&&!Al))for(let l of o.getChildren())Q(l)&&Mv(Ul(ro,l.getKey()),l)}else{let i=o.getTextContent();if(Jt(o)){let s=o.decorate(ro,Ts);s!==null&&EL(e,s)}$n+=i}if(!Lp&&oo(o)&&o.__cachedText!==$n){let i=o.getWritable();i.__cachedText=$n,o=i}return a}function EL(e,t){let n=ro._pendingDecorators,o=ro._decorators;if(n===null){if(o[e]===t)return;n=Pk(ro)}n[e]=t}function pv(e){let t=e.nextSibling;return t!==null&&t===ro._blockCursorElement&&(t=t.nextSibling),t}function DT(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function o$(e,t,n,o,r,a){$n="",Al=o===2,ro=n,Ts=n._config,Oc=n._nodes,qp=ro._listeners.mutation,kv=r,Pv=a,Ls=e._nodeMap,kr=t._nodeMap,Lp=t._readOnly,Ev=new Map(n._keyToDOMMap);let i=new Map;return Fc=i,vp("root",null),ro=void 0,Oc=void 0,kv=void 0,Pv=void 0,Ls=void 0,kr=void 0,Ts=void 0,Ev=void 0,Fc=void 0,i}function Nv(e){let t=Ev.get(e);return t===void 0&&J(75,e),t}function je(e){return{type:e}}var ox=je("SELECTION_CHANGE_COMMAND"),r$=je("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),AL=je("CLICK_COMMAND"),rx=je("BEFORE_INPUT_COMMAND"),ax=je("INPUT_COMMAND"),ix=je("COMPOSITION_START_COMMAND"),sx=je("COMPOSITION_END_COMMAND"),Bc=je("DELETE_CHARACTER_COMMAND"),Ec=je("INSERT_LINE_BREAK_COMMAND"),_v=je("INSERT_PARAGRAPH_COMMAND"),_l=je("CONTROLLED_TEXT_INSERTION_COMMAND"),lx=je("PASTE_COMMAND"),Dv=je("REMOVE_TEXT_COMMAND"),zc=je("DELETE_WORD_COMMAND"),$c=je("DELETE_LINE_COMMAND"),Ci=je("FORMAT_TEXT_COMMAND"),dx=je("UNDO_COMMAND"),cx=je("REDO_COMMAND"),ux=je("KEYDOWN_COMMAND"),ML=je("KEY_ARROW_RIGHT_COMMAND"),RL=je("MOVE_TO_END"),NL=je("KEY_ARROW_LEFT_COMMAND"),_L=je("MOVE_TO_START"),DL=je("KEY_ARROW_UP_COMMAND"),OL=je("KEY_ARROW_DOWN_COMMAND"),Ap=je("KEY_ENTER_COMMAND"),FL=je("KEY_SPACE_COMMAND"),BL=je("KEY_BACKSPACE_COMMAND"),zL=je("KEY_ESCAPE_COMMAND"),$L=je("KEY_DELETE_COMMAND"),HL=je("KEY_TAB_COMMAND"),a$=je("INSERT_TAB_COMMAND"),i$=je("INDENT_CONTENT_COMMAND"),s$=je("OUTDENT_CONTENT_COMMAND"),UL=je("DROP_COMMAND"),l$=je("FORMAT_ELEMENT_COMMAND"),KL=je("DRAGSTART_COMMAND"),qL=je("DRAGOVER_COMMAND"),VL=je("DRAGEND_COMMAND"),fx=je("COPY_COMMAND"),px=je("CUT_COMMAND"),Ov=je("SELECT_ALL_COMMAND"),d$=je("CLEAR_EDITOR_COMMAND"),c$=je("CLEAR_HISTORY_COMMAND"),u$=je("CAN_REDO_COMMAND"),f$=je("CAN_UNDO_COMMAND"),WL=je("FOCUS_COMMAND"),GL=je("BLUR_COMMAND"),jL=je("KEY_MODIFIER_COMMAND"),La=Object.freeze({}),Fv=[["keydown",function(e,t){Hc=e.timeStamp,QL=e.key,!t.isComposing()&&ve(t,ux,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;Ql(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&ra(t,()=>{Tk(n)||($v=!0)})}],["compositionstart",function(e,t){ve(t,ix,e)}],["compositionend",function(e,t){wi?Pc=!0:Wc||!Hp&&!Up?ve(t,sx,e):(xp=!0,yp=e.data)}],["input",function(e,t){e.stopPropagation(),ra(t,()=>{t.dispatchCommand(ax,e)},{event:e}),Ml=null}],["click",function(e,t){ra(t,()=>{let n=St(),o=Rr(qo(t)),r=Ms();if(o){if(Ke(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!oo(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=Rc(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)||aa(a))&&Fo(Wp(r,o,t,e))}}ve(t,AL,e)})}],["cut",La],["copy",La],["dragstart",La],["dragover",La],["dragend",La],["paste",La],["focus",La],["blur",La],["drop",La]];Sp&&Fv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||wi&&Dk(o)||r!=="insertCompositionText"&&ve(o,rx,n)})(e,t)]);var Hc=0,QL=null,XL=0,Ml=null,Bv=new WeakMap,Mp=new WeakMap,zv=!1,$v=!1,Ac=!1,Pc=!1,xp=!1,yp="",Ss=null,YL=[0,"",0,"root",0];function JL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=qt(),d=Rr(qo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Ne(s)||(!r&&(!Sp||XL<o+50)||s.isDirty()&&m<2||Ak(n))&&a.offset!==i.offset&&!s.isComposing()||Ea(s)||s.isDirty()&&m>1||(r||!Sp)&&p!==null&&!s.isComposing()&&c!==Es(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=Ii(g);return v===0?!g.canInsertTextBefore()||!x.canInsertTextBefore()&&!g.isComposing()||y||(function(C){let w=C.getPreviousSibling();return(Ne(w)||Q(w)&&w.isInline())&&!w.canInsertTextAfter()})(g):v===g.getTextContentSize()&&(!g.canInsertTextAfter()||!x.canInsertTextAfter()&&!g.isComposing()||y)})(e,s)}function OT(e,t){return aa(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function FT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;zv&&(zv=!1,OT(o,r)&&OT(a,i)&&!Ss)||ra(t,()=>{if(!n)return void Fo(null);if(!jc(t,o,a))return;let s=St();if(Ss&&Ke(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(),Fo(s))}if(Ss=null,Ke(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]=YL,x=Ko(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)Cp(s,p,m);else if(l.type==="text")Ne(d)||J(141),ZL(s,d);else if(l.type==="element"&&!y){Q(d)||J(259);let C=l.getNode();C.isEmpty()?(function(w,k){let S=k.getTextFormat(),L=k.getTextStyle();Cp(w,S,L)})(s,C):Cp(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(Ne(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}}ve(t,ox,void 0)})}function Cp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function ZL(e,t){Cp(e,t.getFormat(),t.getStyle())}function ek(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function p$(e){let t=e.inputType,n=ek(e),o=qt(),r=St();if(t==="deleteContentBackward"){if(r===null){let f=Ms();if(!Ke(f))return!0;Fo(f.clone())}if(Ke(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,QL==="MediaLast"&&a<Hc+30&&o.isComposing()&&f){if(jn(null),Hc=0,setTimeout(()=>{ra(o,()=>{jn(null)})},30),Ke(r)){let p=r.anchor.getNode();p.markDirty(),Ne(p)||J(142),ZL(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=Iv&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!Jt(_k(r.anchor,!0))),!v){ve(o,Bc,!0);let x=St();Iv&&Ke(x)&&x.isCollapsed()&&(Ss=x,setTimeout(()=>Ss=null))}}return!0}}var a;if(!Ke(r))return!0;let i=e.data;Ml!==null&&Lx(!1,o,Ml),r.dirty&&Ml===null||!r.isCollapsed()||oo(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===`
3697
+ `)e.preventDefault(),ve(o,Ec,!1);else if(i===Kp)e.preventDefault(),ve(o,_v,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&JL(r,n,i,e.timeStamp,!0)?(e.preventDefault(),ve(o,_l,i)):Ml=i;return XL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":ve(o,_l,e);break;case"insertFromComposition":jn(null),ve(o,_l,e);break;case"insertLineBreak":jn(null),ve(o,Ec,!1);break;case"insertParagraph":jn(null),Ac&&!Wc?(Ac=!1,ve(o,Ec,!1)):ve(o,_v,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":ve(o,lx,e);break;case"deleteByComposition":(function(f,p){return f!==p||Q(f)||Q(p)||!Ii(f)||!Ii(p)})(d,c)&&ve(o,Dv,e);break;case"deleteByDrag":case"deleteByCut":ve(o,Dv,e);break;case"deleteContent":ve(o,Bc,!1);break;case"deleteWordBackward":ve(o,zc,!0);break;case"deleteWordForward":ve(o,zc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":ve(o,$c,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":ve(o,$c,!1);break;case"formatStrikeThrough":ve(o,Ci,"strikethrough");break;case"formatBold":ve(o,Ci,"bold");break;case"formatItalic":ve(o,Ci,"italic");break;case"formatUnderline":ve(o,Ci,"underline");break;case"historyUndo":ve(o,dx,void 0);break;case"historyRedo":ve(o,cx,void 0)}return!0}function m$(e){if(ko(e.target)&&Tk(e.target))return!0;let t=qt(),n=St(),o=e.data,r=ek(e);if(o!=null&&Ke(n)&&JL(n,r,o,e.timeStamp,!1)){Pc&&(Rp(t,o),Pc=!1);let a=n.anchor.getNode(),i=Rr(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;Sp&&!n.isCollapsed()&&Ne(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===Rk(i.anchorNode)||ve(t,_l,o);let c=o.length;wi&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Iv&&t.isComposing()&&(Hc=0,jn(null))}else Lx(!1,t,o!==null?o:void 0),Pc&&(Rp(t,o||void 0),Pc=!1);return(function(){Gn();let a=qt();IL(a)})(),!0}function g$(e){let t=qt(),n=St();if(Ke(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();jn(o.key),Yp(sk),(e.timeStamp<Hc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Ne(r)&&r.getStyle()!==n.style)&&ve(t,_l,ex)}return!0}function h$(e){return Rp(qt(),e.data),Yp(lk),!0}function Rp(e,t){let n=e._compositionKey;if(jn(null),n!==null&&t!=null){if(t===""){let o=Hn(n),r=Es(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Ne(o)){let a=Rr(qo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),kx(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3698
+ `){let o=St();if(Ke(o)||Gc(o)){if(Ke(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void ve(e,Ap,null)}}}Lx(!0,e,t)}function v$(e){let t=qt();if(e.key==null)return!0;if(xp){if(cL(e))return ra(t,()=>{Rp(t,yp)}),xp=!1,yp="",!0;xp=!1,yp=""}if((function(n){return At(n,"ArrowRight",{shiftKey:"any"})})(e))ve(t,ML,e);else if((function(n){return At(n,"ArrowRight",Pa)})(e))ve(t,RL,e);else if((function(n){return At(n,"ArrowLeft",{shiftKey:"any"})})(e))ve(t,NL,e);else if((function(n){return At(n,"ArrowLeft",Pa)})(e))ve(t,_L,e);else if((function(n){return At(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))ve(t,DL,e);else if((function(n){return At(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))ve(t,OL,e);else if((function(n){return At(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Ac=!0,ve(t,Ap,e);else if((function(n){return n.key===" "})(e))ve(t,FL,e);else if((function(n){return Tr&&At(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Ac=!0,ve(t,Ec,!0);else if((function(n){return At(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Ac=!1,ve(t,Ap,e);else if((function(n){return At(n,"Backspace",{shiftKey:"any"})||Tr&&At(n,"h",{ctrlKey:!0})})(e))cL(e)?ve(t,BL,e):(e.preventDefault(),ve(t,Bc,!0));else if((function(n){return n.key==="Escape"})(e))ve(t,zL,e);else if((function(n){return At(n,"Delete",{})||Tr&&At(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?ve(t,$L,e):(e.preventDefault(),ve(t,Bc,!1));else if((function(n){return At(n,"Backspace",dL)})(e))e.preventDefault(),ve(t,zc,!0);else if((function(n){return At(n,"Delete",dL)})(e))e.preventDefault(),ve(t,zc,!1);else if((function(n){return Tr&&At(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),ve(t,$c,!0);else if((function(n){return Tr&&(At(n,"Delete",{metaKey:!0})||At(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),ve(t,$c,!1);else if((function(n){return At(n,"b",Pa)})(e))e.preventDefault(),ve(t,Ci,"bold");else if((function(n){return At(n,"u",Pa)})(e))e.preventDefault(),ve(t,Ci,"underline");else if((function(n){return At(n,"i",Pa)})(e))e.preventDefault(),ve(t,Ci,"italic");else if((function(n){return At(n,"Tab",{shiftKey:"any"})})(e))ve(t,HL,e);else if((function(n){return At(n,"z",Pa)})(e))e.preventDefault(),ve(t,dx,void 0);else if((function(n){return Tr?At(n,"z",{metaKey:!0,shiftKey:!0}):At(n,"y",{ctrlKey:!0})||At(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),ve(t,cx,void 0);else{let n=t._editorState._selection;n===null||Ke(n)?uL(e)&&(e.preventDefault(),ve(t,Ov,e)):(function(o){return At(o,"c",Pa)})(e)?(e.preventDefault(),ve(t,fx,e)):(function(o){return At(o,"x",Pa)})(e)?(e.preventDefault(),ve(t,px,e)):uL(e)&&(e.preventDefault(),ve(t,Ov,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(jL,e),!0}function tk(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Dl=new Map;function nk(e){let t=zk(e.target);if(t===null)return;let n=Sx(t.anchorNode);if(n===null)return;$v&&($v=!1,ra(n,()=>{let l=Ms(),d=t.anchorNode;(ko(d)||aa(d))&&Fo(Wp(l,t,n,e))}));let o=Tx(n),r=o[o.length-1],a=r._key,i=Dl.get(a),s=i||r;s!==n&&FT(t,s,!1),FT(t,n,!0),n!==r?Dl.set(a,n):i&&Dl.delete(a)}function BT(e){e._lexicalHandled=!0}function zT(e){return e._lexicalHandled===!0}var $T=()=>{};function x$(e){let t=Bv.get(e);if(t===void 0)return void $T();let n=Mp.get(t);if(n===void 0)return void $T();let o=n-1;o>=0||J(164),Bv.delete(e),Mp.set(t,o),o===0&&t.removeEventListener("selectionchange",nk);let r=Qc(e);jp(r)?((function(i){if(i._parentEditor!==null){let s=Tx(i),l=s[s.length-1]._key;Dl.get(l)===i&&Dl.delete(l)}else Dl.delete(i._key)})(r),e.__lexicalEditor=null):r&&J(198);let a=tk(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function Hv(e,t,n){Gn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=St();if(!Ke(l)||!Q(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return zp(f,s)&&d.set(s.__key,0,"element"),zp(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ke(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(Op(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(Op(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else Gc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ke(a)&&t&&!i){let s=e.getIndexWithinParent();Si(e),Dp(a,r,s,-1)}else Si(e);n||ur(r)||r.canBeEmpty()||!r.isEmpty()||Hv(r,t),t&&a&&oo(r)&&r.isEmpty()&&r.selectEnd()}function y$(e){return e}var ok=Symbol.for("ephemeral");function Np(e){return e[ok]||!1}var cr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Jc(this);return t===void 0&&J(64,this.name),t}static clone(t){J(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}),kk(this,t)}getType(){return this.__type}isInline(){J(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Hn(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(Ne(this))return o;if(Ke(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Jt(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:Hn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&J(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(ur(n))return Q(t)||t===this&&Jt(t)||J(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&J(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:Hn(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:Hn(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?Nc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Nc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Bx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&J(279),!1)))}isParentOf(t){let n=Nc(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&&J(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=qt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Np(this))return this;let t=Hn(this.__key);return t===null&&J(113),t}getWritable(){if(Np(this))return this;Gn();let t=Da(),n=qt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=St();if(s!==null&&s.setCachedNodes(null),i.has(r))return Bp(a),a;let l=Nx(a);return i.add(r),Bp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){J(70)}updateDOM(t,n,o){J(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){J(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of TL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&nx(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){Hv(this,!0,t)}replace(t,n){Gn();let o=St();o!==null&&(o=o.clone()),yv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;Si(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;if(Hv(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)||J(139),this.getChildren().forEach(g=>{s.append(g)})),Ke(o)){Fo(o);let g=o.anchor,v=o.focus;g.key===a&&qT(g,s),v.key===a&&qT(v,s)}return bi()===a&&jn(i),s}insertAfter(t,n=!0){Gn(),yv(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(Si(r),Ke(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&&Ke(i)){let m=this.getIndexWithinParent();Dp(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(),yv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;Si(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&&Ke(c)&&Dp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Ra()}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(!Ne(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(!Ne(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},C$="historic",b$="history-push",bp="history-merge",I$="paste",rk="collaboration",S$="skip-collab",ak="skip-scroll-into-view",ik="skip-dom-selection",Uv="skip-selection-focus",sk="composition-start",lk="composition-end",Fl=class e extends cr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3699
+ `}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&&jv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&pp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&pp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&jv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&pp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&pp(a))return!0}return!1})(t)?null:{conversion:w$,priority:0}}}static importJSON(t){return Bl().updateFromJSON(t)}};function w$(e){return{node:Bl()}}function Bl(){return Yc(new Fl)}function ws(e){return e instanceof Fl}function pp(e){return aa(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function mv(e,t){return 16&t?"code":t&Zv?"mark":32&t?"sub":64&t?"sup":null}function gv(e,t){return 1&t?"strong":2&t?"em":"span"}function dk(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 po){let c=po[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 ck(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?Dc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||wi){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 HT(e,t,n,o,r,a){ck(r,e,t);let i=a.theme.text;i!==void 0&&dk(0,0,o,e,i)}function mp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var ks=class e extends cr{__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 V5[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===bi()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=po[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return qc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=mv(0,o),a=gv(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)),HT(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=mv(0,a),l=mv(0,i),d=gv(0,a),c=gv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let g=n.firstChild;g==null&&J(48);let v=document.createElement(c);return HT(v,this,0,i,r,o),n.replaceChild(v,g),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&J(49)),ck(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&dk(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:P$,priority:0}),b:()=>({conversion:L$,priority:0}),code:()=>({conversion:ka,priority:0}),em:()=>({conversion:ka,priority:0}),i:()=>({conversion:ka,priority:0}),mark:()=>({conversion:ka,priority:0}),s:()=>({conversion:ka,priority:0}),span:()=>({conversion:T$,priority:0}),strong:()=>({conversion:ka,priority:0}),sub:()=>({conversion:ka,priority:0}),sup:()=>({conversion:ka,priority:0}),u:()=>({conversion:ka,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 ko(n)||J(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=mp(n,"b")),this.hasFormat("italic")&&(n=mp(n,"i")),this.hasFormat("strikethrough")&&(n=mp(n,"s")),this.hasFormat("underline")&&(n=mp(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"?po[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?U5[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=qc(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=q5[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(!Ke(a))return pk(s,o,s,r,"text","text");{let l=bi();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&&Ke(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=bi(),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 A=t[T];A>I&&(s.push(o.slice(I,A)),I=A)}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(Ke(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=ET(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=ET(n,T);let A=T.__key;a===r&&jn(A),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(A){let E=A.getPreviousSibling(),N=A.getNextSibling();E!==null&&Bp(E),N!==null&&Bp(N)})(this);let I=f.getWritable(),T=this.getIndexWithinParent();v?(I.splice(T,0,w),this.remove()):I.splice(T,1,w),Ke(C)&&Dp(C,f,T,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||J(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;bi()===r&&jn(o);let s=St();if(Ke(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&YT(f,n,o,t,i),p!==null&&p.key===r&&YT(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 T$(e){return{forChild:mx(e.style),node:null}}function L$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:mx(t.style,n?void 0:"bold"),node:null}}var UT=new WeakMap;function k$(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 P$(e){let t=e;e.parentElement===null&&J(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=UT.get(a))===void 0&&!k$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)UT.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===`
3700
3700
  `||s===`\r
3701
- `?r.push(yl()):s===" "?r.push(Tp()):s!==""&&r.push(Hn(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=sT(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=sT(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:Hn(n)}}function sT(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,vo(n)){let a=n.style.display;if(a===""&&!ak(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Qr(n))return n;if(n.nodeName==="BR")return null}}var O5={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ga(e){let t=O5[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:zv(e.style,t),node:null}}function Hn(e=""){return Ec(new cs(e))}function Ae(e){return e instanceof cs}function zv(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=>(Ae(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 Cl=class e extends cs{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=vl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return Tp().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&_T(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||Y(286),this}setDetail(t){return t!==2&&Y(127),this}setMode(t){return t!=="normal"&&Y(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Tp(){return Ec(new Cl)}function $v(e){return e instanceof Cl}var mv=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:lx(pr(fi(this,"next")),pr(fi(t,"next")))<0}getNode(){let t=_n(this.key);return t===null&&Y(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,Al()||(ri()===i&&Kn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function vr(e,t,n){return new mv(e,t,n)}function Hh(e,t){let n=t.__key,o=e.offset,r="element";if(Ae(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!j(t)){let a=t.getNextSibling();if(Ae(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 lT(e,t){if(j(t)){let n=t.getLastDescendant();j(n)||Ae(n)?Hh(e,n):Hh(e,t)}else Hh(e,t)}var mp=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(!Lc(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(Ae(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=_n(r);a!==null&&o.push(a)}return Al()||(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((It()||ms())===this&&t[0]){let n=Wn(t[0],"next");ck(ui(n,n))}for(let n of t)n.remove()}};function $e(e){return e instanceof us}var us=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!!$e(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(gr(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;j(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),ps(o.focus)&&j(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Ia(o.focus.origin,"previous");gr(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(!j(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=>ba(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(cx(Sv(this),"next"));return Al()||(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(j(p)&&!p.isInline())c||(d+=`
3702
- `),c=!p.isEmpty();else if(c=!1,Ae(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=Bt(),o=n.getEditorState()._selection,r=EL(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),ap(this)}clone(){let t=this.anchor,n=this.focus;return new e(vr(t.key,t.offset,t.type),vr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Sc(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=Zn[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===`
3701
+ `?r.push(Bl()):s===" "?r.push(Vp()):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=KT(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=KT(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 KT(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===""&&!Hk(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(aa(n))return n;if(n.nodeName==="BR")return null}}var E$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ka(e){let t=E$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:mx(e.style,t),node:null}}function Wn(e=""){return Yc(new ks(e))}function Ne(e){return e instanceof ks}function mx(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=>(Ne(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 Vp().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&hL(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||J(286),this}setDetail(t){return t!==2&&J(127),this}setMode(t){return t!=="normal"&&J(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Vp(){return Yc(new zl)}function gx(e){return e instanceof zl}var Kv=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:Fx(Lr(Ei(this,"next")),Lr(Ei(t,"next")))<0}getNode(){let t=Hn(this.key);return t===null&&J(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()||(bi()===i&&jn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Ar(e,t,n){return new Kv(e,t,n)}function hv(e,t){let n=t.__key,o=e.offset,r="element";if(Ne(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!Q(t)){let a=t.getNextSibling();if(Ne(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)||Ne(n)?hv(e,n):hv(e,t)}else hv(e,t)}var _p=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(!Gc(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(Ne(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=Hn(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");Wk(Pi(n,n))}for(let n of t)n.remove()}};function Ke(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!!Ke(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(Pr(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=_a(o.focus.origin,"previous");Pr(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=Lr(o.anchor),c=Lr(o.anchor.getFlipped()),f=m=>Na(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(zx(Jv(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]=qv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(Q(p)&&!p.isInline())c||(d+=`
3702
+ `),c=!p.isEmpty();else if(c=!1,Ne(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!Jt(p)&&!ws(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=qt(),o=n.getEditorState()._selection,r=fk(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),Tp(this)}clone(){let t=this.anchor,n=this.focus;return new e(Ar(t.key,t.offset,t.type),Ar(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=qc(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=po[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===`
3703
3703
  `||i===`\r
3704
- `?o.push(yl()):i===" "?o.push(Tp()):o.push(Hn(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),T=Hn();if(T.setFormat(y),T.setStyle(C),zL(k))k.splice(0,0,[T]);else{let L=jn(w)?Ca().append(T):T;k===null?w.append(L):k.insertBefore(L)}v.is(x)&&x.set(T.__key,0,"text"),v.set(T.__key,0,"text")})(i,s,r,a),s.type==="element"&&Pl(s,pr(fi(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Ae(p)||Y(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&&(va(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Ae(v)&&v.canInsertTextBefore()&&!va(v)||(v=Hn(),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&&(va(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Ae(v)&&!va(v)||(v=Hn(),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=Hn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||j(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),AL(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(ai(p)){let C=Hn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),x=p.getStyle();if(l!==d||v===r&&x===a){if($v(p)){let C=Hn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=Hn(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=j(p)?p:p.getParentOrThrow(),y=j(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(Ae(g)&&!ai(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let b=Hn(g.getTextContent());g.replace(b),g=b}jn(s.getNode())||s.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let b=g.getParentOrThrow();b.canBeEmpty()||b.getChildrenSize()!==1?g.remove():b.remove()}else v.add(g.__key);let w=y.getChildren(),k=new Set(c),T=x.is(y),L=x.isInline()&&p.getNextSibling()===null?x:p;for(let b=w.length-1;b>=0;b--){let S=w[b];if(S.is(p)||j(S)&&S.isParentOf(p))break;S.isAttached()&&(!k.has(S)||S.is(C)?T||L.insertAfter(S,!1):S.remove())}if(!T){let b=y,S=null;for(;b!==null;){let A=b.getChildren(),E=A.length;(E===0||A[E-1].is(S))&&(v.delete(b.__key),S=b),b=b.getParent()}}if(ai(p))if(l===m)p.select();else{let b=Hn(t);b.select(),p.replace(b)}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 b=1;b<f;b++){let S=c[b],A=S.__key;v.has(A)||S.remove()}}}removeText(){let t=It()===this;pc(this,uk(Sv(this))),t&&It()!==this&&To(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Kn(null);let o=this.getNodes(),r=[];for(let w of o)Ae(w)&&r.push(w);let a=w=>{o.forEach(k=>{if(j(k)){let T=k.getFormatFlags(t,w);k.setTextFormat(T)}})},i=r.length;if(i===0)return this.toggleFormat(t),Kn(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(va(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||va(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let C=x.getFormatFlags(t,g);y>0&&(y===x.getTextContentSize()||va(x)||([x]=x.splitText(y)),x.setFormat(C));for(let w=p+1;w<v;w++){let k=r[w],T=k.getFormatFlags(t,C);k.setFormat(T)}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=It();return $e(h)||Y(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=uc(n,ya),r=t[t.length-1];if(j(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=Uh(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(j(h)||qt(h))&&!h.isInline())){j(o)||Y(211,n.constructor.name,n.getType());let h=Uh(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=Ca(),v=null;for(let x=0;x<h.length;x++){let y=h[x],C=ss(y);if(C||qt(y)&&y.isInline()||j(y)&&y.isInline()||Ae(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=!j(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;j(f=c)&&ya(f)&&!f.isEmpty()&&j(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(j(o)||Y(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&Y(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),x=g,y=[g];for(;x!==v;)x.getNextSibling()||Y(140),x=x.getNextSibling(),y.push(x);let C=h;for(let w of y)C=C.insertAfter(w)})(o,c));let p=uc(i,ya);l&&j(p)&&(l.canMergeWhenEmpty()||ya(d))&&(p.append(...l.getChildren()),l.remove()),j(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=j(o)?o.getLastChild():null;ss(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Ca();return Ro().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Uh(this),n=uc(this.anchor.getNode(),ya);j(n)||Y(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=yl();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(Ae(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(Ae(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Ae(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(vT(this,t,n,o))return;let r=t==="move",a=Bt(),i=yr(No(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!j(d)||d.isInline()||d.canBeEmpty()||xv(s,a,l),this.dirty){let c=Sl(a,this.anchor.key),f=Sl(a,this.focus.key);this.anchor.type==="text"&&(c=fs(c)),this.focus.type==="text"&&(f=fs(f)),c&&f&&NL(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=jn(f)?f:tk(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];yp(x,p)?h.push(x):g=!0}if(g&&h.length>0)if(n){let v=h[0];j(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];j(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"&&vT(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&j(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(j(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=ix(fi(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(gr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(j(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=pr(l);pc(this,ui(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(ps(l)){if(j(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())&&j(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=Hv();d.add(l.origin.getKey()),To(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return pc(this,ui(!l.origin.isEmpty()&&d.isEmpty()?Ml(Wn(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&&cT(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 uT(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 uT(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!(jL(w)||F5(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()&&jn(o.getParent())&&o.getPreviousSibling()===null&&cT(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 Lc(e){return e instanceof mp}function dT(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]:[dT(n),dT(o)]}function cT(e,t){for(let n=t;n;n=n.getParent()){if(j(n)){if(n.collapseAtStart(e))return!0;if(Jo(n))break}if(n.getPreviousSibling())break}return!1}var F5=(()=>{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 uT(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 fT(e,t,n,o){let r,a=t;if(vo(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=ml(c),Ae(r))a=hr(r,i?"next":"previous");else{let p=ml(e);if(p===null)return null;if(j(p)){let m=o.getElementByKey(p.getKey());m===null&&Y(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),j(p)||Y(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(j(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=j(g)?g:g.getParentOrThrow()),a=0}Ae(g)?(r=g,p=null,a=hr(g,i?"next":"previous")):g!==p&&i&&!f&&(j(p)||Y(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&qt(p)&&ml(e)===p?m:m+1,p=p.getParentOrThrow()}if(j(p))return vr(p.__key,a,"element")}}else r=ml(e);return Ae(r)?vr(r.__key,hr(r,a,"clamp"),"text"):null}function pT(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&&j(i)&&i.isInline()){let s=i.getPreviousSibling();Ae(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else j(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Ae(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&j(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&j(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Ae(s)&&e.set(s.__key,0,"text")}}}function AL(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);pT(e,o,r),pT(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function EL(e,t,n,o,r,a){if(e===null||n===null||!kc(r,e,n))return null;let i=fT(e,t,$e(a)?a.anchor:null,r);if(i===null)return null;let s=fT(n,o,$e(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=ml(e),d=ml(n);if(qt(l)&&qt(d))return null}return AL(i,s),[i,s]}function B5(e){return j(e)&&!e.isInline()}function ML(e,t,n,o,r,a){let i=Sa(),s=new us(vr(e,t,r),vr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function RL(){let e=vr("root",0,"element"),t=vr("root",0,"element");return new us(e,t,0,"")}function Hv(){return new mp(new Set)}function z5(e,t){return Lp(null,e,t,null)}function Lp(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=!Qh&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if($e(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)&&$e(e)&&!kc(n,d,c))return e.clone();let m=EL(d,f,c,p,n,e);if(m===null)return null;let[h,g]=m,v=0,x="";if($e(e)){let y=e.anchor;if(h.key===y.key)v=e.format,x=e.style;else{let C=h.getNode();Ae(C)?(v=C.getFormat(),x=C.getStyle()):j(C)&&(v=C.getTextFormat(),x=C.getTextStyle())}}return new us(h,g,v,x)}function It(){return Sa()._selection}function ms(){return Bt()._editorState._selection}function gp(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"),mT(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")}}mT(e)}function mT(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!j(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Ae(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(j(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Ae(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(j(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Ae(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,Ae(o)?(i=o.getTextContentSize(),s="text"):j(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Ae(r)?s="text":j(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 gT(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 NL(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function hT(e,t,n){let o=Sl(e,t.getKey());if(j(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function $5(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(IL)&&f!==a||f!==null&&Gv(f))return;if(!$e(t))return void(e!==null&&kc(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=hT(n,h,p.offset),[y,C]=hT(n,g,m.offset),w=t.format,k=t.style,T=t.isCollapsed(),L=v,b=y,S=!1;var A,E,B,R,N;if(p.type==="text"?(L=fs(v),S=h.getFormat()!==w||h.getStyle()!==k):$e(e)&&e.anchor.type==="text"&&(S=!0),m.type==="text"&&(b=fs(y)),L!==null&&b!==null&&(T&&(e===null||S||$e(e)&&(e.format!==w||e.style!==k))&&(A=w,E=k,B=x,R=p.key,N=performance.now(),gL=[A,E,B,R,N]),d!==x||c!==C||s!==L||l!==b||o.type==="Range"&&T||(f!==null&&a.contains(f)||r.has(pv)||a.focus({preventScroll:!0}),p.type==="element"))){if(NL(o,L,x,b,C),!si||!t.isCollapsed()||a===null||r.has(pv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(SL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let H=$e(t)&&t.anchor.type==="element"?L.childNodes[x]||null:o.rangeCount>0?o.getRangeAt(0):null;if(H!==null){let D;if(H instanceof Text){let W=document.createRange();W.selectNode(H),D=W.getBoundingClientRect()}else D=H.getBoundingClientRect();(function(W,xe,ie){let Q=ex(ie),Ye=tx(Q);if(Q===null||Ye===null)return;let{top:Oe,bottom:ke}=xe,Be=0,Se=0,ce=ie;for(;ce!==null;){let Ne=ce===Q.body;if(Ne)Be=0,Se=No(W).innerHeight;else{let ee=ce.getBoundingClientRect();Be=ee.top,Se=ee.bottom}let ge=0;if(Oe<Be?ge=-(Be-Oe):ke>Se&&(ge=ke-Se),ge!==0)if(Ne)Ye.scrollBy(0,ge);else{let ee=ce.scrollTop;ce.scrollTop+=ge;let ye=ce.scrollTop-ee;Oe-=ye,ke-=ye}if(Ne)break;ce=Ac(ce)}})(n,D,a)}}cv=!0}}function H5(e){let t=It()||ms();t===null&&(t=Ro().selectEnd()),t.insertNodes(e)}function U5(){let e=It();return e===null?"":e.getTextContent()}function Uh(e){let t=e;e.isCollapsed()||t.removeText();let n=It();$e(n)&&(t=n),$e(t)||Y(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!ya(r);){let i=r;if([r,a]=K5(r,a),i.is(r))break}return a}function K5(e,t){let n=e.getParent();if(!n){let r=Ca();return Ro().append(r),r.select(),[Ro(),0]}if(Ae(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(!j(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new us(vr(e.__key,t,"element"),vr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function vT(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=fi(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!fk(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 ix(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(gr(c))c.origin.isInline()||(l=c);else{if(j(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=Hv();return c.add(l.origin.getKey()),To(c),!0}return l=pr(l),s&&Pl(e.anchor,l),Pl(e.focus,l),d||!i}var Vn=null,qn=null,wo=!1,Kh=!1,np=0,xT={characterData:!0,childList:!0,subtree:!0};function Al(){return wo||Vn!==null&&Vn._readOnly}function Un(){wo&&Y(13)}function _L(){np>99&&Y(14)}function Sa(){return Vn===null&&Y(195,DL()),Vn}function Bt(){return qn===null&&Y(196,DL()),qn}function DL(){let e=0,t=new Set,n=di.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=Pc(r);if(Pp(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 V5(){return qn}function yT(e,t,n){let o=t.__type,r=qv(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 CT(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function OL(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 q5(e){return Uv(e,Bt()._nodes)}function Uv(e,t){let n=e.type,o=t.get(n);o===void 0&&Y(17,n);let r=o.klass;e.type!==r.getType()&&Y(18,r.name);let a=r.importJSON(e),i=e.children;if(j(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Uv(i[s],t);a.append(l)}return a}function bT(e,t,n){let o=Vn,r=wo,a=qn;Vn=t,wo=!0,qn=e;try{return n()}finally{Vn=o,wo=r,qn=a}}function xa(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=Vn,c=wo,f=qn,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){qn=e,Vn=n,wo=!1,e._updating=!0;try{let T=e._dirtyType,L=e._dirtyElements,b=e._dirtyLeaves;m.disconnect(),h=c5(a,n,e,T,L,b)}catch(T){if(T instanceof Error&&e._onError(T),Kh)throw T;return $L(e,null,o,n),HT(e),e._dirtyType=2,Kh=!0,xa(e,a),void(Kh=!1)}finally{m.observe(o,xT),e._updating=p,Vn=d,wo=c,qn=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(T,L){let b=T._decorators,S=T._pendingDecorators||b,A=L._nodeMap,E;for(E in S)A.has(E)||(S===b&&(S=WL(T)),delete S[E])})(e,n);let w=r?null:yr(No(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!y.has(wL)){qn=e,Vn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let T=e._blockCursorElement;T!==null&&xv(T,e,o),$5(i,s,e,w,y,o)}(function(T,L,b){let S=T._blockCursorElement;if($e(b)&&b.isCollapsed()&&b.anchor.type==="element"&&L.contains(document.activeElement)){let A=b.anchor,E=A.getNode(),B=A.offset,R=!1,N=null;if(B===E.getChildrenSize())qh(E.getChildAtIndex(B-1))&&(R=!0);else{let H=E.getChildAtIndex(B);if(H!==null&&qh(H)){let D=H.getPreviousSibling();(D===null||qh(D))&&(R=!0,N=T.getElementByKey(H.__key))}}if(R){let H=T.getElementByKey(E.__key);return S===null&&(T._blockCursorElement=S=(function(D){let W=D.theme,xe=document.createElement("div");xe.contentEditable="false",xe.setAttribute("data-lexical-cursor","true");let ie=W.blockCursor;if(ie!==void 0){if(typeof ie=="string"){let Q=Rc(ie);ie=W.blockCursor=Q}ie!==void 0&&xe.classList.add(...ie)}return xe})(T._config)),L.style.caretColor="transparent",void(N===null?H.appendChild(S):H.insertBefore(S,N))}}S!==null&&xv(S,T,L)})(e,o,s)}finally{m!==null&&m.observe(o,xT),qn=f,Vn=d}}h!==null&&(function(T,L,b,S,A){let E=Array.from(T._listeners.mutation),B=E.length;for(let R=0;R<B;R++){let[N,H]=E[R];for(let D of H){let W=L.get(D);W!==void 0&&N(W,{dirtyLeaves:S,prevEditorState:A,updateTags:b})}}})(e,h,y,g,a),$e(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(Pv,void 0);let k=e._pendingDecorators;k!==null&&(e._decorators=k,e._pendingDecorators=null,cc("decorator",e,!0,k)),(function(T,L,b){let S=TT(L),A=TT(b);S!==A&&cc("textcontent",T,!0,A)})(e,t||a,n),cc("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:x,prevEditorState:t||a,tags:y}),(function(T,L){if(T._deferred=[],L.length!==0){let b=T._updating;T._updating=!0;try{for(let S=0;S<L.length;S++)L[S]()}finally{T._updating=b}}})(e,C),(function(T){let L=T._updates;if(L.length!==0){let b=L.shift();if(b){let[S,A]=b;kp(T,S,A)}}})(e)}function cc(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 IT(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&&Y(191),s._flushSync=!0),l&&e._deferred.push(l),OL(e,i.tag)),s==null?kp(e,a,i):a()}}return o}function kp(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,OL(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=FL(l||s),d=!0),l._flushSync=i;let c=Vn,f=wo,p=qn,m=e._updating;Vn=l,wo=!1,e._updating=!0,qn=e;let h=e._headless||e.getRootElement()===null;Vv(null);try{d&&(h?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(y,C){let w=y.getEditorState()._selection,k=yr(No(y));return $e(w)||w==null?Lp(w,k,y,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=IT(e,a),(function(y,C){let w=C.getEditorState()._selection,k=y._selection;if($e(k)){let T=k.anchor,L=k.focus,b;if(T.type==="text"&&(b=T.getNode(),b.selectionTransform(w,k)),L.type==="text"){let S=L.getNode();b!==S&&S.selectionTransform(w,k)}}})(l,e),e._dirtyType!==0&&(a?(function(y,C){let w=C._dirtyLeaves,k=y._nodeMap;for(let T of w){let L=k.get(T);Ae(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&Xw(L)}})(l,e):(function(y,C){let w=C._dirtyLeaves,k=C._dirtyElements,T=y._nodeMap,L=ri(),b=new Map,S=w,A=S.size,E=k,B=E.size;for(;A>0||B>0;){if(A>0){C._dirtyLeaves=new Set;for(let R of S){let N=T.get(R);Ae(N)&&N.isAttached()&&N.isSimpleText()&&!N.isUnmergeable()&&Xw(N),N!==void 0&&CT(N,L)&&yT(C,N,b),w.add(R)}if(S=C._dirtyLeaves,A=S.size,A>0){np++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,E.delete("root")&&E.set("root",!0);for(let R of E){let N=R[0],H=R[1];if(k.set(N,H),!H)continue;let D=T.get(N);D!==void 0&&CT(D,L)&&yT(C,D,b)}S=C._dirtyLeaves,A=S.size,E=C._dirtyElements,B=E.size,np++}C._dirtyLeaves=w,C._dirtyElements=k})(l,e),IT(e),(function(y,C,w,k){let T=y._nodeMap,L=C._nodeMap,b=[];for(let[S]of k){let A=L.get(S);A!==void 0&&(A.isAttached()||(j(A)&&BT(A,S,T,L,b,k),T.has(S)||k.delete(S),b.push(S)))}for(let S of b)L.delete(S);for(let S of w){let A=L.get(S);A===void 0||A.isAttached()||(T.has(S)||w.delete(S),L.delete(S))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let x=l._selection;if($e(x)){let y=l._nodeMap,C=x.anchor.key,w=x.focus.key;y.get(C)!==void 0&&y.get(w)!==void 0||Y(19)}else Lc(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 xa(e)}finally{Vn=c,wo=f,qn=p,e._updating=m,np=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,xa(e)):d&&e$(()=>{xa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function jr(e,t,n){qn===e&&n===void 0?t():kp(e,t,n)}var hv=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&&Y(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&Y(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&Y(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"&&(Ip||Tc||bp);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=ST(n,o);a.push(r);let i=ST(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 ST(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&&Y(225),n.reverse()}var li=class extends Yo{__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 Xz[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=Bt()._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(Ae(n)&&t.push(n),j(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;j(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;j(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 j(a)&&a.getLastDescendant()||a||null}let r=n[t];return j(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:_n(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&Y(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:_n(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&Y(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(),j(a)&&r!==o-1&&!a.isInline()&&(t+=Sp)}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(),j(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=jh[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=Zn[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Sc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Un();let o=It(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Ae(l)||j(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Ae(l)||j(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return $e(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):ML(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!==""?jh[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){pp(this)&&Y(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||Y(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&&Y(100);let g=m.getNextSibling(),v=m.__key;ii(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--,ii(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&&Y(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=It();if($e(m)){let h=new Set(l),g=new Set(s),{anchor:v,focus:x}=m;wT(v,h,g)&&hp(v,v.getNode(),this,c,d),wT(x,h,g)&&hp(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||Jo(this)||this.remove()}}return a}getDOMSlot(t){return new hv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(vo(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===""||Jo(this)||this.getChildren().some(Ae)||(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 j(e){return e instanceof li}function wT(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 bc=class extends Yo{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function qt(e){return e instanceof bc}var bl=class e extends li{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Y(51)}getTextContent(){let t=this.__cachedText;return!Al()&&Bt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){Y(52)}replace(t){Y(53)}insertBefore(t){Y(54)}insertAfter(t){Y(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)j(r)||qt(r)||Y(282);return super.splice(t,n,o)}static importJSON(t){return Ro().updateFromJSON(t)}collapseAtStart(){return!0}};function jn(e){return e instanceof bl}function FL(e){return new Ic(new Map(e._nodeMap))}function Kv(){return new Ic(new Map([["root",new bl]]))}function BL(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Y(130,n.name),j(e)){let o=t.children;Array.isArray(o)||Y(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=BL(r[a]);o.push(i)}}return t}function W5(e){return e instanceof Ic}var Ic=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 bT(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 bT(null,this,()=>({root:BL(Ro())}))}},vp=class extends li{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Il=class e extends li{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=vl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:G5,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(vo(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Ca().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Ae);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Ca();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||Ae(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 G5(e){let t=Ca();if(e.style&&(t.setFormat(e.style.textAlign),ik(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in jh&&t.setFormat(n)}return{node:t}}function Ca(){return Ec(new Il)}function zL(e){return e instanceof Il}var pl=0,j5=1,Q5=2,X5=3,Y5=4;function $L(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=Kv(),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 HL(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Mc(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 Yo&&i!==Yo?i:void 0}}return t}function J5(e){let t=e||{},n=V5(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=Kv(),s=t.namespace||(r!==null?r._config.namespace:QL()),l=t.editorState,d=[bl,cs,xl,Cl,Il,vp,...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}Mc(v);let C=v.getType(),w=HL(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:UT(d[g]),transforms:w})}}let h=new di(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 T=x.get(k);T===void 0&&(T=[],x.set(k,T)),T.push(w[k])})};return g.forEach(w=>{let k=w.klass.importDOM;if(k==null||y.has(k))return;y.add(k);let T=k.call(w.klass);T!==null&&C(T)}),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(Av,C5,pl),g.registerCommand(Ev,b5,pl),g.registerCommand(Mv,I5,pl),g.registerCommand(Rv,S5,pl),g.registerCommand(Ov,w5,pl)})(h),h}var di=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=QL(),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&&Y(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&&Y(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&&Y(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=Cv(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=Cv(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=_n(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:tp}: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 me(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=vl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,$L(this,n,t,r),n!==null&&(this._config.disableEvents||T5(n),o!=null&&n.classList.remove(...o)),t!==null){let a=tx(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,HT(this),this._updateTags.add(tp),xa(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;dv.set(s,d);let c=up.get(d)??0;c<1&&d.addEventListener("selectionchange",CL),up.set(d,c+1),s.__lexicalEditor=l;let f=yL(s);for(let p=0;p<lv.length;p++){let[m,h]=lv[p],g=typeof h=="function"?v=>{oT(v)||(nT(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(oT(v))return;nT(v);let x=l.isEditable();switch(m){case"cut":return x&&me(l,Bv,v);case"copy":return me(l,Fv,v);case"paste":return x&&me(l,Nv,v);case"dragstart":return x&&me(l,sL,v);case"dragover":return x&&me(l,lL,v);case"dragend":return x&&me(l,dL,v);case"focus":return x&&me(l,cL,v);case"blur":return x&&me(l,uL,v);case"drop":return x&&me(l,iL,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(tp),xa(this);cc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&Y(38);let o=t;o._readOnly&&(o=FL(t),o._selection=t._selection?t._selection.clone():null),$T(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),xa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||xa(this)}parseEditorState(t,n){return(function(o,r,a){let i=Kv(),s=Vn,l=wo,d=qn,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,Vn=i,wo=!1,qn=r,Vv(null);try{let h=r._nodes;Uv(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,Vn=s,wo=l,qn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return xa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):kp(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),jr(this,()=>{let r=It(),a=Ro();r!==null?r.dirty||To(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Mp("focus"),ek(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=yr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,cc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};di.version="0.41.0+prod.esm";var vv=null;function Vv(e){vv=e}var UL=1;function Z5(){UL=1}function qv(e,t){let n=Wv(e,t);return n===void 0&&Y(30,t),n}function Wv(e,t){return e._nodes.get(t)}var e$=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function KL(e){return qt(Ep(e))}function Gv(e){let t=document.activeElement;if(!vo(t))return!1;let n=t.nodeName;return qt(Ep(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&Pc(t)==null)}function kc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Gv(t)&&jv(t)===e}catch{return!1}}function Pp(e){return e instanceof di}function jv(e){let t=e;for(;t!=null;){let n=Pc(t);if(Pp(n))return n;t=Ac(t)}return null}function Pc(e){return e?e.__lexicalEditor:null}function t$(e){return Gz.test(e)?"rtl":jz.test(e)?"ltr":null}function ai(e){return $v(e)||e.isToken()}function va(e){return ai(e)||e.isSegmented()}function Qr(e){return El(e)&&e.nodeType===3}function VL(e){return El(e)&&e.nodeType===9}function fs(e){let t=e;for(;t!=null;){if(Qr(t))return t;t=t.firstChild}return null}function Sc(e,t,n){let o=Zn[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~Zn.superscript:t==="superscript"?r&=~Zn.subscript:t==="lowercase"?(r&=~Zn.uppercase,r&=~Zn.capitalize):t==="uppercase"?(r&=~Zn.lowercase,r&=~Zn.capitalize):t==="capitalize"&&(r&=~Zn.lowercase,r&=~Zn.uppercase),r}function n$(e){return Ae(e)||ss(e)||qt(e)}function qL(e,t){let n=(function(){let i=vv;return vv=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Un(),_L();let o=Bt(),r=Sa(),a=""+UL++;r._nodeMap.set(a,e),j(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function ii(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 xp(e){_L(),pp(e)&&Y(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Sa(),r=Bt(),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,j(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Kn(e){Un();let t=Bt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=_n(n);o!==null&&o.getWritable()}if(e!==null){let o=_n(e);o!==null&&o.getWritable()}}}function ri(){return Al()?null:Bt()._compositionKey}function _n(e,t){let n=(t||Sa())._nodeMap.get(e);return n===void 0?null:n}function Qv(e,t){let n=Ap(e,Bt());return n!==void 0?_n(n,t):null}function Ap(e,t){return e[`__lexicalKey_${t._key}`]}function Ep(e,t){let n=e;for(;n!=null;){let o=Qv(n,t);if(o!==null)return o;n=Ac(n)}return null}function WL(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function TT(e){return e.read(()=>Ro().getTextContent())}function Ro(){return GL(Sa())}function GL(e){return e._nodeMap.get("root")}function To(e){Un();let t=Sa();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function ml(e){let t=Bt(),n=(function(o,r){let a=o;for(;a!=null;){let i=Ap(a,r);if(i!==void 0)return i;a=Ac(a)}return null})(e,t);return n===null?e===t.getRootElement()?_n("root"):null:_n(n)}function jL(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Xv(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function QL(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function XL(e){return Qr(e)?e.nodeValue:null}function Yv(e,t,n){let o=yr(No(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=XL(r),l=Ep(r);if(s!==null&&Ae(l)){if((s===mc||s===Tv)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Jv(l,s,a,i,e)}}}function Jv(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(mc)&&(s=t.slice(0,-mc.length)),r)){let d=Tv,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(Kn(null),bp||Tc||Ip)a.remove();else{let g=Bt();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=ms(),f=a.getTextContentSize(),p=ri(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||$e(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=It();if(!$e(h)||n===null||o===null)return void LT(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=Hn(a.getTextContent());a.replace(g),a=g}LT(a,s,h)}}}function LT(e,t,n){if(e.setTextContent(t),$e(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=hr(e,a.offset,"clamp"))}}}function Qf(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function YL(e,t){return Qf(e,t,"altKey")&&Qf(e,t,"ctrlKey")&&Qf(e,t,"shiftKey")&&Qf(e,t,"metaKey")}function Tt(e,t,n){if(!YL(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 ha={ctrlKey:!fr,metaKey:fr},kT={altKey:fr,ctrlKey:!fr};function PT(e){return e.key==="Backspace"}function AT(e){return Tt(e,"a",ha)}function o$(e){let t=Ro();if($e(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"),ap(e),e}{let n=t.select(0,t.getChildrenSize());return To(ap(n)),n}}function vl(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=Rc(r);return n[t]=a,a}return r}function Zv(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&Y(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 r$(e){let t=e.getType(),n=Sa();if(n._readOnly){let a=Cv(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 ET(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 JL(e,t){let n=e.offset;if(e.type==="element")return ET(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?ET(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function ZL(e){let t=No(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function me(e,t,n){return(function(o,r,a){let i=Xv(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(jr(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 Sl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&Y(75,t),n}function Ac(e){let t=e.assignedSlot||e.parentElement;return rk(t)?t.host:t}function ex(e){return VL(e)?e:vo(e)?e.ownerDocument:null}function a$(e){return Bt()._updateTags.has(e)}function Mp(e){Un(),Bt()._updateTags.add(e)}function ek(e){Un(),Bt()._deferred.push(e)}function yp(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function tx(e){let t=ex(e);return t?t.defaultView:null}function No(e){let t=e._window;return t===null&&Y(78),t}function i$(e){return j(e)&&e.isInline()||qt(e)&&e.isInline()}function tk(e){let t=e.getParentOrThrow();for(;t!==null;){if(Jo(t))return t;t=t.getParentOrThrow()}return t}function Jo(e){return jn(e)||j(e)&&e.isShadowRoot()}function nx(e){let t=e.constructor.clone(e);return qL(t,null),t.afterCloneFrom(e),t}function Ec(e){let t=Bt(),n=e.getType(),o=Wv(t,n);o===void 0&&Y(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||Y(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||Y(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&Y(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Vh(e,t){!jn(e.getParent())||j(t)||qt(t)||Y(99)}function nk(e){let t=_n(e);return t===null&&Y(63,e),t}function qh(e){return(qt(e)||j(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 yr(e){return xr?(e||window).getSelection():null}function ok(e){let t=tx(e);return t?t.getSelection():null}function s$(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),Jo(e)&&Y(102);let o=i=>{let s=i.getParentOrThrow(),l=Jo(s),d=i!==n||l?nx(i):i;if(l)return j(i)&&j(d)||Y(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 l$(e){return vo(e)&&e.tagName==="A"}function vo(e){return El(e)&&e.nodeType===1}function El(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function rk(e){return El(e)&&e.nodeType===11}function ak(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 ya(e){if(qt(e)&&!e.isInline())return!0;if(!j(e)||Jo(e))return!1;let t=e.getFirstChild(),n=t===null||ss(t)||Ae(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function ox(){return Bt()}var MT=new WeakMap,d$=new Map;function Cv(e){if(!e._readOnly&&e.isEmpty())return d$;e._readOnly||Y(192);let t=MT.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),MT.set(e,t)),t}function rx(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function c$(e){return(t=rx(e))[bL]=!0,t;var t}function ik(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function u$(e){e.__lexicalUnmanaged=!0}function sk(e){return e.__lexicalUnmanaged===!0}function ic(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==Yo[t]}function Mc(e){let t=Kw in e.prototype?e.prototype[Kw]():void 0,n=(function(i){if(!(i===Yo||i.prototype instanceof Yo)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{di.version&&(l=JSON.parse(di.version))}catch{}Y(290,i.name,s,l)}return i===bc||i===li||i===Yo})(e),o=!n&&ic(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&&(ic(e,"getType")||(e.getType=()=>a),ic(e,"clone")||(e.clone=i=>(Vv(i),new e)),ic(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!ic(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function f$(e){let t=ox();return Un(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var uc=(e,t)=>{let n=e;for(;n!=null&&!jn(n);){if(t(n))return n;n=n.getParent()}return null},p$={next:"previous",previous:"next"},wl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return sx({hasNext:ps,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Wn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Wn(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&&Y(263,Array.from(s).join(" "))}else a.insert(l);a=Wn(l,this.direction)}for(let l of s.values())l.remove();return this}},wc=class e extends wl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ia(t,this.direction)}getParentCaret(t="root"){return Wn(ax(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=mi(this.direction);return Wn(this.getNodeAtCaret(),t)||Ia(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)}},m$={root:jn,shadowRoot:Jo};function mi(e){return p$[e]}function ax(e,t="root"){return m$[t](e)?null:e}var Tl=class e extends wl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Wn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return j(this.origin)?Ia(this.origin,this.direction):null}getParentCaret(t="root"){return Wn(ax(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=mi(this.direction);return Wn(this.getNodeAtCaret(),t)||Ia(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 Ll)&&this.direction===t.direction&&this.origin.is(t.origin)}},Ll=class e extends wl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:ci(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Wn(ax(this.getParentAtCaret(),t),this.direction)}getFlipped(){return ci(this.origin,mi(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 Tl||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Wn(this.origin,this.direction)}};function ba(e){return e instanceof Ll}function g$(e){return e instanceof wl}function ps(e){return e instanceof Tl}function gr(e){return e instanceof wc}var h$={next:class extends Ll{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ll{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},v$={next:class extends Tl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Tl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},x$={next:class extends wc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends wc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Wn(e,t){return e?new v$[t](e):null}function ci(e,t,n){return e?new h$[t](e,hr(e,n)):null}function hr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&_T(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function bv(e,t){return new Cp(e,t)}function Ia(e,t){return j(e)?new x$[t](e):null}function lk(e){return e&&e.getChildCaret()||e}function kl(e){return e&&lk(e.getAdjacentCaret())}var Iv=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 ba(a)?(function(i,s){let{direction:l,origin:d}=i,c=hr(d,s==="focus"?mi(l):l);return bv(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[bv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=ba(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=ba(o),a=i=>i.isSameNodeCaret(o)?null:kl(i)||i.getParentCaret(t);return sx({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")}},Cp=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 ci(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function y$(e){return e instanceof Cp}function ix(e){return ui(e,Wn(Ro(),e.direction))}function dk(e){return ui(e,e)}function ui(e,t){return e.direction!==t.direction&&Y(265),new Iv(e,t,e.direction)}function sx(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 lx(e,t){let n=fc(e.origin,t.origin);switch(n===null&&Y(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 dx(n)}}function dx(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 Xf(e,t){return t.is(e)}function RT(e){return j(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function fc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=RT(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=RT(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(Xf(e,o)||Y(276),{commonAncestor:o,type:"ancestor"}):r===null?(Xf(t,o)||Y(277),{commonAncestor:o,type:"descendant"}):((j(a)||Xf(e,a))&&(j(r)||Xf(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||Y(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function fi(e,t){let{type:n,key:o,offset:r}=e,a=nk(e.key);return n==="text"?(Ae(a)||Y(266,a.getType(),o),ci(a,t,r)):(j(a)||Y(267,a.getType(),o),pk(a,e.offset,t))}function Pl(e,t){let{origin:n,direction:o}=t,r=o==="next";ba(t)?e.set(n.getKey(),t.offset,"text"):ps(t)?Ae(n)?e.set(n.getKey(),hr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(gr(t)&&j(n)||Y(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function ck(e){let t=It(),n=$e(t)?t:RL();return pc(n,e),To(n),n}function pc(e,t){Pl(e.anchor,t.anchor),Pl(e.focus,t.focus)}function Sv(e){let{anchor:t,focus:n}=e,o=fi(t,"next"),r=fi(n,"next"),a=lx(o,r)<=0?"next":"previous";return ui(pi(o,a),pi(r,a))}function Ml(e){let{direction:t,origin:n}=e,o=Wn(n,mi(t)).getNodeAtCaret();return o?Wn(o,t):Ia(n.getParentOrThrow(),t)}function NT(e,t="root"){let n=[e];for(let o=gr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Ml(o));return n}function Wh(e){return!!e&&e.origin.isAttached()}function uk(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=cx(e,o),i=NT(a.anchor,n),s=NT(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(gr(h))l.add(h.origin.getKey());else if(ps(h)){let{origin:g}=h;j(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=Ml(Wn(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,T=Hn(k.getTextContent()).setStyle(k.getStyle()).setFormat(k.getFormat());x.replaceOrInsert(T),C=ci(T,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(Wh(h)){c=pr(h);break}for(let h of s)if(Wh(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),T;for(T=0;T<k&&C[T]===w[T];T++);let L=(A,E)=>{let B;for(let R=T;R<A.length;R++){let N=A[R];if(Jo(N))return;!B&&E(N)&&(B=N)}return B},b=L(C,ya),S=b&&L(w,A=>v.has(A.getKey())&&ya(A));return b&&S?[b,S]:null})(c,f,l);if(p){let[h,g]=p;Ia(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(Wh);if(m)return dk(pi(pr(m),e.direction));Y(269,JSON.stringify(i.map(h=>h.origin.__key)))}function pr(e){let t=(function(r){let a=r;for(;gr(a);){let i=kl(a);if(!gr(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Ae(t.origin))return ba(t)?t:ci(t.origin,n,n);let o=t.getAdjacentCaret();return ps(o)&&Ae(o.origin)?ci(o.origin,n,mi(n)):t}function fk(e){return ba(e)&&e.offset!==hr(e.origin,e.direction)}function pi(e,t){return e.direction===t?e:e.getFlipped()}function cx(e,t){return e.direction===t?e:ui(pi(e.focus,t),pi(e.anchor,t))}function pk(e,t,n){let o=Ia(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return pi(o,n)}function C$(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 b$(e){let{origin:t,offset:n,direction:o}=e;if(n===hr(t,o))return e.getSiblingCaret();if(n===hr(t,mi(o)))return Ml(e.getSiblingCaret());let[r]=t.splitText(n);return Ae(r)||Y(281),pi(Wn(r,"next"),o)}function I$(e,t){return!0}function S$(e,{$copyElementNode:t=nx,$splitTextPointCaretNext:n=b$,rootMode:o="shadowRoot",$shouldSplit:r=I$}={}){if(ba(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(gr(e)&&(!i.canBeEmpty()||!r(i,"first")))return Ml(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 w$(e){return e}function T$(...e){return e}function L$(e,t){return[e,t]}function k$(e){return e}function P$(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Rc(...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 A$(e,...t){let n=Rc(...t);n.length>0&&e.classList.add(...n)}function E$(e,...t){let n=Rc(...t);n.length>0&&e.classList.remove(...n)}function M$(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=ux,Aee=M.$addUpdateTag,Rp=M.$applyNodeReplacement,Rl=M.$caretFromPoint,mk=M.$caretRangeFromSelection,Np=M.$cloneWithProperties,gk=M.$cloneWithPropertiesEphemeral,Eee=M.$comparePointCaretNext,Mee=M.$copyNode,hk=M.$create,gs=M.$createLineBreakNode,vk=M.$createNodeSelection,Zo=M.$createParagraphNode,Ree=M.$createPoint,hs=M.$createRangeSelection,xk=M.$createRangeSelectionFromDom,yk=M.$createTabNode,Cr=M.$createTextNode,Ck=M.$extendCaretToRange,wa=M.$findMatchingParent,fx=M.$getAdjacentChildCaret,Nee=M.$getAdjacentNode,vs=M.$getAdjacentSiblingOrParentSiblingCaret,px=M.$getCaretInDirection,bk=M.$getCaretRange,_ee=M.$getCaretRangeInDirection,Ik=M.$getCharacterOffsets,gi=M.$getChildCaret,Dee=M.$getChildCaretAtIndex,mx=M.$getChildCaretOrSelf,Sk=M.$getCollapsedCaretRange,Oee=M.$getCommonAncestor,Fee=M.$getCommonAncestorResultBranchOrder,_p=M.$getEditor,Bee=M.$getNearestNodeFromDOMNode,zee=M.$getNearestRootOrShadowRoot,Dp=M.$getNodeByKey,$ee=M.$getNodeByKeyOrThrow,wk=M.$getNodeFromDOMNode,Nc=M.$getPreviousSelection,yt=M.$getRoot,De=M.$getSelection,Ta=M.$getSiblingCaret,Op=M.$getState,Hee=M.$getStateChange,Uee=M.$getTextContent,Kee=M.$getTextNodeOffset,Vee=M.$getTextPointCaret,qee=M.$getTextPointCaretSlice,Wee=M.$getWritableNodeState,Tk=M.$hasAncestor,Gee=M.$hasUpdateTag,jee=M.$insertNodes,Nl=M.$isBlockElementNode,_c=M.$isChildCaret,Fp=M.$isDecoratorNode,Lk=M.$isEditorState,He=M.$isElementNode,kk=M.$isExtendableTextPointCaret,Qee=M.$isInlineElementOrDecoratorNode,Pk=M.$isLeafNode,_l=M.$isLineBreakNode,Xee=M.$isNodeCaret,gx=M.$isNodeSelection,Ak=M.$isParagraphNode,Ie=M.$isRangeSelection,Dc=M.$isRootNode,xs=M.$isRootOrShadowRoot,Ek=M.$isSiblingCaret,Yee=M.$isTabNode,nt=M.$isTextNode,Bp=M.$isTextPointCaret,Jee=M.$isTextPointCaretSlice,hx=M.$isTokenOrSegmented,Zee=M.$isTokenOrTab,ete=M.$nodesOfType,Mk=M.$normalizeCaret,Rk=M.$normalizeSelection__EXPERIMENTAL,tte=M.$onUpdate,Nk=M.$parseSerializedNode,nte=M.$removeTextFromCaretRange,_k=M.$rewindSiblingCaret,zp=M.$selectAll,ote=M.$setCompositionKey,rte=M.$setPointFromCaret,br=M.$setSelection,Dk=M.$setSelectionFromCaretRange,$p=M.$setState,Ok=M.$splitAtPointCaretNext,Fk=M.$splitNode,ate=M.$updateRangeSelectionFromCaretRange,vx=M.ArtificialNode__DO_NOT_USE,ite=M.BEFORE_INPUT_COMMAND,Bk=M.BLUR_COMMAND,Oc=M.CAN_REDO_COMMAND,Fc=M.CAN_UNDO_COMMAND,Hp=M.CLEAR_EDITOR_COMMAND,zk=M.CLEAR_HISTORY_COMMAND,$k=M.CLICK_COMMAND,ste=M.COLLABORATION_TAG,Up=M.COMMAND_PRIORITY_CRITICAL,Wt=M.COMMAND_PRIORITY_EDITOR,Ir=M.COMMAND_PRIORITY_HIGH,Dl=M.COMMAND_PRIORITY_LOW,lte=M.COMMAND_PRIORITY_NORMAL,dte=M.COMPOSITION_END_COMMAND,Hk=M.COMPOSITION_END_TAG,cte=M.COMPOSITION_START_COMMAND,Uk=M.COMPOSITION_START_TAG,Kk=M.CONTROLLED_TEXT_INSERTION_COMMAND,Kp=M.COPY_COMMAND,Vk=M.CUT_COMMAND,Vp=M.DELETE_CHARACTER_COMMAND,qk=M.DELETE_LINE_COMMAND,Wk=M.DELETE_WORD_COMMAND,ute=M.DRAGEND_COMMAND,fte=M.DRAGOVER_COMMAND,Gk=M.DRAGSTART_COMMAND,jk=M.DROP_COMMAND,La=M.DecoratorNode,pte=M.ElementNode,Qk=M.FOCUS_COMMAND,mte=M.FORMAT_ELEMENT_COMMAND,Xk=M.FORMAT_TEXT_COMMAND,qp=M.HISTORIC_TAG,Xr=M.HISTORY_MERGE_TAG,Yk=M.HISTORY_PUSH_TAG,xx=M.INDENT_CONTENT_COMMAND,gte=M.INPUT_COMMAND,yx=M.INSERT_LINE_BREAK_COMMAND,Jk=M.INSERT_PARAGRAPH_COMMAND,Zk=M.INSERT_TAB_COMMAND,Bc=M.INTERNAL_$isBlock,hte=M.IS_ALL_FORMATTING,vte=M.IS_BOLD,xte=M.IS_CODE,yte=M.IS_HIGHLIGHT,Cte=M.IS_ITALIC,bte=M.IS_STRIKETHROUGH,Ite=M.IS_SUBSCRIPT,Ste=M.IS_SUPERSCRIPT,wte=M.IS_UNDERLINE,eP=M.KEY_ARROW_DOWN_COMMAND,Wp=M.KEY_ARROW_LEFT_COMMAND,Gp=M.KEY_ARROW_RIGHT_COMMAND,tP=M.KEY_ARROW_UP_COMMAND,jp=M.KEY_BACKSPACE_COMMAND,nP=M.KEY_DELETE_COMMAND,oP=M.KEY_DOWN_COMMAND,Qp=M.KEY_ENTER_COMMAND,Tte=M.KEY_ESCAPE_COMMAND,Lte=M.KEY_MODIFIER_COMMAND,kte=M.KEY_SPACE_COMMAND,Xp=M.KEY_TAB_COMMAND,rP=M.LineBreakNode,Pte=M.MOVE_TO_END,Ate=M.MOVE_TO_START,Ete=M.NODE_STATE_KEY,aP=M.OUTDENT_CONTENT_COMMAND,Yp=M.PASTE_COMMAND,iP=M.PASTE_TAG,sP=M.ParagraphNode,lP=M.REDO_COMMAND,dP=M.REMOVE_TEXT_COMMAND,cP=M.RootNode,Mte=M.SELECTION_CHANGE_COMMAND,uP=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,fP=M.SELECT_ALL_COMMAND,Rte=M.SKIP_COLLAB_TAG,Nte=M.SKIP_DOM_SELECTION_TAG,_te=M.SKIP_SCROLL_INTO_VIEW_TAG,Dte=M.SKIP_SELECTION_FOCUS_TAG,pP=M.TEXT_TYPE_TO_FORMAT,mP=M.TabNode,Jp=M.TextNode,gP=M.UNDO_COMMAND,zc=M.addClassNamesToElement,Ote=M.buildImportMap,Zp=M.configExtension,hP=M.createCommand,em=M.createEditor,Fte=M.createSharedNodeState,vP=M.createState,xP=M.declarePeerDependency,Tn=M.defineExtension,Bte=M.flipDirection,zte=M.getDOMOwnerDocument,Cx=M.getDOMSelection,$te=M.getDOMSelectionFromTarget,yP=M.getDOMTextNode,Hte=M.getEditorPropertyFromDOMNode,Ute=M.getNearestEditorFromDOMNode,CP=M.getRegisteredNode,Kte=M.getRegisteredNodeOrThrow,Vte=M.getStaticNodeConfig,qte=M.getTextDirection,Wte=M.getTransformSetFromKlass,bP=M.isBlockDomNode,Gte=M.isCurrentlyReadOnlyMode,IP=M.isDOMDocumentNode,SP=M.isDOMNode,jte=M.isDOMTextNode,Qte=M.isDOMUnmanaged,bx=M.isDocumentFragment,Xte=M.isExactShortcutMatch,wP=M.isHTMLAnchorElement,tm=M.isHTMLElement,$c=M.isInlineDomNode,Yte=M.isLexicalEditor,Jte=M.isModifierMatch,Zte=M.isSelectionCapturedInDecoratorInput,TP=M.isSelectionWithinEditor,Ix=M.makeStepwiseIterator,Yr=M.mergeRegister,ene=M.normalizeClassNames,nm=M.removeClassNamesFromElement,tne=M.removeFromParent,nne=M.resetRandomKey,Sr=M.safeCast,one=M.setDOMUnmanaged,rne=M.setNodeIndentFromDOM,om=M.shallowMergeConfig,Sx=M.toggleTextFormatType;var wx={};wn(wx,{LexicalComposer:()=>N$});ue();var LP=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,R$=LP?Me:V,rm={tag:Xr};function N$({initialConfig:e,children:t}){let n=$(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=Uw(null,o),c=em({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=yt();if(m.isEmpty()){let h=Zo();m.append(h);let g=LP?document.activeElement:null;(De()!==null||g!==null&&g===f.getRootElement())&&h.select()}},rm);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,rm);break}case"object":f.setEditorState(p,rm);break;case"function":f.update(()=>{yt().isEmpty()&&p(f)},rm)}}})(c,s),[c,d]},[]);return R$(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(Hw.Provider,{value:n,children:t})}var _$=wx,kP=_$.LexicalComposer;var Lx={};wn(Lx,{$canShowPlaceholder:()=>AP,$canShowPlaceholderCurry:()=>O$,$findTextIntersectionFromCharacters:()=>F$,$isRootTextContentEmpty:()=>Tx,$isRootTextContentEmptyCurry:()=>D$,$rootTextContent:()=>PP,registerLexicalTextEntity:()=>z$});function PP(){return yt().getTextContent()}function Tx(e,t=!0){if(e)return!1;let n=PP();return t&&(n=n.trim()),n===""}function D$(e,t){return()=>Tx(e,t)}function AP(e){if(!Tx(e,!1))return!1;let t=yt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(Fp(r))return!1;if(He(r)){if(!Ak(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 O$(e){return()=>AP(e)}function F$(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(He(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 B$(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 z$(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Cr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(Jp,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&&B$(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 ys=Lx,fne=ys.$canShowPlaceholder,am=ys.$canShowPlaceholderCurry,pne=ys.$findTextIntersectionFromCharacters,mne=ys.$isRootTextContentEmpty,gne=ys.$isRootTextContentEmptyCurry,hne=ys.$rootTextContent,vne=ys.registerLexicalTextEntity;var Rx={};wn(Rx,{$addNodeStyle:()=>q$,$cloneWithProperties:()=>Np,$copyBlockFormatIndent:()=>BP,$ensureForwardRangeSelection:()=>FP,$forEachSelectedTextNode:()=>OP,$getComputedStyleForElement:()=>Ax,$getComputedStyleForParent:()=>Ex,$getSelectionStyleValueForProperty:()=>Z$,$isAtNodeEnd:()=>V$,$isParentElementRTL:()=>Mx,$isParentRTL:()=>U$,$moveCaretSelection:()=>HP,$moveCharacter:()=>Y$,$patchStyleText:()=>W$,$selectAll:()=>zp,$setBlocksType:()=>G$,$shouldOverrideDefaultCharacterSelection:()=>X$,$sliceSelectedTextNodeContent:()=>K$,$trimTextContentFromAnchor:()=>DP,$wrapNodes:()=>Q$,createDOMRange:()=>$$,createRectsFromDOMRange:()=>H$,getCSSFromStyleObject:()=>_P,getStyleObjectFromCSS:()=>lm,trimTextContentFromAnchor:()=>eH});function Px(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 sm=new Map;function EP(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function MP(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function $$(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=EP(l)),nt(o)&&(d=EP(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=MP(l)),d.nodeName==="BR"&&([d,f]=MP(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 H$(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 NP(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 lm(e){let t=sm.get(e);return t===void 0&&(t=NP(e),sm.set(e,t)),t}function _P(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ax(e){let t=_p().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function Ex(e){return Ax(Dc(e)?e:e.getParentOrThrow())}function U$(e){let t=Ex(e);return t!==null&&t.direction==="rtl"}function K$(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!hx(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]=Ik(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=gk(t)),t.__text=y)}}return t}function V$(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return He(t)||Px(177),e.offset===t.getChildrenSize()}function DP(e,t,n){let o=t.getNode(),r=n;if(He(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(He(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===""&&He(o)&&!o.isInline()&&(s=`
3704
+ `?o.push(Bl()):i===" "?o.push(Vp()):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),bk(k))k.splice(0,0,[S]);else{let L=oo(w)?Ra().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,Lr(Ei(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Ne(p)||J(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&&(Ea(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Ne(v)&&v.canInsertTextBefore()&&!Ea(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&&(Ea(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Ne(v)&&!Ea(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(""),uk(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Ii(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(gx(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(Ne(g)&&!Ii(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let I=Wn(g.getTextContent());g.replace(I),g=I}oo(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 A=I.getChildren(),E=A.length;(E===0||A[E-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(Ii(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],A=T.__key;v.has(A)||T.remove()}}}removeText(){let t=St()===this;_c(this,Gk(Jv(this))),t&&St()!==this&&Fo(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)Ne(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(Ea(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||Ea(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let C=x.getFormatFlags(t,g);y>0&&(y===x.getTextContentSize()||Ea(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 Ke(h)||J(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Rc(n,Ma),r=t[t.length-1];if(Q(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=vv(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(Q(h)||Jt(h))&&!h.isInline())){Q(o)||J(211,n.constructor.name,n.getType());let h=vv(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=Ra(),v=null;for(let x=0;x<h.length;x++){let y=h[x],C=ws(y);if(C||Jt(y)&&y.isInline()||Q(y)&&y.isInline()||Ne(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)&&Ma(f)&&!f.isEmpty()&&Q(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(Q(o)||J(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&J(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),x=g,y=[g];for(;x!==v;)x.getNextSibling()||J(140),x=x.getNextSibling(),y.push(x);let C=h;for(let w of y)C=C.insertAfter(w)})(o,c));let p=Rc(i,Ma);l&&Q(p)&&(l.canMergeWhenEmpty()||Ma(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=Ra();return Ko().splice(this.anchor.offset,0,[i]),i.select(),i}let t=vv(this),n=Rc(this.anchor.getNode(),Ma);Q(n)||J(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]=qv(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(Ne(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(Ne(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Ne(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(ZT(this,t,n,o))return;let r=t==="move",a=qt(),i=Rr(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()||Gv(s,a,l),this.dirty){let c=Ul(a,this.anchor.key),f=Ul(a,this.focus.key);this.anchor.type==="text"&&(c=Es(c)),this.focus.type==="text"&&(f=Es(f)),c&&f&&gk(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=oo(f)?f:Fk(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];zp(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"&&ZT(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=Dx(Ei(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(Pr(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=Lr(l);_c(this,Pi(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(Jt(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=hx();d.add(l.origin.getKey()),Fo(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return _c(this,Pi(!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&&WT(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 GT(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 GT(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!(Ak(w)||A$(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()&&oo(o.getParent())&&o.getPreviousSibling()===null&&WT(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 Gc(e){return e instanceof _p}function VT(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function qv(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]:[VT(n),VT(o)]}function WT(e,t){for(let n=t;n;n=n.getParent()){if(Q(n)){if(n.collapseAtStart(e))return!0;if(ur(n))break}if(n.getPreviousSibling())break}return!1}var A$=(()=>{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 GT(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(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=Nl(c),Ne(r))a=Er(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&&J(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),Q(p)||J(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}Ne(g)?(r=g,p=null,a=Er(g,i?"next":"previous")):g!==p&&i&&!f&&(Q(p)||J(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Jt(p)&&Nl(e)===p?m:m+1,p=p.getParentOrThrow()}if(Q(p))return Ar(p.__key,a,"element")}}else r=Nl(e);return Ne(r)?Ar(r.__key,Er(r,a,"clamp"),"text"):null}function QT(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();Ne(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else Q(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Ne(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();Ne(s)&&e.set(s.__key,0,"text")}}}function uk(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);QT(e,o,r),QT(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function fk(e,t,n,o,r,a){if(e===null||n===null||!jc(r,e,n))return null;let i=jT(e,t,Ke(a)?a.anchor:null,r);if(i===null)return null;let s=jT(n,o,Ke(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(Jt(l)&&Jt(d))return null}return uk(i,s),[i,s]}function M$(e){return Q(e)&&!e.isInline()}function pk(e,t,n,o,r,a){let i=Da(),s=new Ps(Ar(e,t,r),Ar(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function mk(){let e=Ar("root",0,"element"),t=Ar("root",0,"element");return new Ps(e,t,0,"")}function hx(){return new _p(new Set)}function R$(e,t){return Wp(null,e,t,null)}function Wp(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=!wv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ke(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)&&Ke(e)&&!jc(n,d,c))return e.clone();let m=fk(d,f,c,p,n,e);if(m===null)return null;let[h,g]=m,v=0,x="";if(Ke(e)){let y=e.anchor;if(h.key===y.key)v=e.format,x=e.style;else{let C=h.getNode();Ne(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 Da()._selection}function Ms(){return qt()._editorState._selection}function Dp(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"),XT(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")}}XT(e)}function XT(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(Ne(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(Ne(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(Ne(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function Op(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Ne(o)?(i=o.getTextContentSize(),s="text"):Q(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Ne(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 YT(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 gk(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function JT(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 N$(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(rk)&&f!==a||f!==null&&Ix(f))return;if(!Ke(t))return void(e!==null&&jc(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=JT(n,h,p.offset),[y,C]=JT(n,g,m.offset),w=t.format,k=t.style,S=t.isCollapsed(),L=v,I=y,T=!1;var A,E,N,R,B;if(p.type==="text"?(L=Es(v),T=h.getFormat()!==w||h.getStyle()!==k):Ke(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=Es(y)),L!==null&&I!==null&&(S&&(e===null||T||Ke(e)&&(e.format!==w||e.style!==k))&&(A=w,E=k,N=x,R=p.key,B=performance.now(),YL=[A,E,N,R,B]),d!==x||c!==C||s!==L||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Uv)||a.focus({preventScroll:!0}),p.type==="element"))){if(gk(o,L,x,I,C),!wi||!t.isCollapsed()||a===null||r.has(Uv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(ak)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let z=Ke(t)&&t.anchor.type==="element"?L.childNodes[x]||null:o.rangeCount>0?o.getRangeAt(0):null;if(z!==null){let U;if(z instanceof Text){let O=document.createRange();O.selectNode(z),U=O.getBoundingClientRect()}else U=z.getBoundingClientRect();(function(O,ne,ee){let W=Ex(ee),De=Ax(W);if(W===null||De===null)return;let{top:Ce,bottom:ue}=ne,Be=0,ge=0,le=ee;for(;le!==null;){let Se=le===W.body;if(Se)Be=0,ge=qo(O).innerHeight;else{let te=le.getBoundingClientRect();Be=te.top,ge=te.bottom}let ye=0;if(Ce<Be?ye=-(Be-Ce):ue>ge&&(ye=ue-ge),ye!==0)if(Se)De.scrollBy(0,ye);else{let te=le.scrollTop;le.scrollTop+=ye;let we=le.scrollTop-te;Ce-=we,ue-=we}if(Se)break;le=Xc(le)}})(n,U,a)}}zv=!0}}function _$(e){let t=St()||Ms();t===null&&(t=Ko().selectEnd()),t.insertNodes(e)}function D$(){let e=St();return e===null?"":e.getTextContent()}function vv(e){let t=e;e.isCollapsed()||t.removeText();let n=St();Ke(n)&&(t=n),Ke(t)||J(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Ma(r);){let i=r;if([r,a]=O$(r,a),i.is(r))break}return a}function O$(e,t){let n=e.getParent();if(!n){let r=Ra();return Ko().append(r),r.select(),[Ko(),0]}if(Ne(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(Ar(e.__key,t,"element"),Ar(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function ZT(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=Ei(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(!Jt(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Dx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Pr(c))c.origin.isInline()||(l=c);else{if(Q(c.origin))continue;Jt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&Jt(l.origin)&&l.origin.isKeyboardSelectable()){let c=hx();return c.add(l.origin.getKey()),Fo(c),!0}return l=Lr(l),s&&Gl(e.anchor,l),Gl(e.focus,l),d||!i}var Qn=null,Xn=null,Oo=!1,xv=!1,Ip=0,eL={characterData:!0,childList:!0,subtree:!0};function jl(){return Oo||Qn!==null&&Qn._readOnly}function Gn(){Oo&&J(13)}function hk(){Ip>99&&J(14)}function Da(){return Qn===null&&J(195,vk()),Qn}function qt(){return Xn===null&&J(196,vk()),Xn}function vk(){let e=0,t=new Set,n=Li.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=Qc(r);if(jp(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 F$(){return Xn}function tL(e,t,n){let o=t.__type,r=Cx(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 nL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function xk(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 B$(e){return vx(e,qt()._nodes)}function vx(e,t){let n=e.type,o=t.get(n);o===void 0&&J(17,n);let r=o.klass;e.type!==r.getType()&&J(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=vx(i[s],t);a.append(l)}return a}function oL(e,t,n){let o=Qn,r=Oo,a=Xn;Qn=t,Oo=!0,Xn=e;try{return n()}finally{Qn=o,Oo=r,Xn=a}}function Aa(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=Oo,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,Oo=!1,e._updating=!0;try{let S=e._dirtyType,L=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),h=o$(a,n,e,S,L,I)}catch(S){if(S instanceof Error&&e._onError(S),xv)throw S;return Ik(e,null,o,n),SL(e),e._dirtyType=2,xv=!0,Aa(e,a),void(xv=!1)}finally{m.observe(o,eL),e._updating=p,Qn=d,Oo=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,A=L._nodeMap,E;for(E in T)A.has(E)||(T===I&&(T=Pk(S)),delete T[E])})(e,n);let w=r?null:Rr(qo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!y.has(ik)){Xn=e,Qn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&Gv(S,e,o),N$(i,s,e,w,y,o)}(function(S,L,I){let T=S._blockCursorElement;if(Ke(I)&&I.isCollapsed()&&I.anchor.type==="element"&&L.contains(document.activeElement)){let A=I.anchor,E=A.getNode(),N=A.offset,R=!1,B=null;if(N===E.getChildrenSize())Cv(E.getChildAtIndex(N-1))&&(R=!0);else{let z=E.getChildAtIndex(N);if(z!==null&&Cv(z)){let U=z.getPreviousSibling();(U===null||Cv(U))&&(R=!0,B=S.getElementByKey(z.__key))}}if(R){let z=S.getElementByKey(E.__key);return T===null&&(S._blockCursorElement=T=(function(U){let O=U.theme,ne=document.createElement("div");ne.contentEditable="false",ne.setAttribute("data-lexical-cursor","true");let ee=O.blockCursor;if(ee!==void 0){if(typeof ee=="string"){let W=Zc(ee);ee=O.blockCursor=W}ee!==void 0&&ne.classList.add(...ee)}return ne})(S._config)),L.style.caretColor="transparent",void(B===null?z.appendChild(T):z.insertBefore(T,B))}}T!==null&&Gv(T,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,eL),Xn=f,Qn=d}}h!==null&&(function(S,L,I,T,A){let E=Array.from(S._listeners.mutation),N=E.length;for(let R=0;R<N;R++){let[B,z]=E[R];for(let U of z){let O=L.get(U);O!==void 0&&B(O,{dirtyLeaves:T,prevEditorState:A,updateTags:I})}}})(e,h,y,g,a),Ke(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(ox,void 0);let k=e._pendingDecorators;k!==null&&(e._decorators=k,e._pendingDecorators=null,Mc("decorator",e,!0,k)),(function(S,L,I){let T=sL(L),A=sL(I);T!==A&&Mc("textcontent",S,!0,A)})(e,t||a,n),Mc("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,A]=I;Gp(S,T,A)}}})(e)}function Mc(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 rL(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&&J(191),s._flushSync=!0),l&&e._deferred.push(l),xk(e,i.tag)),s==null?Gp(e,a,i):a()}}return o}function Gp(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,xk(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=yk(l||s),d=!0),l._flushSync=i;let c=Qn,f=Oo,p=Xn,m=e._updating;Qn=l,Oo=!1,e._updating=!0,Xn=e;let h=e._headless||e.getRootElement()===null;yx(null);try{d&&(h?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(y,C){let w=y.getEditorState()._selection,k=Rr(qo(y));return Ke(w)||w==null?Wp(w,k,y,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=rL(e,a),(function(y,C){let w=C.getEditorState()._selection,k=y._selection;if(Ke(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);Ne(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&RT(L)}})(l,e):(function(y,C){let w=C._dirtyLeaves,k=C._dirtyElements,S=y._nodeMap,L=bi(),I=new Map,T=w,A=T.size,E=k,N=E.size;for(;A>0||N>0;){if(A>0){C._dirtyLeaves=new Set;for(let R of T){let B=S.get(R);Ne(B)&&B.isAttached()&&B.isSimpleText()&&!B.isUnmergeable()&&RT(B),B!==void 0&&nL(B,L)&&tL(C,B,I),w.add(R)}if(T=C._dirtyLeaves,A=T.size,A>0){Ip++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,E.delete("root")&&E.set("root",!0);for(let R of E){let B=R[0],z=R[1];if(k.set(B,z),!z)continue;let U=S.get(B);U!==void 0&&nL(U,L)&&tL(C,U,I)}T=C._dirtyLeaves,A=T.size,E=C._dirtyElements,N=E.size,Ip++}C._dirtyLeaves=w,C._dirtyElements=k})(l,e),rL(e),(function(y,C,w,k){let S=y._nodeMap,L=C._nodeMap,I=[];for(let[T]of k){let A=L.get(T);A!==void 0&&(A.isAttached()||(Q(A)&&CL(A,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 A=L.get(T);A===void 0||A.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(Ke(x)){let y=l._nodeMap,C=x.anchor.key,w=x.focus.key;y.get(C)!==void 0&&y.get(w)!==void 0||J(19)}else Gc(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 Aa(e)}finally{Qn=c,Oo=f,Xn=p,e._updating=m,Ip=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,Aa(e)):d&&G$(()=>{Aa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function ra(e,t,n){Xn===e&&n===void 0?t():Gp(e,t,n)}var Vv=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&&J(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&J(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&J(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"&&(Up||Wc||Hp);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=aL(n,o);a.push(r);let i=aL(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 aL(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&&J(225),n.reverse()}var Ti=class extends cr{__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 K5[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=qt()._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(Ne(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:Hn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&J(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Hn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&J(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+=Kp)}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=Sv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=po[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return qc(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(Ne(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(Ne(l)||Q(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ke(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):pk(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!==""?Sv[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){Np(this)&&J(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||J(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&&J(100);let g=m.getNextSibling(),v=m.__key;Si(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--,Si(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&&J(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(Ke(m)){let h=new Set(l),g=new Set(s),{anchor:v,focus:x}=m;iL(v,h,g)&&Op(v,v.getNode(),this,c,d),iL(x,h,g)&&Op(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||ur(this)||this.remove()}}return a}getDOMSlot(t){return new Vv(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===""||ur(this)||this.getChildren().some(Ne)||(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 Ti}function iL(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 Uc=class extends cr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Jt(e){return e instanceof Uc}var $l=class e extends Ti{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){J(51)}getTextContent(){let t=this.__cachedText;return!jl()&&qt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){J(52)}replace(t){J(53)}insertBefore(t){J(54)}insertAfter(t){J(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)Q(r)||Jt(r)||J(282);return super.splice(t,n,o)}static importJSON(t){return Ko().updateFromJSON(t)}collapseAtStart(){return!0}};function oo(e){return e instanceof $l}function yk(e){return new Kc(new Map(e._nodeMap))}function xx(){return new Kc(new Map([["root",new $l]]))}function Ck(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&J(130,n.name),Q(e)){let o=t.children;Array.isArray(o)||J(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=Ck(r[a]);o.push(i)}}return t}function z$(e){return e instanceof Kc}var Kc=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 oL(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 oL(null,this,()=>({root:Ck(Ko())}))}},Fp=class extends Ti{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Hl=class e extends Ti{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:$$,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 Ra().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Ne);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Ra();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||Ne(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 $$(e){let t=Ra();if(e.style&&(t.setFormat(e.style.textAlign),Uk(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Sv&&t.setFormat(n)}return{node:t}}function Ra(){return Yc(new Hl)}function bk(e){return e instanceof Hl}var Rl=0,H$=1,U$=2,K$=3,q$=4;function Ik(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=xx(),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 Sk(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Jc(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 cr&&i!==cr?i:void 0}}return t}function V$(e){let t=e||{},n=F$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=xx(),s=t.namespace||(r!==null?r._config.namespace:Mk()),l=t.editorState,d=[$l,ks,Fl,zl,Hl,Fp,...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}Jc(v);let C=v.getType(),w=Sk(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:wL(d[g]),transforms:w})}}let h=new Li(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(rx,p$,Rl),g.registerCommand(ax,m$,Rl),g.registerCommand(ix,g$,Rl),g.registerCommand(sx,h$,Rl),g.registerCommand(ux,v$,Rl)})(h),h}var Li=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=Mk(),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&&J(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&&J(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&&J(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=Qv(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=Qv(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=Hn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:bp}: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 ve(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,Ik(this,n,t,r),n!==null&&(this._config.disableEvents||x$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Ax(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,SL(this),this._updateTags.add(bp),Aa(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Bv.set(s,d);let c=Mp.get(d)??0;c<1&&d.addEventListener("selectionchange",nk),Mp.set(d,c+1),s.__lexicalEditor=l;let f=tk(s);for(let p=0;p<Fv.length;p++){let[m,h]=Fv[p],g=typeof h=="function"?v=>{zT(v)||(BT(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(zT(v))return;BT(v);let x=l.isEditable();switch(m){case"cut":return x&&ve(l,px,v);case"copy":return ve(l,fx,v);case"paste":return x&&ve(l,lx,v);case"dragstart":return x&&ve(l,KL,v);case"dragover":return x&&ve(l,qL,v);case"dragend":return x&&ve(l,VL,v);case"focus":return x&&ve(l,WL,v);case"blur":return x&&ve(l,GL,v);case"drop":return x&&ve(l,UL,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(bp),Aa(this);Mc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&J(38);let o=t;o._readOnly&&(o=yk(t),o._selection=t._selection?t._selection.clone():null),IL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Aa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Aa(this)}parseEditorState(t,n){return(function(o,r,a){let i=xx(),s=Qn,l=Oo,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,Oo=!1,Xn=r,yx(null);try{let h=r._nodes;vx(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,Oo=l,Xn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Aa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Gp(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),ra(this,()=>{let r=St(),a=Ko();r!==null?r.dirty||Fo(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Yp("focus"),Ok(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Rr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Mc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Li.version="0.41.0+prod.esm";var Wv=null;function yx(e){Wv=e}var wk=1;function W$(){wk=1}function Cx(e,t){let n=bx(e,t);return n===void 0&&J(30,t),n}function bx(e,t){return e._nodes.get(t)}var G$=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function Tk(e){return Jt(Xp(e))}function Ix(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return Jt(Xp(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&Qc(t)==null)}function jc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Ix(t)&&Sx(t)===e}catch{return!1}}function jp(e){return e instanceof Li}function Sx(e){let t=e;for(;t!=null;){let n=Qc(t);if(jp(n))return n;t=Xc(t)}return null}function Qc(e){return e?e.__lexicalEditor:null}function j$(e){return $5.test(e)?"rtl":H5.test(e)?"ltr":null}function Ii(e){return gx(e)||e.isToken()}function Ea(e){return Ii(e)||e.isSegmented()}function aa(e){return Ql(e)&&e.nodeType===3}function Lk(e){return Ql(e)&&e.nodeType===9}function Es(e){let t=e;for(;t!=null;){if(aa(t))return t;t=t.firstChild}return null}function qc(e,t,n){let o=po[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~po.superscript:t==="superscript"?r&=~po.subscript:t==="lowercase"?(r&=~po.uppercase,r&=~po.capitalize):t==="uppercase"?(r&=~po.lowercase,r&=~po.capitalize):t==="capitalize"&&(r&=~po.lowercase,r&=~po.uppercase),r}function Q$(e){return Ne(e)||ws(e)||Jt(e)}function kk(e,t){let n=(function(){let i=Wv;return Wv=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Gn(),hk();let o=qt(),r=Da(),a=""+wk++;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 Si(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 Bp(e){hk(),Np(e)&&J(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Da(),r=qt(),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=qt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Hn(n);o!==null&&o.getWritable()}if(e!==null){let o=Hn(e);o!==null&&o.getWritable()}}}function bi(){return jl()?null:qt()._compositionKey}function Hn(e,t){let n=(t||Da())._nodeMap.get(e);return n===void 0?null:n}function wx(e,t){let n=Qp(e,qt());return n!==void 0?Hn(n,t):null}function Qp(e,t){return e[`__lexicalKey_${t._key}`]}function Xp(e,t){let n=e;for(;n!=null;){let o=wx(n,t);if(o!==null)return o;n=Xc(n)}return null}function Pk(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function sL(e){return e.read(()=>Ko().getTextContent())}function Ko(){return Ek(Da())}function Ek(e){return e._nodeMap.get("root")}function Fo(e){Gn();let t=Da();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Nl(e){let t=qt(),n=(function(o,r){let a=o;for(;a!=null;){let i=Qp(a,r);if(i!==void 0)return i;a=Xc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Hn("root"):null:Hn(n)}function Ak(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Tx(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function Mk(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Rk(e){return aa(e)?e.nodeValue:null}function Lx(e,t,n){let o=Rr(qo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=Rk(r),l=Xp(r);if(s!==null&&Ne(l)){if((s===Dc||s===ex)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&kx(l,s,a,i,e)}}}function kx(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(Dc)&&(s=t.slice(0,-Dc.length)),r)){let d=ex,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),Hp||Wc||Up)a.remove();else{let g=qt();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Ms(),f=a.getTextContentSize(),p=bi(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ke(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(!Ke(h)||n===null||o===null)return void lL(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=Wn(a.getTextContent());a.replace(g),a=g}lL(a,s,h)}}}function lL(e,t,n){if(e.setTextContent(t),Ke(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=Er(e,a.offset,"clamp"))}}}function gp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function Nk(e,t){return gp(e,t,"altKey")&&gp(e,t,"ctrlKey")&&gp(e,t,"shiftKey")&&gp(e,t,"metaKey")}function At(e,t,n){if(!Nk(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 Pa={ctrlKey:!Tr,metaKey:Tr},dL={altKey:Tr,ctrlKey:!Tr};function cL(e){return e.key==="Backspace"}function uL(e){return At(e,"a",Pa)}function X$(e){let t=Ko();if(Ke(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"),Tp(e),e}{let n=t.select(0,t.getChildrenSize());return Fo(Tp(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=Zc(r);return n[t]=a,a}return r}function Px(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&J(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 Y$(e){let t=e.getType(),n=Da();if(n._readOnly){let a=Qv(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 fL(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 _k(e,t){let n=e.offset;if(e.type==="element")return fL(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?fL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function Dk(e){let t=qo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function ve(e,t,n){return(function(o,r,a){let i=Tx(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(ra(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&&J(75,t),n}function Xc(e){let t=e.assignedSlot||e.parentElement;return $k(t)?t.host:t}function Ex(e){return Lk(e)?e:ko(e)?e.ownerDocument:null}function J$(e){return qt()._updateTags.has(e)}function Yp(e){Gn(),qt()._updateTags.add(e)}function Ok(e){Gn(),qt()._deferred.push(e)}function zp(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Ax(e){let t=Ex(e);return t?t.defaultView:null}function qo(e){let t=e._window;return t===null&&J(78),t}function Z$(e){return Q(e)&&e.isInline()||Jt(e)&&e.isInline()}function Fk(e){let t=e.getParentOrThrow();for(;t!==null;){if(ur(t))return t;t=t.getParentOrThrow()}return t}function ur(e){return oo(e)||Q(e)&&e.isShadowRoot()}function Mx(e){let t=e.constructor.clone(e);return kk(t,null),t.afterCloneFrom(e),t}function Yc(e){let t=qt(),n=e.getType(),o=bx(t,n);o===void 0&&J(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||J(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||J(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&J(203,e.constructor.name,n,s.name,s.getType()),i}return e}function yv(e,t){!oo(e.getParent())||Q(t)||Jt(t)||J(99)}function Bk(e){let t=Hn(e);return t===null&&J(63,e),t}function Cv(e){return(Jt(e)||Q(e)&&!e.canBeEmpty())&&!e.isInline()}function Gv(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Rr(e){return Mr?(e||window).getSelection():null}function zk(e){let t=Ax(e);return t?t.getSelection():null}function eH(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),ur(e)&&J(102);let o=i=>{let s=i.getParentOrThrow(),l=ur(s),d=i!==n||l?Mx(i):i;if(l)return Q(i)&&Q(d)||J(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 tH(e){return ko(e)&&e.tagName==="A"}function ko(e){return Ql(e)&&e.nodeType===1}function Ql(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function $k(e){return Ql(e)&&e.nodeType===11}function Hk(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 jv(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 Ma(e){if(Jt(e)&&!e.isInline())return!0;if(!Q(e)||ur(e))return!1;let t=e.getFirstChild(),n=t===null||ws(t)||Ne(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Rx(){return qt()}var pL=new WeakMap,nH=new Map;function Qv(e){if(!e._readOnly&&e.isEmpty())return nH;e._readOnly||J(192);let t=pL.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),pL.set(e,t)),t}function Nx(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function oH(e){return(t=Nx(e))[ok]=!0,t;var t}function Uk(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function rH(e){e.__lexicalUnmanaged=!0}function Kk(e){return e.__lexicalUnmanaged===!0}function kc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==cr[t]}function Jc(e){let t=TT in e.prototype?e.prototype[TT]():void 0,n=(function(i){if(!(i===cr||i.prototype instanceof cr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{Li.version&&(l=JSON.parse(Li.version))}catch{}J(290,i.name,s,l)}return i===Uc||i===Ti||i===cr})(e),o=!n&&kc(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&&(kc(e,"getType")||(e.getType=()=>a),kc(e,"clone")||(e.clone=i=>(yx(i),new e)),kc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!kc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function aH(e){let t=Rx();return Gn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Rc=(e,t)=>{let n=e;for(;n!=null&&!oo(n);){if(t(n))return n;n=n.getParent()}return null},iH={next:"previous",previous:"next"},Kl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return Ox({hasNext:As,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&&J(263,Array.from(s).join(" "))}else a.insert(l);a=Yn(l,this.direction)}for(let l of s.values())l.remove();return this}},Vc=class e extends Kl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:_a(t,this.direction)}getParentCaret(t="root"){return Yn(_x(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Mi(this.direction);return Yn(this.getNodeAtCaret(),t)||_a(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)}},sH={root:oo,shadowRoot:ur};function Mi(e){return iH[e]}function _x(e,t="root"){return sH[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)?_a(this.origin,this.direction):null}getParentCaret(t="root"){return Yn(_x(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Mi(this.direction);return Yn(this.getNodeAtCaret(),t)||_a(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:ki(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Yn(_x(this.getParentAtCaret(),t),this.direction)}getFlipped(){return ki(this.origin,Mi(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 Na(e){return e instanceof Vl}function lH(e){return e instanceof Kl}function As(e){return e instanceof ql}function Pr(e){return e instanceof Vc}var dH={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}}},cH={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}}},uH={next:class extends Vc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Vc{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 cH[t](e):null}function ki(e,t,n){return e?new dH[t](e,Er(e,n)):null}function Er(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&hL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function Xv(e,t){return new $p(e,t)}function _a(e,t){return Q(e)?new uH[t](e):null}function qk(e){return e&&e.getChildCaret()||e}function Wl(e){return e&&qk(e.getAdjacentCaret())}var Yv=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 Na(a)?(function(i,s){let{direction:l,origin:d}=i,c=Er(d,s==="focus"?Mi(l):l);return Xv(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[Xv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=Na(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Na(o),a=i=>i.isSameNodeCaret(o)?null:Wl(i)||i.getParentCaret(t);return Ox({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")}},$p=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 ki(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function fH(e){return e instanceof $p}function Dx(e){return Pi(e,Yn(Ko(),e.direction))}function Vk(e){return Pi(e,e)}function Pi(e,t){return e.direction!==t.direction&&J(265),new Yv(e,t,e.direction)}function Ox(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 Fx(e,t){let n=Nc(e.origin,t.origin);switch(n===null&&J(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 Bx(n)}}function Bx(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 hp(e,t){return t.is(e)}function mL(e){return Q(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Nc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=mL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=mL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(hp(e,o)||J(276),{commonAncestor:o,type:"ancestor"}):r===null?(hp(t,o)||J(277),{commonAncestor:o,type:"descendant"}):((Q(a)||hp(e,a))&&(Q(r)||hp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||J(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function Ei(e,t){let{type:n,key:o,offset:r}=e,a=Bk(e.key);return n==="text"?(Ne(a)||J(266,a.getType(),o),ki(a,t,r)):(Q(a)||J(267,a.getType(),o),Qk(a,e.offset,t))}function Gl(e,t){let{origin:n,direction:o}=t,r=o==="next";Na(t)?e.set(n.getKey(),t.offset,"text"):As(t)?Ne(n)?e.set(n.getKey(),Er(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Pr(t)&&Q(n)||J(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function Wk(e){let t=St(),n=Ke(t)?t:mk();return _c(n,e),Fo(n),n}function _c(e,t){Gl(e.anchor,t.anchor),Gl(e.focus,t.focus)}function Jv(e){let{anchor:t,focus:n}=e,o=Ei(t,"next"),r=Ei(n,"next"),a=Fx(o,r)<=0?"next":"previous";return Pi(Ai(o,a),Ai(r,a))}function Xl(e){let{direction:t,origin:n}=e,o=Yn(n,Mi(t)).getNodeAtCaret();return o?Yn(o,t):_a(n.getParentOrThrow(),t)}function gL(e,t="root"){let n=[e];for(let o=Pr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Xl(o));return n}function bv(e){return!!e&&e.origin.isAttached()}function Gk(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=zx(e,o),i=gL(a.anchor,n),s=gL(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(Pr(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=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=ki(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(bv(h)){c=Lr(h);break}for(let h of s)if(bv(h)){f=Lr(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=(A,E)=>{let N;for(let R=S;R<A.length;R++){let B=A[R];if(ur(B))return;!N&&E(B)&&(N=B)}return N},I=L(C,Ma),T=I&&L(w,A=>v.has(A.getKey())&&Ma(A));return I&&T?[I,T]:null})(c,f,l);if(p){let[h,g]=p;_a(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(bv);if(m)return Vk(Ai(Lr(m),e.direction));J(269,JSON.stringify(i.map(h=>h.origin.__key)))}function Lr(e){let t=(function(r){let a=r;for(;Pr(a);){let i=Wl(a);if(!Pr(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Ne(t.origin))return Na(t)?t:ki(t.origin,n,n);let o=t.getAdjacentCaret();return As(o)&&Ne(o.origin)?ki(o.origin,n,Mi(n)):t}function jk(e){return Na(e)&&e.offset!==Er(e.origin,e.direction)}function Ai(e,t){return e.direction===t?e:e.getFlipped()}function zx(e,t){return e.direction===t?e:Pi(Ai(e.focus,t),Ai(e.anchor,t))}function Qk(e,t,n){let o=_a(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Ai(o,n)}function pH(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 mH(e){let{origin:t,offset:n,direction:o}=e;if(n===Er(t,o))return e.getSiblingCaret();if(n===Er(t,Mi(o)))return Xl(e.getSiblingCaret());let[r]=t.splitText(n);return Ne(r)||J(281),Ai(Yn(r,"next"),o)}function gH(e,t){return!0}function hH(e,{$copyElementNode:t=Mx,$splitTextPointCaretNext:n=mH,rootMode:o="shadowRoot",$shouldSplit:r=gH}={}){if(Na(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Pr(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 vH(e){return e}function xH(...e){return e}function yH(e,t){return[e,t]}function CH(e){return e}function bH(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Zc(...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 IH(e,...t){let n=Zc(...t);n.length>0&&e.classList.add(...n)}function SH(e,...t){let n=Zc(...t);n.length>0&&e.classList.remove(...n)}function wH(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=$x,Ote=M.$addUpdateTag,Jp=M.$applyNodeReplacement,Yl=M.$caretFromPoint,Xk=M.$caretRangeFromSelection,Zp=M.$cloneWithProperties,Yk=M.$cloneWithPropertiesEphemeral,Fte=M.$comparePointCaretNext,Bte=M.$copyNode,Jk=M.$create,Rs=M.$createLineBreakNode,Zk=M.$createNodeSelection,fr=M.$createParagraphNode,zte=M.$createPoint,Ns=M.$createRangeSelection,eP=M.$createRangeSelectionFromDom,tP=M.$createTabNode,Nr=M.$createTextNode,nP=M.$extendCaretToRange,Oa=M.$findMatchingParent,Hx=M.$getAdjacentChildCaret,$te=M.$getAdjacentNode,_s=M.$getAdjacentSiblingOrParentSiblingCaret,Ux=M.$getCaretInDirection,oP=M.$getCaretRange,Hte=M.$getCaretRangeInDirection,rP=M.$getCharacterOffsets,Ri=M.$getChildCaret,Ute=M.$getChildCaretAtIndex,Kx=M.$getChildCaretOrSelf,aP=M.$getCollapsedCaretRange,Kte=M.$getCommonAncestor,qte=M.$getCommonAncestorResultBranchOrder,em=M.$getEditor,Vte=M.$getNearestNodeFromDOMNode,Wte=M.$getNearestRootOrShadowRoot,tm=M.$getNodeByKey,Gte=M.$getNodeByKeyOrThrow,iP=M.$getNodeFromDOMNode,eu=M.$getPreviousSelection,Ct=M.$getRoot,Fe=M.$getSelection,Fa=M.$getSiblingCaret,nm=M.$getState,jte=M.$getStateChange,Qte=M.$getTextContent,Xte=M.$getTextNodeOffset,Yte=M.$getTextPointCaret,Jte=M.$getTextPointCaretSlice,Zte=M.$getWritableNodeState,sP=M.$hasAncestor,ene=M.$hasUpdateTag,tne=M.$insertNodes,Jl=M.$isBlockElementNode,tu=M.$isChildCaret,om=M.$isDecoratorNode,lP=M.$isEditorState,qe=M.$isElementNode,dP=M.$isExtendableTextPointCaret,nne=M.$isInlineElementOrDecoratorNode,cP=M.$isLeafNode,Zl=M.$isLineBreakNode,one=M.$isNodeCaret,qx=M.$isNodeSelection,uP=M.$isParagraphNode,Ie=M.$isRangeSelection,nu=M.$isRootNode,Ds=M.$isRootOrShadowRoot,fP=M.$isSiblingCaret,rne=M.$isTabNode,ot=M.$isTextNode,rm=M.$isTextPointCaret,ane=M.$isTextPointCaretSlice,Vx=M.$isTokenOrSegmented,ine=M.$isTokenOrTab,sne=M.$nodesOfType,pP=M.$normalizeCaret,mP=M.$normalizeSelection__EXPERIMENTAL,lne=M.$onUpdate,gP=M.$parseSerializedNode,dne=M.$removeTextFromCaretRange,hP=M.$rewindSiblingCaret,am=M.$selectAll,cne=M.$setCompositionKey,une=M.$setPointFromCaret,_r=M.$setSelection,vP=M.$setSelectionFromCaretRange,im=M.$setState,xP=M.$splitAtPointCaretNext,yP=M.$splitNode,fne=M.$updateRangeSelectionFromCaretRange,Wx=M.ArtificialNode__DO_NOT_USE,pne=M.BEFORE_INPUT_COMMAND,CP=M.BLUR_COMMAND,ou=M.CAN_REDO_COMMAND,ru=M.CAN_UNDO_COMMAND,sm=M.CLEAR_EDITOR_COMMAND,bP=M.CLEAR_HISTORY_COMMAND,IP=M.CLICK_COMMAND,mne=M.COLLABORATION_TAG,lm=M.COMMAND_PRIORITY_CRITICAL,Zt=M.COMMAND_PRIORITY_EDITOR,Dr=M.COMMAND_PRIORITY_HIGH,ed=M.COMMAND_PRIORITY_LOW,gne=M.COMMAND_PRIORITY_NORMAL,hne=M.COMPOSITION_END_COMMAND,SP=M.COMPOSITION_END_TAG,vne=M.COMPOSITION_START_COMMAND,wP=M.COMPOSITION_START_TAG,TP=M.CONTROLLED_TEXT_INSERTION_COMMAND,dm=M.COPY_COMMAND,LP=M.CUT_COMMAND,cm=M.DELETE_CHARACTER_COMMAND,kP=M.DELETE_LINE_COMMAND,PP=M.DELETE_WORD_COMMAND,xne=M.DRAGEND_COMMAND,yne=M.DRAGOVER_COMMAND,EP=M.DRAGSTART_COMMAND,AP=M.DROP_COMMAND,Ba=M.DecoratorNode,Cne=M.ElementNode,MP=M.FOCUS_COMMAND,bne=M.FORMAT_ELEMENT_COMMAND,RP=M.FORMAT_TEXT_COMMAND,um=M.HISTORIC_TAG,Or=M.HISTORY_MERGE_TAG,NP=M.HISTORY_PUSH_TAG,Gx=M.INDENT_CONTENT_COMMAND,Ine=M.INPUT_COMMAND,jx=M.INSERT_LINE_BREAK_COMMAND,_P=M.INSERT_PARAGRAPH_COMMAND,DP=M.INSERT_TAB_COMMAND,au=M.INTERNAL_$isBlock,Sne=M.IS_ALL_FORMATTING,wne=M.IS_BOLD,Tne=M.IS_CODE,Lne=M.IS_HIGHLIGHT,kne=M.IS_ITALIC,Pne=M.IS_STRIKETHROUGH,Ene=M.IS_SUBSCRIPT,Ane=M.IS_SUPERSCRIPT,Mne=M.IS_UNDERLINE,OP=M.KEY_ARROW_DOWN_COMMAND,fm=M.KEY_ARROW_LEFT_COMMAND,pm=M.KEY_ARROW_RIGHT_COMMAND,FP=M.KEY_ARROW_UP_COMMAND,mm=M.KEY_BACKSPACE_COMMAND,BP=M.KEY_DELETE_COMMAND,zP=M.KEY_DOWN_COMMAND,gm=M.KEY_ENTER_COMMAND,Rne=M.KEY_ESCAPE_COMMAND,Nne=M.KEY_MODIFIER_COMMAND,_ne=M.KEY_SPACE_COMMAND,hm=M.KEY_TAB_COMMAND,$P=M.LineBreakNode,Dne=M.MOVE_TO_END,One=M.MOVE_TO_START,Fne=M.NODE_STATE_KEY,HP=M.OUTDENT_CONTENT_COMMAND,vm=M.PASTE_COMMAND,UP=M.PASTE_TAG,KP=M.ParagraphNode,qP=M.REDO_COMMAND,VP=M.REMOVE_TEXT_COMMAND,WP=M.RootNode,Bne=M.SELECTION_CHANGE_COMMAND,GP=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,jP=M.SELECT_ALL_COMMAND,zne=M.SKIP_COLLAB_TAG,$ne=M.SKIP_DOM_SELECTION_TAG,Hne=M.SKIP_SCROLL_INTO_VIEW_TAG,Une=M.SKIP_SELECTION_FOCUS_TAG,QP=M.TEXT_TYPE_TO_FORMAT,XP=M.TabNode,xm=M.TextNode,YP=M.UNDO_COMMAND,iu=M.addClassNamesToElement,Kne=M.buildImportMap,ym=M.configExtension,JP=M.createCommand,Cm=M.createEditor,qne=M.createSharedNodeState,ZP=M.createState,eE=M.declarePeerDependency,Nn=M.defineExtension,Vne=M.flipDirection,Wne=M.getDOMOwnerDocument,Qx=M.getDOMSelection,Gne=M.getDOMSelectionFromTarget,tE=M.getDOMTextNode,jne=M.getEditorPropertyFromDOMNode,Qne=M.getNearestEditorFromDOMNode,nE=M.getRegisteredNode,Xne=M.getRegisteredNodeOrThrow,Yne=M.getStaticNodeConfig,Jne=M.getTextDirection,Zne=M.getTransformSetFromKlass,oE=M.isBlockDomNode,eoe=M.isCurrentlyReadOnlyMode,rE=M.isDOMDocumentNode,aE=M.isDOMNode,toe=M.isDOMTextNode,noe=M.isDOMUnmanaged,Xx=M.isDocumentFragment,ooe=M.isExactShortcutMatch,iE=M.isHTMLAnchorElement,bm=M.isHTMLElement,su=M.isInlineDomNode,roe=M.isLexicalEditor,aoe=M.isModifierMatch,ioe=M.isSelectionCapturedInDecoratorInput,sE=M.isSelectionWithinEditor,Yx=M.makeStepwiseIterator,ia=M.mergeRegister,soe=M.normalizeClassNames,Im=M.removeClassNamesFromElement,loe=M.removeFromParent,doe=M.resetRandomKey,Fr=M.safeCast,coe=M.setDOMUnmanaged,uoe=M.setNodeIndentFromDOM,Sm=M.shallowMergeConfig,Jx=M.toggleTextFormatType;var Zx={};Mn(Zx,{LexicalComposer:()=>LH});pe();var lE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,TH=lE?he:q,wm={tag:Or};function LH({initialConfig:e,children:t}){let n=H(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=wT(null,o),c=Cm({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=fr();m.append(h);let g=lE?document.activeElement:null;(Fe()!==null||g!==null&&g===f.getRootElement())&&h.select()}},wm);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,wm);break}case"object":f.setEditorState(p,wm);break;case"function":f.update(()=>{Ct().isEmpty()&&p(f)},wm)}}})(c,s),[c,d]},[]);return TH(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(ST.Provider,{value:n,children:t})}var kH=Zx,dE=kH.LexicalComposer;var ty={};Mn(ty,{$canShowPlaceholder:()=>uE,$canShowPlaceholderCurry:()=>EH,$findTextIntersectionFromCharacters:()=>AH,$isRootTextContentEmpty:()=>ey,$isRootTextContentEmptyCurry:()=>PH,$rootTextContent:()=>cE,registerLexicalTextEntity:()=>RH});function cE(){return Ct().getTextContent()}function ey(e,t=!0){if(e)return!1;let n=cE();return t&&(n=n.trim()),n===""}function PH(e,t){return()=>ey(e,t)}function uE(e){if(!ey(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(om(r))return!1;if(qe(r)){if(!uP(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(!ot(l))return!1}}}return!0}function EH(e){return()=>uE(e)}function AH(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(qe(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(ot(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 MH(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 RH(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Nr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(xm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(ot(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(ot(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&&ot(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&&MH(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();ot(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();ot(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Os=ty,yoe=Os.$canShowPlaceholder,Tm=Os.$canShowPlaceholderCurry,Coe=Os.$findTextIntersectionFromCharacters,boe=Os.$isRootTextContentEmpty,Ioe=Os.$isRootTextContentEmptyCurry,Soe=Os.$rootTextContent,woe=Os.registerLexicalTextEntity;var sy={};Mn(sy,{$addNodeStyle:()=>BH,$cloneWithProperties:()=>Zp,$copyBlockFormatIndent:()=>CE,$ensureForwardRangeSelection:()=>yE,$forEachSelectedTextNode:()=>xE,$getComputedStyleForElement:()=>ry,$getComputedStyleForParent:()=>ay,$getSelectionStyleValueForProperty:()=>WH,$isAtNodeEnd:()=>FH,$isParentElementRTL:()=>iy,$isParentRTL:()=>DH,$moveCaretSelection:()=>SE,$moveCharacter:()=>qH,$patchStyleText:()=>zH,$selectAll:()=>am,$setBlocksType:()=>$H,$shouldOverrideDefaultCharacterSelection:()=>KH,$sliceSelectedTextNodeContent:()=>OH,$trimTextContentFromAnchor:()=>vE,$wrapNodes:()=>UH,createDOMRange:()=>NH,createRectsFromDOMRange:()=>_H,getCSSFromStyleObject:()=>hE,getStyleObjectFromCSS:()=>Pm,trimTextContentFromAnchor:()=>GH});function oy(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 km=new Map;function fE(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function pE(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function NH(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(ot(t)&&(l=fE(l)),ot(o)&&(d=fE(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=pE(l)),d.nodeName==="BR"&&([d,f]=pE(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 _H(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 gE(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 Pm(e){let t=km.get(e);return t===void 0&&(t=gE(e),km.set(e,t)),t}function hE(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function ry(e){let t=em().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function ay(e){return ry(nu(e)?e:e.getParentOrThrow())}function DH(e){let t=ay(e);return t!==null&&t.direction==="rtl"}function OH(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!Vx(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]=rP(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=Yk(t)),t.__text=y)}}return t}function FH(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return qe(t)||oy(177),e.offset===t.getChildrenSize()}function vE(e,t,n){let o=t.getNode(),r=n;if(qe(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(qe(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===""&&qe(o)&&!o.isInline()&&(s=`
3705
3705
 
3706
- `);let l=s.length;if(!nt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||Dc(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=Dp(d);return nt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=Nc(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=Cr(c);o.replace(g),h=g}if(Ie(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=Cr(p);o.replace(m)}r=0}}}function q$(e){let t=e.getStyle(),n=NP(t);sm.set(t,n)}function im(e,t){(Ie(e)?e.isCollapsed():nt(e)||He(e))||Px(280);let n=lm(Ie(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=_P(o);Ie(e)||nt(e)?e.setStyle(r):e.setTextStyle(r),sm.set(r,o)}function W$(e,t){if(Ie(e)&&e.isCollapsed()){im(e,t);let o=e.anchor.getNode();He(o)&&o.isEmpty()&&im(o,t)}OP(o=>{im(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!He(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),im(r,t))}}}function OP(e){let t=De();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Ie(t))for(let a of mk(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&&(hx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Ie(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&FP(t)}function FP(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 BP(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function G$(e,t,n=BP){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=hs(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=wa(i.getNode(),Bc),d=wa(s.getNode(),Bc);He(l)&&r.set(l.getKey(),l),He(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(He(i)&&Bc(i))r.set(i.getKey(),i);else if(o===null){let s=wa(i,Bc);He(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())&&br(a)}function RP(e){return e.getNode().isAttached()}function j$(e){let t=e;for(;t!==null&&!xs(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function Q$(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];xs(c)?(kx(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&Tk(c,s)?l.push(c):(kx(e,l,l.length,t,n),l=[c])}kx(e,l,l.length,t,n)}function kx(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=He(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(),xs(l))break}let c=new Set;for(let h=0;h<n;h++){let g=t[h];He(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&&Pk(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()),He(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),j$(v)}}else if(c.has(g.getKey())){He(g)||Px(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(xs(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(He(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=Nc();Ie(m)&&RP(m.anchor)&&RP(m.focus)?br(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function zP(e){let t=$P(e);return t!==null&&t.writingMode==="vertical-rl"}function $P(e){let t=e.anchor.getNode();return He(t)?Ax(t):Ex(t)}function X$(e,t){let n=zP(e)?!t:t;Mx(e)&&(n=!n);let o=Rl(e.focus,n?"previous":"next");if(kk(o))return!1;for(let r of Ck(o)){if(_c(r))return!r.origin.isInline();if(!He(r.origin)){if(Fp(r.origin))return!0;break}}return!1}function HP(e,t,n,o){e.modify(t?"extend":"move",n,o)}function Mx(e){let t=$P(e);return t!==null&&t.direction==="rtl"}function Y$(e,t,n){let o=Mx(e),r;r=zP(e)||o?!n:n,HP(e,t,r,"character")}function J$(e,t,n){let o=lm(e.getStyle());return o!==null&&o[t]||n}function Z$(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(Ie(e)&&e.isCollapsed()&&e.style!==""){let c=lm(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=J$(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var eH=DP;var tn=Rx,UP=tn.$addNodeStyle,bne=tn.$cloneWithProperties,Ine=tn.$copyBlockFormatIndent,Sne=tn.$ensureForwardRangeSelection,wne=tn.$forEachSelectedTextNode,Tne=tn.$getComputedStyleForElement,Lne=tn.$getComputedStyleForParent,kne=tn.$getSelectionStyleValueForProperty,Pne=tn.$isAtNodeEnd,Ane=tn.$isParentElementRTL,Ene=tn.$isParentRTL,Mne=tn.$moveCaretSelection,Nx=tn.$moveCharacter,Rne=tn.$patchStyleText,Nne=tn.$selectAll,_ne=tn.$setBlocksType,_x=tn.$shouldOverrideDefaultCharacterSelection,dm=tn.$sliceSelectedTextNodeContent,Dne=tn.$trimTextContentFromAnchor,One=tn.$wrapNodes,Fne=tn.createDOMRange,KP=tn.createRectsFromDOMRange,Bne=tn.getCSSFromStyleObject,zne=tn.getStyleObjectFromCSS,$ne=tn.trimTextContentFromAnchor;var Bx={};wn(Bx,{$descendantsMatching:()=>FH,$dfs:()=>yH,$dfsIterator:()=>ZP,$filter:()=>MH,$findMatchingParent:()=>wa,$firstToLastIterator:()=>BH,$getAdjacentCaret:()=>CH,$getAdjacentSiblingOrParentSiblingCaret:()=>vs,$getDepth:()=>tA,$getNearestBlockElementAncestorOrThrow:()=>TH,$getNearestNodeOfType:()=>wH,$getNextRightPreorderNode:()=>SH,$getNextSiblingOrParentSibling:()=>IH,$handleIndentAndOutdent:()=>RH,$insertFirst:()=>NH,$insertNodeToNearestRoot:()=>PH,$insertNodeToNearestRootAtCaret:()=>oA,$isEditorIsNestedEditor:()=>DH,$lastToFirstIterator:()=>Fx,$restoreEditorState:()=>kH,$reverseDfs:()=>bH,$reverseDfsIterator:()=>nA,$splitNode:()=>Fk,$unwrapAndFilterDescendants:()=>OH,$unwrapNode:()=>zH,$wrapNodeInElement:()=>AH,CAN_USE_BEFORE_INPUT:()=>cH,CAN_USE_DOM:()=>XP,IS_ANDROID:()=>uH,IS_ANDROID_CHROME:()=>fH,IS_APPLE:()=>pH,IS_APPLE_WEBKIT:()=>mH,IS_CHROME:()=>gH,IS_FIREFOX:()=>YP,IS_IOS:()=>hH,IS_SAFARI:()=>vH,addClassNamesToElement:()=>zc,calculateZoomLevel:()=>_H,isBlockDomNode:()=>bP,isHTMLAnchorElement:()=>wP,isHTMLElement:()=>tm,isInlineDomNode:()=>$c,isMimeType:()=>JP,makeStateWrapper:()=>$H,markSelection:()=>QP,mediaFileReader:()=>xH,mergeRegister:()=>Yr,objectKlassEquals:()=>EH,positionNodeOnRange:()=>jP,registerNestedElementResolver:()=>LH,removeClassNamesFromElement:()=>nm,selectionAlwaysOnDisplay:()=>dH});function cm(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 wr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,tH=wr&&"documentMode"in document?document.documentMode:null,WP=wr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),nH=wr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),oH=!(!wr||!("InputEvent"in window)||tH)&&"getTargetRanges"in new window.InputEvent("input"),rH=wr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),aH=wr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,GP=wr&&/Android/.test(navigator.userAgent),Ox=wr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),iH=wr&&GP&&Ox,sH=wr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&WP&&!Ox;function Jr(e){return`${e}px`}var lH={attributes:!0,characterData:!0,childList:!0,subtree:!0};function jP(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&cm(182),r===null&&cm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=KP(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=Jr(y.left-f);w.left!==k&&(w.left=k,v=!0);let T=Jr(y.top-p);w.top!==T&&(C.style.top=T,v=!0);let L=Jr(y.width);w.width!==L&&(C.style.width=L,v=!0);let b=Jr(y.height);w.height!==b&&(C.style.height=b,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(!tm(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,lH),l()});return()=>{c(),d()}}function VP(e,t,n){if(e.type!=="text"&&He(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[yP(n)||n,e.offset]}function QP(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(!Ie(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(b){let S=b.getStartEndPoints();return b.isBackward()?[S[1],S[0]]:S})(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),T=n===null||w!==o||v!==r||g!==n.getKey(),L=a===null||k!==i||C!==s||y!==a.getKey();if((T||L)&&w!==null&&k!==null){let b=(function(S,A,E,B,R,N,H){let D=(S._window?S._window.document:document).createRange();return D.setStart(...VP(A,E,B)),D.setEnd(...VP(R,N,H)),D})(e,p,h,w,m,x,k);l(),l=jP(e,b,S=>{if(t===void 0)for(let A of S){let E=A.style;E.background!=="Highlight"&&(E.background="Highlight"),E.color!=="HighlightText"&&(E.color="HighlightText"),E.marginTop!==Jr(-1.5)&&(E.marginTop=Jr(-1.5)),E.paddingTop!==Jr(4)&&(E.paddingTop=Jr(4)),E.paddingBottom!==Jr(0)&&(E.paddingBottom=Jr(0))}else t(S)})}n=h,o=w,r=v,a=x,i=k,s=C})}return d(e.getEditorState()),Yr(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function dH(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=QP(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var cH=oH,XP=wr,uH=GP,fH=iH,pH=WP,mH=sH,gH=Ox,YP=nH,hH=aH,vH=rH;function JP(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function xH(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()}),JP(l,t)?d.readAsDataURL(l):i()};i()})}function yH(e,t){return Array.from(ZP(e,t))}function CH(e){return e?e.getAdjacentCaret():null}function bH(e,t){return Array.from(nA(e,t))}function ZP(e,t){return eA("next",e,t)}function qP(e,t){let n=vs(Ta(e,t));return n&&n[0]}function eA(e,t,n){let o=yt(),r=t||o,a=He(r)?gi(r,e):Ta(r,e),i=tA(r),s=n?fx(mx(Ta(n,e)))||qP(n,e):qP(r,e),l=i;return Ix({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;_c(d)&&l++;let c=vs(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function IH(e){let t=vs(Ta(e,"next"));return t&&[t[0].origin,t[1]]}function tA(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function SH(e){let t=mx(Ta(e,"previous")),n=vs(t,"root");return n&&n[0].origin}function nA(e,t){return eA("previous",e,t)}function wH(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function TH(e){let t=wa(e,n=>He(n)&&!n.isInline());return He(t)||cm(4,e.__key),t}function LH(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 kH(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,Np(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;br(r===null?null:r.clone())}function PH(e){let t=De()||Nc(),n;if(Ie(t))n=Rl(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=Ta(s,"next"))}n=n||gi(yt(),"previous").getFlipped().insert(Zo())}let o=oA(e,n),r=fx(o),a=_c(r)?Mk(r):o;return Dk(Sk(a)),e.getLatest()}function oA(e,t,n){let o=px(t,"next");for(let r=o;r;r=Ok(r,n))o=r;return Bp(o)&&cm(283),o.insert(e.isInline()?Zo().append(e):e),px(Ta(e.getLatest(),"next"),t.direction)}function AH(e,t){let n=t();return e.replace(n),n.append(e),n}function EH(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function MH(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 RH(e){let t=De();if(!Ie(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=wa(a,d=>He(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 NH(e,t){gi(e,"next").insert(t)}var Dx=!(YP||!XP)&&void 0;function _H(e,t=!1){let n=1;if((function(){if(Dx===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"),Dx=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return Dx})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function DH(e){return e._parentEditor!==null}function OH(e,t){return rA(e,t,null)}function rA(e,t,n){let o=!1;for(let r of Fx(e))t(r)?n!==null&&n(r):(o=!0,He(r)&&rA(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function FH(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(He(r))for(let a of Fx(r))o.push(a);return n}function BH(e){return aA(gi(e,"next"))}function Fx(e){return aA(gi(e,"previous"))}function aA(e){return Ix({hasNext:Ek,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function zH(e){_k(Ta(e,"next")).splice(1,e.getChildren())}function $H(e){let t=o=>Op(o,e),n=(o,r)=>$p(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 Ke=Bx,qne=Ke.$descendantsMatching,Wne=Ke.$dfs,Gne=Ke.$dfsIterator,jne=Ke.$filter,Qne=Ke.$findMatchingParent,Xne=Ke.$firstToLastIterator,Yne=Ke.$getAdjacentCaret,Jne=Ke.$getAdjacentSiblingOrParentSiblingCaret,Zne=Ke.$getDepth,iA=Ke.$getNearestBlockElementAncestorOrThrow,eoe=Ke.$getNearestNodeOfType,toe=Ke.$getNextRightPreorderNode,noe=Ke.$getNextSiblingOrParentSibling,sA=Ke.$handleIndentAndOutdent,ooe=Ke.$insertFirst,roe=Ke.$insertNodeToNearestRoot,aoe=Ke.$insertNodeToNearestRootAtCaret,ioe=Ke.$isEditorIsNestedEditor,soe=Ke.$lastToFirstIterator,loe=Ke.$restoreEditorState,doe=Ke.$reverseDfs,coe=Ke.$reverseDfsIterator,uoe=Ke.$splitNode,foe=Ke.$unwrapAndFilterDescendants,poe=Ke.$unwrapNode,moe=Ke.$wrapNodeInElement,goe=Ke.CAN_USE_BEFORE_INPUT,hoe=Ke.CAN_USE_DOM,voe=Ke.IS_ANDROID,xoe=Ke.IS_ANDROID_CHROME,yoe=Ke.IS_APPLE,Coe=Ke.IS_APPLE_WEBKIT,boe=Ke.IS_CHROME,Ioe=Ke.IS_FIREFOX,Soe=Ke.IS_IOS,woe=Ke.IS_SAFARI,Toe=Ke.addClassNamesToElement,Loe=Ke.calculateZoomLevel,zx=Ke.isBlockDomNode,koe=Ke.isHTMLAnchorElement,lA=Ke.isHTMLElement,Poe=Ke.isInlineDomNode,Aoe=Ke.isMimeType,Eoe=Ke.makeStateWrapper,Moe=Ke.markSelection,Roe=Ke.mediaFileReader,ka=Ke.mergeRegister,Hc=Ke.objectKlassEquals,Noe=Ke.positionNodeOnRange,_oe=Ke.registerNestedElementResolver,Doe=Ke.removeClassNamesFromElement,Ooe=Ke.selectionAlwaysOnDisplay;var $x={};wn($x,{ContentEditable:()=>UH,ContentEditableElement:()=>uA});ue();var cA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Me:V;function HH({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},T){let[L,b]=K(e.isEditable()),S=U(E=>{E&&E.ownerDocument&&E.ownerDocument.defaultView?e.setRootElement(E):e.setRootElement(null)},[e]),A=$(()=>(function(...E){return B=>{for(let R of E)typeof R=="function"?R(B):R!=null&&(R.current=B)}})(T,S),[S,T]);return cA(()=>(b(e.isEditable()),e.registerEditableListener(E=>{b(E)})),[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:A,role:v,spellCheck:x,style:y,tabIndex:C,...k})}var uA=zn(HH);function dA(e){return e.getEditorState().read(am(e.isComposing()))}var UH=zn(KH);function KH(e,t){let{placeholder:n,...o}=e,[r]=xn();return I(pe,{children:[u(uA,{editor:r,...o,ref:t}),n!=null&&u(VH,{editor:r,content:n})]})}function VH({content:e,editor:t}){let n=(function(i){let[s,l]=K(()=>dA(i));return cA(()=>{function d(){let c=dA(i);l(c)}return d(),ka(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=K(t.isEditable());if(Me(()=>(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 fA=$x,pA=fA.ContentEditable,Koe=fA.ContentEditableElement;ue();var qH=Ot(null),Hx={didCatch:!1,error:null},um=class extends id{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Hx}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(Hx))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&WH(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Hx))}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=Ce(o,l);else if(r!==void 0)s=r;else throw i}return Ce(qH.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function WH(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Ux={};wn(Ux,{LexicalErrorBoundary:()=>GH});function GH({children:e,onError:t}){return u(um,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var jH=Ux,mA=jH.LexicalErrorBoundary;var oy={};wn(oy,{$createHorizontalRuleNode:()=>ny,$isDecoratorTextNode:()=>PA,$isHorizontalRuleNode:()=>_A,AutoFocusExtension:()=>YH,ClearEditorExtension:()=>JH,DecoratorTextExtension:()=>rU,DecoratorTextNode:()=>Vc,EditorStateExtension:()=>gm,HorizontalRuleExtension:()=>gU,HorizontalRuleNode:()=>bs,INSERT_HORIZONTAL_RULE_COMMAND:()=>pU,InitialStateExtension:()=>RA,LexicalBuilder:()=>zl,NodeSelectionExtension:()=>Jx,TabIndentationExtension:()=>hU,applyFormatFromStyle:()=>eU,applyFormatToDom:()=>tU,batch:()=>CA,buildEditorFromExtensions:()=>lU,computed:()=>SA,configExtension:()=>Zp,declarePeerDependency:()=>xP,defineExtension:()=>Tn,effect:()=>vi,getExtensionDependencyFromEditor:()=>cU,getKnownTypesAndNodes:()=>ZH,getPeerDependencyFromEditor:()=>NA,getPeerDependencyFromEditorOrThrow:()=>uU,namedSignals:()=>vm,registerClearEditor:()=>LA,registerTabIndentation:()=>OA,safeCast:()=>Sr,shallowMergeConfig:()=>om,signal:()=>Bl,untracked:()=>jx,watchedSignal:()=>ey});var QH=Symbol.for("preact-signals");function hm(){if(hi>1)return void hi--;let e,t=!1;for(;Kc!==void 0;){let n=Kc;for(Kc=void 0,Qx++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&bA(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Qx=0,hi--,t)throw e}function CA(e){if(hi>0)return e();hi++;try{return e()}finally{hm()}}var Lt,Kc;function jx(e){let t=Lt;Lt=void 0;try{return e()}finally{Lt=t}}var hi=0,Qx=0,mm=0;function gA(e){if(Lt===void 0)return;let t=e.n;return t===void 0||t.t!==Lt?(t={i:0,S:e,p:Lt.s,n:void 0,t:Lt,e:void 0,x:void 0,r:t},Lt.s!==void 0&&(Lt.s.n=t),Lt.s=t,e.n=t,32&Lt.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=Lt.s,t.n=void 0,Lt.s.n=t,Lt.s=t),t):void 0}function xo(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 Bl(e,t){return new xo(e,t)}function bA(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 hA(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 IA(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 Cs(e,t){xo.call(this,void 0),this.x=e,this.s=void 0,this.g=mm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function SA(e,t){return new Cs(e,t)}function wA(e){let t=e.u;if(e.u=void 0,typeof t=="function"){hi++;let n=Lt;Lt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Zx(e),o}finally{Lt=n,hm()}}}function Zx(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,wA(e)}function XH(e){if(Lt!==this)throw new Error("Out-of-order effect");IA(this),Lt=e,this.f&=-2,8&this.f&&Zx(this),hm()}function Fl(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 vi(e,t){let n=new Fl(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function vm(e,t={}){let n={};for(let o in e){let r=t[o],a=Bl(r===void 0?e[o]:r);n[o]=a}return n}xo.prototype.brand=QH,xo.prototype.h=function(){return!0},xo.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:jx(()=>{var n;(n=this.W)==null||n.call(this)}))},xo.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&&jx(()=>{var o;(o=this.Z)==null||o.call(this)}))}},xo.prototype.subscribe=function(e){return vi(()=>{let t=this.value,n=Lt;Lt=void 0;try{e(t)}finally{Lt=n}},{name:"sub"})},xo.prototype.valueOf=function(){return this.value},xo.prototype.toString=function(){return this.value+""},xo.prototype.toJSON=function(){return this.value},xo.prototype.peek=function(){let e=Lt;Lt=void 0;try{return this.value}finally{Lt=e}},Object.defineProperty(xo.prototype,"value",{get(){let e=gA(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Qx>100)throw new Error("Cycle detected");this.v=e,this.i++,mm++,hi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{hm()}}}}),Cs.prototype=new xo,Cs.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===mm))return!0;if(this.g=mm,this.f|=1,this.i>0&&!bA(this))return this.f&=-2,!0;let e=Lt;try{hA(this),Lt=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 Lt=e,IA(this),this.f&=-2,!0},Cs.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)}xo.prototype.S.call(this,e)},Cs.prototype.U=function(e){if(this.t!==void 0&&(xo.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)}},Cs.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(Cs.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=gA(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Fl.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()}},Fl.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,wA(this),hA(this),hi++;let e=Lt;return Lt=this,XH.bind(this,e)},Fl.prototype.N=function(){2&this.f||(this.f|=2,this.o=Kc,Kc=this)},Fl.prototype.d=function(){this.f|=8,1&this.f||Zx(this)},Fl.prototype.dispose=function(){this.d()};var YH=Tn({build:(e,t,n)=>vm(t),config:Sr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return vi(()=>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 TA(){let e=yt(),t=De(),n=Zo();e.clear(),e.append(n),t!==null&&n.select(),Ie(t)&&(t.format=0)}function LA(e,t=TA){return e.registerCommand(Hp,n=>(e.update(t),!0),Wt)}var JH=Tn({build:(e,t,n)=>vm(t),config:Sr({$onClear:TA}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return vi(()=>LA(e,o.value))}});function ZH(e){let t=new Set,n=new Set;for(let o of kA(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function kA(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Kx=vP("format",{parse:e=>typeof e=="number"?e:0}),Vc=class extends La{$config(){return this.config("decorator-text",{extends:La,stateConfigs:[{flat:!0,stateConfig:Kx}]})}getFormat(){return Op(this,Kx)}getFormatFlags(t,n){return Sx(this.getFormat(),t,n)}hasFormat(t){let n=pP[t];return(this.getFormat()&n)!==0}setFormat(t){return $p(this,Kx,t)}toggleFormat(t){let n=this.getFormat(),o=Sx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function PA(e){return e instanceof Vc}function eU(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 tU(e,t,n=oU){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=nU(t,o));return t}function nU(e,t){let n=document.createElement(t);return n.appendChild(e),n}var oU={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},rU=Tn({name:"@lexical/extension/DecoratorText",nodes:()=>[Vc],register:(e,t,n)=>e.registerCommand(Xk,o=>{let r=De();if(gx(r)||Ie(r))for(let a of r.getNodes())PA(a)&&a.toggleFormat(o);return!1},Dl)});function ey(e,t){let n;return Bl(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var gm=Tn({build:e=>ey(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Rt(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 AA(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]=AA(n[r],o[r]);return e}return t}var ty=0,Xx=1,EA=2,Vx=3,fm=4,Ol=5,qx=6,Uc=7;function Wx(e){return e.id===ty}function MA(e){return e.id===EA}function aU(e){return(function(t){return t.id===Xx})(e)||Rt(305,String(e.id),String(Xx)),Object.assign(e,{id:EA})}var iU=new Set,Yx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:ty}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):om;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;MA(n)||Rt(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:Vx,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&&Rt(307,String(n.id),String(Ol)),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:Ol,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Ol&&Rt(308,String(o.id),String(Ol));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:qx})})(o),()=>{let a=this.state;a.id!==Uc&&Rt(309,String(o.id),String(Uc)),this.state=(function(i){return Object.assign(i,{id:Ol})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==qx&&Rt(310,String(n.id),String(qx)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:Uc})})(n),o}getSignal(){return this._signal===void 0&&Rt(311),this._signal}getInitResult(){this.extension.init===void 0&&Rt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=fm})(t)||Rt(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>=Vx})(t)||Rt(314,String(t.id),String(Vx)),{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&&Rt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Rt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=Uc})(t)||Rt(316,String(t.id),String(Uc)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||iU}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>=Ol})(t)||Rt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},vA={tag:Xr};function sU(){let e=yt();e.isEmpty()&&e.append(Zo())}var RA=Tn({config:Sr({setOptions:vA,updateOptions:vA}),init:({$initialEditorState:e=sU})=>({$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(Lk(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:[cP,Jp,rP,mP,sP]}),xA=Symbol.for("@lexical/extension/LexicalBuilder");function lU(...e){return zl.fromExtensions(e).buildEditor()}function yA(){}function dU(e){throw e}function pm(e){return Array.isArray(e)?e:[e]}var Gx="0.41.0+prod.esm",zl=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=Gx,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[pm(RA)];for(let o of t)n.push(pm(o));return new e(n)}static maybeFromEditor(t){let n=t[xA];return n&&(n.PACKAGE_VERSION!==Gx&&Rt(292,n.PACKAGE_VERSION,Gx),n instanceof e||Rt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Rt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(em({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[xA]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=yA;function n(){try{t()}finally{t=yA}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=Yr(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&&Rt(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&&Rt(296);let n=pm(t),[o]=n;typeof o.name!="string"&&Rt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Rt(298,o.name),!r){r=new Yx(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Rt(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Rt(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=pm(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(MA(a))return;let i=o.extension.name;var s;Wx(a)||Rt(300,i,r||"[unknown]"),Wx(s=a)||Rt(304,String(s.id),String(ty)),a=Object.assign(s,{id:Xx}),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=aU(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())Wx(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&&Rt(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 Yr(...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 kA(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Rt(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&&AA(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=dU),t}};function cU(e,t){let n=zl.fromEditor(e).getExtensionRep(t);return n===void 0&&Rt(303,t.name),n.getExtensionDependency()}function NA(e,t){let n=zl.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function uU(e,t){let n=NA(e,t);return n===void 0&&Rt(291,t),n}var fU=new Set,Jx=Tn({build(e,t,n){let o=n.getDependency(gm).output,r=Bl({watchedNodeKeys:new Map}),a=ey(()=>{},()=>vi(()=>{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=Dp(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=SA(()=>(a.value||fU).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:[gm],name:"@lexical/extension/NodeSelection"}),pU=hP("INSERT_HORIZONTAL_RULE_COMMAND"),bs=class e extends La{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return ny().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:mU,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return zc(n,t.theme.hr),n}getTextContent(){return`
3707
- `}isInline(){return!1}updateDOM(){return!1}};function mU(){return{node:ny()}}function ny(){return hk(bs)}function _A(e){return e instanceof bs}var gU=Tn({dependencies:[gm,Jx],name:"@lexical/extension/HorizontalRule",nodes:()=>[bs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Jx).output,r=Bl({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return Yr(e.registerCommand($k,i=>{if(SP(i.target)){let s=wk(i.target);if(_A(s))return(function(l,d=!1){let c=De(),f=l.isSelected(),p=l.getKey(),m;d&&gx(c)?m=c:(m=vk(),br(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},Dl),e.registerMutationListener(bs,(i,s)=>{CA(()=>{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:Bl(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),vi(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(vi(()=>{let d=s.value;d&&(l.value?zc(d,a):nm(d,a))}));return Yr(...i)}))}});function DA(e){return e.canBeEmpty()}function OA(e,t,n=DA){return Yr(e.registerCommand(Xp,o=>{let r=De();if(!Ie(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>Nl(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=iA(c);if(f.canIndent()){let p=f.getKey(),m=hs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=Rk(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?aP:xx:Zk;return e.dispatchCommand(a,void 0)},Wt),e.registerCommand(xx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=De();if(!Ie(r))return!1;let a=typeof n=="function"?n:n.peek();return sA(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},Up))}var hU=Tn({build:(e,t,n)=>vm(t),config:Sr({$canIndent:DA,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return vi(()=>{if(!o.value)return OA(e,r,a)})}});var gt=oy,Zoe=gt.$createHorizontalRuleNode,ere=gt.$isDecoratorTextNode,tre=gt.$isHorizontalRuleNode,nre=gt.AutoFocusExtension,ore=gt.ClearEditorExtension,rre=gt.DecoratorTextExtension,are=gt.DecoratorTextNode,ire=gt.EditorStateExtension,sre=gt.HorizontalRuleExtension,lre=gt.HorizontalRuleNode,dre=gt.INSERT_HORIZONTAL_RULE_COMMAND,cre=gt.InitialStateExtension,FA=gt.LexicalBuilder,ure=gt.NodeSelectionExtension,fre=gt.TabIndentationExtension,pre=gt.applyFormatFromStyle,mre=gt.applyFormatToDom,BA=gt.batch,gre=gt.buildEditorFromExtensions,hre=gt.computed,vre=gt.configExtension,xre=gt.declarePeerDependency,yre=gt.defineExtension,qc=gt.effect,Cre=gt.getExtensionDependencyFromEditor,bre=gt.getKnownTypesAndNodes,zA=gt.getPeerDependencyFromEditor,Ire=gt.getPeerDependencyFromEditorOrThrow,xm=gt.namedSignals,Sre=gt.registerClearEditor,wre=gt.registerTabIndentation,Tre=gt.safeCast,Lre=gt.shallowMergeConfig,kre=gt.signal,Pre=gt.untracked,Are=gt.watchedSignal;var ry={};wn(ry,{HistoryExtension:()=>ym,SharedHistoryExtension:()=>yU,createEmptyHistoryState:()=>UA,registerHistory:()=>HA});function vU(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(!(Ie(a)&&Ie(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(x,y,C){let w=x._nodeMap,k=[];for(let T of y){let L=w.get(T);L!==void 0&&k.push(L)}for(let[T,L]of C){if(!L)continue;let b=w.get(T);b===void 0||Dc(b)||k.push(b)}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 xU(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(Uk)&&(r=n,a=o,i=s),p.has(qp))return o=0,n=m,2;p.has(Hk)&&i&&(n=r,o=a,s=i);let h=vU(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(Yk);if(!x&&v&&p.has(Xr))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,T){let L=k._nodeMap.get(w),b=T._nodeMap.get(w),S=k._selection,A=T._selection;return!(Ie(S)&&Ie(A)&&S.anchor.type==="element"&&S.focus.type==="element"&&A.anchor.type==="text"&&A.focus.type==="text"||!nt(L)||!nt(b)||L.__parent!==b.__parent)&&JSON.stringify(k.read(()=>L.exportJSON()))===JSON.stringify(T.read(()=>b.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=h,g}}function $A(e){e.undoStack=[],e.redoStack=[],e.current=null}function HA(e,t,n){let o=xU(e,n);return ka(e.registerCommand(gP,()=>((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(Oc,!0)),l.length===0&&a.dispatchCommand(Fc,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:qp})}})(e,t),!0),Wt),e.registerCommand(lP,()=>((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(Fc,!0));let c=s.pop();s.length===0&&a.dispatchCommand(Oc,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:qp})}})(e,t),!0),Wt),e.registerCommand(Hp,()=>($A(t),!1),Wt),e.registerCommand(zk,()=>($A(t),e.dispatchCommand(Oc,!1),e.dispatchCommand(Fc,!1),!0),Wt),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(Oc,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(Fc,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function UA(){return{current:null,redoStack:[],undoStack:[]}}var ym=Tn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>xm({delay:t,disabled:o,historyState:n(e)}),config:Sr({createInitialHistoryState:UA,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return qc(()=>o.disabled.value?void 0:HA(e,o.historyState.value,o.delay))}}),yU=Tn({dependencies:[Zp(ym,{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(ym),r=(function(i){return i?zA(i,ym.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return qc(()=>BA(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Cm=ry,_re=Cm.HistoryExtension,Dre=Cm.SharedHistoryExtension,bm=Cm.createEmptyHistoryState,KA=Cm.registerHistory;var ay={};wn(ay,{HistoryPlugin:()=>CU,createEmptyHistoryState:()=>bm});ue();function CU({delay:e,externalHistoryState:t}){let[n]=xn();return(function(o,r,a=1e3){let i=$(()=>r||bm(),[r]);V(()=>KA(o,i,a),[a,o,i])})(n,t,e),null}var VA=ay,qA=VA.HistoryPlugin,Hre=VA.createEmptyHistoryState;var iy={};wn(iy,{OnChangePlugin:()=>IU});ue();var bU=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Me:V;function IU({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=xn();return bU(()=>{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(Xr)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var SU=iy,WA=SU.OnChangePlugin;var sy={};wn(sy,{useLexicalEditable:()=>LU});ue();var wU=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Me:V;function TU(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function LU(){return(function(e){let[t]=xn(),n=$(()=>e(t),[t,e]),[o,r]=K(()=>n.initialValueFn()),a=_(o);return wU(()=>{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})(TU)}var kU=sy,GA=kU.useLexicalEditable;var ly={};wn(ly,{ReactProviderExtension:()=>PU});var PU=Tn({name:"@lexical/react/ReactProvider"});var AU=ly,jA=AU.ReactProviderExtension;var dy={};wn(dy,{DragonExtension:()=>EU,registerDragonSupport:()=>QA});function QA(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(Ie(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 EU=Tn({build:(e,t,n)=>xm(t),config:Sr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>qc(()=>n.getOutput().disabled.value?void 0:QA(e))});var XA=dy,YA=XA.DragonExtension,JA=XA.registerDragonSupport;var cy={};wn(cy,{$generateHtmlFromNodes:()=>RU,$generateNodesFromDOM:()=>MU});function MU(e,t){let n=IP(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!eE.has(a.nodeName)){let i=tE(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof vx&&i.insertAfter(gs());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function RU(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=yt().getChildren();for(let r=0;r<o.length;r++)ZA(e,o[r],n,t);return n.innerHTML}function ZA(e,t,n,o=null){let r=o===null||t.isSelected(o),a=He(t)&&t.excludeFromCopy("html"),i=t;o!==null&&nt(t)&&(i=dm(o,t,"clone"));let s=He(i)?i.getChildren():[],l=CP(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=ZA(e,h,p,o);!r&&He(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((lA(c)||bx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(bx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var eE=new Set(["STYLE","SCRIPT"]);function tE(e,t,n,o,r=new Map,a){let i=[];if(eE.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||!xs(s))&&(s!=null&&Nl(s)||o);for(let h=0;h<f.length;h++)p.push(...tE(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),zx(e)&&(p=NU(e,p,m?()=>{let h=new vx;return n.push(h),h}:Zo)),s==null?p.length>0?i=i.concat(p):zx(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:$c(h.nextSibling)&&$c(h.previousSibling)})(e)&&(i=i.concat(gs())):He(s)&&s.append(...p),i}function NU(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(Nl(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&Nl(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var nE=cy,oE=nE.$generateHtmlFromNodes,rE=nE.$generateNodesFromDOM;var fy={};wn(fy,{$generateJSONFromSelectedNodes:()=>dE,$generateNodesFromSerializedNodes:()=>cE,$getClipboardDataFromSelection:()=>fE,$getHtmlContent:()=>iE,$getLexicalContent:()=>sE,$insertDataTransferForPlainText:()=>_U,$insertDataTransferForRichText:()=>DU,$insertGeneratedNodes:()=>uy,copyToClipboard:()=>OU,setLexicalClipboardDataTransfer:()=>pE});function Im(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 iE(e,t=De()){return t==null&&Im(166),Ie(t)&&t.isCollapsed()||t.getNodes().length===0?"":oE(e,t)}function sE(e,t=De()){return t==null&&Im(166),Ie(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(dE(e,t))}function _U(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function DU(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 uy(n,cE(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 uy(n,rE(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Ie(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(Ie(d)){let c=s[l];c===`
3706
+ `);let l=s.length;if(!ot(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||nu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=tm(d);return ot(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=eu(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=Nr(c);o.replace(g),h=g}if(Ie(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=Nr(p);o.replace(m)}r=0}}}function BH(e){let t=e.getStyle(),n=gE(t);km.set(t,n)}function Lm(e,t){(Ie(e)?e.isCollapsed():ot(e)||qe(e))||oy(280);let n=Pm(Ie(e)?e.style:ot(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=hE(o);Ie(e)||ot(e)?e.setStyle(r):e.setTextStyle(r),km.set(r,o)}function zH(e,t){if(Ie(e)&&e.isCollapsed()){Lm(e,t);let o=e.anchor.getNode();qe(o)&&o.isEmpty()&&Lm(o,t)}xE(o=>{Lm(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!qe(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Lm(r,t))}}}function xE(e){let t=Fe();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Ie(t))for(let a of Xk(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!ot(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(Vx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Ie(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&yE(t)}function yE(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 CE(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function $H(e,t,n=CE){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=Oa(i.getNode(),au),d=Oa(s.getNode(),au);qe(l)&&r.set(l.getKey(),l),qe(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(qe(i)&&au(i))r.set(i.getKey(),i);else if(o===null){let s=Oa(i,au);qe(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(Fe())&&_r(a)}function mE(e){return e.getNode().isAttached()}function HH(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 UH(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)?(ny(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&sP(c,s)?l.push(c):(ny(e,l,l.length,t,n),l=[c])}ny(e,l,l.length,t,n)}function ny(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=qe(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];qe(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&&cP(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()),qe(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),HH(v)}}else if(c.has(g.getKey())){qe(g)||oy(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(qe(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=eu();Ie(m)&&mE(m.anchor)&&mE(m.focus)?_r(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function bE(e){let t=IE(e);return t!==null&&t.writingMode==="vertical-rl"}function IE(e){let t=e.anchor.getNode();return qe(t)?ry(t):ay(t)}function KH(e,t){let n=bE(e)?!t:t;iy(e)&&(n=!n);let o=Yl(e.focus,n?"previous":"next");if(dP(o))return!1;for(let r of nP(o)){if(tu(r))return!r.origin.isInline();if(!qe(r.origin)){if(om(r.origin))return!0;break}}return!1}function SE(e,t,n,o){e.modify(t?"extend":"move",n,o)}function iy(e){let t=IE(e);return t!==null&&t.direction==="rtl"}function qH(e,t,n){let o=iy(e),r;r=bE(e)||o?!n:n,SE(e,t,r,"character")}function VH(e,t,n){let o=Pm(e.getStyle());return o!==null&&o[t]||n}function WH(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(Ie(e)&&e.isCollapsed()&&e.style!==""){let c=Pm(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))&&ot(f)){let p=VH(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var GH=vE;var sn=sy,wE=sn.$addNodeStyle,Poe=sn.$cloneWithProperties,Eoe=sn.$copyBlockFormatIndent,Aoe=sn.$ensureForwardRangeSelection,Moe=sn.$forEachSelectedTextNode,Roe=sn.$getComputedStyleForElement,Noe=sn.$getComputedStyleForParent,_oe=sn.$getSelectionStyleValueForProperty,Doe=sn.$isAtNodeEnd,Ooe=sn.$isParentElementRTL,Foe=sn.$isParentRTL,Boe=sn.$moveCaretSelection,ly=sn.$moveCharacter,zoe=sn.$patchStyleText,$oe=sn.$selectAll,Hoe=sn.$setBlocksType,dy=sn.$shouldOverrideDefaultCharacterSelection,Em=sn.$sliceSelectedTextNodeContent,Uoe=sn.$trimTextContentFromAnchor,Koe=sn.$wrapNodes,qoe=sn.createDOMRange,TE=sn.createRectsFromDOMRange,Voe=sn.getCSSFromStyleObject,Woe=sn.getStyleObjectFromCSS,Goe=sn.trimTextContentFromAnchor;var py={};Mn(py,{$descendantsMatching:()=>AU,$dfs:()=>fU,$dfsIterator:()=>DE,$filter:()=>wU,$findMatchingParent:()=>Oa,$firstToLastIterator:()=>MU,$getAdjacentCaret:()=>pU,$getAdjacentSiblingOrParentSiblingCaret:()=>_s,$getDepth:()=>FE,$getNearestBlockElementAncestorOrThrow:()=>xU,$getNearestNodeOfType:()=>vU,$getNextRightPreorderNode:()=>hU,$getNextSiblingOrParentSibling:()=>gU,$handleIndentAndOutdent:()=>TU,$insertFirst:()=>LU,$insertNodeToNearestRoot:()=>bU,$insertNodeToNearestRootAtCaret:()=>zE,$isEditorIsNestedEditor:()=>PU,$lastToFirstIterator:()=>fy,$restoreEditorState:()=>CU,$reverseDfs:()=>mU,$reverseDfsIterator:()=>BE,$splitNode:()=>yP,$unwrapAndFilterDescendants:()=>EU,$unwrapNode:()=>RU,$wrapNodeInElement:()=>IU,CAN_USE_BEFORE_INPUT:()=>oU,CAN_USE_DOM:()=>RE,IS_ANDROID:()=>rU,IS_ANDROID_CHROME:()=>aU,IS_APPLE:()=>iU,IS_APPLE_WEBKIT:()=>sU,IS_CHROME:()=>lU,IS_FIREFOX:()=>NE,IS_IOS:()=>dU,IS_SAFARI:()=>cU,addClassNamesToElement:()=>iu,calculateZoomLevel:()=>kU,isBlockDomNode:()=>oE,isHTMLAnchorElement:()=>iE,isHTMLElement:()=>bm,isInlineDomNode:()=>su,isMimeType:()=>_E,makeStateWrapper:()=>NU,markSelection:()=>ME,mediaFileReader:()=>uU,mergeRegister:()=>ia,objectKlassEquals:()=>SU,positionNodeOnRange:()=>AE,registerNestedElementResolver:()=>yU,removeClassNamesFromElement:()=>Im,selectionAlwaysOnDisplay:()=>nU});function Am(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 Br=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,jH=Br&&"documentMode"in document?document.documentMode:null,PE=Br&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),QH=Br&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),XH=!(!Br||!("InputEvent"in window)||jH)&&"getTargetRanges"in new window.InputEvent("input"),YH=Br&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),JH=Br&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,EE=Br&&/Android/.test(navigator.userAgent),uy=Br&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ZH=Br&&EE&&uy,eU=Br&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&PE&&!uy;function sa(e){return`${e}px`}var tU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function AE(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Am(182),r===null&&Am(183);let{left:f,top:p}=r.getBoundingClientRect(),m=TE(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=sa(y.left-f);w.left!==k&&(w.left=k,v=!0);let S=sa(y.top-p);w.top!==S&&(C.style.top=S,v=!0);let L=sa(y.width);w.width!==L&&(C.style.width=L,v=!0);let I=sa(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(!bm(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,tU),l()});return()=>{c(),d()}}function LE(e,t,n){if(e.type!=="text"&&qe(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[tE(n)||n,e.offset]}function ME(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=Fe();if(!Ie(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,A,E,N,R,B,z){let U=(T._window?T._window.document:document).createRange();return U.setStart(...LE(A,E,N)),U.setEnd(...LE(R,B,z)),U})(e,p,h,w,m,x,k);l(),l=AE(e,I,T=>{if(t===void 0)for(let A of T){let E=A.style;E.background!=="Highlight"&&(E.background="Highlight"),E.color!=="HighlightText"&&(E.color="HighlightText"),E.marginTop!==sa(-1.5)&&(E.marginTop=sa(-1.5)),E.paddingTop!==sa(4)&&(E.paddingTop=sa(4)),E.paddingBottom!==sa(0)&&(E.paddingBottom=sa(0))}else t(T)})}n=h,o=w,r=v,a=x,i=k,s=C})}return d(e.getEditorState()),ia(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function nU(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=ME(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var oU=XH,RE=Br,rU=EE,aU=ZH,iU=PE,sU=eU,lU=uy,NE=QH,dU=JH,cU=YH;function _E(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function uU(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()}),_E(l,t)?d.readAsDataURL(l):i()};i()})}function fU(e,t){return Array.from(DE(e,t))}function pU(e){return e?e.getAdjacentCaret():null}function mU(e,t){return Array.from(BE(e,t))}function DE(e,t){return OE("next",e,t)}function kE(e,t){let n=_s(Fa(e,t));return n&&n[0]}function OE(e,t,n){let o=Ct(),r=t||o,a=qe(r)?Ri(r,e):Fa(r,e),i=FE(r),s=n?Hx(Kx(Fa(n,e)))||kE(n,e):kE(r,e),l=i;return Yx({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;tu(d)&&l++;let c=_s(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function gU(e){let t=_s(Fa(e,"next"));return t&&[t[0].origin,t[1]]}function FE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function hU(e){let t=Kx(Fa(e,"previous")),n=_s(t,"root");return n&&n[0].origin}function BE(e,t){return OE("previous",e,t)}function vU(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function xU(e){let t=Oa(e,n=>qe(n)&&!n.isInline());return qe(t)||Am(4,e.__key),t}function yU(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 CU(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,Zp(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;_r(r===null?null:r.clone())}function bU(e){let t=Fe()||eu(),n;if(Ie(t))n=Yl(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=Fa(s,"next"))}n=n||Ri(Ct(),"previous").getFlipped().insert(fr())}let o=zE(e,n),r=Hx(o),a=tu(r)?pP(r):o;return vP(aP(a)),e.getLatest()}function zE(e,t,n){let o=Ux(t,"next");for(let r=o;r;r=xP(r,n))o=r;return rm(o)&&Am(283),o.insert(e.isInline()?fr().append(e):e),Ux(Fa(e.getLatest(),"next"),t.direction)}function IU(e,t){let n=t();return e.replace(n),n.append(e),n}function SU(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function wU(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 TU(e){let t=Fe();if(!Ie(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=Oa(a,d=>qe(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 LU(e,t){Ri(e,"next").insert(t)}var cy=!(NE||!RE)&&void 0;function kU(e,t=!1){let n=1;if((function(){if(cy===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"),cy=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return cy})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function PU(e){return e._parentEditor!==null}function EU(e,t){return $E(e,t,null)}function $E(e,t,n){let o=!1;for(let r of fy(e))t(r)?n!==null&&n(r):(o=!0,qe(r)&&$E(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function AU(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(qe(r))for(let a of fy(r))o.push(a);return n}function MU(e){return HE(Ri(e,"next"))}function fy(e){return HE(Ri(e,"previous"))}function HE(e){return Yx({hasNext:fP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function RU(e){hP(Fa(e,"next")).splice(1,e.getChildren())}function NU(e){let t=o=>nm(o,e),n=(o,r)=>im(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=py,Joe=Ve.$descendantsMatching,Zoe=Ve.$dfs,ere=Ve.$dfsIterator,tre=Ve.$filter,nre=Ve.$findMatchingParent,ore=Ve.$firstToLastIterator,rre=Ve.$getAdjacentCaret,are=Ve.$getAdjacentSiblingOrParentSiblingCaret,ire=Ve.$getDepth,UE=Ve.$getNearestBlockElementAncestorOrThrow,sre=Ve.$getNearestNodeOfType,lre=Ve.$getNextRightPreorderNode,dre=Ve.$getNextSiblingOrParentSibling,KE=Ve.$handleIndentAndOutdent,cre=Ve.$insertFirst,ure=Ve.$insertNodeToNearestRoot,fre=Ve.$insertNodeToNearestRootAtCaret,pre=Ve.$isEditorIsNestedEditor,mre=Ve.$lastToFirstIterator,gre=Ve.$restoreEditorState,hre=Ve.$reverseDfs,vre=Ve.$reverseDfsIterator,xre=Ve.$splitNode,yre=Ve.$unwrapAndFilterDescendants,Cre=Ve.$unwrapNode,bre=Ve.$wrapNodeInElement,Ire=Ve.CAN_USE_BEFORE_INPUT,Sre=Ve.CAN_USE_DOM,wre=Ve.IS_ANDROID,Tre=Ve.IS_ANDROID_CHROME,Lre=Ve.IS_APPLE,kre=Ve.IS_APPLE_WEBKIT,Pre=Ve.IS_CHROME,Ere=Ve.IS_FIREFOX,Are=Ve.IS_IOS,Mre=Ve.IS_SAFARI,Rre=Ve.addClassNamesToElement,Nre=Ve.calculateZoomLevel,my=Ve.isBlockDomNode,_re=Ve.isHTMLAnchorElement,qE=Ve.isHTMLElement,Dre=Ve.isInlineDomNode,Ore=Ve.isMimeType,Fre=Ve.makeStateWrapper,Bre=Ve.markSelection,zre=Ve.mediaFileReader,za=Ve.mergeRegister,lu=Ve.objectKlassEquals,$re=Ve.positionNodeOnRange,Hre=Ve.registerNestedElementResolver,Ure=Ve.removeClassNamesFromElement,Kre=Ve.selectionAlwaysOnDisplay;var gy={};Mn(gy,{ContentEditable:()=>DU,ContentEditableElement:()=>GE});pe();var WE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function _U({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=$(E=>{E&&E.ownerDocument&&E.ownerDocument.defaultView?e.setRootElement(E):e.setRootElement(null)},[e]),A=H(()=>(function(...E){return N=>{for(let R of E)typeof R=="function"?R(N):R!=null&&(R.current=N)}})(S,T),[T,S]);return WE(()=>(I(e.isEditable()),e.registerEditableListener(E=>{I(E)})),[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:A,role:v,spellCheck:x,style:y,tabIndex:C,...k})}var GE=qn(_U);function VE(e){return e.getEditorState().read(Tm(e.isComposing()))}var DU=qn(OU);function OU(e,t){let{placeholder:n,...o}=e,[r]=Cn();return b(xe,{children:[u(GE,{editor:r,...o,ref:t}),n!=null&&u(FU,{editor:r,content:n})]})}function FU({content:e,editor:t}){let n=(function(i){let[s,l]=G(()=>VE(i));return WE(()=>{function d(){let c=VE(i);l(c)}return d(),za(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=G(t.isEditable());if(he(()=>(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 jE=gy,QE=jE.ContentEditable,Xre=jE.ContentEditableElement;pe();var BU=Ut(null),hy={didCatch:!1,error:null},Mm=class extends Ki{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=hy}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(hy))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&zU(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(hy))}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=Le(o,l);else if(r!==void 0)s=r;else throw i}return Le(BU.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function zU(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var vy={};Mn(vy,{LexicalErrorBoundary:()=>$U});function $U({children:e,onError:t}){return u(Mm,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var HU=vy,XE=HU.LexicalErrorBoundary;var Ry={};Mn(Ry,{$createHorizontalRuleNode:()=>My,$isDecoratorTextNode:()=>cA,$isHorizontalRuleNode:()=>hA,AutoFocusExtension:()=>qU,ClearEditorExtension:()=>VU,DecoratorTextExtension:()=>YU,DecoratorTextNode:()=>uu,EditorStateExtension:()=>Dm,HorizontalRuleExtension:()=>l3,HorizontalRuleNode:()=>Bs,INSERT_HORIZONTAL_RULE_COMMAND:()=>i3,InitialStateExtension:()=>mA,LexicalBuilder:()=>rd,NodeSelectionExtension:()=>ky,TabIndentationExtension:()=>d3,applyFormatFromStyle:()=>GU,applyFormatToDom:()=>jU,batch:()=>nA,buildEditorFromExtensions:()=>t3,computed:()=>aA,configExtension:()=>ym,declarePeerDependency:()=>eE,defineExtension:()=>Nn,effect:()=>_i,getExtensionDependencyFromEditor:()=>o3,getKnownTypesAndNodes:()=>WU,getPeerDependencyFromEditor:()=>gA,getPeerDependencyFromEditorOrThrow:()=>r3,namedSignals:()=>Fm,registerClearEditor:()=>lA,registerTabIndentation:()=>xA,safeCast:()=>Fr,shallowMergeConfig:()=>Sm,signal:()=>od,untracked:()=>Sy,watchedSignal:()=>Ey});var UU=Symbol.for("preact-signals");function Om(){if(Ni>1)return void Ni--;let e,t=!1;for(;cu!==void 0;){let n=cu;for(cu=void 0,wy++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&oA(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(wy=0,Ni--,t)throw e}function nA(e){if(Ni>0)return e();Ni++;try{return e()}finally{Om()}}var Mt,cu;function Sy(e){let t=Mt;Mt=void 0;try{return e()}finally{Mt=t}}var Ni=0,wy=0,_m=0;function YE(e){if(Mt===void 0)return;let t=e.n;return t===void 0||t.t!==Mt?(t={i:0,S:e,p:Mt.s,n:void 0,t:Mt,e:void 0,x:void 0,r:t},Mt.s!==void 0&&(Mt.s.n=t),Mt.s=t,e.n=t,32&Mt.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=Mt.s,t.n=void 0,Mt.s.n=t,Mt.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 od(e,t){return new Po(e,t)}function oA(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 JE(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 rA(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){Po.call(this,void 0),this.x=e,this.s=void 0,this.g=_m-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function aA(e,t){return new Fs(e,t)}function iA(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Ni++;let n=Mt;Mt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Py(e),o}finally{Mt=n,Om()}}}function Py(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,iA(e)}function KU(e){if(Mt!==this)throw new Error("Out-of-order effect");rA(this),Mt=e,this.f&=-2,8&this.f&&Py(this),Om()}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 _i(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 Fm(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}Po.prototype.brand=UU,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:Sy(()=>{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&&Sy(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Po.prototype.subscribe=function(e){return _i(()=>{let t=this.value,n=Mt;Mt=void 0;try{e(t)}finally{Mt=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=Mt;Mt=void 0;try{return this.value}finally{Mt=e}},Object.defineProperty(Po.prototype,"value",{get(){let e=YE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(wy>100)throw new Error("Cycle detected");this.v=e,this.i++,_m++,Ni++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Om()}}}}),Fs.prototype=new Po,Fs.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===_m))return!0;if(this.g=_m,this.f|=1,this.i>0&&!oA(this))return this.f&=-2,!0;let e=Mt;try{JE(this),Mt=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 Mt=e,rA(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)}Po.prototype.S.call(this,e)},Fs.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)}},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=YE(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,iA(this),JE(this),Ni++;let e=Mt;return Mt=this,KU.bind(this,e)},nd.prototype.N=function(){2&this.f||(this.f|=2,this.o=cu,cu=this)},nd.prototype.d=function(){this.f|=8,1&this.f||Py(this)},nd.prototype.dispose=function(){this.d()};var qU=Nn({build:(e,t,n)=>Fm(t),config:Fr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return _i(()=>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 sA(){let e=Ct(),t=Fe(),n=fr();e.clear(),e.append(n),t!==null&&n.select(),Ie(t)&&(t.format=0)}function lA(e,t=sA){return e.registerCommand(sm,n=>(e.update(t),!0),Zt)}var VU=Nn({build:(e,t,n)=>Fm(t),config:Fr({$onClear:sA}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return _i(()=>lA(e,o.value))}});function WU(e){let t=new Set,n=new Set;for(let o of dA(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function dA(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var xy=ZP("format",{parse:e=>typeof e=="number"?e:0}),uu=class extends Ba{$config(){return this.config("decorator-text",{extends:Ba,stateConfigs:[{flat:!0,stateConfig:xy}]})}getFormat(){return nm(this,xy)}getFormatFlags(t,n){return Jx(this.getFormat(),t,n)}hasFormat(t){let n=QP[t];return(this.getFormat()&n)!==0}setFormat(t){return im(this,xy,t)}toggleFormat(t){let n=this.getFormat(),o=Jx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function cA(e){return e instanceof uu}function GU(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 jU(e,t,n=XU){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=QU(t,o));return t}function QU(e,t){let n=document.createElement(t);return n.appendChild(e),n}var XU={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},YU=Nn({name:"@lexical/extension/DecoratorText",nodes:()=>[uu],register:(e,t,n)=>e.registerCommand(RP,o=>{let r=Fe();if(qx(r)||Ie(r))for(let a of r.getNodes())cA(a)&&a.toggleFormat(o);return!1},ed)});function Ey(e,t){let n;return od(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Dm=Nn({build:e=>Ey(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Dt(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 uA(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]=uA(n[r],o[r]);return e}return t}var Ay=0,Ty=1,fA=2,yy=3,Rm=4,td=5,Cy=6,du=7;function by(e){return e.id===Ay}function pA(e){return e.id===fA}function JU(e){return(function(t){return t.id===Ty})(e)||Dt(305,String(e.id),String(Ty)),Object.assign(e,{id:fA})}var ZU=new Set,Ly=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Ay}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Sm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;pA(n)||Dt(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:yy,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:Rm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Rm&&Dt(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&&Dt(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:Cy})})(o),()=>{let a=this.state;a.id!==du&&Dt(309,String(o.id),String(du)),this.state=(function(i){return Object.assign(i,{id:td})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Cy&&Dt(310,String(n.id),String(Cy)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:du})})(n),o}getSignal(){return this._signal===void 0&&Dt(311),this._signal}getInitResult(){this.extension.init===void 0&&Dt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Rm})(t)||Dt(313,String(t.id),String(Rm)),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>=yy})(t)||Dt(314,String(t.id),String(yy)),{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&&Dt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Dt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=du})(t)||Dt(316,String(t.id),String(du)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||ZU}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)||Dt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},ZE={tag:Or};function e3(){let e=Ct();e.isEmpty()&&e.append(fr())}var mA=Nn({config:Fr({setOptions:ZE,updateOptions:ZE}),init:({$initialEditorState:e=e3})=>({$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(lP(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:[WP,xm,$P,XP,KP]}),eA=Symbol.for("@lexical/extension/LexicalBuilder");function t3(...e){return rd.fromExtensions(e).buildEditor()}function tA(){}function n3(e){throw e}function Nm(e){return Array.isArray(e)?e:[e]}var Iy="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=Iy,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Nm(mA)];for(let o of t)n.push(Nm(o));return new e(n)}static maybeFromEditor(t){let n=t[eA];return n&&(n.PACKAGE_VERSION!==Iy&&Dt(292,n.PACKAGE_VERSION,Iy),n instanceof e||Dt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Dt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Cm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[eA]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=tA;function n(){try{t()}finally{t=tA}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ia(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&&Dt(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&&Dt(296);let n=Nm(t),[o]=n;typeof o.name!="string"&&Dt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Dt(298,o.name),!r){r=new Ly(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Dt(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Dt(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Nm(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(pA(a))return;let i=o.extension.name;var s;by(a)||Dt(300,i,r||"[unknown]"),by(s=a)||Dt(304,String(s.id),String(Ay)),a=Object.assign(s,{id:Ty}),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=JU(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())by(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&&Dt(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 ia(...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 dA(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Dt(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&&uA(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=n3),t}};function o3(e,t){let n=rd.fromEditor(e).getExtensionRep(t);return n===void 0&&Dt(303,t.name),n.getExtensionDependency()}function gA(e,t){let n=rd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function r3(e,t){let n=gA(e,t);return n===void 0&&Dt(291,t),n}var a3=new Set,ky=Nn({build(e,t,n){let o=n.getDependency(Dm).output,r=od({watchedNodeKeys:new Map}),a=Ey(()=>{},()=>_i(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(Fe())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=tm(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=aA(()=>(a.value||a3).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:[Dm],name:"@lexical/extension/NodeSelection"}),i3=JP("INSERT_HORIZONTAL_RULE_COMMAND"),Bs=class e extends Ba{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return My().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:s3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return iu(n,t.theme.hr),n}getTextContent(){return`
3707
+ `}isInline(){return!1}updateDOM(){return!1}};function s3(){return{node:My()}}function My(){return Jk(Bs)}function hA(e){return e instanceof Bs}var l3=Nn({dependencies:[Dm,ky],name:"@lexical/extension/HorizontalRule",nodes:()=>[Bs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(ky).output,r=od({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ia(e.registerCommand(IP,i=>{if(aE(i.target)){let s=iP(i.target);if(hA(s))return(function(l,d=!1){let c=Fe(),f=l.isSelected(),p=l.getKey(),m;d&&qx(c)?m=c:(m=Zk(),_r(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},ed),e.registerMutationListener(Bs,(i,s)=>{nA(()=>{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})})}),_i(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(_i(()=>{let d=s.value;d&&(l.value?iu(d,a):Im(d,a))}));return ia(...i)}))}});function vA(e){return e.canBeEmpty()}function xA(e,t,n=vA){return ia(e.registerCommand(hm,o=>{let r=Fe();if(!Ie(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=UE(c);if(f.canIndent()){let p=f.getKey(),m=Ns();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=mP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?HP:Gx:DP;return e.dispatchCommand(a,void 0)},Zt),e.registerCommand(Gx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Fe();if(!Ie(r))return!1;let a=typeof n=="function"?n:n.peek();return KE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},lm))}var d3=Nn({build:(e,t,n)=>Fm(t),config:Fr({$canIndent:vA,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return _i(()=>{if(!o.value)return xA(e,r,a)})}});var gt=Ry,iae=gt.$createHorizontalRuleNode,sae=gt.$isDecoratorTextNode,lae=gt.$isHorizontalRuleNode,dae=gt.AutoFocusExtension,cae=gt.ClearEditorExtension,uae=gt.DecoratorTextExtension,fae=gt.DecoratorTextNode,pae=gt.EditorStateExtension,mae=gt.HorizontalRuleExtension,gae=gt.HorizontalRuleNode,hae=gt.INSERT_HORIZONTAL_RULE_COMMAND,vae=gt.InitialStateExtension,yA=gt.LexicalBuilder,xae=gt.NodeSelectionExtension,yae=gt.TabIndentationExtension,Cae=gt.applyFormatFromStyle,bae=gt.applyFormatToDom,CA=gt.batch,Iae=gt.buildEditorFromExtensions,Sae=gt.computed,wae=gt.configExtension,Tae=gt.declarePeerDependency,Lae=gt.defineExtension,fu=gt.effect,kae=gt.getExtensionDependencyFromEditor,Pae=gt.getKnownTypesAndNodes,bA=gt.getPeerDependencyFromEditor,Eae=gt.getPeerDependencyFromEditorOrThrow,Bm=gt.namedSignals,Aae=gt.registerClearEditor,Mae=gt.registerTabIndentation,Rae=gt.safeCast,Nae=gt.shallowMergeConfig,_ae=gt.signal,Dae=gt.untracked,Oae=gt.watchedSignal;var Ny={};Mn(Ny,{HistoryExtension:()=>zm,SharedHistoryExtension:()=>f3,createEmptyHistoryState:()=>wA,registerHistory:()=>SA});function c3(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(!(Ie(a)&&Ie(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||nu(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)&&ot(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!ot(d)||!ot(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 u3(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(wP)&&(r=n,a=o,i=s),p.has(um))return o=0,n=m,2;p.has(SP)&&i&&(n=r,o=a,s=i);let h=c3(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(NP);if(!x&&v&&p.has(Or))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,A=S._selection;return!(Ie(T)&&Ie(A)&&T.anchor.type==="element"&&T.focus.type==="element"&&A.anchor.type==="text"&&A.focus.type==="text"||!ot(L)||!ot(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 IA(e){e.undoStack=[],e.redoStack=[],e.current=null}function SA(e,t,n){let o=u3(e,n);return za(e.registerCommand(YP,()=>((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(ou,!0)),l.length===0&&a.dispatchCommand(ru,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:um})}})(e,t),!0),Zt),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(ru,!0));let c=s.pop();s.length===0&&a.dispatchCommand(ou,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:um})}})(e,t),!0),Zt),e.registerCommand(sm,()=>(IA(t),!1),Zt),e.registerCommand(bP,()=>(IA(t),e.dispatchCommand(ou,!1),e.dispatchCommand(ru,!1),!0),Zt),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(ou,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(ru,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function wA(){return{current:null,redoStack:[],undoStack:[]}}var zm=Nn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Bm({delay:t,disabled:o,historyState:n(e)}),config:Fr({createInitialHistoryState:wA,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return fu(()=>o.disabled.value?void 0:SA(e,o.historyState.value,o.delay))}}),f3=Nn({dependencies:[ym(zm,{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(zm),r=(function(i){return i?bA(i,zm.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return fu(()=>CA(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var $m=Ny,Hae=$m.HistoryExtension,Uae=$m.SharedHistoryExtension,Hm=$m.createEmptyHistoryState,TA=$m.registerHistory;var _y={};Mn(_y,{HistoryPlugin:()=>p3,createEmptyHistoryState:()=>Hm});pe();function p3({delay:e,externalHistoryState:t}){let[n]=Cn();return(function(o,r,a=1e3){let i=H(()=>r||Hm(),[r]);q(()=>TA(o,i,a),[a,o,i])})(n,t,e),null}var LA=_y,kA=LA.HistoryPlugin,PA=LA.createEmptyHistoryState;var Dy={};Mn(Dy,{OnChangePlugin:()=>g3});pe();var m3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function g3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Cn();return m3(()=>{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(Or)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var h3=Dy,EA=h3.OnChangePlugin;var Oy={};Mn(Oy,{useLexicalEditable:()=>y3});pe();var v3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function x3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function y3(){return(function(e){let[t]=Cn(),n=H(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=_(o);return v3(()=>{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})(x3)}var C3=Oy,AA=C3.useLexicalEditable;var Fy={};Mn(Fy,{ReactProviderExtension:()=>b3});var b3=Nn({name:"@lexical/react/ReactProvider"});var I3=Fy,MA=I3.ReactProviderExtension;var By={};Mn(By,{DragonExtension:()=>S3,registerDragonSupport:()=>RA});function RA(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=Fe();if(Ie(h)){let g=h.anchor,v=g.getNode(),x=0,y=0;if(ot(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()),ot(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 S3=Nn({build:(e,t,n)=>Bm(t),config:Fr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>fu(()=>n.getOutput().disabled.value?void 0:RA(e))});var NA=By,_A=NA.DragonExtension,DA=NA.registerDragonSupport;var zy={};Mn(zy,{$generateHtmlFromNodes:()=>T3,$generateNodesFromDOM:()=>w3});function w3(e,t){let n=rE(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!FA.has(a.nodeName)){let i=BA(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof Wx&&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 T3(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++)OA(e,o[r],n,t);return n.innerHTML}function OA(e,t,n,o=null){let r=o===null||t.isSelected(o),a=qe(t)&&t.excludeFromCopy("html"),i=t;o!==null&&ot(t)&&(i=Em(o,t,"clone"));let s=qe(i)?i.getChildren():[],l=nE(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=OA(e,h,p,o);!r&&qe(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((qE(c)||Xx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(Xx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var FA=new Set(["STYLE","SCRIPT"]);function BA(e,t,n,o,r=new Map,a){let i=[];if(FA.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(...BA(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),my(e)&&(p=L3(e,p,m?()=>{let h=new Wx;return n.push(h),h}:fr)),s==null?p.length>0?i=i.concat(p):my(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:su(h.nextSibling)&&su(h.previousSibling)})(e)&&(i=i.concat(Rs())):qe(s)&&s.append(...p),i}function L3(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 zA=zy,$A=zA.$generateHtmlFromNodes,HA=zA.$generateNodesFromDOM;var Hy={};Mn(Hy,{$generateJSONFromSelectedNodes:()=>WA,$generateNodesFromSerializedNodes:()=>GA,$getClipboardDataFromSelection:()=>QA,$getHtmlContent:()=>KA,$getLexicalContent:()=>qA,$insertDataTransferForPlainText:()=>k3,$insertDataTransferForRichText:()=>P3,$insertGeneratedNodes:()=>$y,copyToClipboard:()=>E3,setLexicalClipboardDataTransfer:()=>XA});function Um(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 KA(e,t=Fe()){return t==null&&Um(166),Ie(t)&&t.isCollapsed()||t.getNodes().length===0?"":$A(e,t)}function qA(e,t=Fe()){return t==null&&Um(166),Ie(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(WA(e,t))}function k3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function P3(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 $y(n,GA(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 $y(n,HA(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Ie(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=Fe();if(Ie(d)){let c=s[l];c===`
3708
3708
  `||c===`\r
3709
- `?d.insertParagraph():c===" "?d.insertNodes([yk()]):d.insertText(c)}}}else t.insertRawText(i)}function uy(e,t,n){e.dispatchCommand(uP,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Ie(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=Rl(r,"previous");if(i)if(Bp(i))a=i.origin;else{let s=bk(i,gi(yt(),"next").getFlipped());for(let l of s){if(nt(l.origin)){a=l.origin;break}if(He(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 lE(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=He(n)&&n.excludeFromCopy("html"),i=n;t!==null&&nt(i)&&(i=dm(t,i,"clone"));let s=He(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Im(58,f.name),He(d)){let p=c.children;Array.isArray(p)||Im(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=lE(e,t,c,l.children);!r&&He(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 dE(e,t){let n=[],o=yt().getChildren();for(let r=0;r<o.length;r++)lE(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function cE(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=Nk(o);nt(r)&&UP(r),t.push(r)}return t}var $l=null;async function OU(e,t,n){if($l!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(aE(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=Cx(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(Kp,p=>(Hc(p,ClipboardEvent)&&(f(),$l!==null&&(r.clearTimeout($l),$l=null),d(aE(e,p,n))),!0),Up);$l=r.setTimeout(()=>{f(),$l=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function aE(e,t,n){if(n===void 0){let r=Cx(e._window),a=De();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!TP(e,i,s))return!1;n=fE(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(pE(o,n),!0)}var uE=[["text/html",iE],["application/x-lexical-editor",sE]];function fE(e=De()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=_p();for(let[o,r]of uE){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function pE(e,t){for(let[n]of uE)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var Zr=fy,dae=Zr.$generateJSONFromSelectedNodes,cae=Zr.$generateNodesFromSerializedNodes,uae=Zr.$getClipboardDataFromSelection,mE=Zr.$getHtmlContent,fae=Zr.$getLexicalContent,py=Zr.$insertDataTransferForPlainText,pae=Zr.$insertDataTransferForRichText,mae=Zr.$insertGeneratedNodes,gae=Zr.copyToClipboard,hae=Zr.setLexicalClipboardDataTransfer;var my={};wn(my,{PlainTextExtension:()=>KU,registerPlainText:()=>vE});var Is=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,FU=Is&&"documentMode"in document?document.documentMode:null,BU=Is&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),zU=!(!Is||!("InputEvent"in window)||FU)&&"getTargetRanges"in new window.InputEvent("input"),$U=Is&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),gE=Is&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,HU=Is&&/^(?=.*Chrome).*/i.test(navigator.userAgent),UU=Is&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&BU&&!HU;function hE(e,t){t.update(()=>{if(e!==null){let n=Hc(e,KeyboardEvent)?null:e.clipboardData,o=De();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=mE(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function vE(e){return ka(e.registerCommand(Vp,t=>{let n=De();return!!Ie(n)&&(n.deleteCharacter(t),!0)},Wt),e.registerCommand(Wk,t=>{let n=De();return!!Ie(n)&&(n.deleteWord(t),!0)},Wt),e.registerCommand(qk,t=>{let n=De();return!!Ie(n)&&(n.deleteLine(t),!0)},Wt),e.registerCommand(Kk,t=>{let n=De();if(!Ie(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)py(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Wt),e.registerCommand(dP,()=>{let t=De();return!!Ie(t)&&(t.removeText(),!0)},Wt),e.registerCommand(yx,t=>{let n=De();return!!Ie(n)&&(n.insertLineBreak(t),!0)},Wt),e.registerCommand(Jk,()=>{let t=De();return!!Ie(t)&&(t.insertLineBreak(),!0)},Wt),e.registerCommand(Wp,t=>{let n=De();if(!Ie(n))return!1;let o=t,r=o.shiftKey;return!!_x(n,!0)&&(o.preventDefault(),Nx(n,r,!0),!0)},Wt),e.registerCommand(Gp,t=>{let n=De();if(!Ie(n))return!1;let o=t,r=o.shiftKey;return!!_x(n,!1)&&(o.preventDefault(),Nx(n,r,!1),!0)},Wt),e.registerCommand(jp,t=>{let n=De();return!!Ie(n)&&(!gE||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Vp,!0))},Wt),e.registerCommand(nP,t=>{let n=De();return!!Ie(n)&&(t.preventDefault(),e.dispatchCommand(Vp,!1))},Wt),e.registerCommand(Qp,t=>{let n=De();if(!Ie(n))return!1;if(t!==null){if((gE||$U||UU)&&zU)return!1;t.preventDefault()}return e.dispatchCommand(yx,!1)},Wt),e.registerCommand(fP,()=>(zp(),!0),Wt),e.registerCommand(Kp,t=>{let n=De();return!!Ie(n)&&(hE(t,e),!0)},Wt),e.registerCommand(Vk,t=>{let n=De();return!!Ie(n)&&((function(o,r){hE(o,r),r.update(()=>{let a=De();Ie(a)&&a.removeText()})})(t,e),!0)},Wt),e.registerCommand(Yp,t=>{let n=De();return!!Ie(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=De(),i=Hc(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Ie(a)&&py(i,a)},{tag:iP})})(t,e),!0)},Wt),e.registerCommand(jk,t=>{let n=De();return!!Ie(n)&&(t.preventDefault(),!0)},Wt),e.registerCommand(Gk,t=>{let n=De();return!!Ie(n)&&(t.preventDefault(),!0)},Wt))}var KU=Tn({conflictsWith:["@lexical/rich-text"],dependencies:[YA],name:"@lexical/plain-text",register:vE});var xE=my,Sae=xE.PlainTextExtension,yE=xE.registerPlainText;var hy={};wn(hy,{PlainTextPlugin:()=>GU});ue();var Sm=ad(Gd(),1);function VU(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?Me:V;function qU({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=K(()=>n.getDecorators());return gy(()=>n.registerDecoratorListener(i=>{(0,Sm.flushSync)(()=>{a(i)})}),[n]),V(()=>{a(n.getDecorators())},[n]),$(()=>{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(Dg,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,Sm.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function WU({editor:e,ErrorBoundary:t}){return(function(n){let o=FA.maybeFromEditor(n);if(o&&o.hasExtensionByName(jA.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&VU(320,r);return!0}return!1})(e)?null:u(qU,{editor:e,ErrorBoundary:t})}function CE(e){return e.getEditorState().read(am(e.isComposing()))}function GU({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=xn();return(function(r){gy(()=>ka(yE(r),JA(r)),[r])})(o),I(pe,{children:[e,u(jU,{content:t}),u(WU,{editor:o,ErrorBoundary:n})]})}function jU({content:e}){let[t]=xn(),n=(function(r){let[a,i]=K(()=>CE(r));return gy(()=>{function s(){let l=CE(r);i(l)}return s(),ka(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=GA();return n?typeof e=="function"?e(o):e:null}var QU=hy,bE=QU.PlainTextPlugin;ue();function IE(e){return/mac|iphone|ipad|ipod/i.test(e)}function Wc(){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 Gc(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function SE(e){let t=Gc(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}ue();var wm=de(function(t){let n=Mt().pierreIcons,o=n.useSpriteReady();sd(n.ensureSprite,[n]);let r=$(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:z("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(Va,{className:z("size-4 shrink-0 text-icon-muted",t.className)}):u(xd,{className:z("size-4 shrink-0 text-icon-muted",t.className)})});var wE=ni;function TE(e){return I(pe,{children:[u(wm,{pathValue:e.path,kind:SE(e.path),theme:e.theme,className:qr}),u("span",{className:e.selectable?Mw:Wr,children:e.label})]})}function LE(e){let{label:t,tooltipText:n,expired:o=!1}=e;return I(je,{children:[u(Xe,{render:I("span",{className:z(ni,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(ua,{className:z(qr,"size-icon-1",o&&"opacity-100")}),u("span",{className:Wr,children:t})]})}),u(Qe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function kE({context:e}){let{t}=_e(),n=iw(e),o=aw(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(LE,{label:n,tooltipText:r,expired:o})}function XU(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 YU(e){return e.replaceAll("\\","/")}function ea(e){let t=e.displayName?.trim();return t||XU(e.name)}function PE(e,t){return t?e.filter(n=>n.enabled):[]}function AE(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function EE(e){let t=YU(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 ME(e,t){return e.registerCommand(Yp,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=rc(`${o}
3710
- `).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=De();if(!Ie(a))return!1;let i=[],s=c=>{let f=c.split(`
3711
- `);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(Cr(m)),p<f.length-1&&i.push(gs())}},l=r[0];if(l&&l.start===0){let c=a.isBackward()?a.focus:a.anchor,f=t.getExpandedAbsoluteOffsetForPoint(c.getNode(),c.offset),p=yt().getTextContent().slice(f-1,f);p.length>0&&!/\s/.test(p)&&i.push(Cr(" "))}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(Cr(" ")),a.insertNodes(i),n.preventDefault(),!0},Ir)}var JU=`composer-editor-${Math.random().toString(36).slice(2)}`,ZU=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],OE=new Map(ZU),RE=OE.get("`")??null,FE=Ot({onRemoveTerminalContext:()=>{}});function eK(e){let t=rK(),n=u("span",{className:wE,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(TE,{path:e.path,label:Gc(e.path),theme:t})});return I(je,{children:[u(Xe,{render:n}),u(Qe,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var jc=class e extends La{__path;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__key)}static importJSON(t){return Cy(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=Vf,t}updateDOM(){return!1}getTextContent(){return oc(this.__path)}isInline(){return!0}decorate(){return u(eK,{path:this.__path})}};function Cy(e){return Rp(new jc(e))}function tK(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Qc(e){return new Map(e.map(t=>[t.name,{label:ea(t),description:tK(t)}]))}function nK(e){let t=I("span",{className:Rw,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:qr,dangerouslySetInnerHTML:{__html:Nw}}),u("span",{className:Wr,children:e.skillLabel})]});return e.skillDescription?I(je,{children:[u(Xe,{render:t}),u(Qe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var Xc=class e extends La{__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 BE(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=Vf,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(nK,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function BE(e,t,n){return Rp(new Xc(e,t,n))}function oK(e){return u(kE,{context:e.context})}var Ss=class e extends La{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return zE(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=Vf,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(oK,{context:this.__context})}};function zE(e){return Rp(new Ss(e))}function xi(e){return e instanceof jc||e instanceof Xc||e instanceof Ss}function rK(){return document.documentElement.classList.contains("dark")?"dark":"light"}function aK(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function iK(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function Tm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Lm(e){return 1}function $E(e){return e.getTextContentSize()}function sK(e,t,n){return t+(n>0?Lm(e):0)}function lK(e,t,n){return t+(n>0?$E(e):0)}function dK(e,t){let n=e.getParent();if(!n||!He(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===Lm(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=Lm(e),null)}function km(e){return xi(e)?Lm(e):nt(e)?e.getTextContentSize():_l(e)?1:He(e)?e.getChildren().reduce((t,n)=>t+km(n),0):0}function xy(e){return xi(e)?$E(e):nt(e)?e.getTextContentSize():_l(e)?1:He(e)?e.getChildren().reduce((t,n)=>t+xy(n),0):0}function by(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!He(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=km(l))}o=r}if(nt(e))return n+Math.min(t,e.getTextContentSize());if(xi(e))return sK(e,n,t);if(_l(e))return n+Math.min(t,1);if(He(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+=km(s))}return n}return n}function Pm(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!He(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(xi(e))return lK(e,n,t);if(_l(e))return n+Math.min(t,1);if(He(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 Am(e,t){if(xi(e))return dK(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(_l(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(He(e)){let n=e.getChildren();for(let o of n){let r=Am(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function Em(){return yt().getChildren().reduce((n,o)=>n+km(o),0)}function ws(e){let t=yt(),n=Em(),r={value:Math.max(0,Math.min(e,n))},a=Am(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=hs();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),br(i)}function vy(e,t){let n=yt(),o=Em(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=Am(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=Am(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=hs();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),br(c)}function NE(e){if(!Ie(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Pm(t,e.anchor.offset),r=Pm(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function _E(e){return Ie(e)?e.getNodes().some(t=>xi(t)):!1}function Yc(e){let t=De();if(!Ie(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=by(n,t.anchor.offset),r=Em();return Math.max(0,Math.min(o,r))}function DE(e){let t=De();if(!Ie(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Pm(n,t.anchor.offset),r=yt().getTextContent().length;return Math.max(0,Math.min(o,r))}function cK(e,t){let n=t.split(`
3712
- `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Cr(r)),o<n.length-1&&e.append(gs())}}function Iy(e,t,n){let o=yt();o.clear();let r=Zo();o.append(r);let a=os(e,t);for(let i of a){if(i.type==="mention"){r.append(Cy(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(BE(i.name,s?.label??ea({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(zE(i.context));continue}cK(r,i.text)}}function yy(e){return e instanceof Ss?[e.__context.id]:He(e)?e.getChildren().flatMap(t=>yy(t)):[]}function uK(e){let[t]=xn();return V(()=>{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(eP,s=>n("ArrowDown",s),Ir),r=t.registerCommand(tP,s=>n("ArrowUp",s),Ir),a=t.registerCommand(Qp,s=>n("Enter",s),Ir),i=t.registerCommand(Xp,s=>n("Tab",s),Ir);return()=>{o(),r(),a(),i()}},[t,e]),null}function fK(){let[e]=xn();return V(()=>{let t=e.registerCommand(Wp,o=>{let r=null;if(e.getEditorState().read(()=>{let i=De();if(!Ie(i)||!i.isCollapsed())return;let s=Yc(0);if(s<=0)return;let l=yt().getTextContent();ac(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{ws(a)}),!0},Ir),n=e.registerCommand(Gp,o=>{let r=null;if(e.getEditorState().read(()=>{let i=De();if(!Ie(i)||!i.isCollapsed())return;let s=Yc(0),l=Em();if(s>=l)return;let d=yt().getTextContent();ac(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{ws(a)}),!0},Ir);return()=>{t(),n()}},[e]),null}function pK(){let[e]=xn();return V(()=>e.registerCommand(oP,t=>{if(!IE(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(()=>{br(xk(o,e))}),!0)},Ir),[e]),null}function mK(){let[e]=xn();return V(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=De();if(!Ie(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!xi(r)||o.anchor.offset===0)return;n=by(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{ws(n)})})}),[e]),null}function gK(){let[e]=xn(),{onRemoveTerminalContext:t}=Ft(FE);return V(()=>e.registerCommand(jp,n=>{let o=De();if(!Ie(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=Yc(0),i=s=>{if(!xi(s))return!1;let l=by(s,0);return s.remove(),s instanceof Ss?(t(s.__context.id),ws(a)):ws(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(He(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(He(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},Ir),[e,t]),null}function hK(){let[e]=xn();return V(()=>{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(Ie(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof La&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(Qk,()=>(n=!0,o(r()),!1),Dl),s=e.registerCommand(Bk,()=>(n=!1,o(new Set),!1),Dl);return()=>{a(),i(),s()}},[e]),null}function vK(){let[e]=xn();return V(()=>ME(e,{createMentionNode:Cy,getExpandedAbsoluteOffsetForPoint:Pm}),[e]),null}function xK(e){let[t]=xn(),n=_(e.terminalContexts),o=_(Qc(e.skills)),r=_(null),a=_(null);V(()=>{n.current=e.terminalContexts},[e.terminalContexts]),V(()=>{o.current=Qc(e.skills)},[e.skills]);let i=Fg(s=>{let l=OE.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(!Ie(g)||g.isCollapsed()||_E(g))return null;let v=NE(g);if(!v||v.start===v.end)return null;let x=yt().getTextContent();return Eh(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)}`;Iy(m,n.current,o.current);let h=Mo(m,f.expandedStart);vy(h+s.length,h+s.length+p.length),c=!0,r.current=null}),c});return V(()=>{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(!Ie(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(_E(g)){r.current=null,a.current=null;return}let v=NE(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=yt().getTextContent();if(Eh(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==="`"&&RE!==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=yt().getTextContent(),x=RE;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=Mo(v,g.expandedStart);vy(w,w+1);let k=De();if(!Ie(k)){r.current=null,a.current=null;return}k.insertText(`\`${C}${x}`),vy(w+1,w+1+C.length),r.current=null,a.current=null},{tag:Xr})})},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 yK({value:e,cursor:t,terminalContexts:n,skills:o,disabled:r,placeholder:a,className:i,onRemoveTerminalContext:s,onChange:l,onCommandKeyDown:d,onPaste:c,editorRef:f}){let[p]=xn(),m=_(l),h=ur(e,t),g=aK(n),v=_(g),x=iK(o),y=_(x),C=_(Qc(o)),w=_({value:e,cursor:h,expandedCursor:Vr(e,h),terminalContextIds:n.map(A=>A.id)}),k=_(!1),T=$(()=>({onRemoveTerminalContext:s}),[s]);V(()=>{m.current=l},[l]),Me(()=>{C.current=Qc(o)},[o]),V(()=>{p.setEditable(!r)},[r,p]),Me(()=>{let A=ur(e,t),E=w.current,B=v.current!==g,R=y.current!==x;if(E.value===e&&E.cursor===A&&!B&&!R)return;w.current={value:e,cursor:A,expandedCursor:Vr(e,A),terminalContextIds:n.map(D=>D.id)},v.current=g,y.current=x;let N=p.getRootElement(),H=!!(N&&document.activeElement===N);E.value===e&&!B&&!R&&!H||(k.current=!0,p.update(()=>{let D=E.value!==e||B||R;D&&Iy(e,n,C.current),(D||H)&&ws(A)}),queueMicrotask(()=>{k.current=!1}))},[t,p,x,n,g,e]);let L=U(A=>{let E=p.getRootElement();if(!E)return;let B=ur(w.current.value,A);E.focus({preventScroll:!0}),p.update(()=>{ws(B)}),w.current={value:w.current.value,cursor:B,expandedCursor:Vr(w.current.value,B),terminalContextIds:w.current.terminalContextIds},m.current(w.current.value,B,w.current.expandedCursor,!1,w.current.terminalContextIds)},[p]),b=U(()=>{let A=w.current;return p.getEditorState().read(()=>{let E=yt().getTextContent(),B=ur(E,w.current.cursor),R=ur(E,Yc(B)),N=Tm(E,w.current.expandedCursor),H=Tm(E,DE(N)),D=yy(yt());A={value:E,cursor:R,expandedCursor:H,terminalContextIds:D}}),w.current=A,A},[p]);Br(f,()=>({focus:()=>{L(w.current.cursor)},focusAt:L,focusAtEnd:()=>{L(Mo(w.current.value,w.current.value.length))},readSnapshot:b}),[L,b]);let S=U(A=>{A.read(()=>{let E=yt().getTextContent(),B=ur(E,w.current.cursor),R=ur(E,Yc(B)),N=Tm(E,w.current.expandedCursor),H=Tm(E,DE(N)),D=yy(yt()),W=w.current;if(W.value===E&&W.cursor===R&&W.expandedCursor===H&&W.terminalContextIds.length===D.length&&W.terminalContextIds.every((ie,Q)=>ie===D[Q])||k.current)return;w.current={value:E,cursor:R,expandedCursor:H,terminalContextIds:D};let xe=ac(E,R,"left")||ac(E,R,"right");m.current(E,R,H,xe,D)})},[]);return u(FE,{value:T,children:I("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(bE,{contentEditable:u(pA,{className:z("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",i),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":a,placeholder:u("span",{}),onPaste:c}),placeholder:n.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:a}),ErrorBoundary:mA}),u(WA,{onChange:S}),u(uK,{...d?{onCommandKeyDown:d}:{}}),u(xK,{terminalContexts:n,skills:o}),u(pK,{}),u(fK,{}),u(mK,{}),u(gK,{}),u(vK,{}),u(hK,{}),u(qA,{})]})})}function HE({value:e,cursor:t,terminalContexts:n,skills:o,disabled:r,placeholder:a,className:i,onRemoveTerminalContext:s,onChange:l,onCommandKeyDown:d,onPaste:c,editorRef:f}){let p=_(e),m=_(n),h=_(Qc(o)),g=$(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[jc,Xc,Ss],editorState:()=>{Iy(p.current,m.current,h.current)},onError:v=>{throw v}}),[]);return u(kP,{initialConfig:g,children:u(yK,{value:e,cursor:t,terminalContexts:n,skills:o,disabled:r,placeholder:a,onRemoveTerminalContext:s,onChange:l,onPaste:c,editorRef:f,...d?{onCommandKeyDown:d}:{},...i?{className:i}:{}})},JU)}ue();ue();ue();var Hy=ad(qE(),1),kM=ad(Gd(),1),PM=ad(Gd(),1);zn(function(t,n){return Ce("div",{ref:n,...t})});var $m=zn(function(t,n){return Ce("div",{ref:n,...t})}),er=$m,Ma={OS:"web"};function Ts(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function Uy(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 AM(){return"normal"}function AK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:AM()}function EK(e){var t;return(t=e?.rtl)!=null?t:!1}function Na(e){return Ky(e?.props)}function Ky(e){return!!e?.horizontal&&EK(e)}function Vy(e){return e?.horizontal?(Ky(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function MK(e,t){var n;return(n=Uy(e,t))!=null?n:0}function WE(e,t){return t&&(Na(e)?t.left:t.right)||0}function RK(e,t,n,o){return!Na(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function qy(e,t,n){if(!e||!Na(e))return t;let o=Uy(e,n),r=Ts(t,o),a=AK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Ts(o-r,o):r}function NK(e,t,n){if(!Na(e))return e.horizontalRTLScrollType=void 0,t;let o=Uy(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Ts(-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 Ts(a,o);if(i==="normal")return Ts(r,o);if(!e.hasScrolled){let f=AM();return e.horizontalRTLScrollType=f,Ts(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Ts(c?a:r,o)}var _K=e=>e,Hm=Ot(null),EM="\0",DK=0;function OK({children:e}){let[t]=K(()=>({animatedScrollY:_K(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:DK++,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 Ce(Hm.Provider,{value:t},e)}function Lr(){return sn(Hm)}function MM(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=re(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(Aa(e,i,r));return()=>{for(let i of a)i()}}}}function FK(e){return e.length===1?e[0]:e.join(EM)}function BK(e){return e.split(EM)}function Aa(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 re(e,t){let{values:n}=e;return n.get(t)}function Le(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 zK(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 $K(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Do(e){let t=sn(Hm),n=FK(e),{subscribe:o,get:r}=$(()=>MM(t,BK(n)),[t,n]);return(0,Hy.useSyncExternalStore)(o,r,r)}function HK(e,t){let n=sn(Hm),{subscribe:o,get:r}=$(()=>MM(n,[e]),[n,e]),a=U(()=>t(r()[0]),[r,t]);return(0,Hy.useSyncExternalStore)(o,a,a)}function UK(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?WE(o,s):s?.bottom)||0,d=UK(t??r.contentInsetEndAdjustment),c=re(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?WE(o,h):h.bottom)||0)+d,f)}return Math.max(m,f)}function eo(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 Ul=({children:e})=>Ce($m,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);de(function(){let t=Lr(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Do(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=eo(t),[,c]=Pi(f=>f+1,0);return KK(()=>{c()},100),Ce($m,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Ce(Ul,null,Ce(er,null,"TotalSize:"),Ce(er,null,n.toFixed(2))),Ce(Ul,null,Ce(er,null,"ContentSize:"),Ce(er,null,d.toFixed(2))),Ce(Ul,null,Ce(er,null,"At end:"),Ce(er,null,String(l))),Ce(Ul,null,Ce(er,null,"ScrollAdjust:"),Ce(er,null,o.toFixed(2))),Ce(Ul,null,Ce(er,null,"RawScroll: "),Ce(er,null,r.toFixed(2))),Ce(Ul,null,Ce(er,null,"ComputedScroll: "),Ce(er,null,a.toFixed(2))))});function KK(e,t){V(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var Wy=!0,RM=new WeakMap;function VK(e){return RM.get(e)}function qK(e,t){RM.set(e,t)}var WK=typeof __DEV__<"u"?__DEV__:void 0,GE,jE=typeof process<"u"&&typeof process.env=="object"&&process.env?(GE="production")!=null?GE:process.env.MODE:void 0,QE=typeof jE=="string"?jE.toLowerCase()!=="production":void 0,XE,_o=(XE=QE??WK)!=null?XE:!1,Kl=-1e7,NM=1,GK=_o&&!1,jK=_o&&!1;function Um({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function _M(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 QK(e){Um(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,_M(e)}function XK(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function YK(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,XK(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var wy=1;function JK(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function YE(e){e.initialScrollSession=void 0}function Ey(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 Mm(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=Ey({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=Ey({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var Km={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){Mm(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){Mm(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=Mm(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},Xn={clear(e){Xn.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=wy},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>wy},isAtZeroTargetOffset(e){return e<=wy},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=Mm(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Ra(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&&!JK(l))return YE(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=Ey({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var ZK=1.3;function My(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*ZK||!t&&n<=0&&o>0}var DM=(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?My(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 e3(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function OM(e){let t=e.state;if(!t.edgeReachedGate)return;let n=eo(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=My(t.scroll,!1,a),l=My(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function FM(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function BM(e){e.state.edgeReachedGate="closed"}function JE(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function t3(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",e3(e,o),o}function eu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function zM(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=eo(e);if(OM(e),f>0&&a){let p=ks(e),m=f-s-i-p,h=f<i;Le(e,"isAtEnd",h||m<=NM),Le(e,"isNearEnd",h||m<=c*i),Le(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),eu(r)||l||(r.isEndReached=DM(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;FM(e,"end",t,n)&&(BM(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function n3(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;OM(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Le(e,"isAtStart",s<=NM),Le(e,"isNearStart",s<=p),eu(o)||o.scrollingTo||(o.isStartReached=DM(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;FM(e,"start",t,n)&&(BM(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function Vm(e,t){let n=!e.state.edgeReachedGate;zM(e,t,n),n3(e,t,n)}function $M(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),Vm(e)}var o3=6,r3=3,a3=250;function HM(e){e.state.scheduledWork.cancel("adaptiveRender")}function ZE(e,t){let n=e.state;HM(e),t<=0?ru(e,"normal","scroll"):n.scheduledWork.timeout(()=>ru(e,"normal","scroll"),t,"adaptiveRender")}function ru(e,t,n){var o,r;re(e,"adaptiveRender")!==t&&(Le(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function Gy(e){var t,n;HM(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";re(e,"adaptiveRender")!==o&&ru(e,o,"initial")}function i3(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=re(e,"adaptiveRender");if(re(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:o3,c=(r=s.exitVelocity)!=null?r:r3,f=(a=s.exitDelay)!=null?a:a3,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"?(ru(e,"light","scroll"),ZE(e,f)):l==="light"&&ZE(e,f))}else Gy(e)}var jy=50;function UM(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"&&!re(e,"readyToRender")&&!a?Math.min(o,jy):o}function KM(e){let{state:t}=e;t.props.drawDistance<=jy||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function Qy(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Le(e,"readyToRender",!1),Gy(e)}function Xy(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&&!re(e,"readyToRender")&&(Le(e,"readyToRender",!0),ru(e,"normal","ready"),o.props.drawDistance>jy&&KM(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var s3=2e3;function eM(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function VM(e){e.scheduledWork.cancel("preservedInitialScroll")}function Vl(e){VM(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Ra(e)}function tM(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&&(Um(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),Km.resetFlags(r),Ra(r,{bootstrap:null}),ql(e))}function ql(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)eM(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)&&eM(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;Xn.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Ra(a),VM(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||Vl(a)},s3,"preservedInitialScroll")):Vl(a),t?.recalculateItems&&$M(e),Xy(e,{didInitialScroll:!0}),p&&YK(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function qm(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function l3(e){let{state:t}=e;return(t.props.horizontal?(Na(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:re(e,"stylePaddingTop")||0)+(re(e,"alignItemsAtEndPadding")||0)+(re(e,"headerSize")||0)}function Nt(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 d3(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 c3(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-d3(e)-ks(e)):0}function Ms(e){let t=re(e,"alignItemsAtEndPadding")||0,n=c3(e);t!==n&&Le(e,"alignItemsAtEndPadding",n)}function tu(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&&Le(e,"totalSize",i),Ms(e)):o&&e.values.get("totalSize")!==i&&Le(e,"totalSize",i)}function Ry(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&&tu(e,t,s,o),a.set(t,n)}function qM(e){return typeof e=="function"}function Wm(e){return Array.isArray(e)}var nM=new Set;function Ls(e,t){_o&&!nM.has(e)&&(nM.add(e),console.warn(`[legend-list] ${t}`))}function au(e){return Math.floor(e*8)/8}function nu(e){return e==null}function oM(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 Zc(e,t,n){return oM(e,n)+oM(t,n)}function Ny(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=re(e,"numContainers");for(let i=0;i<a;i++)if(re(e,`containerItemKey${i}`)===t)return i;return-1}function WM(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 GM(e,t){let n=Nt(e.state,t);return WM(e,n,t,e.state.props.data[t])}function u3(e,t,n){for(let o=t;o<=n;o++)if(GM(e,o)===void 0)return!1;return!0}function to(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=WM(e,t,n,o,s),C!==void 0)return Ry(e,t,C,i),C;let k=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!x){let T=(c=h[k])==null?void 0:c.avg;T!==void 0&&(C=au(T))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&x){let T=(f=x.averageSizeSnapshot)==null?void 0:f[k];T!==void 0&&(C=au(T))}return C===void 0&&(C=g+e.scrollAxisGap),Ry(e,t,C,i),C}function Yy(e,t){if(t===void 0||t<0)return;let n=Nt(e.state,t);return to(e,n,t,e.state.props.data[t])}function Gm(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=l3(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:to(e,Nt(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=re(e,"footerSize")||0;l+=g}}return l}function yi(e,t,n){let o=e.state,r=eo(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&Ma.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 iu(e){var t,n;let o=e.state;if(o?.scrollingTo){Um(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&&tu(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;ql(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}$M(e),r?.()}}var f3=80,p3=1500,m3=320,g3=1;function h3(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?eo(e):void 0,m=f?qy(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;v3(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&iu(e)},100,"platformScrollCompletion")}}function v3(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){iu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),p3),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)<=g3;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),iu(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),f3)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),m3),l.register("platformScrollCompletion",p)}function Wl(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(re(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,eo(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=re(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let h=r.current;if(t.props.horizontal&&Na(t)){let g=eo(e),v=MK(t,g),x=qy(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&&Wl(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function Rs(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,re(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var yo=.1,x3=300,y3=2,C3=1;function b3(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 I3(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)<=yo&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=y3){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+x3,id:n,position:o,quietPasses:c}}}function S3(e,t,n,o,r,a){return!1}function w3(e,t,n){if(Math.abs(t)<=yo)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 T3(e,t){return e<0?-t:t}function Ty(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>yo&&Rs(e,r)}function L3(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>yo)return;let o=eo(e),r=w3(t,n.amount,o);if(Math.abs(r)<=yo)return;let a=n.amount-r;Math.abs(a)<=yo||(n.manualApplied=a,Rs(e,a),n.furthestProgressTowardAmount=0)}function k3(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>yo||r>0&&a<-yo,s=T3(r,a);if(Math.abs(r)<=yo)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+yo>=Math.abs(r))return Ty(e,r,a),!0;let l=Math.max(0,eo(e)-n.scrollLength);return Math.abs(t-l)<=C3||n.pendingMaintainScrollAtEnd&&re(e,"isWithinMaintainScrollAtEndThreshold")&&s>yo?(Ty(e,r,a),!0):s>o.furthestProgressTowardAmount+yo?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>yo&&s<o.furthestProgressTowardAmount-yo&&(n.pendingNativeMVCPAdjust=void 0),!1)}function P3(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=b3(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(eo(e),C){if(p&&v===void 0?(h=p.id,m=p.position):v!==void 0?h=Nt(n,v):o.length>0&&n.didContainersLayout&&!t&&(h=o.find(T=>w.get(T)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let T=0;T<o.length;T++){let L=o[T],b=w.get(L);if(b!==void 0){let S=r[b];S!==void 0&&g.push({id:L,position:S})}}if(h!==void 0&&m===void 0){let T=w.get(h);T!==void 0&&(m=r[T])}return()=>{let T=0,L=p?.id,b,S=!1,A=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 N=A[R];S=N===void 0||!l(N,R,A),S&&p?.id===h&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(h===void 0||S)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:N,position:H}=g[R],D=w.get(N);if(D!==void 0&&l){let xe=A[D];if(xe===void 0||!l(xe,D,A))continue}let W=D!==void 0?r[D]:void 0;if(W!==void 0){T=W-H,L=N,b=W;break}}if(!S&&h!==void 0&&m!==void 0){let R=w.get(h),N=R!==void 0?r[R]:void 0;if(N!==void 0){let H=eo(e),D=N-m;if(D!==0&&y&&n.scroll+n.scrollLength>H)if(D>0)D=Math.max(0,H-n.scroll-n.scrollLength);else{let W=Math.max(0,H-n.scrollLength);n.scroll=W,n.scrollPending=W,D=0}T=D,L=h,b=N}}if(x&&x>0){let R=to(e,h,v,n.props.data[v]),N=f?.itemSize;if(R!==void 0&&N!==void 0&&R!==N){let H=R-N;H!==0&&(T+=H*x,f.itemSize=R)}}if(I3(n,{anchorId:L,anchorPosition:b,dataChanged:t,now:d,positionDiff:T}),S3()){n.pendingNativeMVCPAdjust={amount:T,furthestProgressTowardAmount:0,manualApplied:0,startScroll:k},L3(e);return}Math.abs(T)>yo&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&re(e,"isWithinMaintainScrollAtEndThreshold")||Rs(e,T))}}}var rM=1e3,A3=200,jm=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>rM)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>rM)break;if(c===0||f<=0)continue;let m=o.time-l.time,h=Math.exp(-m/A3);a+=c/f*h,i+=h}return i>0?a/i:0};function E3(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function uu(e){return e.dataChangeNeedsScrollUpdate||E3(e)}function Ps(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:S,gt:A}=i;if(S&&t<S||A&&t>A){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?t3(e,t-f):void 0,y=k3(e,t),C=a.scrollLength,w=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,k=jm(a);i3(e,k,{forceLight:w});let T=a.scrollLastCalculate;if(uu(a)||y||x!==void 0||n||T===void 0||Math.abs(a.scroll-T)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=g;let S=()=>{var E;let B={doMVCP:c!==void 0,scrollVelocity:k};w&&(B.drawDistanceMode="visible-first"),(E=a.triggerCalculateItemsInView)==null||E.call(a,B),Vm(e,x)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,PM.flushSync)(S),KM(e)):S();let A=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);y&&A&&(a.pendingMaintainScrollAtEnd=!1,Wl(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function M3(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 R3(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=Xn.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&Xn.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&Xn.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,Xn.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&Xn.clear(e)}function N3(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 aM(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=Yy(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function _3(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)):N3(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=aM(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=aM(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 D3(e,t,n){let o=_3(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function Qm(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;Um(r);let h=f?c:Gm(e,c,s),g=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=yi(e,h,s),x=g?h:v;if(r.scrollHistory.length=0,!a){d&&Km.resetFlags(r);let y=M3(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||D3(e,v,s.index)}r.scrollPending=v,R3(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)):Ps(e,v,!0,{markHasScrolled:!1})),i||!d||Ma.OS==="android"?h3(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function jM(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function Rm(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=jM(t,l.length);let d=Yy(e,t),c=qm(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,Qm(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Xm(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?jM(i,e.state.props.data.length):void 0,l=Yy(e,s);Qm(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 As(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&Qy(e,{resetInitialScroll:!0}),Ra(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Tr(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?qm(e,t.index):0,i=Gm(e,a,t);return yi(e,i,t)}function QM(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 O3(e,t){var n,o,r;let a=e.state,i=QM(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Tr(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"&&As(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Xm(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function F3(e,t){var n,o;let r=e.state,a=QM(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 Xm(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function su(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?F3(e,{forceScroll:t?.forceScroll}):O3(e,{forceScroll:t?.forceScroll})}function ou(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=Nt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var Ym=1,B3=8,z3=24,$3="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function tr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function Ns(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function H3(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 U3(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 K3(e){let{mountFrameCount:t,maxFrames:n=B3,maxPasses:o=z3,passCount:r}=e;return t>=n||r>=o}function XM(e,t){return K3(t)?(_o&&console.warn($3),n4(e),!0):!1}function lu(e){var t;let n=tr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Ra(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function YM(e,t){var n,o,r;let a=tr(e);Ra(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 V3(e,t){var n,o,r;let a=tr(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,Ra(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&YM(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function _y(e){requestAnimationFrame(()=>{var t;tr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function Jy(e){let t=e.state,n=tr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=tr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!XM(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&Jy(e))};n.frameHandle=requestAnimationFrame(o)}function Om(e,t){V3(e.state,t),Jy(e),_y(e.state)}function Zy(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 q3(e){return!!e?.preserveForBottomPadding}function Es(e){return!!e?.preserveForFooterLayout}function JM(e){return!!(e&&e.viewPosition===1&&(q3(e)||Es(e)))}function W3(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=Es(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 G3(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function Fm(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Es(r))return;let a=Zy({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});As(e,a)}function j3(e){Vl(e)}function eC(e,t,n=Ym){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=du(o);return Math.abs(r-Tr(e,t))>n}function du(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 ZM(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||Ns(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:du(n);return Tr(e,o)-r}function eR(e){return ZM(e)===void 0?!1:(tR(e,{}),!0)}function tR(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=ZM(e);if(a===void 0||Math.abs(a)<=Ym){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Rs(e,a)),tR(e,t)})}function Q3(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||eC(e,o)&&(JM(o)&&re(e,"isAtEnd")||(Es(o)?Fm(e,{dataLength:n.props.data.length,stylePaddingEnd:Vy(n.props),target:o}):j3(n)))}function X3(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Tr(e,i),d=l===0&&!a&&(Ns(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?(lu(s),ql(e,{resolvedOffset:l})):c?(lu(s),ql(e,{preserveTarget:!0,resolvedOffset:l})):(YM(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),Jy(e))}function Y3(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(Ns(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=tr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){Vl(s);return}let p=n>0&&(r||JM(l));if(!(!o&&!d&&!p)){if(p){let m=r?Zy({dataLength:n,footerSize:re(e,"footerSize")||0,preserveForFooterLayout:Es(l),stylePaddingEnd:i}):W3({dataLength:n,footerSize:re(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&eC(e,l)){Fm(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!G3(l,m)||c||d||o){As(e,m,{resetDidFinish:d}),Om(e,{scroll:Tr(e,m),seedContentOffset:d&&!c?du(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(As(e,l,{resetDidFinish:d}),Om(e,{scroll:Tr(e,l),seedContentOffset:d&&!c?du(s):void 0,targetIndexSeed:l.index}))}}function J3(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(Ns(i)||n===0||!s||!(tr(i)||Es(s))))if(eC(e,s))Fm(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=Zy({dataLength:n,footerSize:o,preserveForFooterLayout:Es(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))Fm(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;As(e,d,{resetDidFinish:f}),Om(e,{scroll:Tr(e,d),targetIndexSeed:d.index})}}}function Z3(e){var t,n,o;let r=e.state,a=r.initialScroll,i=tr(r);if(a&&r.props.data.length>0&&!Ns(r)&&(i||a.viewPosition===1)){let s=Tr(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:du(r),c=s-d;if(Math.abs(c)>Ym){if(r.didFinishInitialScroll)eR(e);else if(l){let f=Xn.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,Xn.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),Rs(e,c)}}}else Om(e,{scroll:s,targetIndexSeed:a.index})}}function e4(e){var t,n;let o=e.state,r=tr(o),a=o.initialScroll;if(!r||!a||Ns(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,XM(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=Tr(e,a),s=ou(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=U3({dataLength:d.length,getSize:g=>{var v,x;let y=(v=o.idCache[g])!=null?v:Nt(o,g);return(x=o.sizes.get(y))!=null?x:to(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:Nt(o,g);return o.sizesKnown.has(x)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,_y(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=Ym&&H3(m,c))){_y(o);return}lu(o),Xm(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Ma.OS==="web"})}function t4(e,t){var n;let o=e.state;lu(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;ql(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function n4(e){var t,n,o,r;let a=e.state,i=tr(a),s=a.initialScroll;i&&s&&!Ns(a)&&a.refScroller.current?(lu(a),Xm(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Ma.OS==="web"})):t4(e,(r=(o=(n=(t=tr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function nR(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function o4(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=nR(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 oR(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var r4=20,a4=1,i4=1,Ly=16;function tC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!nC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>u4(e),"checkFinishedScrollFrame")}function s4(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=a4}function l4(e,t){return!!t?.isInitialScroll&&Km.didDispatchNativeScroll(e)&&!e.hasScrolled}function rR(e){var t;return(t=Xn.get(e))==null?void 0:t.targetOffset}function aR(e){let t=rR(e);return!e.didFinishInitialScroll&&Xn.hasNonZeroTargetOffset(t)}function iM(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 Xn.hasNonZeroTargetOffset(r)&&Km.didDispatchNativeScroll(e)&&!e.hasScrolled||Xn.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||aR(e)}function sM(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&eo(e)<=n.scrollLength&&n.scrollPending<=i4}function d4(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function c4(e,t){var n;let o=t.index,a=d4(e,t)&&o!==void 0?Gm(e,qm(e,o),t):(n=t.targetOffset)!=null?n:yi(e,t.offset-(t.viewOffset||0),t);return yi(e,a,t)}function nC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=c4(e,t),i=yi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||Ma.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function u4(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=nC(e,t);o.isAtResolvedTarget&&s4(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&iu(e)}function f4(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 p4(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=sM(e),r=l4(t,n),a=n!==void 0?iM(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?Ly: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=aR(t)&&!t.hasScrolled,g=r?5:h?r4:5,v=sM(e),x=iM(t,m),y=nC(e,m),C=Ma.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||y.isAtResolvedTarget),k=m.isInitialScroll&&!y.isAtResolvedTarget&&l<=g;if(v||w||x||C||l>g)iu(e);else if((h||k)&&l<=g){let T=(p=(f=rR(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;f4(e,T),d(r?Ly:100)}else d(r?Ly:100)}};d(s)}function iR(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?eR(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:su(e,{forceScroll:!0})}function m4(e){var t;if(!e.state.initialScroll)return;let n=()=>su(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),tC(e,{onlyIfAligned:!0})}function g4(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")&&As(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){X3(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?ql(e,{resolvedOffset:p}):Xy(e,{didInitialScroll:!0}))}function h4(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?(As(e,d),Ra(m,{kind:c,previousDataLength:h})):Vl(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Ra(m),p){Y3(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&&Qy(e,{resetInitialScroll:!0}),su(e))}function sR(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function v4(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 Bm(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=re(e,"containerLayoutEpoch"))!=null?n:0)+1;Le(e,"containerLayoutEpoch",a)}}function x4(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:Nt(m,n),T=(a=o?.updateLayout)!=null?a:!0,L=!1,b=!1;if(T){let B=v[n];if(B===void 0)return Le(e,`containerPosition${t}`,Kl),{didChangePosition:!1,didRefreshData:!1};let R=(B||0)-((i=o?.scrollAdjustPending)!=null?i:0),N=(s=m.sizes.get(k))!=null?s:to(e,k,n,w),H=RK(m,R,N,re(e,"totalSize")),D=h[n]||1,W=g[n]||1,xe=re(e,`containerPosition${t}`),ie=re(e,`containerColumn${t}`),Q=re(e,`containerSpan${t}`);H>Kl&&H!==xe&&(Le(e,`containerPosition${t}`,H),L=!0),D>=0&&D!==ie&&Le(e,`containerColumn${t}`,D),W!==Q&&Le(e,`containerSpan${t}`,W)}re(e,`containerItemIndex${t}`)!==n&&Le(e,`containerItemIndex${t}`,n);let A=re(e,`containerItemData${t}`),E=()=>{Le(e,`containerItemData${t}`,w),b=!0};if(A!==w){let B=((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=B?.byIndex[n])!=null?c:0;if(R===2)E();else if(R!==1){let N=(f=re(e,`containerItemKey${t}`))!=null?f:k,H=C?.(A,n);if(A===void 0||!C||H!==N)E();else if(!y)E();else{let D=y(A,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]=D?1:2),D||E()}}}return{didChangePosition:L,didRefreshData:b}}function y4(e,t,n){var o;let r=e.state,a=re(e,"numColumns"),i=t;r.columns[t]!==1&&(i=lM(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=lM(r,a,c),m=C4(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function lM(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 C4(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=to(e,l,s,a[s],o);d>i&&(i=d)}return i}function b4(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=re(e,"numColumns"))!=null?t:1;if(a.length===0)tu(e,null,0);else{let s=a.length-1,l=Nt(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:Nt(o,p),h=to(e,m,p,a[p]);h>f&&(f=h)}tu(e,null,d+f)}else{let c=to(e,l,s,a[s]);if(c!==void 0){let f=d+c;tu(e,null,f)}}}}function lR(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?eo(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Nt(t,i);let s=t.positions[i];r[a]=qy(t,s,o)}Le(e,"snapToOffsets",r)}function dR(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:T,snapToIndices:L},scrollingTo:b}=m,S=k.length,A=(l=re(e,"numColumns"))!=null?l:1,E=A>1,B=_o?new Map:void 0,R=re(e,"extraData"),N=T?{span:1}:void 0,H=m.lastScrollDelta,D=i??jm(m),W=!o&&!t&&(r||Math.abs(D)>0||m.scrollLength>0&&H>m.scrollLength),xe=a+1e3,ie=!0,Q=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=re(e,"scrollAdjustPending"))!=null?d:0)!==0,Ye=!1,Oe=0,ke=1,Be=0;if(t&&(v.length=0),E||(g.length&&(g.length=0),v.length&&(v.length=0)),s>0){if(E){let{startIndex:ee,currentRowTop:ye}=y4(e,s,ie);s=ee,Oe=ye}else if(s<S){let ee=s-1,ye=Nt(m,ee),ct=(c=y[ee])!=null?c:0,ut=(f=w.get(ye))!=null?f:to(e,ye,ee,k[ee],ie,Q,Ye);Oe=ct+ut}}let Se=t||x.size===0,ce=E&&!!T&&!!N,Ne=!1,ge;for(let ee=s;ee<S;ee++){if(W&&ge!==void 0&&ee>ge){Ne=!0;break}W&&ge===void 0&&!b&&!t&&Oe>xe&&(ge=ee+(E?A:1)+10);let ye=(p=C[ee])!=null?p:Nt(m,ee),ct=1;if(ce){N.span=1,T(N,k[ee],ee,A,R);let ft=N.span;ft!==void 0&&Number.isFinite(ft)&&(ct=Math.max(1,Math.min(A,Math.round(ft))))}E&&ke+ct-1>A&&(Oe+=Be,ke=1,Be=0);let ut=w.get(ye),lt=ut!==void 0?ut:to(e,ye,ee,k[ee],ie,Q,Ye);_o&&Se&&(B.has(ye)&&console.error(`[legend-list] Error: Detected overlapping key (${ye}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),B.set(ye,ee)),Oe!==y[ee]&&(y[ee]=Oe,h&&$K(e,ye,Oe)),Se&&x.set(ye,ee),E?(g[ee]=ke,v[ee]=ct,lt>Be&&(Be=lt),ke+=ct,ke>A&&(Oe+=Be,ke=1,Be=0)):Oe+=lt}Ne||b4(e),L&&lR(e)}function cR(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 I4(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function uR(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=cR(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>dM(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):dM(l,d,e,t,o)}}function dM(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=cR(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)fR(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=Ny(o,y.key),T=!1;C!==void 0&&w!==void 0&&(T=uM(n,o,a,k,y.key,r,w,C)),T||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=Nt(n,y),k=Ny(o,w);if(uM(n,o,a,k,w,r,C,y)){let T={containerId:k,index:y,isViewable:!0,item:C,key:w};x.push(T),v.has(T.key)||g.push(T)}}}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];S4(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 cM(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 fR(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(re(t,"stylePaddingTop")||0)+(re(t,"alignItemsAtEndPadding")||0)+(re(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 B={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(!cM(R,B)){t.mapViewabilityAmountValues.set(o,B);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(B)}return B}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),T=x?w?100:100*(k/x):0,L=x?100*(k/a):0,S=(w?100:m?L:T)>=h,A={containerId:o,index:s,isViewable:S,item:i,key:r,percentOfScroller:L,percentVisible:T,scrollSize:a,size:x,sizeVisible:k},E=t.mapViewabilityAmountValues.get(o);if(!cM(E,A)){t.mapViewabilityAmountValues.set(o,A);let B=t.mapViewabilityAmountCallbacks.get(o);B&&B(A)}return A}function uM(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=fR(e,t,n,o,r,a,i,s)),l.isViewable}function S4(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var fM=kM.unstable_batchedUpdates,w4=typeof fM=="function"?fM:e=>e(),T4=32,L4=64,k4=3;function P4(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*k4),o=t+L4,r=Math.max(t,Math.min(n,o),Math.min(e,T4)),a=Math.max(e,t);return Math.min(a,r)}function A4(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function E4(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=re(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((A,E)=>({isSticky:c.props.stickyHeaderIndicesSet.has(A),itemIndex:A,itemType:a?.(A),order:E})),v=g.filter(A=>!A.isSticky),x=g.filter(A=>A.isSticky),y=[],C=[];for(let A=0;A<d;A++){let E=re(e,`containerItemKey${A}`),B=!!h?.has(A);if(!(E&&i?.has(E)&&c.indexByKey.has(E))){if(p.has(A))(E===void 0||B)&&C.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(E===void 0||B)y.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(!m){let N=c.indexByKey.get(E);if(N!==void 0&&(N<n||N>o)){let H=N<n?n-N:N-o;y.push({containerIndex:A,distance:H})}}}}y.sort(M4);let w=new Array(l),k=d,T=!1,L=(A,E)=>{w[A.order]={containerIndex:E,itemIndex:A.itemIndex,itemType:A.itemType},h?.delete(E)&&(T=!0)},b=(A,E,B)=>{for(let R of A){if(w[R.order])continue;let N=E.findIndex(H=>{var D;return B((D=f.get(H.containerIndex))==null?void 0:D.itemType,R.itemType)});if(N!==-1){let[H]=E.splice(N,1);L(R,H.containerIndex)}}},S=(A,E,B)=>{a&&b(A,E,(R,N)=>N!==void 0&&R===N),b(A,E,R=>R===void 0),B&&b(A,E,()=>!0)};S(v,y,!0),S(x,C,!1);for(let A of g){if(w[A.order])continue;let E=k++;A.isSticky&&p.add(E),L(A,E)}if(T&&(r.length=0,h))for(let A of h)r.push(A);if(_o){let A=(s=re(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;k>A&&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:A,numNeeded:l,stillNeeded:k-d}})}return w}function M4(e,t){return t.distance-e.distance}function R4(e){let t=e.state;t.queuedInitialLayout=!0,zM(e),Xy(e,{didLayout:!0})}var N4=4,_4=100;function D4(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/N4);return Math.sign(e)*t*n}function O4(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},_4,"renderRangeProjection")}function F4(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 B4(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=re(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function z4(e,t,n,o,r,a,i){var s;let l=e.state;Le(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(B4(e,f))continue;let p=(s=l.idCache[f])!=null?s:Nt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function $4(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=re(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),Le(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:Nt(d,p);if(x){let y=d.positions[p],C=(l=d.sizes.get(x))!=null?l:to(e,x,p,d.props.data[p]);v=y!==void 0&&n>y+C+o*3}}v&&a.push(c)}}function pR(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 mR(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:Nt(e,i);r.push(s)}return r}function Dy(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:Nt(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 H4(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:Nt(r,f),m=(o=d.get(p))!=null?o:to(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function U4(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:Nt(s,g),x=(i=p.get(v))!=null?i:to(e,v,g,f[g]),y=c[g];if(pR(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:mR(s,h),startNoBuffer:h.startNoBuffer}),Dy(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&uR(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function Ea(e,t={}){let n=e.state;w4(()=>{var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k,T,L;let{columns:b,containerItemKeys:S,enableScrollForNextCalculateItemsInView:A,idCache:E,indexByKey:B,minIndexSizeChanged:R,positions:N,props:{alwaysRenderIndicesArr:H,alwaysRenderIndicesSet:D,getItemType:W,keyExtractor:xe,onStickyHeaderChange:ie},scrollForNextCalculateItemsInView:Q,scrollLength:Ye,sizes:Oe,startBufferedId:ke,viewabilityConfigCallbackPairs:Be}=n,{data:Se}=n.props,ce=n.props.stickyHeaderIndicesArr||[],Ne=n.props.stickyHeaderIndicesSet||new Set,ge=UM(e,t.drawDistanceMode),{dataChanged:ee,doMVCP:ye,forceFullItemPositions:ct}=t,ut=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,lt=!!ut,ft=re(e,"numContainers");if(!Se||Ye===0||!ft)return;let zt=eo(e),it,Pe=re(e,"stylePaddingTop")+re(e,"alignItemsAtEndPadding")+re(e,"headerSize"),Re=re(e,"numColumns"),Fe=(r=t.scrollVelocity)!=null?r:jm(n),Ze=0,{initialScroll:we,queuedInitialLayout:et}=n,ht=lt?(a=ut?.scroll)!=null?a:n.scroll:!et&&eu(n)&&we?Tr(e,we):n.scroll,$t=0,dn=0,_t=0,Ht=0,Gt=0,Dt=0,oo=ht,yn=te=>{var Ge;oo=te,$t=(Ge=re(e,"scrollAdjustPending"))!=null?Ge:0,dn=$t-Pe,_t=Math.round(te+Ze+dn),_t+Ye>zt&&(_t=Math.max(0,zt-Ye))};yn(ht);let kn=re(e,"activeStickyIndex"),Dn=()=>{let te=ce.length>0?F4(ce,_t,n):-1,Ge=te>=0?ce[te]:-1,xt=kn!==Ge;(te>=0||kn>=0)&&Le(e,"activeStickyIndex",Ge);let tt=!!ie&&ce.length>0&&xt;return{currentStickyIdx:te,finishCalculateItemsInView:tt?()=>{let An=Se[Ge];An!==void 0&&ie?.({index:Ge,item:An})}:void 0}},kt=ee?void 0:Dn(),Cn=ge,St=ge;Fe>0||Fe===0&&_t<Math.max(50,ge)?(Cn=ge*.5,St=ge*1.5):(Cn=ge*1.5,St=ge*.5);let cn=!ee&&!ct&&!lt&&!eu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!re(e,"readyToRender")?D4(Fe,Math.min(Cn,St)):0,F=()=>{let te=Math.max(0,_t),Ge=Math.max(0,-oo);Gt=Math.max(te,_t+Ye+Ge),Ht=te-Cn+cn,Dt=Gt+St+cn};if(F(),cn!==0&&O4(e),A&&!lt&&!ee&&!ct&&Q){let{top:te,bottom:Ge}=Q;if(te===null&&Ge===null)n.scrollForNextCalculateItemsInView=void 0;else if((te===null||Ht>te)&&(Ge===null||Dt<Ge)&&!uu(n)){Be?U4(e,Be,Ye,_t,Gt):n.props.onFirstVisibleItemChanged&&Dy(n,H4(e,_t)),(i=kt?.finishCalculateItemsInView)==null||i.call(kt);return}}let J=ye&&!lt?P3(e,ee):void 0;ee&&sR(n);let ae=ct||ee?0:(s=R??n.startBuffered)!=null?s:0,oe=!ct&&!ee&&Re>1&&R!==void 0;dR(e,ee,{doMVCP:ye,forceFullUpdate:!!ct,optimizeForVisibleWindow:oe,scrollBottomBuffered:Dt,scrollVelocity:Fe,startIndex:ae}),zt=eo(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let le;if(ee&&ye&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let te=n.props.maintainVisibleContentPosition.shouldRestorePosition;le=new Set;for(let Ge of n.idsInView){let xt=B.get(Ge);xt!==void 0&&(te&&!te(Se[xt],xt,Se)||le.add(Ge))}}let Je=n.scroll,Ve=(l=re(e,"scrollAdjustPending"))!=null?l:0;J?.(),J&&(n.scroll!==Je||((d=re(e,"scrollAdjustPending"))!=null?d:0)!==Ve)&&(yn(n.scroll),F()),ee&&(kt=Dn());let vt=null,Yt=null,jt=null,Ct=(c=lt?ut?.targetIndexSeed:void 0)!=null?c:!ee&&ke&&B.get(ke)||0;for(let te=Ct;te>=0;te--){let Ge=(f=E[te])!=null?f:Nt(n,te),xt=N[te],tt=(p=Oe.get(Ge))!=null?p:to(e,Ge,te,Se[te]);if(xt+tt>Ht)Ct=te;else break}if(Re>1)for(;Ct>0;){let te=b[Ct];if(te===1||te===void 0)break;Ct-=1}let fe=!1,dt,rt,Pt=0;for(let te=0;te<ft;te++){let Ge=re(e,`containerItemKey${te}`);if(Ge!==void 0){let xt=B.get(Ge);Pt=Math.max(Pt,xt)}}let ze={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},bt=Se.length;for(let te=Math.max(0,Ct);te<bt&&(!fe||te<=Pt);te++){let Ge=(m=E[te])!=null?m:Nt(n,te),xt=(h=Oe.get(Ge))!=null?h:to(e,Ge,te,Se[te]),tt=N[te];fe||(pR(ze,te,tt,xt,_t,Gt),vt===null&&tt+xt>Ht&&(vt=te,Yt=Ge,Ht<0?dt=null:dt=tt),ze.startNoBuffer!==null&&(tt<=Dt?(jt=te,Dt>zt?rt=null:rt=tt+xt):fe=!0))}Object.assign(n,{endBuffered:jt,endNoBuffer:ze.endNoBuffer,firstFullyOnScreenIndex:ze.firstFullyOnScreenIndex,idsInView:mR(n,ze),startBuffered:vt,startBufferedId:Yt,startNoBuffer:ze.startNoBuffer}),A&&dt!==void 0&&rt!==void 0&&(n.scrollForNextCalculateItemsInView=nu(dt)&&nu(rt)?void 0:{bottom:rt,top:dt});let un=ft,At=[];if(ee)for(let te=0;te<un;te++){let Ge=re(e,`containerItemKey${te}`);(!xe||Ge&&B.get(Ge)===void 0)&&At.push(te)}let Qt=n.scrollTargetPinnedRange,nn=0,mn=-1;Qt&&(nn=Math.max(0,Math.min(Qt.start,Qt.end)),mn=Math.min(bt-1,Math.max(Qt.start,Qt.end)));let Pn=nn<=mn,ao=te=>D.has(te)||Pn&&te>=nn&&te<=mn;if(vt!==null&&jt!==null){let te=[],Ge=new Set,xt=tt=>{var An;if(tt>=0&&tt<bt){let Zt=(An=E[tt])!=null?An:Nt(n,tt),on=S.get(Zt);on!==void 0?n.stickyContainerPool.add(on):!nu(Zt)&&!Ge.has(tt)&&(Ge.add(tt),te.push(tt))}};for(let tt=vt;tt<=jt;tt++){let An=(g=E[tt])!=null?g:Nt(n,tt);S.has(An)||(Ge.add(tt),te.push(tt))}for(let tt of H)xt(tt);if(Pn)for(let tt=nn;tt<=mn;tt++)xt(tt);if(ce.length>0?z4(e,ce,(v=kt?.currentStickyIdx)!=null?v:-1,te,Ge,vt,jt):kn!==-1&&Le(e,"activeStickyIndex",-1),te.length>0){let An=E4(e,te,vt,jt,At,W?Zt=>{let on=W(Se[Zt],Zt);return on!==void 0?String(on):""}:void 0,le);for(let Zt of An){let on=Zt.itemIndex,rn=Zt.containerIndex,Co=(x=E[on])!=null?x:Nt(n,on),an=re(e,`containerItemKey${rn}`);an&&an!==Co&&S.delete(an),an!==Co&&(it??(it=new Set),it.add(rn),n.containerItemGenerations[rn]=((y=n.containerItemGenerations[rn])!=null?y:0)+1),Le(e,`containerItemKey${rn}`,Co),Le(e,`containerItemIndex${rn}`,on),Le(e,`containerItemData${rn}`,Se[on]),n.containerItemMetadata.set(rn,nR(n,on,Se[on],Zt.itemType)),S.set(Co,rn),(C=n.userScrollAnchorReset)==null||C.keys.add(Co);let Lo=`containerSticky${rn}`,na=Ne.has(on),bn=ao(on);na?(Le(e,Lo,!0),n.stickyContainerPool.add(rn)):(re(e,Lo)&&Le(e,Lo,!1),bn?n.stickyContainerPool.add(rn):n.stickyContainerPool.delete(rn)),rn>=un&&(un=rn+1)}un!==ft&&(Le(e,"numContainers",un),un>re(e,"numContainersPooled")&&Le(e,"numContainersPooled",A4(bt,un)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&$4(e,ce,_t,ge,(k=kt?.currentStickyIdx)!=null?k:-1,At,ao);let io=At.length>0?new Set(At):void 0,Jt=!1;for(let te=0;te<un;te++){let Ge=re(e,`containerItemKey${te}`);if(io?.has(te))Ge!==void 0&&(S.delete(Ge),it??(it=new Set),it.add(te),n.containerItemGenerations[te]=((T=n.containerItemGenerations[te])!=null?T:0)+1),n.containerItemMetadata.delete(te),n.stickyContainerPool.has(te)&&(Le(e,`containerSticky${te}`,!1),n.stickyContainerPool.delete(te)),Le(e,`containerItemKey${te}`,void 0),Le(e,`containerItemIndex${te}`,void 0),Le(e,`containerItemData${te}`,void 0),Le(e,`containerPosition${te}`,Kl),Le(e,`containerColumn${te}`,-1),Le(e,`containerSpan${te}`,1);else{let xt=B.get(Ge);xt!==void 0&&(Jt=x4(e,te,xt,{scrollAdjustPending:$t,updateLayout:!0}).didChangePosition||Jt)}}if(it&&Wy&&Bm(e,it),Jt&&Le(e,"lastPositionUpdate",Date.now()),lt){e4(e);return}Dy(n,ze.startNoBuffer),!et&&!n.didContainersLayout&&(eu(n)?ou(n,n.startBuffered,n.endBuffered):ou(n,n.startNoBuffer,n.endNoBuffer)||ou(n,n.startBuffered,n.endBuffered))&&(R4(e),m4(e)),Be&&ze.startNoBuffer!==null&&ze.endNoBuffer!==null&&uR(e.state,e,Be,Ye,ze.startNoBuffer,ze.endNoBuffer,vt??ze.startNoBuffer,jt??ze.endNoBuffer),(L=kt?.finishCalculateItemsInView)==null||L.call(kt)})}function zm(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=re(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=Nt(o,g);let C=0,w=!1;for(let T=g;T<y.length;T++){let L=GM(e,T),b=T===g&&v!==void 0?Math.min(L||0,Math.max(0,v)):L;L===void 0&&(w=!0),b!=null&&b>0&&(C+=b)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+Vy(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&&(Le(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Ms(e),Ps(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Le(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Ps(e,o.scroll,!0,{markHasScrolled:!1})),f}function K4(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(Ea(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>Ea(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),Ea(e,{doMVCP:!0}))}function pM(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=re(e,"otherAxisSize");(!a||r>a)&&Le(e,"otherAxisSize",r)}}var Pa;function gR(e){let t=Pa===void 0;Pa??(Pa=new Map);try{e()}finally{if(t){let n=Pa;Pa=void 0;for(let[o,r]of n)oC(o,r)}}}function V4(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 q4(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,K4(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&zm(e),t.didChange&&t.shouldMaintainScrollAtEnd&&Wl(e)}function hR(e,t){if(Pa){let n=Pa.get(e);n?n.push(t):Pa.set(e,[t])}else oC(e,[t])}function oC(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||re(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?o4(o,a.containerId,s,l):void 0,c=W4(e,a.itemKey,a.size,d);V4(r,c)}q4(e,r)}function W4(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 b=i.props.data[x];if(b===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let A=(a=o?.itemType)!=null?a:p&&(r=p(b,x))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(b,x,A),itemType:A}}let S=o.fixedItemSize;if(S!==void 0&&S===c.get(t))return pM(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,w,k=i.sizesKnown.get(t),T=G4(e,t,n,o),L=au(m?n.width:n.height);if(T!==0){w=w!==void 0?Math.min(w,x):x;let{startBuffered:b,endBuffered:S}=i;y||(y=x>=b&&x<=S),!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-T,size:L})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),pM(e,n,m),d||ou(i,i.startBuffered,i.endBuffered)){let b=C&&!!v?.onItemLayout;return{didChange:T!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:y,shouldMaintainScrollAtEnd:b}}return{didChange:T!==0,didMeasureUserScrollAnchorResetItem:l}}function G4(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=to(e,t,h,g,void 0,void 0,void 0,y),w=f?n.width:n.height,k=l.get(t),T=Math.round(w);if(l.set(t,T),x===void 0&&T>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=T,L.num++):k!==void 0&&k>0?L.avg+=(T-k)/L.num:(L.avg=(L.avg*L.num+T)/(L.num+1),L.num++)}return!C||Math.abs(C-T)>.1?(Ry(e,t,T),T-C):0}function j4(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=re(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();qK(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&oC(e,n)}var vR=zn,ta=de,Q4=ta(function({children:t}){let n=Lr(),[o]=Do(["containerLayoutEpoch"]);return Me(()=>{{let r=v4(n);r!==void 0&&j4(n,r)}},[n,o]),t}),Nm=e=>Og(e)?e:e?Ce(e,null):null,X4=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),Oy={contain:"paint layout style",...X4?{display:"flex",flexDirection:"column"}:{}},Y4=ta(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=Kl]=Do([`containerPosition${t}`]),s=Wm(o)?Object.assign({},...o):o,l=n?{...Oy,...s,left:i}:{...Oy,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Ce("div",{ref:r,...m,style:l})}),J4=ta(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=Kl,p,m]=Do([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),h=$(()=>{var x;return(x=Wm(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=$(()=>{var x;let y={...Oy,...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=$(()=>i?.backdropComponent?Ce("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},Nm(i.backdropComponent)):null,[i?.backdropComponent]);return Ce("div",{ref:r,style:g,...c},v,d)}),Z4=Y4;function eV(e){K(()=>e())}var xR=Ot(null),tV=-1;function nV(){return sn(xR)}function oV(){var e;let t=nV(),n=(e=t?.containerId)!=null?e:tV,[o]=Do([`containerItemKey${n}`]);return HK("lastItemKeys",a=>t&&!nu(o)&&a?.includes(o)||!1)}function rV({ItemSeparatorComponent:e,leadingItem:t}){return oV()?null:Ce(e,{leadingItem:t})}var ky=null;function aV(){return ky||(ky=new ResizeObserver(e=>{gR(()=>{for(let t of e){let n=_m.get(t.target);if(n)for(let o of n)o(t)}})})),ky}var _m=new WeakMap;function iV(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=aV(),r=(n=_m.get(e))!=null?n:new Set;return r.size===0&&(_m.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(_m.delete(e),o.unobserve(e))}}function rC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return Me(()=>{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(mM(m),!0),p=m}return iV(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??VK(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let w=!!r?.();(C||w)&&f(mM(x),!1)})},[t,...a||[]]),{}}function mM(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var Dm=new Map,Py;function yR(e){Dm.delete(e)}function sV(e,t){Dm.set(e,t),Py===void 0&&(Py=requestAnimationFrame(()=>{let n=Array.from(Dm.values());Dm.clear(),Py=void 0,gR(()=>{for(let o of n)o()})}))}function lV({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=au(n[l]);r.lastSize&&au(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,hR(t,{containerId:e,itemKey:i,size:s})};!uu(a)&&f!==void 0&&d+1<f?sV(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()}}):(yR(r),p())}function dV({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]=K(0),l=U(f=>{lV({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=U(()=>{Bm(t,e)},[e,t]);Me(()=>(t.containerLayoutTriggers.set(e,d),()=>{yR(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),Me(()=>{Bm(t,e)});let{onLayout:c}=rC({measureInLayoutEffect:!Wy,onLayoutChange:l,ref:r,webLayoutResync:()=>uu(t.state)},[o,i]);return V(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function cV({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&&Ma.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 uV=ta(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Lr(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Na(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[h=0,g=1,v,x=1,y,C]=Do([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=_(null),{onLayout:k,triggerLayout:T}=dV({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),L=h>0?h:1,b=Math.min(Math.max(g||1,1),x),S=x>1?`${(L-1)/x*100}%`:0,A=x>1?`${b/x*100}%`:void 0,E=$(()=>cV({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:x,otherAxisPos:S,otherAxisSize:A}),[r,f,S,A,d,l.state.props.contentContainerAlignItems,x,i]),B=$(()=>n!==void 0?a(n):null,[n,v,y]),{renderedItem:R}=B||{},N=$(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:T}),[t,T]);return Ce(C?m||J4:p||Z4,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:k,refView:w,stickyHeaderConfig:s,style:E},Ce(xR.Provider,{value:N},R,B&&i&&Ce(rV,{ItemSeparatorComponent:i,leadingItem:B.item})))});function fV({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=uV}){let[s]=Do([`containerItemKey${e}`]);return s===void 0?null:Ce(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var pV=ta(function(t){return Ce(fV,{...t})});function mV(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=gV(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 gV(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 hV(e){let t=Lr(),n=_(void 0);V(()=>{let o=Aa(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=re(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}mV(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function vV(e,t){let[n,o]=K(t),r=n!==t;return Me(()=>{o(t)},[t]),e&&!r}var xV=ta(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=_(null),i=Lr(),s=i.columnWrapperStyle,l=Na(i.state),[d,c,f]=Do(["otherAxisSize","readyToRender","totalSize"]),p=vV(!!c,t);hV(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 Ce("div",{ref:a,style:m},Ce(Q4,null,r))}),yV=ta(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Do(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(Ce(pV,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Ce(xV,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function CV(e){return Wm(e)?Object.assign({},...e.filter(Boolean)):e}var cu={create:e=>e,flatten:e=>CV(e)};function Fy(e){let t=_(e);return t.current=e,t}function bV(e){let t=Fy(e),n=_(void 0),o=$(()=>({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 V(()=>()=>{o.cancel()},[o]),o}var By="legend-list-content-container",CR="legend-list-scrollbar-x-hidden",bR="legend-list-scrollbar-y-hidden";function IV(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function zy(){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 gM(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 IR(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function SV(e,t,n){return IR(n?t:e)}function hM(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 vM(e,t){return Math.max(0,Math.min(e,t))}function xM(e,t){return t?e.width:e.height}function wV(e,t,n){return Math.max(0,xM(e,n)-xM(t,n))}function yM(e,t){return t&&IV()||e}function TV(e,t){return t&&typeof window<"u"?window:e}function LV(e,t,n){let o=e.getBoundingClientRect(),r=zy();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 kV({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var CM="legend-list-scrollbar-axis-hidden-style",PV=200,AV=`.${bR}::-webkit-scrollbar:vertical{width:0;display:none;}.${CR}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function EV(){if(typeof document>"u"||document.getElementById(CM))return;let e=document.createElement("style");e.id=CM,e.textContent=AV,document.head.appendChild(e)}function MV(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 RV(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 NV(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 bM=zn(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=Lr(),[T]=Do(["anchoredEndSpaceSize"]),L=_(null),b=_(null),S=h,A=U(()=>TV(L.current,S),[S]),E=U(()=>{let Pe=L.current,Re=SV(Pe,b.current,S),Fe=hM(Pe,S,a);return wV(Re,Fe,a)},[a,S]),B=U(()=>{let Pe=L.current;if(S){let Re=E(),Fe=zy(),Ze=gM(Pe,Fe),we=a?Fe.x-Ze.left:Fe.y-Ze.top;return vM(we,Re)}return Pe?a?Pe.scrollLeft:Pe.scrollTop:0},[E,a,S]),R=U((Pe,Re)=>{let Fe=L.current,Ze=A();if(!Ze||typeof Ze.scrollTo!="function")return;let we=E(),et=vM(Pe,we),$t={behavior:Re?"smooth":"auto"};if(S){let dn=zy(),_t=gM(Fe,dn),{left:Ht,top:Gt}=kV({clampedOffset:et,horizontal:a,listPos:_t,scroll:dn});$t.left=Ht,$t.top=Gt}else a?$t.left=et:$t.top=et;Ze.scrollTo($t)},[E,A,a,S]);Br(x,()=>({getBoundingClientRect:()=>{var Re;return(Re=L.current)==null?void 0:Re.getBoundingClientRect()},getCurrentScrollOffset:B,getScrollableNode:()=>yM(L.current,S),getScrollEventTarget:()=>A(),getScrollResponder:()=>yM(L.current,S),isWindowScroll:()=>S,scrollBy:(Re,Fe)=>{let Ze=A();!Ze||typeof Ze.scrollBy!="function"||Ze.scrollBy({behavior:"auto",left:Re,top:Fe})},scrollTo:Re=>{let{x:Fe=0,y:Ze=0,animated:we=!0}=Re;R(a?Fe:Ze,we)},scrollToEnd:(Re={})=>{let{animated:Fe=!0}=Re,Ze=E();R(Ze,Fe)},scrollToOffset:Re=>{let{offset:Fe,animated:Ze=!0}=Re;R(Fe,Ze)}}),[B,E,A,a,S,R]);let N=U(()=>{if(!l||!L.current)return;let Pe=IR(b.current),Re=hM(L.current,S,a),Fe=B(),Ze={nativeEvent:{contentOffset:{x:a?Fe:0,y:a?0:Fe},contentSize:{height:Pe.height,width:Pe.width},layoutMeasurement:{height:Re.height,width:Re.width}}};l(Ze)},[B,a,S,l]),H=bV(N),D=_(void 0),W=U(()=>{let Pe=D.current;Pe!==void 0&&(clearTimeout(Pe),D.current=void 0),H.flush(),d?.()},[d,H]),xe=U(Pe=>{if(!l)return;let Re=k.state;if(!!Re?.scrollingTo||!!Re?.initialScrollSession&&!Re.didFinishInitialScroll||!!Re?.initialScroll&&!Re.didFinishInitialScroll||!!Re&&uu(Re)?H.flush():H.schedule(),d){let Ze=D.current;Ze!==void 0&&clearTimeout(Ze),D.current=setTimeout(W,PV)}},[k.state,W,d,l,H]);Me(()=>{let Pe=A();if(Pe)return Pe.addEventListener("scroll",xe,{passive:!0}),"onscrollend"in Pe&&Pe.addEventListener("scrollend",W),()=>{Pe.removeEventListener("scroll",xe),"onscrollend"in Pe&&Pe.removeEventListener("scrollend",W);let Re=D.current;Re!==void 0&&(clearTimeout(Re),D.current=void 0),H.cancel()}},[W,A,xe,H]),V(()=>{let Pe=()=>{i&&R(a?i.x||0:i.y||0,!1)};Pe(),requestAnimationFrame(Pe)},[i?.x,i?.y,a,R]),Me(()=>{if(!g||!L.current)return;let Pe=L.current,Re=()=>{g({nativeEvent:{layout:LV(Pe,S,a)}})};Re();let Fe=new ResizeObserver(()=>{Re()});Fe.observe(Pe);let Ze=()=>{Re()};return S&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",Ze),()=>{Fe.disconnect(),S&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Ze)}},[S,g]);let ie=!S&&(a?!f&&CR:!p&&bR);Me(()=>{ie&&EV()},[ie]);let Q={...S?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...cu.flatten(n),...s?{overflowAnchor:"none"}:{}},Ye=MV(k),Oe=(C=(y=k.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&T?T:0,ke=Math.max(0,Ye-Oe),Be=ke?a?{flexShrink:0,width:ke}:{height:ke}:void 0,Se={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...cu.flatten(r),...s?{overflowAnchor:"none"}:{}},ce=o?`${By} ${o}`:By,{contentContainerClassName:Ne,contentInset:ge,scrollEventThrottle:ee,ScrollComponent:ye,snapToOffsets:ct,useWindowScroll:ut,className:lt,...ft}=v,zt=S?[]:RV(ct);zt.length>0&&(Q.scrollSnapType=a?"x mandatory":"y mandatory",Se.position=(w=Se.position)!=null?w:"relative");let it=ie?lt?`${lt} ${ie}`:ie:lt;return _o&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${lt??""}`)&&Ls("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."),Ce("div",{className:it,ref:L,...ft,style:Q},m,Ce("div",{className:ce,ref:b,style:Se},zt.map(Pe=>Ce("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":Pe,key:`snap-${Pe}`,style:NV(Pe,a)})),t,Be?Ce("div",{"aria-hidden":!0,style:Be}):null))});function _V({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function IM(e,t){let n=Lr();Me(()=>Aa(n,e,r=>{t(r)}),[t,n,e])}function DV(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function OV(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 > .${By}`)),i?{contentNode:s,scrollElement:i}:null}function FV(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function BV(){let e=Lr(),t=_(0),n=_(0),o=_(void 0),r=_(void 0),a=_(null),i=U(()=>{let s=re(e,"scrollAdjust"),l=re(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=OV(e,a.current);if(f){let p=!!e.state.props.horizontal,m=DV(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=()=>FV(g,m.x*C,m.y*C);if(a.current=h,w&&h){let T=h[m.contentSizeKey],L=g[m.viewportSizeKey],b=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&T<b+L){let A=h.style[m.paddingEndProp],E=r.current,B=E?.value===A?E.baseline:A,R=(b+L-T)*2,H=`${(Number.parseFloat(window.getComputedStyle(h)[m.paddingEndProp])||0)+R}px`;h.style[m.paddingEndProp]=H,r.current={baseline:B,value:h.style[m.paddingEndProp]},h.offsetHeight,k(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let D=r.current;o.current=void 0,r.current=void 0,h.style[m.paddingEndProp]===D?.value&&(h.style[m.paddingEndProp]=D.baseline)})}else k()}else w&&k()}t.current=d,n.current=l||0}},[e]);return IM("scrollAdjust",i),IM("scrollAdjustUserOffset",i),null}var zV=zn(function({ScrollComponent:t,...n},o){let[r]=Do(["snapToOffsets"]);return Ce(t,{...n,ref:o,snapToOffsets:r})}),$y=.1;function $V(e,t,n){let o=re(e,t)!==n;return o&&(Le(e,t,n),Ms(e)),o}function HV(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-$y&&Math.abs(l)>$y}function SM(e,t){let{state:n}=e,o=re(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>$y;r&&(Le(e,"headerSize",t),Ms(e),a&&HV(e,o,t)&&Rs(e,t-o)),n.didMeasureHeader=!0}function UV(e,t){let n=$V(e,"footerSize",t);return n&&zm(e),n}function KV(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 VV(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!KV(o,r);return n.contentInsetOverride=r,a&&Ms(e),a}function qV(e,t){let n=Fy(e),o=Fy(t);return $(()=>zn((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 wM=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=_(null),a=t??r;return rC({onLayoutChange:e,ref:a}),Ce("div",{...o,ref:a},n)},WV=ta(function({horizontal:t}){let[n=0]=Do(["alignItemsAtEndPadding"]);return n<=0?null:Ce($m,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),GV=ta(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:T,scrollAdjustHandler:L,snapToIndices:b,stickyHeaderConfig:S,stickyHeaderIndices:A,useWindowScroll:E=!1,...B}){let R=Lr(),N=R.state.props.maintainVisibleContentPosition,[H=0,D=0]=Do(["anchoredEndSpaceSize","otherAxisSize"]),W=R.state.props.alignItemsAtEndPaddingEnabled,xe=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&H>0,ie;if(xe){let Ne=a?Na(R.state)?"Left":"Right":"Bottom",ge=cu.flatten(r);ie={[`padding${Ne}`]:Zc({},ge||{},Ne)+H}}let Q=_V({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:D}),Ye=qV(C,(Ne,ge)=>({...Ne,ref:ge})),Oe=C?Ye:bM,ke=b?zV:Oe,Be=U((Ne,ge)=>{var ee;let ye=UV(R,Ne);ge?.(),ye&&((ee=R.state.props.maintainScrollAtEnd)!=null&&ee.onFooterLayout)&&Wl(R)},[R]);Me(()=>{p||SM(R,0),h||Be(0)},[p,h,R,Be]);let Se=U(Ne=>{let ge=Ne[a?"width":"height"];SM(R,ge)},[R,a]),ce=U((Ne,ge)=>{let ee=Ne[a?"width":"height"];Be(ee,()=>{w?.(Ne,ge)})},[a,w,Be]);return Ce(ke,{...B,...Oe===bM?{onInternalScrollEnd:T,useWindowScroll:E}:{},contentContainerStyle:[a?{height:"100%"}:{},r,ie,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:N.size||N.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:y,ScrollComponent:b?Oe:void 0,style:Q?[Q,o]:o},Ce(BV,null),p&&Ce(wM,{onLayoutChange:Se,style:m},Nm(p)),v&&Nm(v),W&&Ce(WV,{horizontal:a}),t&&!v&&Ce(yV,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:S}),h&&Ce(wM,{onLayoutChange:ce,style:g},Nm(h)),_o&&GK)}),jV=100,QV=.9,XV=.9;function YV(e){let t=Lr(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;V(()=>{l&&(a??1)>1&&Ls("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),V(()=>{s&&i&&Ls("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),V(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Ls("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]),V(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<jV)return;let p=()=>{let h=re(t,"readyToRender"),g=re(t,"numContainers")||0,v=re(t,"totalSize")||0,x=t.state.scrollLength||0;if(!h||v<=0||x<=0)return;let y=g>=Math.ceil(c*QV),C=x>=v*XV;y&&C&&Ls("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=[Aa(t,"numContainers",p),Aa(t,"readyToRender",p),Aa(t,"totalSize",p)];return()=>{for(let h of m)h()}},[t])}function JV(e){}var ZV=_o?YV:JV;function eq(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),oR(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}Ea(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&Wl(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||Vm(e),delete o.previousData}function tq(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 SR(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=UM(e),f=re(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++)Le(e,`containerPosition${h}`,Kl),Le(e,`containerColumn${h}`,-1),Le(e,`containerSpan${h}`,1);return Le(e,"numContainers",m),Le(e,"numContainersPooled",P4(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Ea(e,{dataChanged:!0,doMVCP:!0})}):Ea(e,{dataChanged:!0,doMVCP:!0})),!0}}function nq(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function oq(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=nq()[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,Ms(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&SR(e),m&&Ea(e,{doMVCP:!0}),(g||p!==h)&&Le(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&Wl(e),Vm(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}_o&&d===0&&Ls("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 rq(e,t){let n=Xn.get(e);if(!!n&&Xn.didReachTarget(t,n)){Xn.clear(e);return}n&&(e.hasScrolled=!1,Xn.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function aq(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function iq(e){return{...e,nativeEvent:{...e.nativeEvent}}}function sq(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=NK(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=yi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,Qm(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Ps(e,f,c,{fromNativeScrollEvent:!0}),rq(l,f),Q3(e),l.scrollingTo&&tC(e),l.props.onScroll&&(aq(l)?l.deferredPublicOnScrollEvent=iq(t):l.props.onScroll(t))}var lq=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()}},dq=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,Le(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Le(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&tC(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=qm(this.ctx,e.index);o=Gm(this.ctx,a,e),o=yi(this.ctx,o,e)}else o=yi(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,Le(this.ctx,"scrollAdjust",this.appliedAdjust)),Le(this.ctx,"scrollAdjustPending",0),Ea(this.ctx)}}}};function cq(e,t){let n=e.state,o=ks(e,t),a=ks(e)-o;if(a!==0){let i=!!re(e,"isWithinMaintainScrollAtEndThreshold");Ps(e,n.scroll,!0,{markHasScrolled:!1}),!iR(e)&&i&&a>0&&Rs(e,a)}}function Ay(e){return $(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var uq=(...e)=>U(n=>{for(let o of e)o&&(qM(o)?o(n):o.current=n)},e);function fq(e){return null}function pq(e,t,n,o){return o}function mq(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 gq(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=re(e,"footerSize")||0;return Rm(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var hq="default";function vq(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||hq]={average:o.avg,count:o.num})}return t}function xq(e){Bm(e)}function yq(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:u3(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 _M(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);tM(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,()=>gq(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 Rm(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(),oR(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,Le(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),xq(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:re(e,"activeStickyIndex"),contentLength:eo(e),data:n.props.data,elementAtIndex:g=>{var v;return(v=e.viewRefs.get(Ny(e,Nt(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>vq(n),indexByKey:g=>n.indexByKey.get(g),isAtEnd:re(e,"isAtEnd"),isAtStart:re(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:re(e,"isNearEnd"),isNearStart:re(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:re(e,"isWithinMaintainScrollAtEndThreshold"),listen:(g,v)=>Aa(e,g,v),listenToPosition:(g,v)=>zK(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:jm(n),sizeAtIndex:g=>n.sizesKnown.get(Nt(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=VV(e,g);Ps(e,n.scroll,!0,{markHasScrolled:!1}),v&&iR(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?.(),tM(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(Rm(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?(Rm(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(Qm(e,g),!0)),setItemSize:(g,v)=>{hR(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=qM(g)?g(re(e,"scrollAdjustUserOffset")||0):g;Le(e,"scrollAdjustUserOffset",v)}}}var Cq=(e,t)=>e-t,TM=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,Jc=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function bq(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=TM(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Jc(i,s,f);let d=TM(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)Jc(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&Jc(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)&&(Jc(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++)Jc(i,s,p)}let c=Array.from(i);return c.sort(Cq),c}function Iq(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=re(e,"extraData"),f=a[l];if(s&&!nu(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 LM(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 Sq(e){var t;return e?e===!0?{...LM(void 0,!1),animated:!1}:{...LM(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function wq(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 Tq(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=re(e,"stylePaddingTop")||0;if(t<o){let r=re(e,"totalSize")||0;Le(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=re(e,"totalSize")||0,Le(e,"totalSize",r-o)},16)}Le(e,"stylePaddingTop",t)}}function Lq(e){let t=_(null),n=_(0),o=_(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return U((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 kq(e,t){let n=Lq("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var Pq=ta(vR(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(Wm(o)?o:_g.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Ce(OK,null,Ce(Aq,{...l,ref:n}))})),Aq=vR(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k;let T=U(O=>{},[]);t.recycleItems===void 0&&Ls("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:b,alwaysRender:S,columnWrapperStyle:A,contentContainerStyle:E,contentInset:B,data:R=[],dataKey:N,dataVersion:H,drawDistance:D=250,contentInsetEndAdjustment:W,estimatedItemSize:xe=100,estimatedListSize:ie,extraData:Q,getFixedItemSize:Ye,getItemType:Oe,horizontal:ke,rtl:Be,estimatedHeaderSize:Se,initialScrollAtEnd:ce=!1,initialScrollIndex:Ne,initialScrollOffset:ge,experimental_adaptiveRender:ee,itemsAreEqual:ye,keyExtractor:ct,ListEmptyComponent:ut,ListFooterComponent:lt,ListFooterComponentStyle:ft,ListHeaderComponent:zt,maintainScrollAtEnd:it=!1,maintainScrollAtEndThreshold:Pe=.1,maintainVisibleContentPosition:Re,numColumns:Fe=1,overrideItemLayout:Ze,onEndReached:we,onEndReachedThreshold:et=.5,onItemSizeChanged:ht,onMetricsChange:$t,onLayout:dn,onLoad:_t,onMomentumScrollEnd:Ht,onRefresh:Gt,onScroll:Dt,onScrollBeginDrag:oo,onStartReached:yn,onStartReachedThreshold:kn=.5,onStickyHeaderChange:Dn,onFirstVisibleItemChanged:kt,onViewableItemsChanged:Cn,progressViewOffset:St,recycleItems:ro=!1,refreshControl:cn,refreshing:F,refScrollView:J,renderScrollComponent:ae,renderItem:oe,scrollEventThrottle:le,snapToIndices:Je,stickyHeaderIndices:Ve,style:wt,useWindowScroll:vt=!1,viewabilityConfig:Yt,viewabilityConfigCallbackPairs:jt,...Ct}=t,fe=t.animatedPropsInternal,dt=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",rt=t.positionComponentInternal,Pt=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:ze,positionComponentInternal:bt,stickyPositionComponentInternal:un,...At}=Ct,Qt=cu.flatten(E),nn=L&&!ke&&Qt?.minHeight==null&&R.length>0,mn=L&&!nn&&(ke?Qt?.minWidth==null:Qt?.minHeight==null),Pn={...Qt,...L&&!nn?{display:"flex",flexDirection:ke?"row":"column",...mn?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},ao={...cu.flatten(wt)},io=Zc(ao,Pn,"Top"),Jt=Zc(ao,Pn,"Bottom"),te=Zc(ao,Pn,"Left"),Ge=Zc(ao,Pn,"Right"),xt=Vy({horizontal:ke,rtl:Be,stylePaddingBottom:Jt,stylePaddingLeft:te,stylePaddingRight:Ge}),tt=Sq(it),An=wq(Re),Zt=Ne!=null,on=ge!=null,rn=!ce&&!Zt&&!on&&Ky({horizontal:ke,rtl:Be}),Co=!ce&&!Zt&&(on||rn),an=ce||Zt,Lo=ce?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-xt,viewPosition:1}:Zt?typeof Ne=="object"?{index:(r=Ne.index)!=null?r:0,preserveForBottomPadding:Ne.viewOffset===void 0&&Ne.viewPosition===1?!0:void 0,viewOffset:(a=Ne.viewOffset)!=null?a:Ne.viewPosition===1?-xt:0,viewPosition:(i=Ne.viewPosition)!=null?i:0}:{index:Ne??0,viewOffset:ge??0}:Co?{contentOffset:ge??0,index:0,viewOffset:0}:void 0,[na,bn]=K(!Wy),[,bi]=Pi(O=>O+1,0),Ee=Lr();Ee.columnWrapperStyle=A||(Pn?mq(Pn):void 0);let Da=ke?(d=(s=Ee.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=Ee.columnWrapperStyle)==null?void 0:l.gap:(p=(c=Ee.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=Ee.columnWrapperStyle)==null?void 0:f.gap,oa=typeof Da=="number"&&Number.isFinite(Da)?Da:0,Ar=_(null),so=uq(Ar,J),Ut=ct??((O,Z)=>Z.toString()),On=Ve,Xt=W,Ii=_(Xt),en=$(()=>{let O=bq(S,R,Ut,b?.anchorIndex);return{arr:O,set:new Set(O)}},[b?.anchorIndex,S?.top,S?.bottom,(m=S?.indices)==null?void 0:m.join(","),(h=S?.keys)==null?void 0:h.join(","),R,N,H,Ut]),Er=!!vt&&!ae,Kt=_(void 0),In=!!Ze,En=_(In);if(!Kt.current){if(!Ee.state){let O=(ie??{height:0,width:0})[ke?"width":"height"];Ee.values.set("adaptiveRender",(g=ee?.initialMode)!=null?g:"normal"),Ee.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:Lo,initialScrollSession:Lo?{kind:Co?"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 lq,scroll:0,scrollAdjustHandler:new dq(Ee),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:O,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 Z=Ee.state;Z.triggerCalculateItemsInView=ve=>Ea(Ee,ve),Z.reprocessCurrentScroll=()=>Ps(Ee,Z.scroll,!0),Le(Ee,"maintainVisibleContentPosition",An),Le(Ee,"extraData",Q),Se!==void 0&&Le(Ee,"headerSize",Se)}Kt.current=Ee.state}let he=Kt.current,Yn=he.isFirst,ko=he.props.adaptiveRender,lo=he.props.numColumns,ra=!Yn&&Ee.scrollAxisGap!==oa;Ee.scrollAxisGap=oa,he.didColumnsChange=Fe!==lo||ra;let aa=(x=(v=he.props.data)==null?void 0:v.length)!=null?x:0,or=he.props.data!==R,Oo=he.props.dataKey!==N,Oa=he.props.dataVersion!==H,Fn=Oo||Oa||or&&tq(he,R,he.props.data),rr=!Yn&&Fn&&he.hasHadNonEmptyData&&(Oo||aa===0)&&R.length>0;Fn&&!ce&&he.didFinishInitialScroll&&((y=he.initialScroll)==null?void 0:y.viewPosition)===1&&he.props.data.length>0&&Vl(he),Fn&&(he.dataChangeEpoch+=1,he.dataChangeNeedsScrollUpdate=!0,he.didDataChange=!0,he.previousData=he.props.data),rr&&(he.freshDataTransitionEpoch+=1);let Mr=kq(Dt??T,le??0),Si=le&&Dt?Mr:Dt,Po=!Yn&&!Fn&&((C=he.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==b?.anchorIndex;he.props={adaptiveRender:ee,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:nn,alwaysRender:S,alwaysRenderIndicesArr:en.arr,alwaysRenderIndicesSet:en.set,anchoredEndSpace:b,anchoredEndSpaceOwner:dt,animatedProps:fe,contentContainerAlignItems:Pn.alignItems,contentInset:B,contentInsetEndAdjustment:Xt,data:R,dataKey:N,dataVersion:H,drawDistance:D,estimatedItemSize:xe,getFixedItemSize:Ay(Ye),getItemType:Ay(Oe),horizontal:!!ke,itemsAreEqual:ye,keyExtractor:Ay(Ut),maintainScrollAtEnd:tt,maintainScrollAtEndThreshold:Pe,maintainVisibleContentPosition:An,numColumns:Fe,onEndReached:we,onEndReachedThreshold:et,onFirstVisibleItemChanged:kt,onItemSizeChanged:ht,onLoad:_t,onMomentumScrollEnd:Ht,onScroll:Si,onScrollBeginDrag:oo,onStartReached:yn,onStartReachedThreshold:kn,onStickyHeaderChange:Dn,overrideItemLayout:Ze,positionComponentInternal:rt,recycleItems:!!ro,renderItem:oe,rtl:Be,snapToIndices:Je,stickyHeaderIndicesArr:On??[],stickyHeaderIndicesSet:$(()=>new Set(On??[]),[On?.join(",")]),stickyPositionComponentInternal:Pt,stylePaddingBottom:Jt,stylePaddingLeft:te,stylePaddingRight:Ge,stylePaddingTop:io,useWindowScroll:Er},he.refScroller=Ar,!Yn&&ko&&!ee&&Gy(Ee);let Fo=$(()=>R.length?Array.from({length:Math.min(Fe,R.length)},(O,Z)=>Nt(he,R.length-1-Z)):[],[R,N,H,Fe]),Rr=O=>{Le(Ee,"lastItemKeys",Fo),Le(Ee,"numColumns",Fe);let Z=re(Ee,"stylePaddingTop");Tq(Ee,{stylePaddingTop:io}),Kt.current.props.stylePaddingBottom=Jt,Ms(Ee);let ve=io-Z;O&&An.size&&ve&&Z!==void 0&&Ma.OS};Yn&&(Rr(!1),sR(he),dR(Ee,!0));let wi=$(()=>{var O,Z;let ve=he.initialScroll;if(!ve)return;let at=(O=ve.contentOffset)!=null?O:Tr(Ee,ve);return an&&((Z=he.initialScrollSession)==null?void 0:Z.kind)==="bootstrap"&&Ma.OS==="web"?void 0:at},[an]);Me(()=>{g4(Ee,{alwaysDispatchInitialScroll:rn,dataLength:R.length,hasFooterComponent:!!lt,initialContentOffset:wi,initialScrollAtEnd:ce,useBootstrapInitialScroll:an})},[]),(Yn||Fn||he.didColumnsChange)&&(Kt.current.lastBatchingAction=Date.now(),!ct&&!Yn&&Fn&&(Kt.current.sizes.clear(),Kt.current.positions.length=0,Kt.current.totalSize=0,Le(Ee,"totalSize",0))),_o&&ZV(t),Me(()=>{rr&&Qy(Ee,{resetInitialScroll:!!Lo,resetLayout:!0}),h4(Ee,{dataLength:R.length,didDataChange:Fn,didStartFreshData:rr,initialScrollAtEnd:ce,latestInitialScroll:Lo,latestInitialScrollSessionKind:Co?"offset":"bootstrap",stylePaddingEnd:xt,useBootstrapInitialScroll:an})},[R.length,N,Fn,rr,ce,xt,an]),Me(()=>{var O;Po&&(he.scrollForNextCalculateItemsInView=void 0,(O=he.triggerCalculateItemsInView)==null||O.call(he)),zm(Ee)},[Ee,R,H,b?.anchorIndex,b?.anchorMaxSize,b?.anchorOffset,Po,ke,Fe,Be,Jt,te,Ge]),Me(()=>{let O=Ii.current;Ii.current=Xt,cq(Ee,O)},[Ee,Xt]);let ar=U(O=>{an&&J3(Ee,{dataLength:R.length,footerSize:O[ke?"width":"height"],initialScrollAtEnd:ce,stylePaddingEnd:xt})},[R.length,ce,ke,xt,an]),ia=U((O,Z)=>{let ve=he.scrollLength,at=he.otherAxisSize;oq(Ee,O,bn),zm(Ee);let Bn=ve!==he.scrollLength||at!==he.otherAxisSize;an&&!Z&&Bn&&Z3(Ee),!an&&su(Ee)},[R.length,ce,xt,an]),{onLayout:Yl}=rC({onLayoutChange:ia,onLayoutProp:dn,ref:Ar});Me(()=>{Je&&lR(Ee)},[Je]),Me(()=>Rr(!0),[N,H,Fo.join(","),Fe,oa,Jt,io,nn]),Me(()=>{let{didColumnsChange:O,didDataChange:Z,isFirst:ve,props:{data:at}}=he;!(at.length>0&&SR(Ee))&&!ve&&(Z||O)&&eq(Ee,at,{didColumnsChange:O}),Z&&(he.pendingDataComparison=void 0),he.didColumnsChange=!1,he.didDataChange=!1,he.isFirst=!1},[R,N,H,Fe,oa]),Me(()=>{var O;Le(Ee,"extraData",Q);let Z=En.current!==In;En.current=In,(In||Z)&&Fe>1&&((O=he.triggerCalculateItemsInView)==null||O.call(he,{forceFullItemPositions:!0}))},[Q,In,Fe]),V(()=>{if(!$t)return;let O,Z=()=>{let at={footerSize:re(Ee,"footerSize")||0,headerSize:re(Ee,"headerSize")||0};(!O||at.headerSize!==O.headerSize||at.footerSize!==O.footerSize)&&(O=at,$t(at))};Z();let ve=[Aa(Ee,"headerSize",Z),Aa(Ee,"footerSize",Z)];return()=>{for(let at of ve)at()}},[Ee,$t]),V(()=>{let O=I4({onViewableItemsChanged:Cn,viewabilityConfig:Yt,viewabilityConfigCallbackPairs:jt});he.viewabilityConfigCallbackPairs=O,he.enableScrollForNextCalculateItemsInView=!0,O&&(he.scrollForNextCalculateItemsInView=void 0)},[Yt,jt,Cn]),eV(()=>{}),Br(n,()=>yq(Ee,bi),[]),V(()=>()=>{QK(he),he.scheduledWork.dispose()},[he]),Me(()=>{var O;(O=he.runPendingScrollToEnd)==null||O.call(he)}),V(()=>{an||su(Ee)},[Ee,an]);let ir=$(()=>({getRenderedItem:O=>Iq(Ee,O),onMomentumScrollEnd:O=>{p4(Ee),he.props.onMomentumScrollEnd&&he.props.onMomentumScrollEnd(O)},onScroll:O=>sq(Ee,O),onScrollBeginDrag:O=>{var Z,ve;JE(Ee),(ve=(Z=he.props).onScrollBeginDrag)==null||ve.call(Z,O)},onScrollEnd:()=>JE(Ee)}),[]),Ds=pq(On,ke,Ee,ir.onScroll),Nr=cn;return Ce(Ha,null,Ce(GV,{...At,alignItemsAtEnd:L,canRender:na,contentContainerStyle:Pn,contentInset:B,freshDataTransitionEpoch:he.freshDataTransitionEpoch,getRenderedItem:ir.getRenderedItem,horizontal:ke,initialContentOffset:wi,ListEmptyComponent:R.length===0?ut:void 0,ListFooterComponent:lt,ListFooterComponentStyle:ft,ListHeaderComponent:zt,onInternalScrollBeginDrag:ir.onScrollBeginDrag,onInternalScrollEnd:ir.onScrollEnd,onLayout:Yl,onLayoutFooter:ar,onMomentumScrollEnd:ir.onMomentumScrollEnd,onScroll:Ds,recycleItems:ro,refreshControl:Nr?io>0?Bu(Nr,{progressViewOffset:((w=Nr.props.progressViewOffset)!=null?w:0)+io}):Nr:Gt&&Ce(fq,{onRefresh:Gt,progressViewOffset:(St||0)+io,refreshing:!!F}),refScrollView:so,renderScrollComponent:ae,scrollAdjustHandler:(k=Kt.current)==null?void 0:k.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:Je,stickyHeaderIndices:On,style:ao,useWindowScroll:Er}),_o&&jK)});var Eq=Pq;var wR=Eq;ue();ue();function Mq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rq(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${Mq(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function aC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return Rq(n,e.subProvider)}function Gl(e){return aC(e,{preferShortName:!0})}var iC="model:",sC="legacy-models:",lC="action:",jl="pluginActions:manage";function fu(e,t){return`${iC}${e.length}:${e}${t}`}function cC(e){if(!e.startsWith(iC))return null;let t=e.slice(iC.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`${sC}${e}`}function TR(e){return e.startsWith(sC)?e.slice(sC.length):null}function pu(e){return`${lC}${e}`}function LR(e){if(!e.startsWith(lC))return null;let t=e.slice(lC.length);return t.length>0?t:null}var dC="choice:";function fC(e){return`${dC}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function kR(e){if(!e.startsWith(dC))return null;try{let t=JSON.parse(e.slice(dC.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 PR=de(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=I(el,{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:z("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:[I("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?Gl(t.model):aC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&I("div",{className:"mt-1 flex items-center gap-1.5",children:[u(fa,{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})]})]}),I("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(df,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,I(je,{children:[u(Xe,{render:u(ne,{size:"icon-xs",variant:"ghost",className:z("-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(Vi,{className:z("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Qe,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?I(je,{children:[u(Xe,{render:a}),u(Qe,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});function Jm(e){return e==="ready"}function AR(e){return e==="ready"||e==="unchecked"||e==="checking"}function ER(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 mu(e){return e.enabled&&AR(e.readiness)}function MR(e){return e.enabled}function RR(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 Zm=e=>e.enabled;function eg(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&Zm(n))return n}return e.find(n=>n.enabled&&Jm(n.readiness))??e.find(mu)??e.find(n=>Zm(n)&&n.readiness!=="error")}function NR(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}ue();function Nq(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(Jm(o))return n;let r=ER(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 _q="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",Dq="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 ",Oq=`${Dq} text-update-foreground`,_R="left",DR=8,OR="max-w-64 text-balance font-normal leading-snug",FR=de(function(t){let{t:n}=_e(),{t:o}=_e(),r=Mt().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=K(null),d=_(null),[c,f]=K(null);return Me(()=>{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:I("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:z(_q,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?I(pe,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:I(je,{children:[u(Xe,{render:u("button",{className:z("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(Vi,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Qe,{side:_R,sideOffset:DR,align:"center",className:OR,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!mu(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?Nq(p,o):h?t.getDisabledInstanceTooltip?.(p)??p.displayName:y?`${p.displayName} \u2014 ${C}`:p.displayName,k=I("button",{className:z("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(fa,{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:Oq,"aria-hidden":!0,children:u(Qu,{className:"size-2.5"})}):null]}),T=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:I(je,{children:[u(Xe,{render:T}),I(Qe,{side:_R,sideOffset:DR,align:"center",className:OR,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function no(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function Fq(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 pC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function Bq(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+pC(t,n);if(e.boundaryBase!==void 0){let o=Bq(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+pC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+pC(t,n)}if(e.fuzzyBase!==void 0){let o=Fq(t,n);if(o!==null)return e.fuzzyBase+o}return null}function zq(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function $q(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;zq(t,a)<0?o=r:n=r+1}return n}function tg(e,t,n){if(n<=0)return;let o=$q(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var Hq=24;function Uq(e){return[no(e.name),...e.shortName?[no(e.shortName)]:[],...e.subProvider?[no(e.subProvider)]:[],no(e.driverKind),no(e.providerDisplayName),...e.providerAccountEmail?[no(e.providerAccountEmail)]:[],mC(e),...e.slug?[no(e.slug)]:[]]}function Kq(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 mC(e){return no([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function BR(e,t){let n=no(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=Kq(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function zR(e,t){let n=BR(Uq(e),t);return n===null?null:e.isFavorite?n-Hq:n}function $R(e,t){return BR([no(e.title),no(e.description??"")],t)}function HR({top:e,bottom:t}){if(!(!e&&!t))return z("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 ng(e,t){return`${e}:${t}`}var UR=new Map,KR=[],Vq=[],qq=[];function gu(e){return e.choiceKey??fu(e.instanceId,e.slug)}function VR(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 Wq(){return u("div",{className:"h-0.5"})}function gC(e){return e?.trim()||null}function qR({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 Gq=de(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=_e(),i=gC(o.description);return I(pe,{children:[r?u(qR,{label:a("modelPicker.plugins")}):null,I(el,{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(Hi,{className:"size-4 shrink-0 text-muted-foreground/70"}),I("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})]})]})]})}),jq=de(function({index:t,showSectionHeader:n}){let{t:o}=_e();return I(pe,{children:[n?u(qR,{label:o("modelPicker.plugins")}):null,I(el,{hideIndicator:!0,index:t,value:jl,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(ud,{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")})]})]})}),WR=de(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??KR,g=t.selectedPluginActionKey??null,{t:v}=_e(),{t:x}=_e(),y=Mt(),[C,w]=K(""),[k,T]=K(!1),[L,b]=K(!1),S=_(null),A=_(null),E=_(null),B=y.environment.useActiveEnvironmentId(),R=y.settings.useClientSettings(F=>F.favorites??[]),N=$(()=>B===null?qq:R.filter(F=>F.environmentId===B),[B,R]),[H,D]=K(()=>t.lockedProvider!==null?t.activeInstanceId:N.length>0?"favorites":t.activeInstanceId),[W,xe]=K(()=>new Set(o.get(t.activeInstanceId)?.some(F=>F.slug===t.model&&F.isLegacy)?[t.activeInstanceId]:[])),ie=$(()=>n??[],[n]),Q=y.settings.useUpdateClientSettings(),Ye=U(()=>{S.current?.focus({preventScroll:!0})},[]),Oe=U(F=>{D(F),window.requestAnimationFrame(()=>{Ye()})},[Ye]);Me(()=>{Ye();let F=window.requestAnimationFrame(()=>{Ye()}),J=window.setTimeout(()=>{Ye()},0);return()=>{window.cancelAnimationFrame(F),window.clearTimeout(J)}},[Ye]);let ke=$(()=>new Set(N.map(F=>ng(F.instanceId,F.model))),[N]),Be=U(F=>B===null?!1:N.some(J=>VR(F,J,B)),[B,N]),Se=$(()=>new Map(r.map(F=>[F.instanceId,F])),[r]),ce=U(F=>t.lockedProvider===null?!0:F.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?F.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),Ne=$(()=>{let F=new Set;for(let J of r)mu(J)&&F.add(J.instanceId);return F},[r]),ge=$(()=>{let F=[];for(let[J,ae]of o){let oe=Se.get(J);if(oe&&Ne.has(J))for(let le of ae)F.push({slug:le.slug,name:le.name,...le.shortName?{shortName:le.shortName}:{},...le.subProvider?{subProvider:le.subProvider}:{},...le.isLegacy?{isLegacy:!0}:{},instanceId:J,driverKind:oe.driverKind,providerId:oe.providerId,instanceDisplayName:oe.displayName,...oe.accentColor?{instanceAccentColor:oe.accentColor}:{},...oe.accountEmail?{instanceAccountEmail:oe.accountEmail}:{},...oe.continuationGroupKey?{continuationGroupKey:oe.continuationGroupKey}:{}})}if(c&&c.length>0){let J=new Set,ae=[];for(let le of c){let Je=le.legacyInstanceId;if(!Je||!Ne.has(Je))continue;let Ve=Se.get(Je);if(!Ve)continue;let vt=o.get(Je)?.find(jt=>jt.slug===le.modelId),Yt=fC({environmentId:le.selection.environmentId,runtimeId:le.runtimeId,sourceId:le.sourceId,profileId:le.profileId,endpointId:le.endpointId});J.add(ng(Je,le.modelId)),ae.push({slug:le.modelId,name:vt?.name??le.modelLabel,...vt?.shortName?{shortName:vt.shortName}:{},instanceId:Je,driverKind:Ve.driverKind,providerId:Ve.providerId,instanceDisplayName:Ve.displayName,...Ve.accentColor?{instanceAccentColor:Ve.accentColor}:{},...Ve.accountEmail?{instanceAccountEmail:Ve.accountEmail}:{},...Ve.continuationGroupKey?{continuationGroupKey:Ve.continuationGroupKey}:{},runtimeId:le.runtimeId,sourceId:le.sourceId,sourceLabel:le.sourceLabel,profileId:le.profileId,ready:le.ready,...le.reasonCode?{reasonCode:le.reasonCode}:{},choiceKey:Yt})}let oe=F.filter(le=>!J.has(ng(le.instanceId,le.slug)));return[...ae,...oe]}return F},[c,o,Se,Ne]),ee=t.lockedProvider!==null,ye=C.trim().length>0,ct=$(()=>{if(!ee)return;let F=new Set;for(let J of r)ce(J)||F.add(J.instanceId);return F},[r,ee,ce]),ut=$(()=>{let F=r.filter(MR);if(!ee)return F;let J=[],ae=[];for(let oe of F)ce(oe)?J.push(oe):ae.push(oe);return[...J,...ae]},[r,ee,ce]),lt=!ye&&ut.length>0,ft=$(()=>r.map(F=>F.instanceId),[r]),zt=$(()=>{let F=ge;if(C.trim()){let J=F.map(ae=>({model:ae,score:zR({name:ae.name,...ae.shortName?{shortName:ae.shortName}:{},...ae.subProvider?{subProvider:ae.subProvider}:{},driverKind:ae.driverKind,providerDisplayName:ae.instanceDisplayName,...ae.instanceAccountEmail?{providerAccountEmail:ae.instanceAccountEmail}:{},isFavorite:Be(ae)},C),isFavorite:Be(ae),tieBreaker:mC({name:ae.name,...ae.shortName?{shortName:ae.shortName}:{},...ae.subProvider?{subProvider:ae.subProvider}:{},driverKind:ae.driverKind,providerDisplayName:ae.instanceDisplayName,...ae.instanceAccountEmail?{providerAccountEmail:ae.instanceAccountEmail}:{}})})).filter(ae=>ae.score!==null);if(t.lockedProvider!==null){let ae=[];for(let oe of J)ce(oe.model)&&ae.push(oe);return ae.toSorted((oe,le)=>{let Je=oe.score-le.score;return Je!==0?Je:oe.isFavorite!==le.isFavorite?oe.isFavorite?-1:1:oe.tieBreaker.localeCompare(le.tieBreaker)}).map(oe=>oe.model)}return J.toSorted((ae,oe)=>{let le=ae.score-oe.score;return le!==0?le:ae.isFavorite!==oe.isFavorite?ae.isFavorite?-1:1:ae.tieBreaker.localeCompare(oe.tieBreaker)}).map(ae=>ae.model)}return t.lockedProvider!==null?(F=F.filter(J=>ce(J)),H==="favorites"?F=F.filter(J=>Be(J)):F=F.filter(J=>J.instanceId===H)):H==="favorites"?F=F.filter(J=>Be(J)):F=F.filter(J=>J.instanceId===H),y.model.sortProviderModelItems(F,{favoriteModelKeys:ke,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?ft:[]})},[ke,ge,ft,ce,t.lockedProvider,C,H,Be]),it=$(()=>{if(ye||H==="favorites")return null;let F=zt.filter(ae=>!ae.isLegacy),J=zt.filter(ae=>ae.isLegacy);return J.length===0?null:{key:uC(H),currentModels:F,legacyModels:J,isExpanded:W.has(H)}},[W,zt,ye,H]),Pe=$(()=>it?[...it.currentModels,...it.isExpanded?it.legacyModels:[]]:zt,[zt,it]),Re=m!==void 0,Fe=$(()=>{if(!Re)return KR;let F=C.trim();return F.length===0?h:h.map(J=>({action:J,score:$R(J,F)})).filter(J=>J.score!==null).toSorted((J,ae)=>J.score-ae.score||J.action.title.localeCompare(ae.action.title)).map(J=>J.action)},[C,h,Re]),Ze=Re&&(!ye||Fe.length>0),we=$(()=>Ze?[...Fe.map(F=>pu(F.id)),jl]:Vq,[Ze,Fe]),et=$(()=>new Map(Fe.map(F=>[pu(F.id),F])),[Fe]),ht=we[0]??null,$t=U(F=>{xe(J=>{let ae=new Set(J);return ae.has(F)?ae.delete(F):ae.add(F),ae})},[]),dn=U((F,J)=>y.model.resolvePickerRowAction({disabledReason:a?.(F,J)??null,continuationLabel:s?i?.(F,J)??null:null}),[i,a,s]),_t=U((F,J)=>{let ae=dn(J,F);if(ae.kind==="blocked")return;if(ae.kind==="continue"){s?.(J,F);return}let oe=o.get(J);if(!oe)return;let le=Se.get(J);if(!le)return;let Je=y.model.resolveSelectableModel(le.driverKind,F,oe);Je&&l(J,Je)},[Se,o,s,l,dn]),Ht=U(F=>{let J=TR(F);if(J){$t(J);return}if(F===jl){p?.();return}let ae=LR(F);if(ae!==null){m?.(ae);return}let oe=kR(F);if(oe){let Je=c?.find(Ve=>Ve.selection.environmentId===oe.environmentId&&Ve.runtimeId===oe.runtimeId&&Ve.sourceId===oe.sourceId&&Ve.profileId===oe.profileId&&(Ve.endpointId??void 0)===(oe.endpointId??void 0));if(!Je||!Je.legacyInstanceId)return;if(d){d(Je);return}_t(Je.modelId,Je.legacyInstanceId);return}let le=cC(F);le&&_t(le.slug,le.instanceId)},[c,_t,d,p,m,$t]),Gt=U(F=>{if(B===null)return;let J=R.findIndex(oe=>VR(F,oe,B)),ae=[...R];J>=0?ae.splice(J,1):ae.push({environmentId:B,instanceId:F.instanceId,model:F.slug,...F.runtimeId?{runtimeId:F.runtimeId}:{},...F.sourceId?{sourceId:F.sourceId}:{},...F.profileId?{profileId:F.profileId}:{}}),Q({favorites:ae})},[B,R,Q]),Dt=$(()=>{let F=new Map,J=0;for(let ae of Pe){if(ae.ready===!1||dn(ae.instanceId,ae.slug).kind==="blocked")continue;let oe=y.keybindings.modelPickerJumpCommandForIndex(J);if(!oe)return F;F.set(gu(ae),oe),J+=1}return F},[dn,Pe]),oo=$(()=>[...Dt.keys()],[Dt]),yn=$(()=>[...ge.map(F=>gu(F)),...new Set(ge.filter(F=>F.isLegacy).map(F=>uC(F.instanceId))),...Re?[...h.map(F=>pu(F.id)),jl]:[]],[ge,h,Re]),kn=$(()=>{let F=Pe.map(J=>gu(J));return it&&F.splice(it.currentModels.length,0,it.key),we.length>0?[...F,...we]:F},[it,we,Pe]),Dn=$(()=>new Map(Pe.map(F=>[gu(F),F])),[Pe]),kt=U(()=>{let F=A.current?.getScrollableNode();if(!(F instanceof HTMLElement))return;let J=Math.max(0,F.scrollHeight-F.clientHeight);T(F.scrollTop>1),b(J-F.scrollTop>1)},[]),Cn=$(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),St=$(()=>{if(Dt.size===0)return UR;let F={platform:navigator.platform,context:Cn},J=new Map;for(let[ae,oe]of Dt){let le=y.keybindings.shortcutLabelForCommand(ie,oe,F);le&&J.set(ae,le)}return J.size>0?J:UR},[ie,Dt,Cn]),ro=g===null?f?fC(f):fu(t.activeInstanceId,t.model):pu(g),cn=$(()=>({favoritesSet:ke,modelJumpLabelByKey:St,selectedItemKey:ro}),[ke,St,ro]);return y.pane.useKeydown(F=>{if(F.defaultPrevented||F.repeat)return;let J=y.keybindings.resolveShortcutCommand(F,ie,{platform:navigator.platform,context:Cn}),ae=y.keybindings.modelPickerJumpIndexFromCommand(J??"");if(ae===null)return;let oe=oo[ae];if(!oe)return;let le=cC(oe);le&&(F.preventDefault(),F.stopPropagation(),_t(le.slug,le.instanceId))},{capture:!0}),Me(()=>{T(!1),b(kn.length>5);let F=0,J=window.requestAnimationFrame(()=>{kt(),F=window.requestAnimationFrame(kt)});return()=>{window.cancelAnimationFrame(J),window.cancelAnimationFrame(F)}},[kn,kt]),u(II,{delay:0,children:I("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(FR,{selectedInstanceId:H,onSelectInstance:Oe,instanceEntries:ut,showFavorites:!0,...ct?{disabledInstanceIds:ct,getDisabledInstanceTooltip:F=>x("instance.lockedToThread",{name:F.displayName})}:{}}),u(xI,{inline:!0,items:yn,filteredItems:kn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:ro,onItemHighlighted:(F,J)=>{E.current=typeof F=="string"?F:null,J.reason==="keyboard"&&J.index>=0&&A.current?.scrollIndexIntoView?.({index:J.index,animated:!1})},onValueChange:F=>{typeof F=="string"&&Ht(F)},children:I("div",{className:z("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(CI,{ref:S,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(Ki,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:C,onChange:F=>w(F.target.value),onKeyDown:F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),t.onRequestClose?.();return}if(F.key==="Enter"&&E.current){F.preventBaseUIHandler?.(),F.preventDefault(),F.stopPropagation(),Ht(E.current);return}F.stopPropagation()},onMouseDown:F=>F.stopPropagation(),onTouchStart:F=>F.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(bI,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(wR,{ref:A,data:kn,extraData:cn,keyExtractor:F=>F,renderItem:({item:F,index:J})=>{if(it?.key===F)return I(el,{hideIndicator:!0,index:J,value:F,"aria-expanded":it.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[I("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:it.legacyModels.length})})]}),u(Eo,{className:z("size-4 transition-transform",it.isExpanded&&"rotate-90")})]});let ae=et.get(F);if(ae)return u(Gq,{index:J,itemKey:F,action:ae,showSectionHeader:F===ht});if(F===jl)return u(jq,{index:J,showSectionHeader:F===ht});let oe=Dn.get(F);if(!oe)return null;let le=oe.ready===!1?{kind:"blocked",reason:v("modelPicker.notReady")}:dn(oe.instanceId,oe.slug);return u(PR,{index:J,model:oe,instanceId:oe.instanceId,itemKey:gu(oe),sourceLabel:oe.sourceLabel,providerId:oe.providerId,providerDisplayName:oe.instanceDisplayName,providerAccentColor:oe.instanceAccentColor,providerAccountEmail:oe.instanceAccountEmail,isFavorite:Be(oe),isSelected:F===ro,showProvider:!0,preferShortName:!ee,useTriggerLabel:!1,jumpLabel:St.get(F)??null,disabledReason:le.kind==="blocked"?le.reason:null,actionLabel:le.kind==="continue"?le.label:null,onToggleFavorite:()=>Gt(oe)},F)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:Wq,onLayout:kt,onScroll:kt,className:z("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",HR({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 GR="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 Pr({className:e,size:t="sm",variant:n="ghost",...o}){return u(ne,{className:z(GR,e),size:t,variant:n,...o})}function nr({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:z("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function Ci(){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 og({className:e,size:t="sm",variant:n="ghost",...o}){return u(nI,{className:z(GR,e),icon:u(Ci,{}),size:t,variant:n,...o})}function Qq(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?Gl(o):e.model}function Xq(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 jR=de(function(t){let{t:n}=_e(),[o,r]=K(!1),a=t.open??o,i=$(()=>t.instanceEntries.find(y=>y.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),s=t.activeInstanceId,l=t.modelOptionsByInstance.get(s)??[],d=Xq(t.composerChoices,t.selectedExecutionSelection),c=Qq({model:t.model,catalogOptions:l,profileLabel:d?.modelLabel,profileModelId:d?.modelId}),f=y=>{t.onOpenChange?.(y),t.open===void 0&&r(y)};V(()=>{if(!a)return;let{documentElement:y,body:C}=document,w=y.style.overscrollBehavior,k=C.style.overflow,T=C.style.paddingRight,L=window.innerWidth-y.clientWidth;y.style.overscrollBehavior="contain",C.style.overflow="hidden",L>0&&(C.style.paddingRight=`${L}px`);let b=E=>E instanceof Element&&E.closest("[data-model-picker-content]"),S=E=>{b(E.target)||E.preventDefault()},A=E=>{b(E.target)||E.preventDefault()};return document.addEventListener("wheel",S,{capture:!0,passive:!1}),document.addEventListener("touchmove",A,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",S,{capture:!0}),document.removeEventListener("touchmove",A,{capture:!0}),y.style.overscrollBehavior=w,C.style.overflow=k,C.style.paddingRight=T}},[a]);let p=(y,C)=>{t.disabled||(t.onInstanceModelChange(y,C),f(!1))},m=(y,C)=>{t.disabled||(t.onContinueInModel?.(y,C),f(!1))},h=y=>{t.disabled||(t.onSelectPluginAction?.(y),f(!1))},g=()=>{t.onManagePlugins?.(),f(!1)},v=t.selectedPluginActionKey==null?null:t.pluginActions?.find(y=>y.id===t.selectedPluginActionKey)??null,x=v?gC(v.description):null;return I(Ys,{open:a,onOpenChange:y=>{if(t.disabled){f(!1);return}f(y)},children:[I(Zs,{render:u(Pr,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:z("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:v?I(pe,{children:[u(Hi,{className:"size-4 shrink-0"}),I(je,{children:[I(Xe,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:v.title}),x?I("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",x]}):null]}),u(Qe,{side:"top",children:x?`${v.title} \xB7 ${x}`:v.title})]})]}):I(pe,{children:[i?u(fa,{providerId:i.providerId,displayName:i.displayName,accentColor:i.accentColor,className:z("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,I(je,{children:[u(Xe,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:t.sourceLabel?`${t.sourceLabel} \xB7 ${c}`:c}),u(Qe,{side:"top",children:t.executionAppliesTo==="next-message"?`${n("modelPicker.nextMessage")}: ${t.sourceLabel?`${t.sourceLabel} \xB7 ${c}`:c}`:t.sourceLabel?`${t.sourceLabel} \xB7 ${c}`:c})]}),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(Ci,{})})]}),u(Js,{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(WR,{activeInstanceId:s,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:()=>f(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:m}:{},onInstanceModelChange:p,...t.composerChoices?{composerChoices:t.composerChoices}:{},selectedExecutionSelection:t.selectedExecutionSelection??null,...t.onClearExecutionSelection?{onClearExecutionSelection:()=>{t.onClearExecutionSelection?.(),f(!1)}}:{},...t.onChooseExecution?{onChooseExecution:y=>{t.disabled||(t.onChooseExecution?.(y),f(!1))}}:{},...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:h}:{},...t.onManagePlugins?{onManagePlugins:g}:{}})})]})});ue();var QR=de(function(t){let n=_(null);return Me(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(cf,{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(pf,{className:"max-h-72 scroll-pb-6",children:u(uf,{children:t.items.map(o=>u(Yq,{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.")})})})})}),Yq=de(function(t){let n=t.item.type==="skill"?EE(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return I(ff,{value:t.item.id,"data-composer-item-id":t.item.id,className:z("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(wm,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,I("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?I(pe,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),ea(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(eW,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),Jq={app:pd,repo:Va,project:Va,personal:Ur,system:Rd,other:Pd},Zq={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function eW(e){let t=Jq[e.kind];return I(Xs,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),Zq[e.kind],e.showSkillSuffix?" Skill":null]})}ue();function tW(e){return e!==null&&"tagName"in e&&"closest"in e}function rg(e){return tW(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function hC(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function XR(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function YR(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return XR(t,"accept");case"Escape":return XR(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=hC(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var nW=2e3,oW="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",rW=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function aW(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 vC=de(function({requestId:t,isResponding:n,options:o=rW,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=_e(),l=Mt(),d=a==="native"||a==="queued",[c,f]=K(""),p=_([]);V(()=>{f("")},[t]);let m=U(g=>{let v=g==="decline"?c.trim():"";i(t,g,v.length>0?v:void 0)},[c,i,t]),h=U(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=rg(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=YR(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(pe,{children:o.map((g,v)=>{let x=v<9?v+1:null,y=I(ne,{ref:C=>{p.current[v]=C},size:"xs",variant:g.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":aW(g.decision,v),className:`${oW}${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(df,{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:I(Ha,{children:[u(ju,{type:"text",value:c,disabled:n,maxLength:nW,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)})})});ue();ue();var ag=["approval-required","auto-accept-edits","auto","full-access"];var iW={"approval-required":Ld,"auto-accept-edits":Hr,auto:Wa,"full-access":qa},sW={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function ig(){let{t:e}=_e();return U(t=>{let n=sW[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:iW[t]}},[e])}var JR=de(function(t){let{t:n}=_e(),o=ig();return I(Ko,{children:[u(Wo,{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(Uo,{"aria-hidden":"true",className:"size-4"})}),I(qo,{align:"start",children:[t.traitsMenuContent?I(pe,{children:[t.traitsMenuContent,u(Ga,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?I(pe,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Mode"}),I(pa,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(dr,{value:"default",children:"Chat"}),u(dr,{value:"plan",children:"Plan"})]}),u(Ga,{})]}):null,t.nativeMode===null?I(pe,{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:ag.map(r=>u(dr,{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]}):I(pe,{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(dr,{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})]})]})]})});ue();var lW=(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"),dW=e=>{e.preventDefault()},sg=de(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=Mt(),C=p?{onPointerDown:dW}:void 0,w=y.settings.useEnvironmentIdentificationMode(),k=s!==null,T=y.devBackdrop.useVisible(w==="artwork"),L=S=>u("button",{type:"button",className:z("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",S?"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 I("div",{className:z("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(Ri,{})}):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:z("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:lW(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(r)return a?u(ne,{type:"submit",size:"sm",className:z("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")}):I("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")}),I(Ko,{children:[u(Wo,{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(qo,{align:"end",side:"top",children:u(Vo,{disabled:i||k||l||d,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let b=I("button",{type:"submit",className:z("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",T?"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:[T?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(wI,{compact:!0})}):null,l||i?u(Qu,{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?I(pe,{children:[L(!1),m&&f?b:null]}):b});ue();var cW=["command","cmd"],uW=["file_path","filePath","path","notebook_path","notebookPath"],fW=["url"],pW=["query","q"],mW=["name","skill","skill_name","skillName"],ZR=["toolName","tool_name"],eN=["description"],gW=[],hW=[];function _a(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 vW(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function xW(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function nN(e){let t=e.args??gW,n=e.fileChanges??hW,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=_a(t,cW,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=_a(t,uW,o)??xW(n);d!==null&&(i=vW(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=_a(t,fW,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=_a(t,pW,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=_a(t,mW,o)??_a(t,ZR,o),l=_a(t,eN,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=_a(t,ZR,o),l=_a(t,eN,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 yW={"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"},CW={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"},bW={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"},IW={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function oN(e,t){let n=e.subject!==null?yW[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(CW[e.kind])}function rN(e,t){return t(bW[e])}function aN(e,t){return t(IW[e])}function iN(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=tN(t.oldText??""),o=tN(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3709
+ `?d.insertParagraph():c===" "?d.insertNodes([tP()]):d.insertText(c)}}}else t.insertRawText(i)}function $y(e,t,n){e.dispatchCommand(GP,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Ie(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=Yl(r,"previous");if(i)if(rm(i))a=i.origin;else{let s=oP(i,Ri(Ct(),"next").getFlipped());for(let l of s){if(ot(l.origin)){a=l.origin;break}if(qe(l.origin)&&!l.origin.isInline())break}}if(a&&ot(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 VA(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=qe(n)&&n.excludeFromCopy("html"),i=n;t!==null&&ot(i)&&(i=Em(t,i,"clone"));let s=qe(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Um(58,f.name),qe(d)){let p=c.children;Array.isArray(p)||Um(59,f.name)}return c})(i);ot(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=VA(e,t,c,l.children);!r&&qe(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 WA(e,t){let n=[],o=Ct().getChildren();for(let r=0;r<o.length;r++)VA(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function GA(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=gP(o);ot(r)&&wE(r),t.push(r)}return t}var ad=null;async function E3(e,t,n){if(ad!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(UA(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=Qx(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(dm,p=>(lu(p,ClipboardEvent)&&(f(),ad!==null&&(r.clearTimeout(ad),ad=null),d(UA(e,p,n))),!0),lm);ad=r.setTimeout(()=>{f(),ad=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function UA(e,t,n){if(n===void 0){let r=Qx(e._window),a=Fe();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!sE(e,i,s))return!1;n=QA(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(XA(o,n),!0)}var jA=[["text/html",KA],["application/x-lexical-editor",qA]];function QA(e=Fe()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=em();for(let[o,r]of jA){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function XA(e,t){for(let[n]of jA)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var la=Hy,gie=la.$generateJSONFromSelectedNodes,hie=la.$generateNodesFromSerializedNodes,vie=la.$getClipboardDataFromSelection,YA=la.$getHtmlContent,xie=la.$getLexicalContent,Uy=la.$insertDataTransferForPlainText,yie=la.$insertDataTransferForRichText,Cie=la.$insertGeneratedNodes,bie=la.copyToClipboard,Iie=la.setLexicalClipboardDataTransfer;var Ky={};Mn(Ky,{PlainTextExtension:()=>O3,registerPlainText:()=>eM});var zs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,A3=zs&&"documentMode"in document?document.documentMode:null,M3=zs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),R3=!(!zs||!("InputEvent"in window)||A3)&&"getTargetRanges"in new window.InputEvent("input"),N3=zs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),JA=zs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_3=zs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),D3=zs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&M3&&!_3;function ZA(e,t){t.update(()=>{if(e!==null){let n=lu(e,KeyboardEvent)?null:e.clipboardData,o=Fe();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=YA(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function eM(e){return za(e.registerCommand(cm,t=>{let n=Fe();return!!Ie(n)&&(n.deleteCharacter(t),!0)},Zt),e.registerCommand(PP,t=>{let n=Fe();return!!Ie(n)&&(n.deleteWord(t),!0)},Zt),e.registerCommand(kP,t=>{let n=Fe();return!!Ie(n)&&(n.deleteLine(t),!0)},Zt),e.registerCommand(TP,t=>{let n=Fe();if(!Ie(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Uy(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Zt),e.registerCommand(VP,()=>{let t=Fe();return!!Ie(t)&&(t.removeText(),!0)},Zt),e.registerCommand(jx,t=>{let n=Fe();return!!Ie(n)&&(n.insertLineBreak(t),!0)},Zt),e.registerCommand(_P,()=>{let t=Fe();return!!Ie(t)&&(t.insertLineBreak(),!0)},Zt),e.registerCommand(fm,t=>{let n=Fe();if(!Ie(n))return!1;let o=t,r=o.shiftKey;return!!dy(n,!0)&&(o.preventDefault(),ly(n,r,!0),!0)},Zt),e.registerCommand(pm,t=>{let n=Fe();if(!Ie(n))return!1;let o=t,r=o.shiftKey;return!!dy(n,!1)&&(o.preventDefault(),ly(n,r,!1),!0)},Zt),e.registerCommand(mm,t=>{let n=Fe();return!!Ie(n)&&(!JA||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(cm,!0))},Zt),e.registerCommand(BP,t=>{let n=Fe();return!!Ie(n)&&(t.preventDefault(),e.dispatchCommand(cm,!1))},Zt),e.registerCommand(gm,t=>{let n=Fe();if(!Ie(n))return!1;if(t!==null){if((JA||N3||D3)&&R3)return!1;t.preventDefault()}return e.dispatchCommand(jx,!1)},Zt),e.registerCommand(jP,()=>(am(),!0),Zt),e.registerCommand(dm,t=>{let n=Fe();return!!Ie(n)&&(ZA(t,e),!0)},Zt),e.registerCommand(LP,t=>{let n=Fe();return!!Ie(n)&&((function(o,r){ZA(o,r),r.update(()=>{let a=Fe();Ie(a)&&a.removeText()})})(t,e),!0)},Zt),e.registerCommand(vm,t=>{let n=Fe();return!!Ie(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Fe(),i=lu(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Ie(a)&&Uy(i,a)},{tag:UP})})(t,e),!0)},Zt),e.registerCommand(AP,t=>{let n=Fe();return!!Ie(n)&&(t.preventDefault(),!0)},Zt),e.registerCommand(EP,t=>{let n=Fe();return!!Ie(n)&&(t.preventDefault(),!0)},Zt))}var O3=Nn({conflictsWith:["@lexical/rich-text"],dependencies:[_A],name:"@lexical/plain-text",register:eM});var tM=Ky,Eie=tM.PlainTextExtension,nM=tM.registerPlainText;var Vy={};Mn(Vy,{PlainTextPlugin:()=>$3});pe();var Km=Td(mc(),1);function F3(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 qy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function B3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return qy(()=>n.registerDecoratorListener(i=>{(0,Km.flushSync)(()=>{a(i)})}),[n]),q(()=>{a(n.getDecorators())},[n]),H(()=>{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(oh,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,Km.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function z3({editor:e,ErrorBoundary:t}){return(function(n){let o=yA.maybeFromEditor(n);if(o&&o.hasExtensionByName(MA.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&F3(320,r);return!0}return!1})(e)?null:u(B3,{editor:e,ErrorBoundary:t})}function oM(e){return e.getEditorState().read(Tm(e.isComposing()))}function $3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=Cn();return(function(r){qy(()=>za(nM(r),DA(r)),[r])})(o),b(xe,{children:[e,u(H3,{content:t}),u(z3,{editor:o,ErrorBoundary:n})]})}function H3({content:e}){let[t]=Cn(),n=(function(r){let[a,i]=G(()=>oM(r));return qy(()=>{function s(){let l=oM(r);i(l)}return s(),za(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=AA();return n?typeof e=="function"?e(o):e:null}var U3=Vy,rM=U3.PlainTextPlugin;pe();function aM(e){return/mac|iphone|ipad|ipod/i.test(e)}function pu(){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 mu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function iM(e){let t=mu(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}pe();var qm=ce(function(t){let n=_t().pierreIcons,o=n.useSpriteReady();Ld(n.ensureSprite,[n]);let r=H(()=>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(li,{className:F("size-4 shrink-0 text-icon-muted",t.className)}):u(Od,{className:F("size-4 shrink-0 text-icon-muted",t.className)})});var sM=yi;function lM(e){return b(xe,{children:[u(qm,{pathValue:e.path,kind:iM(e.path),theme:e.theme,className:ta}),u("span",{className:e.selectable?pT:na,children:e.label})]})}function dM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Xe,{children:[u(Je,{render:b("span",{className:F(yi,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(Sa,{className:F(ta,"size-icon-1",o&&"opacity-100")}),u("span",{className:na,children:t})]})}),u(Ye,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function cM({context:e}){let{t}=ze(),n=Uw(e),o=Hw(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(dM,{label:n,tooltipText:r,expired:o})}function K3(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 q3(e){return e.replaceAll("\\","/")}function da(e){let t=e.displayName?.trim();return t||K3(e.name)}function uM(e,t){return t?e.filter(n=>n.enabled):[]}function fM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function pM(e){let t=q3(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 mM(e,t){return e.registerCommand(vm,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=Tc(`${o}
3710
+ `).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=Fe();if(!Ie(a))return!1;let i=[],s=c=>{let f=c.split(`
3711
+ `);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(Nr(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(Nr(" "))}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(Nr(" ")),a.insertNodes(i),n.preventDefault(),!0},Dr)}var id=new Map,V3=32;function gM(e,t){for(id.delete(e),id.set(e,t);id.size>V3;){let n=id.keys().next().value;if(n===void 0)break;id.delete(n)}}function W3(e){return{anchor:e.length,focus:e.length}}function $a(e,t,n){let o=id.get(e);if(o)return gM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:W3(t),history:PA()};return gM(e,r),r}function sd(e,t,n){let o=$a(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function hM(e,t,n,o){let r=$a(e,t);r.cursor=n,r.expandedCursor=o}function vM(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 G3=`composer-editor-${Math.random().toString(36).slice(2)}`,j3=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],IM=new Map(j3),xM=IM.get("`")??null,SM=Ut({onRemoveTerminalContext:()=>{}});function Q3(e){let t=Z3(),n=u("span",{className:sM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(lM,{path:e.path,label:mu(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 gu=class e extends Ba{__path;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__key)}static importJSON(t){return Qy(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=cp,t}updateDOM(){return!1}getTextContent(){return wc(this.__path)}isInline(){return!0}decorate(){return u(Q3,{path:this.__path})}};function Qy(e){return Jp(new gu(e))}function X3(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function hu(e){return new Map(e.map(t=>[t.name,{label:da(t),description:X3(t)}]))}function Y3(e){let t=b("span",{className:mT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:ta,dangerouslySetInnerHTML:{__html:gT}}),u("span",{className:na,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 vu=class e extends Ba{__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 wM(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=cp,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(Y3,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function wM(e,t,n){return Jp(new vu(e,t,n))}function J3(e){return u(cM,{context:e.context})}var $s=class e extends Ba{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return TM(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=cp,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(J3,{context:this.__context})}};function TM(e){return Jp(new $s(e))}function Di(e){return e instanceof gu||e instanceof vu||e instanceof $s}function Z3(){return document.documentElement.classList.contains("dark")?"dark":"light"}function eK(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function tK(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function Vm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Gm(e){return 1}function LM(e){return e.getTextContentSize()}function nK(e,t,n){return t+(n>0?Gm(e):0)}function oK(e,t,n){return t+(n>0?LM(e):0)}function rK(e,t){let n=e.getParent();if(!n||!qe(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===Gm(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=Gm(e),null)}function jm(e){return Di(e)?Gm(e):ot(e)?e.getTextContentSize():Zl(e)?1:qe(e)?e.getChildren().reduce((t,n)=>t+jm(n),0):0}function Gy(e){return Di(e)?LM(e):ot(e)?e.getTextContentSize():Zl(e)?1:qe(e)?e.getChildren().reduce((t,n)=>t+Gy(n),0):0}function xu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!qe(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=jm(l))}o=r}if(ot(e))return n+Math.min(t,e.getTextContentSize());if(Di(e))return nK(e,n,t);if(Zl(e))return n+Math.min(t,1);if(qe(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+=jm(s))}return n}return n}function Qm(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!qe(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Gy(l))}o=r}if(ot(e))return n+Math.min(t,e.getTextContentSize());if(Di(e))return oK(e,n,t);if(Zl(e))return n+Math.min(t,1);if(qe(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+=Gy(s))}return n}return n}function Xm(e,t){if(Di(e))return rK(e,t);if(ot(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(qe(e)){let n=e.getChildren();for(let o of n){let r=Xm(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function Ym(){return Ct().getChildren().reduce((n,o)=>n+jm(o),0)}function Hs(e){let t=Ct(),n=Ym(),r={value:Math.max(0,Math.min(e,n))},a=Xm(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),_r(i)}function Wm(e,t){let n=Ct(),o=Ym(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=Xm(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=Xm(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),_r(c)}function yM(e){if(!Ie(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Qm(t,e.anchor.offset),r=Qm(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function CM(e){return Ie(e)?e.getNodes().some(t=>Di(t)):!1}function yu(e){let t=Fe();if(!Ie(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=xu(n,t.anchor.offset),r=Ym();return Math.max(0,Math.min(o,r))}function bM(e){let t=Fe();if(!Ie(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Qm(n,t.anchor.offset),r=Ct().getTextContent().length;return Math.max(0,Math.min(o,r))}function Wy(e){let t=Fe();return Ie(t)?{anchor:xu(t.anchor.getNode(),t.anchor.offset),focus:xu(t.focus.getNode(),t.focus.offset)}:e}function aK(e,t){let n=t.split(`
3712
+ `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Nr(r)),o<n.length-1&&e.append(Rs())}}function Xy(e,t,n){let o=Ct();o.clear();let r=fr();o.append(r);let a=Cs(e,t);for(let i of a){if(i.type==="mention"){r.append(Qy(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(wM(i.name,s?.label??da({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(TM(i.context));continue}aK(r,i.text)}}function jy(e){return e instanceof $s?[e.__context.id]:qe(e)?e.getChildren().flatMap(t=>jy(t)):[]}function iK(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(OP,s=>n("ArrowDown",s),Dr),r=t.registerCommand(FP,s=>n("ArrowUp",s),Dr),a=t.registerCommand(gm,s=>n("Enter",s),Dr),i=t.registerCommand(hm,s=>n("Tab",s),Dr);return()=>{o(),r(),a(),i()}},[t,e]),null}function sK(){let[e]=Cn();return q(()=>{let t=e.registerCommand(fm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Fe();if(!Ie(i)||!i.isCollapsed())return;let s=yu(0);if(s<=0)return;let l=Ct().getTextContent();Lc(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Hs(a)}),!0},Dr),n=e.registerCommand(pm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Fe();if(!Ie(i)||!i.isCollapsed())return;let s=yu(0),l=Ym();if(s>=l)return;let d=Ct().getTextContent();Lc(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Hs(a)}),!0},Dr);return()=>{t(),n()}},[e]),null}function lK(){let[e]=Cn();return q(()=>e.registerCommand(zP,t=>{if(!aM(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(()=>{_r(eP(o,e))}),!0)},Dr),[e]),null}function dK(){let[e]=Cn();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Fe();if(!Ie(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Di(r)||o.anchor.offset===0)return;n=xu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Hs(n)})})}),[e]),null}function cK(){let[e]=Cn(),{onRemoveTerminalContext:t}=Kt(SM);return q(()=>e.registerCommand(mm,n=>{let o=Fe();if(!Ie(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=yu(0),i=s=>{if(!Di(s))return!1;let l=xu(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(ot(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(qe(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(qe(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},Dr),[e,t]),null}function uK(){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=Fe();if(Ie(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Ba&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(MP,()=>(n=!0,o(r()),!1),ed),s=e.registerCommand(CP,()=>(n=!1,o(new Set),!1),ed);return()=>{a(),i(),s()}},[e]),null}function fK(){let[e]=Cn();return q(()=>mM(e,{createMentionNode:Qy,getExpandedAbsoluteOffsetForPoint:Qm}),[e]),null}function pK(e){let[t]=Cn(),n=_(e.terminalContexts),o=_(hu(e.skills)),r=_(null),a=_(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=hu(e.skills)},[e.skills]);let i=ah(s=>{let l=IM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let g=Fe();if(!Ie(g)||g.isCollapsed()||CM(g))return null;let v=yM(g);if(!v||v.start===v.end)return null;let x=Ct().getTextContent();return av(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)}`;Xy(m,n.current,o.current);let h=lr(m,f.expandedStart);Wm(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=Fe();if(!Ie(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(CM(g)){r.current=null,a.current=null;return}let v=yM(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=Ct().getTextContent();if(av(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==="`"&&xM!==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=xM;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=lr(v,g.expandedStart);Wm(w,w+1);let k=Fe();if(!Ie(k)){r.current=null,a.current=null;return}k.insertText(`\`${C}${x}`),Wm(w+1,w+1+C.length),r.current=null,a.current=null},{tag:Or})})},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 mK({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=sr(t,n),v=$a(e,t,{cursor:g,expandedCursor:wr(t,g)}),x=sr(t,v.cursor),y=eK(o),C=_(y),w=tK(r),k=_(w),S=_(hu(r)),L=_({value:t,cursor:x,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(z=>z.id)}),I=_(e),T=v.history,A=_(!1),E=H(()=>({onRemoveTerminalContext:l}),[l]);he(()=>{S.current=hu(r)},[r]),q(()=>{m.setEditable(!a)},[a,m]),he(()=>{let z=sr(t,n),U=L.current,O=I.current,ne=O!==e,ee=C.current!==y,W=k.current!==w;if(!ne&&U.value===t&&U.cursor===z&&!ee&&!W)return;if(ne){let Se=U.selection;m.getEditorState().read(()=>{Se=Wy(Se)}),sd(O,U.value,{cursor:U.cursor,expandedCursor:U.expandedCursor,selection:Se})}let De=$a(e,t),Ce=ne?De.selection:{anchor:z,focus:z};L.current={value:t,cursor:ne?De.cursor:z,expandedCursor:ne?De.expandedCursor:wr(t,z),selection:Ce,terminalContextIds:o.map(Se=>Se.id)},I.current=e,C.current=y,k.current=w;let ue=m.getRootElement(),Be=!!(ue&&document.activeElement===ue);if(!ne&&U.value===t&&!ee&&!W&&!Be)return;let ge=ne?$a(O,U.value).history:null;A.current=!0;let le=()=>m.update(()=>{let Se=ne||U.value!==t||ee||W;Se&&Xy(t,o,S.current),ne?Wm(Ce.anchor,Ce.focus):(Se||Be)&&Hs(z)},{discrete:!0,tag:Or});ge?vM(ge,le):le(),sd(e,t,L.current),queueMicrotask(()=>{A.current=!1})},[n,e,m,w,o,y,t]);let N=$(z=>{let U=m.getRootElement();if(!U)return;let O=sr(L.current.value,z);U.focus({preventScroll:!0}),m.update(()=>{Hs(O)}),L.current={value:L.current.value,cursor:O,expandedCursor:wr(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=$(()=>{let z=L.current;return m.getEditorState().read(()=>{let U=Ct().getTextContent(),O=sr(U,L.current.cursor),ne=sr(U,yu(O)),ee=Vm(U,L.current.expandedCursor),W=Vm(U,bM(ee)),De=jy(Ct()),Ce=Wy(L.current.selection);z={value:U,cursor:ne,expandedCursor:W,selection:Ce,terminalContextIds:De}}),L.current=z,sd(I.current,z.value,z),z},[m]);Qr(p,()=>({focus:()=>{N(L.current.cursor)},focusAt:N,focusAtEnd:()=>{N(lr(L.current.value,L.current.value.length))},readSnapshot:R}),[N,R]);let B=$(z=>{z.read(()=>{let U=Ct().getTextContent(),O=sr(U,L.current.cursor),ne=sr(U,yu(O)),ee=Vm(U,L.current.expandedCursor),W=Vm(U,bM(ee)),De=jy(Ct()),Ce=Wy(L.current.selection),ue=L.current;if(ue.value===U&&ue.cursor===ne&&ue.expandedCursor===W&&ue.selection.anchor===Ce.anchor&&ue.selection.focus===Ce.focus&&ue.terminalContextIds.length===De.length&&ue.terminalContextIds.every((ge,le)=>ge===De[le])||A.current)return;L.current={value:U,cursor:ne,expandedCursor:W,selection:Ce,terminalContextIds:De},sd(I.current,U,{cursor:ne,expandedCursor:W,selection:Ce});let Be=Lc(U,ne,"left")||Lc(U,ne,"right");h.current(U,ne,W,Be,De)})},[]);return u(SM,{value:E,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(rM,{contentEditable:u(QE,{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:XE}),u(EA,{onChange:B}),u(iK,{...c?{onCommandKeyDown:c}:{}}),u(pK,{terminalContexts:o,skills:r}),u(lK,{}),u(sK,{}),u(dK,{}),u(cK,{}),u(fK,{}),u(uK,{}),u(kA,{externalHistoryState:T},e)]})})}function gK(e){let[t]=Cn(),n=_(e),o=_(e),[r,a]=G(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,he(()=>{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(mK,{...i})}function kM({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=_(hu(r)),v=H(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[gu,vu,$s],editorState:()=>{Xy(m.current,h.current,g.current)},onError:x=>{throw x}}),[]);return u(dE,{initialConfig:v,children:u(gK,{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}:{}})},G3)}pe();pe();pe();var gC=Td(MM(),1),pR=Td(mc(),1),mR=Td(mc(),1);qn(function(t,n){return Le("div",{ref:n,...t})});var sg=qn(function(t,n){return Le("div",{ref:n,...t})}),pr=sg,qa={OS:"web"};function Us(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function hC(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 gR(){return"normal"}function TK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:gR()}function LK(e){var t;return(t=e?.rtl)!=null?t:!1}function Wa(e){return vC(e?.props)}function vC(e){return!!e?.horizontal&&LK(e)}function xC(e){return e?.horizontal?(vC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function kK(e,t){var n;return(n=hC(e,t))!=null?n:0}function RM(e,t){return t&&(Wa(e)?t.left:t.right)||0}function PK(e,t,n,o){return!Wa(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function yC(e,t,n){if(!e||!Wa(e))return t;let o=hC(e,n),r=Us(t,o),a=TK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Us(o-r,o):r}function EK(e,t,n){if(!Wa(e))return e.horizontalRTLScrollType=void 0,t;let o=hC(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=gR();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 AK=e=>e,lg=Ut(null),hR="\0",MK=0;function RK({children:e}){let[t]=G(()=>({animatedScrollY:AK(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:MK++,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 Le(lg.Provider,{value:t},e)}function $r(){return cn(lg)}function vR(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=ie(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(Ua(e,i,r));return()=>{for(let i of a)i()}}}}function NK(e){return e.length===1?e[0]:e.join(hR)}function _K(e){return e.split(hR)}function Ua(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 ie(e,t){let{values:n}=e;return n.get(t)}function Ee(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 DK(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 OK(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=cn(lg),n=NK(e),{subscribe:o,get:r}=H(()=>vR(t,_K(n)),[t,n]);return(0,gC.useSyncExternalStore)(o,r,r)}function FK(e,t){let n=cn(lg),{subscribe:o,get:r}=H(()=>vR(n,[e]),[n,e]),a=$(()=>t(r()[0]),[r,t]);return(0,gC.useSyncExternalStore)(o,a,a)}function BK(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?RM(o,s):s?.bottom)||0,d=BK(t??r.contentInsetEndAdjustment),c=ie(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?RM(o,h):h.bottom)||0)+d,f)}return Math.max(m,f)}function mo(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})=>Le(sg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ce(function(){let t=$r(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Wo(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=mo(t),[,c]=ri(f=>f+1,0);return zK(()=>{c()},100),Le(sg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Le(dd,null,Le(pr,null,"TotalSize:"),Le(pr,null,n.toFixed(2))),Le(dd,null,Le(pr,null,"ContentSize:"),Le(pr,null,d.toFixed(2))),Le(dd,null,Le(pr,null,"At end:"),Le(pr,null,String(l))),Le(dd,null,Le(pr,null,"ScrollAdjust:"),Le(pr,null,o.toFixed(2))),Le(dd,null,Le(pr,null,"RawScroll: "),Le(pr,null,r.toFixed(2))),Le(dd,null,Le(pr,null,"ComputedScroll: "),Le(pr,null,a.toFixed(2))))});function zK(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var CC=!0,xR=new WeakMap;function $K(e){return xR.get(e)}function HK(e,t){xR.set(e,t)}var UK=typeof __DEV__<"u"?__DEV__:void 0,NM,_M=typeof process<"u"&&typeof process.env=="object"&&process.env?(NM="production")!=null?NM:process.env.MODE:void 0,DM=typeof _M=="string"?_M.toLowerCase()!=="production":void 0,OM,Vo=(OM=DM??UK)!=null?OM:!1,cd=-1e7,yR=1,KK=Vo&&!1,qK=Vo&&!1;function dg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function CR(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 VK(e){dg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,CR(e)}function WK(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function GK(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,WK(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var Jy=1;function jK(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function FM(e){e.initialScrollSession=void 0}function rC(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 Jm(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=rC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=rC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var cg={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){Jm(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){Jm(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=Jm(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},ao={clear(e){ao.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=Jy},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>Jy},isAtZeroTargetOffset(e){return e<=Jy},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=Jm(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Va(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&&!jK(l))return FM(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=rC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var QK=1.3;function aC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*QK||!t&&n<=0&&o>0}var bR=(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?aC(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 XK(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function IR(e){let t=e.state;if(!t.edgeReachedGate)return;let n=mo(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=aC(t.scroll,!1,a),l=aC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function SR(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function wR(e){e.state.edgeReachedGate="closed"}function BM(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function YK(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",XK(e,o),o}function Iu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function TR(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=mo(e);if(IR(e),f>0&&a){let p=qs(e),m=f-s-i-p,h=f<i;Ee(e,"isAtEnd",h||m<=yR),Ee(e,"isNearEnd",h||m<=c*i),Ee(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),Iu(r)||l||(r.isEndReached=bR(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;SR(e,"end",t,n)&&(wR(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function JK(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;IR(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Ee(e,"isAtStart",s<=yR),Ee(e,"isNearStart",s<=p),Iu(o)||o.scrollingTo||(o.isStartReached=bR(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;SR(e,"start",t,n)&&(wR(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function ug(e,t){let n=!e.state.edgeReachedGate;TR(e,t,n),JK(e,t,n)}function LR(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),ug(e)}var ZK=6,eq=3,tq=250;function kR(e){e.state.scheduledWork.cancel("adaptiveRender")}function zM(e,t){let n=e.state;kR(e),t<=0?Lu(e,"normal","scroll"):n.scheduledWork.timeout(()=>Lu(e,"normal","scroll"),t,"adaptiveRender")}function Lu(e,t,n){var o,r;ie(e,"adaptiveRender")!==t&&(Ee(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function bC(e){var t,n;kR(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";ie(e,"adaptiveRender")!==o&&Lu(e,o,"initial")}function nq(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=ie(e,"adaptiveRender");if(ie(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:ZK,c=(r=s.exitVelocity)!=null?r:eq,f=(a=s.exitDelay)!=null?a:tq,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"?(Lu(e,"light","scroll"),zM(e,f)):l==="light"&&zM(e,f))}else bC(e)}var IC=50;function PR(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"&&!ie(e,"readyToRender")&&!a?Math.min(o,IC):o}function ER(e){let{state:t}=e;t.props.drawDistance<=IC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function SC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Ee(e,"readyToRender",!1),bC(e)}function wC(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&&!ie(e,"readyToRender")&&(Ee(e,"readyToRender",!0),Lu(e,"normal","ready"),o.props.drawDistance>IC&&ER(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var oq=2e3;function $M(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function AR(e){e.scheduledWork.cancel("preservedInitialScroll")}function ud(e){AR(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Va(e)}function HM(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&&(dg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),cg.resetFlags(r),Va(r,{bootstrap:null}),fd(e))}function fd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)$M(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)&&$M(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;ao.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Va(a),AR(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||ud(a)},oq,"preservedInitialScroll")):ud(a),t?.recalculateItems&&LR(e),wC(e,{didInitialScroll:!0}),p&&GK(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function fg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function rq(e){let{state:t}=e;return(t.props.horizontal?(Wa(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:ie(e,"stylePaddingTop")||0)+(ie(e,"alignItemsAtEndPadding")||0)+(ie(e,"headerSize")||0)}function Ot(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 aq(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 iq(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-aq(e)-qs(e)):0}function js(e){let t=ie(e,"alignItemsAtEndPadding")||0,n=iq(e);t!==n&&Ee(e,"alignItemsAtEndPadding",n)}function Su(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&&Ee(e,"totalSize",i),js(e)):o&&e.values.get("totalSize")!==i&&Ee(e,"totalSize",i)}function iC(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&&Su(e,t,s,o),a.set(t,n)}function MR(e){return typeof e=="function"}function pg(e){return Array.isArray(e)}var UM=new Set;function Ks(e,t){Vo&&!UM.has(e)&&(UM.add(e),console.warn(`[legend-list] ${t}`))}function ku(e){return Math.floor(e*8)/8}function wu(e){return e==null}function KM(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 bu(e,t,n){return KM(e,n)+KM(t,n)}function sC(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=ie(e,"numContainers");for(let i=0;i<a;i++)if(ie(e,`containerItemKey${i}`)===t)return i;return-1}function RR(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 NR(e,t){let n=Ot(e.state,t);return RR(e,n,t,e.state.props.data[t])}function sq(e,t,n){for(let o=t;o<=n;o++)if(NR(e,o)===void 0)return!1;return!0}function go(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=RR(e,t,n,o,s),C!==void 0)return iC(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=ku(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=ku(S))}return C===void 0&&(C=g+e.scrollAxisGap),iC(e,t,C,i),C}function TC(e,t){if(t===void 0||t<0)return;let n=Ot(e.state,t);return go(e,n,t,e.state.props.data[t])}function mg(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=rq(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:go(e,Ot(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=ie(e,"footerSize")||0;l+=g}}return l}function Oi(e,t,n){let o=e.state,r=mo(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&qa.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 Pu(e){var t,n;let o=e.state;if(o?.scrollingTo){dg(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&&Su(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}LR(e),r?.()}}var lq=80,dq=1500,cq=320,uq=1;function fq(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?mo(e):void 0,m=f?yC(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;pq(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&Pu(e)},100,"platformScrollCompletion")}}function pq(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Pu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),dq),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)<=uq;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),Pu(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),lq)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),cq),l.register("platformScrollCompletion",p)}function pd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(ie(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,mo(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=ie(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let h=r.current;if(t.props.horizontal&&Wa(t)){let g=mo(e),v=kK(t,g),x=yC(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,ie(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Eo=.1,mq=300,gq=2,hq=1;function vq(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 xq(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)<=Eo&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=gq){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+mq,id:n,position:o,quietPasses:c}}}function yq(e,t,n,o,r,a){return!1}function Cq(e,t,n){if(Math.abs(t)<=Eo)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 bq(e,t){return e<0?-t:t}function Zy(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Eo&&Qs(e,r)}function Iq(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Eo)return;let o=mo(e),r=Cq(t,n.amount,o);if(Math.abs(r)<=Eo)return;let a=n.amount-r;Math.abs(a)<=Eo||(n.manualApplied=a,Qs(e,a),n.furthestProgressTowardAmount=0)}function Sq(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>Eo||r>0&&a<-Eo,s=bq(r,a);if(Math.abs(r)<=Eo)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Eo>=Math.abs(r))return Zy(e,r,a),!0;let l=Math.max(0,mo(e)-n.scrollLength);return Math.abs(t-l)<=hq||n.pendingMaintainScrollAtEnd&&ie(e,"isWithinMaintainScrollAtEndThreshold")&&s>Eo?(Zy(e,r,a),!0):s>o.furthestProgressTowardAmount+Eo?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Eo&&s<o.furthestProgressTowardAmount-Eo&&(n.pendingNativeMVCPAdjust=void 0),!1)}function wq(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=vq(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(mo(e),C){if(p&&v===void 0?(h=p.id,m=p.position):v!==void 0?h=Ot(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,A=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 B=A[R];T=B===void 0||!l(B,R,A),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:B,position:z}=g[R],U=w.get(B);if(U!==void 0&&l){let ne=A[U];if(ne===void 0||!l(ne,U,A))continue}let O=U!==void 0?r[U]:void 0;if(O!==void 0){S=O-z,L=B,I=O;break}}if(!T&&h!==void 0&&m!==void 0){let R=w.get(h),B=R!==void 0?r[R]:void 0;if(B!==void 0){let z=mo(e),U=B-m;if(U!==0&&y&&n.scroll+n.scrollLength>z)if(U>0)U=Math.max(0,z-n.scroll-n.scrollLength);else{let O=Math.max(0,z-n.scrollLength);n.scroll=O,n.scrollPending=O,U=0}S=U,L=h,I=B}}if(x&&x>0){let R=go(e,h,v,n.props.data[v]),B=f?.itemSize;if(R!==void 0&&B!==void 0&&R!==B){let z=R-B;z!==0&&(S+=z*x,f.itemSize=R)}}if(xq(n,{anchorId:L,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),yq()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:k},Iq(e);return}Math.abs(S)>Eo&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&ie(e,"isWithinMaintainScrollAtEndThreshold")||Qs(e,S))}}}var qM=1e3,Tq=200,gg=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/Tq);a+=c/f*h,i+=h}return i>0?a/i:0};function Lq(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Nu(e){return e.dataChangeNeedsScrollUpdate||Lq(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:A}=i;if(T&&t<T||A&&t>A){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?YK(e,t-f):void 0,y=Sq(e,t),C=a.scrollLength,w=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,k=gg(a);nq(e,k,{forceLight:w});let S=a.scrollLastCalculate;if(Nu(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 E;let N={doMVCP:c!==void 0,scrollVelocity:k};w&&(N.drawDistanceMode="visible-first"),(E=a.triggerCalculateItemsInView)==null||E.call(a,N),ug(e,x)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,mR.flushSync)(T),ER(e)):T();let A=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);y&&A&&(a.pendingMaintainScrollAtEnd=!1,pd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function kq(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 Pq(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=ao.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&ao.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&ao.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,ao.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&ao.clear(e)}function Eq(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 VM(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=TC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function Aq(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)):Eq(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=VM(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=VM(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 Mq(e,t,n){let o=Aq(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function hg(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;dg(r);let h=f?c:mg(e,c,s),g=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Oi(e,h,s),x=g?h:v;if(r.scrollHistory.length=0,!a){d&&cg.resetFlags(r);let y=kq(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||Mq(e,v,s.index)}r.scrollPending=v,Pq(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||qa.OS==="android"?fq(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function _R(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function Zm(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=_R(t,l.length);let d=TC(e,t),c=fg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,hg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function vg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?_R(i,e.state.props.data.length):void 0,l=TC(e,s);hg(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&&SC(e,{resetInitialScroll:!0}),Va(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function zr(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?fg(e,t.index):0,i=mg(e,a,t);return Oi(e,i,t)}function DR(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 Rq(e,t){var n,o,r;let a=e.state,i=DR(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=zr(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 vg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function Nq(e,t){var n,o;let r=e.state,a=DR(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 vg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Eu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?Nq(e,{forceScroll:t?.forceScroll}):Rq(e,{forceScroll:t?.forceScroll})}function Tu(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=Ot(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var xg=1,_q=8,Dq=24,Oq="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function mr(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 Fq(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 Bq(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 zq(e){let{mountFrameCount:t,maxFrames:n=_q,maxPasses:o=Dq,passCount:r}=e;return t>=n||r>=o}function OR(e,t){return zq(t)?(Vo&&console.warn(Oq),Jq(e),!0):!1}function Au(e){var t;let n=mr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Va(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function FR(e,t){var n,o,r;let a=mr(e);Va(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 $q(e,t){var n,o,r;let a=mr(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,Va(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&FR(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function lC(e){requestAnimationFrame(()=>{var t;mr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function LC(e){let t=e.state,n=mr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=mr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!OR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&LC(e))};n.frameHandle=requestAnimationFrame(o)}function og(e,t){$q(e.state,t),LC(e),lC(e.state)}function kC(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 Hq(e){return!!e?.preserveForBottomPadding}function Gs(e){return!!e?.preserveForFooterLayout}function BR(e){return!!(e&&e.viewPosition===1&&(Hq(e)||Gs(e)))}function Uq(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 Kq(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function rg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Gs(r))return;let a=kC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Ws(e,a)}function qq(e){ud(e)}function PC(e,t,n=xg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Mu(o);return Math.abs(r-zr(e,t))>n}function Mu(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 zR(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:Mu(n);return zr(e,o)-r}function $R(e){return zR(e)===void 0?!1:(HR(e,{}),!0)}function HR(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=zR(e);if(a===void 0||Math.abs(a)<=xg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Qs(e,a)),HR(e,t)})}function Vq(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||PC(e,o)&&(BR(o)&&ie(e,"isAtEnd")||(Gs(o)?rg(e,{dataLength:n.props.data.length,stylePaddingEnd:xC(n.props),target:o}):qq(n)))}function Wq(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=zr(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?(Au(s),fd(e,{resolvedOffset:l})):c?(Au(s),fd(e,{preserveTarget:!0,resolvedOffset:l})):(FR(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),LC(e))}function Gq(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=mr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){ud(s);return}let p=n>0&&(r||BR(l));if(!(!o&&!d&&!p)){if(p){let m=r?kC({dataLength:n,footerSize:ie(e,"footerSize")||0,preserveForFooterLayout:Gs(l),stylePaddingEnd:i}):Uq({dataLength:n,footerSize:ie(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&PC(e,l)){rg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!Kq(l,m)||c||d||o){Ws(e,m,{resetDidFinish:d}),og(e,{scroll:zr(e,m),seedContentOffset:d&&!c?Mu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Ws(e,l,{resetDidFinish:d}),og(e,{scroll:zr(e,l),seedContentOffset:d&&!c?Mu(s):void 0,targetIndexSeed:l.index}))}}function jq(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||!(mr(i)||Gs(s))))if(PC(e,s))rg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=kC({dataLength:n,footerSize:o,preserveForFooterLayout:Gs(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))rg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Ws(e,d,{resetDidFinish:f}),og(e,{scroll:zr(e,d),targetIndexSeed:d.index})}}}function Qq(e){var t,n,o;let r=e.state,a=r.initialScroll,i=mr(r);if(a&&r.props.data.length>0&&!Xs(r)&&(i||a.viewPosition===1)){let s=zr(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:Mu(r),c=s-d;if(Math.abs(c)>xg){if(r.didFinishInitialScroll)$R(e);else if(l){let f=ao.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,ao.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),Qs(e,c)}}}else og(e,{scroll:s,targetIndexSeed:a.index})}}function Xq(e){var t,n;let o=e.state,r=mr(o),a=o.initialScroll;if(!r||!a||Xs(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,OR(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=zr(e,a),s=Tu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=Bq({dataLength:d.length,getSize:g=>{var v,x;let y=(v=o.idCache[g])!=null?v:Ot(o,g);return(x=o.sizes.get(y))!=null?x:go(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:Ot(o,g);return o.sizesKnown.has(x)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,lC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=xg&&Fq(m,c))){lC(o);return}Au(o),vg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:qa.OS==="web"})}function Yq(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;fd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function Jq(e){var t,n,o,r;let a=e.state,i=mr(a),s=a.initialScroll;i&&s&&!Xs(a)&&a.refScroller.current?(Au(a),vg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:qa.OS==="web"})):Yq(e,(r=(o=(n=(t=mr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function UR(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function Zq(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=UR(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 KR(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var e4=20,t4=1,n4=1,eC=16;function EC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!AC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>s4(e),"checkFinishedScrollFrame")}function o4(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=t4}function r4(e,t){return!!t?.isInitialScroll&&cg.didDispatchNativeScroll(e)&&!e.hasScrolled}function qR(e){var t;return(t=ao.get(e))==null?void 0:t.targetOffset}function VR(e){let t=qR(e);return!e.didFinishInitialScroll&&ao.hasNonZeroTargetOffset(t)}function WM(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 ao.hasNonZeroTargetOffset(r)&&cg.didDispatchNativeScroll(e)&&!e.hasScrolled||ao.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||VR(e)}function GM(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&mo(e)<=n.scrollLength&&n.scrollPending<=n4}function a4(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function i4(e,t){var n;let o=t.index,a=a4(e,t)&&o!==void 0?mg(e,fg(e,o),t):(n=t.targetOffset)!=null?n:Oi(e,t.offset-(t.viewOffset||0),t);return Oi(e,a,t)}function AC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=i4(e,t),i=Oi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||qa.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function s4(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=AC(e,t);o.isAtResolvedTarget&&o4(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Pu(e)}function l4(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 d4(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=GM(e),r=r4(t,n),a=n!==void 0?WM(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?eC: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=VR(t)&&!t.hasScrolled,g=r?5:h?e4:5,v=GM(e),x=WM(t,m),y=AC(e,m),C=qa.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||y.isAtResolvedTarget),k=m.isInitialScroll&&!y.isAtResolvedTarget&&l<=g;if(v||w||x||C||l>g)Pu(e);else if((h||k)&&l<=g){let S=(p=(f=qR(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;l4(e,S),d(r?eC:100)}else d(r?eC:100)}};d(s)}function WR(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?$R(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Eu(e,{forceScroll:!0})}function c4(e){var t;if(!e.state.initialScroll)return;let n=()=>Eu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),EC(e,{onlyIfAligned:!0})}function u4(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"){Wq(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?fd(e,{resolvedOffset:p}):wC(e,{didInitialScroll:!0}))}function f4(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),Va(m,{kind:c,previousDataLength:h})):ud(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Va(m),p){Gq(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&&SC(e,{resetInitialScroll:!0}),Eu(e))}function GR(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function p4(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 ag(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=ie(e,"containerLayoutEpoch"))!=null?n:0)+1;Ee(e,"containerLayoutEpoch",a)}}function m4(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:Ot(m,n),S=(a=o?.updateLayout)!=null?a:!0,L=!1,I=!1;if(S){let N=v[n];if(N===void 0)return Ee(e,`containerPosition${t}`,cd),{didChangePosition:!1,didRefreshData:!1};let R=(N||0)-((i=o?.scrollAdjustPending)!=null?i:0),B=(s=m.sizes.get(k))!=null?s:go(e,k,n,w),z=PK(m,R,B,ie(e,"totalSize")),U=h[n]||1,O=g[n]||1,ne=ie(e,`containerPosition${t}`),ee=ie(e,`containerColumn${t}`),W=ie(e,`containerSpan${t}`);z>cd&&z!==ne&&(Ee(e,`containerPosition${t}`,z),L=!0),U>=0&&U!==ee&&Ee(e,`containerColumn${t}`,U),O!==W&&Ee(e,`containerSpan${t}`,O)}ie(e,`containerItemIndex${t}`)!==n&&Ee(e,`containerItemIndex${t}`,n);let A=ie(e,`containerItemData${t}`),E=()=>{Ee(e,`containerItemData${t}`,w),I=!0};if(A!==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)E();else if(R!==1){let B=(f=ie(e,`containerItemKey${t}`))!=null?f:k,z=C?.(A,n);if(A===void 0||!C||z!==B)E();else if(!y)E();else{let U=y(A,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]=U?1:2),U||E()}}}return{didChangePosition:L,didRefreshData:I}}function g4(e,t,n){var o;let r=e.state,a=ie(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=h4(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 h4(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=go(e,l,s,a[s],o);d>i&&(i=d)}return i}function v4(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=ie(e,"numColumns"))!=null?t:1;if(a.length===0)Su(e,null,0);else{let s=a.length-1,l=Ot(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:Ot(o,p),h=go(e,m,p,a[p]);h>f&&(f=h)}Su(e,null,d+f)}else{let c=go(e,l,s,a[s]);if(c!==void 0){let f=d+c;Su(e,null,f)}}}}function jR(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?mo(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Ot(t,i);let s=t.positions[i];r[a]=yC(t,s,o)}Ee(e,"snapToOffsets",r)}function QR(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,A=(l=ie(e,"numColumns"))!=null?l:1,E=A>1,N=Vo?new Map:void 0,R=ie(e,"extraData"),B=S?{span:1}:void 0,z=m.lastScrollDelta,U=i??gg(m),O=!o&&!t&&(r||Math.abs(U)>0||m.scrollLength>0&&z>m.scrollLength),ne=a+1e3,ee=!0,W=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=ie(e,"scrollAdjustPending"))!=null?d:0)!==0,De=!1,Ce=0,ue=1,Be=0;if(t&&(v.length=0),E||(g.length&&(g.length=0),v.length&&(v.length=0)),s>0){if(E){let{startIndex:te,currentRowTop:we}=g4(e,s,ee);s=te,Ce=we}else if(s<T){let te=s-1,we=Ot(m,te),dt=(c=y[te])!=null?c:0,ct=(f=w.get(we))!=null?f:go(e,we,te,k[te],ee,W,De);Ce=dt+ct}}let ge=t||x.size===0,le=E&&!!S&&!!B,Se=!1,ye;for(let te=s;te<T;te++){if(O&&ye!==void 0&&te>ye){Se=!0;break}O&&ye===void 0&&!I&&!t&&Ce>ne&&(ye=te+(E?A:1)+10);let we=(p=C[te])!=null?p:Ot(m,te),dt=1;if(le){B.span=1,S(B,k[te],te,A,R);let at=B.span;at!==void 0&&Number.isFinite(at)&&(dt=Math.max(1,Math.min(A,Math.round(at))))}E&&ue+dt-1>A&&(Ce+=Be,ue=1,Be=0);let ct=w.get(we),lt=ct!==void 0?ct:go(e,we,te,k[te],ee,W,De);Vo&&ge&&(N.has(we)&&console.error(`[legend-list] Error: Detected overlapping key (${we}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),N.set(we,te)),Ce!==y[te]&&(y[te]=Ce,h&&OK(e,we,Ce)),ge&&x.set(we,te),E?(g[te]=ue,v[te]=dt,lt>Be&&(Be=lt),ue+=dt,ue>A&&(Ce+=Be,ue=1,Be=0)):Ce+=lt}Se||v4(e),L&&jR(e)}function XR(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 x4(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function YR(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=XR(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>QM(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):QM(l,d,e,t,o)}}function QM(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=XR(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)JR(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=sC(o,y.key),S=!1;C!==void 0&&w!==void 0&&(S=YM(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=Ot(n,y),k=sC(o,w);if(YM(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];y4(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 XM(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 JR(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(ie(t,"stylePaddingTop")||0)+(ie(t,"alignItemsAtEndPadding")||0)+(ie(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(!XM(R,N)){t.mapViewabilityAmountValues.set(o,N);let B=t.mapViewabilityAmountCallbacks.get(o);B&&B(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,A={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:L,percentVisible:S,scrollSize:a,size:x,sizeVisible:k},E=t.mapViewabilityAmountValues.get(o);if(!XM(E,A)){t.mapViewabilityAmountValues.set(o,A);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(A)}return A}function YM(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=JR(e,t,n,o,r,a,i,s)),l.isViewable}function y4(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var JM=pR.unstable_batchedUpdates,C4=typeof JM=="function"?JM:e=>e(),b4=32,I4=64,S4=3;function w4(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*S4),o=t+I4,r=Math.max(t,Math.min(n,o),Math.min(e,b4)),a=Math.max(e,t);return Math.min(a,r)}function T4(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function L4(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=ie(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((A,E)=>({isSticky:c.props.stickyHeaderIndicesSet.has(A),itemIndex:A,itemType:a?.(A),order:E})),v=g.filter(A=>!A.isSticky),x=g.filter(A=>A.isSticky),y=[],C=[];for(let A=0;A<d;A++){let E=ie(e,`containerItemKey${A}`),N=!!h?.has(A);if(!(E&&i?.has(E)&&c.indexByKey.has(E))){if(p.has(A))(E===void 0||N)&&C.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(E===void 0||N)y.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(!m){let B=c.indexByKey.get(E);if(B!==void 0&&(B<n||B>o)){let z=B<n?n-B:B-o;y.push({containerIndex:A,distance:z})}}}}y.sort(k4);let w=new Array(l),k=d,S=!1,L=(A,E)=>{w[A.order]={containerIndex:E,itemIndex:A.itemIndex,itemType:A.itemType},h?.delete(E)&&(S=!0)},I=(A,E,N)=>{for(let R of A){if(w[R.order])continue;let B=E.findIndex(z=>{var U;return N((U=f.get(z.containerIndex))==null?void 0:U.itemType,R.itemType)});if(B!==-1){let[z]=E.splice(B,1);L(R,z.containerIndex)}}},T=(A,E,N)=>{a&&I(A,E,(R,B)=>B!==void 0&&R===B),I(A,E,R=>R===void 0),N&&I(A,E,()=>!0)};T(v,y,!0),T(x,C,!1);for(let A of g){if(w[A.order])continue;let E=k++;A.isSticky&&p.add(E),L(A,E)}if(S&&(r.length=0,h))for(let A of h)r.push(A);if(Vo){let A=(s=ie(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;k>A&&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:A,numNeeded:l,stillNeeded:k-d}})}return w}function k4(e,t){return t.distance-e.distance}function P4(e){let t=e.state;t.queuedInitialLayout=!0,TR(e),wC(e,{didLayout:!0})}var E4=4,A4=100;function M4(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/E4);return Math.sign(e)*t*n}function R4(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},A4,"renderRangeProjection")}function N4(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 _4(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=ie(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function D4(e,t,n,o,r,a,i){var s;let l=e.state;Ee(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(_4(e,f))continue;let p=(s=l.idCache[f])!=null?s:Ot(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function O4(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=ie(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),Ee(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:Ot(d,p);if(x){let y=d.positions[p],C=(l=d.sizes.get(x))!=null?l:go(e,x,p,d.props.data[p]);v=y!==void 0&&n>y+C+o*3}}v&&a.push(c)}}function ZR(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 eN(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:Ot(e,i);r.push(s)}return r}function dC(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:Ot(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 F4(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:Ot(r,f),m=(o=d.get(p))!=null?o:go(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function B4(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:Ot(s,g),x=(i=p.get(v))!=null?i:go(e,v,g,f[g]),y=c[g];if(ZR(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:eN(s,h),startNoBuffer:h.startNoBuffer}),dC(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&YR(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function Ka(e,t={}){let n=e.state;C4(()=>{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:A,idCache:E,indexByKey:N,minIndexSizeChanged:R,positions:B,props:{alwaysRenderIndicesArr:z,alwaysRenderIndicesSet:U,getItemType:O,keyExtractor:ne,onStickyHeaderChange:ee},scrollForNextCalculateItemsInView:W,scrollLength:De,sizes:Ce,startBufferedId:ue,viewabilityConfigCallbackPairs:Be}=n,{data:ge}=n.props,le=n.props.stickyHeaderIndicesArr||[],Se=n.props.stickyHeaderIndicesSet||new Set,ye=PR(e,t.drawDistanceMode),{dataChanged:te,doMVCP:we,forceFullItemPositions:dt}=t,ct=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,lt=!!ct,at=ie(e,"numContainers");if(!ge||De===0||!at)return;let Vt=mo(e),it,Ae=ie(e,"stylePaddingTop")+ie(e,"alignItemsAtEndPadding")+ie(e,"headerSize"),Oe=ie(e,"numColumns"),Ue=(r=t.scrollVelocity)!=null?r:gg(n),et=0,{initialScroll:Me,queuedInitialLayout:Te}=n,ht=lt?(a=ct?.scroll)!=null?a:n.scroll:!Te&&Iu(n)&&Me?zr(e,Me):n.scroll,Wt=0,fn=0,Ft=0,en=0,tn=0,Rt=0,Un=ht,kn=Z=>{var Ze;Un=Z,Wt=(Ze=ie(e,"scrollAdjustPending"))!=null?Ze:0,fn=Wt-Ae,Ft=Math.round(Z+et+fn),Ft+De>Vt&&(Ft=Math.max(0,Vt-De))};kn(ht);let pn=ie(e,"activeStickyIndex"),Pn=()=>{let Z=le.length>0?N4(le,Ft,n):-1,Ze=Z>=0?le[Z]:-1,yt=pn!==Ze;(Z>=0||pn>=0)&&Ee(e,"activeStickyIndex",Ze);let We=!!ee&&le.length>0&&yt;return{currentStickyIdx:Z,finishCalculateItemsInView:We?()=>{let In=ge[Ze];In!==void 0&&ee?.({index:Ze,item:In})}:void 0}},Pt=te?void 0:Pn(),ln=ye,Dn=ye;Ue>0||Ue===0&&Ft<Math.max(50,ye)?(ln=ye*.5,Dn=ye*1.5):(ln=ye*1.5,Dn=ye*.5);let Gt=!te&&!dt&&!lt&&!Iu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!ie(e,"readyToRender")?M4(Ue,Math.min(ln,Dn)):0,D=()=>{let Z=Math.max(0,Ft),Ze=Math.max(0,-Un);tn=Math.max(Z,Ft+De+Ze),en=Z-ln+Gt,Rt=tn+Dn+Gt};if(D(),Gt!==0&&R4(e),A&&!lt&&!te&&!dt&&W){let{top:Z,bottom:Ze}=W;if(Z===null&&Ze===null)n.scrollForNextCalculateItemsInView=void 0;else if((Z===null||en>Z)&&(Ze===null||Rt<Ze)&&!Nu(n)){Be?B4(e,Be,De,Ft,tn):n.props.onFirstVisibleItemChanged&&dC(n,F4(e,Ft)),(i=Pt?.finishCalculateItemsInView)==null||i.call(Pt);return}}let X=we&&!lt?wq(e,te):void 0;te&&GR(n);let se=dt||te?0:(s=R??n.startBuffered)!=null?s:0,re=!dt&&!te&&Oe>1&&R!==void 0;QR(e,te,{doMVCP:we,forceFullUpdate:!!dt,optimizeForVisibleWindow:re,scrollBottomBuffered:Rt,scrollVelocity:Ue,startIndex:se}),Vt=mo(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let de;if(te&&we&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let Z=n.props.maintainVisibleContentPosition.shouldRestorePosition;de=new Set;for(let Ze of n.idsInView){let yt=N.get(Ze);yt!==void 0&&(Z&&!Z(ge[yt],yt,ge)||de.add(Ze))}}let tt=n.scroll,vt=(l=ie(e,"scrollAdjustPending"))!=null?l:0;X?.(),X&&(n.scroll!==tt||((d=ie(e,"scrollAdjustPending"))!=null?d:0)!==vt)&&(kn(n.scroll),D()),te&&(Pt=Pn());let xt=null,jt=null,nn=null,bt=(c=lt?ct?.targetIndexSeed:void 0)!=null?c:!te&&ue&&N.get(ue)||0;for(let Z=bt;Z>=0;Z--){let Ze=(f=E[Z])!=null?f:Ot(n,Z),yt=B[Z],We=(p=Ce.get(Ze))!=null?p:go(e,Ze,Z,ge[Z]);if(yt+We>en)bt=Z;else break}if(Oe>1)for(;bt>0;){let Z=I[bt];if(Z===1||Z===void 0)break;bt-=1}let me=!1,ut,ft,Qt=0;for(let Z=0;Z<at;Z++){let Ze=ie(e,`containerItemKey${Z}`);if(Ze!==void 0){let yt=N.get(Ze);Qt=Math.max(Qt,yt)}}let Qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},wt=ge.length;for(let Z=Math.max(0,bt);Z<wt&&(!me||Z<=Qt);Z++){let Ze=(m=E[Z])!=null?m:Ot(n,Z),yt=(h=Ce.get(Ze))!=null?h:go(e,Ze,Z,ge[Z]),We=B[Z];me||(ZR(Qe,Z,We,yt,Ft,tn),xt===null&&We+yt>en&&(xt=Z,jt=Ze,en<0?ut=null:ut=We),Qe.startNoBuffer!==null&&(We<=Rt?(nn=Z,Rt>Vt?ft=null:ft=We+yt):me=!0))}Object.assign(n,{endBuffered:nn,endNoBuffer:Qe.endNoBuffer,firstFullyOnScreenIndex:Qe.firstFullyOnScreenIndex,idsInView:eN(n,Qe),startBuffered:xt,startBufferedId:jt,startNoBuffer:Qe.startNoBuffer}),A&&ut!==void 0&&ft!==void 0&&(n.scrollForNextCalculateItemsInView=wu(ut)&&wu(ft)?void 0:{bottom:ft,top:ut});let bn=at,Tt=[];if(te)for(let Z=0;Z<bn;Z++){let Ze=ie(e,`containerItemKey${Z}`);(!ne||Ze&&N.get(Ze)===void 0)&&Tt.push(Z)}let nt=n.scrollTargetPinnedRange,Lt=0,Jn=-1;nt&&(Lt=Math.max(0,Math.min(nt.start,nt.end)),Jn=Math.min(wt-1,Math.max(nt.start,nt.end)));let Zn=Lt<=Jn,vo=Z=>U.has(Z)||Zn&&Z>=Lt&&Z<=Jn;if(xt!==null&&nn!==null){let Z=[],Ze=new Set,yt=We=>{var In;if(We>=0&&We<wt){let hn=(In=E[We])!=null?In:Ot(n,We),vn=T.get(hn);vn!==void 0?n.stickyContainerPool.add(vn):!wu(hn)&&!Ze.has(We)&&(Ze.add(We),Z.push(We))}};for(let We=xt;We<=nn;We++){let In=(g=E[We])!=null?g:Ot(n,We);T.has(In)||(Ze.add(We),Z.push(We))}for(let We of z)yt(We);if(Zn)for(let We=Lt;We<=Jn;We++)yt(We);if(le.length>0?D4(e,le,(v=Pt?.currentStickyIdx)!=null?v:-1,Z,Ze,xt,nn):pn!==-1&&Ee(e,"activeStickyIndex",-1),Z.length>0){let In=L4(e,Z,xt,nn,Tt,O?hn=>{let vn=O(ge[hn],hn);return vn!==void 0?String(vn):""}:void 0,de);for(let hn of In){let vn=hn.itemIndex,Bt=hn.containerIndex,to=(x=E[vn])!=null?x:Ot(n,vn),on=ie(e,`containerItemKey${Bt}`);on&&on!==to&&T.delete(on),on!==to&&(it??(it=new Set),it.add(Bt),n.containerItemGenerations[Bt]=((y=n.containerItemGenerations[Bt])!=null?y:0)+1),Ee(e,`containerItemKey${Bt}`,to),Ee(e,`containerItemIndex${Bt}`,vn),Ee(e,`containerItemData${Bt}`,ge[vn]),n.containerItemMetadata.set(Bt,UR(n,vn,ge[vn],hn.itemType)),T.set(to,Bt),(C=n.userScrollAnchorReset)==null||C.keys.add(to);let xo=`containerSticky${Bt}`,ua=Se.has(vn),On=vo(vn);ua?(Ee(e,xo,!0),n.stickyContainerPool.add(Bt)):(ie(e,xo)&&Ee(e,xo,!1),On?n.stickyContainerPool.add(Bt):n.stickyContainerPool.delete(Bt)),Bt>=bn&&(bn=Bt+1)}bn!==at&&(Ee(e,"numContainers",bn),bn>ie(e,"numContainersPooled")&&Ee(e,"numContainersPooled",T4(wt,bn)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&O4(e,le,Ft,ye,(k=Pt?.currentStickyIdx)!=null?k:-1,Tt,vo);let eo=Tt.length>0?new Set(Tt):void 0,Xt=!1;for(let Z=0;Z<bn;Z++){let Ze=ie(e,`containerItemKey${Z}`);if(eo?.has(Z))Ze!==void 0&&(T.delete(Ze),it??(it=new Set),it.add(Z),n.containerItemGenerations[Z]=((S=n.containerItemGenerations[Z])!=null?S:0)+1),n.containerItemMetadata.delete(Z),n.stickyContainerPool.has(Z)&&(Ee(e,`containerSticky${Z}`,!1),n.stickyContainerPool.delete(Z)),Ee(e,`containerItemKey${Z}`,void 0),Ee(e,`containerItemIndex${Z}`,void 0),Ee(e,`containerItemData${Z}`,void 0),Ee(e,`containerPosition${Z}`,cd),Ee(e,`containerColumn${Z}`,-1),Ee(e,`containerSpan${Z}`,1);else{let yt=N.get(Ze);yt!==void 0&&(Xt=m4(e,Z,yt,{scrollAdjustPending:Wt,updateLayout:!0}).didChangePosition||Xt)}}if(it&&CC&&ag(e,it),Xt&&Ee(e,"lastPositionUpdate",Date.now()),lt){Xq(e);return}dC(n,Qe.startNoBuffer),!Te&&!n.didContainersLayout&&(Iu(n)?Tu(n,n.startBuffered,n.endBuffered):Tu(n,n.startNoBuffer,n.endNoBuffer)||Tu(n,n.startBuffered,n.endBuffered))&&(P4(e),c4(e)),Be&&Qe.startNoBuffer!==null&&Qe.endNoBuffer!==null&&YR(e.state,e,Be,De,Qe.startNoBuffer,Qe.endNoBuffer,xt??Qe.startNoBuffer,nn??Qe.endNoBuffer),(L=Pt?.finishCalculateItemsInView)==null||L.call(Pt)})}function ig(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=ie(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=Ot(o,g);let C=0,w=!1;for(let S=g;S<y.length;S++){let L=NR(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)+xC(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&&(Ee(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)&&(Ee(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Vs(e,o.scroll,!0,{markHasScrolled:!1})),f}function z4(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(Ka(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>Ka(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),Ka(e,{doMVCP:!0}))}function ZM(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=ie(e,"otherAxisSize");(!a||r>a)&&Ee(e,"otherAxisSize",r)}}var Ha;function tN(e){let t=Ha===void 0;Ha??(Ha=new Map);try{e()}finally{if(t){let n=Ha;Ha=void 0;for(let[o,r]of n)MC(o,r)}}}function $4(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 H4(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,z4(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&ig(e),t.didChange&&t.shouldMaintainScrollAtEnd&&pd(e)}function nN(e,t){if(Ha){let n=Ha.get(e);n?n.push(t):Ha.set(e,[t])}else MC(e,[t])}function MC(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||ie(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?Zq(o,a.containerId,s,l):void 0,c=U4(e,a.itemKey,a.size,d);$4(r,c)}H4(e,r)}function U4(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 A=(a=o?.itemType)!=null?a:p&&(r=p(I,x))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,x,A),itemType:A}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return ZM(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,w,k=i.sizesKnown.get(t),S=K4(e,t,n,o),L=ku(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),ZM(e,n,m),d||Tu(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 K4(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=go(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?(iC(e,t,S),S-C):0}function q4(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=ie(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();HK(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&MC(e,n)}var oN=qn,ca=ce,V4=ca(function({children:t}){let n=$r(),[o]=Wo(["containerLayoutEpoch"]);return he(()=>{{let r=p4(n);r!==void 0&&q4(n,r)}},[n,o]),t}),eg=e=>rh(e)?e:e?Le(e,null):null,W4=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),cC={contain:"paint layout style",...W4?{display:"flex",flexDirection:"column"}:{}},G4=ca(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=cd]=Wo([`containerPosition${t}`]),s=pg(o)?Object.assign({},...o):o,l=n?{...cC,...s,left:i}:{...cC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Le("div",{ref:r,...m,style:l})}),j4=ca(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]=Wo([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),h=H(()=>{var x;return(x=pg(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=H(()=>{var x;let y={...cC,...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=H(()=>i?.backdropComponent?Le("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},eg(i.backdropComponent)):null,[i?.backdropComponent]);return Le("div",{ref:r,style:g,...c},v,d)}),Q4=G4;function X4(e){G(()=>e())}var rN=Ut(null),Y4=-1;function J4(){return cn(rN)}function Z4(){var e;let t=J4(),n=(e=t?.containerId)!=null?e:Y4,[o]=Wo([`containerItemKey${n}`]);return FK("lastItemKeys",a=>t&&!wu(o)&&a?.includes(o)||!1)}function eV({ItemSeparatorComponent:e,leadingItem:t}){return Z4()?null:Le(e,{leadingItem:t})}var tC=null;function tV(){return tC||(tC=new ResizeObserver(e=>{tN(()=>{for(let t of e){let n=tg.get(t.target);if(n)for(let o of n)o(t)}})})),tC}var tg=new WeakMap;function nV(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=tV(),r=(n=tg.get(e))!=null?n:new Set;return r.size===0&&(tg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(tg.delete(e),o.unobserve(e))}}function RC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return he(()=>{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(eR(m),!0),p=m}return nV(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??$K(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let w=!!r?.();(C||w)&&f(eR(x),!1)})},[t,...a||[]]),{}}function eR(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var ng=new Map,nC;function aN(e){ng.delete(e)}function oV(e,t){ng.set(e,t),nC===void 0&&(nC=requestAnimationFrame(()=>{let n=Array.from(ng.values());ng.clear(),nC=void 0,tN(()=>{for(let o of n)o()})}))}function rV({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=ku(n[l]);r.lastSize&&ku(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,nN(t,{containerId:e,itemKey:i,size:s})};!Nu(a)&&f!==void 0&&d+1<f?oV(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()}}):(aN(r),p())}function aV({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=$(f=>{rV({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=$(()=>{ag(t,e)},[e,t]);he(()=>(t.containerLayoutTriggers.set(e,d),()=>{aN(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),he(()=>{ag(t,e)});let{onLayout:c}=RC({measureInLayoutEffect:!CC,onLayoutChange:l,ref:r,webLayoutResync:()=>Nu(t.state)},[o,i]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function iV({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&&qa.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 sV=ca(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=$r(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Wa(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}=aV({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,A=x>1?`${I/x*100}%`:void 0,E=H(()=>iV({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:x,otherAxisPos:T,otherAxisSize:A}),[r,f,T,A,d,l.state.props.contentContainerAlignItems,x,i]),N=H(()=>n!==void 0?a(n):null,[n,v,y]),{renderedItem:R}=N||{},B=H(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return Le(C?m||j4:p||Q4,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:k,refView:w,stickyHeaderConfig:s,style:E},Le(rN.Provider,{value:B},R,N&&i&&Le(eV,{ItemSeparatorComponent:i,leadingItem:N.item})))});function lV({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=sV}){let[s]=Wo([`containerItemKey${e}`]);return s===void 0?null:Le(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var dV=ca(function(t){return Le(lV,{...t})});function cV(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=uV(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 uV(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 fV(e){let t=$r(),n=_(void 0);q(()=>{let o=Ua(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=ie(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}cV(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function pV(e,t){let[n,o]=G(t),r=n!==t;return he(()=>{o(t)},[t]),e&&!r}var mV=ca(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=_(null),i=$r(),s=i.columnWrapperStyle,l=Wa(i.state),[d,c,f]=Wo(["otherAxisSize","readyToRender","totalSize"]),p=pV(!!c,t);fV(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 Le("div",{ref:a,style:m},Le(V4,null,r))}),gV=ca(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(Le(dV,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Le(mV,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function hV(e){return pg(e)?Object.assign({},...e.filter(Boolean)):e}var Ru={create:e=>e,flatten:e=>hV(e)};function uC(e){let t=_(e);return t.current=e,t}function vV(e){let t=uC(e),n=_(void 0),o=H(()=>({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 fC="legend-list-content-container",iN="legend-list-scrollbar-x-hidden",sN="legend-list-scrollbar-y-hidden";function xV(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function pC(){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 tR(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 lN(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function yV(e,t,n){return lN(n?t:e)}function nR(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 oR(e,t){return Math.max(0,Math.min(e,t))}function rR(e,t){return t?e.width:e.height}function CV(e,t,n){return Math.max(0,rR(e,n)-rR(t,n))}function aR(e,t){return t&&xV()||e}function bV(e,t){return t&&typeof window<"u"?window:e}function IV(e,t,n){let o=e.getBoundingClientRect(),r=pC();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 SV({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var iR="legend-list-scrollbar-axis-hidden-style",wV=200,TV=`.${sN}::-webkit-scrollbar:vertical{width:0;display:none;}.${iN}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function LV(){if(typeof document>"u"||document.getElementById(iR))return;let e=document.createElement("style");e.id=iR,e.textContent=TV,document.head.appendChild(e)}function kV(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 PV(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 EV(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 sR=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=$r(),[S]=Wo(["anchoredEndSpaceSize"]),L=_(null),I=_(null),T=h,A=$(()=>bV(L.current,T),[T]),E=$(()=>{let Ae=L.current,Oe=yV(Ae,I.current,T),Ue=nR(Ae,T,a);return CV(Oe,Ue,a)},[a,T]),N=$(()=>{let Ae=L.current;if(T){let Oe=E(),Ue=pC(),et=tR(Ae,Ue),Me=a?Ue.x-et.left:Ue.y-et.top;return oR(Me,Oe)}return Ae?a?Ae.scrollLeft:Ae.scrollTop:0},[E,a,T]),R=$((Ae,Oe)=>{let Ue=L.current,et=A();if(!et||typeof et.scrollTo!="function")return;let Me=E(),Te=oR(Ae,Me),Wt={behavior:Oe?"smooth":"auto"};if(T){let fn=pC(),Ft=tR(Ue,fn),{left:en,top:tn}=SV({clampedOffset:Te,horizontal:a,listPos:Ft,scroll:fn});Wt.left=en,Wt.top=tn}else a?Wt.left=Te:Wt.top=Te;et.scrollTo(Wt)},[E,A,a,T]);Qr(x,()=>({getBoundingClientRect:()=>{var Oe;return(Oe=L.current)==null?void 0:Oe.getBoundingClientRect()},getCurrentScrollOffset:N,getScrollableNode:()=>aR(L.current,T),getScrollEventTarget:()=>A(),getScrollResponder:()=>aR(L.current,T),isWindowScroll:()=>T,scrollBy:(Oe,Ue)=>{let et=A();!et||typeof et.scrollBy!="function"||et.scrollBy({behavior:"auto",left:Oe,top:Ue})},scrollTo:Oe=>{let{x:Ue=0,y:et=0,animated:Me=!0}=Oe;R(a?Ue:et,Me)},scrollToEnd:(Oe={})=>{let{animated:Ue=!0}=Oe,et=E();R(et,Ue)},scrollToOffset:Oe=>{let{offset:Ue,animated:et=!0}=Oe;R(Ue,et)}}),[N,E,A,a,T,R]);let B=$(()=>{if(!l||!L.current)return;let Ae=lN(I.current),Oe=nR(L.current,T,a),Ue=N(),et={nativeEvent:{contentOffset:{x:a?Ue:0,y:a?0:Ue},contentSize:{height:Ae.height,width:Ae.width},layoutMeasurement:{height:Oe.height,width:Oe.width}}};l(et)},[N,a,T,l]),z=vV(B),U=_(void 0),O=$(()=>{let Ae=U.current;Ae!==void 0&&(clearTimeout(Ae),U.current=void 0),z.flush(),d?.()},[d,z]),ne=$(Ae=>{if(!l)return;let Oe=k.state;if(!!Oe?.scrollingTo||!!Oe?.initialScrollSession&&!Oe.didFinishInitialScroll||!!Oe?.initialScroll&&!Oe.didFinishInitialScroll||!!Oe&&Nu(Oe)?z.flush():z.schedule(),d){let et=U.current;et!==void 0&&clearTimeout(et),U.current=setTimeout(O,wV)}},[k.state,O,d,l,z]);he(()=>{let Ae=A();if(Ae)return Ae.addEventListener("scroll",ne,{passive:!0}),"onscrollend"in Ae&&Ae.addEventListener("scrollend",O),()=>{Ae.removeEventListener("scroll",ne),"onscrollend"in Ae&&Ae.removeEventListener("scrollend",O);let Oe=U.current;Oe!==void 0&&(clearTimeout(Oe),U.current=void 0),z.cancel()}},[O,A,ne,z]),q(()=>{let Ae=()=>{i&&R(a?i.x||0:i.y||0,!1)};Ae(),requestAnimationFrame(Ae)},[i?.x,i?.y,a,R]),he(()=>{if(!g||!L.current)return;let Ae=L.current,Oe=()=>{g({nativeEvent:{layout:IV(Ae,T,a)}})};Oe();let Ue=new ResizeObserver(()=>{Oe()});Ue.observe(Ae);let et=()=>{Oe()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",et),()=>{Ue.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",et)}},[T,g]);let ee=!T&&(a?!f&&iN:!p&&sN);he(()=>{ee&&LV()},[ee]);let W={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Ru.flatten(n),...s?{overflowAnchor:"none"}:{}},De=kV(k),Ce=(C=(y=k.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&S?S:0,ue=Math.max(0,De-Ce),Be=ue?a?{flexShrink:0,width:ue}:{height:ue}:void 0,ge={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...Ru.flatten(r),...s?{overflowAnchor:"none"}:{}},le=o?`${fC} ${o}`:fC,{contentContainerClassName:Se,contentInset:ye,scrollEventThrottle:te,ScrollComponent:we,snapToOffsets:dt,useWindowScroll:ct,className:lt,...at}=v,Vt=T?[]:PV(dt);Vt.length>0&&(W.scrollSnapType=a?"x mandatory":"y mandatory",ge.position=(w=ge.position)!=null?w:"relative");let it=ee?lt?`${lt} ${ee}`:ee:lt;return Vo&&/(?:^|\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."),Le("div",{className:it,ref:L,...at,style:W},m,Le("div",{className:le,ref:I,style:ge},Vt.map(Ae=>Le("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":Ae,key:`snap-${Ae}`,style:EV(Ae,a)})),t,Be?Le("div",{"aria-hidden":!0,style:Be}):null))});function AV({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function lR(e,t){let n=$r();he(()=>Ua(n,e,r=>{t(r)}),[t,n,e])}function MV(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function RV(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 > .${fC}`)),i?{contentNode:s,scrollElement:i}:null}function NV(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function _V(){let e=$r(),t=_(0),n=_(0),o=_(void 0),r=_(void 0),a=_(null),i=$(()=>{let s=ie(e,"scrollAdjust"),l=ie(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=RV(e,a.current);if(f){let p=!!e.state.props.horizontal,m=MV(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=()=>NV(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 A=h.style[m.paddingEndProp],E=r.current,N=E?.value===A?E.baseline:A,R=(I+L-S)*2,z=`${(Number.parseFloat(window.getComputedStyle(h)[m.paddingEndProp])||0)+R}px`;h.style[m.paddingEndProp]=z,r.current={baseline:N,value:h.style[m.paddingEndProp]},h.offsetHeight,k(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let U=r.current;o.current=void 0,r.current=void 0,h.style[m.paddingEndProp]===U?.value&&(h.style[m.paddingEndProp]=U.baseline)})}else k()}else w&&k()}t.current=d,n.current=l||0}},[e]);return lR("scrollAdjust",i),lR("scrollAdjustUserOffset",i),null}var DV=qn(function({ScrollComponent:t,...n},o){let[r]=Wo(["snapToOffsets"]);return Le(t,{...n,ref:o,snapToOffsets:r})}),mC=.1;function OV(e,t,n){let o=ie(e,t)!==n;return o&&(Ee(e,t,n),js(e)),o}function FV(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-mC&&Math.abs(l)>mC}function dR(e,t){let{state:n}=e,o=ie(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>mC;r&&(Ee(e,"headerSize",t),js(e),a&&FV(e,o,t)&&Qs(e,t-o)),n.didMeasureHeader=!0}function BV(e,t){let n=OV(e,"footerSize",t);return n&&ig(e),n}function zV(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 $V(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!zV(o,r);return n.contentInsetOverride=r,a&&js(e),a}function HV(e,t){let n=uC(e),o=uC(t);return H(()=>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 cR=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=_(null),a=t??r;return RC({onLayoutChange:e,ref:a}),Le("div",{...o,ref:a},n)},UV=ca(function({horizontal:t}){let[n=0]=Wo(["alignItemsAtEndPadding"]);return n<=0?null:Le(sg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),KV=ca(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:A,useWindowScroll:E=!1,...N}){let R=$r(),B=R.state.props.maintainVisibleContentPosition,[z=0,U=0]=Wo(["anchoredEndSpaceSize","otherAxisSize"]),O=R.state.props.alignItemsAtEndPaddingEnabled,ne=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&z>0,ee;if(ne){let Se=a?Wa(R.state)?"Left":"Right":"Bottom",ye=Ru.flatten(r);ee={[`padding${Se}`]:bu({},ye||{},Se)+z}}let W=AV({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:U}),De=HV(C,(Se,ye)=>({...Se,ref:ye})),Ce=C?De:sR,ue=I?DV:Ce,Be=$((Se,ye)=>{var te;let we=BV(R,Se);ye?.(),we&&((te=R.state.props.maintainScrollAtEnd)!=null&&te.onFooterLayout)&&pd(R)},[R]);he(()=>{p||dR(R,0),h||Be(0)},[p,h,R,Be]);let ge=$(Se=>{let ye=Se[a?"width":"height"];dR(R,ye)},[R,a]),le=$((Se,ye)=>{let te=Se[a?"width":"height"];Be(te,()=>{w?.(Se,ye)})},[a,w,Be]);return Le(ue,{...N,...Ce===sR?{onInternalScrollEnd:S,useWindowScroll:E}:{},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:B.size||B.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:y,ScrollComponent:I?Ce:void 0,style:W?[W,o]:o},Le(_V,null),p&&Le(cR,{onLayoutChange:ge,style:m},eg(p)),v&&eg(v),O&&Le(UV,{horizontal:a}),t&&!v&&Le(gV,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),h&&Le(cR,{onLayoutChange:le,style:g},eg(h)),Vo&&KK)}),qV=100,VV=.9,WV=.9;function GV(e){let t=$r(),{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<qV)return;let p=()=>{let h=ie(t,"readyToRender"),g=ie(t,"numContainers")||0,v=ie(t,"totalSize")||0,x=t.state.scrollLength||0;if(!h||v<=0||x<=0)return;let y=g>=Math.ceil(c*VV),C=x>=v*WV;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=[Ua(t,"numContainers",p),Ua(t,"readyToRender",p),Ua(t,"totalSize",p)];return()=>{for(let h of m)h()}},[t])}function jV(e){}var QV=Vo?GV:jV;function XV(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),KR(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}Ka(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&pd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||ug(e),delete o.previousData}function YV(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 dN(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=PR(e),f=ie(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++)Ee(e,`containerPosition${h}`,cd),Ee(e,`containerColumn${h}`,-1),Ee(e,`containerSpan${h}`,1);return Ee(e,"numContainers",m),Ee(e,"numContainersPooled",w4(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Ka(e,{dataChanged:!0,doMVCP:!0})}):Ka(e,{dataChanged:!0,doMVCP:!0})),!0}}function JV(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function ZV(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=JV()[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&&dN(e),m&&Ka(e,{doMVCP:!0}),(g||p!==h)&&Ee(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&pd(e),ug(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&&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 eW(e,t){let n=ao.get(e);if(!!n&&ao.didReachTarget(t,n)){ao.clear(e);return}n&&(e.hasScrolled=!1,ao.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function tW(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function nW(e){return{...e,nativeEvent:{...e.nativeEvent}}}function oW(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=EK(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=Oi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,hg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Vs(e,f,c,{fromNativeScrollEvent:!0}),eW(l,f),Vq(e),l.scrollingTo&&EC(e),l.props.onScroll&&(tW(l)?l.deferredPublicOnScrollEvent=nW(t):l.props.onScroll(t))}var rW=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()}},aW=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,Ee(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Ee(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&EC(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=fg(this.ctx,e.index);o=mg(this.ctx,a,e),o=Oi(this.ctx,o,e)}else o=Oi(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,Ee(this.ctx,"scrollAdjust",this.appliedAdjust)),Ee(this.ctx,"scrollAdjustPending",0),Ka(this.ctx)}}}};function iW(e,t){let n=e.state,o=qs(e,t),a=qs(e)-o;if(a!==0){let i=!!ie(e,"isWithinMaintainScrollAtEndThreshold");Vs(e,n.scroll,!0,{markHasScrolled:!1}),!WR(e)&&i&&a>0&&Qs(e,a)}}function oC(e){return H(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var sW=(...e)=>$(n=>{for(let o of e)o&&(MR(o)?o(n):o.current=n)},e);function lW(e){return null}function dW(e,t,n,o){return o}function cW(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 uW(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=ie(e,"footerSize")||0;return Zm(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var fW="default";function pW(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||fW]={average:o.avg,count:o.num})}return t}function mW(e){ag(e)}function gW(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:sq(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 CR(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);HM(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,()=>uW(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 Zm(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(),KR(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,Ee(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),mW(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:ie(e,"activeStickyIndex"),contentLength:mo(e),data:n.props.data,elementAtIndex:g=>{var v;return(v=e.viewRefs.get(sC(e,Ot(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>pW(n),indexByKey:g=>n.indexByKey.get(g),isAtEnd:ie(e,"isAtEnd"),isAtStart:ie(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:ie(e,"isNearEnd"),isNearStart:ie(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:ie(e,"isWithinMaintainScrollAtEndThreshold"),listen:(g,v)=>Ua(e,g,v),listenToPosition:(g,v)=>DK(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:gg(n),sizeAtIndex:g=>n.sizesKnown.get(Ot(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=$V(e,g);Vs(e,n.scroll,!0,{markHasScrolled:!1}),v&&WR(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?.(),HM(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(Zm(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?(Zm(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(hg(e,g),!0)),setItemSize:(g,v)=>{nN(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=MR(g)?g(ie(e,"scrollAdjustUserOffset")||0):g;Ee(e,"scrollAdjustUserOffset",v)}}}var hW=(e,t)=>e-t,uR=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,Cu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function vW(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=uR(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Cu(i,s,f);let d=uR(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)Cu(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&Cu(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)&&(Cu(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++)Cu(i,s,p)}let c=Array.from(i);return c.sort(hW),c}function xW(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=ie(e,"extraData"),f=a[l];if(s&&!wu(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 fR(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 yW(e){var t;return e?e===!0?{...fR(void 0,!1),animated:!1}:{...fR(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function CW(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 bW(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=ie(e,"stylePaddingTop")||0;if(t<o){let r=ie(e,"totalSize")||0;Ee(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=ie(e,"totalSize")||0,Ee(e,"totalSize",r-o)},16)}Ee(e,"stylePaddingTop",t)}}function IW(e){let t=_(null),n=_(0),o=_(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return $((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 SW(e,t){let n=IW("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var wW=ca(oN(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(pg(o)?o:nh.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Le(RK,null,Le(TW,{...l,ref:n}))})),TW=oN(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=$(He=>{},[]);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:A,contentContainerStyle:E,contentInset:N,data:R=[],dataKey:B,dataVersion:z,drawDistance:U=250,contentInsetEndAdjustment:O,estimatedItemSize:ne=100,estimatedListSize:ee,extraData:W,getFixedItemSize:De,getItemType:Ce,horizontal:ue,rtl:Be,estimatedHeaderSize:ge,initialScrollAtEnd:le=!1,initialScrollIndex:Se,initialScrollOffset:ye,experimental_adaptiveRender:te,itemsAreEqual:we,keyExtractor:dt,ListEmptyComponent:ct,ListFooterComponent:lt,ListFooterComponentStyle:at,ListHeaderComponent:Vt,maintainScrollAtEnd:it=!1,maintainScrollAtEndThreshold:Ae=.1,maintainVisibleContentPosition:Oe,numColumns:Ue=1,overrideItemLayout:et,onEndReached:Me,onEndReachedThreshold:Te=.5,onItemSizeChanged:ht,onMetricsChange:Wt,onLayout:fn,onLoad:Ft,onMomentumScrollEnd:en,onRefresh:tn,onScroll:Rt,onScrollBeginDrag:Un,onStartReached:kn,onStartReachedThreshold:pn=.5,onStickyHeaderChange:Pn,onFirstVisibleItemChanged:Pt,onViewableItemsChanged:ln,progressViewOffset:Dn,recycleItems:io=!1,refreshControl:Gt,refreshing:D,refScrollView:X,renderScrollComponent:se,renderItem:re,scrollEventThrottle:de,snapToIndices:tt,stickyHeaderIndices:vt,style:gn,useWindowScroll:xt=!1,viewabilityConfig:jt,viewabilityConfigCallbackPairs:nn,...bt}=t,me=t.animatedPropsInternal,ut=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",ft=t.positionComponentInternal,Qt=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:Qe,positionComponentInternal:wt,stickyPositionComponentInternal:bn,...Tt}=bt,nt=Ru.flatten(E),Lt=L&&!ue&&nt?.minHeight==null&&R.length>0,Jn=L&&!Lt&&(ue?nt?.minWidth==null:nt?.minHeight==null),Zn={...nt,...L&&!Lt?{display:"flex",flexDirection:ue?"row":"column",...Jn?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},vo={...Ru.flatten(gn)},eo=bu(vo,Zn,"Top"),Xt=bu(vo,Zn,"Bottom"),Z=bu(vo,Zn,"Left"),Ze=bu(vo,Zn,"Right"),yt=xC({horizontal:ue,rtl:Be,stylePaddingBottom:Xt,stylePaddingLeft:Z,stylePaddingRight:Ze}),We=yW(it),In=CW(Oe),hn=Se!=null,vn=ye!=null,Bt=!le&&!hn&&!vn&&vC({horizontal:ue,rtl:Be}),to=!le&&!hn&&(vn||Bt),on=le||hn,xo=le?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-yt,viewPosition:1}:hn?typeof Se=="object"?{index:(r=Se.index)!=null?r:0,preserveForBottomPadding:Se.viewOffset===void 0&&Se.viewPosition===1?!0:void 0,viewOffset:(a=Se.viewOffset)!=null?a:Se.viewPosition===1?-yt:0,viewPosition:(i=Se.viewPosition)!=null?i:0}:{index:Se??0,viewOffset:ye??0}:to?{contentOffset:ye??0,index:0,viewOffset:0}:void 0,[ua,On]=G(!CC),[,Js]=ri(He=>He+1,0),_e=$r();_e.columnWrapperStyle=A||(Zn?cW(Zn):void 0);let ja=ue?(d=(s=_e.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=_e.columnWrapperStyle)==null?void 0:l.gap:(p=(c=_e.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=_e.columnWrapperStyle)==null?void 0:f.gap,Go=typeof ja=="number"&&Number.isFinite(ja)?ja:0,hr=_(null),Kr=sW(hr,X),dn=dt??((He,pt)=>pt.toString()),Kn=vt,zt=O,vr=_(zt),$t=H(()=>{let He=vW(T,R,dn,I?.anchorIndex);return{arr:He,set:new Set(He)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(h=T?.keys)==null?void 0:h.join(","),R,B,z,dn]),xr=!!xt&&!se,Ht=_(void 0),yr=!!et,Sn=_(yr);if(!Ht.current){if(!_e.state){let He=(ee??{height:0,width:0})[ue?"width":"height"];_e.values.set("adaptiveRender",(g=te?.initialMode)!=null?g:"normal"),_e.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:xo,initialScrollSession:xo?{kind:to?"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 rW,scroll:0,scrollAdjustHandler:new aW(_e),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:He,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 pt=_e.state;pt.triggerCalculateItemsInView=yn=>Ka(_e,yn),pt.reprocessCurrentScroll=()=>Vs(_e,pt.scroll,!0),Ee(_e,"maintainVisibleContentPosition",In),Ee(_e,"extraData",W),ge!==void 0&&Ee(_e,"headerSize",ge)}Ht.current=_e.state}let be=Ht.current,Fn=be.isFirst,Qa=be.props.adaptiveRender,Cr=be.props.numColumns,Xa=!Fn&&_e.scrollAxisGap!==Go;_e.scrollAxisGap=Go,be.didColumnsChange=Ue!==Cr||Xa;let Bo=(x=(v=be.props.data)==null?void 0:v.length)!=null?x:0,jo=be.props.data!==R,Qo=be.props.dataKey!==B,fa=be.props.dataVersion!==z,no=Qo||fa||jo&&YV(be,R,be.props.data),qr=!Fn&&no&&be.hasHadNonEmptyData&&(Qo||Bo===0)&&R.length>0;no&&!le&&be.didFinishInitialScroll&&((y=be.initialScroll)==null?void 0:y.viewPosition)===1&&be.props.data.length>0&&ud(be),no&&(be.dataChangeEpoch+=1,be.dataChangeNeedsScrollUpdate=!0,be.didDataChange=!0,be.previousData=be.props.data),qr&&(be.freshDataTransitionEpoch+=1);let Bi=SW(Rt??S,de??0),Zs=de&&Rt?Bi:Rt,xn=!Fn&&!no&&((C=be.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;be.props={adaptiveRender:te,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:Lt,alwaysRender:T,alwaysRenderIndicesArr:$t.arr,alwaysRenderIndicesSet:$t.set,anchoredEndSpace:I,anchoredEndSpaceOwner:ut,animatedProps:me,contentContainerAlignItems:Zn.alignItems,contentInset:N,contentInsetEndAdjustment:zt,data:R,dataKey:B,dataVersion:z,drawDistance:U,estimatedItemSize:ne,getFixedItemSize:oC(De),getItemType:oC(Ce),horizontal:!!ue,itemsAreEqual:we,keyExtractor:oC(dn),maintainScrollAtEnd:We,maintainScrollAtEndThreshold:Ae,maintainVisibleContentPosition:In,numColumns:Ue,onEndReached:Me,onEndReachedThreshold:Te,onFirstVisibleItemChanged:Pt,onItemSizeChanged:ht,onLoad:Ft,onMomentumScrollEnd:en,onScroll:Zs,onScrollBeginDrag:Un,onStartReached:kn,onStartReachedThreshold:pn,onStickyHeaderChange:Pn,overrideItemLayout:et,positionComponentInternal:ft,recycleItems:!!io,renderItem:re,rtl:Be,snapToIndices:tt,stickyHeaderIndicesArr:Kn??[],stickyHeaderIndicesSet:H(()=>new Set(Kn??[]),[Kn?.join(",")]),stickyPositionComponentInternal:Qt,stylePaddingBottom:Xt,stylePaddingLeft:Z,stylePaddingRight:Ze,stylePaddingTop:eo,useWindowScroll:xr},be.refScroller=hr,!Fn&&Qa&&!te&&bC(_e);let zi=H(()=>R.length?Array.from({length:Math.min(Ue,R.length)},(He,pt)=>Ot(be,R.length-1-pt)):[],[R,B,z,Ue]),pa=He=>{Ee(_e,"lastItemKeys",zi),Ee(_e,"numColumns",Ue);let pt=ie(_e,"stylePaddingTop");bW(_e,{stylePaddingTop:eo}),Ht.current.props.stylePaddingBottom=Xt,js(_e);let yn=eo-pt;He&&In.size&&yn&&pt!==void 0&&qa.OS};Fn&&(pa(!1),GR(be),QR(_e,!0));let $i=H(()=>{var He,pt;let yn=be.initialScroll;if(!yn)return;let rn=(He=yn.contentOffset)!=null?He:zr(_e,yn);return on&&((pt=be.initialScrollSession)==null?void 0:pt.kind)==="bootstrap"&&qa.OS==="web"?void 0:rn},[on]);he(()=>{u4(_e,{alwaysDispatchInitialScroll:Bt,dataLength:R.length,hasFooterComponent:!!lt,initialContentOffset:$i,initialScrollAtEnd:le,useBootstrapInitialScroll:on})},[]),(Fn||no||be.didColumnsChange)&&(Ht.current.lastBatchingAction=Date.now(),!dt&&!Fn&&no&&(Ht.current.sizes.clear(),Ht.current.positions.length=0,Ht.current.totalSize=0,Ee(_e,"totalSize",0))),Vo&&QV(t),he(()=>{qr&&SC(_e,{resetInitialScroll:!!xo,resetLayout:!0}),f4(_e,{dataLength:R.length,didDataChange:no,didStartFreshData:qr,initialScrollAtEnd:le,latestInitialScroll:xo,latestInitialScrollSessionKind:to?"offset":"bootstrap",stylePaddingEnd:yt,useBootstrapInitialScroll:on})},[R.length,B,no,qr,le,yt,on]),he(()=>{var He;xn&&(be.scrollForNextCalculateItemsInView=void 0,(He=be.triggerCalculateItemsInView)==null||He.call(be)),ig(_e)},[_e,R,z,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,xn,ue,Ue,Be,Xt,Z,Ze]),he(()=>{let He=vr.current;vr.current=zt,iW(_e,He)},[_e,zt]);let so=$(He=>{on&&jq(_e,{dataLength:R.length,footerSize:He[ue?"width":"height"],initialScrollAtEnd:le,stylePaddingEnd:yt})},[R.length,le,ue,yt,on]),Ao=$((He,pt)=>{let yn=be.scrollLength,rn=be.otherAxisSize;ZV(_e,He,On),ig(_e);let Xo=yn!==be.scrollLength||rn!==be.otherAxisSize;on&&!pt&&Xo&&Qq(_e),!on&&Eu(_e)},[R.length,le,yt,on]),{onLayout:Ya}=RC({onLayoutChange:Ao,onLayoutProp:fn,ref:hr});he(()=>{tt&&jR(_e)},[tt]),he(()=>pa(!0),[B,z,zi.join(","),Ue,Go,Xt,eo,Lt]),he(()=>{let{didColumnsChange:He,didDataChange:pt,isFirst:yn,props:{data:rn}}=be;!(rn.length>0&&dN(_e))&&!yn&&(pt||He)&&XV(_e,rn,{didColumnsChange:He}),pt&&(be.pendingDataComparison=void 0),be.didColumnsChange=!1,be.didDataChange=!1,be.isFirst=!1},[R,B,z,Ue,Go]),he(()=>{var He;Ee(_e,"extraData",W);let pt=Sn.current!==yr;Sn.current=yr,(yr||pt)&&Ue>1&&((He=be.triggerCalculateItemsInView)==null||He.call(be,{forceFullItemPositions:!0}))},[W,yr,Ue]),q(()=>{if(!Wt)return;let He,pt=()=>{let rn={footerSize:ie(_e,"footerSize")||0,headerSize:ie(_e,"headerSize")||0};(!He||rn.headerSize!==He.headerSize||rn.footerSize!==He.footerSize)&&(He=rn,Wt(rn))};pt();let yn=[Ua(_e,"headerSize",pt),Ua(_e,"footerSize",pt)];return()=>{for(let rn of yn)rn()}},[_e,Wt]),q(()=>{let He=x4({onViewableItemsChanged:ln,viewabilityConfig:jt,viewabilityConfigCallbackPairs:nn});be.viewabilityConfigCallbackPairs=He,be.enableScrollForNextCalculateItemsInView=!0,He&&(be.scrollForNextCalculateItemsInView=void 0)},[jt,nn,ln]),X4(()=>{}),Qr(n,()=>gW(_e,Js),[]),q(()=>()=>{VK(be),be.scheduledWork.dispose()},[be]),he(()=>{var He;(He=be.runPendingScrollToEnd)==null||He.call(be)}),q(()=>{on||Eu(_e)},[_e,on]);let Mo=H(()=>({getRenderedItem:He=>xW(_e,He),onMomentumScrollEnd:He=>{d4(_e),be.props.onMomentumScrollEnd&&be.props.onMomentumScrollEnd(He)},onScroll:He=>oW(_e,He),onScrollBeginDrag:He=>{var pt,yn;BM(_e),(yn=(pt=be.props).onScrollBeginDrag)==null||yn.call(pt,He)},onScrollEnd:()=>BM(_e)}),[]),Ja=dW(Kn,ue,_e,Mo.onScroll),zo=Gt;return Le(oi,null,Le(KV,{...Tt,alignItemsAtEnd:L,canRender:ua,contentContainerStyle:Zn,contentInset:N,freshDataTransitionEpoch:be.freshDataTransitionEpoch,getRenderedItem:Mo.getRenderedItem,horizontal:ue,initialContentOffset:$i,ListEmptyComponent:R.length===0?ct:void 0,ListFooterComponent:lt,ListFooterComponentStyle:at,ListHeaderComponent:Vt,onInternalScrollBeginDrag:Mo.onScrollBeginDrag,onInternalScrollEnd:Mo.onScrollEnd,onLayout:Ya,onLayoutFooter:so,onMomentumScrollEnd:Mo.onMomentumScrollEnd,onScroll:Ja,recycleItems:io,refreshControl:zo?eo>0?rf(zo,{progressViewOffset:((w=zo.props.progressViewOffset)!=null?w:0)+eo}):zo:tn&&Le(lW,{onRefresh:tn,progressViewOffset:(Dn||0)+eo,refreshing:!!D}),refScrollView:Kr,renderScrollComponent:se,scrollAdjustHandler:(k=Ht.current)==null?void 0:k.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:tt,stickyHeaderIndices:Kn,style:vo,useWindowScroll:xr}),Vo&&qK)});var LW=wW;var cN=LW;pe();pe();function kW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function PW(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${kW(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function NC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return PW(n,e.subProvider)}function md(e){return NC(e,{preferShortName:!0})}var _C="model:",DC="legacy-models:",OC="action:",gd="pluginActions:manage";function _u(e,t){return`${_C}${e.length}:${e}${t}`}function BC(e){if(!e.startsWith(_C))return null;let t=e.slice(_C.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 zC(e){return`${DC}${e}`}function uN(e){return e.startsWith(DC)?e.slice(DC.length):null}function Du(e){return`${OC}${e}`}function fN(e){if(!e.startsWith(OC))return null;let t=e.slice(OC.length);return t.length>0?t:null}var FC="choice:";function $C(e){return`${FC}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function pN(e){if(!e.startsWith(FC))return null;try{let t=JSON.parse(e.slice(FC.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 mN=ce(function(t){let{t:n}=ze(),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??_u(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):NC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(wa,{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(kf,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Xe,{children:[u(Je,{render:u(oe,{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 yg(e){return e==="ready"}function gN(e){return e==="ready"||e==="unchecked"||e==="checking"}function hN(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 Ou(e){return e.enabled&&gN(e.readiness)}function vN(e){return e.enabled}function xN(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 Cg=e=>e.enabled;function bg(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&Cg(n))return n}return e.find(n=>n.enabled&&yg(n.readiness))??e.find(Ou)??e.find(n=>Cg(n)&&n.readiness!=="error")}function yN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}pe();function EW(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(yg(o))return n;let r=hN(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 AW="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",MW="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 ",RW=`${MW} text-update-foreground`,CN="left",bN=8,IN="max-w-64 text-balance font-normal leading-snug",SN=ce(function(t){let{t:n}=ze(),{t:o}=ze(),r=_t().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=G(null),d=_(null),[c,f]=G(null);return he(()=>{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(AW,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(xe,{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:CN,sideOffset:bN,align:"center",className:IN,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Ou(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?EW(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(wa,{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:RW,"aria-hidden":!0,children:u(mf,{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:CN,sideOffset:bN,align:"center",className:IN,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function ho(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function NW(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 HC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function _W(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 Hr(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+HC(t,n);if(e.boundaryBase!==void 0){let o=_W(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+HC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+HC(t,n)}if(e.fuzzyBase!==void 0){let o=NW(t,n);if(o!==null)return e.fuzzyBase+o}return null}function DW(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function OW(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;DW(t,a)<0?o=r:n=r+1}return n}function Ig(e,t,n){if(n<=0)return;let o=OW(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var FW=24;function BW(e){return[ho(e.name),...e.shortName?[ho(e.shortName)]:[],...e.subProvider?[ho(e.subProvider)]:[],ho(e.driverKind),ho(e.providerDisplayName),...e.providerAccountEmail?[ho(e.providerAccountEmail)]:[],UC(e),...e.slug?[ho(e.slug)]:[]]}function zW(e,t,n){return Hr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function UC(e){return ho([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function wN(e,t){let n=ho(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=zW(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function TN(e,t){let n=wN(BW(e),t);return n===null?null:e.isFavorite?n-FW:n}function LN(e,t){return wN([ho(e.title),ho(e.description??"")],t)}function kN({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 Sg(e,t){return`${e}:${t}`}var PN=new Map,EN=[],$W=[],HW=[];function Fu(e){return e.choiceKey??_u(e.instanceId,e.slug)}function AN(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 UW(){return u("div",{className:"h-0.5"})}function KC(e){return e?.trim()||null}function MN({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 KW=ce(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=ze(),i=KC(o.description);return b(xe,{children:[r?u(MN,{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})]})]})]})}),qW=ce(function({index:t,showSectionHeader:n}){let{t:o}=ze();return b(xe,{children:[n?u(MN,{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(Ed,{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")})]})]})}),RN=ce(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??EN,g=t.selectedPluginActionKey??null,{t:v}=ze(),{t:x}=ze(),y=_t(),[C,w]=G(""),[k,S]=G(!1),[L,I]=G(!1),T=_(null),A=_(null),E=_(null),N=y.environment.useActiveEnvironmentId(),R=y.settings.useClientSettings(D=>D.favorites??[]),B=H(()=>N===null?HW:R.filter(D=>D.environmentId===N),[N,R]),[z,U]=G(()=>t.lockedProvider!==null?t.activeInstanceId:B.length>0?"favorites":t.activeInstanceId),[O,ne]=G(()=>new Set(o.get(t.activeInstanceId)?.some(D=>D.slug===t.model&&D.isLegacy)?[t.activeInstanceId]:[])),ee=H(()=>n??[],[n]),W=y.settings.useUpdateClientSettings(),De=$(()=>{T.current?.focus({preventScroll:!0})},[]),Ce=$(D=>{U(D),window.requestAnimationFrame(()=>{De()})},[De]);he(()=>{De();let D=window.requestAnimationFrame(()=>{De()}),X=window.setTimeout(()=>{De()},0);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(X)}},[De]);let ue=H(()=>new Set(B.map(D=>Sg(D.instanceId,D.model))),[B]),Be=$(D=>N===null?!1:B.some(X=>AN(D,X,N)),[N,B]),ge=H(()=>new Map(r.map(D=>[D.instanceId,D])),[r]),le=$(D=>t.lockedProvider===null?!0:D.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?D.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),Se=H(()=>{let D=new Set;for(let X of r)Ou(X)&&D.add(X.instanceId);return D},[r]),ye=H(()=>{let D=[];for(let[X,se]of o){let re=ge.get(X);if(re&&Se.has(X))for(let de of se)D.push({slug:de.slug,name:de.name,...de.shortName?{shortName:de.shortName}:{},...de.subProvider?{subProvider:de.subProvider}:{},...de.isLegacy?{isLegacy:!0}:{},instanceId:X,driverKind:re.driverKind,providerId:re.providerId,instanceDisplayName:re.displayName,...re.accentColor?{instanceAccentColor:re.accentColor}:{},...re.accountEmail?{instanceAccountEmail:re.accountEmail}:{},...re.continuationGroupKey?{continuationGroupKey:re.continuationGroupKey}:{}})}if(c&&c.length>0){let X=new Set,se=[];for(let de of c){let tt=de.legacyInstanceId;if(!tt||!Se.has(tt))continue;let vt=ge.get(tt);if(!vt)continue;let xt=o.get(tt)?.find(nn=>nn.slug===de.modelId),jt=$C({environmentId:de.selection.environmentId,runtimeId:de.runtimeId,sourceId:de.sourceId,profileId:de.profileId,endpointId:de.endpointId});X.add(Sg(tt,de.modelId)),se.push({slug:de.modelId,name:xt?.name??de.modelLabel,...xt?.shortName?{shortName:xt.shortName}:{},instanceId:tt,driverKind:vt.driverKind,providerId:vt.providerId,instanceDisplayName:vt.displayName,...vt.accentColor?{instanceAccentColor:vt.accentColor}:{},...vt.accountEmail?{instanceAccountEmail:vt.accountEmail}:{},...vt.continuationGroupKey?{continuationGroupKey:vt.continuationGroupKey}:{},runtimeId:de.runtimeId,sourceId:de.sourceId,sourceLabel:de.sourceLabel,profileId:de.profileId,ready:de.ready,...de.reasonCode?{reasonCode:de.reasonCode}:{},choiceKey:jt})}let re=D.filter(de=>!X.has(Sg(de.instanceId,de.slug)));return[...se,...re]}return D},[c,o,ge,Se]),te=t.lockedProvider!==null,we=C.trim().length>0,dt=H(()=>{if(!te)return;let D=new Set;for(let X of r)le(X)||D.add(X.instanceId);return D},[r,te,le]),ct=H(()=>{let D=r.filter(vN);if(!te)return D;let X=[],se=[];for(let re of D)le(re)?X.push(re):se.push(re);return[...X,...se]},[r,te,le]),lt=!we&&ct.length>0,at=H(()=>r.map(D=>D.instanceId),[r]),Vt=H(()=>{let D=ye;if(C.trim()){let X=D.map(se=>({model:se,score:TN({name:se.name,...se.shortName?{shortName:se.shortName}:{},...se.subProvider?{subProvider:se.subProvider}:{},driverKind:se.driverKind,providerDisplayName:se.instanceDisplayName,...se.instanceAccountEmail?{providerAccountEmail:se.instanceAccountEmail}:{},isFavorite:Be(se)},C),isFavorite:Be(se),tieBreaker:UC({name:se.name,...se.shortName?{shortName:se.shortName}:{},...se.subProvider?{subProvider:se.subProvider}:{},driverKind:se.driverKind,providerDisplayName:se.instanceDisplayName,...se.instanceAccountEmail?{providerAccountEmail:se.instanceAccountEmail}:{}})})).filter(se=>se.score!==null);if(t.lockedProvider!==null){let se=[];for(let re of X)le(re.model)&&se.push(re);return se.toSorted((re,de)=>{let tt=re.score-de.score;return tt!==0?tt:re.isFavorite!==de.isFavorite?re.isFavorite?-1:1:re.tieBreaker.localeCompare(de.tieBreaker)}).map(re=>re.model)}return X.toSorted((se,re)=>{let de=se.score-re.score;return de!==0?de:se.isFavorite!==re.isFavorite?se.isFavorite?-1:1:se.tieBreaker.localeCompare(re.tieBreaker)}).map(se=>se.model)}return t.lockedProvider!==null?(D=D.filter(X=>le(X)),z==="favorites"?D=D.filter(X=>Be(X)):D=D.filter(X=>X.instanceId===z)):z==="favorites"?D=D.filter(X=>Be(X)):D=D.filter(X=>X.instanceId===z),y.model.sortProviderModelItems(D,{favoriteModelKeys:ue,groupFavorites:z!=="favorites",instanceOrder:z==="favorites"?at:[]})},[ue,ye,at,le,t.lockedProvider,C,z,Be]),it=H(()=>{if(we||z==="favorites")return null;let D=Vt.filter(se=>!se.isLegacy),X=Vt.filter(se=>se.isLegacy);return X.length===0?null:{key:zC(z),currentModels:D,legacyModels:X,isExpanded:O.has(z)}},[O,Vt,we,z]),Ae=H(()=>it?[...it.currentModels,...it.isExpanded?it.legacyModels:[]]:Vt,[Vt,it]),Oe=m!==void 0,Ue=H(()=>{if(!Oe)return EN;let D=C.trim();return D.length===0?h:h.map(X=>({action:X,score:LN(X,D)})).filter(X=>X.score!==null).toSorted((X,se)=>X.score-se.score||X.action.title.localeCompare(se.action.title)).map(X=>X.action)},[C,h,Oe]),et=Oe&&(!we||Ue.length>0),Me=H(()=>et?[...Ue.map(D=>Du(D.id)),gd]:$W,[et,Ue]),Te=H(()=>new Map(Ue.map(D=>[Du(D.id),D])),[Ue]),ht=Me[0]??null,Wt=$(D=>{ne(X=>{let se=new Set(X);return se.has(D)?se.delete(D):se.add(D),se})},[]),fn=$((D,X)=>y.model.resolvePickerRowAction({disabledReason:a?.(D,X)??null,continuationLabel:s?i?.(D,X)??null:null}),[i,a,s]),Ft=$((D,X)=>{let se=fn(X,D);if(se.kind==="blocked")return;if(se.kind==="continue"){s?.(X,D);return}let re=o.get(X);if(!re)return;let de=ge.get(X);if(!de)return;let tt=y.model.resolveSelectableModel(de.driverKind,D,re);tt&&l(X,tt)},[ge,o,s,l,fn]),en=$(D=>{let X=uN(D);if(X){Wt(X);return}if(D===gd){p?.();return}let se=fN(D);if(se!==null){m?.(se);return}let re=pN(D);if(re){let tt=c?.find(vt=>vt.selection.environmentId===re.environmentId&&vt.runtimeId===re.runtimeId&&vt.sourceId===re.sourceId&&vt.profileId===re.profileId&&(vt.endpointId??void 0)===(re.endpointId??void 0));if(!tt||!tt.legacyInstanceId)return;if(d){d(tt);return}Ft(tt.modelId,tt.legacyInstanceId);return}let de=BC(D);de&&Ft(de.slug,de.instanceId)},[c,Ft,d,p,m,Wt]),tn=$(D=>{if(N===null)return;let X=R.findIndex(re=>AN(D,re,N)),se=[...R];X>=0?se.splice(X,1):se.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:se})},[N,R,W]),Rt=H(()=>{let D=new Map,X=0;for(let se of Ae){if(se.ready===!1||fn(se.instanceId,se.slug).kind==="blocked")continue;let re=y.keybindings.modelPickerJumpCommandForIndex(X);if(!re)return D;D.set(Fu(se),re),X+=1}return D},[fn,Ae]),Un=H(()=>[...Rt.keys()],[Rt]),kn=H(()=>[...ye.map(D=>Fu(D)),...new Set(ye.filter(D=>D.isLegacy).map(D=>zC(D.instanceId))),...Oe?[...h.map(D=>Du(D.id)),gd]:[]],[ye,h,Oe]),pn=H(()=>{let D=Ae.map(X=>Fu(X));return it&&D.splice(it.currentModels.length,0,it.key),Me.length>0?[...D,...Me]:D},[it,Me,Ae]),Pn=H(()=>new Map(Ae.map(D=>[Fu(D),D])),[Ae]),Pt=$(()=>{let D=A.current?.getScrollableNode();if(!(D instanceof HTMLElement))return;let X=Math.max(0,D.scrollHeight-D.clientHeight);S(D.scrollTop>1),I(X-D.scrollTop>1)},[]),ln=H(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Dn=H(()=>{if(Rt.size===0)return PN;let D={platform:navigator.platform,context:ln},X=new Map;for(let[se,re]of Rt){let de=y.keybindings.shortcutLabelForCommand(ee,re,D);de&&X.set(se,de)}return X.size>0?X:PN},[ee,Rt,ln]),io=g===null?f?$C(f):_u(t.activeInstanceId,t.model):Du(g),Gt=H(()=>({favoritesSet:ue,modelJumpLabelByKey:Dn,selectedItemKey:io}),[ue,Dn,io]);return y.pane.useKeydown(D=>{if(D.defaultPrevented||D.repeat)return;let X=y.keybindings.resolveShortcutCommand(D,ee,{platform:navigator.platform,context:ln}),se=y.keybindings.modelPickerJumpIndexFromCommand(X??"");if(se===null)return;let re=Un[se];if(!re)return;let de=BC(re);de&&(D.preventDefault(),D.stopPropagation(),Ft(de.slug,de.instanceId))},{capture:!0}),he(()=>{S(!1),I(pn.length>5);let D=0,X=window.requestAnimationFrame(()=>{Pt(),D=window.requestAnimationFrame(Pt)});return()=>{window.cancelAnimationFrame(X),window.cancelAnimationFrame(D)}},[pn,Pt]),u(YI,{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(SN,{selectedInstanceId:z,onSelectInstance:Ce,instanceEntries:ct,showFavorites:!0,...dt?{disabledInstanceIds:dt,getDisabledInstanceTooltip:D=>x("instance.lockedToThread",{name:D.displayName})}:{}}),u(GI,{inline:!0,items:kn,filteredItems:pn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:io,onItemHighlighted:(D,X)=>{E.current=typeof D=="string"?D:null,X.reason==="keyboard"&&X.index>=0&&A.current?.scrollIndexIntoView?.({index:X.index,animated:!1})},onValueChange:D=>{typeof D=="string"&&en(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(oe,{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(QI,{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"&&E.current){D.preventBaseUIHandler?.(),D.preventDefault(),D.stopPropagation(),en(E.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(XI,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(cN,{ref:A,data:pn,extraData:Gt,keyExtractor:D=>D,renderItem:({item:D,index:X})=>{if(it?.key===D)return b(xl,{hideIndicator:!0,index:X,value:D,"aria-expanded":it.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:it.legacyModels.length})})]}),u(Uo,{className:F("size-4 transition-transform",it.isExpanded&&"rotate-90")})]});let se=Te.get(D);if(se)return u(KW,{index:X,itemKey:D,action:se,showSectionHeader:D===ht});if(D===gd)return u(qW,{index:X,showSectionHeader:D===ht});let re=Pn.get(D);if(!re)return null;let de=re.ready===!1?{kind:"blocked",reason:v("modelPicker.notReady")}:fn(re.instanceId,re.slug);return u(mN,{index:X,model:re,instanceId:re.instanceId,itemKey:Fu(re),sourceLabel:re.sourceLabel,providerId:re.providerId,providerDisplayName:re.instanceDisplayName,providerAccentColor:re.instanceAccentColor,providerAccountEmail:re.instanceAccountEmail,isFavorite:Be(re),isSelected:D===io,showProvider:!0,preferShortName:!te,useTriggerLabel:!1,jumpLabel:Dn.get(D)??null,disabledReason:de.kind==="blocked"?de.reason:null,actionLabel:de.kind==="continue"?de.label:null,onToggleFavorite:()=>tn(re)},D)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:UW,onLayout:Pt,onScroll:Pt,className:F("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",kN({top:k,bottom:L}))})})}),u(jI,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:v("modelPicker.noModelsFound")})]})})]})})});var NN="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 Ur({className:e,size:t="sm",variant:n="ghost",...o}){return u(oe,{className:F(NN,e),size:t,variant:n,...o})}function gr({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 Fi(){return u(un,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function wg({className:e,size:t="sm",variant:n="ghost",...o}){return u(MI,{className:F(NN,e),icon:u(Fi,{}),size:t,variant:n,...o})}function VW(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 WW(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 _N=ce(function(t){let{t:n}=ze(),[o,r]=G(!1),i=si()&&(t.open??o),s=H(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=WW(t.composerChoices,t.selectedExecutionSelection),f=VW({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]"),A=N=>{T(N.target)||N.preventDefault()},E=N=>{T(N.target)||N.preventDefault()};return document.addEventListener("wheel",A,{capture:!0,passive:!1}),document.addEventListener("touchmove",E,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",A,{capture:!0}),document.removeEventListener("touchmove",E,{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?KC(x.description):null;return b(gl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(vl,{render:u(Ur,{"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(xe,{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(xe,{children:[s?u(wa,{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(Fi,{})})]}),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(RN,{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}:{}})})]})});pe();var DN=ce(function(t){let n=_(null);return he(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Pf,{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(Mf,{className:"max-h-72 scroll-pb-6",children:u(Ef,{children:t.items.map(o=>u(GW,{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.")})})})})}),GW=ce(function(t){let n=t.item.type==="skill"?pM(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Af,{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(xe,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),da(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(XW,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),jW={app:Md,repo:li,project:li,personal:Zr,system:Xd,other:Wd},QW={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function XW(e){let t=jW[e.kind];return b(ml,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),QW[e.kind],e.showSkillSuffix?" Skill":null]})}pe();function YW(e){return e!==null&&"tagName"in e&&"closest"in e}function Tg(e){return YW(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function qC(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function ON(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function FN(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return ON(t,"accept");case"Escape":return ON(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=qC(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var JW=2e3,ZW="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",eG=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function tG(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 VC=ce(function({requestId:t,isResponding:n,options:o=eG,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=ze(),l=_t(),d=a==="native"||a==="queued",[c,f]=G(""),p=_([]);q(()=>{f("")},[t]);let m=$(g=>{let v=g==="decline"?c.trim():"";i(t,g,v.length>0?v:void 0)},[c,i,t]),h=$(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=Tg(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=FN(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(xe,{children:o.map((g,v)=>{let x=v<9?v+1:null,y=b(oe,{ref:C=>{p.current[v]=C},size:"xs",variant:g.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":tG(g.decision,v),className:`${ZW}${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(kf,{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(oi,{children:[u(pf,{type:"text",value:c,disabled:n,maxLength:JW,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)})})});pe();pe();var Lg=["approval-required","auto-accept-edits","auto","full-access"];var nG={"approval-required":qd,"auto-accept-edits":Jr,auto:ci,"full-access":di},oG={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function kg(){let{t:e}=ze();return $(t=>{let n=oG[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:nG[t]}},[e])}var BN=ce(function(t){let{t:n}=ze(),o=kg();return b(Zo,{children:[u(nr,{render:u(oe,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":"More composer controls"}),children:u(Jo,{"aria-hidden":"true",className:"size-4"})}),b(tr,{align:"start",children:[t.traitsMenuContent?b(xe,{children:[t.traitsMenuContent,u(ui,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(xe,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Mode"}),b(Ta,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Ir,{value:"default",children:"Chat"}),u(Ir,{value:"plan",children:"Plan"})]}),u(ui,{})]}):null,t.nativeMode===null?b(xe,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),u(Ta,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Lg.map(r=>u(Ir,{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(xe,{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(Ta,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Ir,{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})]})]})]})});pe();var rG=(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"),aG=e=>{e.preventDefault()},Pg=ce(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}=ze(),y=_t(),C=p?{onPointerDown:aG}: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(oe,{size:"icon-sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(Gi,{})}):u(oe,{size:"sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(oe,{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:rG(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(r)return a?u(oe,{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(oe,{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(Zo,{children:[u(nr,{render:u(oe,{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(un,{})}),u(tr,{align:"end",side:"top",children:u(er,{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(ZI,{compact:!0})}):null,l||i?u(mf,{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(xe,{children:[L(!1),m&&f?I:null]}):I});pe();var iG=["command","cmd"],sG=["file_path","filePath","path","notebook_path","notebookPath"],lG=["url"],dG=["query","q"],cG=["name","skill","skill_name","skillName"],zN=["toolName","tool_name"],$N=["description"],uG=[],fG=[];function Ga(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 pG(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function mG(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function UN(e){let t=e.args??uG,n=e.fileChanges??fG,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=Ga(t,iG,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Ga(t,sG,o)??mG(n);d!==null&&(i=pG(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Ga(t,lG,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Ga(t,dG,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Ga(t,cG,o)??Ga(t,zN,o),l=Ga(t,$N,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Ga(t,zN,o),l=Ga(t,$N,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 gG={"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"},hG={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"},vG={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"},xG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function KN(e,t){let n=e.subject!==null?gG[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(hG[e.kind])}function qN(e,t){return t(vG[e])}function VN(e,t){return t(xG[e])}function WN(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=HN(t.oldText??""),o=HN(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3713
3713
  +++ b/${e.path}
3714
3714
  `,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
3715
3715
  `,i=[...n.map(s=>`-${s}`),...o.map(s=>`+${s}`)];return`${r}${a}${i.join(`
3716
3716
  `)}
3717
- `}function tN(e){if(e.length===0)return[];let t=e.split(`
3718
- `);return t.at(-1)===""?t.slice(0,-1):t}function sN(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 lN(e){return{additions:e.additions??0,deletions:e.deletions??0}}ue();ue();var Mle=(()=>{try{return!1}catch{return!1}})(),dN=/(?=^From [a-f0-9]+ .+$)/m,xC=/(?=^diff --git)/gm;var cN=/^(---|\+\+\+)\s+([^\t\r\n]+)/,uN=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,fN=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,pN=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var SW={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Rle={...SW,hunkLineCount:1};var Nle=Object.freeze({fromStart:0,fromEnd:0});function yC(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var wW=new TextEncoder,TW=new TextDecoder("utf-8",{ignoreBOM:!0}),LW=/[\uD800-\uDFFF]/,CC=1024,Ql=new Uint8Array(CC);function mN(){Ql.length!==CC&&(Ql=new Uint8Array(CC))}function Ln(e){if(e.length===0)return e;if(LW.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Ql.length<t&&(Ql=new Uint8Array(t));let{written:n}=wW.encodeInto(e,Ql);return TW.decode(Ql.subarray(0,n))}function hN(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=PW(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}kW(t,e)}}function kW(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 PW(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(gN(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(gN(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+=EW(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 AW=/\s+/g;function gN(e){return e.replace(AW,"")}function EW(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 MW(e,t,n){try{return RW(e,t,n)}finally{mN()}}function RW(e,t,n=!1){let o=HW(e),r=o?DW(e):OW(e),a,i=[];for(let s of r){if(o&&!xC.test(s)){if(a==null)a=Ln(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!FW(s)){if(a==null)a=Ln(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=NW(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function NW(e,{cacheKey:t,isGitDiff:n=xC.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=TN(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=IN(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=wN(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?vN(r.contents):[],deletionLines:!d&&o!=null&&r!=null?vN(o.contents):[],cacheKey:CN(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let S of m){if(S.startsWith("diff --git")){let E=S.trim().match(fN),B=E?.[1]??E?.[2],R=E?.[3]??E?.[4];if(B==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",S);continue}l.name=Ln(R.trim()),B!==R&&(l.prevName=Ln(B.trim()));continue}let A=S.startsWith("---")||S.startsWith("+++")?S.match(n?uN:cN):null;if(A!=null){let[,E,B]=A;if(E==="---"&&B!=="/dev/null"){let R=Ln(B.trim());l.prevName=R,l.name=R}else E==="+++"&&B!=="/dev/null"&&(l.name=Ln(B.trim()))}else if(n){if(S.startsWith("new mode ")&&(l.mode=Ln(S.slice(8).trim())),S.startsWith("old mode ")&&(l.prevMode=Ln(S.slice(8).trim())),S.startsWith("new file mode")&&(l.type="new",l.mode=Ln(S.slice(13).trim())),S.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Ln(S.slice(17).trim())),S.startsWith("similarity index")&&(S.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),S.startsWith("index ")){let[,E,B,R]=S.trim().match(pN)??[];E!=null&&(l.prevObjectId=Ln(E)),B!=null&&(l.newObjectId=Ln(B)),R!=null&&(l.mode=Ln(R))}S.startsWith("rename from ")&&(l.prevName=Ln(S.slice(12).trim())),S.startsWith("rename to ")&&(l.name=Ln(S.slice(10).trim()))}}continue}let y,C;for(;m.length>0&&(m[m.length-1]===`
3717
+ `}function HN(e){if(e.length===0)return[];let t=e.split(`
3718
+ `);return t.at(-1)===""?t.slice(0,-1):t}function GN(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 jN(e){return{additions:e.additions??0,deletions:e.deletions??0}}pe();pe();var Hde=(()=>{try{return!1}catch{return!1}})(),QN=/(?=^From [a-f0-9]+ .+$)/m,WC=/(?=^diff --git)/gm;var XN=/^(---|\+\+\+)\s+([^\t\r\n]+)/,YN=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,JN=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,ZN=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var yG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Ude={...yG,hunkLineCount:1};var Kde=Object.freeze({fromStart:0,fromEnd:0});function GC(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var CG=new TextEncoder,bG=new TextDecoder("utf-8",{ignoreBOM:!0}),IG=/[\uD800-\uDFFF]/,jC=1024,hd=new Uint8Array(jC);function e_(){hd.length!==jC&&(hd=new Uint8Array(jC))}function _n(e){if(e.length===0)return e;if(IG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;hd.length<t&&(hd=new Uint8Array(t));let{written:n}=CG.encodeInto(e,hd);return bG.decode(hd.subarray(0,n))}function n_(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=wG(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}SG(t,e)}}function SG(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 wG(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(t_(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(t_(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+=LG(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 TG=/\s+/g;function t_(e){return e.replace(TG,"")}function LG(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 kG(e,t,n){try{return PG(e,t,n)}finally{e_()}}function PG(e,t,n=!1){let o=FG(e),r=o?MG(e):RG(e),a,i=[];for(let s of r){if(o&&!WC.test(s)){if(a==null)a=_n(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!NG(s)){if(a==null)a=_n(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=EG(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function EG(e,{cacheKey:t,isGitDiff:n=WC.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=u_(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=l_(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=c_(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?o_(r.contents):[],deletionLines:!d&&o!=null&&r!=null?o_(o.contents):[],cacheKey:i_(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 E=T.trim().match(JN),N=E?.[1]??E?.[2],R=E?.[3]??E?.[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=_n(R.trim()),N!==R&&(l.prevName=_n(N.trim()));continue}let A=T.startsWith("---")||T.startsWith("+++")?T.match(n?YN:XN):null;if(A!=null){let[,E,N]=A;if(E==="---"&&N!=="/dev/null"){let R=_n(N.trim());l.prevName=R,l.name=R}else E==="+++"&&N!=="/dev/null"&&(l.name=_n(N.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=_n(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=_n(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=_n(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=_n(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[,E,N,R]=T.trim().match(ZN)??[];E!=null&&(l.prevObjectId=_n(E)),N!=null&&(l.newObjectId=_n(N)),R!=null&&(l.mode=_n(R))}T.startsWith("rename from ")&&(l.prevName=_n(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=_n(T.slice(10).trim()))}}continue}let y,C;for(;m.length>0&&(m[m.length-1]===`
3719
3719
  `||m[m.length-1]==="\r"||m[m.length-1]===`\r
3720
- `||m[m.length-1]==="");)m.pop();let{additionStart:w,deletionStart:k}=g;c=d?c:k-1,f=d?f:w-1;let T={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:CN(g.hunkContext),hunkSpecs:Ln(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},L=0,b=0;for(let S=1;S<m.length;S++){let A=m[S];if(L>=T.additionCount&&b>=T.deletionCount&&!A.startsWith("\\")){if(a&&BW(A)&&!zW(A))throw Error("parsePatchContent: hunk has more lines than expected");break}let E=A[0];if(E!=="+"&&E!=="-"&&E!==" "&&E!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${E}", full line: "${A}"`),console.error("processFile: invalid rawLine:",A);continue}let B=UW(E);if(B==="addition"){if(a&&L>=T.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=bC(A);(y==null||y.type!=="change")&&(y=IC("change",c,f),T.hunkContent.push(y)),f++,L++,d&&l.additionLines.push(R),y.additions++,v++,C="addition"}else if(B==="deletion"){if(a&&b>=T.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=bC(A);(y==null||y.type!=="change")&&(y=IC("change",c,f),T.hunkContent.push(y)),c++,b++,d&&l.deletionLines.push(R),y.deletions++,x++,C="deletion"}else if(B==="context"){if(a&&(b>=T.deletionCount||L>=T.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=bC(A);(y==null||y.type!=="context")&&(y=IC("context",c,f),T.hunkContent.push(y)),f++,c++,L++,b++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),y.lines++,C="context"}else if(B==="metadata"&&y!=null){if(y.type==="context"?(T.noEOFCRAdditions=!0,T.noEOFCRDeletions=!0):C==="deletion"?T.noEOFCRDeletions=!0:C==="addition"&&(T.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=yC(l.additionLines[R]))}if(d&&(C==="deletion"||C==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=yC(l.deletionLines[R]))}}}if(a&&(L!==T.additionCount||b!==T.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");T.additionLines=v,T.deletionLines=x,T.collapsedBefore=Math.max(T.additionStart-1-i,0),l.hunks.push(T),i=T.additionStart+T.additionCount-1;for(let S of T.hunkContent)S.type==="context"?(T.splitLineCount+=S.lines,T.unifiedLineCount+=S.lines):(T.splitLineCount+=Math.max(S.additions,S.deletions),T.unifiedLineCount+=S.deletions+S.additions);T.splitLineStart=l.splitLineCount+T.collapsedBefore,T.unifiedLineStart=l.unifiedLineCount+T.collapsedBefore,l.splitLineCount+=T.collapsedBefore+T.splitLineCount,l.unifiedLineCount+=T.collapsedBefore+T.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),hN(l),l}}function bN(e,t,n=!1){let o=[],r=_W(e)?e.split(dN):[e];for(let a of r)try{o.push(MW(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function _W(e){return e.startsWith("From ")||e.includes(`
3721
- From `)}function vN(e){let t=IN(e);for(let n=0;n<t.length;n++)t[n]=Ln(t[n]);return t}function IN(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3722
- `,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 DW(e){return TN(e,"diff --git")}function OW(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=SC(e,o);if(r<=0&&a<=0){if(SN(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=SC(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=wN(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 FW(e){return SN(e,0)}function SN(e,t){let n=SC(e,t);return xN(e,t,"---")&&xN(e,n,"+++")}function xN(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
- `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function SC(e,t){let n=e.indexOf(`
3724
- `,t);return n===-1?e.length:n+1}function BW(e){let t=e[0];return t==="+"||t==="-"||t===" "}function zW(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3725
- `&&n!=="\r")return!1}return!0}function wN(e){if(!e.startsWith("@@ -"))return;let t=4,n=lg(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=lg(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=lg(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=lg(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=$W(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function lg(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 $W(e){return e.endsWith(`\r
3720
+ `||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:i_(g.hunkContext),hunkSpecs:_n(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},L=0,I=0;for(let T=1;T<m.length;T++){let A=m[T];if(L>=S.additionCount&&I>=S.deletionCount&&!A.startsWith("\\")){if(a&&_G(A)&&!DG(A))throw Error("parsePatchContent: hunk has more lines than expected");break}let E=A[0];if(E!=="+"&&E!=="-"&&E!==" "&&E!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${E}", full line: "${A}"`),console.error("processFile: invalid rawLine:",A);continue}let N=BG(E);if(N==="addition"){if(a&&L>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=QC(A);(y==null||y.type!=="change")&&(y=XC("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=QC(A);(y==null||y.type!=="change")&&(y=XC("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=QC(A);(y==null||y.type!=="context")&&(y=XC("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]=GC(l.additionLines[R]))}if(d&&(C==="deletion"||C==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=GC(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),n_(l),l}}function s_(e,t,n=!1){let o=[],r=AG(e)?e.split(QN):[e];for(let a of r)try{o.push(kG(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function AG(e){return e.startsWith("From ")||e.includes(`
3721
+ From `)}function o_(e){let t=l_(e);for(let n=0;n<t.length;n++)t[n]=_n(t[n]);return t}function l_(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3722
+ `,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 MG(e){return u_(e,"diff --git")}function RG(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=YC(e,o);if(r<=0&&a<=0){if(d_(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=YC(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=c_(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 NG(e){return d_(e,0)}function d_(e,t){let n=YC(e,t);return r_(e,t,"---")&&r_(e,n,"+++")}function r_(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
+ `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function YC(e,t){let n=e.indexOf(`
3724
+ `,t);return n===-1?e.length:n+1}function _G(e){let t=e[0];return t==="+"||t==="-"||t===" "}function DG(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3725
+ `&&n!=="\r")return!1}return!0}function c_(e){if(!e.startsWith("@@ -"))return;let t=4,n=Eg(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Eg(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Eg(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=Eg(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=OG(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function Eg(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 OG(e){return e.endsWith(`\r
3726
3726
  `)?e.slice(0,-2):e.endsWith(`
3727
- `)?e.slice(0,-1):e}function HW(e){return e.startsWith("diff --git")||e.includes(`
3728
- diff --git`)}function TN(e,t){if(e.length===0)return[""];let n=`
3729
- ${t}`,o=e.startsWith(t)?0:yN(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=yN(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function yN(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function CN(e){return e==null?e:Ln(e)}function UW(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function bC(e){let t=e.slice(1);return Ln(t===""?`
3730
- `:t)}function IC(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 LN={light:"vscode-light-modern",dark:"vscode-dark-modern"};function PN(e){return e==="dark"?LN.dark:LN.light}var AN=2166136261,EN=16777619,KW=2654435769,VW=2246822507;function kN(e,t=AN,n=EN){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 qW(e,t="diff-panel"){let n=e.trim(),o=kN(n,AN,EN).toString(36),r=kN(n,KW,VW).toString(36);return`${t}:${n.length}:${o}:${r}`}function wC(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 MN(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=bN(o,qW(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(wC):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 RN(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function NN({fileChange:e,onOpenDiff:t}){let{t:n}=_e(),[o,r]=K(!1),a=$(()=>iN(e),[e]),i=lN(e);return I("div",{className:"min-w-0",children:[I("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")}):I(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(Eo,{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(WW,{path:e.path,unifiedDiff:a}):null]})}function WW({path:e,unifiedDiff:t}){let n=Mt().theme.useResolvedTheme(),o=$(()=>{let r=MN(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:RN(wC(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(SI,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:PN(n),themeType:n,stickyHeaders:!1}})})}var GW="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",_N=de(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=_e(),i=nN(t),{body:s}=i,l=sN(i.fileChanges);return I("div",{"aria-label":rN(i.kind,a),className:z("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[I("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:oN(i,a)}),n>1?I("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":aN(s.shape,a),className:z(GW,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(NN,{fileChange:d,onOpenDiff:o},l[c])),i.args.length===0?null:I("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=>I("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 TC=de(function(t){return u(_N,{...t})});function dg(e){return e.id??e.label}function LC(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?[dg(o)]:[]})))}function jW(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function kC(e,t){let n=jW(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=LC(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function QW(e,t){let n={};for(let o of e){let r=kC(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function XW(e,t){return e.reduce((n,o)=>kC(o,t[o.id])?n+1:n,0)}function DN(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?kC(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=XW(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?LC(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:QW(e,t)!==null,canAdvance:!!i}}ue();var PC=de(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(YW,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),YW=de(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=_e(),l=Mt(),d=DN(t.questions,o,r),c=d.activeQuestion,f=_(null),p=_(i),[m,h]=K(null),[g,v]=K(null),x=g!==null&&g===c?.id;V(()=>{p.current=i},[i]),V(()=>{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]),V(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=U((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||rg(w.target))return;let k=hC(w.key,c.options.length);if(k===null)return;let T=c.options[k];T&&(w.preventDefault(),y(c.id,dg(T)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return I(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:I(vI,{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?I("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:z("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",x&&"rotate-180")})]})}),u(hI,{className:"px-3 sm:px-4",children:I("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(Go,{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 T=dg(w),b=m?.questionId===c.id&&m.optionLabel===T||!C&&d.selectedOptionLabels.includes(T),S=k<9?k+1:null,A=z("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",b?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),E=I(pe,{children:[I("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]}),b?u(fo,{className:"size-icon-2 shrink-0 text-primary"}):S!==null?u("kbd",{className:z("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:S}):null]});return u("button",{type:"button","aria-pressed":b,disabled:n,onClick:()=>{y(c.id,T)},className:A,children:E},`${c.id}:${T}`)})})]})})]})});ue();var ON=de(function({planTitle:t}){let{t:n}=_e();return u("div",{className:"px-3 py-2 sm:px-4",children:I("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]})})});ue();function FN(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 BN(e){return e.description??e.name}var zN=de(function(t){let{current:n,modes:o}=t.nativeMode,r=BN(n);return!t.canSwitch||o.length<2?I(je,{children:[I(Xe,{render:u(Pr,{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(nr,{icon:Qs}),u("span",{children:n.name})]}),I(Qe,{side:"top",children:[u("span",{className:"block font-medium",children:r}),o.length>1?I("span",{className:"mt-1 block text-muted-foreground text-xs",children:["Agent modes: ",o.map(a=>a.name).join(", ")]}):null]})]}):I(je,{children:[I(Xu,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[I(Xe,{render:u(og,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(nr,{icon:Qs}),u(Zu,{children:n.name})]}),u(Ju,{alignItemWithTrigger:!1,children:o.map(a=>u(Yu,{value:a.id,hideIndicator:!0,className:"min-w-56 py-2",children:I("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(Qe,{side:"top",children:r})]})});function AC(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 EC(e,t){let n=e.name.toLowerCase(),o=ea(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 $N(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=no(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=EC(i,r);s!==null&&tg(a,{item:i,score:s,tieBreaker:`${ea(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function JW(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?EC(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 HN(e,t){let n=no(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=JW(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 ZW(e){return typeof e!="string"?null:e.trim()||null}function eG(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function tG(e,t){return e?.find(o=>o.id===t)?.value}function UN(e,t){let n=ZW(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 nG(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?UN(e,t):UN(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function cg(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(eG).map(r=>nG(r,tG(n,r.id)??r.currentValue))}function _s(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function MC(e){if(!e)return;if(e.type==="boolean")return typeof e.currentValue=="boolean"?e.currentValue?"On":"Off":void 0;let t=_s(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function ug(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=_s(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function hu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function KN(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3731
- ${n}`}ue();var oG=`Ultrathink:
3732
- `;function rG(){let{t:e}=_e();return u(Xs,{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 VN(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=_s(e);return typeof t=="string"?t:null}function aG(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=cg({caps:l,selections:a}),c=d.filter(b=>b.type==="select"),f=d.filter(b=>b.type==="boolean"),p=c[0]??null,m=c.find(b=>b.id==="contextWindow")??null,h=c.find(b=>b.id==="agent")??null,g=f.find(b=>b.id==="fastMode")??null,v=f.find(b=>b.id==="thinking")??null,x=i&&(p?.promptInjectedValues?.length??0)>0&&hu(r),y=x&&hu(r.replace(/^Ultrathink:\s*/i,"")),C=(x?"ultrathink":fg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,k=fg(m),T=fg(h),L=h?MC(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:T,selectedAgentLabel:L}}function RC(e){let t=aG(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 NC(e){return RC(e).hasAnyControls}var _C=de(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=Mt(),m=p.draft.useStore(b=>b.setProviderModelOptions),h=U(b=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(b);return}let S=c.threadRef??c.draftId;S&&m(S,t,b,{...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}=RC({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),T=b=>{h(ug(b))},L=(b,S)=>{if(S){if(b.promptInjectedValues?.includes(S)){let A=a.trim().length===0?oG:KN(a,"ultrathink");i(A);return}if(!(w&&b.id===y?.id)){if(C&&b.id===y?.id){let A=a.replace(/^Ultrathink:\s*/i,"");i(A)}T(VN(g,b.id,S))}}};return k?I(pe,{children:[v.map((b,S)=>{let A=C&&b.id===y?.id?"ultrathink":fg(b)??"";return I("div",{children:[S>0?u(Ga,{}):null,I(Bd,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:b.label}),w&&b.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:A,onValueChange:E=>L(b,E),children:b.options.map(E=>u(dr,{value:E.id,hideIndicator:!0,closeOnClick:!0,disabled:w&&b.id===y?.id,children:I("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:I("span",{className:"min-w-0 truncate",children:[E.label,E.isDefault?I(pe,{children:[" ",u(rG,{})]}):null]})}),E.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:E.description}):null]})},E.id))})]})]},b.id)}),x.map((b,S)=>{let A=b.currentValue===!0?"on":"off";return I("div",{children:[S>0||v.length>0?u(Ga,{}):null,I(Bd,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:b.label}),u(pa,{value:A,onValueChange:E=>{T(VN(g,b.id,E==="on"))},children:["on","off"].map(E=>u(dr,{value:E,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(E==="on"?"traits.on":"traits.off")})})},E))})]})]},b.id)})]}):null});function iG(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=_s(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")}):MC(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 qN=de(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]=K(!1),{t:g}=_e(),v=Mt().model,{descriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C}=RC({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!NC({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:k}=iG(g,{provider:t,descriptors:x,primarySelectDescriptorId:y?.id??null,ultrathinkPromptControlled:C}),T=k?I(pe,{children:[u(nr,{icon:qi,className:z("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:g("traits.fastModeOn")})]}):null,L=t==="codex";return I(Ko,{open:m,onOpenChange:b=>{h(b)},children:[u(Wo,{render:u(Pr,{variant:c??"ghost",className:z(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?I("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[T,u("span",{className:"min-w-0 truncate",children:w}),u(Ci,{})]}):I(pe,{children:[T,u("span",{children:w}),u(Ci,{})]})}),u(qo,{align:"start",children:u(_C,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function WN(e){return hu(e)?"ultrathink":"none"}function GN(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=cg({caps:l,selections:a}),c=d.find(h=>h.type==="select"),f=_s(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i==="ultrathink";return{provider:n,promptEffort:p,modelOptionsForDispatch:ug(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function jN(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)||!NC({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 QN(e){return jN(_C,e)}function XN(e){return jN(qN,e)}ue();var YN=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},JN=(e=>e?YN(e):YN);ue();var sG=e=>e;function lG(e,t=sG){let n=fn.useSyncExternalStore(e.subscribe,fn.useCallback(()=>t(e.getState()),[e,t]),fn.useCallback(()=>t(e.getInitialState()),[e,t]));return fn.useDebugValue(n),n}var ZN=e=>{let t=JN(e),n=o=>lG(t,o);return Object.assign(n,t),n},e_=(e=>e?ZN(e):ZN);var DC=e_(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 t_(e){return DC(t=>e===null?null:t.presetIdByDraftId[e]??null)}function OC(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var FC="__none__",n_=de(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=_e(),i=Mt().presets.useThreadPresets(t),s=t_(n),l=DC(c=>c.setDraftPresetId);if(n===null){let f=OC(i,o)?.displayName??o;return f===null?null:I(Pr,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(nr,{icon:ca}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=OC(i,s);return I(Ko,{children:[u(Wo,{render:u(Pr,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:I("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(nr,{icon:ca}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(Ci,{})]})}),u(qo,{align:"start",children:I(Bd,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),I(pa,{value:s??FC,onValueChange:c=>{l(n,c===FC?null:c)},children:[u(dr,{value:FC,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(dr,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:I("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))]})]})})]})});ue();function o_(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 dG(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 r_(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function cG(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function BC(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function zC(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 $C(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function uG(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=BC(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 a_(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=uG(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:cG(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:$C(o,t)})}return n}function i_(e){return e.snapshot===null||e.credentialIdentity===null?null:dG(e.snapshot,e)?e.snapshot:null}function s_(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function l_(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}ue();function d_(e,t){let n=_(e),o=_(0),r=_(!1),[a,i]=K(e),[s,l]=K(null),[d,c]=K(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=U(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 c_(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 u_(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=zC(e.durationMs);return o!==null?c_(o,t):mG(e.kind,t)}function fG(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 pG(e,t){let n=fG(e.display,t);if(e.kind==="quota-window")return`${u_(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function mG(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 gG(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 vu(e){return Kr(e,"locale")||e}function hG(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:vu(e.retryAt)});case"offline":return t("sourceMetrics.outcomeOffline");case"unsupported":return t("sourceMetrics.outcomeUnsupported");case"error":return t("sourceMetrics.outcomeError")}}function vG(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 HC(e,t){let n=BC(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 f_(e){let[t,n]=K(!1);return u(xG,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function xG(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=_e(),i=o_(r),{feedback:s,refreshing:l,refresh:d}=d_(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?i_(r):null,f=c?.metrics??[],p=a_(f,r.error),m=p.some(T=>T.stale)||r.error!==null&&c!==null,h=s_(p),g=l_(f),v=l,x=vG(r,p,a),y=r_(r),w=`${Fr()}-source-metrics-details`,k=[...p.map(T=>({key:`${T.metricId}\0${T.poolKey}`,text:pG(T,a)})),...h===null?[]:[{key:"resets-at",text:a("sourceMetrics.resetsAt",{time:vu(h)})}]];return I("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:[I("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:I("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[I("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:z("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((T,L)=>I("span",{children:[L>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,T.text]},T.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?I("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(T=>u(yG,{metric:T,queryError:r.error,t:a},T.metricId)),g!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("sourceMetrics.collectedAt",{time:vu(g)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:hG(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 yG({metric:e,queryError:t,t:n}){let o=HC(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):HC(e,e.remaining),a=HC(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:gG(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=$C(e,t),d=e.window?.durationMs??null,c=zC(d),f=u_({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return I("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:[I("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]}),I("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?I("span",{children:[o," ",n("sourceMetrics.used")]}):null,r!==null?I("span",{children:[r," ",e.unlimited===!0?null:n("sourceMetrics.remaining")]}):null,a!==null?I("span",{children:[a," ",n("sourceMetrics.limit")]}):null]}),I("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:vu(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("sourceMetrics.resetsAt",{time:vu(e.resetsAt)})}):null,c!==null?u("div",{children:c_(c,n)}):null,e.window?.nativePeriod!==null&&e.window?.nativePeriod!==void 0?u("div",{children:e.window.nativePeriod}):null]})}function Xl(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 p_(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?Gl(n):e.model}function m_(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 CG(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function g_(e){let{t}=_e(),{usage:n,modelDisplayName:o,onCompact:r,compactDisabled:a,compactDisabledReason:i}=e,s=CG(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 I(Ys,{children:[u(Zs,{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 ${Xl(n.usedTokens)} tokens used`,children:u("span",{className:"relative flex size-5 items-center justify-center",children:I("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(Js,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:I("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[I("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?I("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:s}),u("span",{className:"mx-1",children:"\xB7"}),I("span",{children:[Xl(n.usedTokens),"/",Xl(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:Xl(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?I("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:Xl(p)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:m_(t,o,n.autoCompactThreshold)}):null,r?I(pe,{children:[I(ne,{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 UC(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 KC(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 VC(e){return e.submissionTarget==="provider-turn"?KC(e.providerInput??e.prompt,e.maxInputChars):null}function h_(e){let t=e.disabledReason??VC(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 v_({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 x_(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function bG(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function y_(e){let t=Mt(),n=$u(),o=t.pane.useActive(),[r,a]=K(null);return Me(()=>{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&&bG(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:z(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 IG=['[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(","),qC=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,SG=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},wG=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function TG(e){return e.closest(IG)!==null}var LG=de(function(t){let{t:n}=_e(),o=ig(),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?I(pe,{children:[u(Od,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),I(je,{children:[I(Xe,{render:u(Pr,{className:z("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(nr,{icon:Ad,className:"text-current opacity-100"}):u(nr,{icon:Mi,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t.interactionMode==="plan"?"Plan":"Build"})]}),u(Qe,{side:"top",children:s})]})]}):null,c=I(pe,{children:[u(Od,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),I(je,{children:[I(Xu,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[I(Xe,{render:u(og,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(nr,{icon:a}),u(Zu,{children:r.label})]}),I(Ju,{alignItemWithTrigger:!1,children:[ag.map(f=>{let p=o(f),m=p.icon;return u(Yu,{value:f,hideIndicator:!0,className:"min-w-64 py-2",children:u("div",{className:"flex min-w-0 items-center gap-3",children:I("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[I("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(Qe,{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 I(pe,{children:[t.nativeMode?I(pe,{children:[u(Od,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),u(zN,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),kG=de(function(t){return I(pe,{children:[t.activeContextWindow?u(g_,{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(sg,{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})]})}),C_=de(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:T,pendingApprovals:L,pendingUserInputs:b,activePendingProgress:S,activePendingResolvedAnswers:A,activePendingIsResponding:E,activePendingDraftAnswers:B,activePendingQuestionIndex:R,respondingRequestIds:N,showPlanFollowUpPrompt:H,activeProposedPlan:D,activeTasksProgress:W,activeTaskSteps:xe,runtimeMode:ie,interactionMode:Q,lockedProvider:Ye,providerStatuses:Oe,activeProjectDefaultModelSelection:ke,projectId:Be=null,activeThreadModelSelection:Se,selectedExecutionSelection:ce,composerChoices:Ne,selectedExecutionReady:ge,selectedModelOptionDescriptors:ee,onModelPickerOpenChange:ye,onClearExecutionSelection:ct,executionAppliesTo:ut,activeContextWindow:lt,compactDisabled:ft,compactDisabledReason:zt,resolvedTheme:it,settings:Pe,keybindings:Re,terminalOpen:Fe,gitCwd:Ze,promptRef:we,composerRef:et,composerImagesRef:ht,composerTerminalContextsRef:$t,composerElementContextsRef:dn,onSend:_t,onInterrupt:Ht,onCompactContext:Gt,onImplementPlanInNewThread:Dt,onRespondToApproval:oo,onSelectActivePendingUserInputOption:yn,onAdvanceActivePendingUserInput:kn,onPreviousActivePendingUserInputQuestion:Dn,onChangeActivePendingUserInputCustomAnswer:kt,onProviderModelSelect:Cn,onModelSelectionChosen:St,onExecutionSelectionChosen:ro,onSelectPluginAction:cn,onManagePlugins:F,getModelDisabledReason:J,getModelContinuationLabel:ae,onContinueInModel:oe,toggleInteractionMode:le,handleRuntimeModeChange:Je,handleInteractionModeChange:Ve,handleNativeModeChange:wt,focusComposer:vt,scheduleComposerFocus:Yt,setThreadError:jt,onExpandImage:Ct}=t,fe=t.api,{limits:dt}=t.attachments,{t:rt}=_e(),Pt=fe.draft.useThreadDraft(n),ze=Pt.prompt,bt=Pt.images,un=$(()=>bt.filter(P=>kh(P)==="image"),[bt]),At=Pt.terminalContexts,Qt=Pt.elementContexts,nn=Pt.previewAnnotations,mn=Pt.reviewComments,Pn=Pt.nonPersistedImageIds,ao=fe.uploads.useStore(P=>P.uploadsByImageId),io=a?kw({imageIds:bt.map(P=>P.id),uploadsByImageId:ao,environmentId:o}):null,Jt=fe.draft.useStore,te=Jt(P=>P.setPrompt),Ge=Jt(P=>P.setNativeMode),xt=Jt(P=>P.addImage),tt=Jt(P=>P.addImages),An=Jt(P=>P.removeImage),Zt=Jt(P=>P.insertTerminalContext),on=Jt(P=>P.removeTerminalContext),rn=Jt(P=>P.setTerminalContexts),Co=Jt(P=>P.removeElementContext),an=Jt(P=>P.removePreviewAnnotation),Lo=Jt(P=>P.removeReviewComment),na=Jt(P=>P.clearComposerPromptAndImages);V(()=>{if(r){if(!a){for(let P of bt)fe.uploads.release(P.id);return}fe.draft.restoreAttachments();for(let P of bt)fe.uploads.start({environmentId:o,image:P})}},[r,bt,o,a]);let bn=$(()=>RR(fe.model.applyInstanceSettings(fe.model.deriveInstanceEntries(Oe),Pe)),[fe.model,Oe,Pe]),bi=Pt.activeProvider??null,Ee=f?.session?.providerInstanceId??Se?.instanceId??ke?.instanceId??null,oa=NR(bn,bi??Ee)??bn[0]?.driverKind??fe.model.makeDriverKind("unconfigured"),Ar=Ye??oa,so=$(()=>{if(!Ye||!f)return null;let P=f.session?.providerInstanceId??Se?.instanceId;return P?bn.find(q=>q.instanceId===P)?.continuationGroupKey??null:null},[f,Se?.instanceId,Ye,bn]),Ut=$(()=>{let P=[Pt.activeProvider,f?.session?.providerInstanceId,Se?.instanceId,ke?.instanceId];for(let Ue of P){if(!Ue)continue;let qe=bn.find(pt=>pt.instanceId===Ue&&Zm(pt));if(qe){if(Ye&&qe.driverKind!==Ye||so&&qe.continuationGroupKey!==so)continue;return qe.instanceId}}let q=bn.filter(Ue=>(!Ye||Ue.driverKind===Ye)&&(!so||Ue.continuationGroupKey===so)),se=q.filter(Ue=>Ue.driverKind===Ar);return eg(se,void 0)?.instanceId??eg(q,void 0)?.instanceId??fe.model.noProviderSelection.instanceId},[ke?.instanceId,f?.session?.providerInstanceId,Se?.instanceId,Pt.activeProvider,so,Ye,bn,Ar]),On=$(()=>bn.find(P=>P.instanceId===Ut),[bn,Ut]),Xt=On===void 0,Ii=zt??(Xt?"Compacting is unavailable right now":null),en=On?.driverKind??Ar,{modelOptions:Er,selectedModel:Kt,executionSelection:In}=fe.draft.useEffectiveModelState({threadRef:n,providers:Oe,selectedProvider:en,selectedInstanceId:Ut,threadModelSelection:Se,projectModelSelection:ke,settings:Pe}),En=ce===void 0?In:ce,he=$(()=>On?.snapshot??null,[On]),Yn=$(()=>{let P=On?.models??[];if(!En||ee===void 0)return P;let q=P.find(se=>se.slug===Kt);return[...P.filter(se=>se.slug!==Kt),{...q??{slug:Kt,name:Kt},capabilities:{...q?.capabilities,optionDescriptors:ee}}]},[On,En,ee,Kt]),ko=$(()=>WN(ze),[ze]),lo=$(()=>GN({provider:en,model:Kt,models:Yn,promptInjectionState:ko,modelOptions:Er?.[Ut],planModeEnabled:Pe.planModeEnabled},fe.model),[Er,ko,Ut,Kt,en,Yn,Pe.planModeEnabled]),ra=lo.promptEffort,aa=En?Er?.[Ut]??En.optionOverrides:lo.modelOptionsForDispatch,or=Pe.planModeEnabled,Oo=$(()=>({showInteractionModeToggle:or&&fe.model.getInteractionModeToggle(Oe,en),runtimeModeSwitch:rw(en)}),[or,Oe,en]),Oa=he?.supportsNativeModeSwitch===!0,Fn=m&&Oa?Pt.nativeModeByProvider?.[Ut]??null:null,rr=$(()=>FN(he,m?Fn:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,he,m,Fn]),Mr=Fn&&rr?.current.id===Fn?Fn:void 0,Si=U(P=>{m&&Ge(n,Ut,P),wt(P)},[m,Ge,n,Ut,wt]),Po=$(()=>fe.model.createSelection(Ut,Kt,aa),[fe.model,Ut,Kt,aa]),Fo=$(()=>!En||!Ne?.length?null:Ne.find(P=>P.runtimeId===En.runtimeId&&P.sourceId===En.sourceId&&P.profileId===En.profileId&&(P.endpointId??void 0)===(En.endpointId??void 0))??null,[Ne,En]),Rr=ge??Fo?.ready===!0,wi=_(null);V(()=>{let P=f?.id??null,q=wi.current;wi.current={threadId:P,selection:Po},!(q===null||q.threadId!==P||m)&&q.selection!==Po&&St?.(Po)},[f?.id,m,St,Po]);let ar=Kt,ia=$(()=>{let P=new Map;for(let q of bn)P.set(q.instanceId,fe.model.getAppModelOptionsForInstance(Pe,q));return P},[bn,Pe]),Yl=$(()=>(ia.get(Ut)??[]).some(q=>q.slug===ar)?ar:fe.model.normalizeSlug(ar,en)??ar,[fe.model,ia,Ut,ar,en]),ir=m&&Ye===null,Ds=fe.pluginComposer.useOptions(ir?o:null,Be),Nr=Ds.options,O=ir?Pt.selectedPluginActionKey:null,Z=$(()=>O===null?null:Nr.find(P=>P.id===O)??null,[O,Nr]),ve=O!==null,at=ve&&Z===null?rt(Ds.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,Bn=C??at??(S?null:io),_r=Bn!==null,Dr=$(()=>p_(Se,ia),[Se,ia]),[Ti,Bo]=K(()=>Mo(ze,ze.length)),[bo,sr]=K(()=>Xo(ze,ze.length)),[Os,zo]=K(null),[xu,pg]=K(null),[mg,yu]=K(!1),[Fs,Cu]=K(!1);V(()=>{ye?.(Fs)},[Fs,ye]);let[w_,bu]=K(!1),[Iu,gg]=K(null),[T_,hg]=K(null),[WC,L_]=K(null),[vg,Fa]=K(!1),[Jl,Zl]=K(!1),[k_,P_]=K(null),[Su,GC]=K({key:0,active:!1}),lr=Uf("max-sm"),gn=lr&&!h&&!w_,sa=_(null),jC=_(null),xg=_(null),QC=_(null),yg=_(!1),Cg=_(!1),bg=_(!1),XC=_([]),YC=_(null),co=_(null),Bs=_(null),zs=_(null),wu=_(!1),JC=_(0),$s=_(null),Ig=_(new Set),Li=_(new Map),Hs=$(()=>fe.chat.deriveComposerSendState({prompt:ze,imageCount:bt.length,terminalContexts:At,elementContextCount:Qt.length+nn.length+mn.length}),[Qt.length,bt.length,nn.length,mn.length,At,ze]),Us=bo?.kind??null,ZC=bo?.kind==="path"?bo.query:"",eb=Us==="path",Sg=fe.pathSearch.useComposerPathSearch({environmentId:o,cwd:eb?Ze:null,query:eb?ZC:null}),Ao=$(()=>{if(!bo)return[];if(bo.kind==="path")return Sg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:Gc(P.path),description:P.path.slice(0,Math.max(0,P.path.lastIndexOf("/")))}));if(bo.kind==="slash-command"){let P=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:"Switch response model for this thread"},...or?[{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"}]:[]],q=PE(he?.skills??[],Pe.showSkillsInSlashMenu),se=AE(he?.slashCommands??[],q).map(ot=>({id:`provider-slash-command:${en}:${ot.name}`,type:"provider-slash-command",provider:en,command:ot,label:`/${ot.name}`,description:ot.description??ot.input?.hint??"Run provider command"})),Ue=bo.query.trim().toLowerCase(),qe=q.map(ot=>({id:`skill:${en}:${ot.name}`,type:"skill",provider:en,skill:ot,label:`/skill:${ot.name}`,description:ot.shortDescription??ot.description??(ot.scope?`${ot.scope} skill`:"")})),pt=[...P,...se,...qe];return HN(pt,Ue)}return bo.kind==="skill"?$N(he?.skills??[],bo.query).map(P=>({id:`skill:${en}:${P.name}`,type:"skill",provider:en,skill:P,label:ea(P),description:P.shortDescription??P.description??(P.scope?`${P.scope} skill`:"Run provider skill")})):[]},[bo,or,en,he,Pe.showSkillsInSlashMenu,Sg.entries]),ki=!!bo,Ba=bo?`${bo.kind}:${bo.query.trim().toLowerCase()}`:null,tb=$(()=>{let P=AC({items:Ao,highlightedItemId:Os,currentSearchKey:Ba,highlightedSearchKey:xu});return Ao.find(q=>q.id===P)??null},[Os,xu,Ao,Ba]);bg.current=ki,XC.current=Ao,YC.current=tb;let A_=$(()=>new Set(Pn),[Pn]),Sn=T!==null,Tu=b[0]??null,nb=S?.activeQuestion?.allowFreeform===!1,Lu=Sn||b.length>0||!gn&&H&&D!==null,E_=gn&&!Sn&&b.length===0,M_=H||S!==null,{isComposerFooterCompact:ed,isComposerPrimaryActionsCompact:ob}=zw(xg,M_),R_=Us==="path"&&ZC.length>0&&Sg.isPending,N_=$(()=>Us==="skill"?"No skills found. Try / to browse provider commands.":Us==="path"?"No matching files or folders.":"No matching command.",[Us]),rb=U(P=>{if(P===we.current){Yt();return}we.current=P,te(n,P);let q=Mo(P,P.length);Bo(q),sr(Xo(P,P.length)),Yt()},[n,we,Yt,te]),__=QN({modelApi:fe.model,provider:en,instanceId:Ut,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:Kt,models:Yn,modelOptions:Er?.[Ut],prompt:ze,onPromptChange:rb,planModeEnabled:Pe.planModeEnabled}),ab=XN({modelApi:fe.model,provider:en,instanceId:Ut,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:Kt,models:Yn,modelOptions:Er?.[Ut],prompt:ze,onPromptChange:rb,planModeEnabled:Pe.planModeEnabled}),ku=$(()=>S?{questionIndex:S.questionIndex,isLastQuestion:S.isLastQuestion,canAdvance:S.canAdvance,isResponding:E,isComplete:!!A}:null,[E,S,A]),D_=v==="running"||y||_r||x||Xt||g||k!==null||!Hs.hasSendableContent,O_="Send message",td=lr&&!gn&&ku!==null,Ks=U(P=>{te(n,P)},[n,te]),F_=U(P=>{xt(n,P)},[n,xt]),B_=U(P=>{tt(n,P)},[n,tt]),z_=U(P=>{fe.uploads.release(P),An(n,P)},[fe.uploads,n,An]),$_=U(P=>{let q=At.findIndex(qe=>qe.id===P);if(q<0)return;let se=fe.terminalContext.removeInlinePlaceholder(we.current,q);we.current=se.prompt,Ks(se.prompt),on(n,P);let Ue=Mo(se.prompt,se.cursor);Bo(Ue),sr(Xo(se.prompt,se.cursor))},[n,At,we,on,Ks]);V(()=>{we.current=ze,Bo(P=>ur(ze,P))},[ze,we]),V(()=>{if(Iu===null)return;let P=KC(ze,dt.maxInputChars);P!==Iu&&gg(P)},[Iu,dt.maxInputChars,ze]),V(()=>{hg(null)},[Qt,nn,mn,At,ze,Kt,ra,en]),V(()=>{ht.current=bt},[bt,ht]),V(()=>{$t.current=At},[At,$t]),V(()=>{dn.current=Qt},[Qt,dn]),V(()=>{if(!ki){zo(null),pg(null);return}let P=AC({items:Ao,highlightedItemId:Os,currentSearchKey:Ba,highlightedSearchKey:xu});zo(q=>q===P?q:P),pg(q=>q===Ba?q:Ba)},[Os,xu,Ao,ki,Ba]);let Pu=_(null);V(()=>{let P=S?.customAnswer;if(typeof P!="string"){Pu.current=null;return}let q=Tu?.requestId??null,se=S?.activeQuestion?.id??null,Ue=Pu.current?.requestId!==q||Pu.current?.questionId!==se,qe=we.current!==P;if(Pu.current={requestId:q,questionId:se},!Ue&&!qe)return;we.current=P;let pt=Mo(P,P.length);Bo(pt),sr(Xo(P,Vr(P,pt))),zo(null)},[S?.customAnswer,S?.activeQuestion?.id,Tu?.requestId,we]),V(()=>{zo(null),gg(null),hg(null),Bo(Mo(we.current,we.current.length)),sr(Xo(we.current,we.current.length)),yu(!1)},[l,d,we]);let H_=U((P,q,se,Ue,qe)=>{if(S?.activeQuestion&&b.length>0){if(S.activeQuestion.allowFreeform===!1)return;Bo(q),sr(Ue?null:Xo(P,se)),kt(S.activeQuestion.id,P,q,se,Ue);return}we.current=P,Ks(P),wG(At,qe)||rn(n,SG(At,qe)),Bo(q),sr(Ue?null:Xo(P,se))},[S?.activeQuestion,b.length,kt,we,Ks,n,At,rn]),za=U((P,q,se,Ue)=>{let qe=we.current,pt=Math.max(0,Math.min(qe.length,P)),ot=Math.max(pt,Math.min(qe.length,q));if(Ue?.expectedText!==void 0&&qe.slice(pt,ot)!==Ue.expectedText)return!1;let hn=mw(we.current,P,q,se),pn=Mo(hn.text,hn.cursor),$a=Vr(hn.text,pn);we.current=hn.text;let $o=S?.activeQuestion;return $o&&Tu?kt($o.id,hn.text,pn,$a,!1):Ks(hn.text),Bo(pn),sr(Xo(hn.text,$a)),Ue?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{sa.current?.focusAt(pn)}),!0},[S?.activeQuestion,Tu,kt,we,Ks]),Au=U(()=>{let P=sa.current?.readSnapshot();return P||{value:we.current,cursor:Ti,expandedCursor:Vr(we.current,Ti),terminalContextIds:At.map(q=>q.id)}},[Ti,At,we]),wg=U(()=>{let P=Au();return{snapshot:P,trigger:Xo(P.value,P.expandedCursor)}},[Au]),ib=U(P=>{if(Cg.current)return;Cg.current=!0,window.requestAnimationFrame(()=>{Cg.current=!1});let{snapshot:q,trigger:se}=wg();if(se){if(P.type==="path"){let Ue=`${oc(P.path)} `,qe=qC(q.value,se.rangeEnd,Ue);za(se.rangeStart,qe,Ue,{expectedText:q.value.slice(se.rangeStart,qe)})&&zo(null);return}if(P.type==="slash-command"){if(P.command==="model"){za(se.rangeStart,se.rangeEnd,"",{expectedText:q.value.slice(se.rangeStart,se.rangeEnd),focusEditorAfterReplace:!1})&&(zo(null),Cu(!0));return}Ve(P.command==="plan"?"plan":"default"),za(se.rangeStart,se.rangeEnd,"",{expectedText:q.value.slice(se.rangeStart,se.rangeEnd)})&&zo(null);return}if(P.type==="provider-slash-command"){let Ue=`/${P.command.name} `,qe=qC(q.value,se.rangeEnd,Ue);za(se.rangeStart,qe,Ue,{expectedText:q.value.slice(se.rangeStart,qe)})&&zo(null);return}if(P.type==="skill"){let Ue=`$${P.skill.name} `,qe=qC(q.value,se.rangeEnd,Ue);za(se.rangeStart,qe,Ue,{expectedText:q.value.slice(se.rangeStart,qe)})&&zo(null);return}}},[za,Ve,wg]),U_=U(P=>{zo(P),pg(Ba)},[Ba]),sb=U(P=>{if(Ao.length===0)return;let q=Ao.findIndex(ot=>ot.id===Os),qe=((q>=0?q:P==="ArrowDown"?-1:0)+(P==="ArrowDown"?1:-1)+Ao.length)%Ao.length,pt=Ao[qe];zo(pt?.id??null)},[Os,Ao]),lb=U(()=>{if(!lr)return;co.current!==null&&(window.cancelAnimationFrame(co.current),co.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),bu(!1)},[lr]),db=U(()=>!lr||y||_r||x||Xt||k!==null||v==="running"?!1:S?S.isLastQuestion&&!!A:H||Hs.hasSendableContent,[S,A,Hs.hasSendableContent,k,x,lr,y,_r,Xt,v,H]),Tg=U((P,q="foreground")=>{if(Xt||_r){P?.preventDefault();return}if(d&&(Li.current.get(d)??0)>0){P?.preventDefault(),fe.notify.info("Still compressing a pasted image.","Send again once its thumbnail appears.");return}let se=h_({prompt:we.current,submissionTarget:S?"pending-user-input":"provider-turn",maxInputChars:dt.maxInputChars,disabledReason:Bn,event:P,onSend:Ue=>(yg.current=!1,_t(Ue,q),!yg.current)});gg(se.validationMessage),se.didDispatch&&db()&&lb()},[d,S,lb,_r,dt.maxInputChars,Xt,_t,we,Bn,db]),Lg=U(()=>{if(!(ft||Xt||Hs.hasSendableContent||T!==null||b.length>0||v==="running"||y||x||!d)){if((Li.current.get(d)??0)>0){fe.notify.info("Still compressing a pasted image.","Compact again once its thumbnail appears.");return}Gt()}},[T,d,ft,Hs.hasSendableContent,x,y,Xt,Gt,b.length,v]),Eu=U(()=>{co.current!==null&&(window.cancelAnimationFrame(co.current),co.current=null),Bs.current!==null&&window.cancelAnimationFrame(Bs.current),zs.current!==null&&window.cancelAnimationFrame(zs.current),wu.current=!0,bu(!0),Bs.current=window.requestAnimationFrame(()=>{Bs.current=null,sa.current?.focusAtEnd(),zs.current=window.requestAnimationFrame(()=>{zs.current=null,wu.current=!1})})},[]),K_=(P,q)=>{if(P==="Tab"&&q.shiftKey)return or?(le(),!0):!1;let{trigger:se}=wg();if(bg.current||se!==null){let pt=XC.current,ot=YC.current??pt[0];if(P==="ArrowDown"&&pt.length>0)return sb("ArrowDown"),!0;if(P==="ArrowUp"&&pt.length>0)return sb("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&ot)return ib(ot),!0}let qe=P==="Enter"?uw({isMobileViewport:lr,shiftKey:q.shiftKey,modifierKey:q.metaKey||q.ctrlKey,isDraftThread:i==="draft"}):null;return qe?(Tg(void 0,qe),!0):!1},Mu=fe.stash.useStore,Vs=Mu(P=>P.entries),cb=Mu(P=>P.stashEntry),Ru=Mu(P=>P.takeEntry),ub=Mu(P=>P.finalizeEntryImages);V(()=>()=>{$s.current!==null&&window.clearTimeout($s.current)},[]);let fb=U(()=>{JC.current+=1,GC({key:JC.current,active:!0}),$s.current!==null&&window.clearTimeout($s.current),$s.current=window.setTimeout(()=>{$s.current=null,GC(P=>({...P,active:!1}))},1200)},[]),V_=U(P=>{let{entry:q,durable:se}=Ru(P.id);if(!q)return;se||fe.notify.warning("Restored prompt may reappear in the stash","Browser storage rejected the update, so this entry could still be there after a reload."),Fa(!1);let Ue=we.current,qe=P.prompt.length===0?Ue:Ue.trim().length?`${Ue.replace(/\s+$/,"")}
3727
+ `)?e.slice(0,-1):e}function FG(e){return e.startsWith("diff --git")||e.includes(`
3728
+ diff --git`)}function u_(e,t){if(e.length===0)return[""];let n=`
3729
+ ${t}`,o=e.startsWith(t)?0:a_(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=a_(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function a_(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function i_(e){return e==null?e:_n(e)}function BG(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function QC(e){let t=e.slice(1);return _n(t===""?`
3730
+ `:t)}function XC(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 f_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function m_(e){return e==="dark"?f_.dark:f_.light}var g_=2166136261,h_=16777619,zG=2654435769,$G=2246822507;function p_(e,t=g_,n=h_){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 HG(e,t="diff-panel"){let n=e.trim(),o=p_(n,g_,h_).toString(36),r=p_(n,zG,$G).toString(36);return`${t}:${n.length}:${o}:${r}`}function JC(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 v_(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=s_(o,HG(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(JC):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 x_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function y_({fileChange:e,onOpenDiff:t}){let{t:n}=ze(),[o,r]=G(!1),a=H(()=>WN(e),[e]),i=jN(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(oe,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(un,{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(oe,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(UG,{path:e.path,unifiedDiff:a}):null]})}function UG({path:e,unifiedDiff:t}){let n=_t().theme.useResolvedTheme(),o=H(()=>{let r=v_(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:x_(JC(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(JI,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:m_(n),themeType:n,stickyHeaders:!1}})})}var KG="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",C_=ce(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=ze(),i=UN(t),{body:s}=i,l=GN(i.fileChanges);return b("div",{"aria-label":qN(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:KN(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":VN(s.shape,a),className:F(KG,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(y_,{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 ZC=ce(function(t){return u(C_,{...t})});function Ag(e){return e.id??e.label}function eb(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?[Ag(o)]:[]})))}function qG(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function tb(e,t){let n=qG(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=eb(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function VG(e,t){let n={};for(let o of e){let r=tb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function WG(e,t){return e.reduce((n,o)=>tb(o,t[o.id])?n+1:n,0)}function b_(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?tb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=WG(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?eb(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:VG(e,t)!==null,canAdvance:!!i}}pe();var nb=ce(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(GG,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),GG=ce(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=ze(),l=_t(),d=b_(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=$((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||Tg(w.target))return;let k=qC(w.key,c.options.length);if(k===null)return;let S=c.options[k];S&&(w.preventDefault(),y(c.id,Ag(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(qI,{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(WI,{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(un,{"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(VI,{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(or,{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=Ag(w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),T=k<9?k+1:null,A=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"),E=b(xe,{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:A,children:E},`${c.id}:${S}`)})})]})})]})});pe();var I_=ce(function({planTitle:t}){let{t:n}=ze();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]})})});pe();function S_(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 w_(e){return e.description??e.name}var T_=ce(function(t){let{current:n,modes:o}=t.nativeMode,r=w_(n);return!t.canSwitch||o.length<2?b(Xe,{children:[b(Je,{render:u(Ur,{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(gr,{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(gf,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[b(Je,{render:u(wg,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(gr,{icon:pl}),u(xf,{children:n.name})]}),u(vf,{alignItemWithTrigger:!1,children:o.map(a=>u(hf,{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 ob(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 rb(e,t){let n=e.name.toLowerCase(),o=da(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[Hr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Hr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Hr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Hr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Hr({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function L_(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=ho(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=rb(i,r);s!==null&&Ig(a,{item:i,score:s,tieBreaker:`${da(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function jG(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?rb(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=[Hr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Hr({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 k_(e,t){let n=ho(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=jG(r,n);a!==null&&Ig(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 QG(e){return typeof e!="string"?null:e.trim()||null}function XG(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function YG(e,t){return e?.find(o=>o.id===t)?.value}function P_(e,t){let n=QG(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 JG(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?P_(e,t):P_(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function Mg(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(XG).map(r=>JG(r,YG(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 ab(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 Rg(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 Bu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function E_(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3731
+ ${n}`}pe();var ZG=`Ultrathink:
3732
+ `;function e6(){let{t:e}=ze();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 A_(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 Ng(e){if(!e)return null;let t=Ys(e);return typeof t=="string"?t:null}function t6(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=Mg({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":Ng(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,k=Ng(m),S=Ng(h),L=h?ab(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 ib(e){let t=t6(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 sb(e){return ib(e).hasAnyControls}var lb=ce(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=ze(),p=_t(),m=p.draft.useStore(I=>I.setProviderModelOptions),h=$(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}=ib({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{h(Rg(I))},L=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){let A=a.trim().length===0?ZG:E_(a,"ultrathink");i(A);return}if(!(w&&I.id===y?.id)){if(C&&I.id===y?.id){let A=a.replace(/^Ultrathink:\s*/i,"");i(A)}S(A_(g,I.id,T))}}};return k?b(xe,{children:[v.map((I,T)=>{let A=C&&I.id===y?.id?"ultrathink":Ng(I)??"";return b("div",{children:[T>0?u(ui,{}):null,b(nc,{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(Ta,{value:A,onValueChange:E=>L(I,E),children:I.options.map(E=>u(Ir,{value:E.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:[E.label,E.isDefault?b(xe,{children:[" ",u(e6,{})]}):null]})}),E.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:E.description}):null]})},E.id))})]})]},I.id)}),x.map((I,T)=>{let A=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(ui,{}):null,b(nc,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Ta,{value:A,onValueChange:E=>{S(A_(g,I.id,E==="on"))},children:["on","off"].map(E=>u(Ir,{value:E,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(E==="on"?"traits.on":"traits.off")})})},E))})]})]},I.id)})]}):null});function n6(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")}):ab(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 M_=ce(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}=ze(),v=_t().model,{descriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C}=ib({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!sb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:k}=n6(g,{provider:t,descriptors:x,primarySelectDescriptorId:y?.id??null,ultrathinkPromptControlled:C}),S=k?b(xe,{children:[u(gr,{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(Zo,{open:m,onOpenChange:I=>{h(I)},children:[u(nr,{render:u(Ur,{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(Fi,{})]}):b(xe,{children:[S,u("span",{children:w}),u(Fi,{})]})}),u(tr,{align:"start",children:u(lb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function R_(e){return Bu(e)?"ultrathink":"none"}function N_(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=Mg({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:Rg(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function __(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)||!sb({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 D_(e){return __(lb,e)}function O_(e){return __(M_,e)}pe();var F_=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},B_=(e=>e?F_(e):F_);pe();var o6=e=>e;function r6(e,t=o6){let n=mn.useSyncExternalStore(e.subscribe,mn.useCallback(()=>t(e.getState()),[e,t]),mn.useCallback(()=>t(e.getInitialState()),[e,t]));return mn.useDebugValue(n),n}var z_=e=>{let t=B_(e),n=o=>r6(t,o);return Object.assign(n,t),n},$_=(e=>e?z_(e):z_);var db=$_(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 H_(e){return db(t=>e===null?null:t.presetIdByDraftId[e]??null)}function cb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var ub="__none__",U_=ce(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=ze(),i=_t().presets.useThreadPresets(t),s=H_(n),l=db(c=>c.setDraftPresetId);if(n===null){let f=cb(i,o)?.displayName??o;return f===null?null:b(Ur,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(gr,{icon:Ia}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=cb(i,s);return b(Zo,{children:[u(nr,{render:u(Ur,{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(gr,{icon:Ia}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(Fi,{})]})}),u(tr,{align:"start",children:b(nc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Ta,{value:s??ub,onValueChange:c=>{l(n,c===ub?null:c)},children:[u(Ir,{value:ub,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Ir,{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))]})]})})]})});pe();function K_(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 a6(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 q_(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function i6(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function fb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function pb(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 mb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function s6(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=fb(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 V_(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=s6(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:i6(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:mb(o,t)})}return n}function W_(e){return e.snapshot===null||e.credentialIdentity===null?null:a6(e.snapshot,e)?e.snapshot:null}function G_(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function j_(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}pe();function Q_(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=$(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 X_(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 Y_(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=pb(e.durationMs);return o!==null?X_(o,t):c6(e.kind,t)}function l6(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 d6(e,t){let n=l6(e.display,t);if(e.kind==="quota-window")return`${Y_(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function c6(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 u6(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 ea(e,"locale")||e}function f6(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 p6(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 gb(e,t){let n=fb(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 J_(e){let[t,n]=G(!1);return u(m6,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function m6(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=ze(),i=K_(r),{feedback:s,refreshing:l,refresh:d}=Q_(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?W_(r):null,f=c?.metrics??[],p=V_(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,h=G_(p),g=j_(f),v=l,x=p6(r,p,a),y=q_(r),w=`${jr()}-source-metrics-details`,k=[...p.map(S=>({key:`${S.metricId}\0${S.poolKey}`,text:d6(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(oe,{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(un,{"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(oe,{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(g6,{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:f6(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 g6({metric:e,queryError:t,t:n}){let o=gb(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):gb(e,e.remaining),a=gb(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:u6(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=mb(e,t),d=e.window?.durationMs??null,c=pb(d),f=Y_({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:X_(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 Z_(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 eD(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 h6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function tD(e){let{t}=ze(),{usage:n,modelDisplayName:o,onCompact:r,compactDisabled:a,compactDisabledReason:i}=e,s=h6(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(oe,{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:eD(t,o,n.autoCompactThreshold)}):null,r?b(xe,{children:[b(oe,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:a,onClick:r,children:[u(Vd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),a&&i?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:i}):null]}):null]})})]})}function hb(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 vb(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 xb(e){return e.submissionTarget==="provider-turn"?vb(e.providerInput??e.prompt,e.maxInputChars):null}function nD(e){let t=e.disabledReason??xb(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 oD({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 rD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function v6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function aD(e){let t=_t(),n=sf(),o=t.pane.useActive(),[r,a]=G(null);return he(()=>{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&&v6(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 x6=['[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(","),yb=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,y6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},C6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function b6(e){return e.closest(x6)!==null}var I6=ce(function(t){let{t:n}=ze(),o=kg(),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(xe,{children:[u(ec,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Xe,{children:[b(Je,{render:u(Ur,{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(gr,{icon:Gd,className:"text-current opacity-100"}):u(gr,{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(xe,{children:[u(ec,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Xe,{children:[b(gf,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[b(Je,{render:u(wg,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(gr,{icon:a}),u(xf,{children:r.label})]}),b(vf,{alignItemWithTrigger:!1,children:[Lg.map(f=>{let p=o(f),m=p.icon;return u(hf,{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(xe,{children:[t.nativeMode?b(xe,{children:[u(ec,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),u(T_,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),S6=ce(function(t){return b(xe,{children:[t.activeContextWindow?u(tD,{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(Pg,{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})]})}),iD=ce(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,pendingApprovals:L,pendingUserInputs:I,activePendingProgress:T,activePendingResolvedAnswers:A,activePendingIsResponding:E,activePendingDraftAnswers:N,activePendingQuestionIndex:R,respondingRequestIds:B,showPlanFollowUpPrompt:z,activeProposedPlan:U,activeTasksProgress:O,activeTaskSteps:ne,runtimeMode:ee,interactionMode:W,lockedProvider:De,providerStatuses:Ce,activeProjectDefaultModelSelection:ue,projectId:Be=null,activeThreadModelSelection:ge,selectedExecutionSelection:le,composerChoices:Se,selectedExecutionReady:ye,selectedModelOptionDescriptors:te,onModelPickerOpenChange:we,onClearExecutionSelection:dt,executionAppliesTo:ct,activeContextWindow:lt,compactDisabled:at,compactDisabledReason:Vt,resolvedTheme:it,settings:Ae,keybindings:Oe,terminalOpen:Ue,gitCwd:et,promptRef:Me,composerRef:Te,composerImagesRef:ht,composerTerminalContextsRef:Wt,composerElementContextsRef:fn,onSend:Ft,onInterrupt:en,onCompactContext:tn,onImplementPlanInNewThread:Rt,onRespondToApproval:Un,onSelectActivePendingUserInputOption:kn,onAdvanceActivePendingUserInput:pn,onPreviousActivePendingUserInputQuestion:Pn,onChangeActivePendingUserInputCustomAnswer:Pt,onProviderModelSelect:ln,onModelSelectionChosen:Dn,onExecutionSelectionChosen:io,onSelectPluginAction:Gt,onManagePlugins:D,getModelDisabledReason:X,getModelContinuationLabel:se,onContinueInModel:re,toggleInteractionMode:de,handleRuntimeModeChange:tt,handleInteractionModeChange:vt,handleNativeModeChange:gn,focusComposer:xt,scheduleComposerFocus:jt,setThreadError:nn,onExpandImage:bt}=t,me=t.api,{limits:ut}=t.attachments,{t:ft}=ze(),Qt=me.draft.useThreadDraft(n),Qe=Qt.prompt,wt=Qt.images,bn=H(()=>wt.filter(P=>nv(P)==="image"),[wt]),Tt=Qt.terminalContexts,nt=Qt.elementContexts,Lt=Qt.previewAnnotations,Jn=Qt.reviewComments,Zn=Qt.nonPersistedImageIds,vo=me.uploads.useStore(P=>P.uploadsByImageId),eo=a?dT({imageIds:wt.map(P=>P.id),uploadsByImageId:vo,environmentId:o}):null,Xt=me.draft.useStore,Z=Xt(P=>P.setPrompt),Ze=Xt(P=>P.setNativeMode),yt=Xt(P=>P.addImage),We=Xt(P=>P.addImages),In=Xt(P=>P.removeImage),hn=Xt(P=>P.insertTerminalContext),vn=Xt(P=>P.removeTerminalContext),Bt=Xt(P=>P.setTerminalContexts),to=Xt(P=>P.removeElementContext),on=Xt(P=>P.removePreviewAnnotation),xo=Xt(P=>P.removeReviewComment),ua=Xt(P=>P.clearComposerPromptAndImages);q(()=>{if(r){if(!a){for(let P of wt)me.uploads.release(P.id);return}me.draft.restoreAttachments();for(let P of wt)me.uploads.start({environmentId:o,image:P})}},[r,wt,o,a]);let On=H(()=>xN(me.model.applyInstanceSettings(me.model.deriveInstanceEntries(Ce),Ae)),[me.model,Ce,Ae]),Js=Qt.activeProvider??null,_e=f?.session?.providerInstanceId??ge?.instanceId??ue?.instanceId??null,Go=yN(On,Js??_e)??On[0]?.driverKind??me.model.makeDriverKind("unconfigured"),hr=De??Go,Kr=H(()=>{if(!De||!f)return null;let P=f.session?.providerInstanceId??ge?.instanceId;return P?On.find(V=>V.instanceId===P)?.continuationGroupKey??null:null},[f,ge?.instanceId,De,On]),dn=H(()=>{let P=[Qt.activeProvider,f?.session?.providerInstanceId,ge?.instanceId,ue?.instanceId];for(let $e of P){if(!$e)continue;let Ge=On.find(rt=>rt.instanceId===$e&&Cg(rt));if(Ge){if(De&&Ge.driverKind!==De||Kr&&Ge.continuationGroupKey!==Kr)continue;return Ge.instanceId}}let V=On.filter($e=>(!De||$e.driverKind===De)&&(!Kr||$e.continuationGroupKey===Kr)),ae=V.filter($e=>$e.driverKind===hr);return bg(ae,void 0)?.instanceId??bg(V,void 0)?.instanceId??me.model.noProviderSelection.instanceId},[ue?.instanceId,f?.session?.providerInstanceId,ge?.instanceId,Qt.activeProvider,Kr,De,On,hr]),Kn=H(()=>On.find(P=>P.instanceId===dn),[On,dn]),zt=Kn===void 0,vr=Vt??(zt?"Compacting is unavailable right now":null),$t=Kn?.driverKind??hr,{modelOptions:xr,selectedModel:Ht,executionSelection:yr}=me.draft.useEffectiveModelState({threadRef:n,providers:Ce,selectedProvider:$t,selectedInstanceId:dn,threadModelSelection:ge,projectModelSelection:ue,settings:Ae}),Sn=le===void 0?yr:le,be=H(()=>Kn?.snapshot??null,[Kn]),Fn=H(()=>{let P=Kn?.models??[];if(!Sn||te===void 0)return P;let V=P.find(ae=>ae.slug===Ht);return[...P.filter(ae=>ae.slug!==Ht),{...V??{slug:Ht,name:Ht},capabilities:{...V?.capabilities,optionDescriptors:te}}]},[Kn,Sn,te,Ht]),Qa=H(()=>R_(Qe),[Qe]),Cr=H(()=>N_({provider:$t,model:Ht,models:Fn,promptInjectionState:Qa,modelOptions:xr?.[dn],planModeEnabled:Ae.planModeEnabled},me.model),[xr,Qa,dn,Ht,$t,Fn,Ae.planModeEnabled]),Xa=Cr.promptEffort,Bo=Sn?xr?.[dn]??Sn.optionOverrides:Cr.modelOptionsForDispatch,jo=Ae.planModeEnabled,Qo=H(()=>({showInteractionModeToggle:jo&&me.model.getInteractionModeToggle(Ce,$t),runtimeModeSwitch:$w($t)}),[jo,Ce,$t]),fa=be?.supportsNativeModeSwitch===!0,no=m&&fa?Qt.nativeModeByProvider?.[dn]??null:null,qr=H(()=>S_(be,m?no:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,be,m,no]),Bi=no&&qr?.current.id===no?no:void 0,Zs=$(P=>{m&&Ze(n,dn,P),gn(P)},[m,Ze,n,dn,gn]),xn=H(()=>me.model.createSelection(dn,Ht,Bo),[me.model,dn,Ht,Bo]),zi=H(()=>!Sn||!Se?.length?null:Se.find(P=>P.runtimeId===Sn.runtimeId&&P.sourceId===Sn.sourceId&&P.profileId===Sn.profileId&&(P.endpointId??void 0)===(Sn.endpointId??void 0))??null,[Se,Sn]),pa=ye??zi?.ready===!0,$i=_(null);q(()=>{let P=f?.id??null,V=$i.current;$i.current={threadId:P,selection:xn},!(V===null||V.threadId!==P||m)&&V.selection!==xn&&Dn?.(xn)},[f?.id,m,Dn,xn]);let so=Ht,Ao=H(()=>{let P=new Map;for(let V of On)P.set(V.instanceId,me.model.getAppModelOptionsForInstance(Ae,V));return P},[On,Ae]),Ya=H(()=>(Ao.get(dn)??[]).some(V=>V.slug===so)?so:me.model.normalizeSlug(so,$t)??so,[me.model,Ao,dn,so,$t]),Mo=m&&De===null,Ja=me.pluginComposer.useOptions(Mo?o:null,Be),zo=Ja.options,He=Mo?Qt.selectedPluginActionKey:null,pt=H(()=>He===null?null:zo.find(P=>P.id===He)??null,[He,zo]),yn=He!==null,rn=yn&&pt===null?ft(Ja.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,Xo=C??rn??(T?null:eo),ma=Xo!==null,Za=H(()=>Z_(ge,Ao),[ge,Ao]),an=`${String(o)}\0${String(n)}`,_g=lr(Qe,Qe.length),ei=$a(an,Qe,{cursor:_g,expandedCursor:Qe.length}),[$u,Dg]=G(()=>({documentKey:an,cursor:ei.cursor})),ga=$u.documentKey===an?$u.cursor:ei.cursor,Ro=$(P=>{Dg(V=>{let ae=V.documentKey===an?V.cursor:$a(an,Me.current).cursor,$e=typeof P=="function"?P(ae):P,Ge=Me.current,rt=wr(Ge,$e);return hM(an,Ge,$e,rt),V.documentKey===an&&V.cursor===$e?V:{documentKey:an,cursor:$e}})},[an,Me]),[lo,K]=G(()=>dr(Qe,Qe.length)),[fe,Re]=G(null),[It,yo]=G(null),[Vr,Co]=G(!1),[el,xd]=G(!1);q(()=>{we?.(el)},[el,we]);let[cD,Hu]=G(!1),[Uu,Og]=G(null),[uD,Fg]=G(null),[Cb,fD]=G(null),[Bg,ha]=G(!1),[yd,tl]=G(!1),[pD,bb]=G(null),[nl,zg]=G({key:0,active:!1}),Ib=_(an);he(()=>{Ib.current!==an&&(Ib.current=an,K(dr(Qe,ei.expandedCursor)),Re(null),yo(null),Co(!1),xd(!1),Og(null),Fg(null),ha(!1),tl(!1),bb(null),zg({key:nl.key,active:!1}))},[an,ei.expandedCursor,Qe,nl.key]);let br=ap("max-sm"),wn=br&&!h&&!cD,va=_(null),Sb=_(null),$g=_(null),wb=_(null),Hg=_(!1),Ug=_(!1),Kg=_(!1),Tb=_([]),Lb=_(null),bo=_(null),ol=_(null),rl=_(null),Ku=_(!1),kb=_(0),al=_(null),qg=_(new Set),Hi=_(new Map),il=H(()=>me.chat.deriveComposerSendState({prompt:Qe,imageCount:wt.length,terminalContexts:Tt,elementContextCount:nt.length+Lt.length+Jn.length}),[nt.length,wt.length,Lt.length,Jn.length,Tt,Qe]),sl=lo?.kind??null,Pb=lo?.kind==="path"?lo.query:"",Eb=sl==="path",Vg=me.pathSearch.useComposerPathSearch({environmentId:o,cwd:Eb?et:null,query:Eb?Pb:null}),$o=H(()=>{if(!lo)return[];if(lo.kind==="path")return Vg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:mu(P.path),description:P.path.slice(0,Math.max(0,P.path.lastIndexOf("/")))}));if(lo.kind==="slash-command"){let P=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:"Switch response model for this thread"},...jo?[{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=uM(be?.skills??[],Ae.showSkillsInSlashMenu),ae=fM(be?.slashCommands??[],V).map(Et=>({id:`provider-slash-command:${$t}:${Et.name}`,type:"provider-slash-command",provider:$t,command:Et,label:`/${Et.name}`,description:Et.description??Et.input?.hint??"Run provider command"})),$e=lo.query.trim().toLowerCase(),Ge=V.map(Et=>({id:`skill:${$t}:${Et.name}`,type:"skill",provider:$t,skill:Et,label:`/skill:${Et.name}`,description:Et.shortDescription??Et.description??(Et.scope?`${Et.scope} skill`:"")})),rt=[...P,...ae,...Ge];return k_(rt,$e)}return lo.kind==="skill"?L_(be?.skills??[],lo.query).map(P=>({id:`skill:${$t}:${P.name}`,type:"skill",provider:$t,skill:P,label:da(P),description:P.shortDescription??P.description??(P.scope?`${P.scope} skill`:"Run provider skill")})):[]},[lo,jo,$t,be,Ae.showSkillsInSlashMenu,Vg.entries]),Ui=!!lo,ti=lo?`${lo.kind}:${lo.query.trim().toLowerCase()}`:null,Ab=H(()=>{let P=ob({items:$o,highlightedItemId:fe,currentSearchKey:ti,highlightedSearchKey:It});return $o.find(V=>V.id===P)??null},[fe,It,$o,ti]);Kg.current=Ui,Tb.current=$o,Lb.current=Ab;let mD=H(()=>new Set(Zn),[Zn]),En=S!==null,qu=I[0]??null,Mb=T?.activeQuestion?.allowFreeform===!1,Vu=En||I.length>0||!wn&&z&&U!==null,gD=wn&&!En&&I.length===0,hD=z||T!==null,{isComposerFooterCompact:Cd,isComposerPrimaryActionsCompact:Rb}=bT($g,hD),vD=sl==="path"&&Pb.length>0&&Vg.isPending,xD=H(()=>sl==="skill"?"No skills found. Try / to browse provider commands.":sl==="path"?"No matching files or folders.":"No matching command.",[sl]),Nb=$(P=>{if(P===Me.current){jt();return}Me.current=P,Z(n,P);let V=lr(P,P.length);Ro(V),K(dr(P,P.length)),jt()},[n,Me,jt,Z]),yD=D_({modelApi:me.model,provider:$t,instanceId:dn,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:Ht,models:Fn,modelOptions:xr?.[dn],prompt:Qe,onPromptChange:Nb,planModeEnabled:Ae.planModeEnabled}),_b=O_({modelApi:me.model,provider:$t,instanceId:dn,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:Ht,models:Fn,modelOptions:xr?.[dn],prompt:Qe,onPromptChange:Nb,planModeEnabled:Ae.planModeEnabled}),Wu=H(()=>T?{questionIndex:T.questionIndex,isLastQuestion:T.isLastQuestion,canAdvance:T.canAdvance,isResponding:E,isComplete:!!A}:null,[E,T,A]),CD=v==="running"||y||ma||x||zt||g||k!==null||!il.hasSendableContent,bD="Send message",bd=br&&!wn&&Wu!==null,ll=$(P=>{Z(n,P)},[n,Z]),ID=$(P=>{yt(n,P)},[n,yt]),SD=$(P=>{We(n,P)},[n,We]),wD=$(P=>{me.uploads.release(P),In(n,P)},[me.uploads,n,In]),TD=$(P=>{let V=Tt.findIndex(Ge=>Ge.id===P);if(V<0)return;let ae=me.terminalContext.removeInlinePlaceholder(Me.current,V);Me.current=ae.prompt,ll(ae.prompt),vn(n,P);let $e=lr(ae.prompt,ae.cursor);Ro($e),K(dr(ae.prompt,ae.cursor))},[n,Tt,Me,vn,ll]);he(()=>{Me.current=Qe,Ro(P=>sr(Qe,P))},[an,Qe,Me,Ro]),q(()=>{if(Uu===null)return;let P=vb(Qe,ut.maxInputChars);P!==Uu&&Og(P)},[Uu,ut.maxInputChars,Qe]),q(()=>{Fg(null)},[nt,Lt,Jn,Tt,Qe,Ht,Xa,$t]),he(()=>{ht.current=wt},[wt,ht]),he(()=>{Wt.current=Tt},[Tt,Wt]),he(()=>{fn.current=nt},[nt,fn]),q(()=>{if(!Ui){Re(null),yo(null);return}let P=ob({items:$o,highlightedItemId:fe,currentSearchKey:ti,highlightedSearchKey:It});Re(V=>V===P?V:P),yo(V=>V===ti?V:ti)},[fe,It,$o,Ui,ti]);let Gu=_(null);q(()=>{let P=T?.customAnswer;if(typeof P!="string"){Gu.current=null;return}let V=qu?.requestId??null,ae=T?.activeQuestion?.id??null,$e=Gu.current?.requestId!==V||Gu.current?.questionId!==ae,Ge=Me.current!==P;if(Gu.current={requestId:V,questionId:ae},!$e&&!Ge)return;Me.current=P;let rt=lr(P,P.length);Ro(rt),K(dr(P,wr(P,rt))),Re(null)},[T?.customAnswer,T?.activeQuestion?.id,qu?.requestId,Me]);let LD=$((P,V,ae,$e,Ge)=>{if(T?.activeQuestion&&I.length>0){if(T.activeQuestion.allowFreeform===!1)return;Ro(V),K($e?null:dr(P,ae)),Pt(T.activeQuestion.id,P,V,ae,$e);return}Me.current=P,ll(P),C6(Tt,Ge)||Bt(n,y6(Tt,Ge)),Ro(V),K($e?null:dr(P,ae))},[T?.activeQuestion,I.length,Pt,Me,ll,n,Tt,Bt]),ni=$((P,V,ae,$e)=>{let Ge=Me.current,rt=Math.max(0,Math.min(Ge.length,P)),Et=Math.max(rt,Math.min(Ge.length,V));if($e?.expectedText!==void 0&&Ge.slice(rt,Et)!==$e.expectedText)return!1;let kt=Xw(Me.current,P,V,ae),No=lr(kt.text,kt.cursor),An=wr(kt.text,No);Me.current=kt.text;let ya=T?.activeQuestion;return ya&&qu?Pt(ya.id,kt.text,No,An,!1):ll(kt.text),Ro(No),K(dr(kt.text,An)),$e?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{va.current?.focusAt(No)}),!0},[T?.activeQuestion,qu,Pt,Me,ll]),ju=$(()=>{let P=va.current?.readSnapshot();return P||{value:Me.current,cursor:ga,expandedCursor:wr(Me.current,ga),terminalContextIds:Tt.map(V=>V.id)}},[ga,Tt,Me]),Wg=$(()=>{let P=ju();return{snapshot:P,trigger:dr(P.value,P.expandedCursor)}},[ju]),Db=$(P=>{if(Ug.current)return;Ug.current=!0,window.requestAnimationFrame(()=>{Ug.current=!1});let{snapshot:V,trigger:ae}=Wg();if(ae){if(P.type==="path"){let $e=`${wc(P.path)} `,Ge=yb(V.value,ae.rangeEnd,$e);ni(ae.rangeStart,Ge,$e,{expectedText:V.value.slice(ae.rangeStart,Ge)})&&Re(null);return}if(P.type==="slash-command"){if(P.command==="model"){ni(ae.rangeStart,ae.rangeEnd,"",{expectedText:V.value.slice(ae.rangeStart,ae.rangeEnd),focusEditorAfterReplace:!1})&&(Re(null),xd(!0));return}vt(P.command==="plan"?"plan":"default"),ni(ae.rangeStart,ae.rangeEnd,"",{expectedText:V.value.slice(ae.rangeStart,ae.rangeEnd)})&&Re(null);return}if(P.type==="provider-slash-command"){let $e=`/${P.command.name} `,Ge=yb(V.value,ae.rangeEnd,$e);ni(ae.rangeStart,Ge,$e,{expectedText:V.value.slice(ae.rangeStart,Ge)})&&Re(null);return}if(P.type==="skill"){let $e=`$${P.skill.name} `,Ge=yb(V.value,ae.rangeEnd,$e);ni(ae.rangeStart,Ge,$e,{expectedText:V.value.slice(ae.rangeStart,Ge)})&&Re(null);return}}},[ni,vt,Wg]),kD=$(P=>{Re(P),yo(ti)},[ti]),Ob=$(P=>{if($o.length===0)return;let V=$o.findIndex(Et=>Et.id===fe),Ge=((V>=0?V:P==="ArrowDown"?-1:0)+(P==="ArrowDown"?1:-1)+$o.length)%$o.length,rt=$o[Ge];Re(rt?.id??null)},[fe,$o]),Fb=$(()=>{if(!br)return;bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),Hu(!1)},[br]),Bb=$(()=>!br||y||ma||x||zt||k!==null||v==="running"?!1:T?T.isLastQuestion&&!!A:z||il.hasSendableContent,[T,A,il.hasSendableContent,k,x,br,y,ma,zt,v,z]),Gg=$((P,V="foreground")=>{if(zt||ma){P?.preventDefault();return}if(d&&(Hi.current.get(an)??0)>0){P?.preventDefault(),me.notify.info("Still compressing a pasted image.","Send again once its thumbnail appears.");return}let ae=nD({prompt:Me.current,submissionTarget:T?"pending-user-input":"provider-turn",maxInputChars:ut.maxInputChars,disabledReason:Xo,event:P,onSend:$e=>(Hg.current=!1,Ft($e,V),!Hg.current)});Og(ae.validationMessage),ae.didDispatch&&Bb()&&Fb()},[d,T,Fb,an,ma,ut.maxInputChars,zt,Ft,Me,Xo,Bb]),jg=$(()=>{if(!(at||zt||il.hasSendableContent||S!==null||I.length>0||v==="running"||y||x||!d)){if((Hi.current.get(an)??0)>0){me.notify.info("Still compressing a pasted image.","Compact again once its thumbnail appears.");return}tn()}},[S,d,at,an,il.hasSendableContent,x,y,zt,tn,I.length,v]),Qu=$(()=>{bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),ol.current!==null&&window.cancelAnimationFrame(ol.current),rl.current!==null&&window.cancelAnimationFrame(rl.current),Ku.current=!0,Hu(!0),ol.current=window.requestAnimationFrame(()=>{ol.current=null,va.current?.focusAtEnd(),rl.current=window.requestAnimationFrame(()=>{rl.current=null,Ku.current=!1})})},[]),PD=(P,V)=>{if(P==="Tab"&&V.shiftKey)return jo?(de(),!0):!1;let{trigger:ae}=Wg();if(Kg.current||ae!==null){let rt=Tb.current,Et=Lb.current??rt[0];if(P==="ArrowDown"&&rt.length>0)return Ob("ArrowDown"),!0;if(P==="ArrowUp"&&rt.length>0)return Ob("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&Et)return Db(Et),!0}let Ge=P==="Enter"?Gw({isMobileViewport:br,shiftKey:V.shiftKey,modifierKey:V.metaKey||V.ctrlKey,isDraftThread:i==="draft"}):null;return Ge?(Gg(void 0,Ge),!0):!1},Xu=me.stash.useStore,dl=Xu(P=>P.entries),zb=Xu(P=>P.stashEntry),Yu=Xu(P=>P.takeEntry),$b=Xu(P=>P.finalizeEntryImages);q(()=>()=>{al.current!==null&&window.clearTimeout(al.current)},[]);let Hb=$(()=>{kb.current+=1,zg({key:kb.current,active:!0}),al.current!==null&&window.clearTimeout(al.current),al.current=window.setTimeout(()=>{al.current=null,zg(P=>({...P,active:!1}))},1200)},[]),ED=$(P=>{let{entry:V,durable:ae}=Yu(P.id);if(!V)return;ae||me.notify.warning("Restored prompt may reappear in the stash","Browser storage rejected the update, so this entry could still be there after a reload."),ha(!1);let $e=Me.current,Ge=P.prompt.length===0?$e:$e.trim().length?`${$e.replace(/\s+$/,"")}
3733
3733
 
3734
- ${P.prompt}`:P.prompt,pt=qe!==Ue;pt&&(we.current=qe,te(n,qe),Bo(Mo(qe,qe.length)),sr(null));let ot=[];if(P.attachments.length>0){let pn=new Set(ht.current.map(Gn=>Gn.id)),$a=new Set(ht.current.map(Gn=>`${Gn.mimeType}\0${Gn.sizeBytes}\0${Gn.name}`)),$o=Math.max(0,dt.maxAttachments-ht.current.length),uo=P.attachments.filter(Gn=>!pn.has(Gn.id)&&!$a.has(`${Gn.mimeType}\0${Gn.sizeBytes}\0${Gn.name}`));ot=uo.slice($o).map(Gn=>Gn.name);let qs=fe.draft.hydrateImagesFromPersisted(uo.slice(0,$o));qs.length>0&&tt(n,qs)}let hn=[];P.droppedImageNames.length>0&&hn.push(`${P.droppedImageNames.join(", ")} exceeded the stash size limit when this prompt was saved.`),P.unreadableImageNames&&P.unreadableImageNames.length>0&&hn.push(`${P.unreadableImageNames.join(", ")} could not be read when this prompt was saved.`),ot.length>0&&hn.push(`${ot.join(", ")} could not be restored: the composer is at its ${dt.maxAttachments}-image limit.`),hn.length>0&&fe.notify.warning("Some images were not restored",hn.join(" ")),pt&&window.requestAnimationFrame(()=>{sa.current?.focusAtEnd()})},[tt,n,ht,dt.maxAttachments,we,te,Ru]),q_=U(P=>{let{durable:q}=Ru(P.id);q||fe.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[Ru]),W_=U(async()=>{let P=we.current.split("\uFFFC").join("").trim(),q=[...ht.current];if(P.length===0&&q.length===0){Fa(pt=>!pt);return}let se=`${String(n)}\0${P}\0${q.map(pt=>pt.id).join(",")}`;if(Ig.current.has(se))return;Ig.current.add(se);let Ue=n,qe=Wc();try{let{evicted:pt,written:ot,durable:hn}=cb({id:qe,createdAt:new Date().toISOString(),prompt:P,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:q.length});if(!ot){fe.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}hn||fe.notify.warning("Stashed prompt will not survive a reload","Browser storage is unavailable, so this stash is kept in memory only for this session."),we.current="",na(Ue);for(let Ws of q)fe.uploads.release(Ws.id);Bo(0),sr(null),fb(),pt&&fe.notify.warning("Oldest stashed prompt discarded",`The stash holds ${fe.stash.maxEntries} prompts; the oldest was removed to make room.`);let pn=[],$a=[],$o=[];for(let Ws of q){let rd=await fe.imageCompression.compressForStash(Ws.file);if(!rd.ok){(rd.reason==="too-large"?$a:$o).push(Ws.name);continue}pn.push({id:Ws.id,name:Ws.name,mimeType:rd.image.mimeType,sizeBytes:rd.image.sizeBytes,dataUrl:rd.image.dataUrl})}let{kept:uo,droppedNames:qs}=fe.stash.partitionAttachments(pn),{attached:Gn,durable:eD}=ub(qe,{attachments:uo,droppedImageNames:[...$a,...qs],unreadableImageNames:$o});Gn?!eD&&hn&&q.length>0&&fe.notify.warning("Stashed images were not saved","The prompt was stashed, but browser storage rejected its images. They will be missing if you reload."):uo.length>0&&fe.notify.warning("Stashed images did not attach",`That prompt was restored or deleted before ${uo.length} image${uo.length===1?"":"s"} finished saving. Re-attach ${uo.length===1?"it":"them"} if you still need ${uo.length===1?"it":"them"}.`)}finally{Ig.current.delete(se)}},[na,n,ht,ub,we,fb,cb]),kg=U(()=>{Fa(P=>!P)},[]),G_=U(()=>{if(gn){Eu(),Fa(!0);return}kg()},[Eu,gn,kg]),Pg=U(()=>{Zl(P=>!P)},[]),nd=f?.latestTurn?.turnId??null,pb=nd!==null&&k_===nd,Or=pb?null:W,la=pb?null:xe,od=T!==null||b.length>0,Ag=U(()=>{nd!==null&&P_(nd),Zl(!1)},[nd]),Nu=Vs.length>0&&!Sn&&(t.externalDrawerAttached||Lu||Jl||gn)?u(Nh,{count:Vs.length,menuOpen:vg,placement:"inline",pulseKey:Su.key,pulsing:Su.active,onToggleMenu:G_}):null,_u=Or!==null&&la!==null&&!Jl&&!od&&(t.externalDrawerAttached||Lu||gn)?u(_h,{expanded:!1,onDismiss:Ag,onToggle:Pg,placement:"inline",progress:Or,steps:la}):null,Eg=!t.externalDrawerAttached&&!Lu&&!Jl&&!gn,j_=Eg&&(Vs.length>0||Or!==null&&la!==null&&Or.totalSteps>0);V(()=>{(Or===null||la===null)&&Zl(!1)},[la,Or]),V(()=>{od&&Zl(!1)},[od]),V(()=>{Zl(!1)},[d]),V(()=>{ki&&Fa(!1)},[ki]),V(()=>{Fa(!1)},[ze]),fe.pane.useKeydown(P=>{if(fe.keybindings.resolveShortcutCommand(P,Re,{context:{terminalFocus:fe.terminalFocus.getOwner()!==null,terminalOpen:Fe,modelPickerOpen:Fs}})==="composer.stash"&&(P.preventDefault(),P.stopPropagation(),!fe.commandPalette.isOpen())){if(b.length>0&&!Sn){Fa(se=>!se);return}Sn||g||S!==null||W_()}},{capture:!0});let Du=async P=>{if(!d||P.length===0)return;if(b.length>0){fe.notify.error(rt("attachments.answerQuestionsFirst"));return}let q=d,se=Li.current.get(q)??0,Ue=ht.current.length+se,qe=[],pt=null;for(let ot of P){if(Ue>=dt.maxAttachments){pt=rt("attachments.limitReached",{count:dt.maxAttachments});break}if(ot.size<=0){pt=rt("attachments.empty",{name:ot.name});continue}qe.push(ot),Ue+=1}if(jt(q,pt),qe.length!==0){Li.current.set(q,se+qe.length);try{let ot=[],hn=null;for(let pn of qe){if(!(fe.imageCompression.isHeicFile(pn)||Lh(pn.type))){let Gn=a?dt.maxFileBytes:dt.maxImageBytes;if(pn.size>Gn){hn=rt("attachments.tooLarge",{name:pn.name,limit:Ph(Gn)});continue}ot.push({...Ah({id:Wc(),name:pn.name||"file",mimeType:pn.type||"application/octet-stream",sizeBytes:pn.size}),previewUrl:URL.createObjectURL(pn),file:pn});continue}let $o=await fe.imageCompression.prepareForAttachment(pn,dt.maxImageBytes);if(!$o.ok){hn=$o.reason==="unreadable"?rt("attachments.unreadableImage",{name:pn.name}):rt("attachments.imageTooLarge",{name:pn.name});continue}let uo=$o.file,qs=URL.createObjectURL(uo);ot.push({...Ah({id:Wc(),name:uo.name||"image",mimeType:uo.type,sizeBytes:uo.size}),previewUrl:qs,file:uo})}ot.length===1&&ot[0]?F_(ot[0]):ot.length>1&&B_(ot),hn!==null&&jt(q,hn)}finally{let ot=(Li.current.get(q)??0)-qe.length;ot>0?Li.current.set(q,ot):Li.current.delete(q)}}},Q_=P=>{z_(P)},X_=P=>{let q=Array.from(P.target.files??[]);P.target.value="",q.length!==0&&Du(q)},Y_=P=>{let q=Array.from(P.clipboardData.files);q.length!==0&&(P.preventDefault(),Du(q))},mb=(P,q)=>{if(P.length===0||x||Sn||b.length>0||g)return!1;let se=we.current,Ue=(q?.ensureLeadingBoundary??!1)&&se.length>0&&!/\s$/.test(se);return za(se.length,se.length,Ue?` ${P}`:P)},Mg=vw({insertMentionAtEnd:P=>mb(P,{ensureLeadingBoundary:!0}),setDragActive:yu,onInsertRejected:()=>{fe.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),J_=P=>{if(!Rh(P.dataTransfer.types))return;P.stopPropagation();let q=P.relatedTarget;q instanceof Node&&P.currentTarget.contains(q)||yu(!1)};V(()=>{if(!mg)return;let P=()=>{yu(!1)};return window.addEventListener("dragend",P),()=>window.removeEventListener("dragend",P)},[mg]);let Rg=U(()=>{Ht()},[Ht]),Ng=U(()=>{Dt()},[Dt]),Z_=U(()=>{lr&&(wu.current||(co.current!==null&&window.cancelAnimationFrame(co.current),co.current=window.requestAnimationFrame(()=>{if(co.current=null,wu.current)return;let P=QC.current,q=xg.current,se=document.activeElement;se instanceof Element&&TG(se)||se instanceof Node&&(P&&P.contains(se)||q&&q.contains(se))||bu(!1)})))},[lr]);return V(()=>()=>{co.current!==null&&window.cancelAnimationFrame(co.current),Bs.current!==null&&window.cancelAnimationFrame(Bs.current),zs.current!==null&&window.cancelAnimationFrame(zs.current)},[]),Br(et,()=>({focusAtEnd:()=>{sa.current?.focusAtEnd()},focusAt:P=>{sa.current?.focusAt(P)},addDroppedFiles:P=>{Du(P),vt()},insertTextAtEnd:mb,openModelPicker:()=>{Cu(!0)},toggleModelPicker:()=>{Cu(P=>!P)},compactContext:Lg,isModelPickerOpen:()=>Fs,isMentionMenuOpen:()=>bg.current,readSnapshot:()=>Au(),resetCursorState:P=>{let q=P?.prompt??we.current,se=ur(q,P?.cursor??0);zo(null),Bo(se),sr(P?.detectTrigger?Xo(q,Vr(q,se)):null)},addTerminalContext:P=>{if(!f)return;let q=sa.current?.readSnapshot()??{value:we.current,cursor:Ti,expandedCursor:Vr(we.current,Ti),terminalContextIds:At.map(pt=>pt.id)},se=fe.terminalContext.insertInlinePlaceholder(q.value,q.expandedCursor),Ue=Mo(se.prompt,se.cursor);Zt(n,se.prompt,{id:Wc(),threadId:f.id,createdAt:new Date().toISOString(),...P},se.contextIndex)&&(we.current=se.prompt,Bo(Ue),sr(Xo(se.prompt,se.cursor)),window.requestAnimationFrame(()=>{sa.current?.focusAt(Ue)}))},getSendContext:()=>({prompt:we.current,images:ht.current,terminalContexts:$t.current,elementContexts:dn.current,previewAnnotations:nn,reviewComments:mn,selectedPromptEffort:ra,selectedModelOptionsForDispatch:aa,selectedModelSelection:Po,...En?{executionSelection:En}:{},executionReady:Rr,...Mr?{selectedNativeModeId:Mr}:{},providerAvailable:!Xt,selectedProvider:en,selectedModel:Kt,selectedProviderModels:Yn,selectedPluginAction:Z}),validateProviderInput:P=>{let q=at??VC({prompt:we.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:dt.maxInputChars});return yg.current=q!==null,hg(q),q===null}}),[f,Du,n,Ti,At,Zt,we,ht,$t,dn,nn,mn,vt,x,Sn,b.length,g,za,Fs,Au,Kt,aa,Po,En,Rr,Mr,Xt,ra,en,Yn,Z,at,Lg,dt.maxInputChars]),I("form",{ref:xg,onSubmit:Tg,onFocusCapture:P=>{let q=P.target;gn&&q instanceof HTMLElement&&q.closest('[data-chat-composer-collapsed-controls="true"]')||(co.current!==null&&(window.cancelAnimationFrame(co.current),co.current=null),bu(!0))},onBlurCapture:()=>{Z_()},onDragEnterCapture:Mg.onDragEnter,onDragOverCapture:Mg.onDragOver,onDragLeaveCapture:J_,onDropCapture:Mg.onDrop,className:z("mx-auto w-full min-w-0 max-w-3xl",j_&&"pt-7"),"data-chat-composer-form":"true",children:[Lu&&(!Jl||od)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":T?"warning":"info",children:!gn&&T?I("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(TC,{approval:T,pendingCount:L.length}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:u(vC,{requestId:T.requestId,isResponding:N.includes(T.requestId),options:T.options,keybindings:Re,declineReasonRelay:T.declineReasonRelay,onRespondToApproval:oo})})]}):!gn&&b.length>0?u(PC,{pendingUserInputs:b,respondingRequestIds:N,answers:B,questionIndex:R,onToggleOption:yn,onAdvance:kn}):!gn&&H&&D?u(ON,{planTitle:x_(D.planMarkdown)??null},D.id):gn&&T?I("div",{"data-chat-composer-collapsed-controls":"true",children:[u(TC,{approval:T,pendingCount:L.length,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:u(vC,{requestId:T.requestId,isResponding:N.includes(T.requestId),options:T.options,keybindings:Re,declineReasonRelay:T.declineReasonRelay,onRespondToApproval:oo})})]}):gn&&b.length>0?I("div",{"data-chat-composer-collapsed-controls":"true",children:[u(PC,{pendingUserInputs:b,respondingRequestIds:N,answers:B,questionIndex:R,onToggleOption:yn,onAdvance:kn}),u("div",{className:"px-3 pb-3 sm:px-4",children:I("div",{"data-chat-composer-mobile-pending-compact":"true",className:z("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",!S?.activeQuestion?.multiSelect&&"p-0"),children:[nb?null:u("button",{type:"button",className:z("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",S?.customAnswer?"text-foreground":"text-placeholder",!S?.activeQuestion?.multiSelect&&"px-3 py-2"),onPointerDown:P=>P.preventDefault(),onClick:Eu,"aria-label":"Write custom answer",children:S?.customAnswer||"Write custom answer"}),_u,Nu,S?.activeQuestion?.multiSelect?u(sg,{compact:!0,pendingAction:ku,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:Bn,isConnecting:x,isEnvironmentUnavailable:k!==null||Xt||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Dn,onInterrupt:Rg,onImplementPlanInNewThread:Ng}):null]})})]}):null}):null,Jl&&!od&&Or&&la?u(Lw,{onDismiss:Ag,onCollapse:Pg,progress:Or,steps:la}):null,I("div",{className:"relative",children:[Eg&&Or&&la?u(_h,{expanded:!1,hasTrailingShoulder:Vs.length>0,onDismiss:Ag,onToggle:Pg,progress:Or,steps:la}):null,Eg?u(Nh,{count:Vs.length,menuOpen:vg,pulseKey:Su.key,pulsing:Su.active,onToggleMenu:kg}):null,u("div",{"data-chat-composer-main-surface":"true",className:z("group relative z-10 rounded-[22px] p-px transition-colors duration-200",lo.composerFrameClassName),children:I("div",{ref:QC,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":gn?"true":"false",className:z("rounded-[20px] transition-[background-color] duration-200",mg?"bg-accent/45 ring-1 ring-primary/70":null,g?"opacity-75":null,lo.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&&!Sn?u(f_,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,E_?I("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u("button",{type:"button",className:z("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(S?S.customAnswer:ze.trim())?"text-foreground":"text-placeholder"),onPointerDown:P=>P.preventDefault(),onClick:Eu,"aria-label":"Expand composer",children:S?S.customAnswer||"Type your own answer, or leave this blank to use the selected option":ze.trim()||(Xt?"Enable a provider in Settings":"Ask anything...")}),_u,Nu,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:D_,"aria-label":O_,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),Tg()},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,I("div",{ref:L_,className:z("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Sn&&"pb-3 sm:pb-4",gn&&"hidden"),children:[vg&&!ki&&!Sn&&u(y_,{anchor:WC,children:u(Sw,{entries:Vs,onRestore:V_,onDelete:q_,onClose:()=>Fa(!1)})}),ki&&!Sn&&u(y_,{anchor:WC,children:u(QR,{items:Ao,resolvedTheme:it,isLoading:R_,triggerKind:Us,emptyStateText:N_,activeItemId:tb?.id??null,onHighlightedItemChange:U_,onSelect:ib})}),!gn&&!Sn&&b.length===0&&nn.length>0&&u(Ow,{annotations:nn,images:bt,...a?{uploadsByImageId:ao,onRetryUpload:P=>fe.uploads.retry({environmentId:o,image:P})}:{},onRemove:P=>{fe.uploads.release(P),an(n,P)},onExpandImage:P=>{let q=UC(un,P);q&&Ct(q)},className:"mb-3"}),!gn&&!Sn&&b.length===0&&mn.length>0&&u(Dw,{comments:mn,onRemove:P=>Lo(n,P),className:"mb-3"}),!gn&&!Sn&&b.length===0&&Qt.length>0&&u(_w,{contexts:Qt,onRemove:P=>Co(n,P),className:"mb-3"}),!gn&&!Sn&&b.length===0&&bt.some(P=>!nn.some(q=>q.id===P.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:bt.filter(P=>!nn.some(q=>q.id===P.id)).map(P=>{let q=a?ao[P.id]:void 0,se=kh(P),Ue=Pw(se),qe=se==="image"&&!!P.previewUrl;return I("div",{className:z("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",qe?"w-16":"w-44 max-w-full"),children:[qe?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":rt("attachments.preview",{name:P.name}),onClick:()=>{let pt=UC(un,P.id);pt&&Ct(pt)},children:u("img",{src:P.previewUrl,alt:P.name,className:"h-full w-full object-cover"})}):I("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(Ue,{className:"size-4 shrink-0 text-secondary-label"}),I("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:Ph(P.sizeBytes)})]})]}),A_.has(P.id)&&I(je,{children:[u(Xe,{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(po,{className:"size-3"})})}),u(Qe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:rt("attachments.draftMayNotPersistDetail")})]}),q?.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:Kf(q.progress)}),q?.status==="failed"&&I(je,{children:[u(Xe,{render:u(ne,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>fe.uploads.retry({environmentId:o,image:P}),"aria-label":rt("attachments.retryUpload",{name:P.name})}),children:u(Ui,{})}),u(Qe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:q.reason})]}),u(ne,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>Q_(P.id),"aria-label":rt("attachments.remove",{name:P.name}),children:u(Vt,{})})]},P.id)})}),I("div",{className:"relative",children:[nb?null:u(HE,{editorRef:sa,value:Sn?"":S?S.customAnswer:ze,cursor:Ti,terminalContexts:!Sn&&b.length===0?At:[],skills:he?.skills??[],...td?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:$_,onChange:H_,onCommandKeyDown:K_,onPaste:Y_,placeholder:Sn?T?.detail??"Resolve this approval request to continue":S?"Type your own answer, or leave this blank to use the selected option":H&&D?"Add feedback to refine the plan, or leave this blank to implement it":g?"Choose a project above to start a thread":Xt?"Enable a provider in Settings to send a message":v==="disconnected"?gw:"Ask anything, @tag files/folders, $use skills, or / for commands",disabled:x||Sn||g}),td?I("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[_u,Nu,u(sg,{compact:!0,pendingAction:ku,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:Bn,isConnecting:x,isEnvironmentUnavailable:k!==null||Xt||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Dn,onInterrupt:Rg,onImplementPlanInNewThread:Ng})]}):null]})]}),u(v_,{message:T_??Iu}),at===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:at}),gn||Sn?null:I("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":ed?"true":"false",className:z("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",b.length>0&&"pt-2",ed?"gap-1.5":"gap-2 sm:gap-0",td&&"hidden sm:flex"),children:[I("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:jC,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:X_}),I(je,{children:[u(Xe,{render:u(ne,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:x||g||b.length>0,"aria-label":rt("attachments.add"),onClick:()=>jC.current?.click()}),children:u(Io,{})}),u(Qe,{side:"top",children:rt("attachments.add")})]}),Xt?I(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(po,{className:"size-4"}),"No provider available"]}):u(jR,{compact:ed,activeInstanceId:Ut,model:Yl,lockedProvider:Ye,lockedContinuationGroupKey:so,instanceEntries:bn,keybindings:Re,modelOptionsByInstance:ia,triggerClassName:"-ms-2.5",terminalOpen:Fe,open:Fs,...lo.modelPickerIconClassName?{activeProviderIconClassName:lo.modelPickerIconClassName}:{},onOpenChange:P=>{Cu(P)},getModelDisabledReason:J,getModelContinuationLabel:ae,onContinueInModel:oe,onInstanceModelChange:Cn,...Ne?{composerChoices:Ne}:{},selectedExecutionSelection:En??null,onClearExecutionSelection:ct,executionAppliesTo:ut,sourceLabel:Fo?.sourceLabel,...ro?{onChooseExecution:P=>{ro(P.selection,P)}}:{},...ir?{pluginActions:Nr,selectedPluginActionKey:Z?.id??null,onSelectPluginAction:cn,onManagePlugins:F}:{}}),ve?null:I(pe,{children:[u(n_,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:ed}),ed?u(JR,{interactionMode:Q,runtimeMode:ie,runtimeModeSwitch:Oo.runtimeModeSwitch,nativeMode:rr,canSwitchNativeMode:Oa,showInteractionModeToggle:Oo.showInteractionModeToggle,traitsMenuContent:__,onToggleInteractionMode:le,onRuntimeModeChange:Je,onNativeModeChange:Si}):I(pe,{children:[ab?I(pe,{children:[u(Od,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),ab]}):null,u(LG,{showInteractionModeToggle:Oo.showInteractionModeToggle,interactionMode:Q,runtimeMode:ie,runtimeModeSwitch:Oo.runtimeModeSwitch,nativeMode:rr,canSwitchNativeMode:Oa,onToggleInteractionMode:le,onRuntimeModeChange:Je,onNativeModeChange:Si})]})]})]}),I("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":ob?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[td?null:_u,td?null:Nu,u(kG,{compact:ob,activeContextWindow:lt,activeThreadModelDisplayName:Dr,pendingAction:ku,isRunning:v==="running",showPlanFollowUpPrompt:b.length===0&&H,promptHasText:ze.trim().length>0,isSendBusy:y,sendDisabledReason:Bn,isConnecting:x,isEnvironmentUnavailable:k!==null||Xt||g,isPreparingWorktree:w,hasSendableContent:Hs.hasSendableContent,preserveComposerFocusOnPointerDown:lr,showSendWhileRunning:lr,onPreviousPendingQuestion:Dn,onInterrupt:Rg,onImplementPlanInNewThread:Ng,compactDisabled:ft||Xt||y||x,compactDisabledReason:Ii,onCompactContext:Lg})]})]})]})})]})]})});function b_(e){let{composerRef:t,...n}=e,o=n;return u(Cw,{value:o.api,children:u(C_,{...o,composerRef:t})})}function I_(e){return u(Ug.Provider,{value:e.scope.active,children:u(PG,{...e})})}function PG(e){let{scope:t,mode:n,timeline:o,trajectory:r,queue:a,composer:i}=e,[s,l]=K(null),d=u(b_,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:I(pe,{children:[u(kI,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(EI,{...s,placement:"inline",onSelect:c=>{n.onModeChange("chat"),s.onSelect(c)}}):null]})});return I("div",{className:z("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(PI,{chat:u(OS,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u($S,{...r,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(ow,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:d,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:I(pe,{children:[u(J0,{actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(wh,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var AG=".ycodium-conversation-ui";function EG(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function S_(e,t="conversation"){let n=EG(),o=e.replaceAll(AG,`.${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 MG(e){let t=S_(vb);return{views:{[Sb]:function(o){return I(Cb,{value:e,children:[u(RG,{retain:t.retain}),u(Ib,{value:t.scopeClass,children:u(I_,{...o,scopeClass:t.scopeClass})})]})}}}}function RG({retain:e}){return sd(()=>e(),[e]),null}export{MG as default};
3734
+ ${P.prompt}`:P.prompt,rt=Ge!==$e;rt&&(Me.current=Ge,Z(n,Ge),Ro(lr(Ge,Ge.length)),K(null));let Et=[];if(P.attachments.length>0){let No=new Set(ht.current.map(co=>co.id)),An=new Set(ht.current.map(co=>`${co.mimeType}\0${co.sizeBytes}\0${co.name}`)),ya=Math.max(0,ut.maxAttachments-ht.current.length),Ho=P.attachments.filter(co=>!No.has(co.id)&&!An.has(`${co.mimeType}\0${co.sizeBytes}\0${co.name}`));Et=Ho.slice(ya).map(co=>co.name);let Gr=me.draft.hydrateImagesFromPersisted(Ho.slice(0,ya));Gr.length>0&&We(n,Gr)}let kt=[];P.droppedImageNames.length>0&&kt.push(`${P.droppedImageNames.join(", ")} exceeded the stash size limit when this prompt was saved.`),P.unreadableImageNames&&P.unreadableImageNames.length>0&&kt.push(`${P.unreadableImageNames.join(", ")} could not be read when this prompt was saved.`),Et.length>0&&kt.push(`${Et.join(", ")} could not be restored: the composer is at its ${ut.maxAttachments}-image limit.`),kt.length>0&&me.notify.warning("Some images were not restored",kt.join(" ")),rt&&window.requestAnimationFrame(()=>{va.current?.focusAtEnd()})},[We,n,ht,ut.maxAttachments,Me,Z,Yu]),AD=$(P=>{let{durable:V}=Yu(P.id);V||me.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[Yu]),MD=$(async()=>{let P=Me.current.split("\uFFFC").join("").trim(),V=[...ht.current];if(P.length===0&&V.length===0){ha(rt=>!rt);return}let ae=`${String(n)}\0${P}\0${V.map(rt=>rt.id).join(",")}`;if(qg.current.has(ae))return;qg.current.add(ae);let $e=n,Ge=pu();try{let{evicted:rt,written:Et,durable:kt}=zb({id:Ge,createdAt:new Date().toISOString(),prompt:P,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:V.length});if(!Et){me.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}kt||me.notify.warning("Stashed prompt will not survive a reload","Browser storage is unavailable, so this stash is kept in memory only for this session."),Me.current="",ua($e);for(let cl of V)me.uploads.release(cl.id);Ro(0),K(null),Hb(),rt&&me.notify.warning("Oldest stashed prompt discarded",`The stash holds ${me.stash.maxEntries} prompts; the oldest was removed to make room.`);let No=[],An=[],ya=[];for(let cl of V){let wd=await me.imageCompression.compressForStash(cl.file);if(!wd.ok){(wd.reason==="too-large"?An:ya).push(cl.name);continue}No.push({id:cl.id,name:cl.name,mimeType:wd.image.mimeType,sizeBytes:wd.image.sizeBytes,dataUrl:wd.image.dataUrl})}let{kept:Ho,droppedNames:Gr}=me.stash.partitionAttachments(No),{attached:co,durable:tf}=$b(Ge,{attachments:Ho,droppedImageNames:[...An,...Gr],unreadableImageNames:ya});co?!tf&&kt&&V.length>0&&me.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&&me.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{qg.current.delete(ae)}},[ua,n,ht,$b,Me,Hb,zb]),Qg=$(()=>{ha(P=>!P)},[]),RD=$(()=>{if(wn){Qu(),ha(!0);return}Qg()},[Qu,wn,Qg]),Xg=$(()=>{tl(P=>!P)},[]),Id=f?.latestTurn?.turnId??null,Ub=Id!==null&&pD===Id,Wr=Ub?null:O,xa=Ub?null:ne,Sd=S!==null||I.length>0,Yg=$(()=>{Id!==null&&bb(Id),tl(!1)},[Id]),Ju=dl.length>0&&!En&&(t.externalDrawerAttached||Vu||yd||wn)?u(lv,{count:dl.length,menuOpen:Bg,placement:"inline",pulseKey:nl.key,pulsing:nl.active,onToggleMenu:RD}):null,Zu=Wr!==null&&xa!==null&&!yd&&!Sd&&(t.externalDrawerAttached||Vu||wn)?u(dv,{expanded:!1,onDismiss:Yg,onToggle:Xg,placement:"inline",progress:Wr,steps:xa}):null,Jg=!t.externalDrawerAttached&&!Vu&&!yd&&!wn,ND=Jg&&(dl.length>0||Wr!==null&&xa!==null&&Wr.totalSteps>0);q(()=>{(Wr===null||xa===null)&&tl(!1)},[xa,Wr]),q(()=>{Sd&&tl(!1)},[Sd]),q(()=>{tl(!1)},[d]),q(()=>{Ui&&ha(!1)},[Ui]),q(()=>{ha(!1)},[Qe]),me.pane.useKeydown(P=>{if(me.keybindings.resolveShortcutCommand(P,Oe,{context:{terminalFocus:me.terminalFocus.getOwner()!==null,terminalOpen:Ue,modelPickerOpen:el}})==="composer.stash"&&(P.preventDefault(),P.stopPropagation(),!me.commandPalette.isOpen())){if(I.length>0&&!En){ha(ae=>!ae);return}En||g||T!==null||MD()}},{capture:!0});let ef=async P=>{if(!d||P.length===0)return;if(I.length>0){me.notify.error(ft("attachments.answerQuestionsFirst"));return}let V=d,ae=an,$e=Hi.current.get(ae)??0,Ge=ht.current.length+$e,rt=[],Et=null;for(let kt of P){if(Ge>=ut.maxAttachments){Et=ft("attachments.limitReached",{count:ut.maxAttachments});break}if(kt.size<=0){Et=ft("attachments.empty",{name:kt.name});continue}rt.push(kt),Ge+=1}if(nn(V,Et),rt.length!==0){Hi.current.set(ae,$e+rt.length);try{let kt=[],No=null;for(let An of rt){if(!(me.imageCompression.isHeicFile(An)||tv(An.type))){let tf=a?ut.maxFileBytes:ut.maxImageBytes;if(An.size>tf){No=ft("attachments.tooLarge",{name:An.name,limit:ov(tf)});continue}kt.push({...rv({id:pu(),name:An.name||"file",mimeType:An.type||"application/octet-stream",sizeBytes:An.size}),previewUrl:URL.createObjectURL(An),file:An});continue}let Ho=await me.imageCompression.prepareForAttachment(An,ut.maxImageBytes);if(!Ho.ok){No=Ho.reason==="unreadable"?ft("attachments.unreadableImage",{name:An.name}):ft("attachments.imageTooLarge",{name:An.name});continue}let Gr=Ho.file,co=URL.createObjectURL(Gr);kt.push({...rv({id:pu(),name:Gr.name||"image",mimeType:Gr.type,sizeBytes:Gr.size}),previewUrl:co,file:Gr})}kt.length===1&&kt[0]?ID(kt[0]):kt.length>1&&SD(kt),No!==null&&nn(V,No)}finally{let kt=(Hi.current.get(ae)??0)-rt.length;kt>0?Hi.current.set(ae,kt):Hi.current.delete(ae)}}},_D=P=>{wD(P)},DD=P=>{let V=Array.from(P.target.files??[]);P.target.value="",V.length!==0&&ef(V)},OD=P=>{let V=Array.from(P.clipboardData.files);V.length!==0&&(P.preventDefault(),ef(V))},Kb=(P,V)=>{if(P.length===0||x||En||I.length>0||g)return!1;let ae=Me.current,$e=(V?.ensureLeadingBoundary??!1)&&ae.length>0&&!/\s$/.test(ae);return ni(ae.length,ae.length,$e?` ${P}`:P)},Zg=Zw({insertMentionAtEnd:P=>Kb(P,{ensureLeadingBoundary:!0}),setDragActive:Co,onInsertRejected:()=>{me.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),FD=P=>{if(!sv(P.dataTransfer.types))return;P.stopPropagation();let V=P.relatedTarget;V instanceof Node&&P.currentTarget.contains(V)||Co(!1)};q(()=>{if(!Vr)return;let P=()=>{Co(!1)};return window.addEventListener("dragend",P),()=>window.removeEventListener("dragend",P)},[Vr]);let eh=$(()=>{en()},[en]),th=$(()=>{Rt()},[Rt]),BD=$(()=>{br&&(Ku.current||(bo.current!==null&&window.cancelAnimationFrame(bo.current),bo.current=window.requestAnimationFrame(()=>{if(bo.current=null,Ku.current)return;let P=wb.current,V=$g.current,ae=document.activeElement;ae instanceof Element&&b6(ae)||ae instanceof Node&&(P&&P.contains(ae)||V&&V.contains(ae))||Hu(!1)})))},[br]);return q(()=>()=>{bo.current!==null&&window.cancelAnimationFrame(bo.current),ol.current!==null&&window.cancelAnimationFrame(ol.current),rl.current!==null&&window.cancelAnimationFrame(rl.current)},[]),Qr(Te,()=>({focusAtEnd:()=>{va.current?.focusAtEnd()},focusAt:P=>{va.current?.focusAt(P)},addDroppedFiles:P=>{ef(P),xt()},insertTextAtEnd:Kb,openModelPicker:()=>{xd(!0)},toggleModelPicker:()=>{xd(P=>!P)},compactContext:jg,isModelPickerOpen:()=>el,isMentionMenuOpen:()=>Kg.current,readSnapshot:()=>ju(),resetCursorState:P=>{let V=P?.prompt??Me.current,ae=sr(V,P?.cursor??0);Re(null),Ro(ae),K(P?.detectTrigger?dr(V,wr(V,ae)):null)},addTerminalContext:P=>{if(!f)return;let V=va.current?.readSnapshot()??{value:Me.current,cursor:ga,expandedCursor:wr(Me.current,ga),terminalContextIds:Tt.map(rt=>rt.id)},ae=me.terminalContext.insertInlinePlaceholder(V.value,V.expandedCursor),$e=lr(ae.prompt,ae.cursor);hn(n,ae.prompt,{id:pu(),threadId:f.id,createdAt:new Date().toISOString(),...P},ae.contextIndex)&&(Me.current=ae.prompt,Ro($e),K(dr(ae.prompt,ae.cursor)),window.requestAnimationFrame(()=>{va.current?.focusAt($e)}))},getSendContext:()=>({prompt:Me.current,images:ht.current,terminalContexts:Wt.current,elementContexts:fn.current,previewAnnotations:Lt,reviewComments:Jn,selectedPromptEffort:Xa,selectedModelOptionsForDispatch:Bo,selectedModelSelection:xn,...Sn?{executionSelection:Sn}:{},executionReady:pa,...Bi?{selectedNativeModeId:Bi}:{},providerAvailable:!zt,selectedProvider:$t,selectedModel:Ht,selectedProviderModels:Fn,selectedPluginAction:pt}),validateProviderInput:P=>{let V=rn??xb({prompt:Me.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:ut.maxInputChars});return Hg.current=V!==null,Fg(V),V===null}}),[f,ef,n,ga,Tt,hn,Me,ht,Wt,fn,Lt,Jn,xt,x,En,I.length,g,ni,el,ju,Ht,Bo,xn,Sn,pa,Bi,zt,Xa,$t,Fn,pt,rn,jg,ut.maxInputChars]),b("form",{ref:$g,onSubmit:Gg,onFocusCapture:P=>{let V=P.target;wn&&V instanceof HTMLElement&&V.closest('[data-chat-composer-collapsed-controls="true"]')||(bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),Hu(!0))},onBlurCapture:()=>{BD()},onDragEnterCapture:Zg.onDragEnter,onDragOverCapture:Zg.onDragOver,onDragLeaveCapture:FD,onDropCapture:Zg.onDrop,className:F("mx-auto w-full min-w-0 max-w-3xl",ND&&"pt-7"),"data-chat-composer-form":"true",children:[Vu&&(!yd||Sd)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":S?"warning":"info",children:!wn&&S?b("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(ZC,{approval:S,pendingCount:L.length}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:u(VC,{requestId:S.requestId,isResponding:B.includes(S.requestId),options:S.options,keybindings:Oe,declineReasonRelay:S.declineReasonRelay,onRespondToApproval:Un})})]}):!wn&&I.length>0?u(nb,{pendingUserInputs:I,respondingRequestIds:B,answers:N,questionIndex:R,onToggleOption:kn,onAdvance:pn}):!wn&&z&&U?u(I_,{planTitle:rD(U.planMarkdown)??null},U.id):wn&&S?b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(ZC,{approval:S,pendingCount:L.length,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:u(VC,{requestId:S.requestId,isResponding:B.includes(S.requestId),options:S.options,keybindings:Oe,declineReasonRelay:S.declineReasonRelay,onRespondToApproval:Un})})]}):wn&&I.length>0?b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(nb,{pendingUserInputs:I,respondingRequestIds:B,answers:N,questionIndex:R,onToggleOption:kn,onAdvance:pn}),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?.activeQuestion?.multiSelect&&"p-0"),children:[Mb?null:u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",T?.customAnswer?"text-foreground":"text-placeholder",!T?.activeQuestion?.multiSelect&&"px-3 py-2"),onPointerDown:P=>P.preventDefault(),onClick:Qu,"aria-label":"Write custom answer",children:T?.customAnswer||"Write custom answer"}),Zu,Ju,T?.activeQuestion?.multiSelect?u(Pg,{compact:!0,pendingAction:Wu,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:Xo,isConnecting:x,isEnvironmentUnavailable:k!==null||zt||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Pn,onInterrupt:eh,onImplementPlanInNewThread:th}):null]})})]}):null}):null,yd&&!Sd&&Wr&&xa?u(lT,{onDismiss:Yg,onCollapse:Xg,progress:Wr,steps:xa}):null,b("div",{className:"relative",children:[Jg&&Wr&&xa?u(dv,{expanded:!1,hasTrailingShoulder:dl.length>0,onDismiss:Yg,onToggle:Xg,progress:Wr,steps:xa}):null,Jg?u(lv,{count:dl.length,menuOpen:Bg,pulseKey:nl.key,pulsing:nl.active,onToggleMenu:Qg}):null,u("div",{"data-chat-composer-main-surface":"true",className:F("group relative z-10 rounded-[22px] p-px transition-colors duration-200",Cr.composerFrameClassName),children:b("div",{ref:wb,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":wn?"true":"false",className:F("rounded-[20px] transition-[background-color] duration-200",Vr?"bg-accent/45 ring-1 ring-primary/70":null,g?"opacity-75":null,Cr.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&&!En?u(J_,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,gD?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:Qe.trim())?"text-foreground":"text-placeholder"),onPointerDown:P=>P.preventDefault(),onClick:Qu,"aria-label":"Expand composer",children:T?T.customAnswer||"Type your own answer, or leave this blank to use the selected option":Qe.trim()||(zt?"Enable a provider in Settings":"Ask anything...")}),Zu,Ju,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:CD,"aria-label":bD,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),Gg()},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:fD,className:F("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",En&&"pb-3 sm:pb-4",wn&&"hidden"),children:[Bg&&!Ui&&!En&&u(aD,{anchor:Cb,children:u(aT,{entries:dl,onRestore:ED,onDelete:AD,onClose:()=>ha(!1)})}),Ui&&!En&&u(aD,{anchor:Cb,children:u(DN,{items:$o,resolvedTheme:it,isLoading:vD,triggerKind:sl,emptyStateText:xD,activeItemId:Ab?.id??null,onHighlightedItemChange:kD,onSelect:Db})}),!wn&&!En&&I.length===0&&Lt.length>0&&u(xT,{annotations:Lt,images:wt,...a?{uploadsByImageId:vo,onRetryUpload:P=>me.uploads.retry({environmentId:o,image:P})}:{},onRemove:P=>{me.uploads.release(P),on(n,P)},onExpandImage:P=>{let V=hb(bn,P);V&&bt(V)},className:"mb-3"}),!wn&&!En&&I.length===0&&Jn.length>0&&u(vT,{comments:Jn,onRemove:P=>xo(n,P),className:"mb-3"}),!wn&&!En&&I.length===0&&nt.length>0&&u(hT,{contexts:nt,onRemove:P=>to(n,P),className:"mb-3"}),!wn&&!En&&I.length===0&&wt.some(P=>!Lt.some(V=>V.id===P.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:wt.filter(P=>!Lt.some(V=>V.id===P.id)).map(P=>{let V=a?vo[P.id]:void 0,ae=nv(P),$e=cT(ae),Ge=ae==="image"&&!!P.previewUrl;return b("div",{className:F("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",Ge?"w-16":"w-44 max-w-full"),children:[Ge?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":ft("attachments.preview",{name:P.name}),onClick:()=>{let rt=hb(bn,P.id);rt&&bt(rt)},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":ft("attachments.open",{name:P.name}),children:[u($e,{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:ov(P.sizeBytes)})]})]}),mD.has(P.id)&&b(Xe,{children:[u(Je,{render:u("span",{role:"img","aria-label":ft("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(Ye,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:ft("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:dp(V.progress)}),V?.status==="failed"&&b(Xe,{children:[u(Je,{render:u(oe,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>me.uploads.retry({environmentId:o,image:P}),"aria-label":ft("attachments.retryUpload",{name:P.name})}),children:u(os,{})}),u(Ye,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:V.reason})]}),u(oe,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>_D(P.id),"aria-label":ft("attachments.remove",{name:P.name}),children:u(Yt,{})})]},P.id)})}),b("div",{className:"relative",children:[Mb?null:u(kM,{editorRef:va,documentKey:an,value:En?"":T?T.customAnswer:Qe,cursor:ga,terminalContexts:!En&&I.length===0?Tt:[],skills:be?.skills??[],...bd?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:TD,onChange:LD,onCommandKeyDown:PD,onPaste:OD,placeholder:En?S?.detail??"Resolve this approval request to continue":T?"Type your own answer, or leave this blank to use the selected option":z&&U?"Add feedback to refine the plan, or leave this blank to implement it":g?"Choose a project above to start a thread":zt?"Enable a provider in Settings to send a message":v==="disconnected"?Yw:"Ask anything, @tag files/folders, $use skills, or / for commands",disabled:x||En||g}),bd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[Zu,Ju,u(Pg,{compact:!0,pendingAction:Wu,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:Xo,isConnecting:x,isEnvironmentUnavailable:k!==null||zt||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Pn,onInterrupt:eh,onImplementPlanInNewThread:th})]}):null]})]}),u(oD,{message:uD??Uu}),rn===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:rn}),wn||En?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":Cd?"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",Cd?"gap-1.5":"gap-2 sm:gap-0",bd&&"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:Sb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:DD}),b(Xe,{children:[u(Je,{render:u(oe,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:x||g||I.length>0,"aria-label":ft("attachments.add"),onClick:()=>Sb.current?.click()}),children:u(_o,{})}),u(Ye,{side:"top",children:ft("attachments.add")})]}),zt?b(oe,{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(_N,{compact:Cd,activeInstanceId:dn,model:Ya,lockedProvider:De,lockedContinuationGroupKey:Kr,instanceEntries:On,keybindings:Oe,modelOptionsByInstance:Ao,triggerClassName:"-ms-2.5",terminalOpen:Ue,open:el,...Cr.modelPickerIconClassName?{activeProviderIconClassName:Cr.modelPickerIconClassName}:{},onOpenChange:P=>{xd(P)},getModelDisabledReason:X,getModelContinuationLabel:se,onContinueInModel:re,onInstanceModelChange:ln,...Se?{composerChoices:Se}:{},selectedExecutionSelection:Sn??null,onClearExecutionSelection:dt,executionAppliesTo:ct,sourceLabel:zi?.sourceLabel,...io?{onChooseExecution:P=>{io(P.selection,P)}}:{},...Mo?{pluginActions:zo,selectedPluginActionKey:pt?.id??null,onSelectPluginAction:Gt,onManagePlugins:D}:{}}),yn?null:b(xe,{children:[u(U_,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:Cd}),Cd?u(BN,{interactionMode:W,runtimeMode:ee,runtimeModeSwitch:Qo.runtimeModeSwitch,nativeMode:qr,canSwitchNativeMode:fa,showInteractionModeToggle:Qo.showInteractionModeToggle,traitsMenuContent:yD,onToggleInteractionMode:de,onRuntimeModeChange:tt,onNativeModeChange:Zs}):b(xe,{children:[_b?b(xe,{children:[u(ec,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),_b]}):null,u(I6,{showInteractionModeToggle:Qo.showInteractionModeToggle,interactionMode:W,runtimeMode:ee,runtimeModeSwitch:Qo.runtimeModeSwitch,nativeMode:qr,canSwitchNativeMode:fa,onToggleInteractionMode:de,onRuntimeModeChange:tt,onNativeModeChange:Zs})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":Rb?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[bd?null:Zu,bd?null:Ju,u(S6,{compact:Rb,activeContextWindow:lt,activeThreadModelDisplayName:Za,pendingAction:Wu,isRunning:v==="running",showPlanFollowUpPrompt:I.length===0&&z,promptHasText:Qe.trim().length>0,isSendBusy:y,sendDisabledReason:Xo,isConnecting:x,isEnvironmentUnavailable:k!==null||zt||g,isPreparingWorktree:w,hasSendableContent:il.hasSendableContent,preserveComposerFocusOnPointerDown:br,showSendWhileRunning:br,onPreviousPendingQuestion:Pn,onInterrupt:eh,onImplementPlanInNewThread:th,compactDisabled:at||zt||y||x,compactDisabledReason:vr,onCompactContext:jg})]})]})]})})]})]})});function sD(e){let{composerRef:t,...n}=e,o=n;return u(nT,{value:o.api,children:u(iD,{...o,composerRef:t})})}function lD(e){return u(fh.Provider,{value:e.scope.active,children:u(w6,{...e})})}function w6(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(sD,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:b(xe,{children:[u(tS,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(rS,{...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(nS,{chat:u(m0,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u(x0,{...r,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(zw,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:d,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:b(xe,{children:[u(_w,{inputKey:t.threadKey,actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(Zh,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var T6=".ycodium-conversation-ui";function L6(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function dD(e,t="conversation"){let n=L6(),o=e.replaceAll(T6,`.${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 k6(e){let t=dD(Wb);return{views:{[ih]:P6(t,e)},viewCapabilities:{[ih]:[Jb]}}}function P6(e,t){return function(o){let a=o[sh]??t,i={...o};return delete i[sh],b(Qb,{value:a,children:[u(E6,{retain:e.retain}),u(Yb,{value:e.scopeClass,children:u(lD,{...i,scopeClass:e.scopeClass})})]})}}function E6({retain:e}){return Ld(()=>e(),[e]),null}export{k6 as default};