@ycodium-ai/plugin-conversation 0.2.2078 → 0.2.2098
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/ui.js +53 -49
- package/package.json +2 -2
package/assets/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var JD=Object.create;var af=Object.defineProperty;var ZD=Object.getOwnPropertyDescriptor;var e1=Object.getOwnPropertyNames;var t1=Object.getPrototypeOf,n1=Object.prototype.hasOwnProperty;var o1=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var sf=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},An=(e,t)=>{for(var n in t)af(e,n,{get:t[n],enumerable:!0})},Gb=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of e1(t))!n1.call(e,r)&&r!==n&&af(e,r,{get:()=>t[r],enumerable:!(o=ZD(t,r))||o.enumerable});return e};var Sd=(e,t,n)=>(n=e!=null?JD(t1(e)):{},Gb(t||!e||!e.__esModule?af(n,"default",{value:e,enumerable:!0}):n,e)),jb=e=>Gb(af({},"__esModule",{value:!0}),e);var df={};An(df,{Activity:()=>a1,Children:()=>ah,Component:()=>Ui,Fragment:()=>Ja,Profiler:()=>i1,PureComponent:()=>s1,StrictMode:()=>l1,Suspense:()=>ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>d1,__COMPILER_RUNTIME:()=>c1,act:()=>u1,cache:()=>f1,cacheSignal:()=>p1,captureOwnerStack:()=>m1,cloneElement:()=>lf,createContext:()=>Ht,createElement:()=>Te,createRef:()=>g1,default:()=>hn,forwardRef:()=>Wn,isValidElement:()=>sh,lazy:()=>h1,memo:()=>ue,startTransition:()=>v1,unstable_useCacheRefresh:()=>x1,use:()=>Ut,useActionState:()=>y1,useCallback:()=>B,useContext:()=>fn,useDebugValue:()=>C1,useDeferredValue:()=>b1,useEffect:()=>q,useEffectEvent:()=>lh,useId:()=>Wr,useImperativeHandle:()=>Gr,useInsertionEffect:()=>wd,useLayoutEffect:()=>ye,useMemo:()=>z,useOptimistic:()=>I1,useReducer:()=>Za,useRef:()=>_,useState:()=>G,useSyncExternalStore:()=>xa,useTransition:()=>S1,version:()=>w1});var Xb,hn,a1,ah,Ui,Ja,i1,s1,l1,ih,d1,c1,u1,f1,p1,m1,lf,Ht,Te,g1,Wn,sh,h1,ue,v1,x1,Ut,y1,B,fn,C1,b1,q,lh,Wr,Gr,wd,ye,z,I1,Za,_,G,xa,S1,w1,me=o1(()=>{Xb=window.__ycodiumPluginHost.react,hn=Xb,{Activity:a1,Children:ah,Component:Ui,Fragment:Ja,Profiler:i1,PureComponent:s1,StrictMode:l1,Suspense:ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:d1,__COMPILER_RUNTIME:c1,act:u1,cache:f1,cacheSignal:p1,captureOwnerStack:m1,cloneElement:lf,createContext:Ht,createElement:Te,createRef:g1,forwardRef:Wn,isValidElement:sh,lazy:h1,memo:ue,startTransition:v1,unstable_useCacheRefresh:x1,use:Ut,useActionState:y1,useCallback:B,useContext:fn,useDebugValue:C1,useDeferredValue:b1,useEffect:q,useEffectEvent:lh,useId:Wr,useImperativeHandle:Gr,useInsertionEffect:wd,useLayoutEffect:ye,useMemo:z,useOptimistic:I1,useReducer:Za,useRef:_,useState:G,useSyncExternalStore:xa,useTransition:S1,version:w1}=Xb});var w0=sf(To=>{"use strict";var bB=(me(),jb(df));function S0(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function ci(){}var wo={d:{f:ci,r:function(){throw Error(S0(522))},D:ci,C:ci,L:ci,m:ci,X:ci,S:ci,M:ci},p:0,findDOMNode:null},IB=Symbol.for("react.portal");function SB(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:IB,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var fc=bB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function jf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}To.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wo;To.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(S0(299));return SB(e,t,null,n)};To.flushSync=function(e){var t=fc.T,n=wo.p;try{if(fc.T=null,wo.p=2,e)return e()}finally{fc.T=t,wo.p=n,wo.d.f()}};To.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,wo.d.C(e,t))};To.prefetchDNS=function(e){typeof e=="string"&&wo.d.D(e)};To.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=jf(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?wo.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&wo.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};To.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=jf(t.as,t.crossOrigin);wo.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&wo.d.M(e)};To.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=jf(n,t.crossOrigin);wo.d.L(e,n,{crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};To.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=jf(t.as,t.crossOrigin);wo.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else wo.d.m(e)};To.requestFormReset=function(e){wo.d.r(e)};To.unstable_batchedUpdates=function(e,t){return e(t)};To.useFormState=function(e,t,n){return fc.H.useFormState(e,t,n)};To.useFormStatus=function(){return fc.H.useHostTransitionStatus()};To.version="19.2.6"});var pc=sf((cZ,L0)=>{"use strict";function T0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(T0)}catch(e){console.error(e)}}T0(),L0.exports=w0()});var _M=sf(NM=>{"use strict";var ad=(me(),jb(df));function AK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var EK=typeof Object.is=="function"?Object.is:AK,MK=ad.useState,RK=ad.useEffect,NK=ad.useLayoutEffect,_K=ad.useDebugValue;function DK(e,t){var n=t(),o=MK({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return NK(function(){r.value=n,r.getSnapshot=t,eC(r)&&a({inst:r})},[e,n,t]),RK(function(){return eC(r)&&a({inst:r}),e(function(){eC(r)&&a({inst:r})})},[e]),_K(n),n}function eC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!EK(e,n)}catch{return!0}}function OK(e,t){return t()}var FK=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?OK:DK;NM.useSyncExternalStore=ad.useSyncExternalStore!==void 0?ad.useSyncExternalStore:FK});var OM=sf((sle,DM)=>{"use strict";DM.exports=_M()});var Qb=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
:root, :host {
|
|
4
4
|
--radius-lg: var(--radius);
|
|
@@ -1506,6 +1506,9 @@ var HD=Object.create;var of=Object.defineProperty;var UD=Object.getOwnPropertyDe
|
|
|
1506
1506
|
.pe-\\[calc\\(env\\(safe-area-inset-right\\)\\+0\\.75rem\\)\\] {
|
|
1507
1507
|
padding-inline-end: calc(env(safe-area-inset-right) + 0.75rem);
|
|
1508
1508
|
}
|
|
1509
|
+
.pt-0\\.5 {
|
|
1510
|
+
padding-top: calc(var(--spacing, 0.25rem) * 0.5);
|
|
1511
|
+
}
|
|
1509
1512
|
.pt-1 {
|
|
1510
1513
|
padding-top: calc(var(--spacing, 0.25rem) * 1);
|
|
1511
1514
|
}
|
|
@@ -3662,73 +3665,74 @@ var HD=Object.create;var of=Object.defineProperty;var UD=Object.getOwnPropertyDe
|
|
|
3662
3665
|
}
|
|
3663
3666
|
}
|
|
3664
3667
|
}
|
|
3665
|
-
`;pe();pe();var Qb=Ut(null),Xb=Qb.Provider,Yb=Ut(""),Jb=Yb.Provider;function lf(){return cn(Yb)}function Yo(){let e=cn(Qb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var sh="conversation";var lh="__ycodiumConversationBridge",Zb="ycodium.conversation.rebindable-bridge.v1";pe();function eI(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=eI(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function tI(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=eI(e))&&(o&&(o+=" "),o+=t);return o}var nI=tI;var m1=(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},g1=(e,t)=>({classGroupId:e,validator:t}),cI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var oI=[],h1="arbitrary..",v1=e=>{let t=y1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return x1(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return uI(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?m1(d,l):l:d||oI}return n[i]||oI}}},uI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=uI(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}},x1=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?h1+o:void 0})(),y1=e=>{let{theme:t,classGroups:n}=e;return C1(n,t)},C1=(e,t)=>{let n=cI();for(let o in e){let r=e[o];uh(r,n,o,t)}return n},uh=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];b1(i,t,n,o)}},b1=(e,t,n,o)=>{if(typeof e=="string"){I1(e,t,n);return}if(typeof e=="function"){S1(e,t,n,o);return}w1(e,t,n,o)},I1=(e,t,n)=>{let o=e===""?t:fI(t,e);o.classGroupId=n},S1=(e,t,n,o)=>{if(T1(e)){uh(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(g1(n,e))},w1=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];uh(l,fI(t,s),n,o)}},fI=(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=cI(),n.nextPart.set(i,s)),n=s}return n},T1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,L1=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 k1=[],rI=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),P1=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 rI(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):rI(k1,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},E1=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}},A1=e=>({cache:L1(e.cacheSize),parseClassName:P1(e),sortModifiers:E1(e),postfixLookupClassGroupIds:M1(e),...v1(e)}),M1=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},R1=/\s+/,N1=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(R1),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},_1=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=pI(n))&&(r&&(r+=" "),r+=o);return r},pI=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=pI(e[o]))&&(n&&(n+=" "),n+=t);return n},aI=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=A1(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=N1(l,n);return r(l,c),c};return a=i,(...l)=>a(_1(...l))},D1=[],Bn=e=>{let t=n=>n[e]||D1;return t.isThemeGetter=!0,t},mI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,O1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,F1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,B1=/\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$/,z1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,H1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ai=e=>O1.test(e),st=e=>!!e&&!Number.isNaN(Number(e)),Xr=e=>!!e&&Number.isInteger(Number(e)),dh=e=>e.endsWith("%")&&st(e.slice(0,-1)),ba=e=>F1.test(e),hI=()=>!0,U1=e=>B1.test(e)&&!z1.test(e),fh=()=>!1,K1=e=>$1.test(e),q1=e=>H1.test(e),V1=e=>!ke(e)&&!Pe(e),W1=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)),G1=e=>ii(e,yI,fh),ke=e=>mI.test(e),qi=e=>ii(e,CI,U1),iI=e=>ii(e,tO,st),j1=e=>ii(e,II,hI),Q1=e=>ii(e,bI,fh),sI=e=>ii(e,vI,fh),X1=e=>ii(e,xI,q1),df=e=>ii(e,SI,K1),Pe=e=>gI.test(e),kd=e=>Vi(e,CI),Y1=e=>Vi(e,bI),lI=e=>Vi(e,vI),J1=e=>Vi(e,yI),Z1=e=>Vi(e,xI),cf=e=>Vi(e,SI,!0),eO=e=>Vi(e,II,!0),ii=(e,t,n)=>{let o=mI.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Vi=(e,t,n=!1)=>{let o=gI.exec(e);return o?o[1]?t(o[1]):n:!1},vI=e=>e==="position"||e==="percentage",xI=e=>e==="image"||e==="url",yI=e=>e==="length"||e==="size"||e==="bg-size",CI=e=>e==="length",tO=e=>e==="number",bI=e=>e==="family-name",II=e=>e==="number"||e==="weight",SI=e=>e==="shadow";var dI=()=>{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(),lI,sI,{position:[Pe,ke]}],be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ue=()=>["auto","cover","contain",J1,G1,{size:[Pe,ke]}],Be=()=>[dh,kd,qi],ge=()=>["","none","full",d,Pe,ke],le=()=>["",st,kd,qi],we=()=>["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,dh,lI,sI],Te=()=>["","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:[hI],container:[ba],"drop-shadow":[ba],ease:["in","out","in-out"],font:[V1],"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":[W1],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,eO,j1]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dh,ke]}],"font-family":[{font:[Y1,Q1,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,iI]}],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:[...we(),"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:be()}],"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]},Z1,X1]}],"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:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"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:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[st,Pe,ke]}],"outline-w":[{outline:["",st,kd,qi]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,cf,df]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,cf,df]}],"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,cf,df]}],"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:be()}],"mask-size":[{mask:ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Pe,ke]}],filter:[{filter:["","none",Pe,ke]}],blur:[{blur:Te()}],brightness:[{brightness:[st,Pe,ke]}],contrast:[{contrast:[st,Pe,ke]}],"drop-shadow":[{"drop-shadow":["","none",m,cf,df]}],"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":Te()}],"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,iI]}],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"]}},nO=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(ul(e,"cacheSize",t),ul(e,"prefix",n),ul(e,"experimentalParseClassName",o),uf(e.theme,a.theme),uf(e.classGroups,a.classGroups),uf(e.conflictingClassGroups,a.conflictingClassGroups),uf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ul(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),ul(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),ff(e.theme,r.theme),ff(e.classGroups,r.classGroups),ff(e.conflictingClassGroups,r.conflictingClassGroups),ff(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),ch(e,r,"postfixLookupClassGroups"),ch(e,r,"orderSensitiveModifiers"),e),ul=(e,t,n)=>{n!==void 0&&(e[t]=n)},uf=(e,t)=>{if(t)for(let n in t)ul(e,n,t[n])},ff=(e,t)=>{if(t)for(let n in t)ch(e,t,n)},ch=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},wI=(e,...t)=>typeof e=="function"?aI(dI,e,...t):aI(()=>nO(dI(),e),...t);var oO=wI({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 oO(nI(e))}pe();var ph=Ut(!0);var mh=Ut(void 0);function si(){let e=Kt(ph);return Kt(mh)??e}pe();var pf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var TI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var LI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var gh=e=>{let t=LI(e);return t.charAt(0).toUpperCase()+t.slice(1)};pe();var kI={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 PI=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var EI=qn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Le("svg",{ref:l,...kI,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:pf("lucide",r),...!a&&!PI(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(EI,{ref:a,iconNode:t,className:pf(`lucide-${TI(gh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=gh(e),n};var rO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Pd=j("arrow-down",rO);var aO=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Ed=j("arrow-up-right",aO);var iO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ad=j("arrow-up",iO);var sO=[["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",sO);var lO=[["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",lO);var dO=[["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",dO);var cO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Io=j("check",cO);var uO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],un=j("chevron-down",uO);var fO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Gi=j("chevron-left",fO);var pO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Uo=j("chevron-right",pO);var mO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Rd=j("chevron-up",mO);var gO=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Nd=j("chevrons-left",gO);var hO=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],_d=j("chevrons-right",hO);var vO=[["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",vO);var xO=[["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",xO);var yO=[["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",yO);var CO=[["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",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"}],["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",bO);var IO=[["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",IO);var SO=[["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",SO);var wO=[["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",wO);var TO=[["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",TO);var LO=[["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",LO);var kO=[["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",kO);var PO=[["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",PO);var EO=[["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",EO);var AO=[["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",AO);var MO=[["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",MO);var RO=[["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",RO);var NO=[["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",NO);var _O=[["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",_O);var DO=[["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",DO);var OO=[["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",OO);var FO=[["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",FO);var BO=[["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",BO);var zO=[["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",zO);var $O=[["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",$O);var HO=[["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",HO);var UO=[["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",UO);var KO=[["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",KO);var qO=[["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",qO);var VO=[["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",VO);var WO=[["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",WO);var GO=[["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",GO);var jO=[["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",jO);var QO=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],rs=j("search",QO);var XO=[["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",XO);var YO=[["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",YO);var JO=[["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",JO);var ZO=[["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",ZO);var eF=[["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",eF);var tF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Yd=j("square",tF);var nF=[["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",nF);var oF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Sa=j("terminal",oF);var rF=[["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",rF);var aF=[["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",aF);var iF=[["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",iF);var sF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Yt=j("x",sF);var lF=[["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",lF);pe();function ze(){return{t:Yo().i18n.usePluginTranslation()}}pe();var dF=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function Y(e){let t=n=>{let o=Yo(),r=lf(),a=si(),i=o.ui[e];return Le(i,{...n,...dF.has(e)&&!a?{open:!1}:{},className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var N9=Y("useLinkContextMenu"),wa=Y("ProviderInstanceIcon"),AI=Y("UserAvatar"),ml=Y("Badge"),oe=Y("Button"),_9=Y("Label"),mf=Y("Input"),MI=Y("Textarea"),D9=Y("Switch"),ec=Y("Separator"),O9=Y("Skeleton"),gf=Y("Spinner"),F9=Y("ScrollArea"),B9=Y("Card"),z9=Y("CardAction"),$9=Y("CardContent"),H9=Y("CardDescription"),U9=Y("CardFooter"),K9=Y("CardHeader"),q9=Y("CardTitle"),V9=Y("Empty"),W9=Y("EmptyContent"),G9=Y("EmptyDescription"),j9=Y("EmptyHeader"),Q9=Y("EmptyMedia"),X9=Y("EmptyTitle"),Y9=Y("InputGroup"),J9=Y("InputGroupAddon"),Z9=Y("InputGroupInput"),eQ=Y("DocumentPanel"),tQ=Y("MasterDetail"),hf=Y("Select"),nQ=Y("SelectContent"),vf=Y("SelectItem"),xf=Y("SelectPopup"),RI=Y("SelectTrigger"),yf=Y("SelectValue"),tc=Y("Toggle"),NI=Y("ToggleGroup"),_I=Y("AlertDialog"),DI=Y("AlertDialogClose"),OI=Y("AlertDialogDescription"),FI=Y("AlertDialogFooter"),BI=Y("AlertDialogHeader"),zI=Y("AlertDialogPopup"),$I=Y("AlertDialogTitle"),Cf=Y("Dialog"),oQ=Y("DialogClose"),bf=Y("DialogDescription"),If=Y("DialogFooter"),Sf=Y("DialogHeader"),wf=Y("DialogPopup"),HI=Y("DialogPanel"),Tf=Y("DialogTitle"),rQ=Y("DialogTrigger"),aQ=Y("DropdownMenu"),iQ=Y("DropdownMenuContent"),sQ=Y("DropdownMenuItem"),lQ=Y("DropdownMenuTrigger"),Zo=Y("Menu"),nc=Y("MenuGroup"),dQ=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"),UI=Y("Table"),KI=Y("TableBody"),fi=Y("TableCell"),ss=Y("TableHead"),qI=Y("TableHeader"),Lf=Y("TableRow"),Xe=Y("Tooltip"),Ye=Y("TooltipPopup"),Je=Y("TooltipTrigger"),VI=Y("Collapsible"),WI=Y("CollapsiblePanel"),GI=Y("CollapsibleTrigger"),oc=Y("Alert"),rc=Y("AlertAction"),kf=Y("AlertDescription"),hh=Y("AlertTitle"),Pf=Y("Kbd"),Ef=Y("Command"),Af=Y("CommandGroup"),Mf=Y("CommandItem"),Rf=Y("CommandList"),jI=Y("Combobox"),QI=Y("ComboboxEmpty"),XI=Y("ComboboxInput"),xl=Y("ComboboxItem"),YI=Y("ComboboxListVirtualized"),JI=Y("TooltipProvider"),ZI=Y("StyledDiffCodeView"),eS=Y("DevBackdropArt"),or=Y("Markdown"),tS=Y("DiffView");var{jsx:u,jsxs:b,Fragment:xe}=window.__ycodiumPluginHost.jsxRuntime;function nS({mode:e,onModeChange:t}){let{t:n}=ze();return b(NI,{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 oS({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(mh,{value:t,children:r==="chat"?n:o})})}pe();function uo(){return{t:Yo().i18n.usePluginTranslation()}}function rS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function aS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function ac(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 cF=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:ac(o.outputTokens)}):null]}):null]})]})});function uF({totals:e}){let{t}=uo();if(!e)return null;let n=rS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:ac(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:ac(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?ac(e.cachedInputTokens):`${ac(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var fF=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 iS({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(()=>aS(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return b(gl,{onOpenChange:c,open:d,children:[b(vl,{render:u(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(cF,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(uF,{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(fF,{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 sS(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 pF(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function mF(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function gF(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var vh=mF(gF()),lS=new Map;function dS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=lS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(vh,pF(e,t));return lS.set(n,r),r}function xh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var hF=new Intl.DateTimeFormat(void 0,{month:"long"});function vF(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 xF(e,t){let n=xh(e);return n?dS(t,!1).format(n):""}function ea(e,t){let n=xh(e);if(!n)return"";let o=xF(e,t),r=n.getDate(),a=hF.format(n),i=n.getFullYear();return`${o}, ${r}${vF(r)} ${a} ${i}`}var yF=new Intl.DateTimeFormat(vh,{month:"numeric",day:"numeric"}),CF=new Intl.DateTimeFormat(vh,{month:"numeric",day:"numeric",year:"numeric"});function pi(e,t,n=Date.now()){let o=xh(e);if(!o)return"";let r=dS(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()?yF:CF).format(o)} ${r}`}pe();pe();async function bF(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 Nf({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)=>{bF(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 cS=1e3;function IF({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),cS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Nf({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:cS});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(IF,{title:l.title,description:l.description})})}):null]})});function SF(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 _f({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 uS=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(_f,{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(_f,{label:ea(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:pi(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?b(_f,{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(_f,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),SF(t.outputTokens)]}):null]}),o?u(yl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});pe();pe();function fS(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 pS=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:["+",fS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",fS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function mS(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function wF(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 gS(e){return e.replaceAll("\\","/")}function hS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function TF(e){return e.replace(/[\\/]+$/,"")}function LF(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function kF(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function PF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Df(e,t){let{path:n,line:o,column:r}=wF(e),a=hS(gS(n)),i=a;if(t){let s=hS(gS(TF(t))),l=LF(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(!PF(a)){let m=kF(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function vS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function xS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Of="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function ic({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function sc({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 Ff({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,yS=24,EF=4e3;function yh(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>yS){for(let[o,r]of Cl)if(r.listeners.size===0&&o!==e&&(Cl.delete(o),Cl.size<=yS))break}return n}function Ch(e,t,n){return yh(e).values.get(t)??n}function lc(e,t,n,o=!0){let r=yh(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>EF){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=yh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=$(()=>Ch(e,t,n),[e,t,n]),a=Ca(o,r,r),i=$(s=>lc(e,t,s),[e,t]);return[a,i]}function Bf({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 AF(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 bh(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:AF(o),count:r}))}function Ih(e,t){let n;for(let o of bh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var Il=20;function Sl(e){return mS(e)}function CS(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?Df(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 bS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Sh(e)?null:u(pS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Sh(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function MF({entry:e,failed:t=!1,derive:n}){return t?u(So,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u(Bf,{name:Ih([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function RF({entries:e,failed:t,derive:n}){let{t:o}=Nt(),r=H(()=>bh(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(Bf,{name:s,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function IS({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 NF=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=Sh(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(sc,{status:h}),u(ic,{children:u(MF,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:CS(n,r,s)??l("toolGroup.calls",{count:1})}),u(bS,{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(IS,{entry:n})}):null]})});function _F({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=_(null);return he(()=>{let a=r.current;if(!a)return;a.scrollTop=Ch(e,`${t}:scroll`,0);let i=()=>{lc(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 SS=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(Sh),[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=xS(t.map(O=>vS(s.resolveWorkEntryStatus(O)))),z=Ih(t,s.toolGroupAction),U=B==="failed"?"failed":B==="running"?"running":"success";return u(Ff,{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&&lc(o,`call:${Sl(x)}`,!0)},className:F(Of,"flex-1",k?"text-destructive":"text-muted-foreground"),children:[u(sc,{status:U}),u(ic,{children:u(Bf,{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}):CS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&E?null:u(bS,{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(RF,{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)),lc(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(_F,{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(NF,{entry:O,...R},Sl(O)))})})]}):u(IS,{entry:x})}):null]})})});function DF(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 wS(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=DF(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 wh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function TS(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 OF(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=TS(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=TS(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 LS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Th=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 kS({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=wh(d,c);return f===null?null:LS(f,d)},heightOf:c=>{let f=wh(d,c);return f===null?null:f.offsetHeight},rowAtScroll:()=>OF(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=wh(f,d);return p?(f.scrollTop=Math.max(0,LS(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(Th,{inputKey:e,onBeforeInputChange:t,children:u("div",{ref:l,className:r,style:{position:"relative"},onScroll:i,children:a})})}pe();var PS=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 FF(e){for(let t of e)switch(t.kind){case"turn-identity":return t.turnId;case"working":return t.turnId??null;case"message":if(t.message.role==="assistant")return t.message.turnId;break;case"tool-group":if(t.entries[0]?.turnId!==void 0)return t.entries[0].turnId??null;break;case"work":if(t.groupedEntries[0]?.turnId!==void 0)return t.groupedEntries[0].turnId??null;break;case"turn-plan":return t.turnPlan.turnId;case"proposed-plan":return t.proposedPlan.turnId;case"turn-summary":return t.footer.turnId}return null}function ES(e,t){let n=[];for(let o of t){if(o.end<=o.start)continue;let r=e.slice(o.start,o.end);n.push({key:o.key,turnId:FF(r),firstRowIndex:o.start,rows:r})}return n}function AS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function dc(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 RS=100,BF=new Map,MS=new Map,kh=e=>typeof e=="function"?e():e,zF=(e,t)=>typeof t=="function"?t(e):t;function $F(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 HF(e,t){let n=MS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},MS.set(e,n)),n}function UF(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 Lh(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function NS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:kh(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function cc(e){queueMicrotask(()=>UF(e))}function Ln(e,t,n,o=RS){let r=Math.max(1,o),a=$F(BF,e,r),i=NS(a,t,n),s=$(f=>i.alive?(a.limit=r,i.committed=!0,Lh(a,t,i),i.leases+=1,i.subscribers.add(f),cc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),cc(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=zF(p,f);if(!Object.is(m,p)){i.value=m,Lh(a,t,i);for(let h of i.subscribers)h();cc(a)}},[i,a,t]);return[d,c]}function Rn(e,t,n,o=RS){let r=Math.max(1,o),a=HF(e,r),i=NS(a,t,()=>({current:kh(n)}));return q(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Lh(a,t,i),i.leases+=1,cc(a),()=>{i.leases=Math.max(0,i.leases-1),cc(a)}},[r,i,a,t]),i.value}function uc(e,t){let n=_(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:kh(t)}}),n.current.ref}var ds=3,KF=ds;function _S(e){let[t,n]=Ln("timeline-reveal-window",e,ds),o=$(()=>{n(s=>s+KF)},[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 DS({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 OS(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 FS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=_(o);r.current=o;let a=OS(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 fc(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 BS(){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 zf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function Ph(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
|
|
3667
|
-
`))}function
|
|
3668
|
-
`}function
|
|
3669
|
-
`).length,S=t.length>900||k>20,L=
|
|
3668
|
+
`;me();me();var Yb=Ht(null),Jb=Yb.Provider,Zb=Ht(""),eI=Zb.Provider;function cf(){return fn(Zb)}function Xo(){let e=fn(Yb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var dh="conversation";var ch="__ycodiumConversationBridge",tI="ycodium.conversation.rebindable-bridge.v1";me();function nI(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=nI(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function oI(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=nI(e))&&(o&&(o+=" "),o+=t);return o}var rI=oI;var T1=(e,t)=>{let n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},L1=(e,t)=>({classGroupId:e,validator:t}),fI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var aI=[],k1="arbitrary..",P1=e=>{let t=E1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return A1(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return pI(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?T1(d,l):l:d||aI}return n[i]||aI}}},pI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=pI(e,t+1,a);if(d)return d}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let d=0;d<l;d++){let c=i[d];if(c.validator(s))return c.classGroupId}},A1=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?k1+o:void 0})(),E1=e=>{let{theme:t,classGroups:n}=e;return M1(n,t)},M1=(e,t)=>{let n=fI();for(let o in e){let r=e[o];ph(r,n,o,t)}return n},ph=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];R1(i,t,n,o)}},R1=(e,t,n,o)=>{if(typeof e=="string"){N1(e,t,n);return}if(typeof e=="function"){_1(e,t,n,o);return}D1(e,t,n,o)},N1=(e,t,n)=>{let o=e===""?t:mI(t,e);o.classGroupId=n},_1=(e,t,n,o)=>{if(O1(e)){ph(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(L1(n,e))},D1=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];ph(l,mI(t,s),n,o)}},mI=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);s||(s=fI(),n.nextPart.set(i,s)),n=s}return n},O1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,F1=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}};var B1=[],iI=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),z1=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let g=0;g<c;g++){let v=r[g];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,g)),l=g+1;continue}if(v==="/"){d=g;continue}}v==="["?i++:v==="]"?i--:v==="("?s++:v===")"&&s--}let f=a.length===0?r:r.slice(l),p=f,m=!1;f.endsWith("!")?(p=f.slice(0,-1),m=!0):f.startsWith("!")&&(p=f.slice(1),m=!0);let h=d&&d>l?d-l:void 0;return iI(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):iI(B1,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},$1=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);s||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(i)):r.push(i)}return r.length>0&&(r.sort(),o.push(...r)),o}},H1=e=>({cache:F1(e.cacheSize),parseClassName:z1(e),sortModifiers:$1(e),postfixLookupClassGroupIds:U1(e),...P1(e)}),U1=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},K1=/\s+/,q1=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(K1),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let x=!!v,y;if(x){let L=g.substring(0,v);y=o(L);let I=y&&i[y]?o(g):void 0;I&&I!==y&&(y=I,x=!1)}else y=o(g);if(!y){if(!x){d=f+(d.length>0?" "+d:d);continue}if(y=o(g),!y){d=f+(d.length>0?" "+d:d);continue}x=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=h?C+"!":C,k=w+y;if(s.indexOf(k)>-1)continue;s.push(k);let S=r(y,x);for(let L=0;L<S.length;++L){let I=S[L];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},V1=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=gI(n))&&(r&&(r+=" "),r+=o);return r},gI=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=gI(e[o]))&&(n&&(n+=" "),n+=t);return n},sI=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=H1(d),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=l=>{let d=o(l);if(d)return d;let c=q1(l,n);return r(l,c),c};return a=i,(...l)=>a(V1(...l))},W1=[],Dn=e=>{let t=n=>n[e]||W1;return t.isThemeGetter=!0,t},hI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,j1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,X1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Y1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ei=e=>G1.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),jr=e=>!!e&&Number.isInteger(Number(e)),uh=e=>e.endsWith("%")&&it(e.slice(0,-1)),ya=e=>j1.test(e),xI=()=>!0,Z1=e=>Q1.test(e)&&!X1.test(e),mh=()=>!1,eO=e=>Y1.test(e),tO=e=>J1.test(e),nO=e=>!Le(e)&&!ke(e),oO=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),rO=e=>ti(e,bI,mh),Le=e=>hI.test(e),Ki=e=>ti(e,II,Z1),lI=e=>ti(e,fO,it),aO=e=>ti(e,wI,xI),iO=e=>ti(e,SI,mh),dI=e=>ti(e,yI,mh),sO=e=>ti(e,CI,tO),uf=e=>ti(e,TI,eO),ke=e=>vI.test(e),Td=e=>qi(e,II),lO=e=>qi(e,SI),cI=e=>qi(e,yI),dO=e=>qi(e,bI),cO=e=>qi(e,CI),ff=e=>qi(e,TI,!0),uO=e=>qi(e,wI,!0),ti=(e,t,n)=>{let o=hI.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},qi=(e,t,n=!1)=>{let o=vI.exec(e);return o?o[1]?t(o[1]):n:!1},yI=e=>e==="position"||e==="percentage",CI=e=>e==="image"||e==="url",bI=e=>e==="length"||e==="size"||e==="bg-size",II=e=>e==="length",fO=e=>e==="number",SI=e=>e==="family-name",wI=e=>e==="number"||e==="weight",TI=e=>e==="shadow";var uI=()=>{let e=Dn("color"),t=Dn("font"),n=Dn("text"),o=Dn("font-weight"),r=Dn("tracking"),a=Dn("leading"),i=Dn("breakpoint"),s=Dn("container"),l=Dn("spacing"),d=Dn("radius"),c=Dn("shadow"),f=Dn("inset-shadow"),p=Dn("text-shadow"),m=Dn("drop-shadow"),h=Dn("blur"),g=Dn("perspective"),v=Dn("aspect"),x=Dn("ease"),y=Dn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...w(),ke,Le],S=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],I=()=>[ke,Le,l],T=()=>[ei,"full","auto",...I()],E=()=>[jr,"none","subgrid",ke,Le],A=()=>["auto",{span:["full",jr,ke,Le]},jr,ke,Le],N=()=>[jr,"auto",ke,Le],R=()=>["auto","min","max","fr",ke,Le],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...I()],O=()=>[ei,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],oe=()=>[ei,"screen","full","dvw","lvw","svw","min","max","fit",...I()],ee=()=>[ei,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,ke,Le],qe=()=>[...w(),cI,dI,{position:[ke,Le]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],fe=()=>["auto","cover","contain",dO,rO,{size:[ke,Le]}],Ne=()=>[uh,Td,Ki],Ae=()=>["","none","full",d,ke,Le],ae=()=>["",it,Td,Ki],Ee=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[it,uh,cI,dI],Ie=()=>["","none",h,ke,Le],st=()=>["none",it,ke,Le],dt=()=>["none",it,ke,Le],lt=()=>[it,ke,Le],ct=()=>[ei,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ya],breakpoint:[ya],color:[xI],container:[ya],"drop-shadow":[ya],ease:["in","out","in-out"],font:[nO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ya],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ya],shadow:[ya],spacing:["px",it],text:[ya],"text-shadow":[ya],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ei,Le,ke,v]}],container:["container"],"container-type":[{"@container":["","normal","size",ke,Le]}],"container-named":[oO],columns:[{columns:[it,Le,ke,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[jr,"auto",ke,Le]}],basis:[{basis:[ei,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,ei,"auto","initial","none",Le]}],grow:[{grow:["",it,ke,Le]}],shrink:[{shrink:["",it,ke,Le]}],order:[{order:[jr,"first","last","none",ke,Le]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],"inline-size":[{inline:["auto",...oe()]}],"min-inline-size":[{"min-inline":["auto",...oe()]}],"max-inline-size":[{"max-inline":["none",...oe()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[s,"screen",...O()]}],"min-w":[{"min-w":[s,"screen","none",...O()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,Td,Ki]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,uO,aO]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",uh,Le]}],"font-family":[{font:[lO,iO,t]}],"font-features":[{"font-features":[Le]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ke,Le]}],"line-clamp":[{"line-clamp":[it,"none",ke,lI]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",ke,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",ke,Ki]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[it,"auto",ke,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[jr,ke,Le]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:qe()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jr,ke,Le],radial:["",ke,Le],conic:[jr,ke,Le]},cO,sO]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Ne()}],"gradient-via-pos":[{via:Ne()}],"gradient-to-pos":[{to:Ne()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Ae()}],"rounded-s":[{"rounded-s":Ae()}],"rounded-e":[{"rounded-e":Ae()}],"rounded-t":[{"rounded-t":Ae()}],"rounded-r":[{"rounded-r":Ae()}],"rounded-b":[{"rounded-b":Ae()}],"rounded-l":[{"rounded-l":Ae()}],"rounded-ss":[{"rounded-ss":Ae()}],"rounded-se":[{"rounded-se":Ae()}],"rounded-ee":[{"rounded-ee":Ae()}],"rounded-es":[{"rounded-es":Ae()}],"rounded-tl":[{"rounded-tl":Ae()}],"rounded-tr":[{"rounded-tr":Ae()}],"rounded-br":[{"rounded-br":Ae()}],"rounded-bl":[{"rounded-bl":Ae()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ee(),"hidden","none"]}],"divide-style":[{divide:[...Ee(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,ke,Le]}],"outline-w":[{outline:["",it,Td,Ki]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,ff,uf]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,ff,uf]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[it,Ki]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",p,ff,uf]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[it,ke,Le]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ke,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:qe()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Le]}],filter:[{filter:["","none",ke,Le]}],blur:[{blur:Ie()}],brightness:[{brightness:[it,ke,Le]}],contrast:[{contrast:[it,ke,Le]}],"drop-shadow":[{"drop-shadow":["","none",m,ff,uf]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",it,ke,Le]}],"hue-rotate":[{"hue-rotate":[it,ke,Le]}],invert:[{invert:["",it,ke,Le]}],saturate:[{saturate:[it,ke,Le]}],sepia:[{sepia:["",it,ke,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Le]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[it,ke,Le]}],"backdrop-contrast":[{"backdrop-contrast":[it,ke,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,ke,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,ke,Le]}],"backdrop-invert":[{"backdrop-invert":["",it,ke,Le]}],"backdrop-opacity":[{"backdrop-opacity":[it,ke,Le]}],"backdrop-saturate":[{"backdrop-saturate":[it,ke,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",it,ke,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",ke,Le]}],ease:[{ease:["linear","initial",x,ke,Le]}],delay:[{delay:[it,ke,Le]}],animate:[{animate:["none",y,ke,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,ke,Le]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:st()}],"rotate-x":[{"rotate-x":st()}],"rotate-y":[{"rotate-y":st()}],"rotate-z":[{"rotate-z":st()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[ke,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ct()}],"translate-x":[{"translate-x":ct()}],"translate-y":[{"translate-y":ct()}],"translate-z":[{"translate-z":ct()}],"translate-none":["translate-none"],zoom:[{zoom:[jr,ke,Le]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Le]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[it,Td,Ki,lI]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},pO=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(ll(e,"cacheSize",t),ll(e,"prefix",n),ll(e,"experimentalParseClassName",o),pf(e.theme,a.theme),pf(e.classGroups,a.classGroups),pf(e.conflictingClassGroups,a.conflictingClassGroups),pf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ll(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),ll(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),mf(e.theme,r.theme),mf(e.classGroups,r.classGroups),mf(e.conflictingClassGroups,r.conflictingClassGroups),mf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),fh(e,r,"postfixLookupClassGroups"),fh(e,r,"orderSensitiveModifiers"),e),ll=(e,t,n)=>{n!==void 0&&(e[t]=n)},pf=(e,t)=>{if(t)for(let n in t)ll(e,n,t[n])},mf=(e,t)=>{if(t)for(let n in t)fh(e,t,n)},fh=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},LI=(e,...t)=>typeof e=="function"?sI(uI,e,...t):sI(()=>pO(uI(),e),...t);var mO=LI({extend:{classGroups:{"font-size":[{text:["chat","chat-row","chat-code","chat-dense","chat-meta","control-1","control-2","control-3","control-4","control-5"]}]}}});function F(...e){return mO(rI(e))}me();var gh=Ht(!0);var hh=Ht(void 0);function ni(){let e=Ut(gh);return Ut(hh)??e}me();var gf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var kI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var PI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var vh=e=>{let t=PI(e);return t.charAt(0).toUpperCase()+t.slice(1)};me();var AI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var EI=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var MI=Wn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Te("svg",{ref:l,...AI,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:gf("lucide",r),...!a&&!EI(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>Te(d,c)),...Array.isArray(a)?a:[a]]));var j=(e,t)=>{let n=Wn(({className:o,...r},a)=>Te(MI,{ref:a,iconNode:t,className:gf(`lucide-${kI(vh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=vh(e),n};var gO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ld=j("arrow-down",gO);var hO=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],kd=j("arrow-up-right",hO);var vO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Pd=j("arrow-up",vO);var xO=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Ad=j("blocks",xO);var yO=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],dl=j("bookmark",yO);var CO=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Vi=j("bot",CO);var bO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Io=j("check",bO);var IO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],pn=j("chevron-down",IO);var SO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Wi=j("chevron-left",SO);var wO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Uo=j("chevron-right",wO);var TO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ed=j("chevron-up",TO);var LO=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Md=j("chevrons-left",LO);var kO=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Rd=j("chevrons-right",kO);var PO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],So=j("circle-alert",PO);var AO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Gi=j("copy",AO);var EO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Yo=j("ellipsis",EO);var MO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nd=j("eye",MO);var RO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],ji=j("file-code",RO);var NO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Qi=j("file-text",NO);var _O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],_d=j("file",_O);var DO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],oi=j("folder",DO);var OO=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],Dd=j("frame",OO);var FO=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],Od=j("git-branch-plus",FO);var BO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Fd=j("globe",BO);var zO=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Bd=j("grip-vertical",zO);var $O=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],zd=j("hammer",$O);var HO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Xi=j("image",HO);var UO=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ca=j("layers",UO);var KO=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],$d=j("list-ordered",KO);var qO=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Yi=j("list-todo",qO);var VO=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Hd=j("list",VO);var WO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],ri=j("lock-open",WO);var GO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Ud=j("lock",GO);var jO=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Ji=j("message-circle",jO);var QO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Zi=j("message-square",QO);var XO=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Kd=j("minimize-2",XO);var YO=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Qr=j("mouse-pointer-click",YO);var JO=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],qd=j("package",JO);var ZO=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],es=j("paintbrush",ZO);var eF=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Ro=j("paperclip",eF);var tF=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Xr=j("pen-line",tF);var nF=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Vd=j("pencil-ruler",nF);var oF=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Wd=j("pencil",oF);var rF=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ts=j("puzzle",rF);var aF=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ns=j("rotate-ccw",aF);var iF=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],os=j("search",iF);var sF=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Gd=j("send",sF);var lF=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],jd=j("settings",lF);var dF=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],cl=j("sliders-horizontal",dF);var cF=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ai=j("sparkles",cF);var uF=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],No=j("square-pen",uF);var fF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Qd=j("square",fF);var pF=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],rs=j("star",pF);var mF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ba=j("terminal",mF);var gF=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Xd=j("text-quote",gF);var hF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Yr=j("user-round",hF);var vF=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Yd=j("wrench",vF);var xF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=j("x",xF);var yF=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],as=j("zap",yF);me();function De(){return{t:Xo().i18n.usePluginTranslation()}}me();var CF=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function J(e){let t=n=>{let o=Xo(),r=cf(),a=ni(),i=o.ui[e];return Te(i,{...n,...CF.has(e)&&!a?{open:!1}:{},className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var q9=J("useLinkContextMenu"),Ia=J("ProviderInstanceIcon"),RI=J("UserAvatar"),ul=J("Badge"),te=J("Button"),V9=J("Label"),hf=J("Input"),NI=J("Textarea"),W9=J("Switch"),Jd=J("Separator"),G9=J("Skeleton"),vf=J("Spinner"),j9=J("ScrollArea"),Q9=J("Card"),X9=J("CardAction"),Y9=J("CardContent"),J9=J("CardDescription"),Z9=J("CardFooter"),eQ=J("CardHeader"),tQ=J("CardTitle"),nQ=J("Empty"),oQ=J("EmptyContent"),rQ=J("EmptyDescription"),aQ=J("EmptyHeader"),iQ=J("EmptyMedia"),sQ=J("EmptyTitle"),lQ=J("InputGroup"),dQ=J("InputGroupAddon"),cQ=J("InputGroupInput"),uQ=J("DocumentPanel"),fQ=J("MasterDetail"),xf=J("Select"),pQ=J("SelectContent"),yf=J("SelectItem"),Cf=J("SelectPopup"),_I=J("SelectTrigger"),bf=J("SelectValue"),Zd=J("Toggle"),DI=J("ToggleGroup"),OI=J("AlertDialog"),FI=J("AlertDialogClose"),BI=J("AlertDialogDescription"),zI=J("AlertDialogFooter"),$I=J("AlertDialogHeader"),HI=J("AlertDialogPopup"),UI=J("AlertDialogTitle"),If=J("Dialog"),mQ=J("DialogClose"),Sf=J("DialogDescription"),wf=J("DialogFooter"),Tf=J("DialogHeader"),Lf=J("DialogPopup"),KI=J("DialogPanel"),kf=J("DialogTitle"),gQ=J("DialogTrigger"),hQ=J("DropdownMenu"),vQ=J("DropdownMenuContent"),xQ=J("DropdownMenuItem"),yQ=J("DropdownMenuTrigger"),Jo=J("Menu"),ec=J("MenuGroup"),CQ=J("MenuGroupLabel"),Zo=J("MenuItem"),er=J("MenuPopup"),Sa=J("MenuRadioGroup"),Cr=J("MenuRadioItem"),ii=J("MenuSeparator"),tr=J("MenuTrigger"),fl=J("Popover"),pl=J("PopoverPopup"),ml=J("PopoverTrigger"),qI=J("Table"),VI=J("TableBody"),si=J("TableCell"),is=J("TableHead"),WI=J("TableHeader"),Pf=J("TableRow"),Qe=J("Tooltip"),Xe=J("TooltipPopup"),Ye=J("TooltipTrigger"),GI=J("Collapsible"),jI=J("CollapsiblePanel"),QI=J("CollapsibleTrigger"),tc=J("Alert"),nc=J("AlertAction"),Af=J("AlertDescription"),xh=J("AlertTitle"),Ef=J("Kbd"),Mf=J("Command"),Rf=J("CommandGroup"),Nf=J("CommandItem"),_f=J("CommandList"),XI=J("Combobox"),YI=J("ComboboxEmpty"),JI=J("ComboboxInput"),gl=J("ComboboxItem"),ZI=J("ComboboxListVirtualized"),eS=J("TooltipProvider"),tS=J("StyledDiffCodeView"),nS=J("DevBackdropArt"),nr=J("Markdown"),oS=J("DiffView");var{jsx:u,jsxs:b,Fragment:be}=window.__ycodiumPluginHost.jsxRuntime;function rS({mode:e,onModeChange:t}){let{t:n}=De();return b(DI,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":n("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:o=>{let r=o[0];(r==="chat"||r==="trajectory")&&t(r)},children:[b(Zd,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(Zi,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(Zd,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u($d,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function aS({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat"?"chat":"trajectory";return u("div",{className:"relative flex min-h-0 flex-1 flex-col","aria-hidden":t?void 0:!0,inert:t?void 0:!0,"data-chat-view-pane":r,"data-pane-visible":t?"true":"false",children:u(hh,{value:t,children:r==="chat"?n:o})})}me();function co(){return{t:Xo().i18n.usePluginTranslation()}}function iS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function sS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function oc(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var bF=ue(function({item:t,ordinal:n,usage:o,onSelect:r}){return b("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[u("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),b("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?b("span",{className:"flex items-baseline gap-2",children:[u("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?u("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:oc(o.outputTokens)}):null]}):null]})]})});function IF({totals:e}){let{t}=co();if(!e)return null;let n=iS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:oc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:oc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?oc(e.cachedInputTokens):`${oc(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var SF=ue(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=co(),i=Xo().writeClipboard,[s,l]=G(!1),d=a("turnNavigator.copyMarkdown");return b(Qe,{children:[u(Ye,{render:u(te,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:s?u(Io,{className:"size-3 text-primary"}):u(Gi,{className:"size-3"})}),u(Xe,{children:u("p",{children:d})})]})});function lS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=co(),[d,c]=G(!1),f=z(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=z(()=>sS(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return b(fl,{onOpenChange:c,open:d,children:[b(ml,{render:u(te,{"aria-label":h,className:F("gap-1.5 rounded-full px-3",s==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:s==="float"?{bottom:n+12}:void 0,title:h,variant:"glass"}),children:[u(Hd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(pl,{align:"end",className:"w-80 flex-col",side:"top",children:b("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[b("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),u("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),u("div",{className:F("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>u(bF,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(IF,{totals:p}),b("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),u(SF,{size:"icon-xs",getText:a,variant:"ghost"}),u(te,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>i("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(te,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>i("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}me();function dS(e,t,n,o={}){if(t!==null)for(let r=0;r<e.length;r+=1){let a=e[r];if(a===void 0)continue;let i=n(a);if(i!==null)return i===t?{anchorIndex:r,anchorOffset:o.anchorOffset??16}:void 0}}me();function ss(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function wF(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function TF(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function LF(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var yh=TF(LF()),cS=new Map;function uS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=cS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(yh,wF(e,t));return cS.set(n,r),r}function Ch(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var kF=new Intl.DateTimeFormat(void 0,{month:"long"});function PF(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function AF(e,t){let n=Ch(e);return n?uS(t,!1).format(n):""}function Jr(e,t){let n=Ch(e);if(!n)return"";let o=AF(e,t),r=n.getDate(),a=kF.format(n),i=n.getFullYear();return`${o}, ${r}${PF(r)} ${a} ${i}`}var EF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric"}),MF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric",year:"numeric"});function li(e,t,n=Date.now()){let o=Ch(e);if(!o)return"";let r=uS(t,!1).format(o),a=new Date(n),i=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),l=Math.round((i-s)/864e5);return l<=0?r:l===1?`yesterday at ${r}`:`${(o.getFullYear()===a.getFullYear()?EF:MF).format(o)} ${r}`}me();me();async function RF(e,t){if(typeof window>"u"||typeof navigator>"u"||!navigator.clipboard?.writeText)throw new Error(`Clipboard API is unavailable while copying ${t}.`);if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(n){throw new Error(`Failed to copy ${t} to the clipboard.`,{cause:n})}}function Df({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=G(!1),i=_(null),s=_(n),l=_(o),d=_(t),c=_(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=B((p,m)=>{RF(p,d.current).then(h=>{h&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},h=>{l.current?.(h instanceof Error?h:new Error(String(h)),m)})},[]);return q(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function Dt(){let e=Xo().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var fS=1e3;function NF({title:e,description:t}){return b("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-balance text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?u("span",{className:"block text-muted-foreground",children:t}):null]})}var hl=ue(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=Dt(),s=_(null),[l,d]=G(null),c=_(null),f=(h,g)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(g===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:h,description:g}),c.current=setTimeout(()=>d(null),fS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Df({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:fS});return b(Qe,{children:[u(Ye,{render:u(te,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:m?u(Io,{className:"size-3 text-primary"}):u(Gi,{className:"size-3"})}),u(Xe,{children:u("p",{children:i("copyButton.copyToClipboard")})}),l?u("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:l.top,left:l.left},children:u("span",{className:"relative block -translate-x-1/2",children:u(NF,{title:l.title,description:l.description})})}):null]})});function _F(e){return e<1e3?Math.round(e).toLocaleString():e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Of({label:e,children:t}){let[n,o]=G(!1);return b(Qe,{open:n,onOpenChange:o,children:[u(Ye,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Xe,{children:e})]})}var pS=ue(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=Dt(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return b("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[b("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?b(Of,{label:i,children:[a==="completed"?u(Io,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(jt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Qd,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(Of,{label:Jr(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:li(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?b(Of,{label:r("timeline.workingTime",{duration:ss(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),ss(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(Of,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),_F(t.outputTokens)]}):null]}),o?u(hl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});me();me();function mS(e){if(e<1e3)return String(e);if(e<1e6){let n=e/1e3;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}k`}if(e<1e9){let n=e/1e6;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var gS=ue(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=Dt(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(be,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:F(i==="inline"?"inline-flex items-center gap-1 tabular-nums align-middle":"inline-grid grid-cols-[4ch_4ch] gap-2 text-right tabular-nums align-middle",r),children:[b("span",{"aria-hidden":"true",className:"font-mono text-success",children:["+",mS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",mS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function hS(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function DF(e){let t=e,n,o,r=t.match(/:(\d+)$/);if(!r?.[1])return{path:t,line:void 0,column:void 0};n=r[1],t=t.slice(0,-r[0].length);let a=t.match(/:(\d+)$/);return a?.[1]?(o=a[1],t=t.slice(0,-a[0].length)):(o=n,n=void 0),{path:t,line:o,column:n}}function vS(e){return e.replaceAll("\\","/")}function xS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function OF(e){return e.replace(/[\\/]+$/,"")}function FF(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function BF(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function zF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Ff(e,t){let{path:n,line:o,column:r}=DF(e),a=xS(vS(n)),i=a;if(t){let s=xS(vS(OF(t))),l=FF(s),d=a.toLowerCase(),c=s.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)i=l;else if(d.startsWith(f)){let m=a.slice(s.length+1);i=`${l}/${m}`}else if(!zF(a)){let m=BF(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function yS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function CS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Bf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function rc({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function ac({status:e}){return u("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:u("span",{className:F("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function zf({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:F("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?u("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}me();var vl=new Map,bS=24,$F=4e3;function bh(e){let t=vl.get(e);if(t)return t;let n={values:new Map,listeners:new Set};if(vl.set(e,n),vl.size>bS){for(let[o,r]of vl)if(r.listeners.size===0&&o!==e&&(vl.delete(o),vl.size<=bS))break}return n}function Ih(e,t,n){return bh(e).values.get(t)??n}function ic(e,t,n,o=!0){let r=bh(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>$F){let a=r.values.keys().next().value;a!==void 0&&r.values.delete(a)}o&&r.listeners.forEach(a=>a())}}function xl(e,t,n){let o=B(s=>{let l=bh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=B(()=>Ih(e,t,n),[e,t,n]),a=xa(o,r,r),i=B(s=>ic(e,t,s),[e,t]);return[a,i]}function $f({name:e,className:t}){switch(e){case"bot":return u(Vi,{className:t,"aria-hidden":!0});case"check":return u(Io,{className:t,"aria-hidden":!0});case"circle-alert":return u(So,{className:t,"aria-hidden":!0});case"eye":return u(Nd,{className:t,"aria-hidden":!0});case"globe":return u(Fd,{className:t,"aria-hidden":!0});case"hammer":return u(zd,{className:t,"aria-hidden":!0});case"message-circle":return u(Ji,{className:t,"aria-hidden":!0});case"search":return u(os,{className:t,"aria-hidden":!0});case"square-pen":return u(No,{className:t,"aria-hidden":!0});case"terminal":return u(ba,{className:t,"aria-hidden":!0});case"wrench":return u(Yd,{className:t,"aria-hidden":!0});case"x":return u(jt,{className:t,"aria-hidden":!0});case"zap":return u(as,{className:t,"aria-hidden":!0})}}function HF(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function Sh(e,t){let n=new Map;for(let o of e){let r=t(o);n.set(r,(n.get(r)??0)+1)}return Array.from(n,([o,r])=>({action:o,icon:HF(o),count:r}))}function wh(e,t){let n;for(let o of Sh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var yl=20;function Cl(e){return hS(e)}function IS(e,t,n){let o=e.toolLabel,r=n.resolveToolCommand(e);if(r&&o?.descriptive&&!o.path&&o.detail?.trim())return o.detail.replace(/\s+/g," ").trim();for(let p of[e.rawCommand,e.command]){let m=n.parseToolCommandInput(p)?.description;if(m)return m.replace(/\s+/g," ").trim()}if(r)return r.replace(/\s+/g," ").trim();let a=typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null,i=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,s=o?.name??i??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?Ff(l,t):void 0,c=[s.trim().toLowerCase()==="tool"?void 0:s,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(h=>h.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function SS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Th(e)?null:u(gS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Th(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function UF({entry:e,failed:t=!1,derive:n}){return t?u(So,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u($f,{name:wh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function KF({entries:e,failed:t,derive:n}){let{t:o}=Dt(),r=z(()=>Sh(e,n.toolGroupAction),[e,n]),a=r.length===1;return a&&r[0].count<2?null:u("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":o("toolGroup.calls",{count:e.length}),children:r.map(({action:i,icon:s,count:l})=>b("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u($f,{name:s,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function wS({entry:e}){let t=Ut(Tn),n=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,o=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:o,onOpenFileDiff:t.onOpenFileDiff});return u("div",{className:"min-w-0 space-y-2 p-3",children:r!==void 0?u(be,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var qF=ue(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=Ut(Tn).derive,{t:l}=Dt(),[d,c]=xl(o,`call:${Cl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Th(n),m=s.resolveWorkEntryStatus(n),h=m==="failed"||m==="running"?m:null,g=Wr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Cl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":g,onClick:()=>{a?.(),c(!d)},className:F("chat-tool-member-row chat-tool-summary flex w-full min-w-0 items-center gap-1.5 px-3 text-left hover:bg-accent/20",f?"text-destructive":"text-muted-foreground"),children:[u(ac,{status:h}),u(rc,{children:u(UF,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:IS(n,r,s)??l("toolGroup.calls",{count:1})}),u(SS,{entry:n,failed:f})]}),f||p?u("span",{className:"chat-process-meta shrink-0",children:f?l("toolGroup.failed",{count:1}):l("toolGroup.cancelled",{count:1})}):null,u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:g,children:u(wS,{entry:n})}):null]})});function VF({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=_(null);return ye(()=>{let a=r.current;if(!a)return;a.scrollTop=Ih(e,`${t}:scroll`,0);let i=()=>{ic(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[e,t]),u("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:n},children:o})}var TS=ue(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=Ut(Tn).derive,{t:l}=Dt(),[d,c]=xl(o,`group:${n}`,!1),[f,p]=xl(o,`group-page:${n}`,0),m=Wr(),h=_(null),[g,v]=G(null),x=t.at(-1),y=z(()=>t.filter(O=>s.workEntryIndicatesFailure(O)),[t,s]),C=z(()=>t.filter(Th),[t]),w=t.filter(O=>O.toolLifecycleStatus==="inProgress").length,k=y[0]??C[0],S=k??x,L=Math.max(0,Math.ceil(t.length/yl)-1),I=Math.min(f,L),T=I*yl,E=t.slice(T,T+yl),A=t.length>1;if(ye(()=>{if(!g)return;let O=h.current,oe=Array.from(O?.querySelectorAll("[data-tool-identity]")??[]).find(W=>W.dataset.toolIdentity===g.id);if(!oe)return;let ee=oe.closest('[data-slot="scroll-area-viewport"]');ee&&(ee.scrollTop+=oe.getBoundingClientRect().top-ee.getBoundingClientRect().top),oe.querySelector("button")?.focus({preventScroll:!0})},[g]),!x||!S)return null;let N=O=>{a?.(),p(O)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},$=CS(t.map(O=>yS(s.resolveWorkEntryStatus(O)))),H=wh(t,s.toolGroupAction),K=$==="failed"?"failed":$==="running"?"running":"success";return u(zf,{state:$,variant:"tool",children:b("section",{ref:h,"data-tool-group-id":n,className:"min-w-0",children:[b("div",{className:"flex min-w-0 items-center",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!A&&!d&&ic(o,`call:${Cl(x)}`,!0)},className:F(Bf,"flex-1",k?"text-destructive":"text-muted-foreground"),children:[u(ac,{status:K}),u(rc,{children:u($f,{name:H,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",y.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:F("flex min-w-0 flex-1 items-center",d&&A?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&A?l("toolGroup.calls",{count:t.length}):IS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&A?null:u(SS,{entry:S,failed:s.workEntryIndicatesFailure(S)})]}),w>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:w})}):null,y.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:y.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&A?null:u(KF,{entries:t,failed:y.length>0,derive:s}),u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),k&&A?u("button",{type:"button",className:"chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 text-destructive underline [@media(pointer:coarse)]:min-h-11",onClick:()=>{a?.(),c(!0),p(Math.floor(t.indexOf(k)/yl)),ic(o,`call:${Cl(k)}`,!0),v({id:Cl(k)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:A?b(be,{children:[t.length>yl?b("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[u("span",{className:"min-w-0 flex-1 tabular-nums",children:l("toolGroup.pageRange",{from:T+1,to:Math.min(T+yl,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:I===0,Icon:Md},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Wi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===L,Icon:Uo},{label:l("toolGroup.lastPage"),target:L,disabled:I===L,Icon:Rd}].map(({label:O,target:oe,disabled:ee,Icon:W})=>u("button",{type:"button","aria-label":O,disabled:ee,onClick:()=>N(oe),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(W,{"aria-hidden":!0,className:"size-icon-1"})},O))]}):null,u(VF,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:E.map(O=>u(qF,{entry:O,...R},Cl(O)))})})]}):u(wS,{entry:x})}):null]})})});function WF(e,t,n){let o=n-t;if(Math.abs(o)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+o));return Math.abs(r-e.scrollTop)<1?null:r}function LS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,i=!0,s=null,l=()=>{if(s=null,!i||!n.isConnected||!t.contains(n))return;let f=WF(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{i&&s===null&&(s=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{i=!1,c?.disconnect(),s!==null&&cancelAnimationFrame(s),s=null}}}me();function Lh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function kS(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),s=e[a].getBoundingClientRect();Math.max(s.bottom,s.top+1)>t?(r=a,o=a):n=a+1}return r}function GF(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=kS(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.max(0,Math.round(t-l.getBoundingClientRect().top))}};if(n.length===0)return o(e);let r=kS(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let i=o(n[a]);if(i)return i}return null}function PS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var kh=class extends Ui{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function AS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i}){let s=_(null);Gr(n,()=>({get node(){return s.current},measure:()=>{let d=s.current;return d?{scroll:d.scrollTop,scrollLength:d.clientHeight,contentLength:d.scrollHeight,topOf:c=>{let f=Lh(d,c);return f===null?null:PS(f,d)},heightOf:c=>{let f=Lh(d,c);return f===null?null:f.offsetHeight},rowAtScroll:()=>GF(d)}:null},scrollToEnd:d=>{let c=s.current;if(c){if(d?.animated){c.scrollTo({top:c.scrollHeight,behavior:"smooth"});return}c.scrollTop=c.scrollHeight-c.clientHeight}},scrollToRow:(d,c)=>{let f=s.current;if(!f)return!1;let p=Lh(f,d);return p?(f.scrollTop=Math.max(0,PS(p,f)-(c?.viewOffset??0)),!0):!1},scrollToOffset:d=>{let c=s.current;c&&(c.scrollTop=Math.max(0,d))}}),[]);let l=B(d=>{s.current=d,o(d)},[o]);return u(kh,{inputKey:e,onBeforeInputChange:t,children:u("div",{ref:l,className:r,style:{position:"relative"},onScroll:i,children:a})})}me();var ES=ue(function({sectionKey:t,rowKeyPrefix:n,rows:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(i=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(i)},`${n}:${i.id}`))})});function jF(e){for(let t of e)switch(t.kind){case"turn-identity":return t.turnId;case"working":return t.turnId??null;case"message":if(t.message.role==="assistant")return t.message.turnId;break;case"tool-group":if(t.entries[0]?.turnId!==void 0)return t.entries[0].turnId??null;break;case"work":if(t.groupedEntries[0]?.turnId!==void 0)return t.groupedEntries[0].turnId??null;break;case"turn-plan":return t.turnPlan.turnId;case"proposed-plan":return t.proposedPlan.turnId;case"turn-summary":return t.footer.turnId}return null}function MS(e,t){let n=[];for(let o of t){if(o.end<=o.start)continue;let r=e.slice(o.start,o.end);n.push({key:o.key,turnId:jF(r),firstRowIndex:o.start,rows:r})}return n}function RS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function sc(e,t,n){let o=e.findIndex(r=>r.rows.some(a=>a.id===t));return o<0?n:Math.max(n,e.length-o)}me();me();var _S=100,QF=new Map,NS=new Map,Ah=e=>typeof e=="function"?e():e,XF=(e,t)=>typeof t=="function"?t(e):t;function YF(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function JF(e,t){let n=NS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},NS.set(e,n)),n}function ZF(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Ph(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function DS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:Ah(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function lc(e){queueMicrotask(()=>ZF(e))}function Ln(e,t,n,o=_S){let r=Math.max(1,o),a=YF(QF,e,r),i=DS(a,t,n),s=B(f=>i.alive?(a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,i.subscribers.add(f),lc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),lc(a)}):()=>{},[r,i,a,t]),l=B(()=>i.value,[i]),d=xa(s,l,l),c=B(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=XF(p,f);if(!Object.is(m,p)){i.value=m,Ph(a,t,i);for(let h of i.subscribers)h();lc(a)}},[i,a,t]);return[d,c]}function En(e,t,n,o=_S){let r=Math.max(1,o),a=JF(e,r),i=DS(a,t,()=>({current:Ah(n)}));return q(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,lc(a),()=>{i.leases=Math.max(0,i.leases-1),lc(a)}},[r,i,a,t]),i.value}function dc(e,t){let n=_(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:Ah(t)}}),n.current.ref}var ls=3,e2=ls;function OS(e){let[t,n]=Ln("timeline-reveal-window",e,ls),o=B(()=>{n(s=>s+e2)},[n]),r=B(s=>{n(l=>s>l?s:l)},[n]),a=B(()=>{n(ls)},[n]),i=B(s=>{n(l=>Math.min(l,Math.max(ls,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function FS({root:e,minimumCount:t,canCompact:n,onCompact:o}){let r=e.ownerDocument,a=new Set,i,s=!1,l=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,d=()=>{if(i=void 0,r.hidden||a.size>0||!n()||e.clientHeight<=0||!l())return;let x=r.getSelection();if(x&&!x.isCollapsed){for(let L=0;L<x.rangeCount;L+=1)if(x.getRangeAt(L).intersectsNode(e))return}let y=e.querySelectorAll("[data-timeline-turn-section]"),C=e.getBoundingClientRect().top-32,w=0,k=Math.max(0,y.length-t);for(;w<k;){let L=Math.floor((w+k)/2),I=y[L].getBoundingClientRect().bottom;if(!Number.isFinite(I))return;I<=C?w=L+1:k=L}if(w===0)return;let S=r.activeElement;if(S){for(let L=0;L<w;L+=1)if(y[L].contains(S))return}o(y.length-w)},c=()=>{i===void 0&&(i=setTimeout(d,400))},f=()=>{clearTimeout(i),i=setTimeout(d,400)},p=()=>{let x=l();!x||!s?f():c(),s=x},m=x=>{a.add(x.pointerId),f()},h=x=>{a.delete(x.pointerId),f()},g=()=>{a.clear(),f()},v=["wheel","keydown","focusin","focusout"];for(let x of v)e.addEventListener(x,f,{passive:!0});return e.addEventListener("scroll",p,{passive:!0}),e.addEventListener("pointerdown",m,!0),r.addEventListener("pointerup",h,!0),r.addEventListener("pointercancel",h,!0),r.addEventListener("selectionchange",f),r.addEventListener("visibilitychange",c),r.defaultView?.addEventListener("blur",g),c(),{schedule:c,disconnect:()=>{clearTimeout(i);for(let x of v)e.removeEventListener(x,f);e.removeEventListener("scroll",p),e.removeEventListener("pointerdown",m,!0),r.removeEventListener("pointerup",h,!0),r.removeEventListener("pointercancel",h,!0),r.removeEventListener("selectionchange",f),r.removeEventListener("visibilitychange",c),r.defaultView?.removeEventListener("blur",g)}}}me();me();function BS(e){let t=_(e);t.current=e;let n=_(!1),o=_(null),r=_(null),a=_(0),i=B(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=B(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let c=++a.current;r.current=requestAnimationFrame(f=>{if(c!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=B(c=>{o.current=c,s()},[s]),d=B(()=>{o.current=null,i()},[i]);return ye(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),z(()=>({request:l,cancel:d}),[l,d])}function zS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=_(o);r.current=o;let a=BS(o),i=_(new Map),s=_(null),l=_(null),d=_(n);d.current=n;let c=B(()=>{if(!r.current||!e)return;let g=e.scrollTop+t,v=null,x=Number.NEGATIVE_INFINITY,y=null,C=Number.POSITIVE_INFINITY;for(let[k,S]of i.current){if(!S.isConnected)continue;let L=S.offsetTop;L<C&&(C=L,y=k),L<=g&&L>=x&&(x=L,v=k)}let w=v??y;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=B(()=>{r.current&&a.request(c)},[a,c]);q(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let g=!0,v=new IntersectionObserver(()=>{!g||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let x of i.current.values())v.observe(x);return f(),()=>{g=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=_(new Map),m=B(g=>{let v=p.current.get(g);if(v)return v;let x=y=>{let C=i.current.get(g);C&&C!==y&&(s.current?.unobserve(C),i.current.delete(g)),y?(i.current.set(g,y),s.current?.observe(y)):p.current.delete(g)};return p.current.set(g,x),x},[]),h=B(()=>{r.current&&(l.current=null,f())},[f]);return z(()=>({observeSection:m,refresh:h}),[m,h])}function cc(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=s=>{let l=e.indexOf(s);return l<0?null:[e.slice(0,l),e.slice(l+s.length)]},i=a(o)??a(r);return i===null?b(be,{children:[e,t]}):b(be,{children:[i[0],t,i[1]]})}me();function $S(){let e=Xo(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,i)=>e.notify(r,a,i);return{error:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"error",s)},warning:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"warning",s)},success:(r,a,i)=>{let s=a??i?.description;o(n(r,s),"success",s)}}}function Hf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function Eh(e){let t=e.trimEnd().split(/\r?\n/),n=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;n[0]?.trim().length===0;)n.shift();if(n[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(n.shift();n[0]?.trim().length===0;)n.shift();return n.join(`
|
|
3669
|
+
`)}function HS(e,t){let n=t?.maxLines??8,o=Eh(e).trimEnd().split(/\r?\n/).map(s=>s.trimEnd()),r=[],a=0,i=!1;for(let s of o){let l=s.trim().length>0;if(l&&a>=n){i=!0;break}r.push(s),l&&(a+=1)}for(;r.length>0&&r.at(-1)?.trim().length===0;)r.pop();return r.length===0?Hf(e)??"Plan preview unavailable.":(i&&r.push("","..."),r.join(`
|
|
3670
|
+
`))}function t2(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function US(e){let t=Hf(e);return`${t2(t??"plan")}.md`}function KS(e){return`${e.trimEnd()}
|
|
3671
|
+
`}function qS(e,t){let n=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(o)},0)}var VS=ue(function({planMarkdown:t,environmentId:n,threadRef:o,cwd:r,workspaceRoot:a,onSavePlanToWorkspace:i}){let{t:s}=Dt(),l=$S(),[d,c]=G(!1),[f,p]=G(!1),[m,h]=G(""),[g,v]=G(!1),{copyToClipboard:x,isCopied:y}=Df({target:"plan",onError:H=>{l.error(s("proposedPlan.couldNotCopy"),H,{description:s("proposedPlan.copyErrorDescription")})}}),C=Wr(),w=Hf(t)??s("proposedPlan.defaultTitle"),k=t.split(`
|
|
3672
|
+
`).length,S=t.length>900||k>20,L=Eh(t),I=S?HS(t,{maxLines:10}):null,T=US(t),E=KS(t),A=()=>{qS(T,E)},N=()=>{x(E)},R=()=>{if(!a){l.error(s("proposedPlan.workspacePathUnavailable"),s("proposedPlan.workspacePathUnavailableDescription"));return}h(H=>H.length>0?H:T),p(!0)},$=()=>{let H=m.trim();if(!(!a||i===null)){if(!H){l.warning(s("proposedPlan.enterWorkspacePath"));return}v(!0),(async()=>{let K=await i({environmentId:n,workspaceRoot:a,relativePath:H,contents:E});if(v(!1),K.ok){p(!1),l.success(s("proposedPlan.savedToWorkspace"),K.relativePath);return}l.error(s("proposedPlan.couldNotSave"),void 0,{description:s("proposedPlan.saveErrorDescription")})})()}};return b("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[b("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b("div",{className:"flex min-w-0 items-center gap-2",children:[u(ul,{variant:"secondary",children:s("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:w})]}),b(Jo,{children:[u(tr,{render:u(te,{"aria-label":s("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(Yo,{"aria-hidden":"true",className:"size-4"})}),b(er,{align:"end",children:[u(Zo,{onClick:N,children:s(y?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(Zo,{onClick:A,children:s("proposedPlan.downloadAsMarkdown")}),i!==null?u(Zo,{onClick:R,disabled:!a||g,children:s("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:F("relative",S&&!d&&"max-h-104 overflow-hidden"),children:[S&&!d?u(nr,{text:I??"",cwd:r,threadRef:o,isStreaming:!1}):u(nr,{text:L,cwd:r,threadRef:o,isStreaming:!1}),S&&!d?u("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-card/95 via-card/80 to-transparent"}):null]}),S?u("div",{className:"mt-4 flex justify-center",children:u(te,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>c(H=>!H),children:s(d?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(If,{open:f,onOpenChange:H=>{g||p(H)},children:b(Lf,{className:"max-w-xl",children:[b(Tf,{children:[u(kf,{children:s("proposedPlan.saveToWorkspace")}),u(Sf,{children:cc(s("proposedPlan.pathHint"),u("code",{children:a??s("proposedPlan.theWorkspace")}),"path")})]}),u(KI,{className:"space-y-3",children:b("label",{htmlFor:C,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:s("proposedPlan.workspacePath")}),u(hf,{id:C,value:m,onChange:H=>h(H.target.value),placeholder:T,spellCheck:!1,disabled:g})]})}),b(wf,{children:[u(te,{variant:"outline",size:"sm",onClick:()=>p(!1),disabled:g,children:s("proposedPlan.cancel")}),u(te,{size:"sm",onClick:()=>{$()},disabled:g,children:s(g?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function WS({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function GS({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}me();var Uf=class extends Ui{state={failed:!1,error:null};static getDerivedStateFromError(t){return{failed:!0,error:t instanceof Error?t:new Error(String(t))}}componentDidUpdate(t){this.state.failed&&t.resetKey!==this.props.resetKey&&this.setState({failed:!1,error:null})}render(){if(!this.state.failed)return this.props.children;let{fallback:t}=this.props;return typeof t=="function"?t(this.state.error):t}};function n2({error:e,className:t}){let{t:n}=Dt();return b(Qe,{children:[b(Ye,{render:u("div",{className:F("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(So,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Xe,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function jS(e){return u(n2,{error:e})}me();function Mh(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function di(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||o2.has(t)?"text":"file"}var o2=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function QS(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var r2="<ycodium-system>";function Rh(e){return e.startsWith(r2)}var a2=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function XS(e){let t=e.match(a2);return t&&t.length>0?t:[e]}function YS(e){let t=e.match(/<plugin-instruction>\n([\s\S]*?)\n<\/plugin-instruction>/)?.[1];if(t===void 0)return null;try{let n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return null;let o=n;return typeof o.pluginId!="string"||typeof o.title!="string"||typeof o.body!="string"?null:{pluginId:o.pluginId,title:o.title,body:o.body}}catch{return null}}function JS(e){switch(e){case"image":return Xi;case"pdf":return Qi;case"text":return ji;case"file":return Ro}}var i2=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function uc(e){let t=i2.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=s2(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function s2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
3670
3673
|
`).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
|
|
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
|
|
3673
|
-
`)}function
|
|
3674
|
-
`)}var
|
|
3674
|
+
`)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var l2=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function Nh(e){let t=l2.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
|
|
3675
|
+
`),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),i=o.find(p=>p.startsWith("Comment: ")),s=o.find(p=>p.startsWith("Targets: ")),l=o.indexOf("Requested visual changes:"),d=o.slice(l+1),c=d.indexOf("<element_context>"),f=l<0?[]:d.slice(0,c<0?void 0:c).filter(p=>p.startsWith("- ")).map(p=>p.slice(2));return{promptText:e.slice(0,t.index).replace(/\n+$/,""),annotation:{id:a?.slice(4).trim()||`${t.index}`,title:r?.slice(6).trim()||"Preview annotation",comment:i?.slice(9).trim()||"",targetSummary:s?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var d2=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,c2=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,u2=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function f2(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function p2(e){let t={};for(let n of e.matchAll(c2))t[n[1]]=f2(n[2]??"");return t}function ZS(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function m2(e){let n=Array.from(e.matchAll(u2)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function g2(e,t,n){let o=p2(e),r=ZS(o.startIndex),a=ZS(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=m2(t);return{id:`review-comment:${n}:${s}:${i}:${r}:${a}`,sectionId:s,sectionTitle:o.sectionTitle?.trim()||"Review",filePath:i,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||"line",text:l.text,diff:l.contents,fenceLanguage:l.language}}function _h(e){let t=[],n=0,o=0;for(let a of e.matchAll(d2)){let i=a.index??0,s=e.slice(n,i);s.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:s});let l=g2(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${i}`,text:a[0]}),n=i+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function e0(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
|
|
3676
|
+
`)}function t0(e){if((e.fenceLanguage??"diff")!=="diff")return"";let t=e.diff.trim();if(t.length===0)return"";if(t.startsWith("diff --git "))return t;let n=e.filePath.replaceAll("\\","/");return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
|
|
3677
|
+
`)}var h2="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",v2=`${h2} border border-border/70 bg-accent/40 text-foreground`,Kf=`${v2} text-[12px]`,qf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Vf="truncate leading-tight",n0='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>';var x2=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function y2(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function C2(e){let t=e.displayName?.trim();return t||y2(e.name)}function o0(e){let t=[],n=0;for(let o of e.text.matchAll(x2)){let r=o[1]??"",a=o[2]??"",i=(o.index??0)+r.length,s=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(i>n&&t.push(e.text.slice(n,i)),t.push(u(b2,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(be,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(be,{children:t}))}function b2(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:F(Kf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:qf,dangerouslySetInnerHTML:{__html:n0}}),u("span",{className:Vf,children:C2(e.skill)})]})})}function r0(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Qe,{children:[b(Ye,{render:u("span",{className:F(Kf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(ba,{className:F(qf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Vf,children:t})]}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var I2=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function S2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
3675
3678
|
`).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
|
|
3679
|
+
`)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}if(n){if(r.startsWith(" ")){n.bodyLines.push(r.slice(2));continue}r.length===0&&n.bodyLines.push("")}}return o(),t}function w2(e){let t=I2.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=S2(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
|
|
3677
3680
|
${a}`:r).join(`
|
|
3678
3681
|
|
|
3679
|
-
`):null,contexts:o}}function o0(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 Nh(e){let t=pc(e),n=p2(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var m2=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function r0(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(qf(o))}return t.join(" ")}function qf(e){let t=e.trim(),n=m2.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,"-")}`:o0({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function a0(e,t){let n=0;for(let o of t){let r=qf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function _h({row:e}){let t=Kt(Tn).derive;if(Ah(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(xe,{children:[u(v2,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(_h,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(y2,{row:e})}return u(g2,{row:e,text:e.message.text})}function Dh({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=Eh(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 g2({row:e,text:t}){let{t:n}=Nt(),o=Kt(Tn),r=e.message.attachments??[],a=Nh(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Mh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=pc(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(h2,{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(C2,{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(Dh,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(Fh,{attachment:v},v.id))}),s.map((v,x)=>u(S2,{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(I2,{context:v},`${v.header}:${v.body}`))}):null,u(P2,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function h2({author:e}){let t=e;return t!==null?u(AI,{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 Vf({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 v2({parsed:e}){let{t}=Nt();return b(Vf,{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 x2={"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 y2({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=QS(l);if(d)return b(Vf,{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(Vf,{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(Vf,{children:[u("p",{className:"font-medium text-foreground/80",children:t(x2[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=jS(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(Dh,{images:r}),a.map(l=>u(Fh,{attachment:l},l.id))]}):null]})}function l0(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Ah(e??""))return null;let r=Nh(n??e??"").visibleText;for(;;){let s=Mh(r);if(!s.annotation)break;r=s.promptText}let a=pc(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 d0=34,c0=8,Oh=d0+c0,u0=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:c0},"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:d0}},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 C2({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 f0({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(Ff,{state:"idle",children:b("button",{type:"button",className:F(Of,"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(sc,{status:null}),u(ic,{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(Bh,{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(Dh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(Fh,{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(b2,{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 b2({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 i0=ce(function(t){let n=t.context.body.length>0?`${t.context.header}
|
|
3680
|
-
${t.context.body}`:t.context.header;return u(
|
|
3681
|
-
${t.context.body}`:t.context.header;return b(
|
|
3682
|
-
`).length>w2}var P2=ce(function(t){let[n,o]=G(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&k2(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:s0,maskImage:s0}:void 0,children:u(E2,{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]})}),E2=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=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(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(A2,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=a0(t.text,t.terminalContexts),i=r0(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=qf(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(i0,{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(i0,{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 A2({comment:e}){let t=Kt(Tn),n=e.fenceLanguage??"diff",o=ZS(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:Df(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(t0,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(or,{text:JS(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(tS,{patch:o}):null]})}function M2({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 Bh({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(M2,{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 p0({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),g0=Ut(null),R2=u("div",{className:"h-3 sm:h-4"}),N2=u("div",{className:"h-10 sm:h-12"}),_2=Object.freeze([]);function D2({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 O2({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 F2=u("div",{className:"h-3 sm:h-4"}),B2=[],z2=new Set,$2=200,H2=1e4,U2=600,K2=()=>{};function rr(e,t){let n=_(e);return t&&(n.current=e),n.current}var q2=[],h0=ce(function({derive:t,activities:n=q2,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=_2,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=K2,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=B2,anchorMessageId:U,onAnchorReady:O,onRowsChange:ne,contentInsetEndAdjustment:ee,liveFollowEnabled:W,awaitingUserDecision:De=!1,onIsAtEndChange:be,onManualNavigation:ue,onDisclosureNavigation:Be=ue,hideEmptyPlaceholder:ge=!1,topFadeEnabled:le=!1,scrollerRef:we,loadEarlier:ye=null,revealMessageRequest:te=null,onRevealMessageHandled:Te,usageByTurnId:dt,renderWorkGroup:ct,renderToolCallDetail:lt,loadScrollAnchor:at,saveScrollAnchor:Vt,disclosure:it,useVisibleThreadCompletion:Me,export:Oe,onSavePlanToWorkspace:Ue,paneActive:et,onTurnNavigatorChange:Ee}){let Ce=si(),ht=_(Ce);ht.current=Ce;let Wt=it.usePersistedExpandedTurnIds(o),[fn,Ft]=Ln("timeline-auto-expanded-turns",o,z2),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=uc(o,null),ln=uc(o,null),Dn=uc(o,null),io=Rn("timeline-content-inset",o,ee),Gt=_(null),D=$(K=>{if(K!==null&&(Gt.current=K),typeof we=="function"){we(K);return}we.current=K},[we]);he(()=>{qS({timeline:Gt.current,previousOverlayHeight:io.current,overlayHeight:ee,followingEnd:Ce&&W&&!tn&&U===null}),io.current=ee},[U,ee,tn,W,Ce]),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=wS({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,Ce),xt=rr(y,Ce),jt=rr(C,Ce),nn=rr(k,Ce),bt=rr(en,Ce),me=rr(i,Ce),ut=rr(h,Ce),ft=rr(S,Ce),Qt=rr(L,Ce),Qe=rr(s,Ce),wt=rr(l,Ce),bn=rr(d,Ce),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=rB(Tt.rows,t),Lt=H(()=>ES(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:VS({measurement:K,followingEnd:fe})})},[pn,o,eo]),Z=$(()=>{let K=eo.current;K&&Vt(K.threadKey,K.anchor)},[Vt,eo]),Ze=$(()=>{if(!Ce||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,Ce,Z,Pn]),yt=_S(o),We=_(yt);We.current=yt;let{startIndex:In,hasHiddenOlder:hn}=AS(Lt.length,yt.revealedCount),vn=H(()=>Lt.slice(In),[In,Lt]),Bt=_(Lt);Bt.current=Lt;let to=uc(o,null),on=$(()=>{if(!ht.current)return;let K=Gt.current?.node;K&&(to.current={scrollHeight:K.scrollHeight,scrollTop:K.scrollTop,until:Date.now()+H2})},[to]);he(()=>{if(!Ce)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},[Ce,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(!Ce||hr||K===null)return;let fe=null,Re=requestAnimationFrame(()=>{ht.current&&(ue(),We.current.revealAtLeast(dc(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,Ce,ja,hr]);let zt=Rn("timeline-restore-after-presentation",o,!1),vr=dn||zt.current;Pn.current=vr,he(()=>{if(Ce)return()=>{Un.current!==o?Z():Ze(),zt.current=!0}},[Ce,o]),he(()=>{if(!Ce||!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},be(!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(dc(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,be,ue,Ce,o,nt.length,Lt.length]);let $t=H(()=>Ce?V2(Lt,t):[],[t,Ce,Lt]),xr=H(()=>{if(!Ce)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}))},[Ce,$t,Lt]),Ht=$(K=>{X(),ue(),We.current.revealAtLeast(dc(Bt.current,K.anchorRowId,We.current.revealedCount));let fe=o;requestAnimationFrame(()=>{Un.current===fe&&Go.current(K.anchorRowId,24)})},[ue,X,o]),yr=H(()=>Ce?{items:xr,totalTurnCount:g,bottomInset:ee,usageByTurnId:dt,onSelect:Ht,exportMarkdown:Oe.markdown,onDownload:Oe.download}:null,[ee,Oe,Ht,Ce,g,xr,dt]);q(()=>{yr!==null&&Ee(yr)},[Ee,yr]),q(()=>{if(Ce)return()=>Ee(null)},[Ee,Ce]),q(()=>{if(te===null||!Ce)return;X(),ue();let K=t.resolveToolGroupRevealRowId(vo.current,te.rowId);We.current.revealAtLeast(dc(Bt.current,K,We.current.revealedCount));let fe=requestAnimationFrame(()=>{Un.current===o&&(Go.current(K,24),Te?.())});return()=>cancelAnimationFrame(fe)},[te,Ce,ue,X,Te,t,o]);let Sn=H(()=>$t.flatMap(K=>K.headerText===null?[]:[{sectionKey:K.sectionKey,text:K.headerText}]),[$t]),Ie=_(Sn);Ie.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(()=>sS(nt,U,K=>K.kind==="message"&&K.message.role==="user"?K.message.id:null),[U,nt]),Ao=Ce&&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||!Ce)return;let K=DS({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,Ce,xn]),q(()=>{Ja.current?.schedule()},[Ao,ye?.loading,yt.revealedCount,Lt.length]),q(()=>{if(!xn||!Ce||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()},[Ce,xn]),Me({viewport:qr,viewActive:et&&Ce,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(!Ce)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,Ce,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>U2){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&&be(fe),K.contentLength-K.scrollLength-K.scroll>2&&Xo(K.scroll);let Re=Date.now();Re-Kn.current>=$2&&(Kn.current=Re,Z())},[Xt,ee,t,Xo,be,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 Dg=$(K=>{if(K===null||K===Fn.current)return;Fn.current=K;let fe=Ie.current.find(Re=>Re.sectionKey===K);fe&&Bo.current&&(Bo.current.textContent=fe.text),fa.current&&Qo(!1),an()},[Fn,an,Qo]),ei=FS({root:xn,topInsetPx:Oh,onActiveSectionChange:Dg,active:Ce});q(()=>{if(!Ce){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,Ce]);let Hu=$(()=>{Qo(K=>!K)},[Qo]);he(()=>{if(!Ce)return;let K=Fn.current,fe=K===null?void 0:Ie.current.find(Re=>Re.sectionKey===K);fe&&Bo.current&&(Bo.current.textContent=fe.text),an()},[Ce,an,jo]);let Og=H(()=>{let K=hn?u(O2,{onReveal:xo,fade:le}):ye!==null?u(D2,{loading:ye.loading,onLoadEarlier:pa,fade:le}):le?N2:R2;return Cr?b(xe,{children:[u("div",{style:{height:Oh}}),K]}):K},[pa,hn,Cr,ye,xo,le]);q(()=>{if(!Ce)return;let K=requestAnimationFrame(ma);return()=>cancelAnimationFrame(K)},[ma,Ce,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(G2,{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(g0,{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(kS,{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:[Og,vn.map(K=>u(PS,{sectionKey:K.key,rowKeyPrefix:o,rows:K.rows,renderRow:lo,sectionRef:ei.observeSection(K.key)},`${o}:${K.key}`)),F2,so?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:zo}}):null]})}),Qa!==null?u(u0,{ref:Xa,textRef:Bo,initialText:Qa,expanded:jo,onToggleExpanded:Hu}):null]})})})});function V2(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:m0(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:m0(a),headerText:r===null?null:l0(r.text,t)}})}var zh=240,W2=/\s/u;function m0(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>zh-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(W2.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>zh)||(t.push(a),n+=a.length,n>zh))return r()}return t.length>0?t.join(""):null}var G2=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($f,{resetKey:t.id,fallback:WS,children:[t.kind==="turn-summary"?u(uS,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(SS,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(j2,{row:t}):null,t.kind==="model-switch"?u(p0,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u(Bh,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(_h,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(f0,{row:t}):null,t.kind==="proposed-plan"?u(X2,{row:t}):null,t.kind==="turn-plan"?u(Y2,{row:t}):null,t.kind==="working"?u(J2,{row:t}):null]})})});function j2({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(Q2,{entry:r},r.id))})}function Q2({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 X2({row:e}){let t=Kt(Tn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(KS,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var Y2=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 J2({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Kt(g0),{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?fc(r("activity.workingForLive"),u(oB,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(Z2,{retry:o}):n&&!e.compacting?u(tB,{stall:n}):null]})}function Z2({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(kf,{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 eB={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function tB({stall:e}){let{t}=Nt(),{onInterrupt:n}=Kt(Tn),o=t(eB[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:fc(t("stall.noOutputForLive"),u(nB,{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 v0(e,t){let n=si();q(()=>{let o=()=>{t.current&&(t.current.textContent=$h(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 nB({since:e}){let t=_(null);return v0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:$h(e)})}function oB({createdAt:e}){let t=_(null);return v0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:$h(e)})}function rB(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&&aB(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function aB(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 iB(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 $h(e){return iB(e,new Date().toISOString())??"0s"}pe();var x0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var y0=50,sB=32;function lB(e){let t=[];for(let n=0;n<e.length;n+=y0)t.push(e.slice(n,n+y0));return t}function dB({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
|
|
3682
|
+
`):null,contexts:o}}function a0(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),n=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${n}`}function Dh(e){let t=uc(e),n=w2(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var T2=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function i0(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Wf(o))}return t.join(" ")}function Wf(e){let t=e.trim(),n=T2.exec(t);if(!n)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let o=Number.parseInt(n[2]??"",10),r=Number.parseInt(n[3]??n[2]??"",10);return!Number.isFinite(o)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:a0({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function s0(e,t){let n=0;for(let o of t){let r=Wf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function Oh({row:e}){let t=Ut(Tn).derive;if(Rh(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(be,{children:[u(P2,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Oh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(E2,{row:e})}return u(L2,{row:e,text:e.message.text})}function Fh({images:e}){let t=Ut(Tn),{t:n}=Dt();return e.length===0?null:u("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>u("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Mh(e,o.id);r&&t.onImageExpand(r)},children:u("img",{src:o.previewUrl,alt:o.name,className:"block h-auto max-h-[220px] w-full object-cover"})}):u("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function L2({row:e,text:t}){let{t:n}=Dt(),o=Ut(Tn),r=e.message.attachments??[],a=Dh(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Nh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=uc(l),c=[...a.elementContexts,...d.contexts],f=r.filter(v=>v.name.startsWith("preview-annotation-")),p=r.filter(v=>!v.name.startsWith("preview-annotation-")),m=p.filter(v=>di(v)==="image"),h=p.filter(v=>di(v)!=="image"),g=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(k2,{author:g}),b("div",{className:"min-w-0 flex-1 space-y-2",children:[b("div",{className:"flex min-h-7 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-chat-dense",children:[u("span",{className:"min-w-0 truncate font-medium text-foreground",children:g?.displayName??n("message.user")}),b(Qe,{children:[u(Ye,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:li(e.message.createdAt,o.timestampFormat)}),u(Xe,{children:Jr(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(M2,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(hl,{text:a.copyText,variant:"ghost"})]})]}),b("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(Fh,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(zh,{attachment:v},v.id))}),s.map((v,x)=>u(_2,{annotation:v,image:f[x]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(N2,{context:v},`${v.header}:${v.body}`))}):null,u(z2,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function k2({author:e}){let t=e;return t!==null?u(RI,{userId:t.userId,displayName:t.displayName,size:28,className:"mt-0.5"}):u("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-message text-secondary-label",children:u(Yr,{className:"size-4"})})}function Gf({children:e}){return u("div",{className:"flex justify-center py-1",children:u("div",{className:"max-w-[80%] rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:e})})}function P2({parsed:e}){let{t}=Dt();return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var A2={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.stopped":"childThread.notification.stopped","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved"};function E2({row:e}){let{t}=Dt(),n=Ut(Tn).derive,o=e.message.attachments??[],r=o.filter(l=>di(l)==="image"),a=o.filter(l=>di(l)!=="image"),i=l=>{let d=YS(l);if(d)return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:d.title}),d.body.length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:d.body}):null]});let c=n.parseThreadHandoverText(l);if(c)return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),u("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:c.includedTurns})}),u("p",{className:"mt-1 whitespace-pre-wrap",children:c.body})]});let f=n.parseSystemNotificationText(l);return f?b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t(A2[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=XS(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(be,{children:[s.map((l,d)=>u(Ja,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(Fh,{images:r}),a.map(l=>u(zh,{attachment:l},l.id))]}):null]})}function c0(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Rh(e??""))return null;let r=Dh(n??e??"").visibleText;for(;;){let s=Nh(r);if(!s.annotation)break;r=s.promptText}let a=uc(r).promptText,i=_h(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var u0=34,f0=8,Bh=u0+f0,p0=ue(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=Dt(),s=i(r?"timeline.pinnedTurnHeaderShowLess":"timeline.pinnedTurnHeaderShowMore");return u("div",{ref:t,className:"group pointer-events-none absolute inset-x-0 top-0 z-10 px-3 sm:px-5",style:{paddingTop:f0},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:F("transcript-col-wide pointer-events-auto flex gap-2 rounded-sm border border-border/70 bg-background pe-1 ps-3 shadow-md shadow-black/10",r?"items-start py-1.5":"items-center"),...r?{}:{style:{height:u0}},children:[u("span",{ref:n,className:F("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Qe,{children:[u(Ye,{render:u(te,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Ed,{}):u(pn,{})}),u(Xe,{side:"bottom",children:s})]})]})})});function M2({messageId:e,onFork:t}){let{t:n}=Dt(),o=n("fork.action");return b(Qe,{children:[u(Ye,{render:u(te,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Od,{className:"size-3"})}),u(Xe,{side:"top",children:o})]})}function m0({row:e}){let t=Ut(Tn),{t:n}=Dt(),[o,r]=xl(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(zf,{state:"idle",children:b("button",{type:"button",className:F(Bf,"chat-process-text cursor-pointer text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":n("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[u(ac,{status:null}),u(rc,{children:u(Xd,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(pn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>di(c)==="image"),l=i.filter(c=>di(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":"(empty response)");return u(be,{children:b("div",{className:"relative min-w-0 px-1 py-0.5","data-assistant-text-tone":e.textTone==="process"&&e.presentation!=="compact"?"process":"primary",children:[e.presentation==="compact"?b("div",{className:"mb-1 flex items-center gap-2",children:[u("button",{type:"button",className:"chat-process-meta mb-1 rounded-sm text-secondary-label","aria-expanded":!0,onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!1)},children:n("timeline.collapseMessage")}),e.copyInFooter?null:u(hl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u($h,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(nr,{text:d,className:e.textTone==="process"&&e.presentation!=="compact"?"chat-commentary":"chat-readable-body",cwd:t.markdownCwd,threadRef:t.threadRef??void 0,isStreaming:!!e.message.streaming,lineBreaks:t.derive.shouldPreserveAssistantLineBreaks(d),skills:t.skills}),u(Fh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(zh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?b("div",{className:"mt-1.5 flex items-center gap-2 text-chat-row tabular-nums opacity-0 transition-opacity duration-(--control-duration) focus-within:opacity-100 group-hover/assistant:opacity-100",children:[u(R2,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Qe,{children:[u(Ye,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:li(e.message.updatedAt,t.timestampFormat)}),u(Xe,{children:Jr(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function R2({row:e}){let n=Ut(Tn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(hl,{text:n.text??"",variant:"ghost"}):null}var l0=ue(function(t){let n=t.context.body.length>0?`${t.context.header}
|
|
3683
|
+
${t.context.body}`:t.context.header;return u(r0,{label:t.context.header,tooltipText:n})}),N2=ue(function(t){let n=t.context.body?`${t.context.header}
|
|
3684
|
+
${t.context.body}`:t.context.header;return b(Qe,{children:[b(Ye,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(Qr,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function zh(e){let{t}=Dt(),n=di(e.attachment),o=JS(n),r=t("attachments.open",{name:e.attachment.name}),a=b(be,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0 flex-1",children:[u("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),u("span",{className:"block text-secondary-label text-chat-meta",children:QS(e.attachment.sizeBytes)})]})]});return e.attachment.previewUrl?u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 hover:bg-background/90",children:a}):u("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:a})}function _2(e){let t=Ut(Tn),{t:n}=Dt();return b("div",{className:"mb-2 flex max-w-full items-center overflow-hidden rounded-lg border border-border/70 bg-background/70",children:[e.image?.previewUrl?u("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":n("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let o=Mh([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:"Annotated preview crop",className:"size-full object-cover"})}):null,b("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?u("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,b("div",{className:F("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?u("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?b("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(es,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var D2=8,O2=600,F2=1.75,d0=`linear-gradient(to bottom, black calc(100% - ${F2}rem), transparent)`;function B2(e){return e.trim().length===0?!1:e.length>O2||e.split(`
|
|
3685
|
+
`).length>D2}var z2=ue(function(t){let[n,o]=G(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&B2(t.text),i=a&&!n;return b("div",{children:[r?u("div",{className:F("relative",i&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":i?"true":"false","data-user-message-collapsible":a?"true":"false","data-user-message-fade":i?"true":"false",style:i?{WebkitMaskImage:d0,maskImage:d0}:void 0,children:u($2,{text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,a||t.footer?b("div",{className:F("mt-1.5 flex items-center gap-2",a&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[a?u(te,{type:"button",size:"xs",variant:"ghost","aria-expanded":n,"data-scroll-anchor-ignore":!0,onClick:()=>o(s=>!s),className:"-ml-1 h-6 rounded-control-2 px-1.5 text-secondary-label text-chat-row hover:bg-muted/40 hover:text-message-foreground",children:n?"Show less":"Show full message"}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),$2=ue(function(t){let n=Ut(Tn),o=(a,i)=>{let s=/^\s+/.exec(a)?.[0]??"",l=a.slice(s.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return b(Ja,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(nr,{text:c,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,d?u("span",{"aria-hidden":"true",children:d}):null]},i)},r=_h(t.text);if(r.some(a=>a.kind==="review-comment"))return u("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?u("div",{className:"wrap-break-word",children:u(nr,{text:a.text.trim(),cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:u(H2,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=s0(t.text,t.terminalContexts),i=i0(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Wf(d.header),f=t.text.indexOf(c,l);if(f===-1){s.length=0;break}f>l&&s.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),s.push(u(l0,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(s.length>0)return l<t.text.length&&s.push(o(t.text.slice(l),`user-message-terminal-context-inline-rest:${l}`)),u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}for(let l of t.terminalContexts)s.push(u(l0,{context:l},`user-terminal-context-inline:${l.header}`)),s.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)s.push(u(nr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1},"user-message-terminal-context-inline-text"));else if(i.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}return t.text.length===0?null:u(nr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function H2({comment:e}){let t=Ut(Tn),n=e.fenceLanguage??"diff",o=t0(e);return b("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[b("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:Ff(e.filePath,t.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle," \xB7 ",e.rangeLabel]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(o0,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(nr,{text:e0(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(oS,{patch:o}):null]})}function U2({badge:e}){return b(be,{children:[e.providerId?u("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:u(Ia,{providerId:e.providerId,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,b("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.providerId?u("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}),e.effortLabel?b("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function $h({badge:e,createdAt:t}){let n=Ut(Tn);return b("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[u(U2,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Qe,{children:[u(Ye,{render:u("span",{className:"shrink-0 tabular-nums"}),children:li(t,n.timestampFormat)}),u(Xe,{children:Jr(t,n.timestampFormat)})]})]})}function g0({row:e}){let{t}=Dt(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,e.badge.sourceLabel,n].filter(a=>typeof a=="string"&&a.length>0).join(" \xB7 "),r=e.pending?t("timeline.modelSwitchPending",{model:o}):t("timeline.modelSwitched",{model:o});return b("div",{role:"separator","aria-label":r,"data-pending":e.pending?"true":void 0,className:"flex items-center gap-2 px-1 py-1 text-chat-dense text-muted-foreground/70",children:[u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),b("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.providerId?u(Ia,{providerId:e.badge.providerId,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,u("span",{className:"truncate",children:r})]}),u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}var Tn=Ht(null),v0=Ht(null),K2=u("div",{className:"h-3 sm:h-4"}),q2=u("div",{className:"h-10 sm:h-12"}),V2=Object.freeze([]);function W2({loading:e,onLoadEarlier:t,fade:n}){return u("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:t,disabled:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground disabled:cursor-default pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:e?"Loading earlier turns\u2026":"Load earlier turns"})})})}function G2({onReveal:e,fade:t}){return u("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:"Show earlier turns"})})})}var j2=u("div",{className:"h-3 sm:h-4"}),Q2=[],X2=new Set,Y2=200,J2=1e4,Z2=600,eB=()=>{};function or(e,t){let n=_(e);return t&&(n.current=e),n.current}var tB=[],x0=ue(function({derive:t,activities:n=tB,threadKey:o,threadRef:r,environmentId:a,isWorking:i,workingStepLabel:s=null,stall:l=null,retry:d=null,onInterrupt:c=null,onRespondToDecision:f=null,scheduledWakes:p=V2,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=eB,timelineEntries:y,latestTurn:C,latestAssistantMessageId:w=null,runningTurnId:k,resolveModelBadge:S,pendingModelSelection:L,onOpenFileDiff:I,onForkFromUserMessage:T,onImageExpand:E,markdownCwd:A,resolvedTheme:N,timestampFormat:R,workspaceRoot:$,skills:H=Q2,anchorMessageId:K,onAnchorReady:O,onRowsChange:oe,contentInsetEndAdjustment:ee,liveFollowEnabled:W,awaitingUserDecision:qe=!1,onIsAtEndChange:ve,onManualNavigation:fe,onDisclosureNavigation:Ne=fe,hideEmptyPlaceholder:Ae=!1,topFadeEnabled:ae=!1,scrollerRef:Ee,loadEarlier:xe=null,revealMessageRequest:re=null,onRevealMessageHandled:Ie,usageByTurnId:st,renderWorkGroup:dt,renderToolCallDetail:lt,loadScrollAnchor:ct,saveScrollAnchor:Et,disclosure:ot,useVisibleThreadCompletion:He,export:Se,onSavePlanToWorkspace:ze,paneActive:Je,onTurnNavigatorChange:qt}){let X=ni(),nn=_(X);nn.current=X;let xt=ot.usePersistedExpandedTurnIds(o),[mn,Tt]=Ln("timeline-auto-expanded-turns",o,X2),Yt=z(()=>t.resolveExpandedTurnIds(xt??[],mn),[mn,t,xt]),[Jt,Mt]=Ln("timeline-disclosure-reading",o,!1),zn=_(o);zn.current=o;let kn=_(Yt);kn.current=Yt;let vn=En("timeline-following-end",o,!0);vn.current=W&&K===null;let $n=En("timeline-scroll-restore-pending",o,!1),Vt=dc(o,null),Zt=dc(o,null),Sn=dc(o,null),ho=En("timeline-content-inset",o,ee),zt=_(null),D=B(U=>{if(U!==null&&(zt.current=U),typeof Ee=="function"){Ee(U);return}Ee.current=U},[Ee]);ye(()=>{WS({timeline:zt.current,previousOverlayHeight:ho.current,overlayHeight:ee,followingEnd:X&&W&&!Jt&&K===null}),ho.current=ee},[K,ee,Jt,W,X]),q(()=>()=>{Zt.current?.stop()},[]);let Y=B(()=>{Zt.current?.stop(),Zt.current=null,Vt.current=null,Mt(!1)},[Vt,Zt,Mt]),ce=B(U=>{Ne(),Vt.current=U,Mt(!0),Zt.current?.stop();let se=zt.current?.node??null;if(!se)return;let Re=Array.from(se.querySelectorAll("[data-timeline-row-id]")).find(gn=>gn.dataset.timelineRowId===U);if(!Re)return;let yt=Sn.current;Zt.current=LS({viewport:se,row:Re,anchor:yt&&Re.contains(yt)?yt:Re,scrollToOffset:gn=>{se.scrollTop=gn}})},[Ne]),ie=En("timeline-live-follow-previous",o,W);ye(()=>{W&&!ie.current&&Y(),ie.current=W},[W,Y]);let pe=En("timeline-latest-turn-previous",o,C);q(()=>{let U=pe.current;if(pe.current=C,!(!C||U?.turnId===void 0)){if(C.turnId===U.turnId){U.state==="running"&&C.state==="interrupted"&&Tt(se=>{let Re=new Set(se);return Re.add(C.turnId),Re});return}Tt(se=>{if(!se.has(U.turnId))return se;let Re=new Set(se);return Re.delete(U.turnId),Re})}},[C]);let Ze=En("timeline-rows-cache",o,null,3);Ze.current??=t.createRowsCache();let pt=Ze.current.deriveGroups,xn=or(n,X),ht=or(y,X),en=or(C,X),tn=or(k,X),bt=or(Yt,X),yn=or(i,X),sn=or(h,X),ge=or(S,X),Rt=or(L,X),rt=or(s,X),Lt=or(l,X),et=or(d,X),Nt=z(()=>pt({activities:xn,timelineEntries:ht,latestTurn:en,runningTurnId:tn,expandedTurnIds:bt,isWorking:yn,activeTurnStartedAt:sn,resolveModelBadge:ge,pendingModelSelection:Rt}),[pt,xn,ht,en,tn,bt,yn,sn,ge,Rt]),ut=gB(Nt.rows,t),ft=z(()=>MS(ut,Nt.turnGroups),[Nt.turnGroups,ut]),eo=_(ut);eo.current=ut;let ln=B(U=>{let se=eo.current.find(Re=>Re.id===U||Re.kind==="work"&&Re.groupedEntries.some(yt=>yt.id===U)||Re.kind==="tool-group"&&Re.entries.some(yt=>yt.id===U));ce(se?.id??U)},[ce]),Nn=_(ut);Nn.current=ut;let Hn=En("timeline-scroll-snapshot",o,null),Un=B((U,se=vn.current)=>{U.scrollLength<=0||(Hn.current={threadKey:o,anchor:GS({measurement:U,followingEnd:se})})},[vn,o,Hn]),ne=B(()=>{let U=Hn.current;U&&Et(U.threadKey,U.anchor)},[Et,Hn]),Fe=B(()=>{if(!X||$n.current)return;let U=zt.current?.measure();U&&U.scrollLength>0&&(Un(U,vn.current&&t.resolveIsAtEnd(U,ee)!==!1),ne())},[Un,ee,t,vn,X,ne,$n]),at=OS(o),je=_(at);je.current=at;let{startIndex:wn,hasHiddenOlder:dn}=RS(ft.length,at.revealedCount),Cn=z(()=>ft.slice(wn),[wn,ft]),$t=_(ft);$t.current=ft;let Kn=dc(o,null),Wt=B(()=>{if(!nn.current)return;let U=zt.current?.node;U&&(Kn.current={scrollHeight:U.scrollHeight,scrollTop:U.scrollTop,until:Date.now()+J2})},[Kn]);ye(()=>{if(!X)return;let U=Kn.current;if(!U)return;Kn.current=null;let se=zt.current?.node;if(!se||Date.now()>U.until)return;let Re=U.scrollTop+(se.scrollHeight-U.scrollHeight);se.scrollTop=Re},[X,wn,ut.length]);let vo=B(()=>{Wt(),je.current.revealOlder()},[Wt]),Wa=_(vo);Wa.current=vo;let Ga=_(dn);Ga.current=dn;let Ni=_(null),he=En("timeline-scroll-restore",o,void 0);if(he.current===void 0&&ut.length>0){let U=ct(o);he.current=U!==null&&ut.some(se=>se.id===U.rowId)?U:null}let da=he.current??null,Go=_(()=>{}),[ja,gd]=Ln("timeline-scroll-restore-settled",o,!1),ca=da!==null&&!ja,qn=En("timeline-last-anchor-save",o,0);q(()=>{let U=da;if(!X||ja||U===null)return;let se=null,Re=requestAnimationFrame(()=>{nn.current&&(fe(),je.current.revealAtLeast(sc($t.current,U.rowId,je.current.revealedCount)),se=requestAnimationFrame(()=>{nn.current&&(gd(!0),Go.current(U.rowId,-U.offsetPx))}))});return()=>{cancelAnimationFrame(Re),se!==null&&cancelAnimationFrame(se)}},[fe,X,da,ja]);let _t=En("timeline-restore-after-presentation",o,!1),ro=ca||_t.current;$n.current=ro,ye(()=>{if(X)return()=>{zn.current!==o?ne():Fe(),_t.current=!0}},[X,o]),ye(()=>{if(!X||!_t.current)return;let U=null,se=null,Re=()=>{zt.current?.scrollToEnd(),_t.current=!1,$n.current=!1,vn.current=!0,Qo.current=!0,io.current={...io.current,followEnabled:!0,restoreInProgress:!1},ve(!0)},yt=ct(o),gn=yt!==null&&$t.current.some(xr=>xr.rows.some(Co=>Co.id===yt.rowId));return yt===null?U=requestAnimationFrame(Re):gn?(fe(),je.current.revealAtLeast(sc($t.current,yt.rowId,je.current.revealedCount)),U=requestAnimationFrame(()=>{se=requestAnimationFrame(()=>{nn.current&&(Go.current(yt.rowId,-yt.offsetPx),_t.current=!1,$n.current=!1)})})):ut.length>0&&(U=requestAnimationFrame(Re)),()=>{U!==null&&cancelAnimationFrame(U),se!==null&&cancelAnimationFrame(se)}},[ct,ve,fe,X,o,ut.length,ft.length]);let on=z(()=>X?nB(ft,t):[],[t,X,ft]),_i=z(()=>{if(!X)return[];let U=new Map;for(let se of ft)for(let Re of se.rows){let yt=Re.kind==="message"?Re.message.turnId??null:Re.kind==="turn-summary"?Re.footer.turnId:null;if(yt!==null){U.set(se.key,yt);break}}return on.filter(se=>se.userText!==null).map(se=>({...se,turnId:U.get(se.sectionKey)??null}))},[X,on,ft]),It=B(U=>{Y(),fe(),je.current.revealAtLeast(sc($t.current,U.anchorRowId,je.current.revealedCount));let se=o;requestAnimationFrame(()=>{zn.current===se&&Go.current(U.anchorRowId,24)})},[fe,Y,o]),xo=z(()=>X?{items:_i,totalTurnCount:g,bottomInset:ee,usageByTurnId:st,onSelect:It,exportMarkdown:Se.markdown,onDownload:Se.download}:null,[ee,Se,It,X,g,_i,st]);q(()=>{xo!==null&&qt(xo)},[qt,xo]),q(()=>{if(X)return()=>qt(null)},[qt,X]),q(()=>{if(re===null||!X)return;Y(),fe();let U=t.resolveToolGroupRevealRowId(Nn.current,re.rowId);je.current.revealAtLeast(sc($t.current,U,je.current.revealedCount));let se=requestAnimationFrame(()=>{zn.current===o&&(Go.current(U,24),Ie?.())});return()=>cancelAnimationFrame(se)},[re,X,fe,Y,Ie,t,o]);let bn=z(()=>on.flatMap(U=>U.headerText===null?[]:[{sectionKey:U.sectionKey,text:U.headerText}]),[on]),_e=_(bn);_e.current=bn;let Gt=En("timeline-active-header",o,null),Eo=bn.at(-1)?.text??null,gr=Eo!==null,Di=_(null),yo=_(null),[Hr,jo]=Ln("timeline-pinned-header-expanded",o,!1),hr=_(Hr);hr.current=Hr;let ao=B(()=>{if(!nn.current)return;let U=Di.current,se=yo.current;!U||!se||(U.dataset.truncated=hr.current||se.scrollWidth>se.clientWidth+1?"true":"false")},[]),[Ur,ua]=G(null),Oi=z(()=>t.hasSettledAssistantMessage(y,w),[t,y,w]),[_n,Fi]=G(null),Oo=B(()=>{Wt(),xe?.onLoadEarlier()},[Wt,xe]);Ni.current=xe===null||xe.loading?null:Oo;let Bi=B((U,se)=>{if(!nn.current)return;let Re=zt.current?.node;if(!Re)return;let yt=Array.from(Re.querySelectorAll("[data-timeline-turn-section]")),gn=yt.findIndex(Co=>Co.querySelector(`[data-timeline-row-id="${CSS.escape(U)}"]`)),xr=gn<0?yt:yt.slice(0,gn+1);for(let Co of xr)Co.style.contentVisibility="visible";Re.offsetHeight,zt.current?.scrollToRow(U,{viewOffset:se}),requestAnimationFrame(()=>{for(let Co of xr)Co.style.removeProperty("content-visibility")})},[]);Go.current=Bi;let Fo=z(()=>dS(ut,K,U=>U.kind==="message"&&U.message.role==="user"?U.message.id:null),[K,ut]),vr=X&&W&&!Jt&&Fo===void 0&&!ro,Qo=_(vr);Qo.current=vr;let io=_({followEnabled:vr,restoreInProgress:ro,loadEarlier:xe});io.current={followEnabled:vr,restoreInProgress:ro,loadEarlier:xe};let zi=_(null);q(()=>{if(!_n||!X)return;let U=FS({root:_n,minimumCount:ls,canCompact:()=>{let se=io.current,Re=Kn.current;return se.followEnabled&&!se.restoreInProgress&&!se.loadEarlier?.loading&&!(Re&&Re.until>Date.now())&&je.current.revealedCount>ls},onCompact:se=>{rn.current=!0,Wt(),je.current.compactTo(se)}});return zi.current=U,()=>{U.disconnect(),zi.current=null}},[Wt,X,_n]),q(()=>{zi.current?.schedule()},[vr,xe?.loading,at.revealedCount,ft.length]),q(()=>{if(!_n||!X||typeof ResizeObserver>"u")return;let U=()=>{if(!nn.current||!Qo.current)return;let yt=_n.scrollHeight-_n.clientHeight;Math.abs(_n.scrollTop-yt)>.5&&(_n.scrollTop=yt)},se=new ResizeObserver(U);se.observe(_n);let Re=_n.firstElementChild;return Re&&se.observe(Re),()=>se.disconnect()},[X,_n]),He({viewport:Ur,viewActive:Je&&X,threadKey:o,completedAt:!ro&&C?.state==="completed"&&Oi?C.completedAt:null,messageId:w,bottomInset:ee});let[Bo,$e]=Ln("timeline-anchored-end-height",o,0),vt=En("timeline-anchored-ready",o,null);ye(()=>{if(!X)return;if(Fo===void 0||K===null){$e(0),vt.current=null;return}let U=zt.current?.node,se=ut[Fo.anchorIndex],Re=zt.current?.measure();if(!U||!se||!Re||Re.scrollLength<=0)return;let yt=Re.topOf(se.id);if(yt===null)return;let gn=Re.contentLength-Bo-yt,xr=Math.max(0,Re.scrollLength-ee-Fo.anchorOffset),Co=Math.max(0,Math.round(xr-gn));if(Math.abs(Co-Bo)>1){$e(Co);return}vt.current!==K&&(vt.current=K,O(K,{rowId:se.id,lastRowId:ut.at(-1)?.id??null}))},[K,Fo,Bo,ee,O,X,ut]);let cn=ut.at(-1)?.id??null;q(()=>{oe?.(cn)},[cn,oe,o]);let rn=En("timeline-top-reveal-armed",o,!0),Qa=B(U=>{if(U>Z2){rn.current=!0;return}if(rn.current){if(rn.current=!1,Ga.current){Wa.current();return}Ni.current?.()}},[rn]),fa=B(()=>{if(!nn.current||zn.current!==o)return;let U=zt.current?.measure();if(!U||$n.current)return;Un(U);let se=t.resolveIsAtEnd({contentLength:U.contentLength,scroll:U.scroll,scrollLength:U.scrollLength},ee);se!==void 0&&ve(se),U.contentLength-U.scrollLength-U.scroll>2&&Qa(U.scroll);let Re=Date.now();Re-qn.current>=Y2&&(qn.current=Re,ne())},[Un,ee,t,Qa,ve,ne,o,$n]),zo=_(null),Kr=B(()=>{nn.current&&zo.current===null&&(zo.current=requestAnimationFrame(()=>{zo.current=null,ao()}))},[ao]);q(()=>()=>{zo.current!==null&&(cancelAnimationFrame(zo.current),zo.current=null)},[o]);let Og=B(U=>{if(U===null||U===Gt.current)return;Gt.current=U;let se=_e.current.find(Re=>Re.sectionKey===U);se&&yo.current&&(yo.current.textContent=se.text),hr.current&&jo(!1),Kr()},[Gt,Kr,jo]),un=zS({root:_n,topInsetPx:Bh,onActiveSectionChange:Og,active:X});q(()=>{if(!X){ne();return}let U=requestAnimationFrame(()=>{if(!nn.current)return;let se=zt.current?.node;se&&Qo.current&&(se.scrollTop=se.scrollHeight-se.clientHeight),un.refresh()});return()=>cancelAnimationFrame(U)},[ne,un,X]);let Fg=B(()=>{jo(U=>!U)},[jo]);ye(()=>{if(!X)return;let U=Gt.current,se=U===null?void 0:_e.current.find(Re=>Re.sectionKey===U);se&&yo.current&&(yo.current.textContent=se.text),Kr()},[X,Kr,Hr]);let Ys=z(()=>{let U=dn?u(G2,{onReveal:vo,fade:ae}):xe!==null?u(W2,{loading:xe.loading,onLoadEarlier:Oo,fade:ae}):ae?q2:K2;return gr?b(be,{children:[u("div",{style:{height:Bh}}),U]}):U},[Oo,dn,gr,xe,vo,ae]);q(()=>{if(!X)return;let U=requestAnimationFrame(fa);return()=>cancelAnimationFrame(U)},[fa,X,ro,ut.length]);let $u=z(()=>({timestampFormat:R,threadKey:o,threadRef:r,markdownCwd:A,resolvedTheme:N,workspaceRoot:$,skills:H,activeThreadEnvironmentId:a,onForkFromUserMessage:T,onImageExpand:E,onOpenFileDiff:I,onProcessDisclosureChange:ln,agentPanelModel:v,onOpenAgents:x,onInterrupt:c,onRespondToDecision:f,scheduledWakes:p,onCancelScheduledWake:m,derive:t,renderWorkGroup:dt,renderToolCallDetail:lt,onSavePlanToWorkspace:ze}),[R,o,r,A,N,$,H,a,T,E,I,ln,v,x,c,f,p,m,t,dt,lt,ze]),Bg=z(()=>({isWorking:yn,latestTurnId:en?.turnId??null,workingStepLabel:rt,stall:Lt,retry:et}),[yn,en?.turnId,et,Lt,rt]),pa=B(U=>u(rB,{row:U}),[]);return ut.length===0&&!i?Ae?null:u("div",{className:"flex h-full items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:"Send a message to start the conversation."})}):u(Tn,{value:$u,children:u(v0,{value:Bg,children:b("div",{ref:ua,onClickCapture:U=>{Sn.current=U.target instanceof Element?U.target.closest("button"):null},onWheelCapture:Y,onTouchMoveCapture:Y,onPointerDownCapture:U=>{U.target===zt.current?.node&&Y()},onKeyDownCapture:U=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(U.key)&&Y()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":qe?"true":"false","data-disclosure-reading":Jt?"true":void 0,"data-timeline-follow-end":vr?"true":"false","data-timeline-anchor-row":Fo===void 0?void 0:ut[Fo.anchorIndex]?.id??void 0,"data-timeline-end-inset":ee,children:[u(AS,{inputKey:o,onBeforeInputChange:Fe,handleRef:D,onAttach:Fi,onScroll:fa,className:F("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",ae&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:ee},children:[Ys,Cn.map(U=>u(ES,{sectionKey:U.key,rowKeyPrefix:o,rows:U.rows,renderRow:pa,sectionRef:un.observeSection(U.key)},`${o}:${U.key}`)),j2,Fo?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:Bo}}):null]})}),Eo!==null?u(p0,{ref:Di,textRef:yo,initialText:Eo,expanded:Hr,onToggleExpanded:Fg}):null]})})})});function nB(e,t){return e.map(n=>{let o=n.rows.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of n.rows)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:n.key,sectionKey:n.key,anchorRowId:o?.id??n.rows[0]?.id??n.key,userText:r===null?null:h0(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:h0(a),headerText:r===null?null:c0(r.text,t)}})}var Hh=240,oB=/\s/u;function h0(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Hh-1;)n-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),n-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(oB.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Hh)||(t.push(a),n+=a.length,n>Hh))return r()}return t.length>0?t.join(""):null}var rB=ue(function({row:t}){let n=Ut(Tn);return u("div",{className:F("relative",t.kind==="message"&&t.message.role==="user"?"pb-6":t.kind==="message"&&t.message.role==="assistant"?t.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":t.id,"data-timeline-row-kind":t.kind,"data-message-id":t.kind==="message"?t.message.id:void 0,"data-message-role":t.kind==="message"?t.message.role:void 0,children:b(Uf,{resetKey:t.id,fallback:jS,children:[t.kind==="turn-summary"?u(pS,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(TS,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(aB,{row:t}):null,t.kind==="model-switch"?u(g0,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u($h,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(Oh,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(m0,{row:t}):null,t.kind==="proposed-plan"?u(sB,{row:t}):null,t.kind==="turn-plan"?u(lB,{row:t}):null,t.kind==="working"?u(dB,{row:t}):null]})})});function aB({row:e}){let t=Ut(Tn),n=ni(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(be,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(iB,{entry:r},r.id))})}function iB({entry:e}){let[t,n]=G(!1),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":t,className:F("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive":"text-muted-foreground"),onClick:()=>n(r=>!r),disabled:o===void 0,children:[u("span",{"aria-hidden":!0,className:F("block size-2 shrink-0 rounded-full",e.tone==="error"?"bg-destructive":e.tone==="thinking"||e.tone==="info"?"bg-muted-foreground/60":"border border-muted-foreground/60")}),u("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:e.label}),o!==void 0?u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!t&&"-rotate-90")}):null]}),t&&o!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:o}):null]})}function sB({row:e}){let t=Ut(Tn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(VS,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var lB=ue(function({row:t}){let[n,o]=G(!1),{steps:r}=t.turnPlan.plan,a=r.filter(d=>d.status==="completed").length,i=a===r.length,s=r.find(d=>d.status==="inProgress")?.step??r.find(d=>d.status==="pending")?.step??r.at(-1)?.step??"Plan";return b("div",{className:"min-w-0 px-1 py-0.5",children:[b("button",{type:"button",className:"relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-[12px] leading-5 transition-colors duration-(--control-duration) hover:bg-accent/20 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11","aria-expanded":n,onClick:()=>o(d=>!d),children:[u(n?pn:Uo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),r.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:r.map(d=>u("span",{className:F("h-[3px] w-2.5 rounded-full",d.status==="completed"?"bg-success":d.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},d.step))}):null,u("span",{className:F("min-w-0 truncate",i?"text-muted-foreground/65":"font-medium text-foreground/85"),children:s}),r.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[a,"/",r.length]}):null]}),n?u("div",{className:"mt-0.5 space-y-px pl-6",children:r.map(d=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:F("w-3 shrink-0 text-center font-mono text-chat-meta",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step})]},d.step))}):null]})});function dB({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Ut(v0),{t:r}=Dt();return b("div",{className:"border-b border-border/60 pb-2 pt-1",children:[u("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 px-1 text-chat text-muted-foreground tabular-nums","data-testid":"working-row",children:b("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?cc(r("activity.workingForLive"),u(mB,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(cB,{retry:o}):n&&!e.compacting?u(fB,{stall:n}):null]})}function cB({retry:e}){let{t}=Dt(),n=Ut(Tn);return b(tc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Af,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(nc,{children:u(te,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var uB={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function fB({stall:e}){let{t}=Dt(),{onInterrupt:n}=Ut(Tn),o=t(uB[e.reason]);return b("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[u("span",{className:"tabular-nums",children:cc(t("stall.noOutputForLive"),u(pB,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(te,{className:"h-5 px-1.5 text-chat-row",onClick:n,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t("stall.interrupt")}):null]})}function y0(e,t){let n=ni();q(()=>{let o=()=>{t.current&&(t.current.textContent=Uh(e))};if(o(),!n)return;let r=setInterval(o,1e3);return document.addEventListener("visibilitychange",o),()=>{clearInterval(r),document.removeEventListener("visibilitychange",o)}},[n,e,t])}function pB({since:e}){let t=_(null);return y0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Uh(e)})}function mB({createdAt:e}){let t=_(null);return y0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Uh(e)})}function gB(e,t){let n=_({byId:new Map,result:[]}),o=_(t);return o.current=t,z(()=>{let r=new Map,a=e.map(i=>{let s=n.current.byId.get(i.id),l=s&&hB(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function hB(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":{let n=t;return e.turnId===n.turnId&&e.createdAt===n.createdAt&&e.badge===n.badge}case"turn-summary":{let n=t;return e.createdAt===n.createdAt&&e.copyText===n.copyText&&e.footer===n.footer}case"tool-group":{let n=t;return e.createdAt===n.createdAt&&e.groupId===n.groupId&&e.entries===n.entries}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&e.modelBadge===n.modelBadge}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&e.badge===n.badge}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let n=t;return e.createdAt===n.createdAt&&e.turnPlan.plan===n.turnPlan.plan}case"work":{let n=t;return e.isExpandedToolGroupEntry===n.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===n.isLastExpandedToolGroupEntry&&e.groupedEntries===n.groupedEntries}case"message":{let n=t;return e.message===n.message&&e.presentation===n.presentation&&e.textTone===n.textTone&&e.durationStart===n.durationStart&&e.showAssistantMeta===n.showAssistantMeta&&e.showAssistantCopyButton===n.showAssistantCopyButton&&e.copyInFooter===n.copyInFooter&&e.assistantCopyStreaming===n.assistantCopyStreaming&&e.modelBadge===n.modelBadge}}}function vB(e,t){let n=Date.parse(e),o=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(o))return null;let r=Math.max(0,Math.floor((o-n)/1e3));if(r<60)return`${r}s`;let a=Math.floor(r/3600),i=Math.floor(r%3600/60),s=r%60;return a>0?i>0?`${a}h ${i}m`:`${a}h`:s>0?`${i}m ${s}s`:`${i}m`}function Uh(e){return vB(e,new Date().toISOString())??"0s"}me();var C0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var b0=50,xB=32;function yB(e){let t=[];for(let n=0;n<e.length;n+=b0)t.push(e.slice(n,n+b0));return t}function CB({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
|
|
3683
3686
|
|
|
3684
3687
|
`):[r,...s].filter(Boolean).join(`
|
|
3685
3688
|
|
|
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
|
|
3689
|
+
`);return l.length===0?null:u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:l})}var I0=ue(function({inputKey:t,rows:n,loadEarlier:o,timestampFormat:r,paneVisible:a,useToolCallDetail:i,threadRef:s,resolveChatAnchorMessageId:l,onOpenInChat:d}){let{t:c}=co(),[f,p]=Ln("trajectory-kind-filter",t,"all"),[m,h]=Ln("trajectory-expanded-rows",t,()=>new Set),[g,v]=Ln("trajectory-follow-latest",t,!0),x=z(()=>{let E=new Set(n.map(A=>A.kind));return C0.filter(A=>E.has(A))},[n]),y=z(()=>f==="all"?n:n.filter(E=>E.kind===f),[n,f]),C=z(()=>yB(y),[y]),w=E=>h(A=>{let N=new Set(A);return N.has(E)?N.delete(E):N.add(E),N}),k=_(null),S=En("trajectory-at-end",t,!0),L=En("trajectory-scroll-top",t,0),I=()=>{if(!a)return;let E=k.current;E&&(L.current=E.scrollTop,S.current=E.scrollHeight-E.scrollTop-E.clientHeight<=xB)},T=E=>{E&&(S.current=!0),v(E)};return ye(()=>{if(!a)return;let E=k.current;if(E)return(!g||!S.current)&&(E.scrollTop=L.current),()=>{L.current=E.scrollTop}},[S,g,t,a,L]),ye(()=>{if(!a||!g||!S.current)return;let E=k.current;E&&(E.scrollTop=E.scrollHeight)},[y,g,t,a,n]),b("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[b("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[b("div",{role:"group","aria-label":c("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(te,{size:"xs",variant:f==="all"?"secondary":"ghost","aria-pressed":f==="all",onClick:()=>p("all"),children:c("trajectory.filterAll")}),x.map(E=>u(te,{size:"xs",variant:f===E?"secondary":"ghost","aria-pressed":f===E,onClick:()=>p(E),children:c(`trajectory.kinds.${E}`)},E))]}),u(Zd,{className:"ml-auto",size:"xs",variant:"outline",pressed:g,onPressedChange:T,"aria-label":c("trajectory.followLatest"),children:c("trajectory.followLatest")})]}),b("div",{ref:k,className:"min-h-0 flex-1 overflow-auto",onScroll:I,"data-trajectory-scroll":!0,children:[o!==null?b("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[u("span",{children:c("trajectory.loadEarlier")}),u(te,{size:"xs",variant:"outline",disabled:o.loading,onClick:o.onLoadEarlier,children:o.loading?c("trajectory.loadingEarlier"):c("trajectory.loadEarlierAction")})]}):null,y.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:c("trajectory.empty")}):b(qI,{children:[u(WI,{className:"sticky top-0 z-10 bg-background",children:b(Pf,{className:"hover:bg-transparent",children:[u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnTime")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnType")}),u(is,{children:c("trajectory.columnSummary")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnStatus")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnDuration")}),u(is,{className:"w-px",children:u("span",{className:"sr-only",children:c("trajectory.openInChat")})})]})}),C.map((E,A)=>u(VI,{className:"trajectory-chunk [&_tr:last-child]:border-b",children:E.map(N=>{let R=m.has(N.id),$=N.detail!==void 0||N.toolCallId!==void 0,H=l(N);return[b(Pf,{"data-trajectory-row-id":N.id,className:F($&&"cursor-pointer"),onClick:$?()=>w(N.id):void 0,children:[u(si,{className:"whitespace-nowrap text-muted-foreground",title:Jr(N.createdAt,r),children:li(N.createdAt,r)}),u(si,{className:"whitespace-nowrap",children:c(`trajectory.kinds.${N.kind}`)}),u(si,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[$?u(te,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":c(R?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":R,onClick:K=>{K.stopPropagation(),w(N.id)},children:R?u(pn,{"aria-hidden":!0}):u(Uo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:N.summary})]})}),u(si,{className:"whitespace-nowrap",children:c(`trajectory.status.${N.status}`)}),u(si,{className:"whitespace-nowrap text-muted-foreground",children:N.durationMs!==void 0?ss(N.durationMs):c("trajectory.valueUnknown")}),u(si,{className:"whitespace-nowrap",children:H!==null?b(Qe,{children:[u(Ye,{render:u(te,{size:"xs",variant:"ghost","aria-label":c("trajectory.openInChat"),onClick:K=>{K.stopPropagation(),d(H)}}),children:u(Zi,{"aria-hidden":!0})}),u(Xe,{side:"top",children:c("trajectory.openInChat")})]}):null})]},`${t}:${N.id}`),R&&$?u(Pf,{className:"hover:bg-transparent","data-trajectory-detail-row":N.id,children:b(si,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:c("trajectory.detailTitle")}),N.kind==="tool-call"&&N.toolCallId!==void 0?u(CB,{threadRef:s,useToolCallDetail:i,toolCallId:N.toolCallId,turnId:N.turnId,fallback:N.detail,revision:`${N.status}:${N.updatedActivityId??N.activityId??N.id}`}):N.detail!==void 0?u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:N.detail}):null]})},`${t}:${N.id}:detail`):null]})},`${t}:${E[0]?.id??A}`))]})]})]})});me();var ms=Sd(pc());me();function P0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>o=>{t.forEach(r=>r(o))},t)}var mc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ds(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Qf(e){return"nodeType"in e}function Lo(e){var t,n;return e?ds(e)?e:Qf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Xf(e){let{Document:t}=Lo(e);return e instanceof t}function bl(e){return ds(e)?!1:e instanceof Lo(e).HTMLElement}function qh(e){return e instanceof Lo(e).SVGElement}function cs(e){return e?ds(e)?e.document:Qf(e)?Xf(e)?e:bl(e)||qh(e)?e.ownerDocument:document:document:document}var rr=mc?ye:q;function Yf(e){let t=_(e);return rr(()=>{t.current=e}),B(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function A0(){let e=_(null),t=B((o,r)=>{e.current=setInterval(o,r)},[]),n=B(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Il(e,t){t===void 0&&(t=[e]);let n=_(e);return rr(()=>{n.current!==e&&(n.current=e)},t),n}function Sl(e,t){let n=_();return z(()=>{let o=e(n.current);return n.current=o,o},[...t])}function gc(e){let t=Yf(e),n=_(null),o=B(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Jf(e){let t=_();return q(()=>{t.current=e},[e]),t.current}var Kh={};function us(e,t){return z(()=>{if(t)return t;let n=Kh[e]==null?0:Kh[e]+1;return Kh[e]=n,e+"-"+n},[e,t])}function E0(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((a,i)=>{let s=Object.entries(i);for(let[l,d]of s){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var fs=E0(1),ps=E0(-1);function wB(e){return"clientX"in e&&"clientY"in e}function hc(e){if(!e)return!1;let{KeyboardEvent:t}=Lo(e.target);return t&&e instanceof t}function TB(e){if(!e)return!1;let{TouchEvent:t}=Lo(e.target);return t&&e instanceof t}function vc(e){if(TB(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return wB(e)?{x:e.clientX,y:e.clientY}:null}var ui=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ui.Translate.toString(e),ui.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),k0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function M0(e){return e.matches(k0)?e:e.querySelector(k0)}me();var LB={display:"none"};function R0(e){let{id:t,value:n}=e;return hn.createElement("div",{id:t,style:LB},n)}function N0(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return hn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function _0(){let[e,t]=G("");return{announce:B(o=>{o!=null&&t(o)},[]),announcement:e}}var G0=Ht(null);function kB(e){let t=fn(G0);q(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function PB(){let[e]=G(()=>new Set),t=B(o=>(e.add(o),()=>e.delete(o)),[e]);return[B(o=>{let{type:r,event:a}=o;e.forEach(i=>{var s;return(s=i[r])==null?void 0:s.call(i,a)})},[e]),t]}var AB={draggable:`
|
|
3687
3690
|
To pick up a draggable item, press the space bar.
|
|
3688
3691
|
While dragging, use the arrow keys to move the item.
|
|
3689
3692
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
3690
|
-
`},yB={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 CB(e){let{announcements:t=yB,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=xB}=e,{announce:a,announcement:i}=R0(),s=fs("DndLiveRegion"),[l,d]=G(!1);if(q(()=>{d(!0)},[]),hB(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(A0,{id:o,value:r.draggable}),mn.createElement(M0,{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 Jf(){}function Yh(e,t){return H(()=>({sensor:e,options:t??{}}),[e,t])}function W0(){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 G0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function j0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function bB(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function N0(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 Jh(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function _0(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 Q0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=_0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=G0(_0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(j0)},X0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=N0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=N0(l),c=r.reduce((p,m,h)=>p+G0(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(j0)};function IB(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 SB=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=IB(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(bB)};function wB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Y0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Sr}function TB(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 LB=TB(1);function kB(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 PB(e,t,n){let o=kB(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 EB={ignoreTransform:!1};function xs(e,t){t===void 0&&(t=EB);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Lo(e).getComputedStyle(e);d&&(n=PB(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 D0(e){return xs(e,{ignoreTransform:!0})}function AB(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function MB(e,t){return t===void 0&&(t=Lo(e).getComputedStyle(e)),t.position==="fixed"}function RB(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 wc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(jf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!wl(r)||Uh(r)||n.includes(r))return n;let a=Lo(e).getComputedStyle(r);return r!==e&&RB(r,a)&&n.push(r),MB(r,a)?n:o(r.parentNode)}return e?o(e):n}function J0(e){let[t]=wc(e,1);return t??null}function Kh(e){return!hc||!e?null:cs(e)?e:Gf(e)?jf(e)||e===us(e).scrollingElement?window:wl(e)?e:null:null}function Z0(e){return cs(e)?e.scrollX:e.scrollLeft}function ew(e){return cs(e)?e.scrollY:e.scrollTop}function Wh(e){return{x:Z0(e),y:ew(e)}}var Vn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Vn||(Vn={}));function tw(e){return!hc||!e?!1:e===document.scrollingElement}function nw(e){let t={x:0,y:0},n=tw(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 NB={x:.2,y:.2};function _B(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=NB);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=nw(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 DB(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 ow(e){return e.reduce((t,n)=>ps(t,Wh(n)),Sr)}function OB(e){return e.reduce((t,n)=>t+Z0(n),0)}function FB(e){return e.reduce((t,n)=>t+ew(n),0)}function BB(e,t){if(t===void 0&&(t=xs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);J0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var zB=[["x",["left","right"],OB],["y",["top","bottom"],FB]],bc=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=wc(n),r=ow(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of zB)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 $B(e){let{EventTarget:t}=Lo(e);return e instanceof t?e:us(e)}function qh(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 O0(e){e.preventDefault()}function HB(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 rw={start:[mt.Space,mt.Enter],cancel:[mt.Esc],end:[mt.Space,mt.Enter,mt.Tab]},UB=(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&&BB(o),n(Sr)}handleKeyDown(t){if(xc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=rw,coordinateGetter:i=UB,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}=nw(g),L=DB(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=rw,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 F0(e){return!!(e&&"distance"in e)}function B0(e){return!!(e&&"delay"in e)}var Ic=class{constructor(t,n,o){var r;o===void 0&&(o=$B(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=yc(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,O0),this.windowListeners.add(ir.VisibilityChange,this.handleCancel),this.windowListeners.add(ir.ContextMenu,O0),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(B0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(F0(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,HB,{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=yc(t))!=null?n:Sr,d=ms(r,l);if(!o&&s){if(F0(s)){if(s.tolerance!=null&&qh(d,s.tolerance))return this.handleCancel();if(qh(d,s.distance))return this.handleStart()}if(B0(s)&&qh(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()}},KB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Pl=class extends Ic{constructor(t){let{event:n}=t,o=us(n.target);super(t,KB,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 qB={move:{name:"mousemove"},end:{name:"mouseup"}},Gh;(function(e){e[e.RightClick=2]="RightClick"})(Gh||(Gh={}));var jh=class extends Ic{constructor(t){super(t,qB,us(t.event.target))}};jh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Gh.RightClick?!1:(o?.({event:n}),!0)}}];var Vh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Qh=class extends Ic{constructor(t){super(t,Vh)}static setup(){return window.addEventListener(Vh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Vh.move.name,t)};function t(){}}};Qh.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 Cc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Cc||(Cc={}));var Zf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Zf||(Zf={}));function VB(e){let{acceleration:t,activator:n=Cc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=Zf.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=GB({delta:f,disabled:!a}),[h,g]=k0(),v=_({x:0,y:0}),x=_({x:0,y:0}),y=H(()=>{switch(n){case Cc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Cc.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===Zf.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}=_B(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 WB={x:{[Vn.Backward]:!1,[Vn.Forward]:!1},y:{[Vn.Backward]:!1,[Vn.Forward]:!1}};function GB(e){let{delta:t,disabled:n}=e,o=Xf(t);return Ll(r=>{if(n||!o||!r)return WB;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 jB(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 QB(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 Sc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Sc||(Sc={}));var Xh;(function(e){e.Optimized="optimized"})(Xh||(Xh={}));var z0=new Map;function XB(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 z0;if(!x||x===z0||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 bc(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 Sc.Always:return!1;case Sc.BeforeDragging:return n;default:return!n}}}function aw(e,t){return Ll(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function YB(e,t){return aw(e,t)}function JB(e){let{callback:t,disabled:n}=e,o=Qf(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 ep(e){let{callback:t,disabled:n}=e,o=Qf(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 ZB(e){return new bc(xs(e),e)}function $0(e,t,n){t===void 0&&(t=ZB);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=JB({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=ep({callback:a});return ar(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function ez(e){let t=aw(e);return Y0(e,t)}var H0=[];function tz(e){let t=_(e),n=Ll(o=>e?o&&o!==H0&&e&&t.current&&e.parentNode===t.current.parentNode?o:wc(e):H0,[e]);return q(()=>{t.current=e},[e]),n}function nz(e){let[t,n]=G(null),o=_(e),r=$(a=>{let i=Kh(a.target);i&&n(s=>s?(s.set(i,Wh(i)),new Map(s)):null)},[]);return q(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Kh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,Wh(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=Kh(l);d?.removeEventListener("scroll",r)})}},[r,e]),H(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ps(a,i),Sr):ow(e):Sr,[e,t])}function U0(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 oz(e){q(()=>{if(!hc)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 rz(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 iw(e){return H(()=>e?AB(e):null,[e])}var K0=[];function az(e,t){t===void 0&&(t=xs);let[n]=e,o=iw(n?Lo(n):null),[r,a]=G(K0);function i(){a(()=>e.length?e.map(l=>tw(l)?o:new bc(t(l),l)):K0)}let s=ep({callback:i});return ar(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function iz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return wl(t)?t:e}function sz(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=ep({callback:r}),i=$(d=>{let c=iz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=vc(i);return H(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var lz=[{sensor:Pl,options:{}},{sensor:kl,options:{}}],dz={current:{}},Yf={draggable:{measure:D0},droppable:{measure:D0,strategy:Sc.WhileDragging,frequency:Xh.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}},cz={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:Jf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Yf,measureDroppableContainers:Jf,windowRect:null,measuringScheduled:!1},uz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Jf,draggableNodes:new Map,over:null,measureDroppableContainers:Jf},tp=Ut(uz),sw=Ut(cz);function fz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vs}}}function pz(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 mz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=cn(tp),a=Xf(o),i=Xf(n?.id);return q(()=>{if(!t&&!o&&a&&i!=null){if(!xc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=E0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function gz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function hz(e){return H(()=>({draggable:{...Yf.draggable,...e?.draggable},droppable:{...Yf.droppable,...e?.droppable},dragOverlay:{...Yf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function vz(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=Y0(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=J0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var lw=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 dw=ce(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=lz,collisionDetection:f=SB,measuring:p,modifiers:m,...h}=t,g=ri(pz,void 0,fz),[v,x]=g,[y,C]=vB(),[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:dz,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]),be=hz(p),{droppableRects:ue,measureDroppableContainers:Be,measuringScheduled:ge}=XB(De,{dragging:S,dependencies:[T.x,T.y],config:be.droppable}),le=jB(I,L),we=H(()=>O?yc(O):null,[O]),ye=se(),te=YB(le,be.draggable.measure);vz({activeNode:L!=null?I.get(L):null,config:ye.layoutShiftCompensation,initialRect:te,measure:be.draggable.measure});let Te=$0(le,be.draggable.measure,te),dt=$0(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=sz({measure:be.dragOverlay.measure}),Vt=(o=at.nodeRef.current)!=null?o:le,it=S?(r=at.rect)!=null?r:Te:null,Me=!!(at.nodeRef.current&&at.rect),Oe=ez(Me?null:Te),Ue=iw(Vt?Lo(Vt):null),et=tz(S?lt??le:null),Ee=az(et),Ce=gz(m,{transform:{x:T.x-Oe.x,y:T.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:O,active:R,activeNodeRect:Te,containerNodeRect:dt,draggingNodeRect:it,over:ct.current.over,overlayNodeRect:at.rect,scrollableAncestors:et,scrollableAncestorRects:Ee,windowRect:Ue}),ht=we?ps(we,T):null,Wt=nz(et),fn=U0(Wt),Ft=U0(Wt,[Te]),en=ps(Ce,fn),tn=it?LB(it,Ce):null,Rt=R&&tn?f({active:R,collisionRect:tn,droppableRects:ue,droppableContainers:De,pointerCoordinates:ht}):null,Un=Jh(Rt,"id"),[kn,pn]=G(null),Pn=Me?Ce:ps(Ce,Ft),Pt=wB(Pn,(a=kn?.rect)!=null?a:null,Te),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=QB(c,io);oz(c),ar(()=>{Te&&w===vi.Initializing&&k(vi.Initialized)},[Te,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]),VB({...ye,delta:T,draggingRect:tn,pointerCoordinates:ht,scrollableAncestors:et,scrollableAncestorRects:Ee});let D=H(()=>({active:R,activeNode:le,activeNodeRect:Te,activatorEvent:O,collisions:Rt,containerNodeRect:dt,dragOverlay:at,draggableNodes:I,droppableContainers:A,droppableRects:ue,over:kn,measureDroppableContainers:Be,scrollableAncestors:et,scrollableAncestorRects:Ee,measuringConfiguration:be,measuringScheduled:ge,windowRect:Ue}),[R,le,Te,O,Rt,dt,at,I,A,ue,kn,Be,et,Ee,be,ge,Ue]),X=H(()=>({activatorEvent:O,activators:Gt,active:R,activeNodeRect:Te,ariaDescribedById:{draggable:W},dispatch:x,draggableNodes:I,over:kn,measureDroppableContainers:Be}),[O,Gt,R,Te,x,W,I,kn,Be]);return mn.createElement(V0.Provider,{value:C},mn.createElement(tp.Provider,{value:X},mn.createElement(sw.Provider,{value:D},mn.createElement(lw.Provider,{value:Pt},d)),mn.createElement(mz,{disabled:s?.restoreFocus===!1})),mn.createElement(CB,{...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}}}),xz=Ut(null),q0="button",yz="Draggable";function cw(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=fs(yz),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=cn(tp),{role:m=q0,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=cn(v?lw:xz),[y,C]=vc(),[w,k]=vc(),S=rz(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===q0?!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 uw(){return cn(sw)}var Cz="Droppable",bz={timeout:25};function fw(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=fs(Cz),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=cn(tp),c=_({disabled:n}),f=_(!1),p=_(null),m=_(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...bz,...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=ep({callback:y,disabled:h||!i}),w=$((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[k,S]=vc(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 pw(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Iz(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function np(e){return e!==null&&e>=0}function Sz(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 wz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var mw=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=pw(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 op={scaleX:1,scaleY:1},gw=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,...op}:null}let l=Tz(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...op}:r<n&&r>=i?{x:0,y:s.height+l,...op}:{x:0,y:0,...op}};function Tz(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 hw="Sortable",vw=mn.createContext({activeIndex:-1,containerId:hw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mw,disabled:{draggable:!1,droppable:!1}});function xw(e){let{children:t,id:n,items:o,strategy:r=mw,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=uw(),f=fs(hw,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=!Sz(m,x.current),C=v!==-1&&g===-1||y,w=wz(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:Iz(m,l),strategy:r}),[g,f,w.draggable,w.droppable,C,m,v,l,p,r]);return mn.createElement(vw.Provider,{value:k},t)}var Lz=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return pw(n,o,r).indexOf(t)},kz=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},Pz={duration:200,easing:"ease"},yw="transform",Ez=hi.Transition.toString({property:yw,duration:0,easing:"linear"}),Az={roleDescription:"sortable"};function Mz(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 Cw(e){let{animateLayoutChanges:t=kz,attributes:n,disabled:o,data:r,getNewIndex:a=Lz,id:i,strategy:s,resizeObserverConfig:l,transition:d=Pz}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=cn(vw),C=Rz(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}=fw({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}=cw({id:i,data:k,attributes:{...Az,...n},disabled:C.draggable}),De=L0(A,z),be=!!E,ue=be&&!h&&np(p)&&np(v),Be=!x&&O,ge=Be&&ue?W:null,we=ue?ge??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:w}):null,ye=np(p)&&np(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,te=E?.id,Te=_({activeId:te,items:c,newIndex:ye,containerId:f}),dt=c!==Te.current.items,ct=t({active:E,containerId:f,isDragging:O,isSorting:be,id:i,index:w,items:c,newIndex:Te.current.newIndex,previousItems:Te.current.items,previousContainerId:Te.current.containerId,transition:d,wasDragging:Te.current.activeId!=null}),lt=Mz({disabled:!ct,index:w,node:I,rect:L});return q(()=>{be&&Te.current.newIndex!==ye&&(Te.current.newIndex=ye),f!==Te.current.containerId&&(Te.current.containerId=f),c!==Te.current.items&&(Te.current.items=c)},[be,ye,f,c]),q(()=>{if(te===Te.current.activeId)return;if(te!=null&&Te.current.activeId==null){Te.current.activeId=te;return}let Vt=setTimeout(()=>{Te.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:be,isDragging:O,listeners:U,node:I,overIndex:v,over:ne,setNodeRef:De,setActivatorNodeRef:ee,setDroppableNodeRef:A,setDraggableNodeRef:z,transform:lt??we,transition:at()};function at(){if(lt||dt&&Te.current.newIndex===w)return Ez;if(!(Be&&!xc(N)||!d)&&(be||ct))return hi.Transition.toString({...d,property:yw})}}function Rz(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 rp(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 Nz=[mt.Down,mt.Right,mt.Up,mt.Left],bw=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(Nz.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=X0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=Jh(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=wc(h).some((S,L)=>s[L]!==S),x=Iw(f,p),y=_z(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 Iw(e,t){return!rp(e)||!rp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function _z(e,t){return!rp(e)||!rp(t)||!Iw(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Dz(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 Sw=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:Dz(n,t,r)},ww=e=>{let{transform:t}=e;return{...t,x:0}};pe();pe();var ap={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function Tw(e){return`(min-width: ${typeof e=="number"?e:ap[e]}px)`}function Lw(e){return`(max-width: ${(typeof e=="number"?e:ap[e])-1}px)`}function Oz(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(Tw(e.min)),e.max!=null&&n.push(Lw(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 ap&&t.push(Lw(o))}else n in ap&&t.push(Tw(n));return t.length>0?t.join(" and "):e}function Fz(){return!1}function ip(e){let t=Oz(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,Fz)}pe();var fo=new Map;function Bz(e,t,n){return`${e}\0${t}\0${n??"none"}`}function Zh(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 zz(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 sp(){queueMicrotask(()=>zz())}function kw(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Bz(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 Pw(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,Zh(e,n),n.listeners.add(t),sp(),()=>{n.listeners.delete(t),sp()}):()=>{}}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,Zh(e,n);for(let r of n.listeners)r()}}function lp(e){return fo.get(e)?.state}function Ew(e){let t=fo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,Zh(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}sp()}}}function dp(e){let t=fo.get(e);t&&El(e,t)}function Aw(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);sp()}function Mw({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=uo(),c=kw(n,o,e,a,i),f=Ca(E=>Pw(c.key,E),()=>lp(c.key)??c,()=>lp(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&&(dp(p),l())},[t,p,l]);let L=()=>{v||(dp(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=lp(p);if(!E||E.saving||r||S||!E.text.trim()&&E.retained.length+E.added.length===0)return;let N=Ew(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]}),dp(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(Cf,{open:!0,onOpenChange:E=>{E||L()},children:b(wf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(Sf,{children:[u(Tf,{children:d("turnQueue.editTitle")}),u(bf,{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(MI,{"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(If,{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 Rw(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 Nw(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return Rw(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function _w(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:Rw(e,t),settled:!1}}pe();pe();function $z({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 Dw({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($z,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function ev({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(_I,{open:p,onOpenChange:T=>{T||m(!1)},children:b(zI,{className:"max-w-lg",children:[b(BI,{children:[u($I,{children:a("turnQueue.stopWaiting")}),u(OI,{children:a("turnQueue.abandonDescription")})]}),b(FI,{children:[u(DI,{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(Dw,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var Hz=[ww,Sw];function Uz({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}=Cw({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 Ow({inputKey:e,entries:t,environmentId:n,unavailable:o,attachments:r,actions:a,onCancel:i}){let{t:s}=uo(),l=ip("(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=W0(Yh(Pl,{activationConstraint:{distance:5}}),Yh(kl,{coordinateGetter:bw,scrollBehavior:l?"auto":"smooth"})),I=H(()=>t.filter(O=>O.waiting),[t]),T=y?_w(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(()=>{Aw(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=Nw(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(dw,{sensors:L,collisionDetection:Q0,modifiers:Hz,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 be=A[W+(ee<W?1:0)]?.intentId??null;z(De,be)},children:u(xw,{items:A.map(O=>O.intentId),strategy:gw,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:A.map((O,ne)=>b(Uz,{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(Mw,{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 tv=220,Kz={opacity:0,transform:"translate3d(0, 4rem, 0)"},qz={opacity:0,transform:"translate3d(0, 7rem, 0)"},Fw={opacity:1,transform:"none"},Bw={transition:`transform ${tv}ms ease-in, opacity ${tv}ms ease-in`},Vz={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function $w({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?.()},tv))};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)]",Vz[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:{...Bw,...a===i.id?Kz:Fw},children:u(zw,{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:{...Bw,...a===p.id?qz:Fw},children:u(zw,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function zw({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(hh,{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(hh,{children:e.title}),e.description?u(kf,{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 Hw({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u($w,{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 Wz=["image/gif","image/jpeg","image/png","image/webp"],Gz=new Set(Wz);function nv(e){return Gz.has(e.toLowerCase())}function jz(e){return nv(e)?"image":"file"}var Qz=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function ov(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||Qz.has(t)?"text":"file"}function rv(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 av(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return jz(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var Xz=new Set(["claudeAgent","cursor","grok","dsh","acp"]),Uw=e=>Xz.has(e)?"in-session":"next-turn";function Yz(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function Jz(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function Zz(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Tc(e){return`[${Jz(Yz(e))}](${Zz(e)})`}pe();var e5=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,t5=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var n5=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),o5=/^[A-Za-z][A-Za-z0-9+.-]*:/,r5=/^[A-Za-z]:[\\/]/,a5=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function i5(e){let t=[];for(let n of e.matchAll(n5)){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=o5.test(s)&&!r5.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(t5)){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&&a5.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 Lc(e,t={}){let n=i5(e);for(let o of e.matchAll(e5)){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 s5(e){return e.replace(/\r\n/g,`
|
|
3691
|
-
`).replace(/^\n+|\n+$/g,"")}function
|
|
3692
|
-
`||e===" "||e==="\r"||e==="\uFFFC"}function
|
|
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=m5(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 Jw(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 Zw="Ask for changes, send follow-ups, or attach images";var eT="application/x-ycodium-composer-mention";function lv(e){return e.includes(eT)}function tT(e){let t=n=>lv(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(eT);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}pe();var dv=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 g5(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function h5(e){let t=g5(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 nT(e){let t=h5(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}pe();var oT=Ut(null),rT=oT.Provider;function _t(){let e=cn(oT);if(e===null)throw new Error("Composer API has not been provided.");return e}var aT=90;function iT(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function v5(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>aT?`${n.slice(0,aT)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var sT=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(Ef,{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(Rf,{className:"max-h-64 scroll-pb-6",children:u(Af,{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(Mf,{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:v5(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):iT(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:iT(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:nT(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 dT(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 lT({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:dT(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 cv=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(lT,{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(lT,{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"})})]})}),cT=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:dT(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 uT(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 cp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function fT(e){switch(e){case"image":return Yi;case"pdf":return Xi;case"text":return Qi;case"file":return _o}}var pT="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",mT=`${pT} border border-border/70 bg-accent/40 text-foreground`,x5=`${mT} text-[12px]`,yi=`${mT} text-[0.86em] select-none`,up="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",gT="truncate leading-tight",na="block self-center truncate leading-tight select-none",hT=`${pT} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,vT='<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>',fp="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 y5(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 C5({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:fp,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:y5(e,o.formatLabel,o.formatSourceLabel)})]})}function xT({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(C5,{context:o,onRemove:t},o.id))})}function yT({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:fp,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 pp(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 CT({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(pp,{icon:u(Yr,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(pp,{icon:u(Fd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(pp,{icon:u(Jr,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(pp,{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:cp(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 bT(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function IT(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function ST(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=bT(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&IT(o,{hasWideActions:t})}}var uv={};Mn(uv,{LexicalComposerContext:()=>wT,createLexicalComposerContext:()=>b5,useLexicalComposerContext:()=>I5});pe();var wT=Ut(null);function b5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function I5(){let e=cn(wT);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 fv=uv,TT=fv.LexicalComposerContext,LT=fv.createLexicalComposerContext,Cn=fv.useLexicalComposerContext;var Hx={};Mn(Hx,{$addUpdateTag:()=>Jp,$applyNodeReplacement:()=>Jc,$caretFromPoint:()=>Ei,$caretRangeFromSelection:()=>Zv,$cloneWithProperties:()=>_x,$cloneWithPropertiesEphemeral:()=>aH,$comparePointCaretNext:()=>Bx,$copyNode:()=>Rx,$create:()=>sH,$createLineBreakNode:()=>Bl,$createNodeSelection:()=>vx,$createParagraphNode:()=>Ra,$createPoint:()=>Ar,$createRangeSelection:()=>hk,$createRangeSelectionFromDom:()=>_$,$createTabNode:()=>Wp,$createTextNode:()=>Wn,$extendCaretToRange:()=>Ox,$findMatchingParent:()=>Nc,$getAdjacentChildCaret:()=>Wl,$getAdjacentNode:()=>Ok,$getAdjacentSiblingOrParentSiblingCaret:()=>gH,$getCaretInDirection:()=>Ai,$getCaretRange:()=>Pi,$getCaretRangeInDirection:()=>$x,$getCharacterOffsets:()=>Vv,$getChildCaret:()=>_a,$getChildCaretAtIndex:()=>Yk,$getChildCaretOrSelf:()=>Wk,$getCollapsedCaretRange:()=>Gk,$getCommonAncestor:()=>_c,$getCommonAncestorResultBranchOrder:()=>zx,$getEditor:()=>Nx,$getNearestNodeFromDOMNode:()=>Yp,$getNearestRootOrShadowRoot:()=>zk,$getNodeByKey:()=>Hn,$getNodeByKeyOrThrow:()=>$k,$getNodeFromDOMNode:()=>Tx,$getPreviousSelection:()=>Ms,$getRoot:()=>Ko,$getSelection:()=>St,$getSiblingCaret:()=>Yn,$getState:()=>Tp,$getStateChange:()=>e$,$getTextContent:()=>F$,$getTextNodeOffset:()=>Er,$getTextPointCaret:()=>ki,$getTextPointCaretSlice:()=>Yv,$getWritableNodeState:()=>ox,$hasAncestor:()=>$p,$hasUpdateTag:()=>eH,$insertNodes:()=>O$,$isBlockElementNode:()=>N$,$isChildCaret:()=>Pr,$isDecoratorNode:()=>Jt,$isEditorState:()=>H$,$isElementNode:()=>Q,$isExtendableTextPointCaret:()=>Xk,$isInlineElementOrDecoratorNode:()=>tH,$isLeafNode:()=>Y$,$isLineBreakNode:()=>ws,$isNodeCaret:()=>cH,$isNodeSelection:()=>jc,$isParagraphNode:()=>Sk,$isRangeSelection:()=>Ke,$isRootNode:()=>oo,$isRootOrShadowRoot:()=>ur,$isSiblingCaret:()=>As,$isTabNode:()=>hx,$isTextNode:()=>Ne,$isTextPointCaret:()=>Na,$isTextPointCaretSlice:()=>mH,$isTokenOrSegmented:()=>Ea,$isTokenOrTab:()=>Ii,$nodesOfType:()=>Z$,$normalizeCaret:()=>Lr,$normalizeSelection__EXPERIMENTAL:()=>Lp,$onUpdate:()=>Bk,$parseSerializedNode:()=>$$,$removeTextFromCaretRange:()=>Qk,$rewindSiblingCaret:()=>Xl,$selectAll:()=>J$,$setCompositionKey:()=>jn,$setPointFromCaret:()=>Gl,$setSelection:()=>Fo,$setSelectionFromCaretRange:()=>jk,$setState:()=>t$,$splitAtPointCaretNext:()=>xH,$splitNode:()=>nH,$updateRangeSelectionFromCaretRange:()=>Dc,ArtificialNode__DO_NOT_USE:()=>Bp,BEFORE_INPUT_COMMAND:()=>ax,BLUR_COMMAND:()=>QL,CAN_REDO_COMMAND:()=>p$,CAN_UNDO_COMMAND:()=>m$,CLEAR_EDITOR_COMMAND:()=>u$,CLEAR_HISTORY_COMMAND:()=>f$,CLICK_COMMAND:()=>RL,COLLABORATION_TAG:()=>ik,COMMAND_PRIORITY_CRITICAL:()=>W$,COMMAND_PRIORITY_EDITOR:()=>Rl,COMMAND_PRIORITY_HIGH:()=>V$,COMMAND_PRIORITY_LOW:()=>K$,COMMAND_PRIORITY_NORMAL:()=>q$,COMPOSITION_END_COMMAND:()=>lx,COMPOSITION_END_TAG:()=>ck,COMPOSITION_START_COMMAND:()=>sx,COMPOSITION_START_TAG:()=>dk,CONTROLLED_TEXT_INSERTION_COMMAND:()=>_l,COPY_COMMAND:()=>px,CUT_COMMAND:()=>mx,DELETE_CHARACTER_COMMAND:()=>zc,DELETE_LINE_COMMAND:()=>Hc,DELETE_WORD_COMMAND:()=>$c,DRAGEND_COMMAND:()=>GL,DRAGOVER_COMMAND:()=>WL,DRAGSTART_COMMAND:()=>VL,DROP_COMMAND:()=>qL,DecoratorNode:()=>Kc,ElementNode:()=>Ti,FOCUS_COMMAND:()=>jL,FORMAT_ELEMENT_COMMAND:()=>c$,FORMAT_TEXT_COMMAND:()=>Ci,HISTORIC_TAG:()=>I$,HISTORY_MERGE_TAG:()=>Ip,HISTORY_PUSH_TAG:()=>S$,INDENT_CONTENT_COMMAND:()=>l$,INPUT_COMMAND:()=>ix,INSERT_LINE_BREAK_COMMAND:()=>Ac,INSERT_PARAGRAPH_COMMAND:()=>Dv,INSERT_TAB_COMMAND:()=>s$,INTERNAL_$isBlock:()=>Ma,IS_ALL_FORMATTING:()=>D5,IS_BOLD:()=>P5,IS_CODE:()=>R5,IS_HIGHLIGHT:()=>ex,IS_ITALIC:()=>E5,IS_STRIKETHROUGH:()=>A5,IS_SUBSCRIPT:()=>N5,IS_SUPERSCRIPT:()=>_5,IS_UNDERLINE:()=>M5,KEY_ARROW_DOWN_COMMAND:()=>BL,KEY_ARROW_LEFT_COMMAND:()=>DL,KEY_ARROW_RIGHT_COMMAND:()=>NL,KEY_ARROW_UP_COMMAND:()=>FL,KEY_BACKSPACE_COMMAND:()=>$L,KEY_DELETE_COMMAND:()=>UL,KEY_DOWN_COMMAND:()=>fx,KEY_ENTER_COMMAND:()=>Mp,KEY_ESCAPE_COMMAND:()=>HL,KEY_MODIFIER_COMMAND:()=>XL,KEY_SPACE_COMMAND:()=>zL,KEY_TAB_COMMAND:()=>KL,LineBreakNode:()=>Fl,MOVE_TO_END:()=>_L,MOVE_TO_START:()=>OL,NODE_STATE_KEY:()=>j5,OUTDENT_CONTENT_COMMAND:()=>d$,PASTE_COMMAND:()=>dx,PASTE_TAG:()=>w$,ParagraphNode:()=>Hl,REDO_COMMAND:()=>ux,REMOVE_TEXT_COMMAND:()=>Ov,RootNode:()=>$l,SELECTION_CHANGE_COMMAND:()=>rx,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>i$,SELECT_ALL_COMMAND:()=>Fv,SKIP_COLLAB_TAG:()=>T$,SKIP_DOM_SELECTION_TAG:()=>lk,SKIP_SCROLL_INTO_VIEW_TAG:()=>sk,SKIP_SELECTION_FOCUS_TAG:()=>Kv,TEXT_TYPE_TO_FORMAT:()=>po,TabNode:()=>zl,TextNode:()=>ks,UNDO_COMMAND:()=>cx,addClassNamesToElement:()=>wH,buildImportMap:()=>b$,configExtension:()=>CH,createCommand:()=>je,createEditor:()=>G$,createSharedNodeState:()=>LL,createState:()=>Z5,declarePeerDependency:()=>bH,defineExtension:()=>yH,flipDirection:()=>Mi,getDOMOwnerDocument:()=>Ax,getDOMSelection:()=>Rr,getDOMSelectionFromTarget:()=>Hk,getDOMTextNode:()=>Es,getEditorPropertyFromDOMNode:()=>Xc,getNearestEditorFromDOMNode:()=>wx,getRegisteredNode:()=>Ix,getRegisteredNodeOrThrow:()=>bx,getStaticNodeConfig:()=>Zc,getTextDirection:()=>X$,getTransformSetFromKlass:()=>Tk,isBlockDomNode:()=>Qv,isCurrentlyReadOnlyMode:()=>jl,isDOMDocumentNode:()=>Pk,isDOMNode:()=>Ql,isDOMTextNode:()=>aa,isDOMUnmanaged:()=>Vk,isDocumentFragment:()=>Uk,isExactShortcutMatch:()=>At,isHTMLAnchorElement:()=>oH,isHTMLElement:()=>ko,isInlineDomNode:()=>Kk,isLexicalEditor:()=>Qp,isModifierMatch:()=>Dk,isSelectionCapturedInDecoratorInput:()=>Sx,isSelectionWithinEditor:()=>Qc,makeStepwiseIterator:()=>Fx,mergeRegister:()=>LH,normalizeClassNames:()=>eu,removeClassNamesFromElement:()=>TH,removeFromParent:()=>Si,resetRandomKey:()=>j$,safeCast:()=>IH,setDOMUnmanaged:()=>iH,setNodeIndentFromDOM:()=>qk,shallowMergeConfig:()=>SH,toggleTextFormatType:()=>Vc});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 xL(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,S5=Mr&&"documentMode"in document?document.documentMode:null,Tr=Mr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),wi=Mr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),wp=!(!Mr||!("InputEvent"in window)||S5)&&"getTargetRanges"in new window.InputEvent("input"),Up=Mr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Gc=Mr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,w5=Mr&&/Android/.test(navigator.userAgent),yL=Mr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Sv=Mr&&w5&&yL,Kp=Mr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Tr&&!yL,T5=0,L5=1,k5=2,P5=1,E5=2,A5=4,M5=8,R5=16,N5=32,_5=64,ex=128,D5=2047,O5=1,F5=2,B5=3,z5=4,$5=5,H5=6,Oc=Up||Gc||Kp?"\xA0":"\u200B",qp=`
|
|
3693
|
+
`},EB={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function MB(e){let{announcements:t=EB,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=AB}=e,{announce:a,announcement:i}=_0(),s=us("DndLiveRegion"),[l,d]=G(!1);if(q(()=>{d(!0)},[]),kB(z(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=hn.createElement(hn.Fragment,null,hn.createElement(R0,{id:o,value:r.draggable}),hn.createElement(N0,{id:s,announcement:i}));return n?(0,ms.createPortal)(c,n):c}var On;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(On||(On={}));function ep(){}function Zh(e,t){return z(()=>({sensor:e,options:t??{}}),[e,t])}function j0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>[...t].filter(o=>o!=null),[...t])}var br=Object.freeze({x:0,y:0});function Q0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function X0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function RB(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function D0(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function ev(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function O0(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Y0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=O0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=Q0(O0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(X0)},J0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=D0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=D0(l),c=r.reduce((p,m,h)=>p+Q0(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(X0)};function NB(e,t){let n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=r-o,s=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=i*s,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var _B=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:i}=a,s=n.get(i);if(s){let l=NB(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(RB)};function DB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Z0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:br}function OB(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}var FB=OB(1);function BB(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function zB(e,t,n){let o=BB(t);if(!o)return e;let{scaleX:r,scaleY:a,x:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),d=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:d,right:l+c,bottom:d+f,left:l}}var $B={ignoreTransform:!1};function vs(e,t){t===void 0&&(t=$B);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Lo(e).getComputedStyle(e);d&&(n=zB(n,d,c))}let{top:o,left:r,width:a,height:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function F0(e){return vs(e,{ignoreTransform:!0})}function HB(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function UB(e,t){return t===void 0&&(t=Lo(e).getComputedStyle(e)),t.position==="fixed"}function KB(e,t){t===void 0&&(t=Lo(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?n.test(a):!1})}function Ic(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(Xf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!bl(r)||qh(r)||n.includes(r))return n;let a=Lo(e).getComputedStyle(r);return r!==e&&KB(r,a)&&n.push(r),UB(r,a)?n:o(r.parentNode)}return e?o(e):n}function ew(e){let[t]=Ic(e,1);return t??null}function Vh(e){return!mc||!e?null:ds(e)?e:Qf(e)?Xf(e)||e===cs(e).scrollingElement?window:bl(e)?e:null:null}function tw(e){return ds(e)?e.scrollX:e.scrollLeft}function nw(e){return ds(e)?e.scrollY:e.scrollTop}function jh(e){return{x:tw(e),y:nw(e)}}var Gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Gn||(Gn={}));function ow(e){return!mc||!e?!1:e===document.scrollingElement}function rw(e){let t={x:0,y:0},n=ow(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=o.y,s=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:i,isRight:s,maxScroll:o,minScroll:t}}var qB={x:.2,y:.2};function VB(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=qB);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=rw(e),m={x:0,y:0},h={x:0,y:0},g={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+g.height?(m.y=Gn.Backward,h.y=o*Math.abs((t.top+g.height-a)/g.height)):!c&&l>=t.bottom-g.height&&(m.y=Gn.Forward,h.y=o*Math.abs((t.bottom-g.height-l)/g.height)),!p&&s>=t.right-g.width?(m.x=Gn.Forward,h.x=o*Math.abs((t.right-g.width-s)/g.width)):!f&&i<=t.left+g.width&&(m.x=Gn.Backward,h.x=o*Math.abs((t.left+g.width-i)/g.width)),{direction:m,speed:h}}function WB(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function aw(e){return e.reduce((t,n)=>fs(t,jh(n)),br)}function GB(e){return e.reduce((t,n)=>t+tw(n),0)}function jB(e){return e.reduce((t,n)=>t+nw(n),0)}function QB(e,t){if(t===void 0&&(t=vs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);ew(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var XB=[["x",["left","right"],GB],["y",["top","bottom"],jB]],yc=class{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let o=Ic(n),r=aw(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of XB)for(let l of i)Object.defineProperty(this,l,{get:()=>{let d=s(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},gs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}};function YB(e){let{EventTarget:t}=Lo(e);return e instanceof t?e:cs(e)}function Wh(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var ar;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ar||(ar={}));function B0(e){e.preventDefault()}function JB(e){e.stopPropagation()}var mt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(mt||(mt={}));var iw={start:[mt.Space,mt.Enter],cancel:[mt.Esc],end:[mt.Space,mt.Enter,mt.Tab]},ZB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case mt.Right:return{...n,x:n.x+25};case mt.Left:return{...n,x:n.x-25};case mt.Down:return{...n,y:n.y+25};case mt.Up:return{...n,y:n.y-25}}},wl=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:n}}=t;this.props=t,this.listeners=new gs(cs(n)),this.windowListeners=new gs(Lo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ar.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&QB(o),n(br)}handleKeyDown(t){if(hc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=iw,coordinateGetter:i=ZB,scrollBehavior:s="smooth"}=r,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:d}=o.current,c=d?{x:d.left,y:d.top}:br;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=ps(f,c),m={x:0,y:0},{scrollableAncestors:h}=o.current;for(let g of h){let v=t.code,{isTop:x,isRight:y,isLeft:C,isBottom:w,maxScroll:k,minScroll:S}=rw(g),L=WB(g),I={x:Math.min(v===mt.Right?L.right-L.width/2:L.right,Math.max(v===mt.Right?L.left:L.left+L.width/2,f.x)),y:Math.min(v===mt.Down?L.bottom-L.height/2:L.bottom,Math.max(v===mt.Down?L.top:L.top+L.height/2,f.y))},T=v===mt.Right&&!y||v===mt.Left&&!C,E=v===mt.Down&&!w||v===mt.Up&&!x;if(T&&I.x!==f.x){let A=g.scrollLeft+p.x,N=v===mt.Right&&A<=k.x||v===mt.Left&&A>=S.x;if(N&&!p.y){g.scrollTo({left:A,behavior:s});return}N?m.x=g.scrollLeft-A:m.x=v===mt.Right?g.scrollLeft-k.x:g.scrollLeft-S.x,m.x&&g.scrollBy({left:-m.x,behavior:s});break}else if(E&&I.y!==f.y){let A=g.scrollTop+p.y,N=v===mt.Down&&A<=k.y||v===mt.Up&&A>=S.y;if(N&&!p.x){g.scrollTo({top:A,behavior:s});return}N?m.y=g.scrollTop-A:m.y=v===mt.Down?g.scrollTop-k.y:g.scrollTop-S.y,m.y&&g.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,fs(ps(f,this.referenceCoordinates),m))}}}handleMove(t,n){let{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){let{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){let{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};wl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=iw,onActivation:r}=t,{active:a}=n,{code:i}=e.nativeEvent;if(o.start.includes(i)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function z0(e){return!!(e&&"distance"in e)}function $0(e){return!!(e&&"delay"in e)}var Cc=class{constructor(t,n,o){var r;o===void 0&&(o=YB(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;let{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=cs(i),this.documentListeners=new gs(this.document),this.listeners=new gs(o),this.windowListeners=new gs(Lo(i)),this.initialCoordinates=(r=vc(a))!=null?r:br,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.DragStart,B0),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),this.windowListeners.add(ar.ContextMenu,B0),this.documentListeners.add(ar.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(z0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){let{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ar.Click,JB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ar.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=(n=vc(t))!=null?n:br,d=ps(r,l);if(!o&&s){if(z0(s)){if(s.tolerance!=null&&Wh(d,s.tolerance))return this.handleCancel();if(Wh(d,s.distance))return this.handleStart()}if($0(s)&&Wh(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){let{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){let{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===mt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},ez={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Tl=class extends Cc{constructor(t){let{event:n}=t,o=cs(n.target);super(t,ez,o)}};Tl.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];var tz={move:{name:"mousemove"},end:{name:"mouseup"}},Qh;(function(e){e[e.RightClick=2]="RightClick"})(Qh||(Qh={}));var Xh=class extends Cc{constructor(t){super(t,tz,cs(t.event.target))}};Xh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Qh.RightClick?!1:(o?.({event:n}),!0)}}];var Gh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Yh=class extends Cc{constructor(t){super(t,Gh)}static setup(){return window.addEventListener(Gh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Gh.move.name,t)};function t(){}}};Yh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var xc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(xc||(xc={}));var tp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(tp||(tp={}));function nz(e){let{acceleration:t,activator:n=xc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=tp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=rz({delta:f,disabled:!a}),[h,g]=A0(),v=_({x:0,y:0}),x=_({x:0,y:0}),y=z(()=>{switch(n){case xc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case xc.DraggableRect:return r}},[n,r,l]),C=_(null),w=B(()=>{let S=C.current;if(!S)return;let L=v.current.x*x.current.x,I=v.current.y*x.current.y;S.scrollBy(L,I)},[]),k=z(()=>s===tp.TreeOrder?[...d].reverse():d,[s,d]);q(()=>{if(!a||!d.length||!y){g();return}for(let S of k){if(o?.(S)===!1)continue;let L=d.indexOf(S),I=c[L];if(!I)continue;let{direction:T,speed:E}=VB(S,I,y,t,p);for(let A of["x","y"])m[A][T[A]]||(E[A]=0,T[A]=0);if(E.x>0||E.y>0){g(),C.current=S,h(w,i),v.current=E,x.current=T;return}}v.current={x:0,y:0},x.current={x:0,y:0},g()},[t,w,o,g,a,i,JSON.stringify(y),JSON.stringify(m),h,d,k,c,JSON.stringify(p)])}var oz={x:{[Gn.Backward]:!1,[Gn.Forward]:!1},y:{[Gn.Backward]:!1,[Gn.Forward]:!1}};function rz(e){let{delta:t,disabled:n}=e,o=Jf(t);return Sl(r=>{if(n||!o||!r)return oz;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Gn.Backward]:r.x[Gn.Backward]||a.x===-1,[Gn.Forward]:r.x[Gn.Forward]||a.x===1},y:{[Gn.Backward]:r.y[Gn.Backward]||a.y===-1,[Gn.Forward]:r.y[Gn.Forward]||a.y===1}}},[n,t,o])}function az(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Sl(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function iz(e,t){return z(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,o)}));return[...n,...a]},[]),[e,t])}var bc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(bc||(bc={}));var Jh;(function(e){e.Optimized="optimized"})(Jh||(Jh={}));var H0=new Map;function sz(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=G(null),{frequency:s,measure:l,strategy:d}=r,c=_(e),f=v(),p=Il(f),m=B(function(x){x===void 0&&(x=[]),!p.current&&i(y=>y===null?x:y.concat(x.filter(C=>!y.includes(C))))},[p]),h=_(null),g=Sl(x=>{if(f&&!n)return H0;if(!x||x===H0||c.current!==e||a!=null){let y=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){y.set(C.id,C.rect.current);continue}let w=C.node.current,k=w?new yc(l(w),w):null;C.rect.current=k,k&&y.set(C.id,k)}return y}return x},[e,a,n,f,l]);return q(()=>{c.current=e},[e]),q(()=>{f||m()},[n,f]),q(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),q(()=>{f||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...o]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case bc.Always:return!1;case bc.BeforeDragging:return n;default:return!n}}}function sw(e,t){return Sl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lz(e,t){return sw(e,t)}function dz(e){let{callback:t,disabled:n}=e,o=Yf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return q(()=>()=>r?.disconnect(),[r]),r}function np(e){let{callback:t,disabled:n}=e,o=Yf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return q(()=>()=>r?.disconnect(),[r]),r}function cz(e){return new yc(vs(e),e)}function U0(e,t,n){t===void 0&&(t=cz);let[o,r]=G(null);function a(){r(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}let i=dz({callback(l){if(e)for(let d of l){let{type:c,target:f}=d;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),s=np({callback:a});return rr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function uz(e){let t=sw(e);return Z0(e,t)}var K0=[];function fz(e){let t=_(e),n=Sl(o=>e?o&&o!==K0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Ic(e):K0,[e]);return q(()=>{t.current=e},[e]),n}function pz(e){let[t,n]=G(null),o=_(e),r=B(a=>{let i=Vh(a.target);i&&n(s=>s?(s.set(i,jh(i)),new Map(s)):null)},[]);return q(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Vh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,jh(d)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),o.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{let d=Vh(l);d?.removeEventListener("scroll",r)})}},[r,e]),z(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>fs(a,i),br):aw(e):br,[e,t])}function q0(e,t){t===void 0&&(t=[]);let n=_(null);return q(()=>{n.current=null},t),q(()=>{let o=e!==br;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ps(e,n.current):br}function mz(e){q(()=>{if(!mc)return;let t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(let n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function gz(e,t){return z(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function lw(e){return z(()=>e?HB(e):null,[e])}var V0=[];function hz(e,t){t===void 0&&(t=vs);let[n]=e,o=lw(n?Lo(n):null),[r,a]=G(V0);function i(){a(()=>e.length?e.map(l=>ow(l)?o:new yc(t(l),l)):V0)}let s=np({callback:i});return rr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function vz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return bl(t)?t:e}function xz(e){let{measure:t}=e,[n,o]=G(null),r=B(d=>{for(let{target:c}of d)if(bl(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=np({callback:r}),i=B(d=>{let c=vz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=gc(i);return z(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var yz=[{sensor:Tl,options:{}},{sensor:wl,options:{}}],Cz={current:{}},Zf={draggable:{measure:F0},droppable:{measure:F0,strategy:bc.WhileDragging,frequency:Jh.Optimized},dragOverlay:{measure:vs}},hs=class extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}},bz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ep},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Zf,measureDroppableContainers:ep,windowRect:null,measuringScheduled:!1},Iz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ep,draggableNodes:new Map,over:null,measureDroppableContainers:ep},op=Ht(Iz),dw=Ht(bz);function Sz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hs}}}function wz(e,t){switch(t.type){case On.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case On.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case On.DragEnd:case On.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case On.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new hs(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case On.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let i=new hs(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case On.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new hs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Tz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=fn(op),a=Jf(o),i=Jf(n?.id);return q(()=>{if(!t&&!o&&a&&i!=null){if(!hc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=M0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function Lz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function kz(e){return z(()=>({draggable:{...Zf.draggable,...e?.draggable},droppable:{...Zf.droppable,...e?.droppable},dragOverlay:{...Zf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Pz(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=_(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;rr(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!o)return;let d=t?.node.current;if(!d||d.isConnected===!1)return;let c=n(d),f=Z0(c,o);if(i||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=ew(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var cw=Ht({...br,scaleX:1,scaleY:1}),fi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fi||(fi={}));var uw=ue(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=yz,collisionDetection:f=_B,measuring:p,modifiers:m,...h}=t,g=Za(wz,void 0,Sz),[v,x]=g,[y,C]=PB(),[w,k]=G(fi.Uninitialized),S=w===fi.Initialized,{draggable:{active:L,nodes:I,translate:T},droppable:{containers:E}}=v,A=L!=null?I.get(L):null,N=_({initial:null,translated:null}),R=z(()=>{var ie;return L!=null?{id:L,data:(ie=A?.data)!=null?ie:Cz,rect:N}:null},[L,A]),$=_(null),[H,K]=G(null),[O,oe]=G(null),ee=Il(h,Object.values(h)),W=us("DndDescribedBy",i),qe=z(()=>E.getEnabled(),[E]),ve=kz(p),{droppableRects:fe,measureDroppableContainers:Ne,measuringScheduled:Ae}=sz(qe,{dragging:S,dependencies:[T.x,T.y],config:ve.droppable}),ae=az(I,L),Ee=z(()=>O?vc(O):null,[O]),xe=ce(),re=lz(ae,ve.draggable.measure);Pz({activeNode:L!=null?I.get(L):null,config:xe.layoutShiftCompensation,initialRect:re,measure:ve.draggable.measure});let Ie=U0(ae,ve.draggable.measure,re),st=U0(ae?ae.parentElement:null),dt=_({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=E.getNodeFor((n=dt.current.over)==null?void 0:n.id),ct=xz({measure:ve.dragOverlay.measure}),Et=(o=ct.nodeRef.current)!=null?o:ae,ot=S?(r=ct.rect)!=null?r:Ie:null,He=!!(ct.nodeRef.current&&ct.rect),Se=uz(He?null:Ie),ze=lw(Et?Lo(Et):null),Je=fz(S?lt??ae:null),qt=hz(Je),X=Lz(m,{transform:{x:T.x-Se.x,y:T.y-Se.y,scaleX:1,scaleY:1},activatorEvent:O,active:R,activeNodeRect:Ie,containerNodeRect:st,draggingNodeRect:ot,over:dt.current.over,overlayNodeRect:ct.rect,scrollableAncestors:Je,scrollableAncestorRects:qt,windowRect:ze}),nn=Ee?fs(Ee,T):null,xt=pz(Je),mn=q0(xt),Tt=q0(xt,[Ie]),Yt=fs(X,mn),Jt=ot?FB(ot,X):null,Mt=R&&Jt?f({active:R,collisionRect:Jt,droppableRects:fe,droppableContainers:qe,pointerCoordinates:nn}):null,zn=ev(Mt,"id"),[kn,vn]=G(null),$n=He?X:fs(X,Tt),Vt=DB($n,(a=kn?.rect)!=null?a:null,Ie),Zt=_(null),Sn=B((ie,pe)=>{let{sensor:Ze,options:pt}=pe;if($.current==null)return;let xn=I.get($.current);if(!xn)return;let ht=ie.nativeEvent,en=new Ze({active:$.current,activeNode:xn,event:ht,options:pt,context:dt,onAbort(bt){if(!I.get(bt))return;let{onDragAbort:sn}=ee.current,ge={id:bt};sn?.(ge),y({type:"onDragAbort",event:ge})},onPending(bt,yn,sn,ge){if(!I.get(bt))return;let{onDragPending:rt}=ee.current,Lt={id:bt,constraint:yn,initialCoordinates:sn,offset:ge};rt?.(Lt),y({type:"onDragPending",event:Lt})},onStart(bt){let yn=$.current;if(yn==null)return;let sn=I.get(yn);if(!sn)return;let{onDragStart:ge}=ee.current,Rt={activatorEvent:ht,active:{id:yn,data:sn.data,rect:N}};(0,ms.unstable_batchedUpdates)(()=>{ge?.(Rt),k(fi.Initializing),x({type:On.DragStart,initialCoordinates:bt,active:yn}),y({type:"onDragStart",event:Rt}),K(Zt.current),oe(ht)})},onMove(bt){x({type:On.DragMove,coordinates:bt})},onEnd:tn(On.DragEnd),onCancel:tn(On.DragCancel)});Zt.current=en;function tn(bt){return async function(){let{active:sn,collisions:ge,over:Rt,scrollAdjustedTranslate:rt}=dt.current,Lt=null;if(sn&&rt){let{cancelDrop:et}=ee.current;Lt={activatorEvent:ht,active:sn,collisions:ge,delta:rt,over:Rt},bt===On.DragEnd&&typeof et=="function"&&await Promise.resolve(et(Lt))&&(bt=On.DragCancel)}$.current=null,(0,ms.unstable_batchedUpdates)(()=>{x({type:bt}),k(fi.Uninitialized),vn(null),K(null),oe(null),Zt.current=null;let et=bt===On.DragEnd?"onDragEnd":"onDragCancel";if(Lt){let Nt=ee.current[et];Nt?.(Lt),y({type:et,event:Lt})}})}}},[I]),ho=B((ie,pe)=>(Ze,pt)=>{let xn=Ze.nativeEvent,ht=I.get(pt);if($.current!==null||!ht||xn.dndKit||xn.defaultPrevented)return;let en={active:ht};ie(Ze,pe.options,en)===!0&&(xn.dndKit={capturedBy:pe.sensor},$.current=pt,Sn(Ze,pe))},[I,Sn]),zt=iz(c,ho);mz(c),rr(()=>{Ie&&w===fi.Initializing&&k(fi.Initialized)},[Ie,w]),q(()=>{let{onDragMove:ie}=ee.current,{active:pe,activatorEvent:Ze,collisions:pt,over:xn}=dt.current;if(!pe||!Ze)return;let ht={active:pe,activatorEvent:Ze,collisions:pt,delta:{x:Yt.x,y:Yt.y},over:xn};(0,ms.unstable_batchedUpdates)(()=>{ie?.(ht),y({type:"onDragMove",event:ht})})},[Yt.x,Yt.y]),q(()=>{let{active:ie,activatorEvent:pe,collisions:Ze,droppableContainers:pt,scrollAdjustedTranslate:xn}=dt.current;if(!ie||$.current==null||!pe||!xn)return;let{onDragOver:ht}=ee.current,en=pt.get(zn),tn=en&&en.rect.current?{id:en.id,rect:en.rect.current,data:en.data,disabled:en.disabled}:null,bt={active:ie,activatorEvent:pe,collisions:Ze,delta:{x:xn.x,y:xn.y},over:tn};(0,ms.unstable_batchedUpdates)(()=>{vn(tn),ht?.(bt),y({type:"onDragOver",event:bt})})},[zn]),rr(()=>{dt.current={activatorEvent:O,active:R,activeNode:ae,collisionRect:Jt,collisions:Mt,droppableRects:fe,draggableNodes:I,draggingNode:Et,draggingNodeRect:ot,droppableContainers:E,over:kn,scrollableAncestors:Je,scrollAdjustedTranslate:Yt},N.current={initial:ot,translated:Jt}},[R,ae,Mt,Jt,I,Et,ot,fe,E,kn,Je,Yt]),nz({...xe,delta:T,draggingRect:Jt,pointerCoordinates:nn,scrollableAncestors:Je,scrollableAncestorRects:qt});let D=z(()=>({active:R,activeNode:ae,activeNodeRect:Ie,activatorEvent:O,collisions:Mt,containerNodeRect:st,dragOverlay:ct,draggableNodes:I,droppableContainers:E,droppableRects:fe,over:kn,measureDroppableContainers:Ne,scrollableAncestors:Je,scrollableAncestorRects:qt,measuringConfiguration:ve,measuringScheduled:Ae,windowRect:ze}),[R,ae,Ie,O,Mt,st,ct,I,E,fe,kn,Ne,Je,qt,ve,Ae,ze]),Y=z(()=>({activatorEvent:O,activators:zt,active:R,activeNodeRect:Ie,ariaDescribedById:{draggable:W},dispatch:x,draggableNodes:I,over:kn,measureDroppableContainers:Ne}),[O,zt,R,Ie,x,W,I,kn,Ne]);return hn.createElement(G0.Provider,{value:C},hn.createElement(op.Provider,{value:Y},hn.createElement(dw.Provider,{value:D},hn.createElement(cw.Provider,{value:Vt},d)),hn.createElement(Tz,{disabled:s?.restoreFocus===!1})),hn.createElement(MB,{...s,hiddenTextDescribedById:W}));function ce(){let ie=H?.autoScrollEnabled===!1,pe=typeof l=="object"?l.enabled===!1:l===!1,Ze=S&&!ie&&!pe;return typeof l=="object"?{...l,enabled:Ze}:{enabled:Ze}}}),Az=Ht(null),W0="button",Ez="Draggable";function fw(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=us(Ez),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=fn(op),{role:m=W0,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=fn(v?cw:Az),[y,C]=gc(),[w,k]=gc(),S=gz(i,t),L=Il(n);rr(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:w,data:L}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let I=z(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":v&&m===W0?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[o,m,g,v,h,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:v,listeners:o?void 0:S,node:y,over:p,setNodeRef:C,setActivatorNodeRef:k,transform:x}}function pw(){return fn(dw)}var Mz="Droppable",Rz={timeout:25};function mw(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=us(Mz),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=fn(op),c=_({disabled:n}),f=_(!1),p=_(null),m=_(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Rz,...r},x=Il(g??o),y=B(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),m.current=null},v)},[v]),C=np({callback:y,disabled:h||!i}),w=B((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[k,S]=gc(w),L=Il(t);return q(()=>{!C||!k.current||(C.disconnect(),f.current=!1,C.observe(k.current))},[k,C]),q(()=>(s({type:On.RegisterDroppable,element:{id:o,key:a,disabled:n,node:k,rect:p,data:L}}),()=>s({type:On.UnregisterDroppable,key:a,id:o})),[o]),q(()=>{n!==c.current.disabled&&(s({type:On.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,s]),{active:i,rect:p,isOver:l?.id===o,node:k,over:l,setNodeRef:S}}me();function gw(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Nz(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function rp(e){return e!==null&&e>=0}function _z(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Dz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var hw=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=gw(t,o,n),i=t[r],s=a[r];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}};var ap={scaleX:1,scaleY:1},vw=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e,s=(t=a[n])!=null?t:o;if(!s)return null;if(r===n){let d=a[i];return d?{x:0,y:n<i?d.top+d.height-(s.top+s.height):d.top-s.top,...ap}:null}let l=Oz(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...ap}:r<n&&r>=i?{x:0,y:s.height+l,...ap}:{x:0,y:0,...ap}};function Oz(e,t,n){let o=e[t],r=e[t-1],a=e[t+1];return o?n<t?r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0:a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0:0}var xw="Sortable",yw=hn.createContext({activeIndex:-1,containerId:xw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hw,disabled:{draggable:!1,droppable:!1}});function Cw(e){let{children:t,id:n,items:o,strategy:r=hw,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=pw(),f=us(xw,n),p=s.rect!==null,m=z(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),h=i!=null,g=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,x=_(m),y=!_z(m,x.current),C=v!==-1&&g===-1||y,w=Dz(a);rr(()=>{y&&h&&c(m)},[y,m,h,c]),q(()=>{x.current=m},[m]);let k=z(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:Nz(m,l),strategy:r}),[g,f,w.draggable,w.droppable,C,m,v,l,p,r]);return hn.createElement(yw.Provider,{value:k},t)}var Fz=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return gw(n,o,r).indexOf(t)},Bz=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!o||s!==a&&r===i?!1:n?!0:i!==r&&t===l},zz={duration:200,easing:"ease"},bw="transform",$z=ui.Transition.toString({property:bw,duration:0,easing:"linear"}),Hz={roleDescription:"sortable"};function Uz(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=G(null),s=_(n);return rr(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=vs(o.current,{ignoreTransform:!0}),c={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(c.x||c.y)&&i(c)}}n!==s.current&&(s.current=n)},[t,n,o,r]),q(()=>{a&&i(null)},[a]),a}function Iw(e){let{animateLayoutChanges:t=Bz,attributes:n,disabled:o,data:r,getNewIndex:a=Fz,id:i,strategy:s,resizeObserverConfig:l,transition:d=zz}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=fn(yw),C=Kz(o,m),w=c.indexOf(i),k=z(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=z(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:I,isOver:T,setNodeRef:E}=mw({id:i,data:k,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:A,activatorEvent:N,activeNodeRect:R,attributes:$,setNodeRef:H,listeners:K,isDragging:O,over:oe,setActivatorNodeRef:ee,transform:W}=fw({id:i,data:k,attributes:{...Hz,...n},disabled:C.draggable}),qe=P0(E,H),ve=!!A,fe=ve&&!h&&rp(p)&&rp(v),Ne=!x&&O,Ae=Ne&&fe?W:null,Ee=fe?Ae??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:w}):null,xe=rp(p)&&rp(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,re=A?.id,Ie=_({activeId:re,items:c,newIndex:xe,containerId:f}),st=c!==Ie.current.items,dt=t({active:A,containerId:f,isDragging:O,isSorting:ve,id:i,index:w,items:c,newIndex:Ie.current.newIndex,previousItems:Ie.current.items,previousContainerId:Ie.current.containerId,transition:d,wasDragging:Ie.current.activeId!=null}),lt=Uz({disabled:!dt,index:w,node:I,rect:L});return q(()=>{ve&&Ie.current.newIndex!==xe&&(Ie.current.newIndex=xe),f!==Ie.current.containerId&&(Ie.current.containerId=f),c!==Ie.current.items&&(Ie.current.items=c)},[ve,xe,f,c]),q(()=>{if(re===Ie.current.activeId)return;if(re!=null&&Ie.current.activeId==null){Ie.current.activeId=re;return}let Et=setTimeout(()=>{Ie.current.activeId=re},50);return()=>clearTimeout(Et)},[re]),{active:A,activeIndex:p,attributes:$,data:k,rect:L,index:w,newIndex:xe,items:c,isOver:T,isSorting:ve,isDragging:O,listeners:K,node:I,overIndex:v,over:oe,setNodeRef:qe,setActivatorNodeRef:ee,setDroppableNodeRef:E,setDraggableNodeRef:H,transform:lt??Ee,transition:ct()};function ct(){if(lt||st&&Ie.current.newIndex===w)return $z;if(!(Ne&&!hc(N)||!d)&&(ve||dt))return ui.Transition.toString({...d,property:bw})}}function Kz(e,t){var n,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function ip(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var qz=[mt.Down,mt.Right,mt.Up,mt.Left],Sw=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(qz.includes(e.code)){if(e.preventDefault(),!n||!o)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let p=r.get(f.id);if(p)switch(e.code){case mt.Down:o.top<p.top&&l.push(f);break;case mt.Up:o.top>p.top&&l.push(f);break;case mt.Left:o.left>p.left&&l.push(f);break;case mt.Right:o.left<p.left&&l.push(f);break}});let d=J0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=ev(d,"id");if(c===i?.id&&d.length>1&&(c=d[1].id),c!=null){let f=a.get(n.id),p=a.get(c),m=p?r.get(p.id):null,h=p?.node.current;if(h&&m&&f&&p){let v=Ic(h).some((S,L)=>s[L]!==S),x=ww(f,p),y=Vz(f,p),C=v||!x?{x:0,y:0}:{x:y?o.width-m.width:0,y:y?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:ps(w,C)}}}};function ww(e,t){return!ip(e)||!ip(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Vz(e,t){return!ip(e)||!ip(t)||!ww(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Wz(e,t,n){let o={...e};return t.top+e.y<=n.top?o.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(o.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?o.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(o.x=n.left+n.width-t.right),o}var Tw=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:Wz(n,t,r)},Lw=e=>{let{transform:t}=e;return{...t,x:0}};me();me();var sp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function kw(e){return`(min-width: ${typeof e=="number"?e:sp[e]}px)`}function Pw(e){return`(max-width: ${(typeof e=="number"?e:sp[e])-1}px)`}function Gz(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(kw(e.min)),e.max!=null&&n.push(Pw(e.max)),e.pointer==="coarse"&&n.push("(pointer: coarse)"),e.pointer==="fine"&&n.push("(pointer: fine)"),n.length===0?"(min-width: 0px)":n.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let n of e.split(":"))if(n.startsWith("max-")){let o=n.slice(4);o in sp&&t.push(Pw(o))}else n in sp&&t.push(kw(n));return t.length>0?t.join(" and "):e}function jz(){return!1}function lp(e){let t=Gz(e),n=B(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=B(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return xa(n,o,jz)}me();var uo=new Map;function Qz(e,t,n){return`${e}\0${t}\0${n??"none"}`}function tv(e,t){uo.delete(e),uo.set(e,t)}function Ll(e,t){if(uo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,uo.delete(e);for(let n of t.state.added)t.releaseUpload(n.id),URL.revokeObjectURL(n.previewUrl);for(let n of t.listeners)n()}}function Xz(e){if(uo.size<=100)return;let t=Array.from(uo);for(let[n,o]of t){if(uo.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Ll(n,o)}for(let[n,o]of t){if(uo.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Ll(n,o)}}function dp(){queueMicrotask(()=>Xz())}function Aw(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Qz(e,n.intentId,a),s=uo.get(i);if(s)return s.releaseUpload=o.releaseUpload,s.watchAuthority=r,s.state;let l={key:i,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.text??"",retained:n.management?.attachments??[],added:[],saving:!1,error:null},d={state:l,listeners:new Set,releaseUpload:o.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return uo.set(i,d),l}function Ew(e,t){let n=uo.get(e);return n?(n.releaseAuthorityWatch===void 0&&n.watchAuthority!==void 0&&(n.releaseAuthorityWatch=n.watchAuthority({threadKey:n.state.inputKey,intentId:n.state.intentId,revision:n.state.revision,onInvalid:()=>Ll(e,n)})),n.committed=!0,tv(e,n),n.listeners.add(t),dp(),()=>{n.listeners.delete(t),dp()}):()=>{}}function xs(e,t){let n=uo.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,tv(e,n);for(let r of n.listeners)r()}}function cp(e){return uo.get(e)?.state}function Mw(e){let t=uo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,tv(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Ll(e,t);return}dp()}}}function up(e){let t=uo.get(e);t&&Ll(e,t)}function Rw(e,t){let n=new Map(t.flatMap(o=>o.waiting&&o.management!==void 0?[[o.intentId,o.management.revision]]:[]));for(let[o,r]of uo)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Ll(o,r);dp()}function Nw({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=co(),c=Aw(n,o,e,a,i),f=xa(A=>Ew(c.key,A),()=>cp(c.key)??c,()=>cp(c.key)??c),{key:p,text:m,retained:h,added:g,saving:v,error:x}=f,y=_(null),C=a.useUploadStatuses(),w=z(()=>h.map(A=>A.id),[h]),k=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;q(()=>{t===void 0&&(up(p),l())},[t,p,l]);let L=()=>{v||(up(p),l())},I=A=>{if(v||r||S)return;let N=null,R=[...g];for(let $ of A){let H=$.type||"application/octet-stream";if(h.length+R.length>=a.limits.maxAttachments||$.size===0||$.size>a.maxAttachmentBytes(H)){N=d("turnQueue.attachmentLimit",{name:$.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(H))});continue}let K=a.makeImageAttachment({id:a.randomUUID(),name:$.name,mimeType:H,sizeBytes:$.size,file:$});R.push(K),a.startUpload({environmentId:o,image:K})}xs(p,$=>({...$,added:R,error:N}))},T=async()=>{let A=cp(p);if(!A||A.saving||r||S||!A.text.trim()&&A.retained.length+A.added.length===0)return;let N=Mw(p);if(N!==null){xs(p,R=>({...R,saving:!0,error:null}));try{await a.awaitUploads(A.added.map($=>$.id));let R=a.getUploadedAttachments({environmentId:o,images:A.added});if(!R)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:A.text,attachments:[...A.retained,...R]}),up(p),l()}catch(R){xs(p,$=>({...$,saving:!1,error:R instanceof Error?R.message:d("turnQueue.actionFailed")}))}finally{N()}}},E=[...h.map((A,N)=>({...A,previewUrl:k[N],added:!1})),...g.map(A=>({...A,added:!0}))];return u(If,{open:!0,onOpenChange:A=>{A||L()},children:b(Lf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(Tf,{children:[u(kf,{children:d("turnQueue.editTitle")}),u(Sf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:A=>{A.dataTransfer.types.includes("Files")&&A.preventDefault()},onDrop:A=>{A.dataTransfer.files.length&&(A.preventDefault(),A.stopPropagation(),I(Array.from(A.dataTransfer.files)))},children:[u(NI,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:A=>xs(p,N=>({...N,text:A.target.value})),onPaste:A=>{A.clipboardData.files.length&&(A.preventDefault(),I(Array.from(A.clipboardData.files)))},onKeyDown:A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&!A.nativeEvent.isComposing&&(A.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:E.map(A=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[A.type==="image"&&A.previewUrl?u("img",{src:A.previewUrl,alt:A.name,className:"size-12 rounded object-cover"}):u(Ro,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:A.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(A.sizeBytes)}),A.added&&C.get(A.id)!=="ready"?u("p",{children:d(C.get(A.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,A.added&&C.get(A.id)==="failed"?u(te,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let N=g.find(R=>R.id===A.id);N&&a.retryUpload({environmentId:o,image:N})},children:d("turnQueue.retryUpload")}):null]}),u(te,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:A.name}),disabled:v||S,onClick:()=>{A.added?(a.releaseUpload(A.id),A.previewUrl&&URL.revokeObjectURL(A.previewUrl),xs(p,N=>({...N,added:N.added.filter(R=>R.id!==A.id)}))):xs(p,N=>({...N,retained:N.retained.filter(R=>R.id!==A.id)}))},children:u(jt,{className:"size-3.5"})})]},A.id))}),u("input",{ref:y,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:A=>{I(Array.from(A.target.files??[])),A.target.value=""}}),b(te,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>y.current?.click(),children:[u(Ro,{className:"size-4"}),d("turnQueue.addAttachments")]}),S?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,x?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),b(wf,{children:[u(te,{variant:"ghost",disabled:v,onClick:L,children:d("turnQueue.discardEdit")}),u(te,{disabled:v||r||S||!m.trim()&&E.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function _w(e,t){let n=e.find(a=>a.intentId===t.intentId);if(!n)return e;let o=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?o.length:o.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(o.splice(r,0,n),o)}function Dw(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return _w(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function Ow(e,t){if(!e.find(l=>l.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(l=>l.intentId===t.beforeIntentId))return{entries:e,settled:!0};let o=new Set(e.map(l=>l.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(l=>o.has(l));return e.filter(l=>r.has(l.intentId)).some((l,d)=>l.intentId!==a[d])?{entries:e,settled:!0}:{entries:_w(e,t),settled:!1}}me();me();function Yz({entry:e,unavailable:t,onCancel:n}){let{t:o}=co(),r=_(!1),[a,i]=G(!1),[s,l]=G(!1),[d,c]=G(!1);q(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,i(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,i(!1)}}};return b("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[u("p",{className:"text-muted-foreground",children:o(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),u("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??o("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?u("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?d&&e.action==="abandon"?b("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),b("div",{className:"flex flex-wrap gap-2",children:[u(te,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(te,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(te,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?c(!0):void f(),children:o(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,s?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function Fw({entries:e,unavailable:t,onCancel:n}){let{t:o}=co(),[r,a]=G(!1),i=Wr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(te,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":i,onClick:()=>a(s=>!s),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:i,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(s=>u(Yz,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function nv({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=co(),i=_(!1),[s,l]=G(!1),[d,c]=G(!1),f=_(!1),[p,m]=G(!1),[h,g]=G(!1),[v,x]=G(null);q(()=>{e.paused||c(!1)},[e.paused]);let y=o?.[0];q(()=>{m(!1),x(null)},[y?.intentId,y?.status,y?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&y?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),k=async()=>{if(f.current||t||r===void 0||y===void 0)return;let T=y;f.current=!0,g(!0),x(null);try{await r(T),m(!1)}catch{x(T.intentId)}finally{f.current=!1,g(!1)}},S=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),L=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),I=async()=>{if(!(i.current||t||!e.paused)){i.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{i.current=!1,l(!1)}}};return b("div",{className:"mx-auto mb-2 flex w-full max-w-3xl flex-wrap items-start gap-2 rounded-md border border-warning/40 bg-background px-3 py-2 text-xs text-foreground","data-turn-queue-banner":!0,role:"status",children:[b("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[b("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:S}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:L}),e.paused&&C?u("p",{className:"text-muted-foreground",children:a("turnQueue.pausedUncertainDescription")}):null,t?u("p",{className:"text-muted-foreground",children:a("turnQueue.disconnected")}):null,d&&e.paused?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.resumeFailed")}):null,v!==null&&v===y?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(te,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(be,{children:[u(te,{size:"xs",variant:"outline",disabled:h,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(OI,{open:p,onOpenChange:T=>{T||m(!1)},children:b(HI,{className:"max-w-lg",children:[b($I,{children:[u(UI,{children:a("turnQueue.stopWaiting")}),u(BI,{children:a("turnQueue.abandonDescription")})]}),b(zI,{children:[u(FI,{render:u(te,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(te,{variant:"outline",disabled:h||t,onClick:()=>{k()},children:a(h?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(Fw,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var Jz=[Lw,Tw];function Zz({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=co(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:h}=Iw({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return b("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:ui.Transform.toString(p),transition:m},className:F("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",h&&"z-10 bg-accent shadow-md ring-1 ring-primary/50 ring-inset",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[n?u("span",{"aria-hidden":"true","data-queue-drop-position":n,className:F("pointer-events-none absolute inset-x-1 z-20 h-0.5 rounded-full bg-primary before:absolute before:-top-0.5 before:start-0 before:size-1.5 before:rounded-full before:bg-primary",n==="before"?"top-0":"bottom-0")}):null,u(te,{ref:f,size:"icon-xs",variant:"ghost",className:F("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(Io,{className:"size-3.5"}):u(Bd,{className:"size-3.5"})}),i,h&&o?u("span",{"aria-hidden":"true","data-queue-drag-position":!0,className:"pointer-events-none absolute end-3 rounded bg-primary/10 px-2 py-1 font-medium text-primary tabular-nums",children:o}):null]})}function Bw({inputKey:e,entries:t,environmentId:n,unavailable:o,attachments:r,actions:a,onCancel:i}){let{t:s}=co(),l=lp("(prefers-reduced-motion: reduce)"),[d,c]=Ln("turn-queue:editing",e,null),[f,p]=Ln("turn-queue:pending",e,!1),m=En("turn-queue:pending-ref",e,!1),[h,g]=Ln("turn-queue:error",e,null),[v,x]=Ln("turn-queue:drag",e,null),[y,C]=Ln("turn-queue:move",e,null),w=En("turn-queue:reorder-ref",e,!1),[k,S]=Ln("turn-queue:feedback",e,null),L=j0(Zh(Tl,{activationConstraint:{distance:5}}),Zh(wl,{coordinateGetter:Sw,scrollBehavior:l?"auto":"smooth"})),I=z(()=>t.filter(O=>O.waiting),[t]),T=y?Ow(I,y.preview):null,E=T?.entries??I,A=o||f||y!==null,N=E.findIndex(O=>O.intentId===v?.activeId),R=E.findIndex(O=>O.intentId===v?.overId);q(()=>{Rw(e,t)},[t,e]),q(()=>{y!==null&&(o||y.acknowledged&&T?.settled)&&(w.current=!1,C(null),!o&&I.some(O=>O.intentId===y.preview.intentId)&&S({intentId:y.preview.intentId,kind:"saved"}))},[I,y,T?.settled,o]),q(()=>{if(k===null||k.kind==="failed")return;let O=window.setTimeout(()=>S(oe=>oe===k?null:oe),1600);return()=>window.clearTimeout(O)},[k]);let $=async O=>{if(!(m.current||w.current||o)){m.current=!0,p(!0),g(null),S(null);try{await O()}catch(oe){g(oe instanceof Error?oe.message:s("turnQueue.actionFailed"))}finally{m.current=!1,p(!1)}}},H=(O,oe)=>$(async()=>{let ee=Dw(I,O.intentId,oe);if(!(ee===null||!O.management?.canReorder)){w.current=!0,C({preview:ee,acknowledged:!1});try{await a.onReorder(O,oe),C(W=>W?.preview===ee?{...W,acknowledged:!0}:W)}catch(W){throw w.current=!1,C(null),S({intentId:O.intentId,kind:"failed"}),W}}}),K=o?s("turnQueue.disconnected"):y!==null?s("turnQueue.saving"):v!==null?`${s("turnQueue.dragStarted")} ${R+1}/${E.length}`:k?.kind==="saved"?s("common.action.done"):k?.kind==="cancelled"?s("turnQueue.dragCancelled"):"";return b(be,{children:[E.length>0?b("section",{"aria-label":s("turnQueue.pendingMessages"),"data-turn-queue-dock":!0,className:"mx-auto mb-2 w-full max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-background/95 text-xs shadow-xs",children:[b("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[u("span",{className:"shrink-0",children:s("turnQueue.queued",{count:E.length})}),u("span",{role:"status","aria-live":v===null?"polite":"off","data-queue-reorder-status":y?"saving":k?.kind,className:F("min-w-0 truncate",k?.kind==="saved"&&"text-primary"),children:K})]}),u(uw,{sensors:L,collisionDetection:Y0,modifiers:Jz,accessibility:{screenReaderInstructions:{draggable:s("turnQueue.dragInstructions")},announcements:{onDragStart:()=>s("turnQueue.dragStarted"),onDragOver:({over:O})=>{let oe=E.findIndex(ee=>ee.intentId===O?.id);return oe<0?void 0:`${s("turnQueue.dragStarted")} ${oe+1}/${E.length}`},onDragEnd:()=>s("turnQueue.dragFinished"),onDragCancel:()=>s("turnQueue.dragCancelled")}},onDragStart:({active:O})=>{let oe=E.find(ee=>ee.intentId===O.id);!oe?.management?.canReorder||A||(g(null),S(null),x({activeId:oe.intentId,overId:oe.intentId}))},onDragOver:({over:O})=>{let oe=E.find(ee=>ee.intentId===O?.id);oe&&x(ee=>ee&&{...ee,overId:oe.intentId})},onDragCancel:()=>{v&&S({intentId:v.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:O,over:oe})=>{if(x(null),!oe||O.id===oe.id)return;let ee=E.findIndex(fe=>fe.intentId===O.id),W=E.findIndex(fe=>fe.intentId===oe.id),qe=E[ee];if(!qe?.management?.canReorder||W<0)return;let ve=E[W+(ee<W?1:0)]?.intentId??null;H(qe,ve)},children:u(Cw,{items:E.map(O=>O.intentId),strategy:vw,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:E.map((O,oe)=>b(Zz,{entry:O,disabled:!O.management?.canReorder||A,reducedMotion:l,feedback:k?.intentId===O.intentId?k.kind:void 0,dropPosition:O.intentId===v?.overId&&N!==R?N<R?"after":"before":void 0,dragPosition:O.intentId===v?.activeId?`${R+1}/${E.length}`:void 0,children:[b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:O.text||s("turnQueue.attachmentsOnly")}),O.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(Ro,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:O.attachmentNames.join(", ")})]}):null,O.pendingAction?u("p",{className:"text-muted-foreground",children:s(O.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,O.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:O.failure}):null]}),b("div",{className:F("flex shrink-0 items-center gap-0.5",O.intentId===v?.activeId&&"invisible"),children:[u(te,{size:"icon-xs",variant:"ghost",disabled:!O.management||A||v!==null,"aria-label":s("turnQueue.editMessage"),title:s("turnQueue.editMessage"),onClick:()=>c(O),children:u(Wd,{className:"size-3.5"})}),O.management?.canSteer?u(te,{size:"icon-xs",variant:"ghost",disabled:A||v!==null,"aria-label":s("turnQueue.steer"),title:s("turnQueue.steerDescription"),onClick:()=>{$(()=>a.onRun(O,"steer"))},children:u(Gd,{className:"size-3.5"})}):null,b(Jo,{children:[u(tr,{render:u(te,{size:"icon-xs",variant:"ghost",disabled:A||!O.management||v!==null,"aria-label":s("turnQueue.messageActions")}),children:u(Yo,{className:"size-4"})}),b(er,{align:"end",children:[b(Zo,{disabled:!O.management?.canReorder||oe===0,onClick:()=>{H(O,E[oe-1].intentId)},children:[u(Pd,{className:"size-4"}),s("turnQueue.moveUp")]}),b(Zo,{disabled:!O.management?.canReorder||oe===E.length-1,onClick:()=>{H(O,E[oe+2]?.intentId??null)},children:[u(Ld,{className:"size-4"}),s("turnQueue.moveDown")]}),O.management?.canSteer?u(Zo,{onClick:()=>{$(()=>a.onRun(O,"steer"))},children:s("turnQueue.steer")}):null,u(Zo,{disabled:!O.management?.canRun,onClick:()=>{$(()=>a.onRun(O,"interrupt"))},children:s(O.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(ii,{}),u(Zo,{disabled:O.action!=="cancel",onClick:()=>{$(()=>i(O))},children:s("turnQueue.cancelMessage")})]})]})]})]},O.intentId))})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,d?u(Nw,{entry:d,current:t.find(O=>O.intentId===d.intentId),inputKey:e,environmentId:n,unavailable:A,attachments:r,watchEditorAuthority:a.watchEditorAuthority,onEdit:a.onEdit,onClose:()=>c(null)},`${e}\0${d.intentId}\0${d.management?.revision??"none"}`):null]})}me();var ov=220,e5={opacity:0,transform:"translate3d(0, 4rem, 0)"},t5={opacity:0,transform:"translate3d(0, 7rem, 0)"},zw={opacity:1,transform:"none"},$w={transition:`transform ${ov}ms ease-in, opacity ${ov}ms ease-in`},n5={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function Uw({className:e,items:t}){let[n,o]=G(null),r=_(null),a=n!==null&&t.some(p=>p.id===n)?n:null;if(q(()=>()=>{r.current&&clearTimeout(r.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let s=t.slice(1),l=s.length>0,d=l&&a!==i.id,c=s[0],f=p=>{!p.onDismiss||a||(o(p.id),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,p.onDismiss?.()},ov))};return u("div",{className:F("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:F("relative flex flex-col-reverse",l?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[d&&c?u("div",{className:F("pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-2xl","chat-composer-banner-stack-cap border border-b-0 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",n5[c.variant],"transition-opacity duration-150 ease-out","group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0"),style:{width:"96%"},"aria-hidden":"true"}):null,u("div",{className:F("relative z-10",a===i.id?"pointer-events-none":null),style:{...$w,...a===i.id?e5:zw},children:u(Hw,{item:i,attached:!0,exiting:a===i.id,onDismissRequest:()=>f(i)})}),l?u("div",{"data-composer-banner-stack-expanded-items":"true",className:F("relative z-20 grid grid-rows-[0fr] transition-[grid-template-rows] duration-150 ease-out","group-hover/banner-stack:grid-rows-[1fr] group-focus-within/banner-stack:grid-rows-[1fr]"),children:u("div",{className:"min-h-0 overflow-hidden",children:u("div",{className:F("invisible pointer-events-none space-y-2 pb-2 opacity-0","translate-y-1 transform-gpu transition-[opacity,transform] duration-150 ease-out will-change-[opacity,transform]","group-hover/banner-stack:visible group-hover/banner-stack:pointer-events-auto group-hover/banner-stack:translate-y-0 group-hover/banner-stack:opacity-100","group-focus-within/banner-stack:visible group-focus-within/banner-stack:pointer-events-auto group-focus-within/banner-stack:translate-y-0 group-focus-within/banner-stack:opacity-100"),children:s.map(p=>u("div",{className:F(a===p.id?"pointer-events-none":null),style:{...$w,...a===p.id?t5:zw},children:u(Hw,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function Hw({item:e,attached:t,exiting:n,onDismissRequest:o}){let r=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(tc,{variant:e.variant,role:"status",className:F("min-h-0 px-3 text-xs sm:px-4",t?"chat-composer-drawer-surface chat-composer-drawer-attached pt-1.5 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.25rem)]":"alert-glass rounded-[22px] py-1.5",e.className),"data-composer-banner-presentation":"compact","data-variant":e.variant,children:[e.icon,b(xh,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[u("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?b(nc,{className:F("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(te,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss notice",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]}):b(tc,{variant:e.variant,className:F(t?"chat-composer-drawer-surface chat-composer-drawer-attached px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.375rem)] text-xs sm:px-4":"alert-glass rounded-[22px]",e.className),"data-variant":e.variant,children:[e.icon,u(xh,{children:e.title}),e.description?u(Af,{children:e.description}):null,e.actions||e.onDismiss?b(nc,{className:F(e.actionClassName,r?"max-sm:col-start-3 max-sm:row-start-1 max-sm:mt-0 max-sm:self-start":void 0),children:[e.actions,e.onDismiss?u(te,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss warning",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]})}function Kw({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u(Uw,{className:"relative z-0",items:e});return u("div",{ref:r,"data-chat-composer-overlay":"true",className:o.active?"pointer-events-none absolute inset-0 z-20 flex items-center":"pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2",children:b("div",{ref:o.transitionGroupRef,className:"w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]",children:[b("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?b("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),i]}):i,b("div",{className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:o.composerTransitionName},children:[u("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-[22px]",children:u("div",{ref:o.composerAnchorRef,className:"relative z-10",children:n})}),u("div",{className:"min-h-0",children:t})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]})})}function qw(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var o5=["image/gif","image/jpeg","image/png","image/webp"],r5=new Set(o5);function rv(e){return r5.has(e.toLowerCase())}function a5(e){return rv(e)?"image":"file"}var i5=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function av(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||i5.has(t)?"text":"file"}function iv(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function sv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return a5(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var s5=new Set(["claudeAgent","cursor","grok","dsh","acp"]),Vw=e=>s5.has(e)?"in-session":"next-turn";function l5(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function d5(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function c5(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Sc(e){return`[${d5(l5(e))}](${c5(e)})`}me();var u5=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,f5=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var p5=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),m5=/^[A-Za-z][A-Za-z0-9+.-]*:/,g5=/^[A-Za-z]:[\\/]/,h5=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function v5(e){let t=[];for(let n of e.matchAll(p5)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),i=n[3]??"",s=i;try{s=decodeURIComponent(i)}catch{}let l=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\")),d=l>=0?s.slice(l+1):s,c=m5.test(s)&&!g5.test(s);if(!s||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(f5)){let o=n[0],r=n[1]??"",a=n[2],i=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!i||a===void 0&&h5.test(i))continue;let s=(n.index??0)+r.length,l=s+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(s,l),start:s,end:l})}return t}function wc(e,t={}){let n=v5(e);for(let o of e.matchAll(u5)){let r=o[0],a=o[1]??"",i=o[2]??"";if(!i)continue;let s=(o.index??0)+a.length,l=s+r.length-a.length;n.push({type:"skill",value:i,source:e.slice(s,l),start:s,end:l})}for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function x5(e){return e.replace(/\r\n/g,`
|
|
3694
|
+
`).replace(/^\n+|\n+$/g,"")}function y5(e){return x5(e.text).length>0}function Ww(e){return!y5(e)}function C5(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function Gw(e){return`${e.terminalLabel} (${C5(e)})`}function jw(e,t,n){return e<=n&&n<t}function Qw(e,t){if(!t)return;let n=e[e.length-1];if(n&&n.type==="text"){n.text+=t;return}e.push({type:"text",text:t})}function Xw(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]==="\uFFFC"){if(o>n&&t({type:"text",text:e.slice(n,o),promptOffset:n})===!0||t({type:"terminal-context",promptOffset:o})===!0)return!0;n=o+1}return n<e.length&&t({type:"text",text:e.slice(n),promptOffset:n})===!0}function b5(e,t){return Xw(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function I5(e,t){return b5(e,(n,o)=>{for(let r of wc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function S5(e){let t=[];if(!e)return t;let n=wc(e),o=0;for(let r of n)r.start<o||(r.start>o&&Qw(t,e.slice(o,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),o=r.end);return o<e.length&&Qw(t,e.slice(o)),t}function lv(e,t,n){return!e||t>=n?!1:I5(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&jw(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&jw(t,n,l))})}function ys(e,t=[]){if(!e)return[];let n=[],o=0;return Xw(e,r=>r.type==="text"?(n.push(...S5(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function Jw(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:"foreground"}var Yw=e=>e.type!=="text";function dv(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function w5(e){return e===" "||e===`
|
|
3695
|
+
`||e===" "||e==="\r"||e==="\uFFFC"}function T5(e,t){let n=t-1;for(;n>=0&&!w5(e[n]??"");)n-=1;return n+1}function Ir(e,t){let n=dv(e,t),o=ys(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="skill"){let l=i.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Zw(e){return e.type==="text"?e.text.length:1}function eT(e,t){let n=e.reduce((o,r)=>o+Zw(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function ir(e,t){return eT(ys(e),t)}function sr(e,t){let n=dv(e,t),o=ys(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="skill"){let l=i.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Tc(e,t,n){let o=ys(e);if(!o.some(Yw))return!1;let r=eT(o,t),a=0;for(let i of o){if(Yw(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=Zw(i)}return!1}function lr(e,t){let n=dv(e,t),o=e.lastIndexOf(`
|
|
3696
|
+
`,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let s=/^\/(\S*)$/.exec(r);if(s)return{kind:"slash-command",query:s[1]??"",rangeStart:o,rangeEnd:n}}let a=T5(e,n),i=e.slice(a,n);return i.startsWith("$")?{kind:"skill",query:i.slice(1),rangeStart:a,rangeEnd:n}:i.startsWith("@")?{kind:"path",query:i.slice(1),rangeStart:a,rangeEnd:n}:null}function tT(e,t,n,o){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,n));return{text:`${e.slice(0,r)}${o}${e.slice(a)}`,cursor:r+o.length}}var nT="Ask for changes, send follow-ups, or attach images";var oT="application/x-ycodium-composer-mention";function cv(e){return e.includes(oT)}function rT(e){let t=n=>cv(n.dataTransfer.types)?(n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(n){t(n)&&e.setDragActive(!0)},onDragOver(n){t(n)&&(n.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(n){if(!t(n))return;e.setDragActive(!1);let o=n.dataTransfer.getData(oT);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}me();var uv=ue(function(t){let{t:n}=De();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:F("text-[10px] font-medium leading-none tabular-nums",t.pulsing?"animate-[prompt-stash-count-enter_180ms_ease-out_both] text-primary motion-reduce:animate-none":"text-muted-foreground"),children:t.count},t.pulseKey);return o?b(te,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("shrink-0 gap-1 px-1.5",(t.menuOpen||t.pulsing)&&"[--control-icon-color:currentColor] text-foreground"),onPointerDown:a=>a.preventDefault(),onClick:t.onToggleMenu,children:[u(dl,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):b("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-t-xl border border-b-0 px-3 pb-1 text-xs leading-none","transition-colors duration-(--control-duration)",t.menuOpen&&"pointer-events-none",t.menuOpen||t.pulsing?"text-foreground":"text-muted-foreground hover:text-foreground"),onPointerDown:a=>{a.preventDefault()},onClick:t.onToggleMenu,children:[u(dl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});me();function L5(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function k5(e){let t=L5(e);if(!t)return null;let n=Date.now()-t.getTime();if(n<0)return{value:"just now",suffix:null};let o=Math.floor(n/1e3);if(o<60)return{value:"just now",suffix:null};let r=Math.floor(o/60);if(r<60)return{value:`${r}m`,suffix:"ago"};let a=Math.floor(r/60);return a<24?{value:`${a}h`,suffix:"ago"}:{value:`${Math.floor(a/24)}d`,suffix:"ago"}}function aT(e){let t=k5(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}me();var iT=Ht(null),sT=iT.Provider;function Ot(){let e=fn(iT);if(e===null)throw new Error("Composer API has not been provided.");return e}var lT=90;function dT(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function P5(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>lT?`${n.slice(0,lT)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var cT=ue(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=De(),s=Ot(),l=_(null),[d,c]=G(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return q(()=>{let p=m=>{let h=l.current;h&&m.composedPath().includes(h)||m.target instanceof Element&&m.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),q(()=>{n.length!==0&&(n.some(p=>p.id===d)||c(n[0]?.id??null))},[n,d]),s.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(n.length===0)return;p.preventDefault(),p.stopPropagation();let m=n.findIndex(x=>x.id===d),h=p.key==="ArrowDown"?1:-1,v=((m>=0?m:h===1?-1:0)+h+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(Mf,{autoHighlight:!1,mode:"none",children:b("div",{ref:l,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[u("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:u(te,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(jt,{className:"size-3"})})}),u(_f,{className:"max-h-64 scroll-pb-6",children:u(Rf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>b(Nf,{value:p.id,className:F("group/stash relative cursor-pointer select-none gap-3 rounded-lg px-3 py-1.5! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",d===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{d!==p.id&&c(p.id)},onMouseDown:m=>{m.preventDefault()},onClick:()=>{o(p)},children:[u("span",{className:"min-w-0 flex-1 truncate text-xs",children:P5(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):dT(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:dT(p)})}):null,p.attachments.length>0?u("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(m=>u("img",{src:m.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},m.id))}):null,u("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:aT(p.createdAt)}),u(te,{variant:"ghost",size:"icon-xs",className:"pointer-events-none shrink-0 [--control-icon-color:currentColor] opacity-0 shadow-none! transition-opacity pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 group-hover/stash:pointer-events-auto group-hover/stash:opacity-100 group-focus-within/stash:pointer-events-auto group-focus-within/stash:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100","aria-label":i("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(jt,{className:"stroke-2"})})]},p.id))})})]})})});me();function fT(e){let t=new Map;return e.map(n=>{let o=t.get(n.step)??0;return t.set(n.step,o+1),{key:`${n.step}:${o}`,step:n}})}function uT({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:F("flex w-10 shrink-0 items-center gap-0.5",e),children:fT(t).map(({key:n,step:o})=>u("span",{className:F("h-[3px] min-w-0 flex-1 rounded-full",o.status==="completed"?"bg-success":o.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},n))})}var fv=ue(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=De();if(i.totalSteps<=0)return null;let d=i.completedSteps>=i.totalSteps,c=l("tasksBadge.ariaLabel",{completed:i.completedSteps,total:i.totalSteps,step:i.step});return a==="inline"?b("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[b(te,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":c,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(uT,{steps:s}),b("span",{className:F("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:F("chat-composer-shoulder-tab chat-composer-tasks-tab absolute -top-7 left-4 z-0 flex h-8 items-center gap-1 rounded-t-xl border border-b-0 px-2 pb-1 text-xs leading-none text-muted-foreground",n?"right-28":"right-4",d&&"text-foreground"),"data-composer-tasks-badge":"true",children:[b("button",{type:"button","aria-expanded":t,"aria-label":c,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:"Tasks"}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:i.step}),b("span",{className:F("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(uT,{className:"w-20",steps:s})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]})}),pT=ue(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=De();return b("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[b("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[b("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:n,onPointerDown:i=>i.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),b("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:fT(r).map(({key:i,step:s})=>b("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:F("w-3 shrink-0 text-center font-mono text-[10px]",s.status==="completed"?"text-success":s.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:s.status==="completed"?"\u2713":s.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0 flex-1",s.status==="completed"?"text-muted-foreground/55":s.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:s.step}),u("span",{className:"ml-auto w-10 shrink-0 text-right text-[10px] text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:s.durationMs!==void 0?ss(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function mT(e){let t=0,n=0;for(let o of e.imageIds){let r=e.uploadsByImageId[o];r?.status==="failed"&&r.environmentId===e.environmentId?n+=1:(r?.status!=="ready"||r.environmentId!==e.environmentId)&&(t+=1)}return n>0?n===1?"Retry or remove the failed image":"Retry or remove the failed images":t>0?t===1?"Image still uploading":"Images still uploading":null}function fp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function gT(e){switch(e){case"image":return Xi;case"pdf":return Qi;case"text":return ji;case"file":return Ro}}var hT="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",vT=`${hT} border border-border/70 bg-accent/40 text-foreground`,A5=`${vT} text-[12px]`,mi=`${vT} text-[0.86em] select-none`,pp="relative inline-flex align-[-0.125em] leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']",Zr="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",xT="truncate leading-tight",ea="block self-center truncate leading-tight select-none",yT=`${hT} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,CT='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',mp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";function E5(e,t,n){let o=[];o.push(t(e));let r=n(e);return r&&o.push(r),e.pageUrl&&o.push(e.pageUrl),e.selector&&o.push(e.selector),e.htmlPreview.trim().length>0&&(o.push(""),o.push(e.htmlPreview.trim().slice(0,600))),o.join(`
|
|
3697
|
+
`)}function M5({context:e,onRemove:t}){let{t:n}=De(),o=Ot().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Qe,{children:[u(Ye,{render:b("span",{className:F(mi,"pr-1"),children:[u(Qr,{className:F(Zr,"size-icon-1")}),u("span",{className:ea,children:r}),a?u("span",{className:"select-none text-[10px] font-normal leading-tight text-muted-foreground/85",children:a}):null,u("button",{type:"button","aria-label":n("pendingContext.removeElement",{label:r}),className:mp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]})}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:E5(e,o.formatLabel,o.formatSourceLabel)})]})}function bT({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(o=>u(M5,{context:o,onRemove:t},o.id))})}function IT({comments:e,onRemove:t,className:n}){let{t:o}=De();return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:F(mi,"pr-1"),children:[u(Ji,{className:F(Zr,"size-icon-1")}),u("span",{className:ea,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:mp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Qe,{children:[u(Ye,{render:i}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function gp(e){let t=`${e.count} ${e.label}${e.count===1?"":"s"}`;return b(Qe,{children:[u(Ye,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Xe,{side:"top",children:t})]})}function ST({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=De(),l=Ot().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:F("flex flex-wrap gap-1.5",i),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(h=>{let g=l.normalizeSelection(h.element);return g?[{id:h.id,label:l.formatLabel(g)}]:[]});return b("section",{className:"group/preview-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[f?.previewUrl?u("button",{type:"button","aria-label":s("previewAnnotation.previewImage",{name:f.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>o(f.id),children:u("img",{src:f.previewUrl,alt:s("previewAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/preview-annotation:scale-[1.03]"})}):u("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:u(Qr,{className:"size-icon-2"})}),b("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[c.comment.trim()?u("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:c.comment.trim()}):null,b("div",{className:F("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?b("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:h,label:g})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:g},h)),m.length>2?b("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,b("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(gp,{icon:u(Qr,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(gp,{icon:u(Dd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(gp,{icon:u(Xr,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(gp,{icon:u(es,{className:"size-3"}),count:c.styleChanges.length,label:"style change"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:fp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Qe,{children:[u(Ye,{render:u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":`Retry upload for ${f.name}`,onClick:()=>a(f)}),children:u(ns,{className:"size-3"})}),u(Xe,{side:"top",children:p.reason})]}):null]})]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":s("previewAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>n(c.id),children:u(jt,{className:"size-3"})})]},c.id)})})}me();function wT(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function TT(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function LT(e,t){let n=Ot().pane.useVisible(),[o,r]=G(null);ye(()=>{if(!n)return;let i=e.current;if(!i)return;let s=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!s)return;let p=f.find(v=>v.target===i);if(!p)return;let m=window.getComputedStyle(i),h=Number.parseFloat(m.paddingLeft)||0,g=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+h+g))});return c.observe(i),()=>{s=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,s&&r(i.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{s=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=wT(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&TT(o,{hasWideActions:t})}}var pv={};An(pv,{LexicalComposerContext:()=>kT,createLexicalComposerContext:()=>R5,useLexicalComposerContext:()=>N5});me();var kT=Ht(null);function R5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function N5(){let e=fn(kT);return e==null&&(function(t,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of n)r.append("v",a);throw o.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var mv=pv,PT=mv.LexicalComposerContext,AT=mv.createLexicalComposerContext,In=mv.useLexicalComposerContext;var Kx={};An(Kx,{$addUpdateTag:()=>em,$applyNodeReplacement:()=>Xc,$caretFromPoint:()=>wi,$caretRangeFromSelection:()=>tx,$cloneWithProperties:()=>Ox,$cloneWithPropertiesEphemeral:()=>hH,$comparePointCaretNext:()=>$x,$copyNode:()=>_x,$create:()=>xH,$createLineBreakNode:()=>Dl,$createNodeSelection:()=>yx,$createParagraphNode:()=>Ea,$createPoint:()=>Pr,$createRangeSelection:()=>yk,$createRangeSelectionFromDom:()=>V$,$createTabNode:()=>jp,$createTextNode:()=>jn,$extendCaretToRange:()=>Bx,$findMatchingParent:()=>Mc,$getAdjacentChildCaret:()=>Kl,$getAdjacentNode:()=>zk,$getAdjacentSiblingOrParentSiblingCaret:()=>LH,$getCaretInDirection:()=>Ti,$getCaretRange:()=>Si,$getCaretRangeInDirection:()=>Ux,$getCharacterOffsets:()=>Gv,$getChildCaret:()=>Ra,$getChildCaretAtIndex:()=>eP,$getChildCaretOrSelf:()=>Qk,$getCollapsedCaretRange:()=>Xk,$getCommonAncestor:()=>Rc,$getCommonAncestorResultBranchOrder:()=>Hx,$getEditor:()=>Dx,$getNearestNodeFromDOMNode:()=>Zp,$getNearestRootOrShadowRoot:()=>Uk,$getNodeByKey:()=>Bn,$getNodeByKeyOrThrow:()=>Kk,$getNodeFromDOMNode:()=>kx,$getPreviousSelection:()=>Es,$getRoot:()=>Ko,$getSelection:()=>St,$getSiblingCaret:()=>Zn,$getState:()=>kp,$getStateChange:()=>u$,$getTextContent:()=>j$,$getTextNodeOffset:()=>kr,$getTextPointCaret:()=>Ii,$getTextPointCaretSlice:()=>Zv,$getWritableNodeState:()=>ax,$hasAncestor:()=>Up,$hasUpdateTag:()=>uH,$insertNodes:()=>G$,$isBlockElementNode:()=>q$,$isChildCaret:()=>Lr,$isDecoratorNode:()=>Qt,$isEditorState:()=>J$,$isElementNode:()=>Q,$isExtendableTextPointCaret:()=>Zk,$isInlineElementOrDecoratorNode:()=>fH,$isLeafNode:()=>lH,$isLineBreakNode:()=>Ss,$isNodeCaret:()=>bH,$isNodeSelection:()=>Wc,$isParagraphNode:()=>Lk,$isRangeSelection:()=>Ue,$isRootNode:()=>to,$isRootOrShadowRoot:()=>cr,$isSiblingCaret:()=>As,$isTabNode:()=>xx,$isTextNode:()=>Me,$isTextPointCaret:()=>Ma,$isTextPointCaretSlice:()=>TH,$isTokenOrSegmented:()=>ka,$isTokenOrTab:()=>vi,$nodesOfType:()=>cH,$normalizeCaret:()=>wr,$normalizeSelection__EXPERIMENTAL:()=>Pp,$onUpdate:()=>Hk,$parseSerializedNode:()=>Y$,$removeTextFromCaretRange:()=>Jk,$rewindSiblingCaret:()=>Gl,$selectAll:()=>dH,$setCompositionKey:()=>Xn,$setPointFromCaret:()=>ql,$setSelection:()=>Do,$setSelectionFromCaretRange:()=>Yk,$setState:()=>f$,$splitAtPointCaretNext:()=>AH,$splitNode:()=>pH,$updateRangeSelectionFromCaretRange:()=>Nc,ArtificialNode__DO_NOT_USE:()=>$p,BEFORE_INPUT_COMMAND:()=>sx,BLUR_COMMAND:()=>JL,CAN_REDO_COMMAND:()=>w$,CAN_UNDO_COMMAND:()=>T$,CLEAR_EDITOR_COMMAND:()=>I$,CLEAR_HISTORY_COMMAND:()=>S$,CLICK_COMMAND:()=>DL,COLLABORATION_TAG:()=>dk,COMMAND_PRIORITY_CRITICAL:()=>oH,COMMAND_PRIORITY_EDITOR:()=>Al,COMMAND_PRIORITY_HIGH:()=>nH,COMMAND_PRIORITY_LOW:()=>eH,COMMAND_PRIORITY_NORMAL:()=>tH,COMPOSITION_END_COMMAND:()=>cx,COMPOSITION_END_TAG:()=>pk,COMPOSITION_START_COMMAND:()=>dx,COMPOSITION_START_TAG:()=>fk,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ml,COPY_COMMAND:()=>gx,CUT_COMMAND:()=>hx,DELETE_CHARACTER_COMMAND:()=>Fc,DELETE_LINE_COMMAND:()=>zc,DELETE_WORD_COMMAND:()=>Bc,DRAGEND_COMMAND:()=>XL,DRAGOVER_COMMAND:()=>QL,DRAGSTART_COMMAND:()=>jL,DROP_COMMAND:()=>GL,DecoratorNode:()=>Hc,ElementNode:()=>Ci,FOCUS_COMMAND:()=>YL,FORMAT_ELEMENT_COMMAND:()=>b$,FORMAT_TEXT_COMMAND:()=>gi,HISTORIC_TAG:()=>N$,HISTORY_MERGE_TAG:()=>wp,HISTORY_PUSH_TAG:()=>_$,INDENT_CONTENT_COMMAND:()=>y$,INPUT_COMMAND:()=>lx,INSERT_LINE_BREAK_COMMAND:()=>Pc,INSERT_PARAGRAPH_COMMAND:()=>Fv,INSERT_TAB_COMMAND:()=>x$,INTERNAL_$isBlock:()=>Aa,IS_ALL_FORMATTING:()=>W5,IS_BOLD:()=>z5,IS_CODE:()=>K5,IS_HIGHLIGHT:()=>nx,IS_ITALIC:()=>$5,IS_STRIKETHROUGH:()=>H5,IS_SUBSCRIPT:()=>q5,IS_SUPERSCRIPT:()=>V5,IS_UNDERLINE:()=>U5,KEY_ARROW_DOWN_COMMAND:()=>HL,KEY_ARROW_LEFT_COMMAND:()=>BL,KEY_ARROW_RIGHT_COMMAND:()=>OL,KEY_ARROW_UP_COMMAND:()=>$L,KEY_BACKSPACE_COMMAND:()=>KL,KEY_DELETE_COMMAND:()=>VL,KEY_DOWN_COMMAND:()=>mx,KEY_ENTER_COMMAND:()=>Np,KEY_ESCAPE_COMMAND:()=>qL,KEY_MODIFIER_COMMAND:()=>ZL,KEY_SPACE_COMMAND:()=>UL,KEY_TAB_COMMAND:()=>WL,LineBreakNode:()=>_l,MOVE_TO_END:()=>FL,MOVE_TO_START:()=>zL,NODE_STATE_KEY:()=>a$,OUTDENT_CONTENT_COMMAND:()=>C$,PASTE_COMMAND:()=>ux,PASTE_TAG:()=>D$,ParagraphNode:()=>Bl,REDO_COMMAND:()=>px,REMOVE_TEXT_COMMAND:()=>Bv,RootNode:()=>Fl,SELECTION_CHANGE_COMMAND:()=>ix,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>v$,SELECT_ALL_COMMAND:()=>zv,SKIP_COLLAB_TAG:()=>O$,SKIP_DOM_SELECTION_TAG:()=>uk,SKIP_SCROLL_INTO_VIEW_TAG:()=>ck,SKIP_SELECTION_FOCUS_TAG:()=>Vv,TEXT_TYPE_TO_FORMAT:()=>fo,TabNode:()=>Ol,TextNode:()=>Ls,UNDO_COMMAND:()=>fx,addClassNamesToElement:()=>DH,buildImportMap:()=>R$,configExtension:()=>MH,createCommand:()=>Ge,createEditor:()=>rH,createSharedNodeState:()=>AL,createState:()=>c$,declarePeerDependency:()=>RH,defineExtension:()=>EH,flipDirection:()=>Li,getDOMOwnerDocument:()=>Rx,getDOMSelection:()=>Er,getDOMSelectionFromTarget:()=>qk,getDOMTextNode:()=>Ps,getEditorPropertyFromDOMNode:()=>jc,getNearestEditorFromDOMNode:()=>Lx,getRegisteredNode:()=>wx,getRegisteredNodeOrThrow:()=>Sx,getStaticNodeConfig:()=>Yc,getTextDirection:()=>sH,getTransformSetFromKlass:()=>Pk,isBlockDomNode:()=>Yv,isCurrentlyReadOnlyMode:()=>Vl,isDOMDocumentNode:()=>Mk,isDOMNode:()=>Wl,isDOMTextNode:()=>oa,isDOMUnmanaged:()=>jk,isDocumentFragment:()=>Vk,isExactShortcutMatch:()=>Pt,isHTMLAnchorElement:()=>mH,isHTMLElement:()=>ko,isInlineDomNode:()=>Wk,isLexicalEditor:()=>Yp,isModifierMatch:()=>Bk,isSelectionCapturedInDecoratorInput:()=>Tx,isSelectionWithinEditor:()=>Gc,makeStepwiseIterator:()=>zx,mergeRegister:()=>FH,normalizeClassNames:()=>Jc,removeClassNamesFromElement:()=>OH,removeFromParent:()=>xi,resetRandomKey:()=>aH,safeCast:()=>NH,setDOMUnmanaged:()=>vH,setNodeIndentFromDOM:()=>Gk,shallowMergeConfig:()=>_H,toggleTextFormatType:()=>Kc});function Z(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function bL(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);n.search=o.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Ar=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,_5=Ar&&"documentMode"in document?document.documentMode:null,Sr=Ar&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yi=Ar&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Lp=!(!Ar||!("InputEvent"in window)||_5)&&"getTargetRanges"in new window.InputEvent("input"),qp=Ar&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Vc=Ar&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,D5=Ar&&/Android/.test(navigator.userAgent),IL=Ar&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Tv=Ar&&D5&&IL,Vp=Ar&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Sr&&!IL,O5=0,F5=1,B5=2,z5=1,$5=2,H5=4,U5=8,K5=16,q5=32,V5=64,nx=128,W5=2047,G5=1,j5=2,Q5=3,X5=4,Y5=5,J5=6,_c=qp||Vc||Vp?"\xA0":"\u200B",Wp=`
|
|
3695
3698
|
|
|
3696
|
-
`,tx=wi?"\xA0":Oc,CL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",bL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",U5=new RegExp("^[^"+bL+"]*["+CL+"]"),K5=new RegExp("^[^"+CL+"]*["+bL+"]"),po={bold:1,capitalize:1024,code:16,highlight:ex,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},q5={directionless:1,unmergeable:2},wv={center:2,end:6,justify:4,left:1,right:3,start:5},V5={[F5]:"center",[H5]:"end",[z5]:"justify",[O5]:"left",[B5]:"right",[$5]:"start"},W5={normal:0,segmented:2,token:1},G5={[T5]:"normal",[k5]:"segmented",[L5]:"token"},j5="$",kT="$config";function IL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(Q(i)&&IL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var Tv=!1,nx=0;function Q5(e){nx=e.timeStamp}function pv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&Xp(e,n)!==void 0}function X5(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&&Px(t,i,r,a,!1)}function Y5(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 J5(e,t,n,o){for(let r=e;r&&!Vk(r);r=Yc(r)){let a=Xp(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,Mk(n)]}}function SL(e,t,n){Tv=!0;let o=performance.now()-nx>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=J5(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Ne(y)&&aa(g)&&Y5(r,g,y)&&X5(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=Tx(L),T=L.parentNode;if(T!=null&&L!==l&&I===null&&!pv(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];(pv(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"||pv(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&Fo(r),wi&&Fk(e)&&r.insertRawText(c))})}finally{Tv=!1}}function wL(e){let t=e._observer;t!==null&&SL(e,t.takeRecords(),t)}function TL(e){(function(t){nx===0&&qo(t).addEventListener("textInput",Q5,!0)})(e),e._observer=new MutationObserver((t,n)=>{SL(e,t,n)})}var Lv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||n$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function Z5(e,t){return new Lv(e,t)}function Tp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function e$(e,t,n){let o=Tp(e,n,"direct"),r=Tp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function t$(e,t,n){let o;if(Gn(),typeof n=="function"){let a=e.getLatest(),i=Tp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return ox(r).updateFromKnown(t,o),r}function LL(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}=Zc(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 kv=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 PT(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=PT(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 ox(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new kv(t,kL(t));return t.__state=n,n}function kL(e){return e.__state?e.__state.sharedNodeState:bx(Nx(),e.getType()).sharedNodeState}function PT(e){if(e)for(let t in e)return e}function n$(e){return e}function ET(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 AT(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 MT(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function RT(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&&ET(p,c,f)||f&&ET(p,f,c)||c&&AT(p,c,f)||f&&AT(p,f,c))})(l,d))}function NT(e,t){let n=e.mergeWithSibling(t),o=qt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function _T(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(RT(t,o)){o=NT(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Ne(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(RT(o,n)){o=NT(o,n);break}break}n.remove()}}else o.remove()}function Lp(e){return DT(e.anchor),DT(e.focus),e}function DT(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,Fc,Vp,Pv,Ev,Ls,kr,Av,Bc,$n="",oa=null,Is=null,Al=!1,kp=!1;function Pp(e,t){let n=Ls.get(e);if(t!==null){let o=_v(e);o.parentNode===t&&t.removeChild(o)}if(kr.has(e)||ro._keyToDOMMap.delete(e),Q(n)){let o=Ap(n,Ls);Mv(o,0,o.length-1,null)}n!==void 0&&Ex(Bc,Fc,Vp,n,"destroyed")}function Mv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Pp(a,o)}}function bs(e,t){e.setProperty("text-align",t)}var o$="40px";function PL(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")||o$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function EL(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 Rv(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 Ep(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(Rv(o,n),r!==0&&PL(o,r),a!==0){let s=a-1;Nv(Ap(n,kr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&EL(o,i),n.isInline()||AL(null,n,o)}else{let r=n.getTextContent();if(Jt(n)){let a=n.decorate(ro,Ts);a!==null&&ML(e,a),o.contentEditable="false"}$n+=r}return t!==null&&t.insertChild(o),Ex(Bc,Fc,Vp,n,"created"),o}function Nv(e,t,n,o,r){let a=$n;$n="";let i=n;for(;i<=o;++i){Ep(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+=qp)}r.element.__lexicalTextContent=$n,$n=a+$n}function OT(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 AL(e,t,n){let o=OT(e,Ls),r=OT(t,kr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function r$(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)xp(f,c);else{let h=_v(f),g=Ep(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}Pp(f,null)}let m=kr.get(p);Ne(m)&&oa===null&&(oa=m.getFormat(),Is=m.getStyle())}else{let f=Ap(r,Ls),p=Ap(a,kr);if(f.length!==l&&J(227),p.length!==d&&J(228),l===0)d!==0&&Nv(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;Mv(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=mv(xp(R,y.element)),I++,T++;else{if(S===void 0&&(S=FT(g,T)),k===void 0)k=FT(h,I);else if(!k.has(N)){I++;continue}if(!S.has(N)){L=mv(_v(N)),Pp(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=mv(xp(R,y.element)),I++,T++}else Ep(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+=qp)}let A=I>C,E=T>w;if(A&&!E){let N=g[w+1],R=N===void 0?null:ro.getElementByKey(N);Nv(g,0,T,w,y.withBefore(R))}else E&&!A&&Mv(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||kp||o.setTextFormat(oa),(function(r){Is==null||Is===r.__textStyle||kp||r.setTextStyle(Is)})(t)}function Ap(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 xp(e,t){let n=Ls.get(e),o=kr.get(e);n!==void 0&&o!==void 0||J(61);let r=Al||Ev.has(e)||Pv.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&&Ex(Bc,Fc,Vp,o,"updated"),o.updateDOM(n,a,Ts)){let i=Ep(e,null);return t===null&&J(62),t.replaceChild(i,a),Pp(e,null),i}if(Q(n)){Q(o)||J(334,e);let i=o.__indent;(Al||i!==n.__indent)&&PL(a,i);let s=o.__format;if((Al||s!==n.__format)&&EL(a,s),r)r$(n,o,a),oo(o)||o.isInline()||AL(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)&&(Rv(a,o),oo(o)&&!Al))for(let l of o.getChildren())Q(l)&&Rv(Ul(ro,l.getKey()),l)}else{let i=o.getTextContent();if(Jt(o)){let s=o.decorate(ro,Ts);s!==null&&ML(e,s)}$n+=i}if(!kp&&oo(o)&&o.__cachedText!==$n){let i=o.getWritable();i.__cachedText=$n,o=i}return a}function ML(e,t){let n=ro._pendingDecorators,o=ro._decorators;if(n===null){if(o[e]===t)return;n=Ak(ro)}n[e]=t}function mv(e){let t=e.nextSibling;return t!==null&&t===ro._blockCursorElement&&(t=t.nextSibling),t}function FT(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function a$(e,t,n,o,r,a){$n="",Al=o===2,ro=n,Ts=n._config,Fc=n._nodes,Vp=ro._listeners.mutation,Pv=r,Ev=a,Ls=e._nodeMap,kr=t._nodeMap,kp=t._readOnly,Av=new Map(n._keyToDOMMap);let i=new Map;return Bc=i,xp("root",null),ro=void 0,Fc=void 0,Pv=void 0,Ev=void 0,Ls=void 0,kr=void 0,Ts=void 0,Av=void 0,Bc=void 0,i}function _v(e){let t=Av.get(e);return t===void 0&&J(75,e),t}function je(e){return{type:e}}var rx=je("SELECTION_CHANGE_COMMAND"),i$=je("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),RL=je("CLICK_COMMAND"),ax=je("BEFORE_INPUT_COMMAND"),ix=je("INPUT_COMMAND"),sx=je("COMPOSITION_START_COMMAND"),lx=je("COMPOSITION_END_COMMAND"),zc=je("DELETE_CHARACTER_COMMAND"),Ac=je("INSERT_LINE_BREAK_COMMAND"),Dv=je("INSERT_PARAGRAPH_COMMAND"),_l=je("CONTROLLED_TEXT_INSERTION_COMMAND"),dx=je("PASTE_COMMAND"),Ov=je("REMOVE_TEXT_COMMAND"),$c=je("DELETE_WORD_COMMAND"),Hc=je("DELETE_LINE_COMMAND"),Ci=je("FORMAT_TEXT_COMMAND"),cx=je("UNDO_COMMAND"),ux=je("REDO_COMMAND"),fx=je("KEYDOWN_COMMAND"),NL=je("KEY_ARROW_RIGHT_COMMAND"),_L=je("MOVE_TO_END"),DL=je("KEY_ARROW_LEFT_COMMAND"),OL=je("MOVE_TO_START"),FL=je("KEY_ARROW_UP_COMMAND"),BL=je("KEY_ARROW_DOWN_COMMAND"),Mp=je("KEY_ENTER_COMMAND"),zL=je("KEY_SPACE_COMMAND"),$L=je("KEY_BACKSPACE_COMMAND"),HL=je("KEY_ESCAPE_COMMAND"),UL=je("KEY_DELETE_COMMAND"),KL=je("KEY_TAB_COMMAND"),s$=je("INSERT_TAB_COMMAND"),l$=je("INDENT_CONTENT_COMMAND"),d$=je("OUTDENT_CONTENT_COMMAND"),qL=je("DROP_COMMAND"),c$=je("FORMAT_ELEMENT_COMMAND"),VL=je("DRAGSTART_COMMAND"),WL=je("DRAGOVER_COMMAND"),GL=je("DRAGEND_COMMAND"),px=je("COPY_COMMAND"),mx=je("CUT_COMMAND"),Fv=je("SELECT_ALL_COMMAND"),u$=je("CLEAR_EDITOR_COMMAND"),f$=je("CLEAR_HISTORY_COMMAND"),p$=je("CAN_REDO_COMMAND"),m$=je("CAN_UNDO_COMMAND"),jL=je("FOCUS_COMMAND"),QL=je("BLUR_COMMAND"),XL=je("KEY_MODIFIER_COMMAND"),La=Object.freeze({}),Bv=[["keydown",function(e,t){Uc=e.timeStamp,YL=e.key,!t.isComposing()&&ve(t,fx,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;Ql(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&ra(t,()=>{kk(n)||(Hv=!0)})}],["compositionstart",function(e,t){ve(t,sx,e)}],["compositionend",function(e,t){wi?Ec=!0:Gc||!Up&&!Kp?ve(t,lx,e):(yp=!0,Cp=e.data)}],["input",function(e,t){e.stopPropagation(),ra(t,()=>{t.dispatchCommand(ix,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=Nc(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(Gp(r,o,t,e))}}ve(t,RL,e)})}],["cut",La],["copy",La],["dragstart",La],["dragover",La],["dragend",La],["paste",La],["focus",La],["blur",La],["drop",La]];wp&&Bv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||wi&&Fk(o)||r!=="insertCompositionText"&&ve(o,ax,n)})(e,t)]);var Uc=0,YL=null,JL=0,Ml=null,zv=new WeakMap,Rp=new WeakMap,$v=!1,Hv=!1,Mc=!1,Ec=!1,yp=!1,Cp="",Ss=null,ZL=[0,"",0,"root",0];function ek(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&&(!wp||JL<o+50)||s.isDirty()&&m<2||Rk(n))&&a.offset!==i.offset&&!s.isComposing()||Ea(s)||s.isDirty()&&m>1||(r||!wp)&&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 BT(e,t){return aa(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function zT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;$v&&($v=!1,BT(o,r)&&BT(a,i)&&!Ss)||ra(t,()=>{if(!n)return void Fo(null);if(!Qc(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]=ZL,x=Ko(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)bp(s,p,m);else if(l.type==="text")Ne(d)||J(141),tk(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();bp(w,S,L)})(s,C):bp(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,rx,void 0)})}function bp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function tk(e,t){bp(e,t.getFormat(),t.getStyle())}function nk(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function g$(e){let t=e.inputType,n=nk(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,YL==="MediaLast"&&a<Uc+30&&o.isComposing()&&f){if(jn(null),Uc=0,setTimeout(()=>{ra(o,()=>{jn(null)})},30),Ke(r)){let p=r.anchor.getNode();p.markDirty(),Ne(p)||J(142),tk(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=Sv&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!Jt(Ok(r.anchor,!0))),!v){ve(o,zc,!0);let x=St();Sv&&Ke(x)&&x.isCollapsed()&&(Ss=x,setTimeout(()=>Ss=null))}}return!0}}var a;if(!Ke(r))return!0;let i=e.data;Ml!==null&&kx(!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(),
|
|
3698
|
-
`){let o=St();if(Ke(o)||jc(o)){if(Ke(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void ve(e,Mp,null)}}}kx(!0,e,t)}function y$(e){let t=qt();if(e.key==null)return!0;if(yp){if(fL(e))return ra(t,()=>{Np(t,Cp)}),yp=!1,Cp="",!0;yp=!1,Cp=""}if((function(n){return At(n,"ArrowRight",{shiftKey:"any"})})(e))ve(t,NL,e);else if((function(n){return At(n,"ArrowRight",Pa)})(e))ve(t,_L,e);else if((function(n){return At(n,"ArrowLeft",{shiftKey:"any"})})(e))ve(t,DL,e);else if((function(n){return At(n,"ArrowLeft",Pa)})(e))ve(t,OL,e);else if((function(n){return At(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))ve(t,FL,e);else if((function(n){return At(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))ve(t,BL,e);else if((function(n){return At(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Mc=!0,ve(t,Mp,e);else if((function(n){return n.key===" "})(e))ve(t,zL,e);else if((function(n){return Tr&&At(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Mc=!0,ve(t,Ac,!0);else if((function(n){return At(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Mc=!1,ve(t,Mp,e);else if((function(n){return At(n,"Backspace",{shiftKey:"any"})||Tr&&At(n,"h",{ctrlKey:!0})})(e))fL(e)?ve(t,$L,e):(e.preventDefault(),ve(t,zc,!0));else if((function(n){return n.key==="Escape"})(e))ve(t,HL,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,UL,e):(e.preventDefault(),ve(t,zc,!1));else if((function(n){return At(n,"Backspace",uL)})(e))e.preventDefault(),ve(t,$c,!0);else if((function(n){return At(n,"Delete",uL)})(e))e.preventDefault(),ve(t,$c,!1);else if((function(n){return Tr&&At(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),ve(t,Hc,!0);else if((function(n){return Tr&&(At(n,"Delete",{metaKey:!0})||At(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),ve(t,Hc,!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,KL,e);else if((function(n){return At(n,"z",Pa)})(e))e.preventDefault(),ve(t,cx,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,ux,void 0);else{let n=t._editorState._selection;n===null||Ke(n)?pL(e)&&(e.preventDefault(),ve(t,Fv,e)):(function(o){return At(o,"c",Pa)})(e)?(e.preventDefault(),ve(t,px,e)):(function(o){return At(o,"x",Pa)})(e)?(e.preventDefault(),ve(t,mx,e)):pL(e)&&(e.preventDefault(),ve(t,Fv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(XL,e),!0}function ok(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Dl=new Map;function rk(e){let t=Hk(e.target);if(t===null)return;let n=wx(t.anchorNode);if(n===null)return;Hv&&(Hv=!1,ra(n,()=>{let l=Ms(),d=t.anchorNode;(ko(d)||aa(d))&&Fo(Gp(l,t,n,e))}));let o=Lx(n),r=o[o.length-1],a=r._key,i=Dl.get(a),s=i||r;s!==n&&zT(t,s,!1),zT(t,n,!0),n!==r?Dl.set(a,n):i&&Dl.delete(a)}function $T(e){e._lexicalHandled=!0}function HT(e){return e._lexicalHandled===!0}var UT=()=>{};function C$(e){let t=zv.get(e);if(t===void 0)return void UT();let n=Rp.get(t);if(n===void 0)return void UT();let o=n-1;o>=0||J(164),zv.delete(e),Rp.set(t,o),o===0&&t.removeEventListener("selectionchange",rk);let r=Xc(e);Qp(r)?((function(i){if(i._parentEditor!==null){let s=Lx(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=ok(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function Uv(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 $p(f,s)&&d.set(s.__key,0,"element"),$p(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&&(Fp(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(Fp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else jc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ke(a)&&t&&!i){let s=e.getIndexWithinParent();Si(e),Op(a,r,s,-1)}else Si(e);n||ur(r)||r.canBeEmpty()||!r.isEmpty()||Uv(r,t),t&&a&&oo(r)&&r.isEmpty()&&r.selectEnd()}function b$(e){return e}var ak=Symbol.for("ephemeral");function _p(e){return e[ak]||!1}var cr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Zc(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}),Ek(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?_c(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=_c(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?zx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&J(279),!1)))}isParentOf(t){let n=_c(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(_p(this))return this;let t=Hn(this.__key);return t===null&&J(113),t}getWritable(){if(_p(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 zp(a),a;let l=_x(a);return i.add(r),zp(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 kL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&ox(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){Uv(this,!0,t)}replace(t,n){Gn();let o=St();o!==null&&(o=o.clone()),Cv(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(Uv(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&&WT(g,s),v.key===a&&WT(v,s)}return bi()===a&&jn(i),s}insertAfter(t,n=!0){Gn(),Cv(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();Op(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(),Cv(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)&&Op(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()}},I$="historic",S$="history-push",Ip="history-merge",w$="paste",ik="collaboration",T$="skip-collab",sk="skip-scroll-into-view",lk="skip-dom-selection",Kv="skip-selection-focus",dk="composition-start",ck="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&&
|
|
3699
|
+
`,ox=yi?"\xA0":_c,SL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",wL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Z5=new RegExp("^[^"+wL+"]*["+SL+"]"),e$=new RegExp("^[^"+SL+"]*["+wL+"]"),fo={bold:1,capitalize:1024,code:16,highlight:nx,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},t$={directionless:1,unmergeable:2},Lv={center:2,end:6,justify:4,left:1,right:3,start:5},n$={[j5]:"center",[J5]:"end",[X5]:"justify",[G5]:"left",[Q5]:"right",[Y5]:"start"},o$={normal:0,segmented:2,token:1},r$={[O5]:"normal",[B5]:"segmented",[F5]:"token"},a$="$",ET="$config";function TL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(Q(i)&&TL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var kv=!1,rx=0;function i$(e){rx=e.timeStamp}function gv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&Jp(e,n)!==void 0}function s$(e,t,n){let o=Er(qo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Ex(t,i,r,a,!1)}function l$(e,t,n){if(Ue(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return oa(t)&&n.isAttached()}function d$(e,t,n,o){for(let r=e;r&&!jk(r);r=Qc(r)){let a=Jp(r,t);if(a!==void 0){let i=Bn(a,n);if(i)return Qt(i)||!ko(r)?void 0:[r,i]}else if(r===o)return[o,_k(n)]}}function LL(e,t,n){kv=!0;let o=performance.now()-rx>100;try{na(e,()=>{let r=St()||(function(p){return p.getEditorState().read(()=>{let m=St();return m!==null?m.clone():null})})(e),a=new Map,i=e.getRootElement(),s=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],h=m.type,g=m.target,v=d$(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Me(y)&&oa(g)&&l$(r,g,y)&&s$(g,y,e);else if(h==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let L=C[S],I=kx(L),T=L.parentNode;if(T!=null&&L!==l&&I===null&&!gv(L,T,e)){if(yi){let E=(ko(L)?L.innerText:null)||L.nodeValue;E&&(c+=E)}T.removeChild(L)}}let w=m.removedNodes,k=w.length;if(k>0){let S=0;for(let L=0;L<k;L++){let I=w[L];(gv(I,g,e)||l===I)&&(g.appendChild(I),S++)}k!==S&&a.set(x,y)}}}if(a.size>0)for(let[p,m]of a)m.reconcileObservedMutation(p,e);let f=n.takeRecords();if(f.length>0){for(let p=0;p<f.length;p++){let m=f[p],h=m.addedNodes,g=m.target;for(let v=0;v<h.length;v++){let x=h[v],y=x.parentNode;y==null||x.nodeName!=="BR"||gv(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&Do(r),yi&&$k(e)&&r.insertRawText(c))})}finally{kv=!1}}function kL(e){let t=e._observer;t!==null&&LL(e,t.takeRecords(),t)}function PL(e){(function(t){rx===0&&qo(t).addEventListener("textInput",i$,!0)})(e),e._observer=new MutationObserver((t,n)=>{LL(e,t,n)})}var Pv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||p$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function c$(e,t){return new Pv(e,t)}function kp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function u$(e,t,n){let o=kp(e,n,"direct"),r=kp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function f$(e,t,n){let o;if(Qn(),typeof n=="function"){let a=e.getLatest(),i=kp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return ax(r).updateFromKnown(t,o),r}function AL(e){let t=new Map,n=new Set;for(let o=typeof e=="function"?e:e.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=Yc(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let i;"stateConfig"in a?(i=a.stateConfig,a.flat&&n.add(i.key)):i=a,t.set(i.key,i)}}return{flatKeys:n,sharedConfigMap:t}}var Av=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,n,o=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:i}=this.sharedNodeState,s=a!==void 0?a:(function(l,d,c){let f=c.size;if(d)for(let p in d){let m=l.get(p);m&&c.has(m)||f++}return f})(i,o,r);this.size=s}getValue(t){let n=this.knownState.get(t);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(t.key,t);let o=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(o=t.parse(r)),this.updateFromKnown(t,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete t[o.key]:t[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in t&&(n[o]=t[o],delete t[o]);return MT(t)&&(n.$=t),n}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new e(t,n,(function(a,i,s){let l;if(s)for(let[d,c]of Object.entries(s)){let f=a.get(d);f?i.has(f)||i.set(f,f.parse(c)):(l=l||{},l[d]=c)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(t,n){let o=t.key;this.sharedNodeState.sharedConfigMap.set(o,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&o in a||(a&&(delete a[o],this.unknownState=MT(a)),this.size++),r.set(t,n)}updateFromUnknown(t,n){let o=this.sharedNodeState.sharedConfigMap.get(t);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=n)}updateFromJSON(t){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,t)for(let[o,r]of Object.entries(t))this.updateFromUnknown(o,r)}};function ax(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Av(t,EL(t));return t.__state=n,n}function EL(e){return e.__state?e.__state.sharedNodeState:Sx(Dx(),e.getType()).sharedNodeState}function MT(e){if(e)for(let t in e)return e}function p$(e){return e}function RT(e,t,n){for(let[o,r]of t.knownState){if(e.has(o.key))continue;e.add(o.key);let a=n?n.getValue(o):o.defaultValue;if(a!==r&&!o.isEqual(a,r))return!0}return!1}function NT(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,i]of Object.entries(o))if(!e.has(a)&&(e.add(a),i!==(r?r[a]:void 0)))return!0}return!1}function _T(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function DT(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,i=t.__format,s=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===i)&&(r===null||r===s)&&(e.__state===null||l===d||(function(c,f){if(c===f)return!0;if(c&&f&&c.size!==f.size)return!1;let p=new Set;return!(c&&RT(p,c,f)||f&&RT(p,f,c)||c&&NT(p,c,f)||f&&NT(p,f,c))})(l,d))}function OT(e,t){let n=e.mergeWithSibling(t),o=Kt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function FT(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Me(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(DT(t,o)){o=OT(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Me(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(DT(o,n)){o=OT(o,n);break}break}n.remove()}}else o.remove()}function Pp(e){return BT(e.anchor),BT(e.focus),e}function BT(e){for(;e.type==="element";){let t=e.getNode(),n=e.offset,o,r;if(n===t.getChildrenSize()?(o=t.getChildAtIndex(n-1),r=!0):(o=t.getChildAtIndex(n),r=!1),Me(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!Q(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var ws,no,Dc,Gp,Ev,Mv,Ts,Tr,Rv,Oc,Fn="",ta=null,bs=null,kl=!1,Ap=!1;function Ep(e,t){let n=Ts.get(e);if(t!==null){let o=Ov(e);o.parentNode===t&&t.removeChild(o)}if(Tr.has(e)||no._keyToDOMMap.delete(e),Q(n)){let o=Rp(n,Ts);Nv(o,0,o.length-1,null)}n!==void 0&&Mx(Oc,Dc,Gp,n,"destroyed")}function Nv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Ep(a,o)}}function Cs(e,t){e.setProperty("text-align",t)}var m$="40px";function ML(e,t){let n=ws.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(no._rootElement||e).getPropertyValue("--lexical-indent-base-value")||m$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function RL(e,t){let n=e.style;t===0?Cs(n,""):t===1?Cs(n,"left"):t===2?Cs(n,"center"):t===3?Cs(n,"right"):t===4?Cs(n,"justify"):t===5?Cs(n,"start"):t===6&&Cs(n,"end")}function _v(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(to(o))return null;let a=o.getParentOrThrow();return to(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Mp(e,t){let n=Tr.get(e);n===void 0&&Z(60);let o=n.createDOM(ws,no);if((function(r,a,i){let s=i._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,i,r),s.set(r,a)})(e,o,no),Me(n)?o.setAttribute("data-lexical-text","true"):Qt(n)&&o.setAttribute("data-lexical-decorator","true"),Q(n)){let r=n.__indent,a=n.__size;if(_v(o,n),r!==0&&ML(o,r),a!==0){let s=a-1;Dv(Rp(n,Tr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&RL(o,i),n.isInline()||NL(null,n,o)}else{let r=n.getTextContent();if(Qt(n)){let a=n.decorate(no,ws);a!==null&&_L(e,a),o.contentEditable="false"}Fn+=r}return t!==null&&t.insertChild(o),Mx(Oc,Dc,Gp,n,"created"),o}function Dv(e,t,n,o,r){let a=Fn;Fn="";let i=n;for(;i<=o;++i){Mp(e[i],r);let s=Tr.get(e[i]);s!==null&&Me(s)?ta===null&&(ta=s.getFormat(),bs=s.getStyle()):Q(s)&&i<o&&!s.isInline()&&(Fn+=Wp)}r.element.__lexicalTextContent=Fn,Fn=a+Fn}function zT(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return Ss(o)?"line-break":Qt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function NL(e,t,n){let o=zT(e,Ts),r=zT(t,Tr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function g$(e,t,n){var o;ta=null,bs=null,(function(r,a,i){let s=Fn,l=r.__size,d=a.__size;Fn="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Cp(f,c);else{let h=Ov(f),g=Mp(p,null);try{c.replaceChild(g,h)}catch(v){if(typeof v=="object"&&v!=null){let x=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${g.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(x)}throw v}Ep(f,null)}let m=Tr.get(p);Me(m)&&ta===null&&(ta=m.getFormat(),bs=m.getStyle())}else{let f=Rp(r,Ts),p=Rp(a,Tr);if(f.length!==l&&Z(227),p.length!==d&&Z(228),l===0)d!==0&&Dv(p,0,0,d-1,i);else if(d===0){if(l!==0){let m=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;Nv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,h,g,v,x,y){let C=v-1,w=x-1,k,S,L=y.getFirstChild(),I=0,T=0;for(;I<=C&&T<=w;){let N=h[I],R=g[T];if(N===R)L=hv(Cp(R,y.element)),I++,T++;else{if(S===void 0&&(S=$T(g,T)),k===void 0)k=$T(h,I);else if(!k.has(N)){I++;continue}if(!S.has(N)){L=hv(Ov(N)),Ep(N,y.element),I++,k.delete(N);continue}if(k.has(R)){let H=zl(no,R);H!==L&&y.withBefore(L).insertChild(H),L=hv(Cp(R,y.element)),I++,T++}else Mp(R,y.withBefore(L)),T++}let $=Tr.get(R);$!==null&&Me($)?ta===null&&(ta=$.getFormat(),bs=$.getStyle()):Q($)&&T<=w&&!$.isInline()&&(Fn+=Wp)}let E=I>C,A=T>w;if(E&&!A){let N=g[w+1],R=N===void 0?null:no.getElementByKey(N);Dv(g,0,T,w,y.withBefore(R))}else A&&!E&&Nv(h,I,C,y.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=Fn,Fn=s+Fn})(e,t,t.getDOMSlot(n)),o=t,ta==null||ta===o.__textFormat||Ap||o.setTextFormat(ta),(function(r){bs==null||bs===r.__textStyle||Ap||r.setTextStyle(bs)})(t)}function Rp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&Z(101),n.push(o),o=r.__next}return n}function Cp(e,t){let n=Ts.get(e),o=Tr.get(e);n!==void 0&&o!==void 0||Z(61);let r=kl||Mv.has(e)||Ev.has(e),a=zl(no,e);if(n===o&&!r){let i;if(Q(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return Fn+=i,a}if(n!==o&&r&&Mx(Oc,Dc,Gp,o,"updated"),o.updateDOM(n,a,ws)){let i=Mp(e,null);return t===null&&Z(62),t.replaceChild(i,a),Ep(e,null),i}if(Q(n)){Q(o)||Z(334,e);let i=o.__indent;(kl||i!==n.__indent)&&ML(a,i);let s=o.__format;if((kl||s!==n.__format)&&RL(a,s),r)g$(n,o,a),to(o)||o.isInline()||NL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),Fn+=d}if((kl||o.__dir!==n.__dir)&&(_v(a,o),to(o)&&!kl))for(let l of o.getChildren())Q(l)&&_v(zl(no,l.getKey()),l)}else{let i=o.getTextContent();if(Qt(o)){let s=o.decorate(no,ws);s!==null&&_L(e,s)}Fn+=i}if(!Ap&&to(o)&&o.__cachedText!==Fn){let i=o.getWritable();i.__cachedText=Fn,o=i}return a}function _L(e,t){let n=no._pendingDecorators,o=no._decorators;if(n===null){if(o[e]===t)return;n=Nk(no)}n[e]=t}function hv(e){let t=e.nextSibling;return t!==null&&t===no._blockCursorElement&&(t=t.nextSibling),t}function $T(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function h$(e,t,n,o,r,a){Fn="",kl=o===2,no=n,ws=n._config,Dc=n._nodes,Gp=no._listeners.mutation,Ev=r,Mv=a,Ts=e._nodeMap,Tr=t._nodeMap,Ap=t._readOnly,Rv=new Map(n._keyToDOMMap);let i=new Map;return Oc=i,Cp("root",null),no=void 0,Dc=void 0,Ev=void 0,Mv=void 0,Ts=void 0,Tr=void 0,ws=void 0,Rv=void 0,Oc=void 0,i}function Ov(e){let t=Rv.get(e);return t===void 0&&Z(75,e),t}function Ge(e){return{type:e}}var ix=Ge("SELECTION_CHANGE_COMMAND"),v$=Ge("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),DL=Ge("CLICK_COMMAND"),sx=Ge("BEFORE_INPUT_COMMAND"),lx=Ge("INPUT_COMMAND"),dx=Ge("COMPOSITION_START_COMMAND"),cx=Ge("COMPOSITION_END_COMMAND"),Fc=Ge("DELETE_CHARACTER_COMMAND"),Pc=Ge("INSERT_LINE_BREAK_COMMAND"),Fv=Ge("INSERT_PARAGRAPH_COMMAND"),Ml=Ge("CONTROLLED_TEXT_INSERTION_COMMAND"),ux=Ge("PASTE_COMMAND"),Bv=Ge("REMOVE_TEXT_COMMAND"),Bc=Ge("DELETE_WORD_COMMAND"),zc=Ge("DELETE_LINE_COMMAND"),gi=Ge("FORMAT_TEXT_COMMAND"),fx=Ge("UNDO_COMMAND"),px=Ge("REDO_COMMAND"),mx=Ge("KEYDOWN_COMMAND"),OL=Ge("KEY_ARROW_RIGHT_COMMAND"),FL=Ge("MOVE_TO_END"),BL=Ge("KEY_ARROW_LEFT_COMMAND"),zL=Ge("MOVE_TO_START"),$L=Ge("KEY_ARROW_UP_COMMAND"),HL=Ge("KEY_ARROW_DOWN_COMMAND"),Np=Ge("KEY_ENTER_COMMAND"),UL=Ge("KEY_SPACE_COMMAND"),KL=Ge("KEY_BACKSPACE_COMMAND"),qL=Ge("KEY_ESCAPE_COMMAND"),VL=Ge("KEY_DELETE_COMMAND"),WL=Ge("KEY_TAB_COMMAND"),x$=Ge("INSERT_TAB_COMMAND"),y$=Ge("INDENT_CONTENT_COMMAND"),C$=Ge("OUTDENT_CONTENT_COMMAND"),GL=Ge("DROP_COMMAND"),b$=Ge("FORMAT_ELEMENT_COMMAND"),jL=Ge("DRAGSTART_COMMAND"),QL=Ge("DRAGOVER_COMMAND"),XL=Ge("DRAGEND_COMMAND"),gx=Ge("COPY_COMMAND"),hx=Ge("CUT_COMMAND"),zv=Ge("SELECT_ALL_COMMAND"),I$=Ge("CLEAR_EDITOR_COMMAND"),S$=Ge("CLEAR_HISTORY_COMMAND"),w$=Ge("CAN_REDO_COMMAND"),T$=Ge("CAN_UNDO_COMMAND"),YL=Ge("FOCUS_COMMAND"),JL=Ge("BLUR_COMMAND"),ZL=Ge("KEY_MODIFIER_COMMAND"),wa=Object.freeze({}),$v=[["keydown",function(e,t){$c=e.timeStamp,ek=e.key,!t.isComposing()&&Ce(t,mx,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;Wl(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&na(t,()=>{Ek(n)||(Kv=!0)})}],["compositionstart",function(e,t){Ce(t,dx,e)}],["compositionend",function(e,t){yi?kc=!0:Vc||!qp&&!Vp?Ce(t,cx,e):(bp=!0,Ip=e.data)}],["input",function(e,t){e.stopPropagation(),na(t,()=>{t.dispatchCommand(lx,e)},{event:e}),Pl=null}],["click",function(e,t){na(t,()=>{let n=St(),o=Er(qo(t)),r=Es();if(o){if(Ue(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!to(i)&&Ko().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&i!==n.focus.getNode()){let s=Mc(i,l=>Q(l)&&!l.isInline());Q(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(ko(a)||oa(a))&&Do(Qp(r,o,t,e))}}Ce(t,DL,e)})}],["cut",wa],["copy",wa],["dragstart",wa],["dragover",wa],["dragend",wa],["paste",wa],["focus",wa],["blur",wa],["drop",wa]];Lp&&$v.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||yi&&$k(o)||r!=="insertCompositionText"&&Ce(o,sx,n)})(e,t)]);var $c=0,ek=null,tk=0,Pl=null,Hv=new WeakMap,_p=new WeakMap,Uv=!1,Kv=!1,Ac=!1,kc=!1,bp=!1,Ip="",Is=null,nk=[0,"",0,"root",0];function ok(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Kt(),d=Er(qo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Me(s)||(!r&&(!Lp||tk<o+50)||s.isDirty()&&m<2||Dk(n))&&a.offset!==i.offset&&!s.isComposing()||ka(s)||s.isDirty()&&m>1||(r||!Lp)&&p!==null&&!s.isComposing()&&c!==Ps(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||(function(h,g){if(g.isSegmented())return!0;if(!h.isCollapsed())return!1;let v=h.anchor.offset,x=g.getParentOrThrow(),y=vi(g);return v===0?!g.canInsertTextBefore()||!x.canInsertTextBefore()&&!g.isComposing()||y||(function(C){let w=C.getPreviousSibling();return(Me(w)||Q(w)&&w.isInline())&&!w.canInsertTextAfter()})(g):v===g.getTextContentSize()&&(!g.canInsertTextAfter()||!x.canInsertTextAfter()&&!g.isComposing()||y)})(e,s)}function HT(e,t){return oa(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function UT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Uv&&(Uv=!1,HT(o,r)&&HT(a,i)&&!Is)||na(t,()=>{if(!n)return void Do(null);if(!Gc(t,o,a))return;let s=St();if(Is&&Ue(s)&&s.isCollapsed()){let l=s.anchor,d=Is.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=Is.clone(),Do(s))}if(Is=null,Ue(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=qo(t).event,f=c?c.timeStamp:performance.now(),[p,m,h,g,v]=nk,x=Ko(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)Sp(s,p,m);else if(l.type==="text")Me(d)||Z(141),rk(s,d);else if(l.type==="element"&&!y){Q(d)||Z(259);let C=l.getNode();C.isEmpty()?(function(w,k){let S=k.getTextFormat(),L=k.getTextStyle();Sp(w,S,L)})(s,C):Sp(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,h=s.isBackward(),g=h?i:r,v=h?r:i,x=h?f:c,y=h?c:f,C=2047,w=!1;for(let k=0;k<m;k++){let S=p[k],L=S.getTextContentSize();if(Me(S)&&L!==0&&!(k===0&&S.__key===x&&g===L||k===m-1&&S.__key===y&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Ce(t,ix,void 0)})}function Sp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function rk(e,t){Sp(e,t.getFormat(),t.getStyle())}function ak(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function L$(e){let t=e.inputType,n=ak(e),o=Kt(),r=St();if(t==="deleteContentBackward"){if(r===null){let f=Es();if(!Ue(f))return!0;Do(f.clone())}if(Ue(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,ek==="MediaLast"&&a<$c+30&&o.isComposing()&&f){if(Xn(null),$c=0,setTimeout(()=>{na(o,()=>{Xn(null)})},30),Ue(r)){let p=r.anchor.getNode();p.markDirty(),Me(p)||Z(142),rk(r,p)}}else{Xn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),h=p.canInsertTextAfter(),g=r.anchor.offset===0&&r.focus.offset===m.length,v=Tv&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!Qt(zk(r.anchor,!0))),!v){Ce(o,Fc,!0);let x=St();Tv&&Ue(x)&&x.isCollapsed()&&(Is=x,setTimeout(()=>Is=null))}}return!0}}var a;if(!Ue(r))return!0;let i=e.data;Pl!==null&&Ax(!1,o,Pl),r.dirty&&Pl===null||!r.isCollapsed()||to(r.anchor.getNode())||n===null||r.applyDOMRange(n),Pl=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
|
|
3700
|
+
`)e.preventDefault(),Ce(o,Pc,!1);else if(i===Wp)e.preventDefault(),Ce(o,Fv,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&ok(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Ce(o,Ml,i)):Pl=i;return tk=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Ce(o,Ml,e);break;case"insertFromComposition":Xn(null),Ce(o,Ml,e);break;case"insertLineBreak":Xn(null),Ce(o,Pc,!1);break;case"insertParagraph":Xn(null),Ac&&!Vc?(Ac=!1,Ce(o,Pc,!1)):Ce(o,Fv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Ce(o,ux,e);break;case"deleteByComposition":(function(f,p){return f!==p||Q(f)||Q(p)||!vi(f)||!vi(p)})(d,c)&&Ce(o,Bv,e);break;case"deleteByDrag":case"deleteByCut":Ce(o,Bv,e);break;case"deleteContent":Ce(o,Fc,!1);break;case"deleteWordBackward":Ce(o,Bc,!0);break;case"deleteWordForward":Ce(o,Bc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Ce(o,zc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Ce(o,zc,!1);break;case"formatStrikeThrough":Ce(o,gi,"strikethrough");break;case"formatBold":Ce(o,gi,"bold");break;case"formatItalic":Ce(o,gi,"italic");break;case"formatUnderline":Ce(o,gi,"underline");break;case"historyUndo":Ce(o,fx,void 0);break;case"historyRedo":Ce(o,px,void 0)}return!0}function k$(e){if(ko(e.target)&&Ek(e.target))return!0;let t=Kt(),n=St(),o=e.data,r=ak(e);if(o!=null&&Ue(n)&&ok(n,r,o,e.timeStamp,!1)){kc&&(Dp(t,o),kc=!1);let a=n.anchor.getNode(),i=Er(qo(t));if(i===null)return!0;let s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,d=s?n.focus.offset:n.anchor.offset;Lp&&!n.isCollapsed()&&Me(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===Fk(i.anchorNode)||Ce(t,Ml,o);let c=o.length;yi&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Tv&&t.isComposing()&&($c=0,Xn(null))}else Ax(!1,t,o!==null?o:void 0),kc&&(Dp(t,o||void 0),kc=!1);return(function(){Qn();let a=Kt();kL(a)})(),!0}function P$(e){let t=Kt(),n=St();if(Ue(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Xn(o.key),em(fk),(e.timeStamp<$c+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Me(r)&&r.getStyle()!==n.style)&&Ce(t,Ml,ox)}return!0}function A$(e){return Dp(Kt(),e.data),em(pk),!0}function Dp(e,t){let n=e._compositionKey;if(Xn(null),n!==null&&t!=null){if(t===""){let o=Bn(n),r=Ps(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Me(o)){let a=Er(qo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Ex(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
|
|
3701
|
+
`){let o=St();if(Ue(o)||Wc(o)){if(Ue(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Ce(e,Np,null)}}}Ax(!0,e,t)}function E$(e){let t=Kt();if(e.key==null)return!0;if(bp){if(gL(e))return na(t,()=>{Dp(t,Ip)}),bp=!1,Ip="",!0;bp=!1,Ip=""}if((function(n){return Pt(n,"ArrowRight",{shiftKey:"any"})})(e))Ce(t,OL,e);else if((function(n){return Pt(n,"ArrowRight",La)})(e))Ce(t,FL,e);else if((function(n){return Pt(n,"ArrowLeft",{shiftKey:"any"})})(e))Ce(t,BL,e);else if((function(n){return Pt(n,"ArrowLeft",La)})(e))Ce(t,zL,e);else if((function(n){return Pt(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Ce(t,$L,e);else if((function(n){return Pt(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Ce(t,HL,e);else if((function(n){return Pt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Ac=!0,Ce(t,Np,e);else if((function(n){return n.key===" "})(e))Ce(t,UL,e);else if((function(n){return Sr&&Pt(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Ac=!0,Ce(t,Pc,!0);else if((function(n){return Pt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Ac=!1,Ce(t,Np,e);else if((function(n){return Pt(n,"Backspace",{shiftKey:"any"})||Sr&&Pt(n,"h",{ctrlKey:!0})})(e))gL(e)?Ce(t,KL,e):(e.preventDefault(),Ce(t,Fc,!0));else if((function(n){return n.key==="Escape"})(e))Ce(t,qL,e);else if((function(n){return Pt(n,"Delete",{})||Sr&&Pt(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Ce(t,VL,e):(e.preventDefault(),Ce(t,Fc,!1));else if((function(n){return Pt(n,"Backspace",mL)})(e))e.preventDefault(),Ce(t,Bc,!0);else if((function(n){return Pt(n,"Delete",mL)})(e))e.preventDefault(),Ce(t,Bc,!1);else if((function(n){return Sr&&Pt(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Ce(t,zc,!0);else if((function(n){return Sr&&(Pt(n,"Delete",{metaKey:!0})||Pt(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Ce(t,zc,!1);else if((function(n){return Pt(n,"b",La)})(e))e.preventDefault(),Ce(t,gi,"bold");else if((function(n){return Pt(n,"u",La)})(e))e.preventDefault(),Ce(t,gi,"underline");else if((function(n){return Pt(n,"i",La)})(e))e.preventDefault(),Ce(t,gi,"italic");else if((function(n){return Pt(n,"Tab",{shiftKey:"any"})})(e))Ce(t,WL,e);else if((function(n){return Pt(n,"z",La)})(e))e.preventDefault(),Ce(t,fx,void 0);else if((function(n){return Sr?Pt(n,"z",{metaKey:!0,shiftKey:!0}):Pt(n,"y",{ctrlKey:!0})||Pt(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Ce(t,px,void 0);else{let n=t._editorState._selection;n===null||Ue(n)?hL(e)&&(e.preventDefault(),Ce(t,zv,e)):(function(o){return Pt(o,"c",La)})(e)?(e.preventDefault(),Ce(t,gx,e)):(function(o){return Pt(o,"x",La)})(e)?(e.preventDefault(),Ce(t,hx,e)):hL(e)&&(e.preventDefault(),Ce(t,zv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(ZL,e),!0}function ik(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Rl=new Map;function sk(e){let t=qk(e.target);if(t===null)return;let n=Lx(t.anchorNode);if(n===null)return;Kv&&(Kv=!1,na(n,()=>{let l=Es(),d=t.anchorNode;(ko(d)||oa(d))&&Do(Qp(l,t,n,e))}));let o=Px(n),r=o[o.length-1],a=r._key,i=Rl.get(a),s=i||r;s!==n&&UT(t,s,!1),UT(t,n,!0),n!==r?Rl.set(a,n):i&&Rl.delete(a)}function KT(e){e._lexicalHandled=!0}function qT(e){return e._lexicalHandled===!0}var VT=()=>{};function M$(e){let t=Hv.get(e);if(t===void 0)return void VT();let n=_p.get(t);if(n===void 0)return void VT();let o=n-1;o>=0||Z(164),Hv.delete(e),_p.set(t,o),o===0&&t.removeEventListener("selectionchange",sk);let r=jc(e);Yp(r)?((function(i){if(i._parentEditor!==null){let s=Px(i),l=s[s.length-1]._key;Rl.get(l)===i&&Rl.delete(l)}else Rl.delete(i._key)})(r),e.__lexicalEditor=null):r&&Z(198);let a=ik(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function qv(e,t,n){Qn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=St();if(!Ue(l)||!Q(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return Up(f,s)&&d.set(s.__key,0,"element"),Up(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ue(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(zp(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(zp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else Wc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ue(a)&&t&&!i){let s=e.getIndexWithinParent();xi(e),Bp(a,r,s,-1)}else xi(e);n||cr(r)||r.canBeEmpty()||!r.isEmpty()||qv(r,t),t&&a&&to(r)&&r.isEmpty()&&r.selectEnd()}function R$(e){return e}var lk=Symbol.for("ephemeral");function Op(e){return e[lk]||!1}var dr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Yc(this);return t===void 0&&Z(64,this.name),t}static clone(t){Z(65,this.name)}$config(){return{}}config(t,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:t}),{[t]:n}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Rk(this,t)}getType(){return this.__type}isInline(){Z(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Bn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||St();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Me(this))return o;if(Ue(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Qt(this)&&this.isInline()&&r){let a=n.isBackward()?n.focus:n.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let n=t.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Bn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&Z(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(cr(n))return Q(t)||t===this&&Qt(t)||Z(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&Z(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Bn(t)}getPreviousSiblings(){let t=[],n=this.getParent();if(n===null)return t;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)t.push(o),o=o.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Bn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=Q(this)?this:this.getParent(),o=Q(t)?t:t.getParent(),r=n&&o?Rc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Rc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Hx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&Z(279),!1)))}isParentOf(t){let n=Rc(this,t);return n!==null&&n.type==="ancestor"}getNodesBetween(t){let n=this.isBefore(t),o=[],r=new Set,a=this;for(;a!==null;){let i=a.__key;if(r.has(i)||(r.add(i),o.push(a)),a===t)break;let s=Q(a)?n?a.getFirstChild():a.getLastChild():null;if(s!==null){a=s;continue}let l=n?a.getNextSibling():a.getPreviousSibling();if(l!==null){a=l;continue}let d=a.getParentOrThrow();if(r.has(d.__key)||o.push(d),d===t)break;let c=null,f=d;do{if(f===null&&Z(68),c=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||r.has(f.__key)||o.push(f)}while(c===null);a=c}return n||o.reverse(),o}isDirty(){let t=Kt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Op(this))return this;let t=Bn(this.__key);return t===null&&Z(113),t}getWritable(){if(Op(this))return this;Qn();let t=Na(),n=Kt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=St();if(s!==null&&s.setCachedNodes(null),i.has(r))return Hp(a),a;let l=Ox(a);return i.add(r),Hp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){Z(70)}updateDOM(t,n,o){Z(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){let t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){Z(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of EL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&ax(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){qv(this,!0,t)}replace(t,n){Qn();let o=St();o!==null&&(o=o.clone()),Iv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;xi(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;if(qv(r,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,s.__prev=p,f===null?l.__last=i:f.getWritable().__prev=i,s.__next=m,s.__parent=h,l.__size=d,n&&(Q(this)&&Q(s)||Z(139),this.getChildren().forEach(g=>{s.append(g)})),Ue(o)){Do(o);let g=o.anchor,v=o.focus;g.key===a&&QT(g,s),v.key===a&&QT(v,s)}return hi()===a&&Xn(i),s}insertAfter(t,n=!0){Qn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=St(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(xi(r),Ue(i)){let h=a.__key,g=i.anchor,v=i.focus;s=g.type==="element"&&g.key===h&&g.offset===m+1,l=v.type==="element"&&v.key===h&&v.offset===m+1}}let d=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=r.__key,p=o.__next;if(d===null?c.__last=f:d.getWritable().__prev=f,c.__size++,o.__next=f,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&Ue(i)){let m=this.getIndexWithinParent();Bp(i,c,m+1);let h=c.__key;s&&i.anchor.set(h,m+2,"element"),l&&i.focus.set(h,m+2,"element")}return t}insertBefore(t,n=!0){Qn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;xi(r);let i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();i===null?s.__first=a:i.getWritable().__next=a,s.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=St();return n&&Ue(c)&&Bp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Ea()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){Qn();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(Q(o))return o.select();if(!Me(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){Qn();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(Q(o))return o.select(0,0);if(!Me(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},N$="historic",_$="history-push",wp="history-merge",D$="paste",dk="collaboration",O$="skip-collab",ck="skip-scroll-into-view",uk="skip-dom-selection",Vv="skip-selection-focus",fk="composition-start",pk="composition-end",_l=class e extends dr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
|
|
3702
|
+
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&hp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&hp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&hp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&hp(a))return!0}return!1})(t)?null:{conversion:F$,priority:0}}}static importJSON(t){return Dl().updateFromJSON(t)}};function F$(e){return{node:Dl()}}function Dl(){return Xc(new _l)}function Ss(e){return e instanceof _l}function hp(e){return oa(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function vv(e,t){return 16&t?"code":t&nx?"mark":32&t?"sub":64&t?"sup":null}function xv(e,t){return 1&t?"strong":2&t?"em":"span"}function mk(e,t,n,o,r){let a=o.classList,i=Nl(r,"base");i!==void 0&&a.add(...i),i=Nl(r,"underlineStrikethrough");let s=!1,l=8&t&&4&t;i!==void 0&&(8&n&&4&n?(s=!0,l||a.add(...i)):l&&a.remove(...i));for(let d in fo){let c=fo[d];if(i=Nl(r,d),i!==void 0)if(n&c){if(s&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...i);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...i)}else t&c&&a.remove(...i)}}function gk(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?_c:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||yi){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,h=0,g=0;for(;h<p&&h<m&&c[h]===f[h];)h++;for(;g+h<p&&g+h<m&&c[p-g-1]===f[m-g-1];)g++;return[h,p-h-g,f.slice(h,m-g)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function WT(e,t,n,o,r,a){gk(r,e,t);let i=a.theme.text;i!==void 0&&mk(0,0,o,e,i)}function vp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Ls=class e extends dr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",n){super(n),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return r$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===hi()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=fo[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Kc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=vv(0,o),a=xv(0,o),i=r===null?a:r,s=document.createElement(i),l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),s.appendChild(l)),WT(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(s.style.cssText=d),s}updateDOM(t,n,o){let r=this.__text,a=t.__format,i=this.__format,s=vv(0,a),l=vv(0,i),d=xv(0,a),c=xv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let g=n.firstChild;g==null&&Z(48);let v=document.createElement(c);return WT(v,this,0,i,r,o),n.replaceChild(v,g),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&Z(49)),gk(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&mk(0,a,i,f,p);let m=t.__style,h=this.__style;return m!==h&&(n.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:H$,priority:0}),b:()=>({conversion:z$,priority:0}),code:()=>({conversion:Ta,priority:0}),em:()=>({conversion:Ta,priority:0}),i:()=>({conversion:Ta,priority:0}),mark:()=>({conversion:Ta,priority:0}),s:()=>({conversion:Ta,priority:0}),span:()=>({conversion:B$,priority:0}),strong:()=>({conversion:Ta,priority:0}),sub:()=>({conversion:Ta,priority:0}),sup:()=>({conversion:Ta,priority:0}),u:()=>({conversion:Ta,priority:0})}}static importJSON(t){return jn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:n}=super.exportDOM(t);return ko(n)||Z(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=vp(n,"b")),this.hasFormat("italic")&&(n=vp(n,"i")),this.hasFormat("strikethrough")&&(n=vp(n,"s")),this.hasFormat("underline")&&(n=vp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,n){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?fo[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?t$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Kc(this.getFormat(),t,null);return this.setFormat(n)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let n=o$[t];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){Qn();let o=t,r=n,a=St(),i=this.getTextContent(),s=this.__key;if(typeof i=="string"){let l=i.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!Ue(a))return xk(s,o,s,r,"text","text");{let l=hi();l!==a.anchor.key&&l!==a.focus.key||Xn(s),a.setTextNodeRange(this,o,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,n,o,r){let a=this.getWritable(),i=a.__text,s=o.length,l=t;l<0&&(l=s+l,l<0&&(l=0));let d=St();if(r&&Ue(d)){let f=t+s;d.setTextNodeRange(a,f,a,f)}let c=i.slice(0,l)+o+i.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Qn();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=hi(),i=o.length;t.sort((I,T)=>I-T),t.push(i);let s=[],l=t.length;for(let I=0,T=0;I<i&&T<=l;T++){let E=t[T];E>I&&(s.push(o.slice(I,E)),I=E)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),h=n.getStyle(),g=n.__detail,v=!1,x=null,y=null,C=St();if(Ue(C)){let[I,T]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];I.type==="text"&&I.key===r&&(x=I),T.type==="text"&&T.key===r&&(y=T)}n.isSegmented()?(p=jn(c),p.__format=m,p.__style=h,p.__detail=g,p.__state=_T(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let I=1;I<d;I++){let T=jn(s[I]);T.__format=m,T.__style=h,T.__detail=g,T.__state=_T(n,T);let E=T.__key;a===r&&Xn(E),w.push(T)}let k=x?x.offset:null,S=y?y.offset:null,L=0;for(let I of w){if(!x&&!y)break;let T=L+I.getTextContentSize();if(x!==null&&k!==null&&k<=T&&k>=L&&(x.set(I.getKey(),k-L,"text"),k<T&&(x=null)),y!==null&&S!==null&&S<=T&&S>=L){y.set(I.getKey(),S-L,"text");break}L=T}if(f!==null){(function(E){let A=E.getPreviousSibling(),N=E.getNextSibling();A!==null&&Hp(A),N!==null&&Hp(N)})(this);let I=f.getWritable(),T=this.getIndexWithinParent();v?(I.splice(T,0,w),this.remove()):I.splice(T,1,w),Ue(C)&&Bp(C,f,T,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||Z(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;hi()===r&&Xn(o);let s=St();if(Ue(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&nL(f,n,o,t,i),p!==null&&p.key===r&&nL(p,n,o,t,i)}let l=t.__text,d=n?l+a:a+l;this.setTextContent(d);let c=this.getWritable();return t.remove(),c}isTextEntity(){return!1}};function B$(e){return{forChild:vx(e.style),node:null}}function z$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:vx(t.style,n?void 0:"bold"),node:null}}var GT=new WeakMap;function $$(e){if(!ko(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function H$(e){let t=e;e.parentElement===null&&Z(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=GT.get(a))===void 0&&!$$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)GT.set(i[l],s);return s})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let i=0;i<a;i++){let s=o[i];s===`
|
|
3700
3703
|
`||s===`\r
|
|
3701
|
-
`?r.push(
|
|
3702
|
-
`),c=!p.isEmpty();else if(c=!1,
|
|
3704
|
+
`?r.push(Dl()):s===" "?r.push(jp()):s!==""&&r.push(jn(s))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=t,r=!0;for(;o!==null&&(o=jT(o,!1))!==null;){let a=o.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=t,r=!0;for(;o!==null&&(o=jT(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:jn(n)}}function jT(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,ko(n)){let a=n.style.display;if(a===""&&!Wk(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(oa(n))return n;if(n.nodeName==="BR")return null}}var U$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ta(e){let t=U$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:vx(e.style,t),node:null}}function jn(e=""){return Xc(new Ls(e))}function Me(e){return e instanceof Ls}function vx(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),i=e.fontStyle==="italic",s=o.includes("underline"),l=e.verticalAlign;return d=>(Me(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),i&&!d.hasFormat("italic")&&d.toggleFormat("italic"),s&&!d.hasFormat("underline")&&d.toggleFormat("underline"),l!=="sub"||d.hasFormat("subscript")||d.toggleFormat("subscript"),l!=="super"||d.hasFormat("superscript")||d.toggleFormat("superscript"),t&&!d.hasFormat(t)&&d.toggleFormat(t)),d)}var Ol=class e extends Ls{static getType(){return"tab"}static clone(t){return new e(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){let n=super.createDOM(t),o=Nl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return jp().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&bL(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||Z(286),this}setDetail(t){return t!==2&&Z(127),this}setMode(t){return t!=="normal"&&Z(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function jp(){return Xc(new Ol)}function xx(e){return e instanceof Ol}var Wv=class{key;offset;type;_selection;constructor(t,n,o){this._selection=null,this.key=t,this.offset=n,this.type=o}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:$x(wr(wi(this,"next")),wr(wi(t,"next")))<0}getNode(){let t=Bn(this.key);return t===null&&Z(20),t}set(t,n,o,r){let a=this._selection,i=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,Vl()||(hi()===i&&Xn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Pr(e,t,n){return new Wv(e,t,n)}function yv(e,t){let n=t.__key,o=e.offset,r="element";if(Me(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!Q(t)){let a=t.getNextSibling();if(Me(a))n=a.__key,o=0,r="text";else{let i=t.getParent();i&&(n=i.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function QT(e,t){if(Q(t)){let n=t.getLastDescendant();Q(n)||Me(n)?yv(e,n):yv(e,t)}else yv(e,t)}var Fp=class e{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!Wc(t))return!1;let n=this._nodes,o=t._nodes;return n.size===o.size&&Array.from(n).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){let n=this.getNodes(),o=n.length,r=n[o-1],a;if(Me(r))a=r.select();else{let i=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(i,i)}a.insertNodes(t);for(let i=0;i<o;i++)n[i].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=Bn(r);a!==null&&o.push(a)}return Vl()||(this._cachedNodes=o),o}getTextContent(){let t=this.getNodes(),n="";for(let o=0;o<t.length;o++)n+=t[o].getTextContent();return n}deleteNodes(){let t=this.getNodes();if((St()||Es())===this&&t[0]){let n=Zn(t[0],"next");Yk(Si(n,n))}for(let n of t)n.remove()}};function Ue(e){return e instanceof ks}var ks=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,n,o,r){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Ue(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=(function(o){let r=[],[a,i]=o.getTextSlices();a&&r.push(a.caret.origin);let s=new Set,l=new Set;for(let d of o)if(Lr(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;Q(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),As(o.focus)&&Q(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Ra(o.focus.origin,"previous");Lr(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Kl(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!Q(d)||l.has(d)||d.isEmpty()||s.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=wr(o.anchor),c=wr(o.anchor.getFlipped()),f=m=>Ma(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(Ux(tx(this),"next"));return Vl()||(this._cachedNodes=n),n}setTextNodeRange(t,n,o,r){this.anchor.set(t.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],o=t[t.length-1],r=this.anchor,a=this.focus,i=r.isBefore(a),[s,l]=Gv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(Q(p)&&!p.isInline())c||(d+=`
|
|
3705
|
+
`),c=!p.isEmpty();else if(c=!1,Me(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=s<l?m.slice(s,l):m.slice(l,s)):m=i?m.slice(s):m.slice(l):p===o&&(m=i?m.slice(0,l):m.slice(0,s)),d+=m}else!Qt(p)&&!Ss(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Kt(),o=n.getEditorState()._selection,r=vk(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,i]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(i.key,i.offset,i.type,!0),Pp(this)}clone(){let t=this.anchor,n=this.focus;return new e(Pr(t.key,t.offset,t.type),Pr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Kc(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let n=fo[t];return(this.format&n)!==0}insertRawText(t){let n=t.split(/(\r?\n|\t)/),o=[],r=n.length;for(let a=0;a<r;a++){let i=n[a];i===`
|
|
3703
3706
|
`||i===`\r
|
|
3704
|
-
`?o.push(Bl()):i===" "?o.push(Wp()):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),Sk(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(""),pk(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(hx(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;Dc(this,Qk(Zv(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=Nc(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=xv(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=xv(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=Nc(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=xv(this),n=Nc(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]=Vv(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(tL(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()||jv(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&&vk(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:zk(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];$p(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"&&tL(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=Ox(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);Dc(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=vx();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 Dc(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&&jT(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 QT(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 QT(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!(Rk(w)||R$(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&&jT(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 jc(e){return e instanceof Dp}function GT(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Vv(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]:[GT(n),GT(o)]}function jT(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 R$=(()=>{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 QT(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 XT(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 YT(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 pk(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);YT(e,o,r),YT(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function mk(e,t,n,o,r,a){if(e===null||n===null||!Qc(r,e,n))return null;let i=XT(e,t,Ke(a)?a.anchor:null,r);if(i===null)return null;let s=XT(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 pk(i,s),[i,s]}function N$(e){return Q(e)&&!e.isInline()}function gk(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 hk(){let e=Ar("root",0,"element"),t=Ar("root",0,"element");return new Ps(e,t,0,"")}function vx(){return new Dp(new Set)}function _$(e,t){return Gp(null,e,t,null)}function Gp(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=!Tv&&(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)&&!Qc(n,d,c))return e.clone();let m=mk(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 Op(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"),JT(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")}}JT(e)}function JT(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 Fp(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 ZT(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 vk(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function eL(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 D$(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(ik)&&f!==a||f!==null&&Sx(f))return;if(!Ke(t))return void(e!==null&&Qc(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=eL(n,h,p.offset),[y,C]=eL(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(),ZL=[A,E,N,R,B]),d!==x||c!==C||s!==L||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Kv)||a.focus({preventScroll:!0}),p.type==="element"))){if(vk(o,L,x,I,C),!wi||!t.isCollapsed()||a===null||r.has(Kv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(sk)&&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=Ax(ee),De=Mx(W);if(W===null||De===null)return;let{top:be,bottom:ue}=ne,Be=0,ge=0,le=ee;for(;le!==null;){let we=le===W.body;if(we)Be=0,ge=qo(O).innerHeight;else{let te=le.getBoundingClientRect();Be=te.top,ge=te.bottom}let ye=0;if(be<Be?ye=-(Be-be):ue>ge&&(ye=ue-ge),ye!==0)if(we)De.scrollBy(0,ye);else{let te=le.scrollTop;le.scrollTop+=ye;let Te=le.scrollTop-te;be-=Te,ue-=Te}if(we)break;le=Yc(le)}})(n,U,a)}}$v=!0}}function O$(e){let t=St()||Ms();t===null&&(t=Ko().selectEnd()),t.insertNodes(e)}function F$(){let e=St();return e===null?"":e.getTextContent()}function xv(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]=B$(r,a),i.is(r))break}return a}function B$(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 tL(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(!Xk(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 Ox(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=vx();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,yv=!1,Sp=0,nL={characterData:!0,childList:!0,subtree:!0};function jl(){return Oo||Qn!==null&&Qn._readOnly}function Gn(){Oo&&J(13)}function xk(){Sp>99&&J(14)}function Da(){return Qn===null&&J(195,yk()),Qn}function qt(){return Xn===null&&J(196,yk()),Xn}function yk(){let e=0,t=new Set,n=Li.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=Xc(r);if(Qp(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 z$(){return Xn}function oL(e,t,n){let o=t.__type,r=bx(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 rL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Ck(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 $$(e){return xx(e,qt()._nodes)}function xx(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=xx(i[s],t);a.append(l)}return a}function aL(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=a$(a,n,e,S,L,I)}catch(S){if(S instanceof Error&&e._onError(S),yv)throw S;return wk(e,null,o,n),TL(e),e._dirtyType=2,yv=!0,Aa(e,a),void(yv=!1)}finally{m.observe(o,nL),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=Ak(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(lk)){Xn=e,Qn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&jv(S,e,o),D$(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())bv(E.getChildAtIndex(N-1))&&(R=!0);else{let z=E.getChildAtIndex(N);if(z!==null&&bv(z)){let U=z.getPreviousSibling();(U===null||bv(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=eu(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&&jv(T,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,nL),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(rx,void 0);let k=e._pendingDecorators;k!==null&&(e._decorators=k,e._pendingDecorators=null,Rc("decorator",e,!0,k)),(function(S,L,I){let T=dL(L),A=dL(I);T!==A&&Rc("textcontent",S,!0,A)})(e,t||a,n),Rc("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;jp(S,T,A)}}})(e)}function Rc(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 iL(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),Ck(e,i.tag)),s==null?jp(e,a,i):a()}}return o}function jp(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,Ck(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=bk(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;Cx(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?Gp(w,k,y,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=iL(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()&&_T(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()&&_T(B),B!==void 0&&rL(B,L)&&oL(C,B,I),w.add(R)}if(T=C._dirtyLeaves,A=T.size,A>0){Sp++;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&&rL(U,L)&&oL(C,U,I)}T=C._dirtyLeaves,A=T.size,E=C._dirtyElements,N=E.size,Sp++}C._dirtyLeaves=w,C._dirtyElements=k})(l,e),iL(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)&&IL(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 jc(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,Sp=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&&Q$(()=>{Aa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function ra(e,t,n){Xn===e&&n===void 0?t():jp(e,t,n)}var Wv=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"&&(Kp||Gc||Up);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=sL(n,o);a.push(r);let i=sL(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 sL(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 V5[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+=qp)}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=wv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=po[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Vc(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):gk(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!==""?wv[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){_p(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;lL(v,h,g)&&Fp(v,v.getNode(),this,c,d),lL(x,h,g)&&Fp(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||ur(this)||this.remove()}}return a}getDOMSlot(t){return new Wv(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 lL(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 Kc=class extends cr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Jt(e){return e instanceof Kc}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 bk(e){return new qc(new Map(e._nodeMap))}function yx(){return new qc(new Map([["root",new $l]]))}function Ik(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=Ik(r[a]);o.push(i)}}return t}function H$(e){return e instanceof qc}var qc=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 aL(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 aL(null,this,()=>({root:Ik(Ko())}))}},Bp=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:U$,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 U$(e){let t=Ra();if(e.style&&(t.setFormat(e.style.textAlign),qk(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in wv&&t.setFormat(n)}return{node:t}}function Ra(){return Jc(new Hl)}function Sk(e){return e instanceof Hl}var Rl=0,K$=1,q$=2,V$=3,W$=4;function wk(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=yx(),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 Tk(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Zc(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 G$(e){let t=e||{},n=z$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=yx(),s=t.namespace||(r!==null?r._config.namespace:Nk()),l=t.editorState,d=[$l,ks,Fl,zl,Hl,Bp,...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}Zc(v);let C=v.getType(),w=Tk(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:LL(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(ax,g$,Rl),g.registerCommand(ix,h$,Rl),g.registerCommand(sx,v$,Rl),g.registerCommand(lx,x$,Rl),g.registerCommand(fx,y$,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=Nk(),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=Xv(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=Xv(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:Ip}: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,wk(this,n,t,r),n!==null&&(this._config.disableEvents||C$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Mx(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,TL(this),this._updateTags.add(Ip),Aa(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;zv.set(s,d);let c=Rp.get(d)??0;c<1&&d.addEventListener("selectionchange",rk),Rp.set(d,c+1),s.__lexicalEditor=l;let f=ok(s);for(let p=0;p<Bv.length;p++){let[m,h]=Bv[p],g=typeof h=="function"?v=>{HT(v)||($T(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(HT(v))return;$T(v);let x=l.isEditable();switch(m){case"cut":return x&&ve(l,mx,v);case"copy":return ve(l,px,v);case"paste":return x&&ve(l,dx,v);case"dragstart":return x&&ve(l,VL,v);case"dragover":return x&&ve(l,WL,v);case"dragend":return x&&ve(l,GL,v);case"focus":return x&&ve(l,jL,v);case"blur":return x&&ve(l,QL,v);case"drop":return x&&ve(l,qL,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(Ip),Aa(this);Rc("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=bk(t),o._selection=t._selection?t._selection.clone():null),wL(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=yx(),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,Cx(null);try{let h=r._nodes;xx(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]):jp(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()),Jp("focus"),Bk(()=>{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,Rc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Li.version="0.41.0+prod.esm";var Gv=null;function Cx(e){Gv=e}var Lk=1;function j$(){Lk=1}function bx(e,t){let n=Ix(e,t);return n===void 0&&J(30,t),n}function Ix(e,t){return e._nodes.get(t)}var Q$=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function kk(e){return Jt(Yp(e))}function Sx(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return Jt(Yp(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&Xc(t)==null)}function Qc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Sx(t)&&wx(t)===e}catch{return!1}}function Qp(e){return e instanceof Li}function wx(e){let t=e;for(;t!=null;){let n=Xc(t);if(Qp(n))return n;t=Yc(t)}return null}function Xc(e){return e?e.__lexicalEditor:null}function X$(e){return U5.test(e)?"rtl":K5.test(e)?"ltr":null}function Ii(e){return hx(e)||e.isToken()}function Ea(e){return Ii(e)||e.isSegmented()}function aa(e){return Ql(e)&&e.nodeType===3}function Pk(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 Vc(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 Y$(e){return Ne(e)||ws(e)||Jt(e)}function Ek(e,t){let n=(function(){let i=Gv;return Gv=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Gn(),xk();let o=qt(),r=Da(),a=""+Lk++;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 zp(e){xk(),_p(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 Tx(e,t){let n=Xp(e,qt());return n!==void 0?Hn(n,t):null}function Xp(e,t){return e[`__lexicalKey_${t._key}`]}function Yp(e,t){let n=e;for(;n!=null;){let o=Tx(n,t);if(o!==null)return o;n=Yc(n)}return null}function Ak(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function dL(e){return e.read(()=>Ko().getTextContent())}function Ko(){return Mk(Da())}function Mk(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=Xp(a,r);if(i!==void 0)return i;a=Yc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Hn("root"):null:Hn(n)}function Rk(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Lx(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function Nk(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function _k(e){return aa(e)?e.nodeValue:null}function kx(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=_k(r),l=Yp(r);if(s!==null&&Ne(l)){if((s===Oc||s===tx)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Px(l,s,a,i,e)}}}function Px(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(Oc)&&(s=t.slice(0,-Oc.length)),r)){let d=tx,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),Up||Gc||Kp)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 cL(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=Wn(a.getTextContent());a.replace(g),a=g}cL(a,s,h)}}}function cL(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 hp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function Dk(e,t){return hp(e,t,"altKey")&&hp(e,t,"ctrlKey")&&hp(e,t,"shiftKey")&&hp(e,t,"metaKey")}function At(e,t,n){if(!Dk(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},uL={altKey:Tr,ctrlKey:!Tr};function fL(e){return e.key==="Backspace"}function pL(e){return At(e,"a",Pa)}function J$(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"),Lp(e),e}{let n=t.select(0,t.getChildrenSize());return Fo(Lp(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=eu(r);return n[t]=a,a}return r}function Ex(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 Z$(e){let t=e.getType(),n=Da();if(n._readOnly){let a=Xv(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 mL(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 Ok(e,t){let n=e.offset;if(e.type==="element")return mL(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?mL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function Fk(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=Lx(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 Yc(e){let t=e.assignedSlot||e.parentElement;return Uk(t)?t.host:t}function Ax(e){return Pk(e)?e:ko(e)?e.ownerDocument:null}function eH(e){return qt()._updateTags.has(e)}function Jp(e){Gn(),qt()._updateTags.add(e)}function Bk(e){Gn(),qt()._deferred.push(e)}function $p(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Mx(e){let t=Ax(e);return t?t.defaultView:null}function qo(e){let t=e._window;return t===null&&J(78),t}function tH(e){return Q(e)&&e.isInline()||Jt(e)&&e.isInline()}function zk(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 Rx(e){let t=e.constructor.clone(e);return Ek(t,null),t.afterCloneFrom(e),t}function Jc(e){let t=qt(),n=e.getType(),o=Ix(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 Cv(e,t){!oo(e.getParent())||Q(t)||Jt(t)||J(99)}function $k(e){let t=Hn(e);return t===null&&J(63,e),t}function bv(e){return(Jt(e)||Q(e)&&!e.canBeEmpty())&&!e.isInline()}function jv(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 Hk(e){let t=Mx(e);return t?t.getSelection():null}function nH(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?Rx(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 oH(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 Uk(e){return Ql(e)&&e.nodeType===11}function Kk(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 Qv(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 Nx(){return qt()}var gL=new WeakMap,rH=new Map;function Xv(e){if(!e._readOnly&&e.isEmpty())return rH;e._readOnly||J(192);let t=gL.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),gL.set(e,t)),t}function _x(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function aH(e){return(t=_x(e))[ak]=!0,t;var t}function qk(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function iH(e){e.__lexicalUnmanaged=!0}function Vk(e){return e.__lexicalUnmanaged===!0}function Pc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==cr[t]}function Zc(e){let t=kT in e.prototype?e.prototype[kT]():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===Kc||i===Ti||i===cr})(e),o=!n&&Pc(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&&(Pc(e,"getType")||(e.getType=()=>a),Pc(e,"clone")||(e.clone=i=>(Cx(i),new e)),Pc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Pc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function sH(e){let t=Nx();return Gn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Nc=(e,t)=>{let n=e;for(;n!=null&&!oo(n);){if(t(n))return n;n=n.getParent()}return null},lH={next:"previous",previous:"next"},Kl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return Fx({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}},Wc=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(Dx(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)}},dH={root:oo,shadowRoot:ur};function Mi(e){return lH[e]}function Dx(e,t="root"){return dH[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(Dx(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(Dx(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 cH(e){return e instanceof Kl}function As(e){return e instanceof ql}function Pr(e){return e instanceof Wc}var uH={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}}},fH={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}}},pH={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 Yn(e,t){return e?new fH[t](e):null}function ki(e,t,n){return e?new uH[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"&&xL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function Yv(e,t){return new Hp(e,t)}function _a(e,t){return Q(e)?new pH[t](e):null}function Wk(e){return e&&e.getChildCaret()||e}function Wl(e){return e&&Wk(e.getAdjacentCaret())}var Jv=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 Yv(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[Yv(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 Fx({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")}},Hp=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 mH(e){return e instanceof Hp}function Ox(e){return Pi(e,Yn(Ko(),e.direction))}function Gk(e){return Pi(e,e)}function Pi(e,t){return e.direction!==t.direction&&J(265),new Jv(e,t,e.direction)}function Fx(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 Bx(e,t){let n=_c(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 zx(n)}}function zx(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 vp(e,t){return t.is(e)}function hL(e){return Q(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function _c(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=hL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=hL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(vp(e,o)||J(276),{commonAncestor:o,type:"ancestor"}):r===null?(vp(t,o)||J(277),{commonAncestor:o,type:"descendant"}):((Q(a)||vp(e,a))&&(Q(r)||vp(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=$k(e.key);return n==="text"?(Ne(a)||J(266,a.getType(),o),ki(a,t,r)):(Q(a)||J(267,a.getType(),o),Yk(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 jk(e){let t=St(),n=Ke(t)?t:hk();return Dc(n,e),Fo(n),n}function Dc(e,t){Gl(e.anchor,t.anchor),Gl(e.focus,t.focus)}function Zv(e){let{anchor:t,focus:n}=e,o=Ei(t,"next"),r=Ei(n,"next"),a=Bx(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 vL(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 Iv(e){return!!e&&e.origin.isAttached()}function Qk(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=$x(e,o),i=vL(a.anchor,n),s=vL(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(Iv(h)){c=Lr(h);break}for(let h of s)if(Iv(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(Iv);if(m)return Gk(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 Xk(e){return Na(e)&&e.offset!==Er(e.origin,e.direction)}function Ai(e,t){return e.direction===t?e:e.getFlipped()}function $x(e,t){return e.direction===t?e:Pi(Ai(e.focus,t),Ai(e.anchor,t))}function Yk(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 gH(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 hH(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 vH(e,t){return!0}function xH(e,{$copyElementNode:t=Rx,$splitTextPointCaretNext:n=hH,rootMode:o="shadowRoot",$shouldSplit:r=vH}={}){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 yH(e){return e}function CH(...e){return e}function bH(e,t){return[e,t]}function IH(e){return e}function SH(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function eu(...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 wH(e,...t){let n=eu(...t);n.length>0&&e.classList.add(...n)}function TH(e,...t){let n=eu(...t);n.length>0&&e.classList.remove(...n)}function LH(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Hx,$te=M.$addUpdateTag,Zp=M.$applyNodeReplacement,Yl=M.$caretFromPoint,Jk=M.$caretRangeFromSelection,em=M.$cloneWithProperties,Zk=M.$cloneWithPropertiesEphemeral,Hte=M.$comparePointCaretNext,Ute=M.$copyNode,eP=M.$create,Rs=M.$createLineBreakNode,tP=M.$createNodeSelection,fr=M.$createParagraphNode,Kte=M.$createPoint,Ns=M.$createRangeSelection,nP=M.$createRangeSelectionFromDom,oP=M.$createTabNode,Nr=M.$createTextNode,rP=M.$extendCaretToRange,Oa=M.$findMatchingParent,Ux=M.$getAdjacentChildCaret,qte=M.$getAdjacentNode,_s=M.$getAdjacentSiblingOrParentSiblingCaret,Kx=M.$getCaretInDirection,aP=M.$getCaretRange,Vte=M.$getCaretRangeInDirection,iP=M.$getCharacterOffsets,Ri=M.$getChildCaret,Wte=M.$getChildCaretAtIndex,qx=M.$getChildCaretOrSelf,sP=M.$getCollapsedCaretRange,Gte=M.$getCommonAncestor,jte=M.$getCommonAncestorResultBranchOrder,tm=M.$getEditor,Qte=M.$getNearestNodeFromDOMNode,Xte=M.$getNearestRootOrShadowRoot,nm=M.$getNodeByKey,Yte=M.$getNodeByKeyOrThrow,lP=M.$getNodeFromDOMNode,tu=M.$getPreviousSelection,Ct=M.$getRoot,Fe=M.$getSelection,Fa=M.$getSiblingCaret,om=M.$getState,Jte=M.$getStateChange,Zte=M.$getTextContent,ene=M.$getTextNodeOffset,tne=M.$getTextPointCaret,nne=M.$getTextPointCaretSlice,one=M.$getWritableNodeState,dP=M.$hasAncestor,rne=M.$hasUpdateTag,ane=M.$insertNodes,Jl=M.$isBlockElementNode,nu=M.$isChildCaret,rm=M.$isDecoratorNode,cP=M.$isEditorState,qe=M.$isElementNode,uP=M.$isExtendableTextPointCaret,ine=M.$isInlineElementOrDecoratorNode,fP=M.$isLeafNode,Zl=M.$isLineBreakNode,sne=M.$isNodeCaret,Vx=M.$isNodeSelection,pP=M.$isParagraphNode,Se=M.$isRangeSelection,ou=M.$isRootNode,Ds=M.$isRootOrShadowRoot,mP=M.$isSiblingCaret,lne=M.$isTabNode,ot=M.$isTextNode,am=M.$isTextPointCaret,dne=M.$isTextPointCaretSlice,Wx=M.$isTokenOrSegmented,cne=M.$isTokenOrTab,une=M.$nodesOfType,gP=M.$normalizeCaret,hP=M.$normalizeSelection__EXPERIMENTAL,fne=M.$onUpdate,vP=M.$parseSerializedNode,pne=M.$removeTextFromCaretRange,xP=M.$rewindSiblingCaret,im=M.$selectAll,mne=M.$setCompositionKey,gne=M.$setPointFromCaret,_r=M.$setSelection,yP=M.$setSelectionFromCaretRange,sm=M.$setState,CP=M.$splitAtPointCaretNext,bP=M.$splitNode,hne=M.$updateRangeSelectionFromCaretRange,Gx=M.ArtificialNode__DO_NOT_USE,vne=M.BEFORE_INPUT_COMMAND,IP=M.BLUR_COMMAND,ru=M.CAN_REDO_COMMAND,au=M.CAN_UNDO_COMMAND,lm=M.CLEAR_EDITOR_COMMAND,SP=M.CLEAR_HISTORY_COMMAND,wP=M.CLICK_COMMAND,xne=M.COLLABORATION_TAG,dm=M.COMMAND_PRIORITY_CRITICAL,Zt=M.COMMAND_PRIORITY_EDITOR,Dr=M.COMMAND_PRIORITY_HIGH,ed=M.COMMAND_PRIORITY_LOW,yne=M.COMMAND_PRIORITY_NORMAL,Cne=M.COMPOSITION_END_COMMAND,TP=M.COMPOSITION_END_TAG,bne=M.COMPOSITION_START_COMMAND,LP=M.COMPOSITION_START_TAG,kP=M.CONTROLLED_TEXT_INSERTION_COMMAND,cm=M.COPY_COMMAND,PP=M.CUT_COMMAND,um=M.DELETE_CHARACTER_COMMAND,EP=M.DELETE_LINE_COMMAND,AP=M.DELETE_WORD_COMMAND,Ine=M.DRAGEND_COMMAND,Sne=M.DRAGOVER_COMMAND,MP=M.DRAGSTART_COMMAND,RP=M.DROP_COMMAND,Ba=M.DecoratorNode,wne=M.ElementNode,NP=M.FOCUS_COMMAND,Tne=M.FORMAT_ELEMENT_COMMAND,_P=M.FORMAT_TEXT_COMMAND,fm=M.HISTORIC_TAG,Or=M.HISTORY_MERGE_TAG,DP=M.HISTORY_PUSH_TAG,jx=M.INDENT_CONTENT_COMMAND,Lne=M.INPUT_COMMAND,Qx=M.INSERT_LINE_BREAK_COMMAND,OP=M.INSERT_PARAGRAPH_COMMAND,FP=M.INSERT_TAB_COMMAND,iu=M.INTERNAL_$isBlock,kne=M.IS_ALL_FORMATTING,Pne=M.IS_BOLD,Ene=M.IS_CODE,Ane=M.IS_HIGHLIGHT,Mne=M.IS_ITALIC,Rne=M.IS_STRIKETHROUGH,Nne=M.IS_SUBSCRIPT,_ne=M.IS_SUPERSCRIPT,Dne=M.IS_UNDERLINE,BP=M.KEY_ARROW_DOWN_COMMAND,pm=M.KEY_ARROW_LEFT_COMMAND,mm=M.KEY_ARROW_RIGHT_COMMAND,zP=M.KEY_ARROW_UP_COMMAND,gm=M.KEY_BACKSPACE_COMMAND,$P=M.KEY_DELETE_COMMAND,HP=M.KEY_DOWN_COMMAND,hm=M.KEY_ENTER_COMMAND,One=M.KEY_ESCAPE_COMMAND,Fne=M.KEY_MODIFIER_COMMAND,Bne=M.KEY_SPACE_COMMAND,vm=M.KEY_TAB_COMMAND,UP=M.LineBreakNode,zne=M.MOVE_TO_END,$ne=M.MOVE_TO_START,Hne=M.NODE_STATE_KEY,KP=M.OUTDENT_CONTENT_COMMAND,xm=M.PASTE_COMMAND,qP=M.PASTE_TAG,VP=M.ParagraphNode,WP=M.REDO_COMMAND,GP=M.REMOVE_TEXT_COMMAND,jP=M.RootNode,Une=M.SELECTION_CHANGE_COMMAND,QP=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,XP=M.SELECT_ALL_COMMAND,Kne=M.SKIP_COLLAB_TAG,qne=M.SKIP_DOM_SELECTION_TAG,Vne=M.SKIP_SCROLL_INTO_VIEW_TAG,Wne=M.SKIP_SELECTION_FOCUS_TAG,YP=M.TEXT_TYPE_TO_FORMAT,JP=M.TabNode,ym=M.TextNode,ZP=M.UNDO_COMMAND,su=M.addClassNamesToElement,Gne=M.buildImportMap,Cm=M.configExtension,eE=M.createCommand,bm=M.createEditor,jne=M.createSharedNodeState,tE=M.createState,nE=M.declarePeerDependency,Nn=M.defineExtension,Qne=M.flipDirection,Xne=M.getDOMOwnerDocument,Xx=M.getDOMSelection,Yne=M.getDOMSelectionFromTarget,oE=M.getDOMTextNode,Jne=M.getEditorPropertyFromDOMNode,Zne=M.getNearestEditorFromDOMNode,rE=M.getRegisteredNode,eoe=M.getRegisteredNodeOrThrow,toe=M.getStaticNodeConfig,noe=M.getTextDirection,ooe=M.getTransformSetFromKlass,aE=M.isBlockDomNode,roe=M.isCurrentlyReadOnlyMode,iE=M.isDOMDocumentNode,sE=M.isDOMNode,aoe=M.isDOMTextNode,ioe=M.isDOMUnmanaged,Yx=M.isDocumentFragment,soe=M.isExactShortcutMatch,lE=M.isHTMLAnchorElement,Im=M.isHTMLElement,lu=M.isInlineDomNode,loe=M.isLexicalEditor,doe=M.isModifierMatch,coe=M.isSelectionCapturedInDecoratorInput,dE=M.isSelectionWithinEditor,Jx=M.makeStepwiseIterator,ia=M.mergeRegister,uoe=M.normalizeClassNames,Sm=M.removeClassNamesFromElement,foe=M.removeFromParent,poe=M.resetRandomKey,Fr=M.safeCast,moe=M.setDOMUnmanaged,goe=M.setNodeIndentFromDOM,wm=M.shallowMergeConfig,Zx=M.toggleTextFormatType;var ey={};Mn(ey,{LexicalComposer:()=>PH});pe();var cE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,kH=cE?he:q,Tm={tag:Or};function PH({initialConfig:e,children:t}){let n=H(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=LT(null,o),c=bm({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=cE?document.activeElement:null;(Fe()!==null||g!==null&&g===f.getRootElement())&&h.select()}},Tm);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,Tm);break}case"object":f.setEditorState(p,Tm);break;case"function":f.update(()=>{Ct().isEmpty()&&p(f)},Tm)}}})(c,s),[c,d]},[]);return kH(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(TT.Provider,{value:n,children:t})}var EH=ey,uE=EH.LexicalComposer;var ny={};Mn(ny,{$canShowPlaceholder:()=>pE,$canShowPlaceholderCurry:()=>MH,$findTextIntersectionFromCharacters:()=>RH,$isRootTextContentEmpty:()=>ty,$isRootTextContentEmptyCurry:()=>AH,$rootTextContent:()=>fE,registerLexicalTextEntity:()=>_H});function fE(){return Ct().getTextContent()}function ty(e,t=!0){if(e)return!1;let n=fE();return t&&(n=n.trim()),n===""}function AH(e,t){return()=>ty(e,t)}function pE(e){if(!ty(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(rm(r))return!1;if(qe(r)){if(!pP(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 MH(e){return()=>pE(e)}function RH(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 NH(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 _H(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(ym,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&&NH(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=ny,Soe=Os.$canShowPlaceholder,Lm=Os.$canShowPlaceholderCurry,woe=Os.$findTextIntersectionFromCharacters,Toe=Os.$isRootTextContentEmpty,Loe=Os.$isRootTextContentEmptyCurry,koe=Os.$rootTextContent,Poe=Os.registerLexicalTextEntity;var ly={};Mn(ly,{$addNodeStyle:()=>$H,$cloneWithProperties:()=>em,$copyBlockFormatIndent:()=>IE,$ensureForwardRangeSelection:()=>bE,$forEachSelectedTextNode:()=>CE,$getComputedStyleForElement:()=>ay,$getComputedStyleForParent:()=>iy,$getSelectionStyleValueForProperty:()=>jH,$isAtNodeEnd:()=>zH,$isParentElementRTL:()=>sy,$isParentRTL:()=>FH,$moveCaretSelection:()=>TE,$moveCharacter:()=>WH,$patchStyleText:()=>HH,$selectAll:()=>im,$setBlocksType:()=>UH,$shouldOverrideDefaultCharacterSelection:()=>VH,$sliceSelectedTextNodeContent:()=>BH,$trimTextContentFromAnchor:()=>yE,$wrapNodes:()=>qH,createDOMRange:()=>DH,createRectsFromDOMRange:()=>OH,getCSSFromStyleObject:()=>xE,getStyleObjectFromCSS:()=>Em,trimTextContentFromAnchor:()=>QH});function ry(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 Pm=new Map;function mE(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function gE(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function DH(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=mE(l)),ot(o)&&(d=mE(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=gE(l)),d.nodeName==="BR"&&([d,f]=gE(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 OH(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 vE(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 Em(e){let t=Pm.get(e);return t===void 0&&(t=vE(e),Pm.set(e,t)),t}function xE(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function ay(e){let t=tm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function iy(e){return ay(ou(e)?e:e.getParentOrThrow())}function FH(e){let t=iy(e);return t!==null&&t.direction==="rtl"}function BH(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!Wx(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]=iP(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=Zk(t)),t.__text=y)}}return t}function zH(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return qe(t)||ry(177),e.offset===t.getChildrenSize()}function yE(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=`
|
|
3707
|
+
`?o.push(Dl()):i===" "?o.push(jp()):o.push(jn(i))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,i=n,s=o;!this.isCollapsed()&&o.isBefore(n)&&(i=o,s=n),i.type==="element"&&(function(v,x,y,C){let w=v.getNode(),k=w.getChildAtIndex(v.offset),S=jn();if(S.setFormat(y),S.setStyle(C),Lk(k))k.splice(0,0,[S]);else{let L=to(w)?Ea().append(S):S;k===null?w.append(L):k.insertBefore(L)}v.is(x)&&x.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&ql(s,wr(wi(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Me(p)||Z(26);let m=p.getTextContent().length,h=p.getParentOrThrow(),g=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(ka(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Me(v)&&v.canInsertTextBefore()&&!ka(v)||(v=jn(),v.setFormat(r),v.setStyle(a),h.canInsertTextAfter()?p.insertAfter(v):h.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(ka(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Me(v)&&!ka(v)||(v=jn(),v.setFormat(r),h.canInsertTextBefore()?p.insertBefore(v):h.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=jn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||Q(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),hk(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(vi(p)){let C=jn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),x=p.getStyle();if(l!==d||v===r&&x===a){if(xx(p)){let C=jn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=jn(t);if(C.setFormat(r),C.setStyle(a),C.select(),l===0)p.insertBefore(C,!1);else{let[w]=p.splitText(l);w.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let y=d-l;p=p.spliceText(l,y,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...g.getParentKeys()]),x=Q(p)?p:p.getParentOrThrow(),y=Q(g)?g:g.getParentOrThrow(),C=g;if(!x.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(s.type==="text"&&(d!==0||g.getTextContent()==="")||s.type==="element"&&g.getIndexWithinParent()<d)if(Me(g)&&!vi(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let I=jn(g.getTextContent());g.replace(I),g=I}to(s.getNode())||s.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let I=g.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?g.remove():I.remove()}else v.add(g.__key);let w=y.getChildren(),k=new Set(c),S=x.is(y),L=x.isInline()&&p.getNextSibling()===null?x:p;for(let I=w.length-1;I>=0;I--){let T=w[I];if(T.is(p)||Q(T)&&T.isParentOf(p))break;T.isAttached()&&(!k.has(T)||T.is(C)?S||L.insertAfter(T,!1):T.remove())}if(!S){let I=y,T=null;for(;I!==null;){let E=I.getChildren(),A=E.length;(A===0||E[A-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(vi(p))if(l===m)p.select();else{let I=jn(t);I.select(),p.replace(I)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let I=1;I<f;I++){let T=c[I],E=T.__key;v.has(E)||T.remove()}}}removeText(){let t=St()===this;Nc(this,Jk(tx(this))),t&&St()!==this&&Do(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Xn(null);let o=this.getNodes(),r=[];for(let w of o)Me(w)&&r.push(w);let a=w=>{o.forEach(k=>{if(Q(k)){let S=k.getFormatFlags(t,w);k.setTextFormat(S)}})},i=r.length;if(i===0)return this.toggleFormat(t),Xn(null),void a(n);let s=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:s,f=d?s:l,p=0,m=r[0],h=c.type==="element"?0:c.offset;if(c.type==="text"&&h===m.getTextContentSize()&&(p=1,m=r[1],h=0),m==null)return;let g=m.getFormatFlags(t,n);a(g);let v=i-1,x=r[v],y=f.type==="text"?f.offset:x.getTextContentSize();if(m.is(x)){if(h===y)return;if(ka(m)||h===0&&y===m.getTextContentSize())m.setFormat(g);else{let w=m.splitText(h,y),k=h===0?w[0]:w[1];k.setFormat(g),c.type==="text"&&c.set(k.__key,0,"text"),f.type==="text"&&f.set(k.__key,y-h,"text")}return void(this.format=g)}h===0||ka(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let C=x.getFormatFlags(t,g);y>0&&(y===x.getTextContentSize()||ka(x)||([x]=x.splitText(y)),x.setFormat(C));for(let w=p+1;w<v;w++){let k=r[w],S=k.getFormatFlags(t,C);k.setFormat(S)}c.type==="text"&&c.set(m.__key,h,"text"),f.type==="text"&&f.set(x.__key,y,"text"),this.format=g|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=St();return Ue(h)||Z(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Mc(n,Aa),r=t[t.length-1];if(Q(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=Cv(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(Q(h)||Qt(h))&&!h.isInline())){Q(o)||Z(211,n.constructor.name,n.getType());let h=Cv(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=Ea(),v=null;for(let x=0;x<h.length;x++){let y=h[x],C=Ss(y);if(C||Qt(y)&&y.isInline()||Q(y)&&y.isInline()||Me(y)||y.isParentRequired()){if(v===null&&(v=y.createParentElementNode(),g.append(v),C))continue;v!==null&&v.append(y)}else g.append(y),v=null}return g})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!Q(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;Q(f=c)&&Aa(f)&&!f.isEmpty()&&Q(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(Q(o)||Z(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&Z(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),x=g,y=[g];for(;x!==v;)x.getNextSibling()||Z(140),x=x.getNextSibling(),y.push(x);let C=h;for(let w of y)C=C.insertAfter(w)})(o,c));let p=Mc(i,Aa);l&&Q(p)&&(l.canMergeWhenEmpty()||Aa(d))&&(p.append(...l.getChildren()),l.remove()),Q(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=Q(o)?o.getLastChild():null;Ss(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Ea();return Ko().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Cv(this),n=Mc(this.anchor.getNode(),Aa);Q(n)||Z(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Dl();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,i]=Gv(this),s=this.isBackward(),[l,d]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=s?[i,a]:[a,i];if(n===0)return[];if(n===1){if(Me(o)&&!this.isCollapsed()){let p=o.splitText(c,f),m=c===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(Me(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Me(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(rL(this,t,n,o))return;let r=t==="move",a=Kt(),i=Er(qo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!Q(d)||d.isInline()||d.canBeEmpty()||Xv(s,a,l),this.dirty){let c=zl(a,this.anchor.key),f=zl(a,this.focus.key);this.anchor.type==="text"&&(c=Ps(c)),this.focus.type==="text"&&(f=Ps(f)),c&&f&&Ck(i,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(i,t,n?"backward":"forward",o),i.rangeCount>0){let c=i.getRangeAt(0),f=this.anchor.getNode(),p=to(f)?f:Uk(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),h=[],g=!1;for(let v=0;v<m.length;v++){let x=m[v];Up(x,p)?h.push(x):g=!0}if(g&&h.length>0)if(n){let v=h[0];Q(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];Q(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let x=v.focus,y=v.anchor,C=y.key,w=y.offset,k=y.type;y.set(x.key,x.offset,x.type,!0),x.set(C,w,k,!0)})(this)}}o==="lineboundary"&&rL(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&Q(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(Q(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=Bx(wi(o,t?"previous":"next"));if(a.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(Lr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=wr(l);Nc(this,Si(d,d)),a.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:l,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(As(l)){if(Q(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else s={block:l.origin,type:"merge-next-block"};continue}if(Qt(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=yx();d.add(l.origin.getKey()),Do(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return Nc(this,Si(!l.origin.isEmpty()&&d.isEmpty()?Gl(Zn(d,l.direction)):a.anchor,l)),this.removeText()}}let i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&YT(this,o.getNode()))return}else{let s=i.type==="text"?i.getNode():null;if(r=o.type==="text"?o.getNode():null,s!==null&&s.isSegmented()){let l=i.offset,d=s.getTextContentSize();if(s.is(r)||t&&l!==d||!t&&l!==0)return void JT(s,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(s)||t&&l!==0||!t&&l!==d)return void JT(r,t,l)}(function(l,d){let c=l.anchor,f=l.focus,p=c.getNode(),m=f.getNode();if(p===m&&c.type==="text"&&f.type==="text"){let h=c.offset,g=f.offset,v=h<g,x=v?h:g,y=v?g:h,C=y-1;x!==C&&(function(w){return!(Dk(w)||K$(w))})(p.getTextContent().slice(x,y))&&(d?f.set(f.key,C,f.type):c.set(c.key,C,c.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&to(o.getParent())&&o.getPreviousSibling()===null&&YT(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Wc(e){return e instanceof Fp}function XT(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Gv(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[XT(n),XT(o)]}function YT(e,t){for(let n=t;n;n=n.getParent()){if(Q(n)){if(n.collapseAtStart(e))return!0;if(cr(n))break}if(n.getPreviousSibling())break}return!1}var K$=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function JT(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,i=0,s=0;for(let d=0;d<a;d++){let c=d===a-1;if(s=i,i+=r[d].length,t&&i===n||i>n||c){r.splice(d,1),c&&(s=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(s,s))}function ZT(e,t,n,o){let r,a=t;if(ko(e)){let i=!1,s=e.childNodes,l=s.length,d=o._blockCursorElement;a===l&&(i=!0,a=l-1);let c=s[a],f=!1;if(c===d)c=s[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=El(c),Me(r))a=kr(r,i?"next":"previous");else{let p=El(e);if(p===null)return null;if(Q(p)){let m=o.getElementByKey(p.getKey());m===null&&Z(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),Q(p)||Z(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(Q(g)&&(function(v,x,y){let C=v.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()})(g,0,n)){let v=i?g.getLastDescendant():g.getFirstDescendant();v===null?p=g:(g=v,p=Q(g)?g:g.getParentOrThrow()),a=0}Me(g)?(r=g,p=null,a=kr(g,i?"next":"previous")):g!==p&&i&&!f&&(Q(p)||Z(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Qt(p)&&El(e)===p?m:m+1,p=p.getParentOrThrow()}if(Q(p))return Pr(p.__key,a,"element")}}else r=El(e);return Me(r)?Pr(r.__key,kr(r,a,"clamp"),"text"):null}function eL(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),i=r.getParent();if(t){if((n||!t)&&a===null&&Q(i)&&i.isInline()){let s=i.getPreviousSibling();Me(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else Q(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Me(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&Q(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&Q(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Me(s)&&e.set(s.__key,0,"text")}}}function hk(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);eL(e,o,r),eL(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function vk(e,t,n,o,r,a){if(e===null||n===null||!Gc(r,e,n))return null;let i=ZT(e,t,Ue(a)?a.anchor:null,r);if(i===null)return null;let s=ZT(n,o,Ue(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=El(e),d=El(n);if(Qt(l)&&Qt(d))return null}return hk(i,s),[i,s]}function q$(e){return Q(e)&&!e.isInline()}function xk(e,t,n,o,r,a){let i=Na(),s=new ks(Pr(e,t,r),Pr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function yk(){let e=Pr("root",0,"element"),t=Pr("root",0,"element");return new ks(e,t,0,"")}function yx(){return new Fp(new Set)}function V$(e,t){return Qp(null,e,t,null)}function Qp(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,i=a?a.type:void 0,s=i==="selectionchange",l=!kv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ue(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(s||i===void 0)&&Ue(e)&&!Gc(n,d,c))return e.clone();let m=vk(d,f,c,p,n,e);if(m===null)return null;let[h,g]=m,v=0,x="";if(Ue(e)){let y=e.anchor;if(h.key===y.key)v=e.format,x=e.style;else{let C=h.getNode();Me(C)?(v=C.getFormat(),x=C.getStyle()):Q(C)&&(v=C.getTextFormat(),x=C.getTextStyle())}}return new ks(h,g,v,x)}function St(){return Na()._selection}function Es(){return Kt()._editorState._selection}function Bp(e,t,n,o=1){let r=e.anchor,a=e.focus,i=r.getNode(),s=a.getNode();if(!t.is(i)&&!t.is(s))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let c=Math.max(0,d+o);r.set(l,c,"element"),a.set(l,c,"element"),tL(e)}}else{let d=e.isBackward(),c=d?a:r,f=c.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let h=c.offset;(n<=h&&o>0||n<h&&o<0)&&c.set(l,Math.max(0,h+o),"element")}if(t.is(m)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}tL(e)}function tL(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!Q(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(Q(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(Q(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function zp(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Me(o)?(i=o.getTextContentSize(),s="text"):Q(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Me(r)?s="text":Q(r)&&(s="element")),a!==null&&s!==null?e.set(a,i,s):(i=t.getIndexWithinParent(),i===-1&&(i=n.getChildrenSize()),e.set(n.__key,i,"element"))}function nL(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function Ck(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function oL(e,t,n){let o=zl(e,t.getKey());if(Q(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function W$(e,t,n,o,r,a,i){let s=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(dk)&&f!==a||f!==null&&Tx(f))return;if(!Ue(t))return void(e!==null&&Gc(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=oL(n,h,p.offset),[y,C]=oL(n,g,m.offset),w=t.format,k=t.style,S=t.isCollapsed(),L=v,I=y,T=!1;var E,A,N,R,$;if(p.type==="text"?(L=Ps(v),T=h.getFormat()!==w||h.getStyle()!==k):Ue(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=Ps(y)),L!==null&&I!==null&&(S&&(e===null||T||Ue(e)&&(e.format!==w||e.style!==k))&&(E=w,A=k,N=x,R=p.key,$=performance.now(),nk=[E,A,N,R,$]),d!==x||c!==C||s!==L||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Vv)||a.focus({preventScroll:!0}),p.type==="element"))){if(Ck(o,L,x,I,C),!yi||!t.isCollapsed()||a===null||r.has(Vv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(ck)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let H=Ue(t)&&t.anchor.type==="element"?L.childNodes[x]||null:o.rangeCount>0?o.getRangeAt(0):null;if(H!==null){let K;if(H instanceof Text){let O=document.createRange();O.selectNode(H),K=O.getBoundingClientRect()}else K=H.getBoundingClientRect();(function(O,oe,ee){let W=Rx(ee),qe=Nx(W);if(W===null||qe===null)return;let{top:ve,bottom:fe}=oe,Ne=0,Ae=0,ae=ee;for(;ae!==null;){let Ee=ae===W.body;if(Ee)Ne=0,Ae=qo(O).innerHeight;else{let re=ae.getBoundingClientRect();Ne=re.top,Ae=re.bottom}let xe=0;if(ve<Ne?xe=-(Ne-ve):fe>Ae&&(xe=fe-Ae),xe!==0)if(Ee)qe.scrollBy(0,xe);else{let re=ae.scrollTop;ae.scrollTop+=xe;let Ie=ae.scrollTop-re;ve-=Ie,fe-=Ie}if(Ee)break;ae=Qc(ae)}})(n,K,a)}}Uv=!0}}function G$(e){let t=St()||Es();t===null&&(t=Ko().selectEnd()),t.insertNodes(e)}function j$(){let e=St();return e===null?"":e.getTextContent()}function Cv(e){let t=e;e.isCollapsed()||t.removeText();let n=St();Ue(n)&&(t=n),Ue(t)||Z(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Aa(r);){let i=r;if([r,a]=Q$(r,a),i.is(r))break}return a}function Q$(e,t){let n=e.getParent();if(!n){let r=Ea();return Ko().append(r),r.select(),[Ko(),0]}if(Me(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!Q(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new ks(Pr(e.__key,t,"element"),Pr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function rL(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[c,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(c.key,c.offset,c.type),!0}let a=wi(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!Zk(l)){for(let c of l){d=!1;let{origin:f}=c;if(!Qt(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Bx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Lr(c))c.origin.isInline()||(l=c);else{if(Q(c.origin))continue;Qt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&Qt(l.origin)&&l.origin.isKeyboardSelectable()){let c=yx();return c.add(l.origin.getKey()),Do(c),!0}return l=wr(l),s&&ql(e.anchor,l),ql(e.focus,l),d||!i}var Yn=null,Jn=null,_o=!1,bv=!1,Tp=0,aL={characterData:!0,childList:!0,subtree:!0};function Vl(){return _o||Yn!==null&&Yn._readOnly}function Qn(){_o&&Z(13)}function bk(){Tp>99&&Z(14)}function Na(){return Yn===null&&Z(195,Ik()),Yn}function Kt(){return Jn===null&&Z(196,Ik()),Jn}function Ik(){let e=0,t=new Set,n=bi.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=jc(r);if(Yp(a))e++;else if(a){let i=String(a.constructor.version||"<0.17.1");i===n&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function X$(){return Jn}function iL(e,t,n){let o=t.__type,r=Sx(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let i=a.length;for(let s=0;s<i&&(a[s](t),t.isAttached());s++);}function sL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Sk(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function Y$(e){return Cx(e,Kt()._nodes)}function Cx(e,t){let n=e.type,o=t.get(n);o===void 0&&Z(17,n);let r=o.klass;e.type!==r.getType()&&Z(18,r.name);let a=r.importJSON(e),i=e.children;if(Q(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Cx(i[s],t);a.append(l)}return a}function lL(e,t,n){let o=Yn,r=_o,a=Jn;Yn=t,_o=!0,Jn=e;try{return n()}finally{Yn=o,_o=r,Jn=a}}function Pa(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,i=a._selection,s=n._selection,l=e._dirtyType!==0,d=Yn,c=_o,f=Jn,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Jn=e,Yn=n,_o=!1,e._updating=!0;try{let S=e._dirtyType,L=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),h=h$(a,n,e,S,L,I)}catch(S){if(S instanceof Error&&e._onError(S),bv)throw S;return kk(e,null,o,n),PL(e),e._dirtyType=2,bv=!0,Pa(e,a),void(bv=!1)}finally{m.observe(o,aL),e._updating=p,Yn=d,_o=c,Jn=f}}n._readOnly||(n._readOnly=!0);let g=e._dirtyLeaves,v=e._dirtyElements,x=e._normalizedNodes,y=e._updateTags,C=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(S,L){let I=S._decorators,T=S._pendingDecorators||I,E=L._nodeMap,A;for(A in T)E.has(A)||(T===I&&(T=Nk(S)),delete T[A])})(e,n);let w=r?null:Er(qo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!y.has(uk)){Jn=e,Yn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&Xv(S,e,o),W$(i,s,e,w,y,o)}(function(S,L,I){let T=S._blockCursorElement;if(Ue(I)&&I.isCollapsed()&&I.anchor.type==="element"&&L.contains(document.activeElement)){let E=I.anchor,A=E.getNode(),N=E.offset,R=!1,$=null;if(N===A.getChildrenSize())Sv(A.getChildAtIndex(N-1))&&(R=!0);else{let H=A.getChildAtIndex(N);if(H!==null&&Sv(H)){let K=H.getPreviousSibling();(K===null||Sv(K))&&(R=!0,$=S.getElementByKey(H.__key))}}if(R){let H=S.getElementByKey(A.__key);return T===null&&(S._blockCursorElement=T=(function(K){let O=K.theme,oe=document.createElement("div");oe.contentEditable="false",oe.setAttribute("data-lexical-cursor","true");let ee=O.blockCursor;if(ee!==void 0){if(typeof ee=="string"){let W=Jc(ee);ee=O.blockCursor=W}ee!==void 0&&oe.classList.add(...ee)}return oe})(S._config)),L.style.caretColor="transparent",void($===null?H.appendChild(T):H.insertBefore(T,$))}}T!==null&&Xv(T,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,aL),Jn=f,Yn=d}}h!==null&&(function(S,L,I,T,E){let A=Array.from(S._listeners.mutation),N=A.length;for(let R=0;R<N;R++){let[$,H]=A[R];for(let K of H){let O=L.get(K);O!==void 0&&$(O,{dirtyLeaves:T,prevEditorState:E,updateTags:I})}}})(e,h,y,g,a),Ue(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(ix,void 0);let k=e._pendingDecorators;k!==null&&(e._decorators=k,e._pendingDecorators=null,Ec("decorator",e,!0,k)),(function(S,L,I){let T=fL(L),E=fL(I);T!==E&&Ec("textcontent",S,!0,E)})(e,t||a,n),Ec("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:x,prevEditorState:t||a,tags:y}),(function(S,L){if(S._deferred=[],L.length!==0){let I=S._updating;S._updating=!0;try{for(let T=0;T<L.length;T++)L[T]()}finally{S._updating=I}}})(e,C),(function(S){let L=S._updates;if(L.length!==0){let I=L.shift();if(I){let[T,E]=I;Xp(S,T,E)}}})(e)}function Ec(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let i=0;i<a.length;i++)a[i].apply(null,o)}finally{t._updating=r}}function dL(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,i]=r,s=e._pendingEditorState,l;i!==void 0&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(s===null&&Z(191),s._flushSync=!0),l&&e._deferred.push(l),Sk(e,i.tag)),s==null?Xp(e,a,i):a()}}return o}function Xp(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,Sk(e,n.tag),a=n.skipTransforms||!1,i=n.discrete||!1),r&&e._deferred.push(r);let s=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=wk(l||s),d=!0),l._flushSync=i;let c=Yn,f=_o,p=Jn,m=e._updating;Yn=l,_o=!1,e._updating=!0,Jn=e;let h=e._headless||e.getRootElement()===null;Ix(null);try{d&&(h?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(y,C){let w=y.getEditorState()._selection,k=Er(qo(y));return Ue(w)||w==null?Qp(w,k,y,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=dL(e,a),(function(y,C){let w=C.getEditorState()._selection,k=y._selection;if(Ue(k)){let S=k.anchor,L=k.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,k)),L.type==="text"){let T=L.getNode();I!==T&&T.selectionTransform(w,k)}}})(l,e),e._dirtyType!==0&&(a?(function(y,C){let w=C._dirtyLeaves,k=y._nodeMap;for(let S of w){let L=k.get(S);Me(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&FT(L)}})(l,e):(function(y,C){let w=C._dirtyLeaves,k=C._dirtyElements,S=y._nodeMap,L=hi(),I=new Map,T=w,E=T.size,A=k,N=A.size;for(;E>0||N>0;){if(E>0){C._dirtyLeaves=new Set;for(let R of T){let $=S.get(R);Me($)&&$.isAttached()&&$.isSimpleText()&&!$.isUnmergeable()&&FT($),$!==void 0&&sL($,L)&&iL(C,$,I),w.add(R)}if(T=C._dirtyLeaves,E=T.size,E>0){Tp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let R of A){let $=R[0],H=R[1];if(k.set($,H),!H)continue;let K=S.get($);K!==void 0&&sL(K,L)&&iL(C,K,I)}T=C._dirtyLeaves,E=T.size,A=C._dirtyElements,N=A.size,Tp++}C._dirtyLeaves=w,C._dirtyElements=k})(l,e),dL(e),(function(y,C,w,k){let S=y._nodeMap,L=C._nodeMap,I=[];for(let[T]of k){let E=L.get(T);E!==void 0&&(E.isAttached()||(Q(E)&&TL(E,T,S,L,I,k),S.has(T)||k.delete(T),I.push(T)))}for(let T of I)L.delete(T);for(let T of w){let E=L.get(T);E===void 0||E.isAttached()||(S.has(T)||w.delete(T),L.delete(T))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let x=l._selection;if(Ue(x)){let y=l._nodeMap,C=x.anchor.key,w=x.focus.key;y.get(C)!==void 0&&y.get(w)!==void 0||Z(19)}else Wc(x)&&x._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Pa(e)}finally{Yn=c,_o=f,Jn=p,e._updating=m,Tp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,x){let y=x.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(y))return!0}else if(y!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Pa(e)):d&&iH(()=>{Pa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function na(e,t,n){Jn===e&&n===void 0?t():Xp(e,t,n)}var jv=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&Z(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&Z(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&Z(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(Vp||Vc||qp);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",o.insertBefore(i,a),o.__lexicalLineBreak=i}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=cL(n,o);a.push(r);let i=cL(n,this.element),s=t.getIndexWithinParent();for(let l=0;l<i.length;l++){let d=a[l],c=i[l];if(d===void 0||d<c)break;if(d>c){s+=1;break}}return[t.getParentOrThrow(),s]}};function cL(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&Z(225),n.reverse()}var Ci=class extends dr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return n$[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Kt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Me(n)&&t.push(n),Q(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Q(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;Q(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return Q(a)&&a.getLastDescendant()||a||null}let r=n[t];return Q(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Bn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&Z(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Bn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&Z(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=Wp)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=Lv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=fo[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Kc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Qn();let o=St(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Me(l)||Q(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Me(l)||Q(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ue(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):xk(s,r,s,a,"element","element")}selectStart(){let t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){let t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?Lv[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Op(this)&&Z(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||Z(226,String(t),String(n),String(r));let i=a.__key,s=[],l=[],d=this.getChildAtIndex(t+n),c=null,f=r-n+o.length;if(t!==0)if(t===r)c=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(c=m.getPreviousSibling())}if(n>0){let m=c===null?this.getFirstChild():c.getNextSibling();for(let h=0;h<n;h++){m===null&&Z(100);let g=m.getNextSibling(),v=m.__key;xi(m.getWritable()),l.push(v),m=g}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let h=m.getWritable();h.__parent===i&&f--,xi(h);let g=m.__key;if(p===null)a.__first=g,h.__prev=null;else{let v=p.getWritable();v.__next=g,h.__prev=v.__key}m.__key===i&&Z(76),h.__parent=i,s.push(g),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=St();if(Ue(m)){let h=new Set(l),g=new Set(s),{anchor:v,focus:x}=m;uL(v,h,g)&&zp(v,v.getNode(),this,c,d),uL(x,h,g)&&zp(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||cr(this)||this.remove()}}return a}getDOMSlot(t){return new jv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||cr(this)||this.getChildren().some(Me)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let i=n.getElementByKey(a.getKey());i!==null&&(r==null?(o.insertChild(i),r=i):r!==i&&o.replaceChild(i,r),r=r.nextSibling)}}};function Q(e){return e instanceof Ci}function uL(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Hc=class extends dr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Qt(e){return e instanceof Hc}var Fl=class e extends Ci{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Z(51)}getTextContent(){let t=this.__cachedText;return!Vl()&&Kt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){Z(52)}replace(t){Z(53)}insertBefore(t){Z(54)}insertAfter(t){Z(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)Q(r)||Qt(r)||Z(282);return super.splice(t,n,o)}static importJSON(t){return Ko().updateFromJSON(t)}collapseAtStart(){return!0}};function to(e){return e instanceof Fl}function wk(e){return new Uc(new Map(e._nodeMap))}function bx(){return new Uc(new Map([["root",new Fl]]))}function Tk(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Z(130,n.name),Q(e)){let o=t.children;Array.isArray(o)||Z(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=Tk(r[a]);o.push(i)}}return t}function J$(e){return e instanceof Uc}var Uc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return lL(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return lL(null,this,()=>({root:Tk(Ko())}))}},$p=class extends Ci{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Bl=class e extends Ci{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Nl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:Z$,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Ea().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Me);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Ea();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||Me(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Z$(e){let t=Ea();if(e.style&&(t.setFormat(e.style.textAlign),Gk(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Lv&&t.setFormat(n)}return{node:t}}function Ea(){return Xc(new Bl)}function Lk(e){return e instanceof Bl}var Al=0,eH=1,tH=2,nH=3,oH=4;function kk(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=bx(),e._pendingEditorState=o,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function Pk(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Yc(o),a=o.transform;if(!n.has(a)){n.add(a);let i=o.transform();i&&t.add(i)}if(r){let i=r.$transform;i&&t.add(i),o=r.extends}else{let i=Object.getPrototypeOf(o);o=i.prototype instanceof dr&&i!==dr?i:void 0}}return t}function rH(e){let t=e||{},n=X$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=bx(),s=t.namespace||(r!==null?r._config.namespace:Ok()),l=t.editorState,d=[Fl,Ls,_l,Ol,Bl,$p,...t.nodes||[]],{onError:c,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let g=0;g<d.length;g++){let v=d[g],x=null,y=null;if(typeof v!="function"){let k=v;v=k.replace,x=k.with,y=k.withKlass||null}Yc(v);let C=v.getType(),w=Pk(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:AL(d[g]),transforms:w})}}let h=new bi(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(g,v){let x=new Map,y=new Set,C=w=>{Object.keys(w).forEach(k=>{let S=x.get(k);S===void 0&&(S=[],x.set(k,S)),S.push(w[k])})};return g.forEach(w=>{let k=w.klass.importDOM;if(k==null||y.has(k))return;y.add(k);let S=k.call(w.klass);S!==null&&C(S)}),v&&C(v),x})(m,f?f.import:void 0),p,e);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=2),(function(g){g.registerCommand(sx,L$,Al),g.registerCommand(lx,k$,Al),g.registerCommand(dx,P$,Al),g.registerCommand(cx,A$,Al),g.registerCommand(mx,E$,Al)})(h),h}var bi=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,n,o,r,a,i,s,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ok(),this._onError=a,this._htmlConversions=i,this._editable=s,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&Z(35);let r=this._commands;r.has(t)||r.set(t,[new Set,new Set,new Set,new Set,new Set]);let a=r.get(t);a===void 0&&Z(36,String(t));let i=a[o];return i.add(n),()=>{i.delete(n),a.every(s=>s.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,i=a.get(n);i===void 0&&(i=new Set,a.set(n,i)),i.add(r);let s=o&&o.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(n,r),()=>{i.delete(r),i.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&Z(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=Jv(o).get(n.getType());if(!r)return;let a=new Map;for(let i of r.keys())a.set(i,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let i=this.registerNodeTransformToKlass(a,n);r.push(i)}return(function(i,s){let l=Jv(i.getEditorState()),d=[];for(let c of s){let f=l.get(c);f&&d.push(f)}d.length!==0&&i.update(()=>{for(let c of d)for(let f of c.keys()){let p=Bn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:wp}:void 0)})(this,r.map(i=>i.klass.getType())),()=>{r.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Ce(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Nl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,kk(this,n,t,r),n!==null&&(this._config.disableEvents||M$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Nx(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,PL(this),this._updateTags.add(wp),Pa(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Hv.set(s,d);let c=_p.get(d)??0;c<1&&d.addEventListener("selectionchange",sk),_p.set(d,c+1),s.__lexicalEditor=l;let f=ik(s);for(let p=0;p<$v.length;p++){let[m,h]=$v[p],g=typeof h=="function"?v=>{qT(v)||(KT(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(qT(v))return;KT(v);let x=l.isEditable();switch(m){case"cut":return x&&Ce(l,hx,v);case"copy":return Ce(l,gx,v);case"paste":return x&&Ce(l,ux,v);case"dragstart":return x&&Ce(l,jL,v);case"dragover":return x&&Ce(l,QL,v);case"dragend":return x&&Ce(l,XL,v);case"focus":return x&&Ce(l,YL,v);case"blur":return x&&Ce(l,JL,v);case"drop":return x&&Ce(l,GL,v)}};s.addEventListener(m,g),f.push(()=>{s.removeEventListener(m,g)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(wp),Pa(this);Ec("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&Z(38);let o=t;o._readOnly&&(o=wk(t),o._selection=t._selection?t._selection.clone():null),kL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Pa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Pa(this)}parseEditorState(t,n){return(function(o,r,a){let i=bx(),s=Yn,l=_o,d=Jn,c=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Yn=i,_o=!1,Jn=r,Ix(null);try{let h=r._nodes;Cx(o.root,h),a&&a(),i._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Yn=s,_o=l,Jn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Pa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Xp(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),na(this,()=>{let r=St(),a=Ko();r!==null?r.dirty||Do(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),em("focus"),Hk(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Er(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Ec("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};bi.version="0.41.0+prod.esm";var Qv=null;function Ix(e){Qv=e}var Ak=1;function aH(){Ak=1}function Sx(e,t){let n=wx(e,t);return n===void 0&&Z(30,t),n}function wx(e,t){return e._nodes.get(t)}var iH=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function Ek(e){return Qt(Zp(e))}function Tx(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return Qt(Zp(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&jc(t)==null)}function Gc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Tx(t)&&Lx(t)===e}catch{return!1}}function Yp(e){return e instanceof bi}function Lx(e){let t=e;for(;t!=null;){let n=jc(t);if(Yp(n))return n;t=Qc(t)}return null}function jc(e){return e?e.__lexicalEditor:null}function sH(e){return Z5.test(e)?"rtl":e$.test(e)?"ltr":null}function vi(e){return xx(e)||e.isToken()}function ka(e){return vi(e)||e.isSegmented()}function oa(e){return Wl(e)&&e.nodeType===3}function Mk(e){return Wl(e)&&e.nodeType===9}function Ps(e){let t=e;for(;t!=null;){if(oa(t))return t;t=t.firstChild}return null}function Kc(e,t,n){let o=fo[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~fo.superscript:t==="superscript"?r&=~fo.subscript:t==="lowercase"?(r&=~fo.uppercase,r&=~fo.capitalize):t==="uppercase"?(r&=~fo.lowercase,r&=~fo.capitalize):t==="capitalize"&&(r&=~fo.lowercase,r&=~fo.uppercase),r}function lH(e){return Me(e)||Ss(e)||Qt(e)}function Rk(e,t){let n=(function(){let i=Qv;return Qv=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Qn(),bk();let o=Kt(),r=Na(),a=""+Ak++;r._nodeMap.set(a,e),Q(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function xi(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),i=a!==null?a.__key:null,s=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=i),a===null&&(o.__last=s),l!==null&&(l.__next=i),d!==null&&(d.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Hp(e){bk(),Op(e)&&Z(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Na(),r=Kt(),a=o._nodeMap,i=r._dirtyElements;n!==null&&(function(l,d,c){let f=l;for(;f!==null;){if(c.has(f))return;let p=d.get(f);if(p===void 0)break;c.set(f,!1),f=p.__parent}})(n,a,i);let s=t.__key;r._dirtyType=1,Q(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Xn(e){Qn();let t=Kt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Bn(n);o!==null&&o.getWritable()}if(e!==null){let o=Bn(e);o!==null&&o.getWritable()}}}function hi(){return Vl()?null:Kt()._compositionKey}function Bn(e,t){let n=(t||Na())._nodeMap.get(e);return n===void 0?null:n}function kx(e,t){let n=Jp(e,Kt());return n!==void 0?Bn(n,t):null}function Jp(e,t){return e[`__lexicalKey_${t._key}`]}function Zp(e,t){let n=e;for(;n!=null;){let o=kx(n,t);if(o!==null)return o;n=Qc(n)}return null}function Nk(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function fL(e){return e.read(()=>Ko().getTextContent())}function Ko(){return _k(Na())}function _k(e){return e._nodeMap.get("root")}function Do(e){Qn();let t=Na();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function El(e){let t=Kt(),n=(function(o,r){let a=o;for(;a!=null;){let i=Jp(a,r);if(i!==void 0)return i;a=Qc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Bn("root"):null:Bn(n)}function Dk(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Px(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function Ok(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Fk(e){return oa(e)?e.nodeValue:null}function Ax(e,t,n){let o=Er(qo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=Fk(r),l=Zp(r);if(s!==null&&Me(l)){if((s===_c||s===ox)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Ex(l,s,a,i,e)}}}function Ex(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let i=a.isComposing(),s=t;if((i||r)&&(t.endsWith(_c)&&(s=t.slice(0,-_c.length)),r)){let d=ox,c;for(;(c=s.indexOf(d))!==-1;)s=s.slice(0,c)+s.slice(c+d.length),n!==null&&n>c&&(n=Math.max(c,n-d.length)),o!==null&&o>c&&(o=Math.max(c,o-d.length))}let l=a.getTextContent();if(r||s!==l){if(s===""){if(Xn(null),qp||Vc||Vp)a.remove();else{let g=Kt();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Es(),f=a.getTextContentSize(),p=hi(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ue(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!i||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!i))return void a.markDirty();let h=St();if(!Ue(h)||n===null||o===null)return void pL(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=jn(a.getTextContent());a.replace(g),a=g}pL(a,s,h)}}}function pL(e,t,n){if(e.setTextContent(t),Ue(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=kr(e,a.offset,"clamp"))}}}function xp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function Bk(e,t){return xp(e,t,"altKey")&&xp(e,t,"ctrlKey")&&xp(e,t,"shiftKey")&&xp(e,t,"metaKey")}function Pt(e,t,n){if(!Bk(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var La={ctrlKey:!Sr,metaKey:Sr},mL={altKey:Sr,ctrlKey:!Sr};function gL(e){return e.key==="Backspace"}function hL(e){return Pt(e,"a",La)}function dH(e){let t=Ko();if(Ue(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Pp(e),e}{let n=t.select(0,t.getChildrenSize());return Do(Pp(n)),n}}function Nl(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=Jc(r);return n[t]=a,a}return r}function Mx(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&Z(33,a);let l=s.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(i),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(i,f?"updated":r)}function cH(e){let t=e.getType(),n=Na();if(n._readOnly){let a=Jv(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function vL(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function zk(e,t){let n=e.offset;if(e.type==="element")return vL(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?vL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function $k(e){let t=qo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Ce(e,t,n){return(function(o,r,a){let i=Px(o);for(let s=4;s>=0;s--)for(let l=0;l<i.length;l++){let d=i[l],c=d._commands.get(r);if(c!==void 0){let f=c[s];if(f!==void 0){let p=Array.from(f),m=p.length,h=!1;if(na(d,()=>{for(let g=0;g<m;g++)if(p[g](a,o))return void(h=!0)}),h)return h}}}return!1})(e,t,n)}function zl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&Z(75,t),n}function Qc(e){let t=e.assignedSlot||e.parentElement;return Vk(t)?t.host:t}function Rx(e){return Mk(e)?e:ko(e)?e.ownerDocument:null}function uH(e){return Kt()._updateTags.has(e)}function em(e){Qn(),Kt()._updateTags.add(e)}function Hk(e){Qn(),Kt()._deferred.push(e)}function Up(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Nx(e){let t=Rx(e);return t?t.defaultView:null}function qo(e){let t=e._window;return t===null&&Z(78),t}function fH(e){return Q(e)&&e.isInline()||Qt(e)&&e.isInline()}function Uk(e){let t=e.getParentOrThrow();for(;t!==null;){if(cr(t))return t;t=t.getParentOrThrow()}return t}function cr(e){return to(e)||Q(e)&&e.isShadowRoot()}function _x(e){let t=e.constructor.clone(e);return Rk(t,null),t.afterCloneFrom(e),t}function Xc(e){let t=Kt(),n=e.getType(),o=wx(t,n);o===void 0&&Z(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let i=r(e),s=i.constructor;return a!==null?i instanceof a||Z(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||Z(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&Z(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Iv(e,t){!to(e.getParent())||Q(t)||Qt(t)||Z(99)}function Kk(e){let t=Bn(e);return t===null&&Z(63,e),t}function Sv(e){return(Qt(e)||Q(e)&&!e.canBeEmpty())&&!e.isInline()}function Xv(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Er(e){return Ar?(e||window).getSelection():null}function qk(e){let t=Nx(e);return t?t.getSelection():null}function pH(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),cr(e)&&Z(102);let o=i=>{let s=i.getParentOrThrow(),l=cr(s),d=i!==n||l?_x(i):i;if(l)return Q(i)&&Q(d)||Z(133),i.insertAfter(d),[i,d,d];{let[c,f,p]=o(s),m=i.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function mH(e){return ko(e)&&e.tagName==="A"}function ko(e){return Wl(e)&&e.nodeType===1}function Wl(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function Vk(e){return Wl(e)&&e.nodeType===11}function Wk(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return e.nodeName.match(t)!==null}function Yv(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return e.nodeName.match(t)!==null}function Aa(e){if(Qt(e)&&!e.isInline())return!0;if(!Q(e)||cr(e))return!1;let t=e.getFirstChild(),n=t===null||Ss(t)||Me(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Dx(){return Kt()}var xL=new WeakMap,gH=new Map;function Jv(e){if(!e._readOnly&&e.isEmpty())return gH;e._readOnly||Z(192);let t=xL.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let i=a.__type,s=o.get(i);s||(s=new Map,o.set(i,s)),s.set(r,a)}return o})(e),xL.set(e,t)),t}function Ox(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function hH(e){return(t=Ox(e))[lk]=!0,t;var t}function Gk(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function vH(e){e.__lexicalUnmanaged=!0}function jk(e){return e.__lexicalUnmanaged===!0}function Lc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==dr[t]}function Yc(e){let t=ET in e.prototype?e.prototype[ET]():void 0,n=(function(i){if(!(i===dr||i.prototype instanceof dr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{bi.version&&(l=JSON.parse(bi.version))}catch{}Z(290,i.name,s,l)}return i===Hc||i===Ci||i===dr})(e),o=!n&&Lc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[i,s]of Object.entries(t))a=i,r=s;if(!n&&a&&(Lc(e,"getType")||(e.getType=()=>a),Lc(e,"clone")||(e.clone=i=>(Ix(i),new e)),Lc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Lc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function xH(e){let t=Dx();return Qn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Mc=(e,t)=>{let n=e;for(;n!=null&&!to(n);){if(t(n))return n;n=n.getParent()}return null},yH={next:"previous",previous:"next"},$l=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return zx({hasNext:As,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Zn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Zn(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,i=this.getParentAtCaret(),s=new Map;for(let l=a.getAdjacentCaret();l!==null&&s.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();s.set(d.getKey(),d)}for(let l of r){if(s.size>0){let d=a.getNodeAtCaret();if(d){if(s.delete(d.getKey()),s.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(i)&&l.remove(),d.replace(l)}}else d===null&&Z(263,Array.from(s).join(" "))}else a.insert(l);a=Zn(l,this.direction)}for(let l of s.values())l.remove();return this}},qc=class e extends $l{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ra(t,this.direction)}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Li(this.direction);return Zn(this.getNodeAtCaret(),t)||Ra(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}},CH={root:to,shadowRoot:cr};function Li(e){return yH[e]}function Fx(e,t="root"){return CH[t](e)?null:e}var Hl=class e extends $l{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Zn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Q(this.origin)?Ra(this.origin,this.direction):null}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Li(this.direction);return Zn(this.getNodeAtCaret(),t)||Ra(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Ul)&&this.direction===t.direction&&this.origin.is(t.origin)}},Ul=class e extends $l{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ii(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ii(this.origin,Li(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Hl||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Zn(this.origin,this.direction)}};function Ma(e){return e instanceof Ul}function bH(e){return e instanceof $l}function As(e){return e instanceof Hl}function Lr(e){return e instanceof qc}var IH={next:class extends Ul{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ul{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},SH={next:class extends Hl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Hl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},wH={next:class extends qc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends qc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Zn(e,t){return e?new SH[t](e):null}function Ii(e,t,n){return e?new IH[t](e,kr(e,n)):null}function kr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&bL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function Zv(e,t){return new Kp(e,t)}function Ra(e,t){return Q(e)?new wH[t](e):null}function Qk(e){return e&&e.getChildCaret()||e}function Kl(e){return e&&Qk(e.getAdjacentCaret())}var ex=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Ma(a)?(function(i,s){let{direction:l,origin:d}=i,c=kr(d,s==="focus"?Li(l):l);return Zv(i,c-i.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[Zv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=Ma(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Ma(o),a=i=>i.isSameNodeCaret(o)?null:Kl(i)||i.getParentCaret(t);return zx({hasNext:i=>i!==null&&!(r&&o.isSameNodeCaret(i)),initial:n.isSameNodeCaret(o)?null:a(n),map:i=>i,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Kp=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return Ii(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function TH(e){return e instanceof Kp}function Bx(e){return Si(e,Zn(Ko(),e.direction))}function Xk(e){return Si(e,e)}function Si(e,t){return e.direction!==t.direction&&Z(265),new ex(e,t,e.direction)}function zx(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let i={done:!1,value:r(a)};return a=o(a),i}}}function $x(e,t){let n=Rc(e.origin,t.origin);switch(n===null&&Z(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,i){return Math.sign(a-i)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Hx(n)}}function Hx(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,i=n;for(;a&&i;a=a.getNextSibling(),i=i.getNextSibling()){if(a.__key===r)return-1;if(i.__key===o)return 1}return a===null?1:-1}function yp(e,t){return t.is(e)}function yL(e){return Q(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Rc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=yL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=yL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(yp(e,o)||Z(276),{commonAncestor:o,type:"ancestor"}):r===null?(yp(t,o)||Z(277),{commonAncestor:o,type:"descendant"}):((Q(a)||yp(e,a))&&(Q(r)||yp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||Z(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function wi(e,t){let{type:n,key:o,offset:r}=e,a=Kk(e.key);return n==="text"?(Me(a)||Z(266,a.getType(),o),Ii(a,t,r)):(Q(a)||Z(267,a.getType(),o),eP(a,e.offset,t))}function ql(e,t){let{origin:n,direction:o}=t,r=o==="next";Ma(t)?e.set(n.getKey(),t.offset,"text"):As(t)?Me(n)?e.set(n.getKey(),kr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Lr(t)&&Q(n)||Z(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function Yk(e){let t=St(),n=Ue(t)?t:yk();return Nc(n,e),Do(n),n}function Nc(e,t){ql(e.anchor,t.anchor),ql(e.focus,t.focus)}function tx(e){let{anchor:t,focus:n}=e,o=wi(t,"next"),r=wi(n,"next"),a=$x(o,r)<=0?"next":"previous";return Si(Ti(o,a),Ti(r,a))}function Gl(e){let{direction:t,origin:n}=e,o=Zn(n,Li(t)).getNodeAtCaret();return o?Zn(o,t):Ra(n.getParentOrThrow(),t)}function CL(e,t="root"){let n=[e];for(let o=Lr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Gl(o));return n}function wv(e){return!!e&&e.origin.isAttached()}function Jk(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Ux(e,o),i=CL(a.anchor,n),s=CL(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(Lr(h))l.add(h.origin.getKey());else if(As(h)){let{origin:g}=h;Q(g)&&!l.has(g.getKey())||d.push(g)}for(let h of d)h.remove();for(let h of a.getTextSlices()){if(!h)continue;let{origin:g}=h.caret,v=g.getTextContentSize(),x=Gl(Zn(g,o)),y=g.getMode();if(Math.abs(h.distance)===v&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)x.remove();else if(h.distance!==0){r="removeEmptySlices";let C=h.removeTextSlice(),w=h.caret.origin;if(y==="segmented"){let k=C.origin,S=jn(k.getTextContent()).setStyle(k.getStyle()).setFormat(k.getFormat());x.replaceOrInsert(S),C=Ii(S,o,C.offset)}w.is(i[0].origin)&&(i[0]=C),w.is(s[0].origin)&&(s[0]=C.getFlipped())}}let c,f;for(let h of i)if(wv(h)){c=wr(h);break}for(let h of s)if(wv(h)){f=wr(h);break}let p=(function(h,g,v){if(!h||!g)return null;let x=h.getParentAtCaret(),y=g.getParentAtCaret();if(!x||!y)return null;let C=x.getParents().reverse();C.push(x);let w=y.getParents().reverse();w.push(y);let k=Math.min(C.length,w.length),S;for(S=0;S<k&&C[S]===w[S];S++);let L=(E,A)=>{let N;for(let R=S;R<E.length;R++){let $=E[R];if(cr($))return;!N&&A($)&&(N=$)}return N},I=L(C,Aa),T=I&&L(w,E=>v.has(E.getKey())&&Aa(E));return I&&T?[I,T]:null})(c,f,l);if(p){let[h,g]=p;Ra(h,"previous").splice(0,g.getChildren());let v=g.getParent();for(g.remove(!0);v&&v.isEmpty();){let x=v;v=v.getParent(),x.remove(!0)}}let m=[c,f,...i,...s].find(wv);if(m)return Xk(Ti(wr(m),e.direction));Z(269,JSON.stringify(i.map(h=>h.origin.__key)))}function wr(e){let t=(function(r){let a=r;for(;Lr(a);){let i=Kl(a);if(!Lr(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Me(t.origin))return Ma(t)?t:Ii(t.origin,n,n);let o=t.getAdjacentCaret();return As(o)&&Me(o.origin)?Ii(o.origin,n,Li(n)):t}function Zk(e){return Ma(e)&&e.offset!==kr(e.origin,e.direction)}function Ti(e,t){return e.direction===t?e:e.getFlipped()}function Ux(e,t){return e.direction===t?e:Si(Ti(e.focus,t),Ti(e.anchor,t))}function eP(e,t,n){let o=Ra(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Ti(o,n)}function LH(e,t="root"){let n=0,o=e,r=Kl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Kl(o)}return r&&[r,n]}function kH(e){let{origin:t,offset:n,direction:o}=e;if(n===kr(t,o))return e.getSiblingCaret();if(n===kr(t,Li(o)))return Gl(e.getSiblingCaret());let[r]=t.splitText(n);return Me(r)||Z(281),Ti(Zn(r,"next"),o)}function PH(e,t){return!0}function AH(e,{$copyElementNode:t=_x,$splitTextPointCaretNext:n=kH,rootMode:o="shadowRoot",$shouldSplit:r=PH}={}){if(Ma(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Lr(e)&&(!i.canBeEmpty()||!r(i,"first")))return Gl(a);let s=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(s.length>0||i.canBeEmpty()&&r(i,"last"))&&a.insert(t(i).splice(0,0,s))}return a}function EH(e){return e}function MH(...e){return e}function RH(e,t){return[e,t]}function NH(e){return e}function _H(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Jc(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function DH(e,...t){let n=Jc(...t);n.length>0&&e.classList.add(...n)}function OH(e,...t){let n=Jc(...t);n.length>0&&e.classList.remove(...n)}function FH(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Kx,Jte=M.$addUpdateTag,tm=M.$applyNodeReplacement,jl=M.$caretFromPoint,tP=M.$caretRangeFromSelection,nm=M.$cloneWithProperties,nP=M.$cloneWithPropertiesEphemeral,Zte=M.$comparePointCaretNext,ene=M.$copyNode,oP=M.$create,Ms=M.$createLineBreakNode,rP=M.$createNodeSelection,ur=M.$createParagraphNode,tne=M.$createPoint,Rs=M.$createRangeSelection,aP=M.$createRangeSelectionFromDom,iP=M.$createTabNode,Mr=M.$createTextNode,sP=M.$extendCaretToRange,_a=M.$findMatchingParent,qx=M.$getAdjacentChildCaret,nne=M.$getAdjacentNode,Ns=M.$getAdjacentSiblingOrParentSiblingCaret,Vx=M.$getCaretInDirection,lP=M.$getCaretRange,one=M.$getCaretRangeInDirection,dP=M.$getCharacterOffsets,ki=M.$getChildCaret,rne=M.$getChildCaretAtIndex,Wx=M.$getChildCaretOrSelf,cP=M.$getCollapsedCaretRange,ane=M.$getCommonAncestor,ine=M.$getCommonAncestorResultBranchOrder,om=M.$getEditor,sne=M.$getNearestNodeFromDOMNode,lne=M.$getNearestRootOrShadowRoot,rm=M.$getNodeByKey,dne=M.$getNodeByKeyOrThrow,uP=M.$getNodeFromDOMNode,Zc=M.$getPreviousSelection,Ct=M.$getRoot,Oe=M.$getSelection,Da=M.$getSiblingCaret,am=M.$getState,cne=M.$getStateChange,une=M.$getTextContent,fne=M.$getTextNodeOffset,pne=M.$getTextPointCaret,mne=M.$getTextPointCaretSlice,gne=M.$getWritableNodeState,fP=M.$hasAncestor,hne=M.$hasUpdateTag,vne=M.$insertNodes,Ql=M.$isBlockElementNode,eu=M.$isChildCaret,im=M.$isDecoratorNode,pP=M.$isEditorState,Ke=M.$isElementNode,mP=M.$isExtendableTextPointCaret,xne=M.$isInlineElementOrDecoratorNode,gP=M.$isLeafNode,Xl=M.$isLineBreakNode,yne=M.$isNodeCaret,Gx=M.$isNodeSelection,hP=M.$isParagraphNode,we=M.$isRangeSelection,tu=M.$isRootNode,_s=M.$isRootOrShadowRoot,vP=M.$isSiblingCaret,Cne=M.$isTabNode,tt=M.$isTextNode,sm=M.$isTextPointCaret,bne=M.$isTextPointCaretSlice,jx=M.$isTokenOrSegmented,Ine=M.$isTokenOrTab,Sne=M.$nodesOfType,xP=M.$normalizeCaret,yP=M.$normalizeSelection__EXPERIMENTAL,wne=M.$onUpdate,CP=M.$parseSerializedNode,Tne=M.$removeTextFromCaretRange,bP=M.$rewindSiblingCaret,lm=M.$selectAll,Lne=M.$setCompositionKey,kne=M.$setPointFromCaret,Rr=M.$setSelection,IP=M.$setSelectionFromCaretRange,dm=M.$setState,SP=M.$splitAtPointCaretNext,wP=M.$splitNode,Pne=M.$updateRangeSelectionFromCaretRange,Qx=M.ArtificialNode__DO_NOT_USE,Ane=M.BEFORE_INPUT_COMMAND,TP=M.BLUR_COMMAND,nu=M.CAN_REDO_COMMAND,ou=M.CAN_UNDO_COMMAND,cm=M.CLEAR_EDITOR_COMMAND,LP=M.CLEAR_HISTORY_COMMAND,kP=M.CLICK_COMMAND,Ene=M.COLLABORATION_TAG,um=M.COMMAND_PRIORITY_CRITICAL,Xt=M.COMMAND_PRIORITY_EDITOR,Nr=M.COMMAND_PRIORITY_HIGH,Yl=M.COMMAND_PRIORITY_LOW,Mne=M.COMMAND_PRIORITY_NORMAL,Rne=M.COMPOSITION_END_COMMAND,PP=M.COMPOSITION_END_TAG,Nne=M.COMPOSITION_START_COMMAND,AP=M.COMPOSITION_START_TAG,EP=M.CONTROLLED_TEXT_INSERTION_COMMAND,fm=M.COPY_COMMAND,MP=M.CUT_COMMAND,pm=M.DELETE_CHARACTER_COMMAND,RP=M.DELETE_LINE_COMMAND,NP=M.DELETE_WORD_COMMAND,_ne=M.DRAGEND_COMMAND,Dne=M.DRAGOVER_COMMAND,_P=M.DRAGSTART_COMMAND,DP=M.DROP_COMMAND,Oa=M.DecoratorNode,One=M.ElementNode,OP=M.FOCUS_COMMAND,Fne=M.FORMAT_ELEMENT_COMMAND,FP=M.FORMAT_TEXT_COMMAND,mm=M.HISTORIC_TAG,_r=M.HISTORY_MERGE_TAG,BP=M.HISTORY_PUSH_TAG,Xx=M.INDENT_CONTENT_COMMAND,Bne=M.INPUT_COMMAND,Yx=M.INSERT_LINE_BREAK_COMMAND,zP=M.INSERT_PARAGRAPH_COMMAND,$P=M.INSERT_TAB_COMMAND,ru=M.INTERNAL_$isBlock,zne=M.IS_ALL_FORMATTING,$ne=M.IS_BOLD,Hne=M.IS_CODE,Une=M.IS_HIGHLIGHT,Kne=M.IS_ITALIC,qne=M.IS_STRIKETHROUGH,Vne=M.IS_SUBSCRIPT,Wne=M.IS_SUPERSCRIPT,Gne=M.IS_UNDERLINE,HP=M.KEY_ARROW_DOWN_COMMAND,gm=M.KEY_ARROW_LEFT_COMMAND,hm=M.KEY_ARROW_RIGHT_COMMAND,UP=M.KEY_ARROW_UP_COMMAND,vm=M.KEY_BACKSPACE_COMMAND,KP=M.KEY_DELETE_COMMAND,qP=M.KEY_DOWN_COMMAND,xm=M.KEY_ENTER_COMMAND,jne=M.KEY_ESCAPE_COMMAND,Qne=M.KEY_MODIFIER_COMMAND,Xne=M.KEY_SPACE_COMMAND,ym=M.KEY_TAB_COMMAND,VP=M.LineBreakNode,Yne=M.MOVE_TO_END,Jne=M.MOVE_TO_START,Zne=M.NODE_STATE_KEY,WP=M.OUTDENT_CONTENT_COMMAND,Cm=M.PASTE_COMMAND,GP=M.PASTE_TAG,jP=M.ParagraphNode,QP=M.REDO_COMMAND,XP=M.REMOVE_TEXT_COMMAND,YP=M.RootNode,eoe=M.SELECTION_CHANGE_COMMAND,JP=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,ZP=M.SELECT_ALL_COMMAND,toe=M.SKIP_COLLAB_TAG,noe=M.SKIP_DOM_SELECTION_TAG,ooe=M.SKIP_SCROLL_INTO_VIEW_TAG,roe=M.SKIP_SELECTION_FOCUS_TAG,eA=M.TEXT_TYPE_TO_FORMAT,tA=M.TabNode,bm=M.TextNode,nA=M.UNDO_COMMAND,au=M.addClassNamesToElement,aoe=M.buildImportMap,Im=M.configExtension,oA=M.createCommand,Sm=M.createEditor,ioe=M.createSharedNodeState,rA=M.createState,aA=M.declarePeerDependency,Mn=M.defineExtension,soe=M.flipDirection,loe=M.getDOMOwnerDocument,Jx=M.getDOMSelection,doe=M.getDOMSelectionFromTarget,iA=M.getDOMTextNode,coe=M.getEditorPropertyFromDOMNode,uoe=M.getNearestEditorFromDOMNode,sA=M.getRegisteredNode,foe=M.getRegisteredNodeOrThrow,poe=M.getStaticNodeConfig,moe=M.getTextDirection,goe=M.getTransformSetFromKlass,lA=M.isBlockDomNode,hoe=M.isCurrentlyReadOnlyMode,dA=M.isDOMDocumentNode,cA=M.isDOMNode,voe=M.isDOMTextNode,xoe=M.isDOMUnmanaged,Zx=M.isDocumentFragment,yoe=M.isExactShortcutMatch,uA=M.isHTMLAnchorElement,wm=M.isHTMLElement,iu=M.isInlineDomNode,Coe=M.isLexicalEditor,boe=M.isModifierMatch,Ioe=M.isSelectionCapturedInDecoratorInput,fA=M.isSelectionWithinEditor,ey=M.makeStepwiseIterator,ra=M.mergeRegister,Soe=M.normalizeClassNames,Tm=M.removeClassNamesFromElement,woe=M.removeFromParent,Toe=M.resetRandomKey,Dr=M.safeCast,Loe=M.setDOMUnmanaged,koe=M.setNodeIndentFromDOM,Lm=M.shallowMergeConfig,ty=M.toggleTextFormatType;var ny={};An(ny,{LexicalComposer:()=>zH});me();var pA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,BH=pA?ye:q,km={tag:_r};function zH({initialConfig:e,children:t}){let n=z(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=AT(null,o),c=Sm({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>i(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=Ct();if(m.isEmpty()){let h=ur();m.append(h);let g=pA?document.activeElement:null;(Oe()!==null||g!==null&&g===f.getRootElement())&&h.select()}},km);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,km);break}case"object":f.setEditorState(p,km);break;case"function":f.update(()=>{Ct().isEmpty()&&p(f)},km)}}})(c,s),[c,d]},[]);return BH(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(PT.Provider,{value:n,children:t})}var $H=ny,mA=$H.LexicalComposer;var ry={};An(ry,{$canShowPlaceholder:()=>hA,$canShowPlaceholderCurry:()=>UH,$findTextIntersectionFromCharacters:()=>KH,$isRootTextContentEmpty:()=>oy,$isRootTextContentEmptyCurry:()=>HH,$rootTextContent:()=>gA,registerLexicalTextEntity:()=>VH});function gA(){return Ct().getTextContent()}function oy(e,t=!0){if(e)return!1;let n=gA();return t&&(n=n.trim()),n===""}function HH(e,t){return()=>oy(e,t)}function hA(e){if(!oy(e,!1))return!1;let t=Ct().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(im(r))return!1;if(Ke(r)){if(!hP(r)||r.__indent!==0)return!1;let a=r.getChildren(),i=a.length;for(let s=0;s<i;s++){let l=a[o];if(!tt(l))return!1}}}return!0}function UH(e){return()=>hA(e)}function KH(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(Ke(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(tt(n)){let i=n.getTextContentSize();if(o+i>t)return{node:n,offset:t-o};o+=i}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let i=a.getNextSibling();if(i!==null){n=i;continue e}a=a.getParent()}break}return null}function qH(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function VH(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Mr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(bm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(tt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(h=>h.getLatest().__mode)(l)!==0)return void a(l);{let h=m.end-p.length;if(h>0){let g=p+d.slice(0,h);if(l.select(),l.setTextContent(g),h===d.length)i.remove();else{let v=d.slice(h);i.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){s=t(d);let p,m=s===null?"":d.slice(s.end);if(d=m,m===""){let g=c.getNextSibling();if(tt(g)){m=c.getTextContent()+g.getTextContent();let v=t(m);if(v===null)return void(r(g)?a(g):g.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&tt(l)&&l.isTextEntity()){f+=s.end;continue}s.start===0?[p,c]=c.splitText(s.end):[,p,c]=c.splitText(s.start+f,s.end+f),p===void 0&&qH(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),c==null)return;f=0,l=h}}),e.registerNodeTransform(n,i=>{let s=i.getTextContent(),l=t(s);if(l===null||l.start!==0)return void a(i);if(s.length>l.end)return void i.splitText(l.end);let d=i.getPreviousSibling();tt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();tt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Ds=ry,Doe=Ds.$canShowPlaceholder,Pm=Ds.$canShowPlaceholderCurry,Ooe=Ds.$findTextIntersectionFromCharacters,Foe=Ds.$isRootTextContentEmpty,Boe=Ds.$isRootTextContentEmptyCurry,zoe=Ds.$rootTextContent,$oe=Ds.registerLexicalTextEntity;var cy={};An(cy,{$addNodeStyle:()=>YH,$cloneWithProperties:()=>nm,$copyBlockFormatIndent:()=>TA,$ensureForwardRangeSelection:()=>wA,$forEachSelectedTextNode:()=>SA,$getComputedStyleForElement:()=>sy,$getComputedStyleForParent:()=>ly,$getSelectionStyleValueForProperty:()=>aU,$isAtNodeEnd:()=>XH,$isParentElementRTL:()=>dy,$isParentRTL:()=>jH,$moveCaretSelection:()=>PA,$moveCharacter:()=>oU,$patchStyleText:()=>JH,$selectAll:()=>lm,$setBlocksType:()=>ZH,$shouldOverrideDefaultCharacterSelection:()=>nU,$sliceSelectedTextNodeContent:()=>QH,$trimTextContentFromAnchor:()=>IA,$wrapNodes:()=>tU,createDOMRange:()=>WH,createRectsFromDOMRange:()=>GH,getCSSFromStyleObject:()=>bA,getStyleObjectFromCSS:()=>Mm,trimTextContentFromAnchor:()=>iU});function iy(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Em=new Map;function vA(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function xA(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function WH(e,t,n,o,r){let a=t.getKey(),i=o.getKey(),s=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(i),c=n,f=r;if(tt(t)&&(l=vA(l)),tt(o)&&(d=vA(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=xA(l)),d.nodeName==="BR"&&([d,f]=xA(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{s.setStart(l,c),s.setEnd(d,f)}catch{return null}return!s.collapsed||c===f&&a===i||(s.setStart(d,f),s.setEnd(l,c)),s}function GH(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(t.getClientRects()),s,l=i.length;i.sort((d,c)=>{let f=d.top-c.top;return Math.abs(f)<=3?d.left-c.left:f});for(let d=0;d<l;d++){let c=i[d],f=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,p=c.width+a===o.width;f||p?(i.splice(d--,1),l--):s=c}return i}function CA(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Mm(e){let t=Em.get(e);return t===void 0&&(t=CA(e),Em.set(e,t)),t}function bA(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function sy(e){let t=om().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function ly(e){return sy(tu(e)?e:e.getParentOrThrow())}function jH(e){let t=ly(e);return t!==null&&t.direction==="rtl"}function QH(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!jx(t)&&o!==null){let[r,a]=o,i=e.isBackward(),s=r.getNode(),l=a.getNode(),d=t.is(s),c=t.is(l);if(d||c){let[f,p]=dP(e),m=s.is(l),h=t.is(i?l:s),g=t.is(i?s:l),v,x=0;m?(x=f>p?p:f,v=f>p?f:p):h?(x=i?p:f,v=void 0):g&&(x=0,v=i?f:p);let y=t.__text.slice(x,v);y!==t.__text&&(n==="clone"&&(t=nP(t)),t.__text=y)}}return t}function XH(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return Ke(t)||iy(177),e.offset===t.getChildrenSize()}function IA(e,t,n){let o=t.getNode(),r=n;if(Ke(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(Ke(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),i=0;if(a===null){let d=o.getParentOrThrow(),c=d.getPreviousSibling();for(;c===null;){if(d=d.getParent(),d===null){a=null;break}c=d.getPreviousSibling()}d!==null&&(i=d.isInline()?0:2,a=c)}let s=o.getTextContent();s===""&&Ke(o)&&!o.isInline()&&(s=`
|
|
3705
3708
|
|
|
3706
|
-
`);let l=s.length;if(!ot(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||ou(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=nm(d);return ot(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=tu(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=Nr(c);o.replace(g),h=g}if(Se(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 $H(e){let t=e.getStyle(),n=vE(t);Pm.set(t,n)}function km(e,t){(Se(e)?e.isCollapsed():ot(e)||qe(e))||ry(280);let n=Em(Se(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=xE(o);Se(e)||ot(e)?e.setStyle(r):e.setTextStyle(r),Pm.set(r,o)}function HH(e,t){if(Se(e)&&e.isCollapsed()){km(e,t);let o=e.anchor.getNode();qe(o)&&o.isEmpty()&&km(o,t)}CE(o=>{km(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),km(r,t))}}}function CE(e){let t=Fe();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Se(t))for(let a of Jk(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&&(Wx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Se(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&bE(t)}function bE(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 IE(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function UH(e,t,n=IE){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(),iu),d=Oa(s.getNode(),iu);qe(l)&&r.set(l.getKey(),l),qe(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(qe(i)&&iu(i))r.set(i.getKey(),i);else if(o===null){let s=Oa(i,iu);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 hE(e){return e.getNode().isAttached()}function KH(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 qH(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)?(oy(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&dP(c,s)?l.push(c):(oy(e,l,l.length,t,n),l=[c])}oy(e,l,l.length,t,n)}function oy(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&&fP(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))}),KH(v)}}else if(c.has(g.getKey())){qe(g)||ry(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=tu();Se(m)&&hE(m.anchor)&&hE(m.focus)?_r(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function SE(e){let t=wE(e);return t!==null&&t.writingMode==="vertical-rl"}function wE(e){let t=e.anchor.getNode();return qe(t)?ay(t):iy(t)}function VH(e,t){let n=SE(e)?!t:t;sy(e)&&(n=!n);let o=Yl(e.focus,n?"previous":"next");if(uP(o))return!1;for(let r of rP(o)){if(nu(r))return!r.origin.isInline();if(!qe(r.origin)){if(rm(r.origin))return!0;break}}return!1}function TE(e,t,n,o){e.modify(t?"extend":"move",n,o)}function sy(e){let t=wE(e);return t!==null&&t.direction==="rtl"}function WH(e,t,n){let o=sy(e),r;r=SE(e)||o?!n:n,TE(e,t,r,"character")}function GH(e,t,n){let o=Em(e.getStyle());return o!==null&&o[t]||n}function jH(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(Se(e)&&e.isCollapsed()&&e.style!==""){let c=Em(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=GH(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var QH=yE;var sn=ly,LE=sn.$addNodeStyle,Roe=sn.$cloneWithProperties,Noe=sn.$copyBlockFormatIndent,_oe=sn.$ensureForwardRangeSelection,Doe=sn.$forEachSelectedTextNode,Ooe=sn.$getComputedStyleForElement,Foe=sn.$getComputedStyleForParent,Boe=sn.$getSelectionStyleValueForProperty,zoe=sn.$isAtNodeEnd,$oe=sn.$isParentElementRTL,Hoe=sn.$isParentRTL,Uoe=sn.$moveCaretSelection,dy=sn.$moveCharacter,Koe=sn.$patchStyleText,qoe=sn.$selectAll,Voe=sn.$setBlocksType,cy=sn.$shouldOverrideDefaultCharacterSelection,Am=sn.$sliceSelectedTextNodeContent,Woe=sn.$trimTextContentFromAnchor,Goe=sn.$wrapNodes,joe=sn.createDOMRange,kE=sn.createRectsFromDOMRange,Qoe=sn.getCSSFromStyleObject,Xoe=sn.getStyleObjectFromCSS,Yoe=sn.trimTextContentFromAnchor;var my={};Mn(my,{$descendantsMatching:()=>RU,$dfs:()=>mU,$dfsIterator:()=>FE,$filter:()=>LU,$findMatchingParent:()=>Oa,$firstToLastIterator:()=>NU,$getAdjacentCaret:()=>gU,$getAdjacentSiblingOrParentSiblingCaret:()=>_s,$getDepth:()=>zE,$getNearestBlockElementAncestorOrThrow:()=>CU,$getNearestNodeOfType:()=>yU,$getNextRightPreorderNode:()=>xU,$getNextSiblingOrParentSibling:()=>vU,$handleIndentAndOutdent:()=>kU,$insertFirst:()=>PU,$insertNodeToNearestRoot:()=>SU,$insertNodeToNearestRootAtCaret:()=>HE,$isEditorIsNestedEditor:()=>AU,$lastToFirstIterator:()=>py,$restoreEditorState:()=>IU,$reverseDfs:()=>hU,$reverseDfsIterator:()=>$E,$splitNode:()=>bP,$unwrapAndFilterDescendants:()=>MU,$unwrapNode:()=>_U,$wrapNodeInElement:()=>wU,CAN_USE_BEFORE_INPUT:()=>aU,CAN_USE_DOM:()=>_E,IS_ANDROID:()=>iU,IS_ANDROID_CHROME:()=>sU,IS_APPLE:()=>lU,IS_APPLE_WEBKIT:()=>dU,IS_CHROME:()=>cU,IS_FIREFOX:()=>DE,IS_IOS:()=>uU,IS_SAFARI:()=>fU,addClassNamesToElement:()=>su,calculateZoomLevel:()=>EU,isBlockDomNode:()=>aE,isHTMLAnchorElement:()=>lE,isHTMLElement:()=>Im,isInlineDomNode:()=>lu,isMimeType:()=>OE,makeStateWrapper:()=>DU,markSelection:()=>NE,mediaFileReader:()=>pU,mergeRegister:()=>ia,objectKlassEquals:()=>TU,positionNodeOnRange:()=>RE,registerNestedElementResolver:()=>bU,removeClassNamesFromElement:()=>Sm,selectionAlwaysOnDisplay:()=>rU});function Mm(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,XH=Br&&"documentMode"in document?document.documentMode:null,AE=Br&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),YH=Br&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),JH=!(!Br||!("InputEvent"in window)||XH)&&"getTargetRanges"in new window.InputEvent("input"),ZH=Br&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),eU=Br&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,ME=Br&&/Android/.test(navigator.userAgent),fy=Br&&/^(?=.*Chrome).*/i.test(navigator.userAgent),tU=Br&&ME&&fy,nU=Br&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&AE&&!fy;function sa(e){return`${e}px`}var oU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function RE(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Mm(182),r===null&&Mm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=kE(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(!Im(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,oU),l()});return()=>{c(),d()}}function PE(e,t,n){if(e.type!=="text"&&qe(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[oE(n)||n,e.offset]}function NE(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(!Se(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(...PE(A,E,N)),U.setEnd(...PE(R,B,z)),U})(e,p,h,w,m,x,k);l(),l=RE(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 rU(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=NE(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var aU=JH,_E=Br,iU=ME,sU=tU,lU=AE,dU=nU,cU=fy,DE=YH,uU=eU,fU=ZH;function OE(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function pU(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()}),OE(l,t)?d.readAsDataURL(l):i()};i()})}function mU(e,t){return Array.from(FE(e,t))}function gU(e){return e?e.getAdjacentCaret():null}function hU(e,t){return Array.from($E(e,t))}function FE(e,t){return BE("next",e,t)}function EE(e,t){let n=_s(Fa(e,t));return n&&n[0]}function BE(e,t,n){let o=Ct(),r=t||o,a=qe(r)?Ri(r,e):Fa(r,e),i=zE(r),s=n?Ux(qx(Fa(n,e)))||EE(n,e):EE(r,e),l=i;return Jx({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;nu(d)&&l++;let c=_s(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function vU(e){let t=_s(Fa(e,"next"));return t&&[t[0].origin,t[1]]}function zE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function xU(e){let t=qx(Fa(e,"previous")),n=_s(t,"root");return n&&n[0].origin}function $E(e,t){return BE("previous",e,t)}function yU(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function CU(e){let t=Oa(e,n=>qe(n)&&!n.isInline());return qe(t)||Mm(4,e.__key),t}function bU(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 IU(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,em(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;_r(r===null?null:r.clone())}function SU(e){let t=Fe()||tu(),n;if(Se(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=HE(e,n),r=Ux(o),a=nu(r)?gP(r):o;return yP(sP(a)),e.getLatest()}function HE(e,t,n){let o=Kx(t,"next");for(let r=o;r;r=CP(r,n))o=r;return am(o)&&Mm(283),o.insert(e.isInline()?fr().append(e):e),Kx(Fa(e.getLatest(),"next"),t.direction)}function wU(e,t){let n=t();return e.replace(n),n.append(e),n}function TU(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function LU(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 kU(e){let t=Fe();if(!Se(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 PU(e,t){Ri(e,"next").insert(t)}var uy=!(DE||!_E)&&void 0;function EU(e,t=!1){let n=1;if((function(){if(uy===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"),uy=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return uy})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function AU(e){return e._parentEditor!==null}function MU(e,t){return UE(e,t,null)}function UE(e,t,n){let o=!1;for(let r of py(e))t(r)?n!==null&&n(r):(o=!0,qe(r)&&UE(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function RU(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 py(r))o.push(a);return n}function NU(e){return KE(Ri(e,"next"))}function py(e){return KE(Ri(e,"previous"))}function KE(e){return Jx({hasNext:mP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function _U(e){xP(Fa(e,"next")).splice(1,e.getChildren())}function DU(e){let t=o=>om(o,e),n=(o,r)=>sm(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=my,nre=Ve.$descendantsMatching,ore=Ve.$dfs,rre=Ve.$dfsIterator,are=Ve.$filter,ire=Ve.$findMatchingParent,sre=Ve.$firstToLastIterator,lre=Ve.$getAdjacentCaret,dre=Ve.$getAdjacentSiblingOrParentSiblingCaret,cre=Ve.$getDepth,qE=Ve.$getNearestBlockElementAncestorOrThrow,ure=Ve.$getNearestNodeOfType,fre=Ve.$getNextRightPreorderNode,pre=Ve.$getNextSiblingOrParentSibling,VE=Ve.$handleIndentAndOutdent,mre=Ve.$insertFirst,gre=Ve.$insertNodeToNearestRoot,hre=Ve.$insertNodeToNearestRootAtCaret,vre=Ve.$isEditorIsNestedEditor,xre=Ve.$lastToFirstIterator,yre=Ve.$restoreEditorState,Cre=Ve.$reverseDfs,bre=Ve.$reverseDfsIterator,Ire=Ve.$splitNode,Sre=Ve.$unwrapAndFilterDescendants,wre=Ve.$unwrapNode,Tre=Ve.$wrapNodeInElement,Lre=Ve.CAN_USE_BEFORE_INPUT,kre=Ve.CAN_USE_DOM,Pre=Ve.IS_ANDROID,Ere=Ve.IS_ANDROID_CHROME,Are=Ve.IS_APPLE,Mre=Ve.IS_APPLE_WEBKIT,Rre=Ve.IS_CHROME,Nre=Ve.IS_FIREFOX,_re=Ve.IS_IOS,Dre=Ve.IS_SAFARI,Ore=Ve.addClassNamesToElement,Fre=Ve.calculateZoomLevel,gy=Ve.isBlockDomNode,Bre=Ve.isHTMLAnchorElement,WE=Ve.isHTMLElement,zre=Ve.isInlineDomNode,$re=Ve.isMimeType,Hre=Ve.makeStateWrapper,Ure=Ve.markSelection,Kre=Ve.mediaFileReader,za=Ve.mergeRegister,du=Ve.objectKlassEquals,qre=Ve.positionNodeOnRange,Vre=Ve.registerNestedElementResolver,Wre=Ve.removeClassNamesFromElement,Gre=Ve.selectionAlwaysOnDisplay;var hy={};Mn(hy,{ContentEditable:()=>FU,ContentEditableElement:()=>QE});pe();var jE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function OU({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 jE(()=>(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 QE=qn(OU);function GE(e){return e.getEditorState().read(Lm(e.isComposing()))}var FU=qn(BU);function BU(e,t){let{placeholder:n,...o}=e,[r]=Cn();return b(xe,{children:[u(QE,{editor:r,...o,ref:t}),n!=null&&u(zU,{editor:r,content:n})]})}function zU({content:e,editor:t}){let n=(function(i){let[s,l]=G(()=>GE(i));return jE(()=>{function d(){let c=GE(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 XE=hy,YE=XE.ContentEditable,eae=XE.ContentEditableElement;pe();var $U=Ut(null),vy={didCatch:!1,error:null},Rm=class extends Ki{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=vy}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(vy))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&HU(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(vy))}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($U.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function HU(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var xy={};Mn(xy,{LexicalErrorBoundary:()=>UU});function UU({children:e,onError:t}){return u(Rm,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var KU=xy,JE=KU.LexicalErrorBoundary;var Ny={};Mn(Ny,{$createHorizontalRuleNode:()=>Ry,$isDecoratorTextNode:()=>fA,$isHorizontalRuleNode:()=>xA,AutoFocusExtension:()=>WU,ClearEditorExtension:()=>GU,DecoratorTextExtension:()=>ZU,DecoratorTextNode:()=>fu,EditorStateExtension:()=>Om,HorizontalRuleExtension:()=>c3,HorizontalRuleNode:()=>Bs,INSERT_HORIZONTAL_RULE_COMMAND:()=>l3,InitialStateExtension:()=>hA,LexicalBuilder:()=>rd,NodeSelectionExtension:()=>Py,TabIndentationExtension:()=>u3,applyFormatFromStyle:()=>QU,applyFormatToDom:()=>XU,batch:()=>rA,buildEditorFromExtensions:()=>o3,computed:()=>sA,configExtension:()=>Cm,declarePeerDependency:()=>nE,defineExtension:()=>Nn,effect:()=>_i,getExtensionDependencyFromEditor:()=>a3,getKnownTypesAndNodes:()=>jU,getPeerDependencyFromEditor:()=>vA,getPeerDependencyFromEditorOrThrow:()=>i3,namedSignals:()=>Bm,registerClearEditor:()=>cA,registerTabIndentation:()=>CA,safeCast:()=>Fr,shallowMergeConfig:()=>wm,signal:()=>od,untracked:()=>wy,watchedSignal:()=>Ay});var qU=Symbol.for("preact-signals");function Fm(){if(Ni>1)return void Ni--;let e,t=!1;for(;uu!==void 0;){let n=uu;for(uu=void 0,Ty++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&aA(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Ty=0,Ni--,t)throw e}function rA(e){if(Ni>0)return e();Ni++;try{return e()}finally{Fm()}}var Mt,uu;function wy(e){let t=Mt;Mt=void 0;try{return e()}finally{Mt=t}}var Ni=0,Ty=0,Dm=0;function ZE(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 aA(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 eA(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 Fs(e,t){Po.call(this,void 0),this.x=e,this.s=void 0,this.g=Dm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function sA(e,t){return new Fs(e,t)}function lA(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,Ey(e),o}finally{Mt=n,Fm()}}}function Ey(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,lA(e)}function VU(e){if(Mt!==this)throw new Error("Out-of-order effect");iA(this),Mt=e,this.f&=-2,8&this.f&&Ey(this),Fm()}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 Bm(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=qU,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:wy(()=>{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&&wy(()=>{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=ZE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Ty>100)throw new Error("Cycle detected");this.v=e,this.i++,Dm++,Ni++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Fm()}}}}),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===Dm))return!0;if(this.g=Dm,this.f|=1,this.i>0&&!aA(this))return this.f&=-2,!0;let e=Mt;try{eA(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,iA(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=ZE(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,lA(this),eA(this),Ni++;let e=Mt;return Mt=this,VU.bind(this,e)},nd.prototype.N=function(){2&this.f||(this.f|=2,this.o=uu,uu=this)},nd.prototype.d=function(){this.f|=8,1&this.f||Ey(this)},nd.prototype.dispose=function(){this.d()};var WU=Nn({build:(e,t,n)=>Bm(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 dA(){let e=Ct(),t=Fe(),n=fr();e.clear(),e.append(n),t!==null&&n.select(),Se(t)&&(t.format=0)}function cA(e,t=dA){return e.registerCommand(lm,n=>(e.update(t),!0),Zt)}var GU=Nn({build:(e,t,n)=>Bm(t),config:Fr({$onClear:dA}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return _i(()=>cA(e,o.value))}});function jU(e){let t=new Set,n=new Set;for(let o of uA(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function uA(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var yy=tE("format",{parse:e=>typeof e=="number"?e:0}),fu=class extends Ba{$config(){return this.config("decorator-text",{extends:Ba,stateConfigs:[{flat:!0,stateConfig:yy}]})}getFormat(){return om(this,yy)}getFormatFlags(t,n){return Zx(this.getFormat(),t,n)}hasFormat(t){let n=YP[t];return(this.getFormat()&n)!==0}setFormat(t){return sm(this,yy,t)}toggleFormat(t){let n=this.getFormat(),o=Zx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function fA(e){return e instanceof fu}function QU(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 XU(e,t,n=JU){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=YU(t,o));return t}function YU(e,t){let n=document.createElement(t);return n.appendChild(e),n}var JU={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},ZU=Nn({name:"@lexical/extension/DecoratorText",nodes:()=>[fu],register:(e,t,n)=>e.registerCommand(_P,o=>{let r=Fe();if(Vx(r)||Se(r))for(let a of r.getNodes())fA(a)&&a.toggleFormat(o);return!1},ed)});function Ay(e,t){let n;return od(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Om=Nn({build:e=>Ay(()=>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 pA(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]=pA(n[r],o[r]);return e}return t}var My=0,Ly=1,mA=2,Cy=3,Nm=4,td=5,by=6,cu=7;function Iy(e){return e.id===My}function gA(e){return e.id===mA}function e3(e){return(function(t){return t.id===Ly})(e)||Dt(305,String(e.id),String(Ly)),Object.assign(e,{id:mA})}var t3=new Set,ky=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:My}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):wm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;gA(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:Cy,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:Nm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Nm&&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:by})})(o),()=>{let a=this.state;a.id!==cu&&Dt(309,String(o.id),String(cu)),this.state=(function(i){return Object.assign(i,{id:td})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==by&&Dt(310,String(n.id),String(by)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:cu})})(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>=Nm})(t)||Dt(313,String(t.id),String(Nm)),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>=Cy})(t)||Dt(314,String(t.id),String(Cy)),{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>=cu})(t)||Dt(316,String(t.id),String(cu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||t3}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}},tA={tag:Or};function n3(){let e=Ct();e.isEmpty()&&e.append(fr())}var hA=Nn({config:Fr({setOptions:tA,updateOptions:tA}),init:({$initialEditorState:e=n3})=>({$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(cP(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:[jP,ym,UP,JP,VP]}),nA=Symbol.for("@lexical/extension/LexicalBuilder");function o3(...e){return rd.fromExtensions(e).buildEditor()}function oA(){}function r3(e){throw e}function _m(e){return Array.isArray(e)?e:[e]}var Sy="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=Sy,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[_m(hA)];for(let o of t)n.push(_m(o));return new e(n)}static maybeFromEditor(t){let n=t[nA];return n&&(n.PACKAGE_VERSION!==Sy&&Dt(292,n.PACKAGE_VERSION,Sy),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(bm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[nA]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=oA;function n(){try{t()}finally{t=oA}}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=_m(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 ky(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=_m(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(gA(a))return;let i=o.extension.name;var s;Iy(a)||Dt(300,i,r||"[unknown]"),Iy(s=a)||Dt(304,String(s.id),String(My)),a=Object.assign(s,{id:Ly}),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=e3(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())Iy(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 uA(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&&pA(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=r3),t}};function a3(e,t){let n=rd.fromEditor(e).getExtensionRep(t);return n===void 0&&Dt(303,t.name),n.getExtensionDependency()}function vA(e,t){let n=rd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function i3(e,t){let n=vA(e,t);return n===void 0&&Dt(291,t),n}var s3=new Set,Py=Nn({build(e,t,n){let o=n.getDependency(Om).output,r=od({watchedNodeKeys:new Map}),a=Ay(()=>{},()=>_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=nm(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||s3).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:[Om],name:"@lexical/extension/NodeSelection"}),l3=eE("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 Ry().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:d3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return su(n,t.theme.hr),n}getTextContent(){return`
|
|
3707
|
-
`}isInline(){return!1}updateDOM(){return!1}};function d3(){return{node:Ry()}}function Ry(){return eP(Bs)}function xA(e){return e instanceof Bs}var c3=Nn({dependencies:[Om,Py],name:"@lexical/extension/HorizontalRule",nodes:()=>[Bs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Py).output,r=od({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ia(e.registerCommand(wP,i=>{if(sE(i.target)){let s=lP(i.target);if(xA(s))return(function(l,d=!1){let c=Fe(),f=l.isSelected(),p=l.getKey(),m;d&&Vx(c)?m=c:(m=tP(),_r(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},ed),e.registerMutationListener(Bs,(i,s)=>{rA(()=>{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?su(d,a):Sm(d,a))}));return ia(...i)}))}});function yA(e){return e.canBeEmpty()}function CA(e,t,n=yA){return ia(e.registerCommand(vm,o=>{let r=Fe();if(!Se(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=qE(c);if(f.canIndent()){let p=f.getKey(),m=Ns();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=hP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?KP:jx:FP;return e.dispatchCommand(a,void 0)},Zt),e.registerCommand(jx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Fe();if(!Se(r))return!1;let a=typeof n=="function"?n:n.peek();return VE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},dm))}var u3=Nn({build:(e,t,n)=>Bm(t),config:Fr({$canIndent:yA,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 CA(e,r,a)})}});var gt=Ny,cae=gt.$createHorizontalRuleNode,uae=gt.$isDecoratorTextNode,fae=gt.$isHorizontalRuleNode,pae=gt.AutoFocusExtension,mae=gt.ClearEditorExtension,gae=gt.DecoratorTextExtension,hae=gt.DecoratorTextNode,vae=gt.EditorStateExtension,xae=gt.HorizontalRuleExtension,yae=gt.HorizontalRuleNode,Cae=gt.INSERT_HORIZONTAL_RULE_COMMAND,bae=gt.InitialStateExtension,bA=gt.LexicalBuilder,Iae=gt.NodeSelectionExtension,Sae=gt.TabIndentationExtension,wae=gt.applyFormatFromStyle,Tae=gt.applyFormatToDom,IA=gt.batch,Lae=gt.buildEditorFromExtensions,kae=gt.computed,Pae=gt.configExtension,Eae=gt.declarePeerDependency,Aae=gt.defineExtension,pu=gt.effect,Mae=gt.getExtensionDependencyFromEditor,Rae=gt.getKnownTypesAndNodes,SA=gt.getPeerDependencyFromEditor,Nae=gt.getPeerDependencyFromEditorOrThrow,zm=gt.namedSignals,_ae=gt.registerClearEditor,Dae=gt.registerTabIndentation,Oae=gt.safeCast,Fae=gt.shallowMergeConfig,Bae=gt.signal,zae=gt.untracked,$ae=gt.watchedSignal;var _y={};Mn(_y,{HistoryExtension:()=>$m,SharedHistoryExtension:()=>m3,createEmptyHistoryState:()=>LA,registerHistory:()=>TA});function f3(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(!(Se(a)&&Se(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||ou(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 p3(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(LP)&&(r=n,a=o,i=s),p.has(fm))return o=0,n=m,2;p.has(TP)&&i&&(n=r,o=a,s=i);let h=f3(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(DP);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!(Se(T)&&Se(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 wA(e){e.undoStack=[],e.redoStack=[],e.current=null}function TA(e,t,n){let o=p3(e,n);return za(e.registerCommand(ZP,()=>((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(ru,!0)),l.length===0&&a.dispatchCommand(au,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:fm})}})(e,t),!0),Zt),e.registerCommand(WP,()=>((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(au,!0));let c=s.pop();s.length===0&&a.dispatchCommand(ru,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:fm})}})(e,t),!0),Zt),e.registerCommand(lm,()=>(wA(t),!1),Zt),e.registerCommand(SP,()=>(wA(t),e.dispatchCommand(ru,!1),e.dispatchCommand(au,!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(ru,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(au,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function LA(){return{current:null,redoStack:[],undoStack:[]}}var $m=Nn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>zm({delay:t,disabled:o,historyState:n(e)}),config:Fr({createInitialHistoryState:LA,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return pu(()=>o.disabled.value?void 0:TA(e,o.historyState.value,o.delay))}}),m3=Nn({dependencies:[Cm($m,{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($m),r=(function(i){return i?SA(i,$m.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return pu(()=>IA(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Hm=_y,Vae=Hm.HistoryExtension,Wae=Hm.SharedHistoryExtension,Um=Hm.createEmptyHistoryState,kA=Hm.registerHistory;var Dy={};Mn(Dy,{HistoryPlugin:()=>g3,createEmptyHistoryState:()=>Um});pe();function g3({delay:e,externalHistoryState:t}){let[n]=Cn();return(function(o,r,a=1e3){let i=H(()=>r||Um(),[r]);q(()=>kA(o,i,a),[a,o,i])})(n,t,e),null}var PA=Dy,EA=PA.HistoryPlugin,AA=PA.createEmptyHistoryState;var Oy={};Mn(Oy,{OnChangePlugin:()=>v3});pe();var h3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function v3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Cn();return h3(()=>{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 x3=Oy,MA=x3.OnChangePlugin;var Fy={};Mn(Fy,{useLexicalEditable:()=>b3});pe();var y3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function C3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function b3(){return(function(e){let[t]=Cn(),n=H(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=_(o);return y3(()=>{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})(C3)}var I3=Fy,RA=I3.useLexicalEditable;var By={};Mn(By,{ReactProviderExtension:()=>S3});var S3=Nn({name:"@lexical/react/ReactProvider"});var w3=By,NA=w3.ReactProviderExtension;var zy={};Mn(zy,{DragonExtension:()=>T3,registerDragonSupport:()=>_A});function _A(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(Se(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 T3=Nn({build:(e,t,n)=>zm(t),config:Fr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>pu(()=>n.getOutput().disabled.value?void 0:_A(e))});var DA=zy,OA=DA.DragonExtension,FA=DA.registerDragonSupport;var $y={};Mn($y,{$generateHtmlFromNodes:()=>k3,$generateNodesFromDOM:()=>L3});function L3(e,t){let n=iE(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!zA.has(a.nodeName)){let i=$A(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof Gx&&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 k3(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++)BA(e,o[r],n,t);return n.innerHTML}function BA(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=Am(o,t,"clone"));let s=qe(i)?i.getChildren():[],l=rE(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=BA(e,h,p,o);!r&&qe(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((WE(c)||Yx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(Yx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var zA=new Set(["STYLE","SCRIPT"]);function $A(e,t,n,o,r=new Map,a){let i=[];if(zA.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(...$A(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),gy(e)&&(p=P3(e,p,m?()=>{let h=new Gx;return n.push(h),h}:fr)),s==null?p.length>0?i=i.concat(p):gy(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:lu(h.nextSibling)&&lu(h.previousSibling)})(e)&&(i=i.concat(Rs())):qe(s)&&s.append(...p),i}function P3(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 HA=$y,UA=HA.$generateHtmlFromNodes,KA=HA.$generateNodesFromDOM;var Uy={};Mn(Uy,{$generateJSONFromSelectedNodes:()=>jA,$generateNodesFromSerializedNodes:()=>QA,$getClipboardDataFromSelection:()=>YA,$getHtmlContent:()=>VA,$getLexicalContent:()=>WA,$insertDataTransferForPlainText:()=>E3,$insertDataTransferForRichText:()=>A3,$insertGeneratedNodes:()=>Hy,copyToClipboard:()=>M3,setLexicalClipboardDataTransfer:()=>JA});function Km(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 VA(e,t=Fe()){return t==null&&Km(166),Se(t)&&t.isCollapsed()||t.getNodes().length===0?"":UA(e,t)}function WA(e,t=Fe()){return t==null&&Km(166),Se(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(jA(e,t))}function E3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function A3(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 Hy(n,QA(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 Hy(n,KA(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Se(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(Se(d)){let c=s[l];c===`
|
|
3709
|
+
`);let l=s.length;if(!tt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||tu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=rm(d);return tt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=Zc(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=Mr(c);o.replace(g),h=g}if(we(m)&&m.isCollapsed()){let g=m.anchor.offset;h.select(g,g)}}else if(o.isSimpleText()){let m=t.key===d,h=t.offset;h<r&&(h=l);let g=m?h-r:0,v=m?h:f;if(m&&g===0){let[x]=o.splitText(g,v);x.remove()}else{let[,x]=o.splitText(g,v);x.remove()}}else{let m=Mr(p);o.replace(m)}r=0}}}function YH(e){let t=e.getStyle(),n=CA(t);Em.set(t,n)}function Am(e,t){(we(e)?e.isCollapsed():tt(e)||Ke(e))||iy(280);let n=Mm(we(e)?e.style:tt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[i,s])=>(typeof s=="function"?a[i]=s(n[i],e):s===null?delete a[i]:a[i]=s,a),{...n}),r=bA(o);we(e)||tt(e)?e.setStyle(r):e.setTextStyle(r),Em.set(r,o)}function JH(e,t){if(we(e)&&e.isCollapsed()){Am(e,t);let o=e.anchor.getNode();Ke(o)&&o.isEmpty()&&Am(o,t)}SA(o=>{Am(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!Ke(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Am(r,t))}}}function SA(e){let t=Oe();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(we(t))for(let a of tP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!tt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(jx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}we(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&wA(t)}function wA(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function TA(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function ZH(e,t,n=TA){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=Rs(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=_a(i.getNode(),ru),d=_a(s.getNode(),ru);Ke(l)&&r.set(l.getKey(),l),Ke(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(Ke(i)&&ru(i))r.set(i.getKey(),i);else if(o===null){let s=_a(i,ru);Ke(s)&&r.set(s.getKey(),s)}for(let[i,s]of r){let l=t();n(s,l),s.replace(l,!0),a&&(i===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),i===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Oe())&&Rr(a)}function yA(e){return e.getNode().isAttached()}function eU(e){let t=e;for(;t!==null&&!_s(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function tU(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),i=a.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),c=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),c.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let s=null,l=[];for(let d=0;d<i;d++){let c=a[d];_s(c)?(ay(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&fP(c,s)?l.push(c):(ay(e,l,l.length,t,n),l=[c])}ay(e,l,l.length,t,n)}function ay(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=Ke(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,d=!0;break}if(l=l.getParentOrThrow(),_s(l))break}let c=new Set;for(let h=0;h<n;h++){let g=t[h];Ke(g)&&g.getChildrenSize()===0&&c.add(g.getKey())}let f=new Set;for(let h=0;h<n;h++){let g=t[h],v=g.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&gP(g)&&!f.has(g.getKey())){let x=v.getKey();if(i.get(x)===void 0){let y=o();y.setFormat(v.getFormatType()),y.setIndent(v.getIndent()),s.push(y),i.set(x,y),v.getChildren().forEach(C=>{y.append(C),f.add(C.getKey()),Ke(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),eU(v)}}else if(c.has(g.getKey())){Ke(g)||iy(179);let x=o();x.setFormat(g.getFormatType()),x.setIndent(g.getIndent()),s.push(x),g.remove(!0)}}if(r!==null)for(let h=0;h<s.length;h++){let g=s[h];r.append(g)}let p=null;if(_s(l))if(d)if(r!==null)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g)}else{let h=l.getFirstChild();if(Ke(h)&&(l=h),h===null)if(r)l.append(r);else for(let g=0;g<s.length;g++){let v=s[g];l.append(v),p=v}else if(r!==null)h.insertBefore(r);else for(let g=0;g<s.length;g++){let v=s[g];h.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g),p=g}let m=Zc();we(m)&&yA(m.anchor)&&yA(m.focus)?Rr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function LA(e){let t=kA(e);return t!==null&&t.writingMode==="vertical-rl"}function kA(e){let t=e.anchor.getNode();return Ke(t)?sy(t):ly(t)}function nU(e,t){let n=LA(e)?!t:t;dy(e)&&(n=!n);let o=jl(e.focus,n?"previous":"next");if(mP(o))return!1;for(let r of sP(o)){if(eu(r))return!r.origin.isInline();if(!Ke(r.origin)){if(im(r.origin))return!0;break}}return!1}function PA(e,t,n,o){e.modify(t?"extend":"move",n,o)}function dy(e){let t=kA(e);return t!==null&&t.direction==="rtl"}function oU(e,t,n){let o=dy(e),r;r=LA(e)||o?!n:n,PA(e,t,r,"character")}function rU(e,t,n){let o=Mm(e.getStyle());return o!==null&&o[t]||n}function aU(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,i=e.focus,s=e.isBackward(),l=s?i.offset:a.offset,d=s?i.getNode():a.getNode();if(we(e)&&e.isCollapsed()&&e.style!==""){let c=Mm(e.style);if(c!==null&&t in c)return c[t]}for(let c=0;c<r.length;c++){let f=r[c];if((c===0||l!==0||!f.is(d))&&tt(f)){let p=rU(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var iU=IA;var an=cy,AA=an.$addNodeStyle,qoe=an.$cloneWithProperties,Voe=an.$copyBlockFormatIndent,Woe=an.$ensureForwardRangeSelection,Goe=an.$forEachSelectedTextNode,joe=an.$getComputedStyleForElement,Qoe=an.$getComputedStyleForParent,Xoe=an.$getSelectionStyleValueForProperty,Yoe=an.$isAtNodeEnd,Joe=an.$isParentElementRTL,Zoe=an.$isParentRTL,ere=an.$moveCaretSelection,uy=an.$moveCharacter,tre=an.$patchStyleText,nre=an.$selectAll,ore=an.$setBlocksType,fy=an.$shouldOverrideDefaultCharacterSelection,Rm=an.$sliceSelectedTextNodeContent,rre=an.$trimTextContentFromAnchor,are=an.$wrapNodes,ire=an.createDOMRange,EA=an.createRectsFromDOMRange,sre=an.getCSSFromStyleObject,lre=an.getStyleObjectFromCSS,dre=an.trimTextContentFromAnchor;var hy={};An(hy,{$descendantsMatching:()=>KU,$dfs:()=>TU,$dfsIterator:()=>$A,$filter:()=>FU,$findMatchingParent:()=>_a,$firstToLastIterator:()=>qU,$getAdjacentCaret:()=>LU,$getAdjacentSiblingOrParentSiblingCaret:()=>Ns,$getDepth:()=>UA,$getNearestBlockElementAncestorOrThrow:()=>MU,$getNearestNodeOfType:()=>EU,$getNextRightPreorderNode:()=>AU,$getNextSiblingOrParentSibling:()=>PU,$handleIndentAndOutdent:()=>BU,$insertFirst:()=>zU,$insertNodeToNearestRoot:()=>_U,$insertNodeToNearestRootAtCaret:()=>qA,$isEditorIsNestedEditor:()=>HU,$lastToFirstIterator:()=>gy,$restoreEditorState:()=>NU,$reverseDfs:()=>kU,$reverseDfsIterator:()=>KA,$splitNode:()=>wP,$unwrapAndFilterDescendants:()=>UU,$unwrapNode:()=>VU,$wrapNodeInElement:()=>DU,CAN_USE_BEFORE_INPUT:()=>hU,CAN_USE_DOM:()=>FA,IS_ANDROID:()=>vU,IS_ANDROID_CHROME:()=>xU,IS_APPLE:()=>yU,IS_APPLE_WEBKIT:()=>CU,IS_CHROME:()=>bU,IS_FIREFOX:()=>BA,IS_IOS:()=>IU,IS_SAFARI:()=>SU,addClassNamesToElement:()=>au,calculateZoomLevel:()=>$U,isBlockDomNode:()=>lA,isHTMLAnchorElement:()=>uA,isHTMLElement:()=>wm,isInlineDomNode:()=>iu,isMimeType:()=>zA,makeStateWrapper:()=>WU,markSelection:()=>OA,mediaFileReader:()=>wU,mergeRegister:()=>ra,objectKlassEquals:()=>OU,positionNodeOnRange:()=>DA,registerNestedElementResolver:()=>RU,removeClassNamesFromElement:()=>Tm,selectionAlwaysOnDisplay:()=>gU});function Nm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,sU=Or&&"documentMode"in document?document.documentMode:null,NA=Or&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),lU=Or&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),dU=!(!Or||!("InputEvent"in window)||sU)&&"getTargetRanges"in new window.InputEvent("input"),cU=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),uU=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_A=Or&&/Android/.test(navigator.userAgent),my=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),fU=Or&&_A&&my,pU=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&NA&&!my;function aa(e){return`${e}px`}var mU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function DA(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Nm(182),r===null&&Nm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=EA(e,t);var h,g;s.isConnected||(g=s,(h=r).insertBefore(g,h.firstChild));let v=!1;for(let x=0;x<m.length;x++){let y=m[x],C=i[x]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let k=aa(y.left-f);w.left!==k&&(w.left=k,v=!0);let S=aa(y.top-p);w.top!==S&&(C.style.top=S,v=!0);let L=aa(y.width);w.width!==L&&(C.style.width=L,v=!0);let I=aa(y.height);w.height!==I&&(C.style.height=I,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[x]=C}for(;i.length>m.length;)i.pop();v&&n(i)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,s.remove();for(let f of i)f.remove();i=[]}s.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!wm(m))return d();d(),o=p,r=m,a=new MutationObserver(h=>{let g=e.getRootElement(),v=g&&g.parentElement;if(g!==o||v!==r)return f();for(let x of h)if(!s.contains(x.target))return l()}),a.observe(m,mU),l()});return()=>{c(),d()}}function MA(e,t,n){if(e.type!=="text"&&Ke(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[iA(n)||n,e.offset]}function OA(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=Oe();if(!we(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let T=I.getStartEndPoints();return I.isBackward()?[T[1],T[0]]:T})(f),h=p.getNode(),g=h.getKey(),v=p.offset,x=m.getNode(),y=x.getKey(),C=m.offset,w=e.getElementByKey(g),k=e.getElementByKey(y),S=n===null||w!==o||v!==r||g!==n.getKey(),L=a===null||k!==i||C!==s||y!==a.getKey();if((S||L)&&w!==null&&k!==null){let I=(function(T,E,A,N,R,$,H){let K=(T._window?T._window.document:document).createRange();return K.setStart(...MA(E,A,N)),K.setEnd(...MA(R,$,H)),K})(e,p,h,w,m,x,k);l(),l=DA(e,I,T=>{if(t===void 0)for(let E of T){let A=E.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==aa(-1.5)&&(A.marginTop=aa(-1.5)),A.paddingTop!==aa(4)&&(A.paddingTop=aa(4)),A.paddingBottom!==aa(0)&&(A.paddingBottom=aa(0))}else t(T)})}n=h,o=w,r=v,a=x,i=k,s=C})}return d(e.getEditorState()),ra(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function gU(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,i=e.getRootElement();a!==null&&i!==null&&i.contains(a)?n!==null&&(n(),n=null):n===null&&(n=OA(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var hU=dU,FA=Or,vU=_A,xU=fU,yU=NA,CU=pU,bU=my,BA=lU,IU=uU,SU=cU;function zA(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function wU(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],i=()=>{let{done:s,value:l}=n.next();if(s)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let c=d.result;typeof c=="string"&&a.push({file:l,result:c}),i()}),zA(l,t)?d.readAsDataURL(l):i()};i()})}function TU(e,t){return Array.from($A(e,t))}function LU(e){return e?e.getAdjacentCaret():null}function kU(e,t){return Array.from(KA(e,t))}function $A(e,t){return HA("next",e,t)}function RA(e,t){let n=Ns(Da(e,t));return n&&n[0]}function HA(e,t,n){let o=Ct(),r=t||o,a=Ke(r)?ki(r,e):Da(r,e),i=UA(r),s=n?qx(Wx(Da(n,e)))||RA(n,e):RA(r,e),l=i;return ey({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;eu(d)&&l++;let c=Ns(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function PU(e){let t=Ns(Da(e,"next"));return t&&[t[0].origin,t[1]]}function UA(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function AU(e){let t=Wx(Da(e,"previous")),n=Ns(t,"root");return n&&n[0].origin}function KA(e,t){return HA("previous",e,t)}function EU(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function MU(e){let t=_a(e,n=>Ke(n)&&!n.isInline());return Ke(t)||Nm(4,e.__key),t}function RU(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let i=(s=>{let l=s.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=s,c=s;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(i!==null){let{child:s,parent:l}=i;if(s.is(a)){o(l,a);let d=s.getNextSiblings(),c=d.length;if(l.insertAfter(s),c!==0){let f=n(l);s.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function NU(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,nm(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Rr(r===null?null:r.clone())}function _U(e){let t=Oe()||Zc(),n;if(we(t))n=jl(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=Da(s,"next"))}n=n||ki(Ct(),"previous").getFlipped().insert(ur())}let o=qA(e,n),r=qx(o),a=eu(r)?xP(r):o;return IP(cP(a)),e.getLatest()}function qA(e,t,n){let o=Vx(t,"next");for(let r=o;r;r=SP(r,n))o=r;return sm(o)&&Nm(283),o.insert(e.isInline()?ur().append(e):e),Vx(Da(e.getLatest(),"next"),t.direction)}function DU(e,t){let n=t();return e.replace(n),n.append(e),n}function OU(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function FU(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function BU(e){let t=Oe();if(!we(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],i=a.getKey();if(n.has(i))continue;let s=_a(a,d=>Ke(d)&&!d.isInline());if(s===null)continue;let l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function zU(e,t){ki(e,"next").insert(t)}var py=!(BA||!FA)&&void 0;function $U(e,t=!1){let n=1;if((function(){if(py===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),py=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return py})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function HU(e){return e._parentEditor!==null}function UU(e,t){return VA(e,t,null)}function VA(e,t,n){let o=!1;for(let r of gy(e))t(r)?n!==null&&n(r):(o=!0,Ke(r)&&VA(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function KU(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(Ke(r))for(let a of gy(r))o.push(a);return n}function qU(e){return WA(ki(e,"next"))}function gy(e){return WA(ki(e,"previous"))}function WA(e){return ey({hasNext:vP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function VU(e){bP(Da(e,"next")).splice(1,e.getChildren())}function WU(e){let t=o=>am(o,e),n=(o,r)=>dm(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Ve=hy,mre=Ve.$descendantsMatching,gre=Ve.$dfs,hre=Ve.$dfsIterator,vre=Ve.$filter,xre=Ve.$findMatchingParent,yre=Ve.$firstToLastIterator,Cre=Ve.$getAdjacentCaret,bre=Ve.$getAdjacentSiblingOrParentSiblingCaret,Ire=Ve.$getDepth,GA=Ve.$getNearestBlockElementAncestorOrThrow,Sre=Ve.$getNearestNodeOfType,wre=Ve.$getNextRightPreorderNode,Tre=Ve.$getNextSiblingOrParentSibling,jA=Ve.$handleIndentAndOutdent,Lre=Ve.$insertFirst,kre=Ve.$insertNodeToNearestRoot,Pre=Ve.$insertNodeToNearestRootAtCaret,Are=Ve.$isEditorIsNestedEditor,Ere=Ve.$lastToFirstIterator,Mre=Ve.$restoreEditorState,Rre=Ve.$reverseDfs,Nre=Ve.$reverseDfsIterator,_re=Ve.$splitNode,Dre=Ve.$unwrapAndFilterDescendants,Ore=Ve.$unwrapNode,Fre=Ve.$wrapNodeInElement,Bre=Ve.CAN_USE_BEFORE_INPUT,zre=Ve.CAN_USE_DOM,$re=Ve.IS_ANDROID,Hre=Ve.IS_ANDROID_CHROME,Ure=Ve.IS_APPLE,Kre=Ve.IS_APPLE_WEBKIT,qre=Ve.IS_CHROME,Vre=Ve.IS_FIREFOX,Wre=Ve.IS_IOS,Gre=Ve.IS_SAFARI,jre=Ve.addClassNamesToElement,Qre=Ve.calculateZoomLevel,vy=Ve.isBlockDomNode,Xre=Ve.isHTMLAnchorElement,QA=Ve.isHTMLElement,Yre=Ve.isInlineDomNode,Jre=Ve.isMimeType,Zre=Ve.makeStateWrapper,eae=Ve.markSelection,tae=Ve.mediaFileReader,Fa=Ve.mergeRegister,su=Ve.objectKlassEquals,nae=Ve.positionNodeOnRange,oae=Ve.registerNestedElementResolver,rae=Ve.removeClassNamesFromElement,aae=Ve.selectionAlwaysOnDisplay;var xy={};An(xy,{ContentEditable:()=>jU,ContentEditableElement:()=>JA});me();var YA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function GU({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:i,ariaInvalid:s,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:h,id:g,role:v="textbox",spellCheck:x=!0,style:y,tabIndex:C,"data-testid":w,...k},S){let[L,I]=G(e.isEditable()),T=B(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),E=z(()=>(function(...A){return N=>{for(let R of A)typeof R=="function"?R(N):R!=null&&(R.current=N)}})(S,T),[T,S]);return YA(()=>(I(e.isEditable()),e.registerEditableListener(A=>{I(A)})),[e]),u("div",{"aria-activedescendant":L?t:void 0,"aria-autocomplete":L?n:"none","aria-controls":L?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":L&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":L?f:void 0,"aria-readonly":!L||void 0,"aria-required":p,autoCapitalize:m,className:h,contentEditable:L,"data-testid":w,id:g,ref:E,role:v,spellCheck:x,style:y,tabIndex:C,...k})}var JA=Wn(GU);function XA(e){return e.getEditorState().read(Pm(e.isComposing()))}var jU=Wn(QU);function QU(e,t){let{placeholder:n,...o}=e,[r]=In();return b(be,{children:[u(JA,{editor:r,...o,ref:t}),n!=null&&u(XU,{editor:r,content:n})]})}function XU({content:e,editor:t}){let n=(function(i){let[s,l]=G(()=>XA(i));return YA(()=>{function d(){let c=XA(i);l(c)}return d(),Fa(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=G(t.isEditable());if(ye(()=>(r(t.isEditable()),t.registerEditableListener(i=>{r(i)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:u("div",{"aria-hidden":!0,children:a})}var ZA=xy,eE=ZA.ContentEditable,fae=ZA.ContentEditableElement;me();var YU=Ht(null),yy={didCatch:!1,error:null},_m=class extends Ui{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=yy}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(yy))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&JU(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(yy))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:i}=this.state,s=t;if(a){let l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")s=n(l);else if(o)s=Te(o,l);else if(r!==void 0)s=r;else throw i}return Te(YU.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function JU(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Cy={};An(Cy,{LexicalErrorBoundary:()=>ZU});function ZU({children:e,onError:t}){return u(_m,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var e3=Cy,tE=e3.LexicalErrorBoundary;var Dy={};An(Dy,{$createHorizontalRuleNode:()=>_y,$isDecoratorTextNode:()=>gE,$isHorizontalRuleNode:()=>bE,AutoFocusExtension:()=>o3,ClearEditorExtension:()=>r3,DecoratorTextExtension:()=>c3,DecoratorTextNode:()=>cu,EditorStateExtension:()=>Bm,HorizontalRuleExtension:()=>b3,HorizontalRuleNode:()=>Fs,INSERT_HORIZONTAL_RULE_COMMAND:()=>y3,InitialStateExtension:()=>yE,LexicalBuilder:()=>td,NodeSelectionExtension:()=>Ey,TabIndentationExtension:()=>I3,applyFormatFromStyle:()=>i3,applyFormatToDom:()=>s3,batch:()=>sE,buildEditorFromExtensions:()=>m3,computed:()=>cE,configExtension:()=>Im,declarePeerDependency:()=>aA,defineExtension:()=>Mn,effect:()=>Ai,getExtensionDependencyFromEditor:()=>h3,getKnownTypesAndNodes:()=>a3,getPeerDependencyFromEditor:()=>CE,getPeerDependencyFromEditorOrThrow:()=>v3,namedSignals:()=>$m,registerClearEditor:()=>pE,registerTabIndentation:()=>SE,safeCast:()=>Dr,shallowMergeConfig:()=>Lm,signal:()=>ed,untracked:()=>Ly,watchedSignal:()=>Ry});var t3=Symbol.for("preact-signals");function zm(){if(Pi>1)return void Pi--;let e,t=!1;for(;du!==void 0;){let n=du;for(du=void 0,ky++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&lE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(ky=0,Pi--,t)throw e}function sE(e){if(Pi>0)return e();Pi++;try{return e()}finally{zm()}}var At,du;function Ly(e){let t=At;At=void 0;try{return e()}finally{At=t}}var Pi=0,ky=0,Fm=0;function nE(e){if(At===void 0)return;let t=e.n;return t===void 0||t.t!==At?(t={i:0,S:e,p:At.s,n:void 0,t:At,e:void 0,x:void 0,r:t},At.s!==void 0&&(At.s.n=t),At.s=t,e.n=t,32&At.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=At.s,t.n=void 0,At.s.n=t,At.s=t),t):void 0}function Po(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function ed(e,t){return new Po(e,t)}function lE(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function oE(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function dE(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Os(e,t){Po.call(this,void 0),this.x=e,this.s=void 0,this.g=Fm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function cE(e,t){return new Os(e,t)}function uE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Pi++;let n=At;At=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,My(e),o}finally{At=n,zm()}}}function My(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,uE(e)}function n3(e){if(At!==this)throw new Error("Out-of-order effect");dE(this),At=e,this.f&=-2,8&this.f&&My(this),zm()}function Zl(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}function Ai(e,t){let n=new Zl(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function $m(e,t={}){let n={};for(let o in e){let r=t[o],a=ed(r===void 0?e[o]:r);n[o]=a}return n}Po.prototype.brand=t3,Po.prototype.h=function(){return!0},Po.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:Ly(()=>{var n;(n=this.W)==null||n.call(this)}))},Po.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Ly(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Po.prototype.subscribe=function(e){return Ai(()=>{let t=this.value,n=At;At=void 0;try{e(t)}finally{At=n}},{name:"sub"})},Po.prototype.valueOf=function(){return this.value},Po.prototype.toString=function(){return this.value+""},Po.prototype.toJSON=function(){return this.value},Po.prototype.peek=function(){let e=At;At=void 0;try{return this.value}finally{At=e}},Object.defineProperty(Po.prototype,"value",{get(){let e=nE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(ky>100)throw new Error("Cycle detected");this.v=e,this.i++,Fm++,Pi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{zm()}}}}),Os.prototype=new Po,Os.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Fm))return!0;if(this.g=Fm,this.f|=1,this.i>0&&!lE(this))return this.f&=-2,!0;let e=At;try{oE(this),At=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return At=e,dE(this),this.f&=-2,!0},Os.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Po.prototype.S.call(this,e)},Os.prototype.U=function(e){if(this.t!==void 0&&(Po.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Os.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Os.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=nE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Zl.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},Zl.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,uE(this),oE(this),Pi++;let e=At;return At=this,n3.bind(this,e)},Zl.prototype.N=function(){2&this.f||(this.f|=2,this.o=du,du=this)},Zl.prototype.d=function(){this.f|=8,1&this.f||My(this)},Zl.prototype.dispose=function(){this.d()};var o3=Mn({build:(e,t,n)=>$m(t),config:Dr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Ai(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function fE(){let e=Ct(),t=Oe(),n=ur();e.clear(),e.append(n),t!==null&&n.select(),we(t)&&(t.format=0)}function pE(e,t=fE){return e.registerCommand(cm,n=>(e.update(t),!0),Xt)}var r3=Mn({build:(e,t,n)=>$m(t),config:Dr({$onClear:fE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Ai(()=>pE(e,o.value))}});function a3(e){let t=new Set,n=new Set;for(let o of mE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function mE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var by=rA("format",{parse:e=>typeof e=="number"?e:0}),cu=class extends Oa{$config(){return this.config("decorator-text",{extends:Oa,stateConfigs:[{flat:!0,stateConfig:by}]})}getFormat(){return am(this,by)}getFormatFlags(t,n){return ty(this.getFormat(),t,n)}hasFormat(t){let n=eA[t];return(this.getFormat()&n)!==0}setFormat(t){return dm(this,by,t)}toggleFormat(t){let n=this.getFormat(),o=ty(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function gE(e){return e instanceof cu}function i3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function s3(e,t,n=d3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=l3(t,o));return t}function l3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var d3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},c3=Mn({name:"@lexical/extension/DecoratorText",nodes:()=>[cu],register:(e,t,n)=>e.registerCommand(FP,o=>{let r=Oe();if(Gx(r)||we(r))for(let a of r.getNodes())gE(a)&&a.toggleFormat(o);return!1},Yl)});function Ry(e,t){let n;return ed(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Bm=Mn({build:e=>Ry(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Ft(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function hE(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=hE(n[r],o[r]);return e}return t}var Ny=0,Py=1,vE=2,Iy=3,Dm=4,Jl=5,Sy=6,lu=7;function wy(e){return e.id===Ny}function xE(e){return e.id===vE}function u3(e){return(function(t){return t.id===Py})(e)||Ft(305,String(e.id),String(Py)),Object.assign(e,{id:vE})}var f3=new Set,Ay=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Ny}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Lm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;xE(n)||Ft(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(s,l,d){return Object.assign(s,{config:l,id:Iy,registerState:d})})(n,this.mergeConfigs(),o),i;this.state=a,this.extension.init&&(i=this.extension.init(t,a.config,o)),this.state=(function(s,l,d){return Object.assign(s,{id:Dm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Dm&&Ft(307,String(n.id),String(Jl)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,i,s){return Object.assign(a,{id:Jl,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Jl&&Ft(308,String(o.id),String(Jl));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Sy})})(o),()=>{let a=this.state;a.id!==lu&&Ft(309,String(o.id),String(lu)),this.state=(function(i){return Object.assign(i,{id:Jl})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Sy&&Ft(310,String(n.id),String(Sy)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:lu})})(n),o}getSignal(){return this._signal===void 0&&Ft(311),this._signal}getInitResult(){this.extension.init===void 0&&Ft(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Dm})(t)||Ft(313,String(t.id),String(Dm)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Iy})(t)||Ft(314,String(t.id),String(Iy)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=lu})(t)||Ft(316,String(t.id),String(lu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||f3}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=Jl})(t)||Ft(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},rE={tag:_r};function p3(){let e=Ct();e.isEmpty()&&e.append(ur())}var yE=Mn({config:Dr({setOptions:rE,updateOptions:rE}),init:({$initialEditorState:e=p3})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(pP(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let i=e.parseEditorState(a);e.setEditorState(i,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[YP,bm,VP,tA,jP]}),aE=Symbol.for("@lexical/extension/LexicalBuilder");function m3(...e){return td.fromExtensions(e).buildEditor()}function iE(){}function g3(e){throw e}function Om(e){return Array.isArray(e)?e:[e]}var Ty="0.41.0+prod.esm",td=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Ty,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Om(yE)];for(let o of t)n.push(Om(o));return new e(n)}static maybeFromEditor(t){let n=t[aE];return n&&(n.PACKAGE_VERSION!==Ty&&Ft(292,n.PACKAGE_VERSION,Ty),n instanceof e||Ft(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ft(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Sm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[aE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=iE;function n(){try{t()}finally{t=iE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ra(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Ft(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Ft(296);let n=Om(t),[o]=n;typeof o.name!="string"&&Ft(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Ft(298,o.name),!r){r=new Ay(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Ft(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Ft(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Om(i);this.addEdge(o.name,s[0].name,s.slice(1)),this.addExtension(s)}for(let[i,s]of o.peerDependencies||[])this.addEdge(o.name,i,s?[s]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(xE(a))return;let i=o.extension.name;var s;wy(a)||Ft(300,i,r||"[unknown]"),wy(s=a)||Ft(304,String(s.id),String(Ny)),a=Object.assign(s,{id:Py}),o.state=a;let l=this.outgoingConfigEdges.get(i);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,i)}a=u3(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())wy(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let i=this.extensionNameMap.get(r);if(i)for(let s of a)i.configs.add(s)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Ft(301,o.name);for(let i of r)a.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let i of n){let s=i.register(t,a);s&&r.push(s)}for(let i of n){let s=i.afterRegistration(t);s&&r.push(s)}return ra(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},i={},s=this.sortedExtensionReps();for(let c of s){let{extension:f}=c;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of mE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Ft(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,c)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&hE(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let c of s)c.init(t);return t.onError||(t.onError=g3),t}};function h3(e,t){let n=td.fromEditor(e).getExtensionRep(t);return n===void 0&&Ft(303,t.name),n.getExtensionDependency()}function CE(e,t){let n=td.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function v3(e,t){let n=CE(e,t);return n===void 0&&Ft(291,t),n}var x3=new Set,Ey=Mn({build(e,t,n){let o=n.getDependency(Bm).output,r=ed({watchedNodeKeys:new Map}),a=Ry(()=>{},()=>Ai(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(Oe())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=rm(c),m=p&&p.isSelected()||!1;d=d||m!==(!!i&&i.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&i&&l.size===i.size||(a.value=l)}));return{watchNodeKey:function(i){let s=cE(()=>(a.value||x3).has(i)),{watchedNodeKeys:l}=r.peek(),d=l.get(i),c=d!==void 0;return d=d||new Set,d.add(s),c||(l.set(i,d),r.value={watchedNodeKeys:l}),s}}},dependencies:[Bm],name:"@lexical/extension/NodeSelection"}),y3=oA("INSERT_HORIZONTAL_RULE_COMMAND"),Fs=class e extends Oa{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return _y().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:C3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return au(n,t.theme.hr),n}getTextContent(){return`
|
|
3710
|
+
`}isInline(){return!1}updateDOM(){return!1}};function C3(){return{node:_y()}}function _y(){return oP(Fs)}function bE(e){return e instanceof Fs}var b3=Mn({dependencies:[Bm,Ey],name:"@lexical/extension/HorizontalRule",nodes:()=>[Fs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Ey).output,r=ed({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ra(e.registerCommand(kP,i=>{if(cA(i.target)){let s=uP(i.target);if(bE(s))return(function(l,d=!1){let c=Oe(),f=l.isSelected(),p=l.getKey(),m;d&&Gx(c)?m=c:(m=rP(),Rr(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},Yl),e.registerMutationListener(Fs,(i,s)=>{sE(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of i.entries())if(f==="destroyed")d.delete(c),l=!0;else{let p=d.get(c),m=e.getElementByKey(c);p?p.domNode.value=m:(l=!0,d.set(c,{domNode:ed(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Ai(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Ai(()=>{let d=s.value;d&&(l.value?au(d,a):Tm(d,a))}));return ra(...i)}))}});function IE(e){return e.canBeEmpty()}function SE(e,t,n=IE){return ra(e.registerCommand(ym,o=>{let r=Oe();if(!we(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>Ql(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=GA(c);if(f.canIndent()){let p=f.getKey(),m=Rs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=yP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?WP:Xx:$P;return e.dispatchCommand(a,void 0)},Xt),e.registerCommand(Xx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Oe();if(!we(r))return!1;let a=typeof n=="function"?n:n.peek();return jA(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},um))}var I3=Mn({build:(e,t,n)=>$m(t),config:Dr({$canIndent:IE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Ai(()=>{if(!o.value)return SE(e,r,a)})}});var gt=Dy,Iae=gt.$createHorizontalRuleNode,Sae=gt.$isDecoratorTextNode,wae=gt.$isHorizontalRuleNode,Tae=gt.AutoFocusExtension,Lae=gt.ClearEditorExtension,kae=gt.DecoratorTextExtension,Pae=gt.DecoratorTextNode,Aae=gt.EditorStateExtension,Eae=gt.HorizontalRuleExtension,Mae=gt.HorizontalRuleNode,Rae=gt.INSERT_HORIZONTAL_RULE_COMMAND,Nae=gt.InitialStateExtension,wE=gt.LexicalBuilder,_ae=gt.NodeSelectionExtension,Dae=gt.TabIndentationExtension,Oae=gt.applyFormatFromStyle,Fae=gt.applyFormatToDom,TE=gt.batch,Bae=gt.buildEditorFromExtensions,zae=gt.computed,$ae=gt.configExtension,Hae=gt.declarePeerDependency,Uae=gt.defineExtension,uu=gt.effect,Kae=gt.getExtensionDependencyFromEditor,qae=gt.getKnownTypesAndNodes,LE=gt.getPeerDependencyFromEditor,Vae=gt.getPeerDependencyFromEditorOrThrow,Hm=gt.namedSignals,Wae=gt.registerClearEditor,Gae=gt.registerTabIndentation,jae=gt.safeCast,Qae=gt.shallowMergeConfig,Xae=gt.signal,Yae=gt.untracked,Jae=gt.watchedSignal;var Oy={};An(Oy,{HistoryExtension:()=>Um,SharedHistoryExtension:()=>T3,createEmptyHistoryState:()=>AE,registerHistory:()=>PE});function S3(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,i=e._selection;if(r)return 1;if(!(we(a)&&we(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(x,y,C){let w=x._nodeMap,k=[];for(let S of y){let L=w.get(S);L!==void 0&&k.push(L)}for(let[S,L]of C){if(!L)continue;let I=w.get(S);I===void 0||tu(I)||k.push(I)}return k})(t,n,o);if(s.length===0)return 0;if(s.length>1){let x=t._nodeMap,y=x.get(a.anchor.key),C=x.get(i.anchor.key);return y&&C&&!e._nodeMap.has(y.__key)&&tt(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!tt(d)||!tt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=i.anchor;if(p.key!==m.key||p.type!=="text")return 0;let h=p.offset,g=m.offset,v=f.length-c.length;return v===1&&g===h-1?2:v===-1&&g===h+1?3:v===-1&&g===h?4:0}function w3(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,i=null;return(s,l,d,c,f,p)=>{let m=Date.now();if(p.has(AP)&&(r=n,a=o,i=s),p.has(mm))return o=0,n=m,2;p.has(PP)&&i&&(n=r,o=a,s=i);let h=S3(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(BP);if(!x&&v&&p.has(_r))return 0;if(h===1)return 2;if(s===null)return 1;let y=l._selection;if(!(c.size>0||f.size>0))return y!==null?0:2;let C=typeof t=="number"?t:t.peek();return x===!1&&h!==0&&h===o&&m<n+C&&v||c.size===1&&(function(w,k,S){let L=k._nodeMap.get(w),I=S._nodeMap.get(w),T=k._selection,E=S._selection;return!(we(T)&&we(E)&&T.anchor.type==="element"&&T.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!tt(L)||!tt(I)||L.__parent!==I.__parent)&&JSON.stringify(k.read(()=>L.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=h,g}}function kE(e){e.undoStack=[],e.redoStack=[],e.current=null}function PE(e,t,n){let o=w3(e,n);return Fa(e.registerCommand(nA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(l.length!==0){let d=i.current,c=l.pop();d!==null&&(s.push(d),a.dispatchCommand(nu,!0)),l.length===0&&a.dispatchCommand(ou,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:mm})}})(e,t),!0),Xt),e.registerCommand(QP,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(s.length!==0){let d=i.current;d!==null&&(l.push(d),a.dispatchCommand(ou,!0));let c=s.pop();s.length===0&&a.dispatchCommand(nu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:mm})}})(e,t),!0),Xt),e.registerCommand(cm,()=>(kE(t),!1),Xt),e.registerCommand(LP,()=>(kE(t),e.dispatchCommand(nu,!1),e.dispatchCommand(ou,!1),!0),Xt),e.registerUpdateListener(({editorState:a,prevEditorState:i,dirtyLeaves:s,dirtyElements:l,tags:d})=>{let c=t.current,f=t.redoStack,p=t.undoStack,m=c===null?null:c.editorState;if(c!==null&&a===m)return;let h=o(i,a,c,s,l,d);if(h===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(nu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(ou,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function AE(){return{current:null,redoStack:[],undoStack:[]}}var Um=Mn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Hm({delay:t,disabled:o,historyState:n(e)}),config:Dr({createInitialHistoryState:AE,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return uu(()=>o.disabled.value?void 0:PE(e,o.historyState.value,o.delay))}}),T3=Mn({dependencies:[Im(Um,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(Um),r=(function(i){return i?LE(i,Um.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return uu(()=>TE(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Km=Oy,oie=Km.HistoryExtension,rie=Km.SharedHistoryExtension,qm=Km.createEmptyHistoryState,EE=Km.registerHistory;var Fy={};An(Fy,{HistoryPlugin:()=>L3,createEmptyHistoryState:()=>qm});me();function L3({delay:e,externalHistoryState:t}){let[n]=In();return(function(o,r,a=1e3){let i=z(()=>r||qm(),[r]);q(()=>EE(o,i,a),[a,o,i])})(n,t,e),null}var ME=Fy,RE=ME.HistoryPlugin,NE=ME.createEmptyHistoryState;var By={};An(By,{OnChangePlugin:()=>P3});me();var k3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function P3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=In();return k3(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:i,prevEditorState:s,tags:l})=>{t&&a.size===0&&i.size===0||e&&l.has(_r)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var A3=By,_E=A3.OnChangePlugin;var zy={};An(zy,{useLexicalEditable:()=>R3});me();var E3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function M3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function R3(){return(function(e){let[t]=In(),n=z(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=_(o);return E3(()=>{let{initialValueFn:i,subscribe:s}=n,l=i();return a.current!==l&&(a.current=l,r(l)),s(d=>{a.current=d,r(d)})},[n,e]),o})(M3)}var N3=zy,DE=N3.useLexicalEditable;var $y={};An($y,{ReactProviderExtension:()=>_3});var _3=Mn({name:"@lexical/react/ReactProvider"});var D3=$y,OE=D3.ReactProviderExtension;var Hy={};An(Hy,{DragonExtension:()=>O3,registerDragonSupport:()=>FE});function FE(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let i;try{i=JSON.parse(a)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){let s=i.payload;if(s&&s.functionId==="makeChanges"){let l=s.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let h=Oe();if(we(h)){let g=h.anchor,v=g.getNode(),x=0,y=0;if(tt(v)&&d>=0&&c>=0&&(x=d,y=d+c,h.setTextNodeRange(v,x,v,y)),x===y&&f===""||(h.insertRawText(f),v=g.getNode()),tt(v)){x=p,y=p+m;let C=v.getTextContentSize();x=x>C?C:x,y=y>C?C:y,h.setTextNodeRange(v,x,v,y)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var O3=Mn({build:(e,t,n)=>Hm(t),config:Dr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>uu(()=>n.getOutput().disabled.value?void 0:FE(e))});var BE=Hy,zE=BE.DragonExtension,$E=BE.registerDragonSupport;var Uy={};An(Uy,{$generateHtmlFromNodes:()=>B3,$generateNodesFromDOM:()=>F3});function F3(e,t){let n=dA(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!UE.has(a.nodeName)){let i=KE(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof Qx&&i.insertAfter(Ms());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function B3(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Ct().getChildren();for(let r=0;r<o.length;r++)HE(e,o[r],n,t);return n.innerHTML}function HE(e,t,n,o=null){let r=o===null||t.isSelected(o),a=Ke(t)&&t.excludeFromCopy("html"),i=t;o!==null&&tt(t)&&(i=Rm(o,t,"clone"));let s=Ke(i)?i.getChildren():[],l=sA(e,i.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,i):i.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<s.length;m++){let h=s[m],g=HE(e,h,p,o);!r&&Ke(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((QA(c)||Zx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(Zx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var UE=new Set(["STYLE","SCRIPT"]);function KE(e,t,n,o,r=new Map,a){let i=[];if(UE.has(e.nodeName))return i;let s=null,l=(function(h,g){let{nodeName:v}=h,x=g._htmlConversions.get(v.toLowerCase()),y=null;if(x!==void 0)for(let C of x){let w=C(h);w!==null&&(y===null||(y.priority||0)<=(w.priority||0))&&(y=w)}return y!==null?y.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let h=d.node;if(s=Array.isArray(h)?h[h.length-1]:h,s!==null){for(let[,g]of r)if(s=g(s,a),!s)break;s&&i.push(...Array.isArray(h)?h:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!_s(s))&&(s!=null&&Ql(s)||o);for(let h=0;h<f.length;h++)p.push(...KE(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),vy(e)&&(p=z3(e,p,m?()=>{let h=new Qx;return n.push(h),h}:ur)),s==null?p.length>0?i=i.concat(p):vy(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:iu(h.nextSibling)&&iu(h.previousSibling)})(e)&&(i=i.concat(Ms())):Ke(s)&&s.append(...p),i}function z3(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(Ql(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&Ql(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var qE=Uy,VE=qE.$generateHtmlFromNodes,WE=qE.$generateNodesFromDOM;var qy={};An(qy,{$generateJSONFromSelectedNodes:()=>YE,$generateNodesFromSerializedNodes:()=>JE,$getClipboardDataFromSelection:()=>eM,$getHtmlContent:()=>jE,$getLexicalContent:()=>QE,$insertDataTransferForPlainText:()=>$3,$insertDataTransferForRichText:()=>H3,$insertGeneratedNodes:()=>Ky,copyToClipboard:()=>U3,setLexicalClipboardDataTransfer:()=>tM});function Vm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jE(e,t=Oe()){return t==null&&Vm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?"":VE(e,t)}function QE(e,t=Oe()){return t==null&&Vm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(YE(e,t))}function $3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function H3(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let s=JSON.parse(o);if(s.namespace===n._config.namespace&&Array.isArray(s.nodes))return Ky(n,JE(s.nodes),t)}catch(s){console.error(s)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let s=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return Ky(n,WE(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(we(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=Oe();if(we(d)){let c=s[l];c===`
|
|
3708
3711
|
`||c===`\r
|
|
3709
|
-
`?d.insertParagraph():c===" "?d.insertNodes([oP()]):d.insertText(c)}}}else t.insertRawText(i)}function Hy(e,t,n){e.dispatchCommand(QP,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Se(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=Yl(r,"previous");if(i)if(am(i))a=i.origin;else{let s=aP(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 GA(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=qe(n)&&n.excludeFromCopy("html"),i=n;t!==null&&ot(i)&&(i=Am(t,i,"clone"));let s=qe(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Km(58,f.name),qe(d)){let p=c.children;Array.isArray(p)||Km(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=GA(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 jA(e,t){let n=[],o=Ct().getChildren();for(let r=0;r<o.length;r++)GA(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function QA(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=vP(o);ot(r)&&LE(r),t.push(r)}return t}var ad=null;async function M3(e,t,n){if(ad!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(qA(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=Xx(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(cm,p=>(du(p,ClipboardEvent)&&(f(),ad!==null&&(r.clearTimeout(ad),ad=null),d(qA(e,p,n))),!0),dm);ad=r.setTimeout(()=>{f(),ad=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function qA(e,t,n){if(n===void 0){let r=Xx(e._window),a=Fe();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!dE(e,i,s))return!1;n=YA(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(JA(o,n),!0)}var XA=[["text/html",VA],["application/x-lexical-editor",WA]];function YA(e=Fe()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=tm();for(let[o,r]of XA){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function JA(e,t){for(let[n]of XA)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=Uy,yie=la.$generateJSONFromSelectedNodes,Cie=la.$generateNodesFromSerializedNodes,bie=la.$getClipboardDataFromSelection,ZA=la.$getHtmlContent,Iie=la.$getLexicalContent,Ky=la.$insertDataTransferForPlainText,Sie=la.$insertDataTransferForRichText,wie=la.$insertGeneratedNodes,Tie=la.copyToClipboard,Lie=la.setLexicalClipboardDataTransfer;var qy={};Mn(qy,{PlainTextExtension:()=>B3,registerPlainText:()=>nM});var zs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,R3=zs&&"documentMode"in document?document.documentMode:null,N3=zs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),_3=!(!zs||!("InputEvent"in window)||R3)&&"getTargetRanges"in new window.InputEvent("input"),D3=zs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),eM=zs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,O3=zs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),F3=zs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&N3&&!O3;function tM(e,t){t.update(()=>{if(e!==null){let n=du(e,KeyboardEvent)?null:e.clipboardData,o=Fe();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=ZA(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function nM(e){return za(e.registerCommand(um,t=>{let n=Fe();return!!Se(n)&&(n.deleteCharacter(t),!0)},Zt),e.registerCommand(AP,t=>{let n=Fe();return!!Se(n)&&(n.deleteWord(t),!0)},Zt),e.registerCommand(EP,t=>{let n=Fe();return!!Se(n)&&(n.deleteLine(t),!0)},Zt),e.registerCommand(kP,t=>{let n=Fe();if(!Se(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Ky(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Zt),e.registerCommand(GP,()=>{let t=Fe();return!!Se(t)&&(t.removeText(),!0)},Zt),e.registerCommand(Qx,t=>{let n=Fe();return!!Se(n)&&(n.insertLineBreak(t),!0)},Zt),e.registerCommand(OP,()=>{let t=Fe();return!!Se(t)&&(t.insertLineBreak(),!0)},Zt),e.registerCommand(pm,t=>{let n=Fe();if(!Se(n))return!1;let o=t,r=o.shiftKey;return!!cy(n,!0)&&(o.preventDefault(),dy(n,r,!0),!0)},Zt),e.registerCommand(mm,t=>{let n=Fe();if(!Se(n))return!1;let o=t,r=o.shiftKey;return!!cy(n,!1)&&(o.preventDefault(),dy(n,r,!1),!0)},Zt),e.registerCommand(gm,t=>{let n=Fe();return!!Se(n)&&(!eM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(um,!0))},Zt),e.registerCommand($P,t=>{let n=Fe();return!!Se(n)&&(t.preventDefault(),e.dispatchCommand(um,!1))},Zt),e.registerCommand(hm,t=>{let n=Fe();if(!Se(n))return!1;if(t!==null){if((eM||D3||F3)&&_3)return!1;t.preventDefault()}return e.dispatchCommand(Qx,!1)},Zt),e.registerCommand(XP,()=>(im(),!0),Zt),e.registerCommand(cm,t=>{let n=Fe();return!!Se(n)&&(tM(t,e),!0)},Zt),e.registerCommand(PP,t=>{let n=Fe();return!!Se(n)&&((function(o,r){tM(o,r),r.update(()=>{let a=Fe();Se(a)&&a.removeText()})})(t,e),!0)},Zt),e.registerCommand(xm,t=>{let n=Fe();return!!Se(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Fe(),i=du(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Se(a)&&Ky(i,a)},{tag:qP})})(t,e),!0)},Zt),e.registerCommand(RP,t=>{let n=Fe();return!!Se(n)&&(t.preventDefault(),!0)},Zt),e.registerCommand(MP,t=>{let n=Fe();return!!Se(n)&&(t.preventDefault(),!0)},Zt))}var B3=Nn({conflictsWith:["@lexical/rich-text"],dependencies:[OA],name:"@lexical/plain-text",register:nM});var oM=qy,Nie=oM.PlainTextExtension,rM=oM.registerPlainText;var Wy={};Mn(Wy,{PlainTextPlugin:()=>U3});pe();var qm=Td(gc(),1);function z3(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 Vy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:q;function $3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return Vy(()=>n.registerDecoratorListener(i=>{(0,qm.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(rh,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,qm.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function H3({editor:e,ErrorBoundary:t}){return(function(n){let o=bA.maybeFromEditor(n);if(o&&o.hasExtensionByName(NA.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&z3(320,r);return!0}return!1})(e)?null:u($3,{editor:e,ErrorBoundary:t})}function aM(e){return e.getEditorState().read(Lm(e.isComposing()))}function U3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=Cn();return(function(r){Vy(()=>za(rM(r),FA(r)),[r])})(o),b(xe,{children:[e,u(K3,{content:t}),u(H3,{editor:o,ErrorBoundary:n})]})}function K3({content:e}){let[t]=Cn(),n=(function(r){let[a,i]=G(()=>aM(r));return Vy(()=>{function s(){let l=aM(r);i(l)}return s(),za(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=RA();return n?typeof e=="function"?e(o):e:null}var q3=Wy,iM=q3.PlainTextPlugin;pe();function sM(e){return/mac|iphone|ipad|ipod/i.test(e)}function mu(){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 gu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function lM(e){let t=gu(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}pe();var Vm=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 dM=yi;function cM(e){return b(xe,{children:[u(Vm,{pathValue:e.path,kind:lM(e.path),theme:e.theme,className:ta}),u("span",{className:e.selectable?gT:na,children:e.label})]})}function uM(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 fM({context:e}){let{t}=ze(),n=qw(e),o=Kw(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(uM,{label:n,tooltipText:r,expired:o})}function V3(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 W3(e){return e.replaceAll("\\","/")}function da(e){let t=e.displayName?.trim();return t||V3(e.name)}function pM(e,t){return t?e.filter(n=>n.enabled):[]}function mM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function gM(e){let t=W3(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 hM(e,t){return e.registerCommand(xm,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=Lc(`${o}
|
|
3710
|
-
`).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=
|
|
3711
|
-
`);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(
|
|
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 Yy(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(Xy(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(LM(i.name,s?.label??da({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(kM(i.context));continue}sK(r,i.text)}}function Qy(e){return e instanceof $s?[e.__context.id]:qe(e)?e.getChildren().flatMap(t=>Qy(t)):[]}function lK(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(BP,s=>n("ArrowDown",s),Dr),r=t.registerCommand(zP,s=>n("ArrowUp",s),Dr),a=t.registerCommand(hm,s=>n("Enter",s),Dr),i=t.registerCommand(vm,s=>n("Tab",s),Dr);return()=>{o(),r(),a(),i()}},[t,e]),null}function dK(){let[e]=Cn();return q(()=>{let t=e.registerCommand(pm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Fe();if(!Se(i)||!i.isCollapsed())return;let s=Cu(0);if(s<=0)return;let l=Ct().getTextContent();kc(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(mm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Fe();if(!Se(i)||!i.isCollapsed())return;let s=Cu(0),l=Jm();if(s>=l)return;let d=Ct().getTextContent();kc(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 cK(){let[e]=Cn();return q(()=>e.registerCommand(HP,t=>{if(!sM(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(nP(o,e))}),!0)},Dr),[e]),null}function uK(){let[e]=Cn();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Fe();if(!Se(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Di(r)||o.anchor.offset===0)return;n=yu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Hs(n)})})}),[e]),null}function fK(){let[e]=Cn(),{onRemoveTerminalContext:t}=Kt(TM);return q(()=>e.registerCommand(gm,n=>{let o=Fe();if(!Se(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=Cu(0),i=s=>{if(!Di(s))return!1;let l=yu(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 pK(){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(Se(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(NP,()=>(n=!0,o(r()),!1),ed),s=e.registerCommand(IP,()=>(n=!1,o(new Set),!1),ed);return()=>{a(),i(),s()}},[e]),null}function mK(){let[e]=Cn();return q(()=>hM(e,{createMentionNode:Xy,getExpandedAbsoluteOffsetForPoint:Xm}),[e]),null}function gK(e){let[t]=Cn(),n=_(e.terminalContexts),o=_(vu(e.skills)),r=_(null),a=_(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=vu(e.skills)},[e.skills]);let i=ih(s=>{let l=wM.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(!Se(g)||g.isCollapsed()||IM(g))return null;let v=bM(g);if(!v||v.start===v.end)return null;let x=Ct().getTextContent();return iv(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)}`;Yy(m,n.current,o.current);let h=lr(m,f.expandedStart);Gm(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(!Se(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(IM(g)){r.current=null,a.current=null;return}let v=bM(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=Ct().getTextContent();if(iv(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==="`"&&CM!==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=CM;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);Gm(w,w+1);let k=Fe();if(!Se(k)){r.current=null,a.current=null;return}k.insertText(`\`${C}${x}`),Gm(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 hK({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=nK(o),C=_(y),w=oK(r),k=_(w),S=_(vu(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=vu(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 we=U.selection;m.getEditorState().read(()=>{we=Gy(we)}),sd(O,U.value,{cursor:U.cursor,expandedCursor:U.expandedCursor,selection:we})}let De=$a(e,t),be=ne?De.selection:{anchor:z,focus:z};L.current={value:t,cursor:ne?De.cursor:z,expandedCursor:ne?De.expandedCursor:wr(t,z),selection:be,terminalContextIds:o.map(we=>we.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 we=ne||U.value!==t||ee||W;we&&Yy(t,o,S.current),ne?Gm(be.anchor,be.focus):(we||Be)&&Hs(z)},{discrete:!0,tag:Or});ge?yM(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,Cu(O)),ee=Wm(U,L.current.expandedCursor),W=Wm(U,SM(ee)),De=Qy(Ct()),be=Gy(L.current.selection);z={value:U,cursor:ne,expandedCursor:W,selection:be,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,Cu(O)),ee=Wm(U,L.current.expandedCursor),W=Wm(U,SM(ee)),De=Qy(Ct()),be=Gy(L.current.selection),ue=L.current;if(ue.value===U&&ue.cursor===ne&&ue.expandedCursor===W&&ue.selection.anchor===be.anchor&&ue.selection.focus===be.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:be,terminalContextIds:De},sd(I.current,U,{cursor:ne,expandedCursor:W,selection:be});let Be=kc(U,ne,"left")||kc(U,ne,"right");h.current(U,ne,W,Be,De)})},[]);return u(TM,{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(iM,{contentEditable:u(YE,{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:JE}),u(MA,{onChange:B}),u(lK,{...c?{onCommandKeyDown:c}:{}}),u(gK,{terminalContexts:o,skills:r}),u(cK,{}),u(dK,{}),u(uK,{}),u(fK,{}),u(mK,{}),u(pK,{}),u(EA,{externalHistoryState:T},e)]})})}function vK(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(hK,{...i})}function EM({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=_(vu(r)),v=H(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[hu,xu,$s],editorState:()=>{Yy(m.current,h.current,g.current)},onError:x=>{throw x}}),[]);return u(uE,{initialConfig:v,children:u(vK,{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}:{}})},Q3)}pe();pe();pe();var hC=Td(NM(),1),gR=Td(gc(),1),hR=Td(gc(),1);qn(function(t,n){return Le("div",{ref:n,...t})});var lg=qn(function(t,n){return Le("div",{ref:n,...t})}),pr=lg,qa={OS:"web"};function Us(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function vC(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 vR(){return"normal"}function kK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:vR()}function PK(e){var t;return(t=e?.rtl)!=null?t:!1}function Wa(e){return xC(e?.props)}function xC(e){return!!e?.horizontal&&PK(e)}function yC(e){return e?.horizontal?(xC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function EK(e,t){var n;return(n=vC(e,t))!=null?n:0}function _M(e,t){return t&&(Wa(e)?t.left:t.right)||0}function AK(e,t,n,o){return!Wa(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function CC(e,t,n){if(!e||!Wa(e))return t;let o=vC(e,n),r=Us(t,o),a=kK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Us(o-r,o):r}function MK(e,t,n){if(!Wa(e))return e.horizontalRTLScrollType=void 0,t;let o=vC(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=vR();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 RK=e=>e,dg=Ut(null),xR="\0",NK=0;function _K({children:e}){let[t]=G(()=>({animatedScrollY:RK(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:NK++,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(dg.Provider,{value:t},e)}function $r(){return cn(dg)}function yR(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 DK(e){return e.length===1?e[0]:e.join(xR)}function OK(e){return e.split(xR)}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 Ae(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 FK(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 BK(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(dg),n=DK(e),{subscribe:o,get:r}=H(()=>yR(t,OK(n)),[t,n]);return(0,hC.useSyncExternalStore)(o,r,r)}function zK(e,t){let n=cn(dg),{subscribe:o,get:r}=H(()=>yR(n,[e]),[n,e]),a=$(()=>t(r()[0]),[r,t]);return(0,hC.useSyncExternalStore)(o,a,a)}function $K(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?_M(o,s):s?.bottom)||0,d=$K(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?_M(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(lg,{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 HK(()=>{c()},100),Le(lg,{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 HK(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var bC=!0,CR=new WeakMap;function UK(e){return CR.get(e)}function KK(e,t){CR.set(e,t)}var qK=typeof __DEV__<"u"?__DEV__:void 0,DM,OM=typeof process<"u"&&typeof process.env=="object"&&process.env?(DM="production")!=null?DM:process.env.MODE:void 0,FM=typeof OM=="string"?OM.toLowerCase()!=="production":void 0,BM,Vo=(BM=FM??qK)!=null?BM:!1,cd=-1e7,bR=1,VK=Vo&&!1,WK=Vo&&!1;function cg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function IR(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 GK(e){cg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,IR(e)}function jK(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function QK(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,jK(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var Zy=1;function XK(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function zM(e){e.initialScrollSession=void 0}function aC(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 Zm(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=aC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=aC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var ug={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){Zm(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){Zm(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=Zm(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)<=Zy},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>Zy},isAtZeroTargetOffset(e){return e<=Zy},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=Zm(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&&!XK(l))return zM(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=aC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var YK=1.3;function iC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*YK||!t&&n<=0&&o>0}var SR=(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?iC(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 JK(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function wR(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=iC(t.scroll,!1,a),l=iC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function TR(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function LR(e){e.state.edgeReachedGate="closed"}function $M(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function ZK(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",JK(e,o),o}function Su(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function kR(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(wR(e),f>0&&a){let p=qs(e),m=f-s-i-p,h=f<i;Ae(e,"isAtEnd",h||m<=bR),Ae(e,"isNearEnd",h||m<=c*i),Ae(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),Su(r)||l||(r.isEndReached=SR(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;TR(e,"end",t,n)&&(LR(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function eq(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;wR(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Ae(e,"isAtStart",s<=bR),Ae(e,"isNearStart",s<=p),Su(o)||o.scrollingTo||(o.isStartReached=SR(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;TR(e,"start",t,n)&&(LR(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function fg(e,t){let n=!e.state.edgeReachedGate;kR(e,t,n),eq(e,t,n)}function PR(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),fg(e)}var tq=6,nq=3,oq=250;function ER(e){e.state.scheduledWork.cancel("adaptiveRender")}function HM(e,t){let n=e.state;ER(e),t<=0?ku(e,"normal","scroll"):n.scheduledWork.timeout(()=>ku(e,"normal","scroll"),t,"adaptiveRender")}function ku(e,t,n){var o,r;ie(e,"adaptiveRender")!==t&&(Ae(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function IC(e){var t,n;ER(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";ie(e,"adaptiveRender")!==o&&ku(e,o,"initial")}function rq(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:tq,c=(r=s.exitVelocity)!=null?r:nq,f=(a=s.exitDelay)!=null?a:oq,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"?(ku(e,"light","scroll"),HM(e,f)):l==="light"&&HM(e,f))}else IC(e)}var SC=50;function AR(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,SC):o}function MR(e){let{state:t}=e;t.props.drawDistance<=SC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function wC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Ae(e,"readyToRender",!1),IC(e)}function TC(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")&&(Ae(e,"readyToRender",!0),ku(e,"normal","ready"),o.props.drawDistance>SC&&MR(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var aq=2e3;function UM(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function RR(e){e.scheduledWork.cancel("preservedInitialScroll")}function ud(e){RR(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Va(e)}function KM(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&&(cg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),ug.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)UM(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)&&UM(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),RR(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||ud(a)},aq,"preservedInitialScroll")):ud(a),t?.recalculateItems&&PR(e),TC(e,{didInitialScroll:!0}),p&&QK(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function pg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function iq(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 sq(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 lq(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-sq(e)-qs(e)):0}function js(e){let t=ie(e,"alignItemsAtEndPadding")||0,n=lq(e);t!==n&&Ae(e,"alignItemsAtEndPadding",n)}function wu(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&&Ae(e,"totalSize",i),js(e)):o&&e.values.get("totalSize")!==i&&Ae(e,"totalSize",i)}function sC(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&&wu(e,t,s,o),a.set(t,n)}function NR(e){return typeof e=="function"}function mg(e){return Array.isArray(e)}var qM=new Set;function Ks(e,t){Vo&&!qM.has(e)&&(qM.add(e),console.warn(`[legend-list] ${t}`))}function Pu(e){return Math.floor(e*8)/8}function Tu(e){return e==null}function VM(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 Iu(e,t,n){return VM(e,n)+VM(t,n)}function lC(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 _R(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 DR(e,t){let n=Ot(e.state,t);return _R(e,n,t,e.state.props.data[t])}function dq(e,t,n){for(let o=t;o<=n;o++)if(DR(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=_R(e,t,n,o,s),C!==void 0)return sC(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=Pu(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=Pu(S))}return C===void 0&&(C=g+e.scrollAxisGap),sC(e,t,C,i),C}function LC(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 gg(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=iq(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 Eu(e){var t,n;let o=e.state;if(o?.scrollingTo){cg(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&&wu(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}PR(e),r?.()}}var cq=80,uq=1500,fq=320,pq=1;function mq(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?CC(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;gq(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&Eu(e)},100,"platformScrollCompletion")}}function gq(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Eu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),uq),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)<=pq;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),Eu(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),cq)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),fq),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=EK(t,g),x=CC(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,hq=300,vq=2,xq=1;function yq(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 Cq(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>=vq){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+hq,id:n,position:o,quietPasses:c}}}function bq(e,t,n,o,r,a){return!1}function Iq(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 Sq(e,t){return e<0?-t:t}function eC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Eo&&Qs(e,r)}function wq(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Eo)return;let o=mo(e),r=Iq(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 Tq(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=Sq(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 eC(e,r,a),!0;let l=Math.max(0,mo(e)-n.scrollLength);return Math.abs(t-l)<=xq||n.pendingMaintainScrollAtEnd&&ie(e,"isWithinMaintainScrollAtEndThreshold")&&s>Eo?(eC(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 Lq(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=yq(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(Cq(n,{anchorId:L,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),bq()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:k},wq(e);return}Math.abs(S)>Eo&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&ie(e,"isWithinMaintainScrollAtEndThreshold")||Qs(e,S))}}}var WM=1e3,kq=200,hg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>WM)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>WM)break;if(c===0||f<=0)continue;let m=o.time-l.time,h=Math.exp(-m/kq);a+=c/f*h,i+=h}return i>0?a/i:0};function Pq(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function _u(e){return e.dataChangeNeedsScrollUpdate||Pq(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?ZK(e,t-f):void 0,y=Tq(e,t),C=a.scrollLength,w=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,k=hg(a);rq(e,k,{forceLight:w});let S=a.scrollLastCalculate;if(_u(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),fg(e,x)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,hR.flushSync)(T),MR(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 Eq(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 Aq(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 Mq(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 GM(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=LC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function Rq(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)):Mq(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=GM(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=GM(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 Nq(e,t,n){let o=Rq(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function vg(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;cg(r);let h=f?c:gg(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&&ug.resetFlags(r);let y=Eq(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||Nq(e,v,s.index)}r.scrollPending=v,Aq(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"?mq(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function OR(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function eg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=OR(t,l.length);let d=LC(e,t),c=pg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,vg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function xg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?OR(i,e.state.props.data.length):void 0,l=LC(e,s);vg(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&&wC(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?pg(e,t.index):0,i=gg(e,a,t);return Oi(e,i,t)}function FR(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 _q(e,t){var n,o,r;let a=e.state,i=FR(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 xg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function Dq(e,t){var n,o;let r=e.state,a=FR(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 xg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Au(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?Dq(e,{forceScroll:t?.forceScroll}):_q(e,{forceScroll:t?.forceScroll})}function Lu(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 yg=1,Oq=8,Fq=24,Bq="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 zq(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 $q(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 Hq(e){let{mountFrameCount:t,maxFrames:n=Oq,maxPasses:o=Fq,passCount:r}=e;return t>=n||r>=o}function BR(e,t){return Hq(t)?(Vo&&console.warn(Bq),e4(e),!0):!1}function Mu(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 zR(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 Uq(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&&zR(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function dC(e){requestAnimationFrame(()=>{var t;mr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function kC(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,!BR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&kC(e))};n.frameHandle=requestAnimationFrame(o)}function rg(e,t){Uq(e.state,t),kC(e),dC(e.state)}function PC(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 Kq(e){return!!e?.preserveForBottomPadding}function Gs(e){return!!e?.preserveForFooterLayout}function $R(e){return!!(e&&e.viewPosition===1&&(Kq(e)||Gs(e)))}function qq(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 Vq(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function ag(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Gs(r))return;let a=PC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Ws(e,a)}function Wq(e){ud(e)}function EC(e,t,n=yg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Ru(o);return Math.abs(r-zr(e,t))>n}function Ru(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 HR(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:Ru(n);return zr(e,o)-r}function UR(e){return HR(e)===void 0?!1:(KR(e,{}),!0)}function KR(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=HR(e);if(a===void 0||Math.abs(a)<=yg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Qs(e,a)),KR(e,t)})}function Gq(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)&&($R(o)&&ie(e,"isAtEnd")||(Gs(o)?ag(e,{dataLength:n.props.data.length,stylePaddingEnd:yC(n.props),target:o}):Wq(n)))}function jq(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?(Mu(s),fd(e,{resolvedOffset:l})):c?(Mu(s),fd(e,{preserveTarget:!0,resolvedOffset:l})):(zR(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),kC(e))}function Qq(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||$R(l));if(!(!o&&!d&&!p)){if(p){let m=r?PC({dataLength:n,footerSize:ie(e,"footerSize")||0,preserveForFooterLayout:Gs(l),stylePaddingEnd:i}):qq({dataLength:n,footerSize:ie(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&EC(e,l)){ag(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!Vq(l,m)||c||d||o){Ws(e,m,{resetDidFinish:d}),rg(e,{scroll:zr(e,m),seedContentOffset:d&&!c?Ru(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Ws(e,l,{resetDidFinish:d}),rg(e,{scroll:zr(e,l),seedContentOffset:d&&!c?Ru(s):void 0,targetIndexSeed:l.index}))}}function Xq(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(EC(e,s))ag(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=PC({dataLength:n,footerSize:o,preserveForFooterLayout:Gs(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))ag(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Ws(e,d,{resetDidFinish:f}),rg(e,{scroll:zr(e,d),targetIndexSeed:d.index})}}}function Yq(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:Ru(r),c=s-d;if(Math.abs(c)>yg){if(r.didFinishInitialScroll)UR(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 rg(e,{scroll:s,targetIndexSeed:a.index})}}function Jq(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,BR(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=Lu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=$q({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,dC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=yg&&zq(m,c))){dC(o);return}Mu(o),xg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:qa.OS==="web"})}function Zq(e,t){var n;let o=e.state;Mu(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 e4(e){var t,n,o,r;let a=e.state,i=mr(a),s=a.initialScroll;i&&s&&!Xs(a)&&a.refScroller.current?(Mu(a),xg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:qa.OS==="web"})):Zq(e,(r=(o=(n=(t=mr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function qR(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function t4(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=qR(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 VR(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var n4=20,o4=1,r4=1,tC=16;function AC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!MC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>d4(e),"checkFinishedScrollFrame")}function a4(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=o4}function i4(e,t){return!!t?.isInitialScroll&&ug.didDispatchNativeScroll(e)&&!e.hasScrolled}function WR(e){var t;return(t=ao.get(e))==null?void 0:t.targetOffset}function GR(e){let t=WR(e);return!e.didFinishInitialScroll&&ao.hasNonZeroTargetOffset(t)}function jM(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)&&ug.didDispatchNativeScroll(e)&&!e.hasScrolled||ao.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||GR(e)}function QM(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<=r4}function s4(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function l4(e,t){var n;let o=t.index,a=s4(e,t)&&o!==void 0?gg(e,pg(e,o),t):(n=t.targetOffset)!=null?n:Oi(e,t.offset-(t.viewOffset||0),t);return Oi(e,a,t)}function MC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=l4(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 d4(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=MC(e,t);o.isAtResolvedTarget&&a4(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Eu(e)}function c4(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 u4(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=QM(e),r=i4(t,n),a=n!==void 0?jM(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?tC: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=GR(t)&&!t.hasScrolled,g=r?5:h?n4:5,v=QM(e),x=jM(t,m),y=MC(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)Eu(e);else if((h||k)&&l<=g){let S=(p=(f=WR(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;c4(e,S),d(r?tC:100)}else d(r?tC:100)}};d(s)}function jR(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?UR(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Au(e,{forceScroll:!0})}function f4(e){var t;if(!e.state.initialScroll)return;let n=()=>Au(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),AC(e,{onlyIfAligned:!0})}function p4(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"){jq(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?fd(e,{resolvedOffset:p}):TC(e,{didInitialScroll:!0}))}function m4(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){Qq(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&&wC(e,{resetInitialScroll:!0}),Au(e))}function QR(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function g4(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 ig(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;Ae(e,"containerLayoutEpoch",a)}}function h4(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 Ae(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=AK(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&&(Ae(e,`containerPosition${t}`,z),L=!0),U>=0&&U!==ee&&Ae(e,`containerColumn${t}`,U),O!==W&&Ae(e,`containerSpan${t}`,O)}ie(e,`containerItemIndex${t}`)!==n&&Ae(e,`containerItemIndex${t}`,n);let A=ie(e,`containerItemData${t}`),E=()=>{Ae(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 v4(e,t,n){var o;let r=e.state,a=ie(e,"numColumns"),i=t;r.columns[t]!==1&&(i=XM(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=XM(r,a,c),m=x4(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function XM(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 x4(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 y4(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)wu(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)}wu(e,null,d+f)}else{let c=go(e,l,s,a[s]);if(c!==void 0){let f=d+c;wu(e,null,f)}}}}function XR(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]=CC(t,s,o)}Ae(e,"snapToOffsets",r)}function YR(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??hg(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,be=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:Te}=v4(e,s,ee);s=te,be=Te}else if(s<T){let te=s-1,Te=Ot(m,te),dt=(c=y[te])!=null?c:0,ct=(f=w.get(Te))!=null?f:go(e,Te,te,k[te],ee,W,De);be=dt+ct}}let ge=t||x.size===0,le=E&&!!S&&!!B,we=!1,ye;for(let te=s;te<T;te++){if(O&&ye!==void 0&&te>ye){we=!0;break}O&&ye===void 0&&!I&&!t&&be>ne&&(ye=te+(E?A:1)+10);let Te=(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&&(be+=Be,ue=1,Be=0);let ct=w.get(Te),lt=ct!==void 0?ct:go(e,Te,te,k[te],ee,W,De);Vo&&ge&&(N.has(Te)&&console.error(`[legend-list] Error: Detected overlapping key (${Te}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),N.set(Te,te)),be!==y[te]&&(y[te]=be,h&&BK(e,Te,be)),ge&&x.set(Te,te),E?(g[te]=ue,v[te]=dt,lt>Be&&(Be=lt),ue+=dt,ue>A&&(be+=Be,ue=1,Be=0)):be+=lt}we||y4(e),L&&XR(e)}function JR(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 C4(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function ZR(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=JR(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>YM(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):YM(l,d,e,t,o)}}function YM(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=JR(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)eN(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=lC(o,y.key),S=!1;C!==void 0&&w!==void 0&&(S=ZM(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=lC(o,w);if(ZM(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];b4(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 JM(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 eN(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(!JM(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(!JM(E,A)){t.mapViewabilityAmountValues.set(o,A);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(A)}return A}function ZM(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=eN(e,t,n,o,r,a,i,s)),l.isViewable}function b4(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var eR=gR.unstable_batchedUpdates,I4=typeof eR=="function"?eR:e=>e(),S4=32,w4=64,T4=3;function L4(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*T4),o=t+w4,r=Math.max(t,Math.min(n,o),Math.min(e,S4)),a=Math.max(e,t);return Math.min(a,r)}function k4(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function P4(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(E4);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 E4(e,t){return t.distance-e.distance}function A4(e){let t=e.state;t.queuedInitialLayout=!0,kR(e),TC(e,{didLayout:!0})}var M4=4,R4=100;function N4(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/M4);return Math.sign(e)*t*n}function _4(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},R4,"renderRangeProjection")}function D4(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 O4(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 F4(e,t,n,o,r,a,i){var s;let l=e.state;Ae(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(O4(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 B4(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),Ae(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 tN(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 nN(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 cC(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 z4(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 $4(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(tN(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:nN(s,h),startNoBuffer:h.startNoBuffer}),cC(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&ZR(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function Ka(e,t={}){let n=e.state;I4(()=>{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:be,startBufferedId:ue,viewabilityConfigCallbackPairs:Be}=n,{data:ge}=n.props,le=n.props.stickyHeaderIndicesArr||[],we=n.props.stickyHeaderIndicesSet||new Set,ye=AR(e,t.drawDistanceMode),{dataChanged:te,doMVCP:Te,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,Me=ie(e,"stylePaddingTop")+ie(e,"alignItemsAtEndPadding")+ie(e,"headerSize"),Oe=ie(e,"numColumns"),Ue=(r=t.scrollVelocity)!=null?r:hg(n),et=0,{initialScroll:Ee,queuedInitialLayout:Ce}=n,ht=lt?(a=ct?.scroll)!=null?a:n.scroll:!Ce&&Su(n)&&Ee?zr(e,Ee):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-Me,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?D4(le,Ft,n):-1,Ze=Z>=0?le[Z]:-1,yt=pn!==Ze;(Z>=0||pn>=0)&&Ae(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&&!Su(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!ie(e,"readyToRender")?N4(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&&_4(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)&&!_u(n)){Be?$4(e,Be,De,Ft,tn):n.props.onFirstVisibleItemChanged&&cC(n,z4(e,Ft)),(i=Pt?.finishCalculateItemsInView)==null||i.call(Pt);return}}let X=Te&&!lt?Lq(e,te):void 0;te&&QR(n);let se=dt||te?0:(s=R??n.startBuffered)!=null?s:0,re=!dt&&!te&&Oe>1&&R!==void 0;YR(e,te,{doMVCP:Te,forceFullUpdate:!!dt,optimizeForVisibleWindow:re,scrollBottomBuffered:Rt,scrollVelocity:Ue,startIndex:se}),Vt=mo(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let de;if(te&&Te&&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=be.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=be.get(Ze))!=null?h:go(e,Ze,Z,ge[Z]),We=B[Z];me||(tN(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:nN(n,Qe),startBuffered:xt,startBufferedId:jt,startNoBuffer:Qe.startNoBuffer}),A&&ut!==void 0&&ft!==void 0&&(n.scrollForNextCalculateItemsInView=Tu(ut)&&Tu(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):!Tu(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?F4(e,le,(v=Pt?.currentStickyIdx)!=null?v:-1,Z,Ze,xt,nn):pn!==-1&&Ae(e,"activeStickyIndex",-1),Z.length>0){let In=P4(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),Ae(e,`containerItemKey${Bt}`,to),Ae(e,`containerItemIndex${Bt}`,vn),Ae(e,`containerItemData${Bt}`,ge[vn]),n.containerItemMetadata.set(Bt,qR(n,vn,ge[vn],hn.itemType)),T.set(to,Bt),(C=n.userScrollAnchorReset)==null||C.keys.add(to);let xo=`containerSticky${Bt}`,ua=we.has(vn),On=vo(vn);ua?(Ae(e,xo,!0),n.stickyContainerPool.add(Bt)):(ie(e,xo)&&Ae(e,xo,!1),On?n.stickyContainerPool.add(Bt):n.stickyContainerPool.delete(Bt)),Bt>=bn&&(bn=Bt+1)}bn!==at&&(Ae(e,"numContainers",bn),bn>ie(e,"numContainersPooled")&&Ae(e,"numContainersPooled",k4(wt,bn)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&B4(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)&&(Ae(e,`containerSticky${Z}`,!1),n.stickyContainerPool.delete(Z)),Ae(e,`containerItemKey${Z}`,void 0),Ae(e,`containerItemIndex${Z}`,void 0),Ae(e,`containerItemData${Z}`,void 0),Ae(e,`containerPosition${Z}`,cd),Ae(e,`containerColumn${Z}`,-1),Ae(e,`containerSpan${Z}`,1);else{let yt=N.get(Ze);yt!==void 0&&(Xt=h4(e,Z,yt,{scrollAdjustPending:Wt,updateLayout:!0}).didChangePosition||Xt)}}if(it&&bC&&ig(e,it),Xt&&Ae(e,"lastPositionUpdate",Date.now()),lt){Jq(e);return}cC(n,Qe.startNoBuffer),!Ce&&!n.didContainersLayout&&(Su(n)?Lu(n,n.startBuffered,n.endBuffered):Lu(n,n.startNoBuffer,n.endNoBuffer)||Lu(n,n.startBuffered,n.endBuffered))&&(A4(e),f4(e)),Be&&Qe.startNoBuffer!==null&&Qe.endNoBuffer!==null&&ZR(e.state,e,Be,De,Qe.startNoBuffer,Qe.endNoBuffer,xt??Qe.startNoBuffer,nn??Qe.endNoBuffer),(L=Pt?.finishCalculateItemsInView)==null||L.call(Pt)})}function sg(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=DR(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)+yC(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&&(Ae(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)&&(Ae(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Vs(e,o.scroll,!0,{markHasScrolled:!1})),f}function H4(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 tR(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=ie(e,"otherAxisSize");(!a||r>a)&&Ae(e,"otherAxisSize",r)}}var Ha;function oN(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)RC(o,r)}}}function U4(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 K4(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,H4(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&sg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&pd(e)}function rN(e,t){if(Ha){let n=Ha.get(e);n?n.push(t):Ha.set(e,[t])}else RC(e,[t])}function RC(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?t4(o,a.containerId,s,l):void 0,c=q4(e,a.itemKey,a.size,d);U4(r,c)}K4(e,r)}function q4(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 tR(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,w,k=i.sizesKnown.get(t),S=V4(e,t,n,o),L=Pu(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),tR(e,n,m),d||Lu(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 V4(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?(sC(e,t,S),S-C):0}function W4(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();KK(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&RC(e,n)}var aN=qn,ca=ce,G4=ca(function({children:t}){let n=$r(),[o]=Wo(["containerLayoutEpoch"]);return he(()=>{{let r=g4(n);r!==void 0&&W4(n,r)}},[n,o]),t}),tg=e=>ah(e)?e:e?Le(e,null):null,j4=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),uC={contain:"paint layout style",...j4?{display:"flex",flexDirection:"column"}:{}},Q4=ca(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=cd]=Wo([`containerPosition${t}`]),s=mg(o)?Object.assign({},...o):o,l=n?{...uC,...s,left:i}:{...uC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Le("div",{ref:r,...m,style:l})}),X4=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=mg(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=H(()=>{var x;let y={...uC,...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"}},tg(i.backdropComponent)):null,[i?.backdropComponent]);return Le("div",{ref:r,style:g,...c},v,d)}),Y4=Q4;function J4(e){G(()=>e())}var iN=Ut(null),Z4=-1;function eV(){return cn(iN)}function tV(){var e;let t=eV(),n=(e=t?.containerId)!=null?e:Z4,[o]=Wo([`containerItemKey${n}`]);return zK("lastItemKeys",a=>t&&!Tu(o)&&a?.includes(o)||!1)}function nV({ItemSeparatorComponent:e,leadingItem:t}){return tV()?null:Le(e,{leadingItem:t})}var nC=null;function oV(){return nC||(nC=new ResizeObserver(e=>{oN(()=>{for(let t of e){let n=ng.get(t.target);if(n)for(let o of n)o(t)}})})),nC}var ng=new WeakMap;function rV(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=oV(),r=(n=ng.get(e))!=null?n:new Set;return r.size===0&&(ng.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(ng.delete(e),o.unobserve(e))}}function NC({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(nR(m),!0),p=m}return rV(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??UK(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let w=!!r?.();(C||w)&&f(nR(x),!1)})},[t,...a||[]]),{}}function nR(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var og=new Map,oC;function sN(e){og.delete(e)}function aV(e,t){og.set(e,t),oC===void 0&&(oC=requestAnimationFrame(()=>{let n=Array.from(og.values());og.clear(),oC=void 0,oN(()=>{for(let o of n)o()})}))}function iV({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=Pu(n[l]);r.lastSize&&Pu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,rN(t,{containerId:e,itemKey:i,size:s})};!_u(a)&&f!==void 0&&d+1<f?aV(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()}}):(sN(r),p())}function sV({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=>{iV({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=$(()=>{ig(t,e)},[e,t]);he(()=>(t.containerLayoutTriggers.set(e,d),()=>{sN(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),he(()=>{ig(t,e)});let{onLayout:c}=NC({measureInLayoutEffect:!bC,onLayoutChange:l,ref:r,webLayoutResync:()=>_u(t.state)},[o,i]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function lV({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 dV=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}=sV({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(()=>lV({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||X4:p||Y4,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:k,refView:w,stickyHeaderConfig:s,style:E},Le(iN.Provider,{value:B},R,N&&i&&Le(nV,{ItemSeparatorComponent:i,leadingItem:N.item})))});function cV({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=dV}){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 uV=ca(function(t){return Le(cV,{...t})});function fV(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=pV(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 pV(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 mV(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)}fV(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function gV(e,t){let[n,o]=G(t),r=n!==t;return he(()=>{o(t)},[t]),e&&!r}var hV=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=gV(!!c,t);mV(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(G4,null,r))}),vV=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(uV,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Le(hV,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function xV(e){return mg(e)?Object.assign({},...e.filter(Boolean)):e}var Nu={create:e=>e,flatten:e=>xV(e)};function fC(e){let t=_(e);return t.current=e,t}function yV(e){let t=fC(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 pC="legend-list-content-container",lN="legend-list-scrollbar-x-hidden",dN="legend-list-scrollbar-y-hidden";function CV(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function mC(){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 oR(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 cN(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function bV(e,t,n){return cN(n?t:e)}function rR(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 aR(e,t){return Math.max(0,Math.min(e,t))}function iR(e,t){return t?e.width:e.height}function IV(e,t,n){return Math.max(0,iR(e,n)-iR(t,n))}function sR(e,t){return t&&CV()||e}function SV(e,t){return t&&typeof window<"u"?window:e}function wV(e,t,n){let o=e.getBoundingClientRect(),r=mC();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 TV({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var lR="legend-list-scrollbar-axis-hidden-style",LV=200,kV=`.${dN}::-webkit-scrollbar:vertical{width:0;display:none;}.${lN}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function PV(){if(typeof document>"u"||document.getElementById(lR))return;let e=document.createElement("style");e.id=lR,e.textContent=kV,document.head.appendChild(e)}function EV(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 AV(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 MV(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 dR=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=$(()=>SV(L.current,T),[T]),E=$(()=>{let Me=L.current,Oe=bV(Me,I.current,T),Ue=rR(Me,T,a);return IV(Oe,Ue,a)},[a,T]),N=$(()=>{let Me=L.current;if(T){let Oe=E(),Ue=mC(),et=oR(Me,Ue),Ee=a?Ue.x-et.left:Ue.y-et.top;return aR(Ee,Oe)}return Me?a?Me.scrollLeft:Me.scrollTop:0},[E,a,T]),R=$((Me,Oe)=>{let Ue=L.current,et=A();if(!et||typeof et.scrollTo!="function")return;let Ee=E(),Ce=aR(Me,Ee),Wt={behavior:Oe?"smooth":"auto"};if(T){let fn=mC(),Ft=oR(Ue,fn),{left:en,top:tn}=TV({clampedOffset:Ce,horizontal:a,listPos:Ft,scroll:fn});Wt.left=en,Wt.top=tn}else a?Wt.left=Ce:Wt.top=Ce;et.scrollTo(Wt)},[E,A,a,T]);Qr(x,()=>({getBoundingClientRect:()=>{var Oe;return(Oe=L.current)==null?void 0:Oe.getBoundingClientRect()},getCurrentScrollOffset:N,getScrollableNode:()=>sR(L.current,T),getScrollEventTarget:()=>A(),getScrollResponder:()=>sR(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:Ee=!0}=Oe;R(a?Ue:et,Ee)},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 Me=cN(I.current),Oe=rR(L.current,T,a),Ue=N(),et={nativeEvent:{contentOffset:{x:a?Ue:0,y:a?0:Ue},contentSize:{height:Me.height,width:Me.width},layoutMeasurement:{height:Oe.height,width:Oe.width}}};l(et)},[N,a,T,l]),z=yV(B),U=_(void 0),O=$(()=>{let Me=U.current;Me!==void 0&&(clearTimeout(Me),U.current=void 0),z.flush(),d?.()},[d,z]),ne=$(Me=>{if(!l)return;let Oe=k.state;if(!!Oe?.scrollingTo||!!Oe?.initialScrollSession&&!Oe.didFinishInitialScroll||!!Oe?.initialScroll&&!Oe.didFinishInitialScroll||!!Oe&&_u(Oe)?z.flush():z.schedule(),d){let et=U.current;et!==void 0&&clearTimeout(et),U.current=setTimeout(O,LV)}},[k.state,O,d,l,z]);he(()=>{let Me=A();if(Me)return Me.addEventListener("scroll",ne,{passive:!0}),"onscrollend"in Me&&Me.addEventListener("scrollend",O),()=>{Me.removeEventListener("scroll",ne),"onscrollend"in Me&&Me.removeEventListener("scrollend",O);let Oe=U.current;Oe!==void 0&&(clearTimeout(Oe),U.current=void 0),z.cancel()}},[O,A,ne,z]),q(()=>{let Me=()=>{i&&R(a?i.x||0:i.y||0,!1)};Me(),requestAnimationFrame(Me)},[i?.x,i?.y,a,R]),he(()=>{if(!g||!L.current)return;let Me=L.current,Oe=()=>{g({nativeEvent:{layout:wV(Me,T,a)}})};Oe();let Ue=new ResizeObserver(()=>{Oe()});Ue.observe(Me);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&&lN:!p&&dN);he(()=>{ee&&PV()},[ee]);let W={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Nu.flatten(n),...s?{overflowAnchor:"none"}:{}},De=EV(k),be=(C=(y=k.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&S?S:0,ue=Math.max(0,De-be),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,...Nu.flatten(r),...s?{overflowAnchor:"none"}:{}},le=o?`${pC} ${o}`:pC,{contentContainerClassName:we,contentInset:ye,scrollEventThrottle:te,ScrollComponent:Te,snapToOffsets:dt,useWindowScroll:ct,className:lt,...at}=v,Vt=T?[]:AV(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(Me=>Le("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":Me,key:`snap-${Me}`,style:MV(Me,a)})),t,Be?Le("div",{"aria-hidden":!0,style:Be}):null))});function RV({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function cR(e,t){let n=$r();he(()=>Ua(n,e,r=>{t(r)}),[t,n,e])}function NV(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function _V(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 > .${pC}`)),i?{contentNode:s,scrollElement:i}:null}function DV(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function OV(){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=_V(e,a.current);if(f){let p=!!e.state.props.horizontal,m=NV(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=()=>DV(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 cR("scrollAdjust",i),cR("scrollAdjustUserOffset",i),null}var FV=qn(function({ScrollComponent:t,...n},o){let[r]=Wo(["snapToOffsets"]);return Le(t,{...n,ref:o,snapToOffsets:r})}),gC=.1;function BV(e,t,n){let o=ie(e,t)!==n;return o&&(Ae(e,t,n),js(e)),o}function zV(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-gC&&Math.abs(l)>gC}function uR(e,t){let{state:n}=e,o=ie(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>gC;r&&(Ae(e,"headerSize",t),js(e),a&&zV(e,o,t)&&Qs(e,t-o)),n.didMeasureHeader=!0}function $V(e,t){let n=BV(e,"footerSize",t);return n&&sg(e),n}function HV(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 UV(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!HV(o,r);return n.contentInsetOverride=r,a&&js(e),a}function KV(e,t){let n=fC(e),o=fC(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 fR=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=_(null),a=t??r;return NC({onLayoutChange:e,ref:a}),Le("div",{...o,ref:a},n)},qV=ca(function({horizontal:t}){let[n=0]=Wo(["alignItemsAtEndPadding"]);return n<=0?null:Le(lg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),VV=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 we=a?Wa(R.state)?"Left":"Right":"Bottom",ye=Nu.flatten(r);ee={[`padding${we}`]:Iu({},ye||{},we)+z}}let W=RV({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:U}),De=KV(C,(we,ye)=>({...we,ref:ye})),be=C?De:dR,ue=I?FV:be,Be=$((we,ye)=>{var te;let Te=$V(R,we);ye?.(),Te&&((te=R.state.props.maintainScrollAtEnd)!=null&&te.onFooterLayout)&&pd(R)},[R]);he(()=>{p||uR(R,0),h||Be(0)},[p,h,R,Be]);let ge=$(we=>{let ye=we[a?"width":"height"];uR(R,ye)},[R,a]),le=$((we,ye)=>{let te=we[a?"width":"height"];Be(te,()=>{w?.(we,ye)})},[a,w,Be]);return Le(ue,{...N,...be===dR?{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?be:void 0,style:W?[W,o]:o},Le(OV,null),p&&Le(fR,{onLayoutChange:ge,style:m},tg(p)),v&&tg(v),O&&Le(qV,{horizontal:a}),t&&!v&&Le(vV,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),h&&Le(fR,{onLayoutChange:le,style:g},tg(h)),Vo&&VK)}),WV=100,GV=.9,jV=.9;function QV(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<WV)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*GV),C=x>=v*jV;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 XV(e){}var YV=Vo?QV:XV;function JV(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),VR(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||fg(e),delete o.previousData}function ZV(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 uN(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=AR(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++)Ae(e,`containerPosition${h}`,cd),Ae(e,`containerColumn${h}`,-1),Ae(e,`containerSpan${h}`,1);return Ae(e,"numContainers",m),Ae(e,"numContainersPooled",L4(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Ka(e,{dataChanged:!0,doMVCP:!0})}):Ka(e,{dataChanged:!0,doMVCP:!0})),!0}}function eW(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function tW(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=eW()[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&&uN(e),m&&Ka(e,{doMVCP:!0}),(g||p!==h)&&Ae(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&pd(e),fg(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 nW(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 oW(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function rW(e){return{...e,nativeEvent:{...e.nativeEvent}}}function aW(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=MK(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,vg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Vs(e,f,c,{fromNativeScrollEvent:!0}),nW(l,f),Gq(e),l.scrollingTo&&AC(e),l.props.onScroll&&(oW(l)?l.deferredPublicOnScrollEvent=rW(t):l.props.onScroll(t))}var iW=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()}},sW=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,Ae(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Ae(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&AC(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=pg(this.ctx,e.index);o=gg(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,Ae(this.ctx,"scrollAdjust",this.appliedAdjust)),Ae(this.ctx,"scrollAdjustPending",0),Ka(this.ctx)}}}};function lW(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}),!jR(e)&&i&&a>0&&Qs(e,a)}}function rC(e){return H(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var dW=(...e)=>$(n=>{for(let o of e)o&&(NR(o)?o(n):o.current=n)},e);function cW(e){return null}function uW(e,t,n,o){return o}function fW(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 pW(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 eg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var mW="default";function gW(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||mW]={average:o.avg,count:o.num})}return t}function hW(e){ig(e)}function vW(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:dq(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 IR(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);KM(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,()=>pW(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 eg(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(),VR(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,Ae(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),hW(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(lC(e,Ot(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>gW(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)=>FK(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:hg(n),sizeAtIndex:g=>n.sizesKnown.get(Ot(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=UV(e,g);Vs(e,n.scroll,!0,{markHasScrolled:!1}),v&&jR(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?.(),KM(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(eg(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?(eg(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(vg(e,g),!0)),setItemSize:(g,v)=>{rN(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=NR(g)?g(ie(e,"scrollAdjustUserOffset")||0):g;Ae(e,"scrollAdjustUserOffset",v)}}}var xW=(e,t)=>e-t,pR=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,bu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function yW(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=pR(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)bu(i,s,f);let d=pR(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)bu(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&bu(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)&&(bu(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++)bu(i,s,p)}let c=Array.from(i);return c.sort(xW),c}function CW(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&&!Tu(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 mR(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 bW(e){var t;return e?e===!0?{...mR(void 0,!1),animated:!1}:{...mR(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function IW(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 SW(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;Ae(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=ie(e,"totalSize")||0,Ae(e,"totalSize",r-o)},16)}Ae(e,"stylePaddingTop",t)}}function wW(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 TW(e,t){let n=wW("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var LW=ca(aN(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(mg(o)?o:oh.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Le(_K,null,Le(kW,{...l,ref:n}))})),kW=aN(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:be,horizontal:ue,rtl:Be,estimatedHeaderSize:ge,initialScrollAtEnd:le=!1,initialScrollIndex:we,initialScrollOffset:ye,experimental_adaptiveRender:te,itemsAreEqual:Te,keyExtractor:dt,ListEmptyComponent:ct,ListFooterComponent:lt,ListFooterComponentStyle:at,ListHeaderComponent:Vt,maintainScrollAtEnd:it=!1,maintainScrollAtEndThreshold:Me=.1,maintainVisibleContentPosition:Oe,numColumns:Ue=1,overrideItemLayout:et,onEndReached:Ee,onEndReachedThreshold:Ce=.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=Nu.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={...Nu.flatten(gn)},eo=Iu(vo,Zn,"Top"),Xt=Iu(vo,Zn,"Bottom"),Z=Iu(vo,Zn,"Left"),Ze=Iu(vo,Zn,"Right"),yt=yC({horizontal:ue,rtl:Be,stylePaddingBottom:Xt,stylePaddingLeft:Z,stylePaddingRight:Ze}),We=bW(it),In=IW(Oe),hn=we!=null,vn=ye!=null,Bt=!le&&!hn&&!vn&&xC({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 we=="object"?{index:(r=we.index)!=null?r:0,preserveForBottomPadding:we.viewOffset===void 0&&we.viewPosition===1?!0:void 0,viewOffset:(a=we.viewOffset)!=null?a:we.viewPosition===1?-yt:0,viewPosition:(i=we.viewPosition)!=null?i:0}:{index:we??0,viewOffset:ye??0}:to?{contentOffset:ye??0,index:0,viewOffset:0}:void 0,[ua,On]=G(!bC),[,Js]=ri(He=>He+1,0),_e=$r();_e.columnWrapperStyle=A||(Zn?fW(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=dW(hr,X),dn=dt??((He,pt)=>pt.toString()),Kn=vt,zt=O,vr=_(zt),$t=H(()=>{let He=yW(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 iW,scroll:0,scrollAdjustHandler:new sW(_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),Ae(_e,"maintainVisibleContentPosition",In),Ae(_e,"extraData",W),ge!==void 0&&Ae(_e,"headerSize",ge)}Ht.current=_e.state}let Ie=Ht.current,Fn=Ie.isFirst,Qa=Ie.props.adaptiveRender,Cr=Ie.props.numColumns,Xa=!Fn&&_e.scrollAxisGap!==Go;_e.scrollAxisGap=Go,Ie.didColumnsChange=Ue!==Cr||Xa;let Bo=(x=(v=Ie.props.data)==null?void 0:v.length)!=null?x:0,jo=Ie.props.data!==R,Qo=Ie.props.dataKey!==B,fa=Ie.props.dataVersion!==z,no=Qo||fa||jo&&ZV(Ie,R,Ie.props.data),qr=!Fn&&no&&Ie.hasHadNonEmptyData&&(Qo||Bo===0)&&R.length>0;no&&!le&&Ie.didFinishInitialScroll&&((y=Ie.initialScroll)==null?void 0:y.viewPosition)===1&&Ie.props.data.length>0&&ud(Ie),no&&(Ie.dataChangeEpoch+=1,Ie.dataChangeNeedsScrollUpdate=!0,Ie.didDataChange=!0,Ie.previousData=Ie.props.data),qr&&(Ie.freshDataTransitionEpoch+=1);let Bi=TW(Rt??S,de??0),Zs=de&&Rt?Bi:Rt,xn=!Fn&&!no&&((C=Ie.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;Ie.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:rC(De),getItemType:rC(be),horizontal:!!ue,itemsAreEqual:Te,keyExtractor:rC(dn),maintainScrollAtEnd:We,maintainScrollAtEndThreshold:Me,maintainVisibleContentPosition:In,numColumns:Ue,onEndReached:Ee,onEndReachedThreshold:Ce,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},Ie.refScroller=hr,!Fn&&Qa&&!te&&IC(_e);let zi=H(()=>R.length?Array.from({length:Math.min(Ue,R.length)},(He,pt)=>Ot(Ie,R.length-1-pt)):[],[R,B,z,Ue]),pa=He=>{Ae(_e,"lastItemKeys",zi),Ae(_e,"numColumns",Ue);let pt=ie(_e,"stylePaddingTop");SW(_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),QR(Ie),YR(_e,!0));let $i=H(()=>{var He,pt;let yn=Ie.initialScroll;if(!yn)return;let rn=(He=yn.contentOffset)!=null?He:zr(_e,yn);return on&&((pt=Ie.initialScrollSession)==null?void 0:pt.kind)==="bootstrap"&&qa.OS==="web"?void 0:rn},[on]);he(()=>{p4(_e,{alwaysDispatchInitialScroll:Bt,dataLength:R.length,hasFooterComponent:!!lt,initialContentOffset:$i,initialScrollAtEnd:le,useBootstrapInitialScroll:on})},[]),(Fn||no||Ie.didColumnsChange)&&(Ht.current.lastBatchingAction=Date.now(),!dt&&!Fn&&no&&(Ht.current.sizes.clear(),Ht.current.positions.length=0,Ht.current.totalSize=0,Ae(_e,"totalSize",0))),Vo&&YV(t),he(()=>{qr&&wC(_e,{resetInitialScroll:!!xo,resetLayout:!0}),m4(_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&&(Ie.scrollForNextCalculateItemsInView=void 0,(He=Ie.triggerCalculateItemsInView)==null||He.call(Ie)),sg(_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,lW(_e,He)},[_e,zt]);let so=$(He=>{on&&Xq(_e,{dataLength:R.length,footerSize:He[ue?"width":"height"],initialScrollAtEnd:le,stylePaddingEnd:yt})},[R.length,le,ue,yt,on]),Ao=$((He,pt)=>{let yn=Ie.scrollLength,rn=Ie.otherAxisSize;tW(_e,He,On),sg(_e);let Xo=yn!==Ie.scrollLength||rn!==Ie.otherAxisSize;on&&!pt&&Xo&&Yq(_e),!on&&Au(_e)},[R.length,le,yt,on]),{onLayout:Ya}=NC({onLayoutChange:Ao,onLayoutProp:fn,ref:hr});he(()=>{tt&&XR(_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}}=Ie;!(rn.length>0&&uN(_e))&&!yn&&(pt||He)&&JV(_e,rn,{didColumnsChange:He}),pt&&(Ie.pendingDataComparison=void 0),Ie.didColumnsChange=!1,Ie.didDataChange=!1,Ie.isFirst=!1},[R,B,z,Ue,Go]),he(()=>{var He;Ae(_e,"extraData",W);let pt=Sn.current!==yr;Sn.current=yr,(yr||pt)&&Ue>1&&((He=Ie.triggerCalculateItemsInView)==null||He.call(Ie,{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=C4({onViewableItemsChanged:ln,viewabilityConfig:jt,viewabilityConfigCallbackPairs:nn});Ie.viewabilityConfigCallbackPairs=He,Ie.enableScrollForNextCalculateItemsInView=!0,He&&(Ie.scrollForNextCalculateItemsInView=void 0)},[jt,nn,ln]),J4(()=>{}),Qr(n,()=>vW(_e,Js),[]),q(()=>()=>{GK(Ie),Ie.scheduledWork.dispose()},[Ie]),he(()=>{var He;(He=Ie.runPendingScrollToEnd)==null||He.call(Ie)}),q(()=>{on||Au(_e)},[_e,on]);let Mo=H(()=>({getRenderedItem:He=>CW(_e,He),onMomentumScrollEnd:He=>{u4(_e),Ie.props.onMomentumScrollEnd&&Ie.props.onMomentumScrollEnd(He)},onScroll:He=>aW(_e,He),onScrollBeginDrag:He=>{var pt,yn;$M(_e),(yn=(pt=Ie.props).onScrollBeginDrag)==null||yn.call(pt,He)},onScrollEnd:()=>$M(_e)}),[]),Ja=uW(Kn,ue,_e,Mo.onScroll),zo=Gt;return Le(oi,null,Le(VV,{...Tt,alignItemsAtEnd:L,canRender:ua,contentContainerStyle:Zn,contentInset:N,freshDataTransitionEpoch:Ie.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?af(zo,{progressViewOffset:((w=zo.props.progressViewOffset)!=null?w:0)+eo}):zo:tn&&Le(cW,{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&&WK)});var PW=LW;var fN=PW;pe();pe();function EW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function AW(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${EW(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function _C(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return AW(n,e.subProvider)}function md(e){return _C(e,{preferShortName:!0})}var DC="model:",OC="legacy-models:",FC="action:",gd="pluginActions:manage";function Du(e,t){return`${DC}${e.length}:${e}${t}`}function zC(e){if(!e.startsWith(DC))return null;let t=e.slice(DC.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 $C(e){return`${OC}${e}`}function pN(e){return e.startsWith(OC)?e.slice(OC.length):null}function Ou(e){return`${FC}${e}`}function mN(e){if(!e.startsWith(FC))return null;let t=e.slice(FC.length);return t.length>0?t:null}var BC="choice:";function HC(e){return`${BC}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function gN(e){if(!e.startsWith(BC))return null;try{let t=JSON.parse(e.slice(BC.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 hN=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??Du(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):_C(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(Pf,{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 Cg(e){return e==="ready"}function vN(e){return e==="ready"||e==="unchecked"||e==="checking"}function xN(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 Fu(e){return e.enabled&&vN(e.readiness)}function yN(e){return e.enabled}function CN(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 bg=e=>e.enabled;function Ig(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&bg(n))return n}return e.find(n=>n.enabled&&Cg(n.readiness))??e.find(Fu)??e.find(n=>bg(n)&&n.readiness!=="error")}function bN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}pe();function MW(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(Cg(o))return n;let r=xN(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 RW="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",NW="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 ",_W=`${NW} text-update-foreground`,IN="left",SN=8,wN="max-w-64 text-balance font-normal leading-snug",TN=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(RW,"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:IN,sideOffset:SN,align:"center",className:wN,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Fu(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?MW(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:_W,"aria-hidden":!0,children:u(gf,{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:IN,sideOffset:SN,align:"center",className:wN,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 DW(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 UC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function OW(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+UC(t,n);if(e.boundaryBase!==void 0){let o=OW(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+UC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+UC(t,n)}if(e.fuzzyBase!==void 0){let o=DW(t,n);if(o!==null)return e.fuzzyBase+o}return null}function FW(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function BW(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;FW(t,a)<0?o=r:n=r+1}return n}function Sg(e,t,n){if(n<=0)return;let o=BW(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var zW=24;function $W(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)]:[],KC(e),...e.slug?[ho(e.slug)]:[]]}function HW(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 KC(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 LN(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=HW(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function kN(e,t){let n=LN($W(e),t);return n===null?null:e.isFavorite?n-zW:n}function PN(e,t){return LN([ho(e.title),ho(e.description??"")],t)}function EN({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 wg(e,t){return`${e}:${t}`}var AN=new Map,MN=[],UW=[],KW=[];function Bu(e){return e.choiceKey??Du(e.instanceId,e.slug)}function RN(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 qW(){return u("div",{className:"h-0.5"})}function qC(e){return e?.trim()||null}function NN({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 VW=ce(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=ze(),i=qC(o.description);return b(xe,{children:[r?u(NN,{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})]})]})]})}),WW=ce(function({index:t,showSectionHeader:n}){let{t:o}=ze();return b(xe,{children:[n?u(NN,{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")})]})]})}),_N=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??MN,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?KW: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})},[]),be=$(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=>wg(D.instanceId,D.model))),[B]),Be=$(D=>N===null?!1:B.some(X=>RN(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]),we=H(()=>{let D=new Set;for(let X of r)Fu(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&&we.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||!we.has(tt))continue;let vt=ge.get(tt);if(!vt)continue;let xt=o.get(tt)?.find(nn=>nn.slug===de.modelId),jt=HC({environmentId:de.selection.environmentId,runtimeId:de.runtimeId,sourceId:de.sourceId,profileId:de.profileId,endpointId:de.endpointId});X.add(wg(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(wg(de.instanceId,de.slug)));return[...se,...re]}return D},[c,o,ge,we]),te=t.lockedProvider!==null,Te=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(yN);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=!Te&&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:kN({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:KC({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(Te||z==="favorites")return null;let D=Vt.filter(se=>!se.isLegacy),X=Vt.filter(se=>se.isLegacy);return X.length===0?null:{key:$C(z),currentModels:D,legacyModels:X,isExpanded:O.has(z)}},[O,Vt,Te,z]),Me=H(()=>it?[...it.currentModels,...it.isExpanded?it.legacyModels:[]]:Vt,[Vt,it]),Oe=m!==void 0,Ue=H(()=>{if(!Oe)return MN;let D=C.trim();return D.length===0?h:h.map(X=>({action:X,score:PN(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&&(!Te||Ue.length>0),Ee=H(()=>et?[...Ue.map(D=>Ou(D.id)),gd]:UW,[et,Ue]),Ce=H(()=>new Map(Ue.map(D=>[Ou(D.id),D])),[Ue]),ht=Ee[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=pN(D);if(X){Wt(X);return}if(D===gd){p?.();return}let se=mN(D);if(se!==null){m?.(se);return}let re=gN(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=zC(D);de&&Ft(de.slug,de.instanceId)},[c,Ft,d,p,m,Wt]),tn=$(D=>{if(N===null)return;let X=R.findIndex(re=>RN(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 Me){if(se.ready===!1||fn(se.instanceId,se.slug).kind==="blocked")continue;let re=y.keybindings.modelPickerJumpCommandForIndex(X);if(!re)return D;D.set(Bu(se),re),X+=1}return D},[fn,Me]),Un=H(()=>[...Rt.keys()],[Rt]),kn=H(()=>[...ye.map(D=>Bu(D)),...new Set(ye.filter(D=>D.isLegacy).map(D=>$C(D.instanceId))),...Oe?[...h.map(D=>Ou(D.id)),gd]:[]],[ye,h,Oe]),pn=H(()=>{let D=Me.map(X=>Bu(X));return it&&D.splice(it.currentModels.length,0,it.key),Ee.length>0?[...D,...Ee]:D},[it,Ee,Me]),Pn=H(()=>new Map(Me.map(D=>[Bu(D),D])),[Me]),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 AN;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:AN},[ee,Rt,ln]),io=g===null?f?HC(f):Du(t.activeInstanceId,t.model):Ou(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=zC(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(JI,{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(TN,{selectedInstanceId:z,onSelectInstance:be,instanceEntries:ct,showFavorites:!0,...dt?{disabledInstanceIds:dt,getDisabledInstanceTooltip:D=>x("instance.lockedToThread",{name:D.displayName})}:{}}),u(jI,{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(XI,{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(YI,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(fN,{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=Ce.get(D);if(se)return u(VW,{index:X,itemKey:D,action:se,showSectionHeader:D===ht});if(D===gd)return u(WW,{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(hN,{index:X,model:re,instanceId:re.instanceId,itemKey:Bu(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:qW,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",EN({top:k,bottom:L}))})})}),u(QI,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:v("modelPicker.noModelsFound")})]})})]})})});var DN="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(DN,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 Tg({className:e,size:t="sm",variant:n="ghost",...o}){return u(RI,{className:F(DN,e),icon:u(Fi,{}),size:t,variant:n,...o})}function GW(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 jW(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 ON=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=jW(t.composerChoices,t.selectedExecutionSelection),f=GW({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?qC(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(_N,{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 FN=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(Ef,{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(Rf,{className:"max-h-72 scroll-pb-6",children:u(Af,{children:t.items.map(o=>u(QW,{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.")})})})})}),QW=ce(function(t){let n=t.item.type==="skill"?gM(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Mf,{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(Vm,{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(JW,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),XW={app:Md,repo:li,project:li,personal:Zr,system:Xd,other:Wd},YW={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function JW(e){let t=XW[e.kind];return b(ml,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),YW[e.kind],e.showSkillSuffix?" Skill":null]})}pe();function ZW(e){return e!==null&&"tagName"in e&&"closest"in e}function Lg(e){return ZW(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function VC(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function BN(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function zN(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return BN(t,"accept");case"Escape":return BN(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=VC(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var eG=2e3,tG="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",nG=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function oG(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 WC=ce(function({requestId:t,isResponding:n,options:o=nG,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=Lg(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=zN(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":oG(g.decision,v),className:`${tG}${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(Pf,{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(mf,{type:"text",value:c,disabled:n,maxLength:eG,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 kg=["approval-required","auto-accept-edits","auto","full-access"];var rG={"approval-required":qd,"auto-accept-edits":Jr,auto:ci,"full-access":di},aG={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Pg(){let{t:e}=ze();return $(t=>{let n=aG[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:rG[t]}},[e])}var $N=ce(function(t){let{t:n}=ze(),o=Pg();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:kg.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 iG=(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"),sG=e=>{e.preventDefault()},Eg=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:sG}: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:iG(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(eS,{compact:!0})}):null,l||i?u(gf,{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 lG=["command","cmd"],dG=["file_path","filePath","path","notebook_path","notebookPath"],cG=["url"],uG=["query","q"],fG=["name","skill","skill_name","skillName"],HN=["toolName","tool_name"],UN=["description"],pG=[],mG=[];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 gG(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function hG(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function qN(e){let t=e.args??pG,n=e.fileChanges??mG,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,lG,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Ga(t,dG,o)??hG(n);d!==null&&(i=gG(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Ga(t,cG,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Ga(t,uG,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Ga(t,fG,o)??Ga(t,HN,o),l=Ga(t,UN,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Ga(t,HN,o),l=Ga(t,UN,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 vG={"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"},xG={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"},yG={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"},CG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function VN(e,t){let n=e.subject!==null?vG[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(xG[e.kind])}function WN(e,t){return t(yG[e])}function GN(e,t){return t(CG[e])}function jN(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=KN(t.oldText??""),o=KN(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
|
|
3712
|
+
`?d.insertParagraph():c===" "?d.insertNodes([iP()]):d.insertText(c)}}}else t.insertRawText(i)}function Ky(e,t,n){e.dispatchCommand(JP,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(we(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=jl(r,"previous");if(i)if(sm(i))a=i.origin;else{let s=lP(i,ki(Ct(),"next").getFlipped());for(let l of s){if(tt(l.origin)){a=l.origin;break}if(Ke(l.origin)&&!l.origin.isInline())break}}if(a&&tt(a)){let s=a.getFormat(),l=a.getStyle();o.format===s&&o.style===l||(o.format=s,o.style=l,o.dirty=!0)}}})(n))}function XE(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=Ke(n)&&n.excludeFromCopy("html"),i=n;t!==null&&tt(i)&&(i=Rm(t,i,"clone"));let s=Ke(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Vm(58,f.name),Ke(d)){let p=c.children;Array.isArray(p)||Vm(59,f.name)}return c})(i);tt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=XE(e,t,c,l.children);!r&&Ke(n)&&f&&n.extractWithChild(c,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let c=l.children[d];o.push(c)}return r}function YE(e,t){let n=[],o=Ct().getChildren();for(let r=0;r<o.length;r++)XE(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function JE(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=CP(o);tt(r)&&AA(r),t.push(r)}return t}var nd=null;async function U3(e,t,n){if(nd!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(GE(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=Jx(r);if(o===null||i===null)return!1;let s=a.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(a.createTextNode("#")),o.append(s);let l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(fm,p=>(su(p,ClipboardEvent)&&(f(),nd!==null&&(r.clearTimeout(nd),nd=null),d(GE(e,p,n))),!0),um);nd=r.setTimeout(()=>{f(),nd=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function GE(e,t,n){if(n===void 0){let r=Jx(e._window),a=Oe();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!fA(e,i,s))return!1;n=eM(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(tM(o,n),!0)}var ZE=[["text/html",jE],["application/x-lexical-editor",QE]];function eM(e=Oe()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=om();for(let[o,r]of ZE){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function tM(e,t){for(let[n]of ZE)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var ia=qy,Mie=ia.$generateJSONFromSelectedNodes,Rie=ia.$generateNodesFromSerializedNodes,Nie=ia.$getClipboardDataFromSelection,nM=ia.$getHtmlContent,_ie=ia.$getLexicalContent,Vy=ia.$insertDataTransferForPlainText,Die=ia.$insertDataTransferForRichText,Oie=ia.$insertGeneratedNodes,Fie=ia.copyToClipboard,Bie=ia.setLexicalClipboardDataTransfer;var Wy={};An(Wy,{PlainTextExtension:()=>Q3,registerPlainText:()=>aM});var Bs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,K3=Bs&&"documentMode"in document?document.documentMode:null,q3=Bs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),V3=!(!Bs||!("InputEvent"in window)||K3)&&"getTargetRanges"in new window.InputEvent("input"),W3=Bs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),oM=Bs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,G3=Bs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),j3=Bs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&q3&&!G3;function rM(e,t){t.update(()=>{if(e!==null){let n=su(e,KeyboardEvent)?null:e.clipboardData,o=Oe();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=nM(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function aM(e){return Fa(e.registerCommand(pm,t=>{let n=Oe();return!!we(n)&&(n.deleteCharacter(t),!0)},Xt),e.registerCommand(NP,t=>{let n=Oe();return!!we(n)&&(n.deleteWord(t),!0)},Xt),e.registerCommand(RP,t=>{let n=Oe();return!!we(n)&&(n.deleteLine(t),!0)},Xt),e.registerCommand(EP,t=>{let n=Oe();if(!we(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Vy(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Xt),e.registerCommand(XP,()=>{let t=Oe();return!!we(t)&&(t.removeText(),!0)},Xt),e.registerCommand(Yx,t=>{let n=Oe();return!!we(n)&&(n.insertLineBreak(t),!0)},Xt),e.registerCommand(zP,()=>{let t=Oe();return!!we(t)&&(t.insertLineBreak(),!0)},Xt),e.registerCommand(gm,t=>{let n=Oe();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!0)&&(o.preventDefault(),uy(n,r,!0),!0)},Xt),e.registerCommand(hm,t=>{let n=Oe();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!1)&&(o.preventDefault(),uy(n,r,!1),!0)},Xt),e.registerCommand(vm,t=>{let n=Oe();return!!we(n)&&(!oM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(pm,!0))},Xt),e.registerCommand(KP,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),e.dispatchCommand(pm,!1))},Xt),e.registerCommand(xm,t=>{let n=Oe();if(!we(n))return!1;if(t!==null){if((oM||W3||j3)&&V3)return!1;t.preventDefault()}return e.dispatchCommand(Yx,!1)},Xt),e.registerCommand(ZP,()=>(lm(),!0),Xt),e.registerCommand(fm,t=>{let n=Oe();return!!we(n)&&(rM(t,e),!0)},Xt),e.registerCommand(MP,t=>{let n=Oe();return!!we(n)&&((function(o,r){rM(o,r),r.update(()=>{let a=Oe();we(a)&&a.removeText()})})(t,e),!0)},Xt),e.registerCommand(Cm,t=>{let n=Oe();return!!we(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Oe(),i=su(o,ClipboardEvent)?o.clipboardData:null;i!=null&&we(a)&&Vy(i,a)},{tag:GP})})(t,e),!0)},Xt),e.registerCommand(DP,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),!0)},Xt),e.registerCommand(_P,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),!0)},Xt))}var Q3=Mn({conflictsWith:["@lexical/rich-text"],dependencies:[zE],name:"@lexical/plain-text",register:aM});var iM=Wy,Vie=iM.PlainTextExtension,sM=iM.registerPlainText;var jy={};An(jy,{PlainTextPlugin:()=>Z3});me();var Wm=Sd(pc(),1);function X3(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Gy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function Y3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return Gy(()=>n.registerDecoratorListener(i=>{(0,Wm.flushSync)(()=>{a(i)})}),[n]),q(()=>{a(n.getDecorators())},[n]),z(()=>{let i=[],s=Object.keys(r);for(let l=0;l<s.length;l++){let d=s[l],c=u(o,{onError:p=>n._onError(p),children:u(ih,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,Wm.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function J3({editor:e,ErrorBoundary:t}){return(function(n){let o=wE.maybeFromEditor(n);if(o&&o.hasExtensionByName(OE.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&X3(320,r);return!0}return!1})(e)?null:u(Y3,{editor:e,ErrorBoundary:t})}function lM(e){return e.getEditorState().read(Pm(e.isComposing()))}function Z3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=In();return(function(r){Gy(()=>Fa(sM(r),$E(r)),[r])})(o),b(be,{children:[e,u(eK,{content:t}),u(J3,{editor:o,ErrorBoundary:n})]})}function eK({content:e}){let[t]=In(),n=(function(r){let[a,i]=G(()=>lM(r));return Gy(()=>{function s(){let l=lM(r);i(l)}return s(),Fa(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=DE();return n?typeof e=="function"?e(o):e:null}var tK=jy,dM=tK.PlainTextPlugin;me();function cM(e){return/mac|iphone|ipad|ipod/i.test(e)}function fu(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function pu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function uM(e){let t=pu(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}me();var Gm=ue(function(t){let n=Ot().pierreIcons,o=n.useSpriteReady();wd(n.ensureSprite,[n]);let r=z(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:F("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(oi,{className:F("size-4 shrink-0 text-icon-muted",t.className)}):u(_d,{className:F("size-4 shrink-0 text-icon-muted",t.className)})});var fM=mi;function pM(e){return b(be,{children:[u(Gm,{pathValue:e.path,kind:uM(e.path),theme:e.theme,className:Zr}),u("span",{className:e.selectable?xT:ea,children:e.label})]})}function mM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Qe,{children:[u(Ye,{render:b("span",{className:F(mi,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(ba,{className:F(Zr,"size-icon-1",o&&"opacity-100")}),u("span",{className:ea,children:t})]})}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function gM({context:e}){let{t}=De(),n=Gw(e),o=Ww(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(mM,{label:n,tooltipText:r,expired:o})}function nK(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function oK(e){return e.replaceAll("\\","/")}function sa(e){let t=e.displayName?.trim();return t||nK(e.name)}function hM(e,t){return t?e.filter(n=>n.enabled):[]}function vM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function xM(e){let t=oK(e.path);if(t.includes("/.codex/plugins/")||t.includes("/.agents/plugins/"))return"app";switch(e.scope?.trim().toLowerCase()){case"repo":case"repository":return"repo";case"project":case"workspace":case"local":return"project";case"user":case"personal":return"personal";case"system":return"system";case void 0:case"":return"other";default:return"other"}}function yM(e,t){return e.registerCommand(Cm,n=>{if(!(n instanceof ClipboardEvent)||n.clipboardData===null||n.clipboardData.files.length>0)return!1;let o=n.clipboardData.getData("text/plain");if(o.length===0)return!1;let r=wc(`${o}
|
|
3713
|
+
`).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=Oe();if(!we(a))return!1;let i=[],s=c=>{let f=c.split(`
|
|
3714
|
+
`);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(Mr(m)),p<f.length-1&&i.push(Ms())}},l=r[0];if(l&&l.start===0){let c=a.isBackward()?a.focus:a.anchor,f=t.getExpandedAbsoluteOffsetForPoint(c.getNode(),c.offset),p=Ct().getTextContent().slice(f-1,f);p.length>0&&!/\s/.test(p)&&i.push(Mr(" "))}let d=0;for(let c of r)c.start<d||(c.start>d&&s(o.slice(d,c.start)),i.push(t.createMentionNode(c.value)),d=c.end);return d<o.length?s(o.slice(d)):i.push(Mr(" ")),a.insertNodes(i),n.preventDefault(),!0},Nr)}var od=new Map,rK=32;function CM(e,t){for(od.delete(e),od.set(e,t);od.size>rK;){let n=od.keys().next().value;if(n===void 0)break;od.delete(n)}}function aK(e){return{anchor:e.length,focus:e.length}}function Ba(e,t,n){let o=od.get(e);if(o)return CM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:aK(t),history:NE()};return CM(e,r),r}function rd(e,t,n){let o=Ba(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function bM(e,t,n,o){let r=Ba(e,t);r.cursor=n,r.expandedCursor=o}function IM(e,t){let n=e.current,o=[...e.undoStack],r=[...e.redoStack];t(),e.current=n,e.undoStack.splice(0,e.undoStack.length,...o),e.redoStack.splice(0,e.redoStack.length,...r)}var iK=`composer-editor-${Math.random().toString(36).slice(2)}`,sK=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],kM=new Map(sK),SM=kM.get("`")??null,PM=Ht({onRemoveTerminalContext:()=>{}});function lK(e){let t=fK(),n=u("span",{className:fM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(pM,{path:e.path,label:pu(e.path),theme:t})});return b(Qe,{children:[u(Ye,{render:n}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var mu=class e extends Oa{__path;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__key)}static importJSON(t){return Jy(t.path).updateFromJSON(t)}constructor(t,n){super(n),this.__path=t}exportJSON(){return{...super.exportJSON(),path:this.__path,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return Sc(this.__path)}isInline(){return!0}decorate(){return u(lK,{path:this.__path})}};function Jy(e){return tm(new mu(e))}function dK(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function gu(e){return new Map(e.map(t=>[t.name,{label:sa(t),description:dK(t)}]))}function cK(e){let t=b("span",{className:yT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:Zr,dangerouslySetInnerHTML:{__html:CT}}),u("span",{className:ea,children:e.skillLabel})]});return e.skillDescription?b(Qe,{children:[u(Ye,{render:t}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var hu=class e extends Oa{__skillName;__skillLabel;__skillDescription;static getType(){return"composer-skill"}static clone(t){return new e(t.__skillName,t.__skillLabel,t.__skillDescription,t.__key)}static importJSON(t){return AM(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,n,o,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=n,this.__skillDescription=o}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(cK,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function AM(e,t,n){return tm(new hu(e,t,n))}function uK(e){return u(gM,{context:e.context})}var zs=class e extends Oa{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return EM(t.context)}constructor(t,n){super(n),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(uK,{context:this.__context})}};function EM(e){return tm(new zs(e))}function Ei(e){return e instanceof mu||e instanceof hu||e instanceof zs}function fK(){return document.documentElement.classList.contains("dark")?"dark":"light"}function pK(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function mK(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function jm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Xm(e){return 1}function MM(e){return e.getTextContentSize()}function gK(e,t,n){return t+(n>0?Xm(e):0)}function hK(e,t,n){return t+(n>0?MM(e):0)}function vK(e,t){let n=e.getParent();if(!n||!Ke(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===Xm(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=Xm(e),null)}function Ym(e){return Ei(e)?Xm(e):tt(e)?e.getTextContentSize():Xl(e)?1:Ke(e)?e.getChildren().reduce((t,n)=>t+Ym(n),0):0}function Xy(e){return Ei(e)?MM(e):tt(e)?e.getTextContentSize():Xl(e)?1:Ke(e)?e.getChildren().reduce((t,n)=>t+Xy(n),0):0}function vu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ke(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Ym(l))}o=r}if(tt(e))return n+Math.min(t,e.getTextContentSize());if(Ei(e))return gK(e,n,t);if(Xl(e))return n+Math.min(t,1);if(Ke(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Ym(s))}return n}return n}function Jm(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ke(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Xy(l))}o=r}if(tt(e))return n+Math.min(t,e.getTextContentSize());if(Ei(e))return hK(e,n,t);if(Xl(e))return n+Math.min(t,1);if(Ke(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Xy(s))}return n}return n}function Zm(e,t){if(Ei(e))return vK(e,t);if(tt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(Xl(e)){let n=e.getParent();if(!n)return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===1?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=1,null)}if(Ke(e)){let n=e.getChildren();for(let o of n){let r=Zm(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function eg(){return Ct().getChildren().reduce((n,o)=>n+Ym(o),0)}function $s(e){let t=Ct(),n=eg(),r={value:Math.max(0,Math.min(e,n))},a=Zm(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=Rs();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Rr(i)}function Qm(e,t){let n=Ct(),o=eg(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=Zm(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=Zm(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=Rs();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Rr(c)}function wM(e){if(!we(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Jm(t,e.anchor.offset),r=Jm(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function TM(e){return we(e)?e.getNodes().some(t=>Ei(t)):!1}function xu(e){let t=Oe();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=vu(n,t.anchor.offset),r=eg();return Math.max(0,Math.min(o,r))}function LM(e){let t=Oe();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Jm(n,t.anchor.offset),r=Ct().getTextContent().length;return Math.max(0,Math.min(o,r))}function Qy(e){let t=Oe();return we(t)?{anchor:vu(t.anchor.getNode(),t.anchor.offset),focus:vu(t.focus.getNode(),t.focus.offset)}:e}function xK(e,t){let n=t.split(`
|
|
3715
|
+
`);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Mr(r)),o<n.length-1&&e.append(Ms())}}function Zy(e,t,n){let o=Ct();o.clear();let r=ur();o.append(r);let a=ys(e,t);for(let i of a){if(i.type==="mention"){r.append(Jy(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(AM(i.name,s?.label??sa({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(EM(i.context));continue}xK(r,i.text)}}function Yy(e){return e instanceof zs?[e.__context.id]:Ke(e)?e.getChildren().flatMap(t=>Yy(t)):[]}function yK(e){let[t]=In();return q(()=>{let n=(s,l)=>{if(!e.onCommandKeyDown||!l)return!1;if(s==="Enter"&&(l.isComposing||l.keyCode===229))return l.stopPropagation(),!0;let d=e.onCommandKeyDown(s,l);return d&&(l.preventDefault(),l.stopPropagation()),d},o=t.registerCommand(HP,s=>n("ArrowDown",s),Nr),r=t.registerCommand(UP,s=>n("ArrowUp",s),Nr),a=t.registerCommand(xm,s=>n("Enter",s),Nr),i=t.registerCommand(ym,s=>n("Tab",s),Nr);return()=>{o(),r(),a(),i()}},[t,e]),null}function CK(){let[e]=In();return q(()=>{let t=e.registerCommand(gm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Oe();if(!we(i)||!i.isCollapsed())return;let s=xu(0);if(s<=0)return;let l=Ct().getTextContent();Tc(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{$s(a)}),!0},Nr),n=e.registerCommand(hm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Oe();if(!we(i)||!i.isCollapsed())return;let s=xu(0),l=eg();if(s>=l)return;let d=Ct().getTextContent();Tc(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{$s(a)}),!0},Nr);return()=>{t(),n()}},[e]),null}function bK(){let[e]=In();return q(()=>e.registerCommand(qP,t=>{if(!cM(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let n=e.getRootElement(),o=window.getSelection(),r=o?.anchorNode;return!n||!o||!r||!n.contains(r)||o.rangeCount===0||typeof o.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),o.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{Rr(aP(o,e))}),!0)},Nr),[e]),null}function IK(){let[e]=In();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Oe();if(!we(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Ei(r)||o.anchor.offset===0)return;n=vu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{$s(n)})})}),[e]),null}function SK(){let[e]=In(),{onRemoveTerminalContext:t}=Ut(PM);return q(()=>e.registerCommand(vm,n=>{let o=Oe();if(!we(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=xu(0),i=s=>{if(!Ei(s))return!1;let l=vu(s,0);return s.remove(),s instanceof zs?(t(s.__context.id),$s(a)):$s(l),n?.preventDefault(),!0};if(i(r))return!0;if(tt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(Ke(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(Ke(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},Nr),[e,t]),null}function wK(){let[e]=In();return q(()=>{let t=new Set,n=e.getRootElement()===document.activeElement,o=l=>{for(let d of t)l.has(d)||e.getElementByKey(d)?.removeAttribute("data-composer-chip-selected");for(let d of l)e.getElementByKey(d)?.setAttribute("data-composer-chip-selected","true");t=l},r=()=>{let l=new Set;return e.getEditorState().read(()=>{let d=Oe();if(we(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Oa&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(OP,()=>(n=!0,o(r()),!1),Yl),s=e.registerCommand(TP,()=>(n=!1,o(new Set),!1),Yl);return()=>{a(),i(),s()}},[e]),null}function TK(){let[e]=In();return q(()=>yM(e,{createMentionNode:Jy,getExpandedAbsoluteOffsetForPoint:Jm}),[e]),null}function LK(e){let[t]=In(),n=_(e.terminalContexts),o=_(gu(e.skills)),r=_(null),a=_(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=gu(e.skills)},[e.skills]);let i=lh(s=>{let l=kM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let g=Oe();if(!we(g)||g.isCollapsed()||TM(g))return null;let v=wM(g);if(!v||v.start===v.end)return null;let x=Ct().getTextContent();return lv(x,v.start,v.end)?null:{value:x,expandedStart:v.start,expandedEnd:v.end}})();if(!f||!l)return;let p=f.value.slice(f.expandedStart,f.expandedEnd),m=`${f.value.slice(0,f.expandedStart)}${s}${p}${l}${f.value.slice(f.expandedEnd)}`;Zy(m,n.current,o.current);let h=sr(m,f.expandedStart);Qm(h+s.length,h+s.length+p.length),c=!0,r.current=null}),c});return q(()=>{let s=h=>{if(a.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;a.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){r.current=null,a.current=null;return}t.getEditorState().read(()=>{let g=Oe();if(!we(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(TM(g)){r.current=null,a.current=null;return}let v=wM(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=Ct().getTextContent();if(lv(x,v.start,v.end)){r.current=null,a.current=null;return}let y={value:x,expandedStart:v.start,expandedEnd:v.end};r.current=y,a.current=null})},l=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&SM!==null&&r.current){a.current=r.current;return}if(a.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){r.current=null;return}let g=h.inputType==="insertText"?h.data:null;if(!g||g.length!==1){r.current=null;return}i(g)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},d=h=>{queueMicrotask(()=>{t.update(()=>{let g=a.current;if(!g)return;let v=Ct().getTextContent(),x=SM;if(x===null){a.current=null;return}let y=`${g.value.slice(0,g.expandedStart)}\`${g.value.slice(g.expandedEnd)}`;if(v!==y){h?.finalAttempt&&(r.current=null,a.current=null);return}let C=g.value.slice(g.expandedStart,g.expandedEnd),w=sr(v,g.expandedStart);Qm(w,w+1);let k=Oe();if(!we(k)){r.current=null,a.current=null;return}k.insertText(`\`${C}${x}`),Qm(w+1,w+1+C.length),r.current=null,a.current=null},{tag:_r})})},c=h=>{let g=h;(g.inputType==="insertText"||g.inputType==="insertCompositionText")&&d()},f=()=>{d({finalAttempt:!0})},p=null,m=t.registerRootListener((h,g)=>{g?.removeEventListener("keydown",s),g?.removeEventListener("beforeinput",l,!0),g?.removeEventListener("input",c),g?.removeEventListener("compositionend",f),h?.addEventListener("keydown",s),h?.addEventListener("beforeinput",l,!0),h?.addEventListener("input",c),h?.addEventListener("compositionend",f),p=h});return()=>{p&&(p.removeEventListener("keydown",s),p.removeEventListener("beforeinput",l,!0),p.removeEventListener("input",c),p.removeEventListener("compositionend",f)),m()}},[t]),null}function kK({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let[m]=In(),h=_(d);h.current=d;let g=ir(t,n),v=Ba(e,t,{cursor:g,expandedCursor:Ir(t,g)}),x=ir(t,v.cursor),y=pK(o),C=_(y),w=mK(r),k=_(w),S=_(gu(r)),L=_({value:t,cursor:x,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(H=>H.id)}),I=_(e),T=v.history,E=_(!1),A=z(()=>({onRemoveTerminalContext:l}),[l]);ye(()=>{S.current=gu(r)},[r]),q(()=>{m.setEditable(!a)},[a,m]),ye(()=>{let H=ir(t,n),K=L.current,O=I.current,oe=O!==e,ee=C.current!==y,W=k.current!==w;if(!oe&&K.value===t&&K.cursor===H&&!ee&&!W)return;if(oe){let Ee=K.selection;m.getEditorState().read(()=>{Ee=Qy(Ee)}),rd(O,K.value,{cursor:K.cursor,expandedCursor:K.expandedCursor,selection:Ee})}let qe=Ba(e,t),ve=oe?qe.selection:{anchor:H,focus:H};L.current={value:t,cursor:oe?qe.cursor:H,expandedCursor:oe?qe.expandedCursor:Ir(t,H),selection:ve,terminalContextIds:o.map(Ee=>Ee.id)},I.current=e,C.current=y,k.current=w;let fe=m.getRootElement(),Ne=!!(fe&&document.activeElement===fe);if(!oe&&K.value===t&&!ee&&!W&&!Ne)return;let Ae=oe?Ba(O,K.value).history:null;E.current=!0;let ae=()=>m.update(()=>{let Ee=oe||K.value!==t||ee||W;Ee&&Zy(t,o,S.current),oe?Qm(ve.anchor,ve.focus):(Ee||Ne)&&$s(H)},{discrete:!0,tag:_r});Ae?IM(Ae,ae):ae(),rd(e,t,L.current),queueMicrotask(()=>{E.current=!1})},[n,e,m,w,o,y,t]);let N=B(H=>{let K=m.getRootElement();if(!K)return;let O=ir(L.current.value,H);K.focus({preventScroll:!0}),m.update(()=>{$s(O)}),L.current={value:L.current.value,cursor:O,expandedCursor:Ir(L.current.value,O),selection:{anchor:O,focus:O},terminalContextIds:L.current.terminalContextIds},rd(I.current,L.current.value,{cursor:L.current.cursor,expandedCursor:L.current.expandedCursor,selection:L.current.selection}),h.current(L.current.value,O,L.current.expandedCursor,!1,L.current.terminalContextIds)},[m]),R=B(()=>{let H=L.current;return m.getEditorState().read(()=>{let K=Ct().getTextContent(),O=ir(K,L.current.cursor),oe=ir(K,xu(O)),ee=jm(K,L.current.expandedCursor),W=jm(K,LM(ee)),qe=Yy(Ct()),ve=Qy(L.current.selection);H={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:qe}}),L.current=H,rd(I.current,H.value,H),H},[m]);Gr(p,()=>({focus:()=>{N(L.current.cursor)},focusAt:N,focusAtEnd:()=>{N(sr(L.current.value,L.current.value.length))},readSnapshot:R}),[N,R]);let $=B(H=>{H.read(()=>{let K=Ct().getTextContent(),O=ir(K,L.current.cursor),oe=ir(K,xu(O)),ee=jm(K,L.current.expandedCursor),W=jm(K,LM(ee)),qe=Yy(Ct()),ve=Qy(L.current.selection),fe=L.current;if(fe.value===K&&fe.cursor===oe&&fe.expandedCursor===W&&fe.selection.anchor===ve.anchor&&fe.selection.focus===ve.focus&&fe.terminalContextIds.length===qe.length&&fe.terminalContextIds.every((Ae,ae)=>Ae===qe[ae])||E.current)return;L.current={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:qe},rd(I.current,K,{cursor:oe,expandedCursor:W,selection:ve});let Ne=Tc(K,oe,"left")||Tc(K,oe,"right");h.current(K,oe,W,Ne,qe)})},[]);return u(PM,{value:A,children:b("div",{className:"relative [font-family:var(--font-composer,var(--font-sans))] [font-size:var(--font-size-prompt,0.875rem)] [@media(max-width:39.999rem)_and_(pointer:coarse)]:[font-size:max(var(--font-size-prompt,1rem),16px)]",children:[u(dM,{contentEditable:u(eE,{className:F("block max-h-50 min-h-17.5 w-full overflow-y-auto whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none",s),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":i,placeholder:u("span",{}),onPaste:f}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:tE}),u(_E,{onChange:$}),u(yK,{...c?{onCommandKeyDown:c}:{}}),u(LK,{terminalContexts:o,skills:r}),u(bK,{}),u(CK,{}),u(IK,{}),u(SK,{}),u(TK,{}),u(wK,{}),u(RE,{externalHistoryState:T},e)]})})}function PK(e){let[t]=In(),n=_(e),o=_(e),[r,a]=G(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,ye(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),q(()=>{let s=null,l=()=>{let c=o.current.documentKey;a(f=>f===c?f:c)},d=t.registerRootListener((c,f)=>{f?.removeEventListener("compositionend",l),c?.addEventListener("compositionend",l),s=c});return()=>{s?.removeEventListener("compositionend",l),d()}},[t]);let i=r===e.documentKey?e:n.current;return u(kK,{...i})}function RM({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let m=_(t),h=_(o),g=_(gu(r)),v=z(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[mu,hu,zs],editorState:()=>{Zy(m.current,h.current,g.current)},onError:x=>{throw x}}),[]);return u(mA,{initialConfig:v,children:u(PK,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:l,onChange:d,onPaste:f,editorRef:p,...c?{onCommandKeyDown:c}:{},...s?{className:s}:{}})},iK)}me();me();me();var xC=Sd(OM(),1),xR=Sd(pc(),1),yR=Sd(pc(),1);Wn(function(t,n){return Te("div",{ref:n,...t})});var cg=Wn(function(t,n){return Te("div",{ref:n,...t})}),fr=cg,Ua={OS:"web"};function Hs(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function yC(e,t){return t===void 0||!Number.isFinite(t)||!Number.isFinite(e.scrollLength)||t<=e.scrollLength?t!==void 0&&Number.isFinite(t)&&Number.isFinite(e.scrollLength)?0:void 0:Math.max(0,t-e.scrollLength)}function CR(){return"normal"}function BK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:CR()}function zK(e){var t;return(t=e?.rtl)!=null?t:!1}function qa(e){return CC(e?.props)}function CC(e){return!!e?.horizontal&&zK(e)}function bC(e){return e?.horizontal?(CC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function $K(e,t){var n;return(n=yC(e,t))!=null?n:0}function FM(e,t){return t&&(qa(e)?t.left:t.right)||0}function HK(e,t,n,o){return!qa(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function IC(e,t,n){if(!e||!qa(e))return t;let o=yC(e,n),r=Hs(t,o),a=BK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Hs(o-r,o):r}function UK(e,t,n){if(!qa(e))return e.horizontalRTLScrollType=void 0,t;let o=yC(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Hs(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let i=e.horizontalRTLScrollType;if(i==="inverted")return Hs(a,o);if(i==="normal")return Hs(r,o);if(!e.hasScrolled){let f=CR();return e.horizontalRTLScrollType=f,Hs(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Hs(c?a:r,o)}var KK=e=>e,ug=Ht(null),bR="\0",qK=0;function VK({children:e}){let[t]=G(()=>({animatedScrollY:KK(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:qK++,listeners:new Map,mapViewabilityAmountCallbacks:new Map,mapViewabilityAmountValues:new Map,mapViewabilityCallbacks:new Map,mapViewabilityConfigStates:new Map,mapViewabilityValues:new Map,pendingContainerIds:void 0,positionListeners:new Map,scrollAxisGap:0,state:void 0,values:new Map([["alignItemsAtEndPadding",0],["containerLayoutEpoch",0],["stylePaddingTop",0],["headerSize",0],["numContainers",0],["activeStickyIndex",-1],["isAtEnd",!1],["isAtStart",!1],["isNearEnd",!1],["isNearStart",!1],["isWithinMaintainScrollAtEndThreshold",!1],["adaptiveRender","normal"],["totalSize",0],["scrollAdjustPending",0]]),viewRefs:new Map}));return Te(ug.Provider,{value:t},e)}function Br(){return fn(ug)}function IR(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let i=0;i<t.length;i++){let s=de(e,t[i]);r.push(s),s!==o[i]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let i of t)a.push($a(e,i,r));return()=>{for(let i of a)i()}}}}function WK(e){return e.length===1?e[0]:e.join(bR)}function GK(e){return e.split(bR)}function $a(e,t,n){let{listeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function de(e,t){let{values:n}=e;return n.get(t)}function Pe(e,t,n){let{listeners:o,values:r}=e;if(r.get(t)!==n){r.set(t,n);let a=o.get(t);if(a)for(let i of a)i(n)}}function jK(e,t,n){let{positionListeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function QK(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Wo(e){let t=fn(ug),n=WK(e),{subscribe:o,get:r}=z(()=>IR(t,GK(n)),[t,n]);return(0,xC.useSyncExternalStore)(o,r,r)}function XK(e,t){let n=fn(ug),{subscribe:o,get:r}=z(()=>IR(n,[e]),[n,e]),a=B(()=>t(r()[0]),[r,t]);return(0,xC.useSyncExternalStore)(o,a,a)}function YK(e){return Math.max(0,e??0)}function Ks(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?FM(o,s):s?.bottom)||0,d=YK(t??r.contentInsetEndAdjustment),c=de(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let h={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?FM(o,h):h.bottom)||0)+d,f)}return Math.max(m,f)}function po(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,i=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,s=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=Ks(e),f=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:o.get("totalSize"),p=Math.max(0,f-(r.props.data.length>0?e.scrollAxisGap:0));return l+d+p+a+s+i+(c||0)}var id=({children:e})=>Te(cg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ue(function(){let t=Br(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Wo(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=po(t),[,c]=Za(f=>f+1,0);return JK(()=>{c()},100),Te(cg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Te(id,null,Te(fr,null,"TotalSize:"),Te(fr,null,n.toFixed(2))),Te(id,null,Te(fr,null,"ContentSize:"),Te(fr,null,d.toFixed(2))),Te(id,null,Te(fr,null,"At end:"),Te(fr,null,String(l))),Te(id,null,Te(fr,null,"ScrollAdjust:"),Te(fr,null,o.toFixed(2))),Te(id,null,Te(fr,null,"RawScroll: "),Te(fr,null,r.toFixed(2))),Te(id,null,Te(fr,null,"ComputedScroll: "),Te(fr,null,a.toFixed(2))))});function JK(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var SC=!0,SR=new WeakMap;function ZK(e){return SR.get(e)}function eq(e,t){SR.set(e,t)}var tq=typeof __DEV__<"u"?__DEV__:void 0,BM,zM=typeof process<"u"&&typeof process.env=="object"&&process.env?(BM="production")!=null?BM:process.env.MODE:void 0,$M=typeof zM=="string"?zM.toLowerCase()!=="production":void 0,HM,Vo=(HM=$M??tq)!=null?HM:!1,sd=-1e7,wR=1,nq=Vo&&!1,oq=Vo&&!1;function fg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function TR(e){var t,n;let o=(n=e.pendingScrollResolve)!=null?n:(t=e.pendingScrollToEnd)==null?void 0:t.resolve;e.pendingScrollResolve=void 0,e.pendingScrollToEnd=void 0,o?.()}function rq(e){fg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,TR(e)}function aq(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function iq(e,t){var n,o,r,a;let i=e.state,s=i.deferredPublicOnScrollEvent;i.deferredPublicOnScrollEvent=void 0,s&&((a=(r=i.props).onScroll)==null||a.call(r,aq(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var tC=1;function sq(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function UM(e){e.initialScrollSession=void 0}function sC(e){let{bootstrap:t,completion:n,kind:o,previousDataLength:r}=e;return o==="offset"?{completion:n,kind:o,previousDataLength:r}:{bootstrap:t,completion:n,kind:o,previousDataLength:r}}function tg(e,t=(n=>(n=(o=>(o=e.initialScrollSession)==null?void 0:o.kind)())!=null?n:"bootstrap")()){var n,o;return e.initialScrollSession?e.initialScrollSession.kind!==t&&(e.initialScrollSession=sC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=sC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var pg={didDispatchNativeScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didDispatchNativeScroll)},didRetrySilentInitialScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didRetrySilentInitialScroll)},markInitialScrollNativeDispatch(e){tg(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){tg(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=tg(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},oo={clear(e){oo.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=tC},get(e){var t,n;return(n=(t=e.initialScrollSession)==null?void 0:t.completion)==null?void 0:n.watchdog},hasNonZeroTargetOffset(e){return e!==void 0&&e>tC},isAtZeroTargetOffset(e){return e<=tC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=tg(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Ka(e,t={}){var n,o,r,a;let i=e.initialScrollSession,s=(n=t.kind)!=null?n:i?.kind,l=i?.completion,d=i?.kind==="bootstrap"?i.bootstrap:void 0,c=s==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!s||!e.initialScroll&&!c&&!sq(l))return UM(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=sC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var lq=1.3;function lC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*lq||!t&&n<=0&&o>0}var LR=(e,t,n,o,r,a,i,s)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{s({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?lC(e,t,n)?(s(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(i(e),c(),!0):!1};function dq(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function kR(e){let t=e.state;if(!t.edgeReachedGate)return;let n=po(e),o=n-t.scroll-t.scrollLength-Ks(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=lC(t.scroll,!1,a),l=lC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function PR(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function AR(e){e.state.edgeReachedGate="closed"}function KM(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function cq(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",dq(e,o),o}function bu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function ER(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:i,scroll:s,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=po(e);if(kR(e),f>0&&a){let p=Ks(e),m=f-s-i-p,h=f<i;Pe(e,"isAtEnd",h||m<=wR),Pe(e,"isNearEnd",h||m<=c*i),Pe(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),bu(r)||l||(r.isEndReached=LR(m,h,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var x,y;PR(e,"end",t,n)&&(AR(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function uq(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:i},scroll:s,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=i*l;kR(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Pe(e,"isAtStart",s<=wR),Pe(e,"isNearStart",s<=p),bu(o)||o.scrollingTo||(o.isStartReached=LR(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;PR(e,"start",t,n)&&(AR(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function mg(e,t){let n=!e.state.edgeReachedGate;ER(e,t,n),uq(e,t,n)}function MR(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),mg(e)}var fq=6,pq=3,mq=250;function RR(e){e.state.scheduledWork.cancel("adaptiveRender")}function qM(e,t){let n=e.state;RR(e),t<=0?Tu(e,"normal","scroll"):n.scheduledWork.timeout(()=>Tu(e,"normal","scroll"),t,"adaptiveRender")}function Tu(e,t,n){var o,r;de(e,"adaptiveRender")!==t&&(Pe(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function wC(e){var t,n;RR(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";de(e,"adaptiveRender")!==o&&Tu(e,o,"initial")}function gq(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=de(e,"adaptiveRender");if(de(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:fq,c=(r=s.exitVelocity)!=null?r:pq,f=(a=s.exitDelay)!=null?a:mq,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",h=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==h&&(m==="light"?(Tu(e,"light","scroll"),qM(e,f)):l==="light"&&qM(e,f))}else wC(e)}var TC=50;function NR(e,t){var n;let o=e.state.props.drawDistance,r=e.state.initialScroll,a=r!==void 0&&((n=r.viewPosition)!=null?n:0)>0;return t==="visible-first"||t!=="full"&&!de(e,"readyToRender")&&!a?Math.min(o,TC):o}function _R(e){let{state:t}=e;t.props.drawDistance<=TC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function LC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Pe(e,"readyToRender",!1),wC(e)}function kC(e,{didLayout:t,didInitialScroll:n}){let{state:o}=e,{loadStartTime:r,props:{onLoad:a}}=o;t&&(o.didContainersLayout=!0),n&&(o.didFinishInitialScroll=!0),o.didContainersLayout&&o.didFinishInitialScroll&&!de(e,"readyToRender")&&(Pe(e,"readyToRender",!0),Tu(e,"normal","ready"),o.props.drawDistance>TC&&_R(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var hq=2e3;function VM(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function DR(e){e.scheduledWork.cancel("preservedInitialScroll")}function ld(e){DR(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Ka(e)}function WM(e){var t,n,o;let r=e.state,a=((t=r.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?r.initialScrollSession.bootstrap:void 0;(r.initialScroll||a||(n=r.scrollingTo)!=null&&n.isInitialScroll)&&(a?.frameHandle!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.frameHandle),(o=r.scrollingTo)!=null&&o.isInitialScroll&&(fg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),pg.resetFlags(r),Ka(r,{bootstrap:null}),dd(e))}function dd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)VM(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let s=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof s=="number"&&Number.isFinite(s)&&VM(a,s)}let i=()=>{var s,l,d,c,f;let p=((s=a.initialScrollSession)==null?void 0:s.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;oo.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Ka(a),DR(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||ld(a)},hq,"preservedInitialScroll")):ld(a),t?.recalculateItems&&MR(e),kC(e,{didInitialScroll:!0}),p&&iq(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function gg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function vq(e){let{state:t}=e;return(t.props.horizontal?(qa(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:de(e,"stylePaddingTop")||0)+(de(e,"alignItemsAtEndPadding")||0)+(de(e,"headerSize")||0)}function Bt(e,t){let{data:n,keyExtractor:o}=e.props;if(!n)return"";let a=t<n.length?o?o(n[t],t):t:null;return e.idCache[t]=a,a}function xq(e){var t,n,o;let{state:r,values:a}=e;return(a.get("headerSize")||0)+(a.get("footerSize")||0)+((o=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:a.get("totalSize"))!=null?o:0)+(r.props.stylePaddingTop||0)+(r.props.stylePaddingBottom||0)}function yq(e){let{state:t}=e;return!!t.props.alignItemsAtEndPaddingEnabled&&!t.props.horizontal&&t.props.data.length>0&&t.scrollLength>0?Math.max(0,t.scrollLength-xq(e)-Ks(e)):0}function Gs(e){let t=de(e,"alignItemsAtEndPadding")||0,n=yq(e);t!==n&&Pe(e,"alignItemsAtEndPadding",n)}function Iu(e,t,n,o=!0){let r=e.state,a=r.totalSize,i=r.totalSize;t===null?(i=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):i+=n,a!==i?(r.pendingTotalSize=void 0,r.totalSize=i,o&&Pe(e,"totalSize",i),Gs(e)):o&&e.values.get("totalSize")!==i&&Pe(e,"totalSize",i)}function dC(e,t,n,o=!0){let r=e.state,{sizes:a}=r,i=a.get(t),s=i!==void 0?n-i:n;s!==0&&Iu(e,t,s,o),a.set(t,n)}function OR(e){return typeof e=="function"}function hg(e){return Array.isArray(e)}var GM=new Set;function Us(e,t){Vo&&!GM.has(e)&&(GM.add(e),console.warn(`[legend-list] ${t}`))}function Lu(e){return Math.floor(e*8)/8}function Su(e){return e==null}function jM(e,t){var n,o,r;let a=t==="Left"||t==="Right"?e.paddingHorizontal:e.paddingVertical;return(r=(o=(n=e[`padding${t}`])!=null?n:a)!=null?o:e.padding)!=null?r:0}function Cu(e,t,n){return jM(e,n)+jM(t,n)}function cC(e,t){var n,o;let r=(o=(n=e.state)==null?void 0:n.containerItemKeys)==null?void 0:o.get(t);if(r!==void 0)return r;let a=de(e,"numContainers");for(let i=0;i<a;i++)if(de(e,`containerItemKey${i}`)===t)return i;return-1}function FR(e,t,n,o,r){var a,i;let s=e.state,{getFixedItemSize:l,getItemType:d}=s.props,c=t?s.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(i=r?.itemType)!=null?i:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,s.sizesKnown.set(t,c))}return c}function BR(e,t){let n=Bt(e.state,t);return FR(e,n,t,e.state.props.data[t])}function Cq(e,t,n){for(let o=t;o<=n;o++)if(BR(e,o)===void 0)return!1;return!0}function mo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:h,props:{estimatedItemSize:g,getItemType:v},scrollingTo:x}=p,y=p.sizesKnown.get(t);if(y!==void 0)return y;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=FR(e,t,n,o,s),C!==void 0)return dC(e,t,C,i),C;let k=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!x){let S=(c=h[k])==null?void 0:c.avg;S!==void 0&&(C=Lu(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&x){let S=(f=x.averageSizeSnapshot)==null?void 0:f[k];S!==void 0&&(C=Lu(S))}return C===void 0&&(C=g+e.scrollAxisGap),dC(e,t,C,i),C}function PC(e,t){if(t===void 0||t<0)return;let n=Bt(e.state,t);return mo(e,n,t,e.state.props.data[t])}function vg(e,t,n){var o;let r=e.state,{index:a,viewOffset:i,viewPosition:s}=n,l=t;if(i&&(l-=i),a!==void 0){let d=vq(e);d&&(l+=d)}if(s!==void 0&&a!==void 0){let d=r.props.data.length;if(d===0)return l;let c=a<0||a>=d,f=(o=r.props.estimatedItemSize)!=null?o:0,p=c?f:mo(e,Bt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),h=Ks(e);if(l-=s*(r.scrollLength-h-m),!c&&a===r.props.data.length-1){let g=de(e,"footerSize")||0;l+=g}}return l}function Mi(e,t,n){let o=e.state,r=po(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&Ua.OS!=="android"){let i=Math.max(0,r-o.scrollLength),s=n?.viewOffset,l=typeof s=="number"&&s<0?-s:0,d=i+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function ku(e){var t,n;let o=e.state;if(o?.scrollingTo){fg(o);let r=o.pendingScrollResolve;o.pendingScrollResolve=void 0;let a=o.scrollingTo;if(o.scrollHistory.length=0,o.scrollingTo=void 0,o.scrollTargetPinnedRange=void 0,o.pendingTotalSize!==void 0&&Iu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let i=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",s=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;dd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}MR(e),r?.()}}var bq=80,Iq=1500,Sq=320,wq=1;function Tq(e,t){var n,o;let r=e.state,{animated:a,horizontal:i,offset:s}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!i,p=f?po(e):void 0,m=f?IC(r,s,p):0,h=f?0:s;if(l.scrollTo({animated:c,x:m,y:h}),c){let g=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;Lq(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&ku(e)},100,"platformScrollCompletion")}}function Lq(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){ku(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),Iq),f=()=>{o.removeEventListener("scroll",h),a&&o.removeEventListener("scrollend",g),i!==void 0&&clearTimeout(i),clearTimeout(c)},p=()=>{s||(s=!0,f())},m=v=>{if(s)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let x=n(),y=Math.abs(x-r)<=wq;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),ku(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),bq)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),Sq),l.register("platformScrollCompletion",p)}function cd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(de(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,po(e)<t.scrollLength&&(t.scroll=0),t.maintainingScrollAtEnd)t.pendingMaintainScrollAtEnd=!0;else{let d=a.animated?"pending-animated":"pending-instant",c=a.animated?"animated":"instant",f=t.scroll;t.maintainingScrollAtEnd=d,requestAnimationFrame(()=>{let p=de(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let h=r.current;if(t.props.horizontal&&qa(t)){let g=po(e),v=$K(t,g),x=IC(t,v,g);h?.scrollTo({animated:a.animated,x,y:0})}else h?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&cd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function js(e,t,n){let o=e.state;if(Math.abs(t)>.1){let r=()=>{o.scrollAdjustHandler.requestAdjust(t),o.adjustingFromInitialMount&&o.adjustingFromInitialMount--};o.scroll+=t,o.scrollForNextCalculateItemsInView=void 0,de(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Ao=.1,kq=300,Pq=2,Aq=1;function Eq(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,i=e.indexByKey.get(r.id)===void 0;if(a||i||!n){e.mvcpAnchorLock=void 0;return}return r}function Mq(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:i}=t,s=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!s||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(i)<=Ao&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=Pq){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+kq,id:n,position:o,quietPasses:c}}}function Rq(e,t,n,o,r,a){return!1}function Nq(e,t,n){if(Math.abs(t)<=Ao)return 0;let r=Math.max(0,n-e.scrollLength)-e.scroll;return t<0?Math.max(t,Math.min(0,r)):t>0?Math.min(t,Math.max(0,r)):0}function _q(e,t){return e<0?-t:t}function nC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Ao&&js(e,r)}function Dq(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Ao)return;let o=po(e),r=Nq(t,n.amount,o);if(Math.abs(r)<=Ao)return;let a=n.amount-r;Math.abs(a)<=Ao||(n.manualApplied=a,js(e,a),n.furthestProgressTowardAmount=0)}function Oq(e,t){let n=e.state,o=n.pendingNativeMVCPAdjust;if(!o)return!1;let r=o.amount-o.manualApplied,a=t-(o.startScroll+o.manualApplied),i=r<0&&a>Ao||r>0&&a<-Ao,s=_q(r,a);if(Math.abs(r)<=Ao)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Ao>=Math.abs(r))return nC(e,r,a),!0;let l=Math.max(0,po(e)-n.scrollLength);return Math.abs(t-l)<=Aq||n.pendingMaintainScrollAtEnd&&de(e,"isWithinMaintainScrollAtEndThreshold")&&s>Ao?(nC(e,r,a),!0):s>o.furthestProgressTowardAmount+Ao?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Ao&&s<o.furthestProgressTowardAmount-Ao&&(n.pendingNativeMVCPAdjust=void 0),!1)}function Fq(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:i,size:s,shouldRestorePosition:l}}=a,d=Date.now(),c=!!t||!!n.mvcpAnchorLock,f=n.scrollingTo;if(t&&n.pendingScrollToEnd&&f===void 0){n.mvcpAnchorLock=void 0;return}let p=Eq(n,c,i,d),m,h,g=[],v=f?.index,x=f?.viewPosition,y=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(x??0)>0,C=t?i:s,w=n.indexByKey,k=n.scroll;if(po(e),C){if(p&&v===void 0?(h=p.id,m=p.position):v!==void 0?h=Bt(n,v):o.length>0&&n.didContainersLayout&&!t&&(h=o.find(S=>w.get(S)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let S=0;S<o.length;S++){let L=o[S],I=w.get(L);if(I!==void 0){let T=r[I];T!==void 0&&g.push({id:L,position:T})}}if(h!==void 0&&m===void 0){let S=w.get(h);S!==void 0&&(m=r[S])}return()=>{let S=0,L=p?.id,I,T=!1,E=n.props.data;if(t&&i&&v===void 0&&h!==void 0&&p?.id===h&&l!==void 0&&h!==void 0){let R=w.get(h);if(R!==void 0){let $=E[R];T=$===void 0||!l($,R,E),T&&p?.id===h&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(h===void 0||T)return!0;let R=w.get(h);return R===void 0||r[R]===void 0})())for(let R=0;R<g.length;R++){let{id:$,position:H}=g[R],K=w.get($);if(K!==void 0&&l){let oe=E[K];if(oe===void 0||!l(oe,K,E))continue}let O=K!==void 0?r[K]:void 0;if(O!==void 0){S=O-H,L=$,I=O;break}}if(!T&&h!==void 0&&m!==void 0){let R=w.get(h),$=R!==void 0?r[R]:void 0;if($!==void 0){let H=po(e),K=$-m;if(K!==0&&y&&n.scroll+n.scrollLength>H)if(K>0)K=Math.max(0,H-n.scroll-n.scrollLength);else{let O=Math.max(0,H-n.scrollLength);n.scroll=O,n.scrollPending=O,K=0}S=K,L=h,I=$}}if(x&&x>0){let R=mo(e,h,v,n.props.data[v]),$=f?.itemSize;if(R!==void 0&&$!==void 0&&R!==$){let H=R-$;H!==0&&(S+=H*x,f.itemSize=R)}}if(Mq(n,{anchorId:L,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),Rq()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:k},Dq(e);return}Math.abs(S)>Ao&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&de(e,"isWithinMaintainScrollAtEndThreshold")||js(e,S))}}}var QM=1e3,Bq=200,xg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>QM)return 0;let r=0,a=0,i=0;for(let s=n;s>0;s--){let l=t[s],d=t[s-1],c=l.scroll-d.scroll,f=l.time-d.time,p=Math.sign(c);if(p!==0){if(r===0)r=p;else if(p!==r)break}if(o.time-d.time>QM)break;if(c===0||f<=0)continue;let m=o.time-l.time,h=Math.exp(-m/Bq);a+=c/f*h,i+=h}return i>0?a/i:0};function zq(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Ru(e){return e.dataChangeNeedsScrollUpdate||zq(e)}function qs(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:i,lastScrollAdjustForHistory:s,scrollAdjustHandler:l,scrollHistory:d,scrollingTo:c}=a,f=a.scroll;o?.markHasScrolled!==!1&&(a.hasScrolled=!0);let p=Date.now();a.lastBatchingAction=p;let m=l.getAdjust(),h=s!==void 0&&Math.abs(m-s)>.1;if(h&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(h||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:T,gt:E}=i;if(T&&t<T||E&&t>E){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let g=Math.abs(t-f),x=!!o?.fromNativeScrollEvent&&g>.1&&!h&&c===void 0&&!a.pendingNativeMVCPAdjust?cq(e,t-f):void 0,y=Oq(e,t),C=a.scrollLength,w=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,k=xg(a);gq(e,k,{forceLight:w});let S=a.scrollLastCalculate;if(Ru(a)||y||x!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=g;let T=()=>{var A;let N={doMVCP:c!==void 0,scrollVelocity:k};w&&(N.drawDistanceMode="visible-first"),(A=a.triggerCalculateItemsInView)==null||A.call(a,N),mg(e,x)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,yR.flushSync)(T),_R(e)):T();let E=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);y&&E&&(a.pendingMaintainScrollAtEnd=!1,cd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function $q(e){if(Object.keys(e.averageSizes).length===0)return;let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];t[n]=o.avg}return t}function Hq(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=oo.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&oo.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&oo.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,oo.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&oo.clear(e)}function Uq(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,i;for(;r<=a;){let s=Math.floor((r+a)/2),l=n.positions[s];l===void 0?a=s-1:l<=t?(i=s,r=s+1):a=s-1}return i}function XM(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=PC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function Kq(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),i=Math.max(a,t+o.scrollLength),s=n!==void 0?Math.max(0,Math.min(r-1,n)):Uq(e,a);if(s===void 0)return;if(n!==void 0&&o.positions[s]===void 0)return{end:s,start:s};if(n===void 0){let d=XM(e,s);if(d===void 0||d<=a)return}for(;s>0;){let d=o.positions[s];if(d===void 0||d<=a||o.positions[s-1]===void 0)break;s--}for(;s>0;){let d=XM(e,s-1);if(d===void 0||d<=a)break;s--}let l=s;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>i)break;l++}return{end:l,start:s}}function qq(e,t,n){let o=Kq(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function yg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:i,...s}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=s,{props:{horizontal:m}}=r;fg(r);let h=f?c:vg(e,c,s),g=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Mi(e,h,s),x=g?h:v;if(r.scrollHistory.length=0,!a){d&&pg.resetFlags(r);let y=$q(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||qq(e,v,s.index)}r.scrollPending=v,Hq(r,{isInitialScroll:d,requestedOffset:x,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):qs(e,v,!0,{markHasScrolled:!1})),i||!d||Ua.OS==="android"?Tq(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function zR(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function ng(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=zR(t,l.length);let d=PC(e,t),c=gg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,yg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Cg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?zR(i,e.state.props.data.length):void 0,l=PC(e,s);yg(e,{animated:!1,forceScroll:n,index:s!==void 0&&s>=0?s:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Vs(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&LC(e,{resetInitialScroll:!0}),Ka(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Fr(e,t){var n,o;if(((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset")return(o=t.contentOffset)!=null?o:0;let a=t.index!==void 0?gg(e,t.index):0,i=vg(e,a,t);return Mi(e,i,t)}function $R(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,i=!!r?.isInitialScroll,s=!!t?.requiresMeasuredLayout&&!o&&!i;if(!(!a||s||n||r&&!i))return{initialScroll:a,isInitialScrollInProgress:i,queuedInitialLayout:o,scrollingTo:r}}function Vq(e,t){var n,o,r;let a=e.state,i=$R(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Fr(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,h=p!==void 0&&Math.abs(p-f)>1,g=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!h||t?.forceScroll&&g)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Vs(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Cg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function Wq(e,t){var n,o;let r=e.state,a=$R(r);if(!a)return!1;let{initialScroll:i,queuedInitialLayout:s}=a,l=(n=i.contentOffset)!=null?n:0,d=Math.abs(r.scroll-l)<=1&&Math.abs(r.scrollPending-l)<=1;if(t?.forceScroll&&d)return!1;let c=!!r.lastLayout&&r.scrollLength>0,f=(o=t?.forceScroll)!=null?o:c||!!s;return Cg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Pu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?Wq(e,{forceScroll:t?.forceScroll}):Vq(e,{forceScroll:t?.forceScroll})}function wu(e,t,n){if(t==null||n==null||t<0||n<t)return!1;let o=!1;for(let r of e.containerItemKeys.keys()){let a=e.indexByKey.get(r);if(a!==void 0&&a>=t&&a<=n){o=!0;let i=Bt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var bg=1,Gq=8,jq=24,Qq="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function pr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function Qs(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function Xq(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yq(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:i}=e,s=o+a,l=[],d=i!==void 0?Math.max(0,Math.min(t-1,i)):0;for(;d>0;){let c=d-1,f=r[c];if(f===void 0){d=c;continue}let p=n(c);if(p===void 0){d=c;continue}if(f+p<=o)break;d=c}for(;d<t;d++){let c=r[d];if(c===void 0)continue;let f=n(d);if(f!==void 0){if(c<s&&c+f>o)l.push(d);else if(l.length>0&&c>=s)break}}return l}function Jq(e){let{mountFrameCount:t,maxFrames:n=Gq,maxPasses:o=jq,passCount:r}=e;return t>=n||r>=o}function HR(e,t){return Jq(t)?(Vo&&console.warn(Qq),uV(e),!0):!1}function Au(e){var t;let n=pr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Ka(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function UR(e,t){var n,o,r;let a=pr(e);Ka(e,{bootstrap:{frameHandle:a?.frameHandle,mountFrameCount:(n=a?.mountFrameCount)!=null?n:0,passCount:0,previousResolvedOffset:void 0,scroll:t.scroll,seedContentOffset:(r=(o=t.seedContentOffset)!=null?o:a?.seedContentOffset)!=null?r:t.scroll,targetIndexSeed:t.targetIndexSeed,visibleIndices:void 0},kind:"bootstrap"})}function Zq(e,t){var n,o,r;let a=pr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,Ka(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&UR(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function uC(e){requestAnimationFrame(()=>{var t;pr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function AC(e){let t=e.state,n=pr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=pr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!HR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&AC(e))};n.frameHandle=requestAnimationFrame(o)}function ig(e,t){Zq(e.state,t),AC(e),uC(e.state)}function EC(e){let{dataLength:t,footerSize:n,preserveForFooterLayout:o,stylePaddingEnd:r}=e;return{contentOffset:void 0,index:Math.max(0,t-1),preserveForBottomPadding:!0,preserveForFooterLayout:o,viewOffset:-r-n,viewPosition:1}}function eV(e){return!!e?.preserveForBottomPadding}function Ws(e){return!!e?.preserveForFooterLayout}function KR(e){return!!(e&&e.viewPosition===1&&(eV(e)||Ws(e)))}function tV(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=Ws(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:i,viewOffset:-r-(i?n:0),viewPosition:1}}function nV(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function sg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Ws(r))return;let a=EC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Vs(e,a)}function oV(e){ld(e)}function MC(e,t,n=bg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Eu(o);return Math.abs(r-Fr(e,t))>n}function Eu(e){var t,n,o,r;let a=(n=(t=e.refScroller.current)==null?void 0:t.getCurrentScrollOffset)==null?void 0:n.call(t);return typeof a=="number"&&Number.isFinite(a)?a:(r=(o=e.scrollPending)!=null?o:e.scroll)!=null?r:0}function qR(e){var t;let n=e.state,o=n.initialScroll;if(!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||!o||o.viewPosition!==1||n.props.data.length===0||Qs(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Eu(n);return Fr(e,o)-r}function VR(e){return qR(e)===void 0?!1:(WR(e,{}),!0)}function WR(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=qR(e);if(a===void 0||Math.abs(a)<=bg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),js(e,a)),WR(e,t)})}function rV(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||MC(e,o)&&(KR(o)&&de(e,"isAtEnd")||(Ws(o)?sg(e,{dataLength:n.props.data.length,stylePaddingEnd:bC(n.props),target:o}):oV(n)))}function aV(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Fr(e,i),d=l===0&&!a&&(Qs(s)?Math.abs((n=i.contentOffset)!=null?n:0)<=1:i.index===0&&((o=i.viewPosition)!=null?o:0)===0&&Math.abs((r=i.viewOffset)!=null?r:0)<=1),c=s.props.data.length===0&&i.index!==void 0;d?(Au(s),dd(e,{resolvedOffset:l})):c?(Au(s),dd(e,{preserveTarget:!0,resolvedOffset:l})):(UR(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),AC(e))}function iV(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(Qs(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=pr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){ld(s);return}let p=n>0&&(r||KR(l));if(!(!o&&!d&&!p)){if(p){let m=r?EC({dataLength:n,footerSize:de(e,"footerSize")||0,preserveForFooterLayout:Ws(l),stylePaddingEnd:i}):tV({dataLength:n,footerSize:de(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&MC(e,l)){sg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!nV(l,m)||c||d||o){Vs(e,m,{resetDidFinish:d}),ig(e,{scroll:Fr(e,m),seedContentOffset:d&&!c?Eu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Vs(e,l,{resetDidFinish:d}),ig(e,{scroll:Fr(e,l),seedContentOffset:d&&!c?Eu(s):void 0,targetIndexSeed:l.index}))}}function sV(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(Qs(i)||n===0||!s||!(pr(i)||Ws(s))))if(MC(e,s))sg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=EC({dataLength:n,footerSize:o,preserveForFooterLayout:Ws(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))sg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Vs(e,d,{resetDidFinish:f}),ig(e,{scroll:Fr(e,d),targetIndexSeed:d.index})}}}function lV(e){var t,n,o;let r=e.state,a=r.initialScroll,i=pr(r);if(a&&r.props.data.length>0&&!Qs(r)&&(i||a.viewPosition===1)){let s=Fr(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!i&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:Eu(r),c=s-d;if(Math.abs(c)>bg){if(r.didFinishInitialScroll)VR(e);else if(l){let f=oo.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,oo.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),js(e,c)}}}else ig(e,{scroll:s,targetIndexSeed:a.index})}}function dV(e){var t,n;let o=e.state,r=pr(o),a=o.initialScroll;if(!r||!a||Qs(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,HR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let i=Fr(e,a),s=wu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=Yq({dataLength:d.length,getSize:g=>{var v,x;let y=(v=o.idCache[g])!=null?v:Bt(o,g);return(x=o.sizes.get(y))!=null?x:mo(e,y,g,d[g])},offset:i,positions:o.positions,scrollLength:o.scrollLength,startIndex:(n=r.targetIndexSeed)!=null?n:o.startBuffered>=0?o.startBuffered:void 0}),f=c.length>0&&c.every(g=>{var v;let x=(v=o.idCache[g])!=null?v:Bt(o,g);return o.sizesKnown.has(x)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,uC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=bg&&Xq(m,c))){uC(o);return}Au(o),Cg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Ua.OS==="web"})}function cV(e,t){var n;let o=e.state;Au(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;dd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function uV(e){var t,n,o,r;let a=e.state,i=pr(a),s=a.initialScroll;i&&s&&!Qs(a)&&a.refScroller.current?(Au(a),Cg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Ua.OS==="web"})):cV(e,(r=(o=(n=(t=pr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function GR(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function fV(e,t,n,o){var r,a;let{getFixedItemSize:i,getItemType:s}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===s&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=s?(r=s(o,n))!=null?r:"":void 0;d=GR(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==i&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=i),i&&!d.didResolveFixedItemSize&&(d.fixedItemSize=i(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function jR(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var pV=20,mV=1,gV=1,oC=16;function RC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!NC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>CV(e),"checkFinishedScrollFrame")}function hV(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=mV}function vV(e,t){return!!t?.isInitialScroll&&pg.didDispatchNativeScroll(e)&&!e.hasScrolled}function QR(e){var t;return(t=oo.get(e))==null?void 0:t.targetOffset}function XR(e){let t=QR(e);return!e.didFinishInitialScroll&&oo.hasNonZeroTargetOffset(t)}function YM(e,t){var n,o;if(!t.isInitialScroll||t.animated||!e.didContainersLayout||((n=e.initialScrollSession)==null?void 0:n.kind)==="bootstrap")return!1;let r=(o=t.targetOffset)!=null?o:t.offset;return oo.hasNonZeroTargetOffset(r)&&pg.didDispatchNativeScroll(e)&&!e.hasScrolled||oo.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||XR(e)}function JM(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&po(e)<=n.scrollLength&&n.scrollPending<=gV}function xV(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function yV(e,t){var n;let o=t.index,a=xV(e,t)&&o!==void 0?vg(e,gg(e,o),t):(n=t.targetOffset)!=null?n:Mi(e,t.offset-(t.viewOffset||0),t);return Mi(e,a,t)}function NC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=yV(e,t),i=Mi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||Ua.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function CV(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=NC(e,t);o.isAtResolvedTarget&&hV(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&ku(e)}function bV(e,t){var n;(n=e.state.refScroller.current)==null||n.scrollTo({animated:!1,x:e.state.props.horizontal?t:0,y:e.state.props.horizontal?0:t})}function IV(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=JM(e),r=vV(t,n),a=n!==void 0?YM(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?oC:i?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let h=XR(t)&&!t.hasScrolled,g=r?5:h?pV:5,v=JM(e),x=YM(t,m),y=NC(e,m),C=Ua.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||y.isAtResolvedTarget),k=m.isInitialScroll&&!y.isAtResolvedTarget&&l<=g;if(v||w||x||C||l>g)ku(e);else if((h||k)&&l<=g){let S=(p=(f=QR(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;bV(e,S),d(r?oC:100)}else d(r?oC:100)}};d(s)}function YR(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?VR(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Pu(e,{forceScroll:!0})}function SV(e){var t;if(!e.state.initialScroll)return;let n=()=>Pu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),RC(e,{onlyIfAligned:!0})}function wV(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:i,initialContentOffset:s,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=s??0,m=d&&l&&i;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Vs(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){aV(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?dd(e,{resolvedOffset:p}):kC(e,{didInitialScroll:!0}))}function TV(e,t){var n,o,r;let{dataLength:a,didDataChange:i,didStartFreshData:s,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,h=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,g=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),g&&(d?(Vs(e,d),Ka(m,{kind:c,previousDataLength:h})):ld(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Ka(m),p){iV(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:h,stylePaddingEnd:f});return}let v=h===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;h!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&LC(e,{resetInitialScroll:!0}),Pu(e))}function JR(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function LV(e){var t;let n=e.pendingContainerIds;if(e.pendingContainerIds=void 0,n===void 0)return;let o=e.state,r=n;if(r&&((t=o.userScrollAnchorReset)!=null&&t.keys.size)){r=new Set(r);for(let a of o.userScrollAnchorReset.keys){let i=o.containerItemKeys.get(a);i!==void 0&&r.add(i)}}return r}function lg(e,t){var n;let o=e.pendingContainerIds!==void 0,r=e.pendingContainerIds;if(t===void 0)e.pendingContainerIds=null;else if(r!==null){let a=r;if(!a)a=typeof t=="number"?new Set([t]):new Set(t);else if(typeof t=="number")a.add(t);else for(let i of t)a.add(i);e.pendingContainerIds=a}if(!o){let a=((n=de(e,"containerLayoutEpoch"))!=null?n:0)+1;Pe(e,"containerLayoutEpoch",a)}}function kV(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:h,columnSpans:g,positions:v,props:{data:x,itemsAreEqual:y,keyExtractor:C}}=m,w=x[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let k=(r=m.idCache[n])!=null?r:Bt(m,n),S=(a=o?.updateLayout)!=null?a:!0,L=!1,I=!1;if(S){let N=v[n];if(N===void 0)return Pe(e,`containerPosition${t}`,sd),{didChangePosition:!1,didRefreshData:!1};let R=(N||0)-((i=o?.scrollAdjustPending)!=null?i:0),$=(s=m.sizes.get(k))!=null?s:mo(e,k,n,w),H=HK(m,R,$,de(e,"totalSize")),K=h[n]||1,O=g[n]||1,oe=de(e,`containerPosition${t}`),ee=de(e,`containerColumn${t}`),W=de(e,`containerSpan${t}`);H>sd&&H!==oe&&(Pe(e,`containerPosition${t}`,H),L=!0),K>=0&&K!==ee&&Pe(e,`containerColumn${t}`,K),O!==W&&Pe(e,`containerSpan${t}`,O)}de(e,`containerItemIndex${t}`)!==n&&Pe(e,`containerItemIndex${t}`,n);let E=de(e,`containerItemData${t}`),A=()=>{Pe(e,`containerItemData${t}`,w),I=!0};if(E!==w){let N=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===x?m.pendingDataComparison:void 0,R=(c=N?.byIndex[n])!=null?c:0;if(R===2)A();else if(R!==1){let $=(f=de(e,`containerItemKey${t}`))!=null?f:k,H=C?.(E,n);if(E===void 0||!C||H!==$)A();else if(!y)A();else{let K=y(E,w,n,x);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==x)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:x,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=K?1:2),K||A()}}}return{didChangePosition:L,didRefreshData:I}}function PV(e,t,n){var o;let r=e.state,a=de(e,"numColumns"),i=t;r.columns[t]!==1&&(i=ZM(r,a,t));let l=0,d=r.columns[i];if(i>0){let c=i-1,f=(o=r.positions[c])!=null?o:0,p=ZM(r,a,c),m=AV(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function ZM(e,t,n){if(t<=1)return Math.max(0,n);let o=Math.max(0,n);for(;o>0&&e.columns[o]!==1;)o--;return o}function AV(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let i=0;for(let s=t;s<=n;s++){if(s<0||s>=a.length)continue;let l=r.idCache[s],d=mo(e,l,s,a[s],o);d>i&&(i=d)}return i}function EV(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=de(e,"numColumns"))!=null?t:1;if(a.length===0)Iu(e,null,0);else{let s=a.length-1,l=Bt(o,s),d=r[s];if(l!==void 0&&d!==void 0)if(i>1){let c=s;for(;c>0;){let p=o.columns[c];if(p===1||p===void 0)break;c-=1}let f=0;for(let p=c;p<=s;p++){let m=(n=o.idCache[p])!=null?n:Bt(o,p),h=mo(e,m,p,a[p]);h>f&&(f=h)}Iu(e,null,d+f)}else{let c=mo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Iu(e,null,f)}}}}function ZR(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?po(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Bt(t,i);let s=t.positions[i];r[a]=IC(t,s,o)}Pe(e,"snapToOffsets",r)}function eN(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:i,startIndex:s}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,h=e.positionListeners.size>0,{columns:g,columnSpans:v,indexByKey:x,positions:y,idCache:C,sizesKnown:w,props:{data:k,overrideItemLayout:S,snapToIndices:L},scrollingTo:I}=m,T=k.length,E=(l=de(e,"numColumns"))!=null?l:1,A=E>1,N=Vo?new Map:void 0,R=de(e,"extraData"),$=S?{span:1}:void 0,H=m.lastScrollDelta,K=i??xg(m),O=!o&&!t&&(r||Math.abs(K)>0||m.scrollLength>0&&H>m.scrollLength),oe=a+1e3,ee=!0,W=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=de(e,"scrollAdjustPending"))!=null?d:0)!==0,qe=!1,ve=0,fe=1,Ne=0;if(t&&(v.length=0),A||(g.length&&(g.length=0),v.length&&(v.length=0)),s>0){if(A){let{startIndex:re,currentRowTop:Ie}=PV(e,s,ee);s=re,ve=Ie}else if(s<T){let re=s-1,Ie=Bt(m,re),st=(c=y[re])!=null?c:0,dt=(f=w.get(Ie))!=null?f:mo(e,Ie,re,k[re],ee,W,qe);ve=st+dt}}let Ae=t||x.size===0,ae=A&&!!S&&!!$,Ee=!1,xe;for(let re=s;re<T;re++){if(O&&xe!==void 0&&re>xe){Ee=!0;break}O&&xe===void 0&&!I&&!t&&ve>oe&&(xe=re+(A?E:1)+10);let Ie=(p=C[re])!=null?p:Bt(m,re),st=1;if(ae){$.span=1,S($,k[re],re,E,R);let ct=$.span;ct!==void 0&&Number.isFinite(ct)&&(st=Math.max(1,Math.min(E,Math.round(ct))))}A&&fe+st-1>E&&(ve+=Ne,fe=1,Ne=0);let dt=w.get(Ie),lt=dt!==void 0?dt:mo(e,Ie,re,k[re],ee,W,qe);Vo&&Ae&&(N.has(Ie)&&console.error(`[legend-list] Error: Detected overlapping key (${Ie}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),N.set(Ie,re)),ve!==y[re]&&(y[re]=ve,h&&QK(e,Ie,ve)),Ae&&x.set(Ie,re),A?(g[re]=fe,v[re]=st,lt>Ne&&(Ne=lt),fe+=st,fe>E&&(ve+=Ne,fe=1,Ne=0)):ve+=lt}Ee||EV(e),L&&ZR(e)}function tN(e,t){let n=e.mapViewabilityConfigStates;n||(n=new Map,e.mapViewabilityConfigStates=n);let o=n.get(t);return o||(o={end:-1,endBuffered:-1,previousEnd:-1,previousStart:-1,start:-1,startBuffered:-1,viewableItems:[]},n.set(t,o)),o}function MV(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function nN(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=tN(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>eR(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):eR(l,d,e,t,o)}}function eR(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=tN(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)oN(n,o,a,y,C.key,r,C.item,C.index).sizeVisible<0&&(h??(h=[]),h.push(y));let g=[],v=new Set;if(d)for(let y of d){v.add(y.key);let C=n.indexByKey.get(y.key),w=C!==void 0?e[C]:void 0,k=cC(o,y.key),S=!1;C!==void 0&&w!==void 0&&(S=nR(n,o,a,k,y.key,r,w,C)),S||g.push({...y,index:C??y.index,isViewable:!1,item:w??y.item})}let x=[];for(let y=c;y<=f;y++){let C=e[y];if(C){let w=Bt(n,y),k=cC(o,w);if(nR(n,o,a,k,w,r,C,y)){let S={containerId:k,index:y,isViewable:!0,item:C,key:w};x.push(S),v.has(S.key)||g.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:x}),g.length>0){l.viewableItems=x;for(let y=0;y<g.length;y++){let C=g[y];RV(o,s,C.containerId,C)}i&&i({changed:g,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:x})}if(h)for(let y of h){let C=o.mapViewabilityAmountValues.get(y);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(y)}}function tR(e,t){return!!e&&e.containerId===t.containerId&&e.index===t.index&&e.isViewable===t.isViewable&&e.item===t.item&&e.key===t.key&&e.percentOfScroller===t.percentOfScroller&&e.percentVisible===t.percentVisible&&e.scrollSize===t.scrollSize&&e.size===t.size&&e.sizeVisible===t.sizeVisible}function oN(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(de(t,"stylePaddingTop")||0)+(de(t,"alignItemsAtEndPadding")||0)+(de(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,h=m?p:f,g=d-c,v=e.positions[s],x=l.get(r)||0;if(v===void 0){let N={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:x,sizeVisible:-1},R=t.mapViewabilityAmountValues.get(o);if(!tR(R,N)){t.mapViewabilityAmountValues.set(o,N);let $=t.mapViewabilityAmountCallbacks.get(o);$&&$(N)}return N}let y=v-g,C=y+x,w=y>=0&&C<=a&&C>y,k=w?x:Math.min(C,a)-Math.max(y,0),S=x?w?100:100*(k/x):0,L=x?100*(k/a):0,T=(w?100:m?L:S)>=h,E={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:L,percentVisible:S,scrollSize:a,size:x,sizeVisible:k},A=t.mapViewabilityAmountValues.get(o);if(!tR(A,E)){t.mapViewabilityAmountValues.set(o,E);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(E)}return E}function nR(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=oN(e,t,n,o,r,a,i,s)),l.isViewable}function RV(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var oR=xR.unstable_batchedUpdates,NV=typeof oR=="function"?oR:e=>e(),_V=32,DV=64,OV=3;function FV(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*OV),o=t+DV,r=Math.max(t,Math.min(n,o),Math.min(e,_V)),a=Math.max(e,t);return Math.min(a,r)}function BV(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function zV(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=de(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,h=r.length>0?new Set(r):void 0,g=t.map((E,A)=>({isSticky:c.props.stickyHeaderIndicesSet.has(E),itemIndex:E,itemType:a?.(E),order:A})),v=g.filter(E=>!E.isSticky),x=g.filter(E=>E.isSticky),y=[],C=[];for(let E=0;E<d;E++){let A=de(e,`containerItemKey${E}`),N=!!h?.has(E);if(!(A&&i?.has(A)&&c.indexByKey.has(A))){if(p.has(E))(A===void 0||N)&&C.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(A===void 0||N)y.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(!m){let $=c.indexByKey.get(A);if($!==void 0&&($<n||$>o)){let H=$<n?n-$:$-o;y.push({containerIndex:E,distance:H})}}}}y.sort($V);let w=new Array(l),k=d,S=!1,L=(E,A)=>{w[E.order]={containerIndex:A,itemIndex:E.itemIndex,itemType:E.itemType},h?.delete(A)&&(S=!0)},I=(E,A,N)=>{for(let R of E){if(w[R.order])continue;let $=A.findIndex(H=>{var K;return N((K=f.get(H.containerIndex))==null?void 0:K.itemType,R.itemType)});if($!==-1){let[H]=A.splice($,1);L(R,H.containerIndex)}}},T=(E,A,N)=>{a&&I(E,A,(R,$)=>$!==void 0&&R===$),I(E,A,R=>R===void 0),N&&I(E,A,()=>!0)};T(v,y,!0),T(x,C,!1);for(let E of g){if(w[E.order])continue;let A=k++;E.isSticky&&p.add(A),L(E,A)}if(S&&(r.length=0,h))for(let E of h)r.push(E);if(Vo){let E=(s=de(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;k>E&&console.warn("[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",{debugInfo:{numContainers:d,numContainersPooled:E,numNeeded:l,stillNeeded:k-d}})}return w}function $V(e,t){return t.distance-e.distance}function HV(e){let t=e.state;t.queuedInitialLayout=!0,ER(e),kC(e,{didLayout:!0})}var UV=4,KV=100;function qV(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/UV);return Math.sign(e)*t*n}function VV(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},KV,"renderRangeProjection")}function WV(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],i=o[a];if(i!==void 0&&t>=i)return r}return-1}function GV(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=de(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function jV(e,t,n,o,r,a,i){var s;let l=e.state;Pe(e,"activeStickyIndex",n>=0?t[n]:-1);for(let d=0;d<=1;d++){let c=n-d;if(c<0)continue;let f=t[c];if(GV(e,f))continue;let p=(s=l.idCache[f])!=null?s:Bt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function QV(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=de(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||i(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Pe(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let g=t[m+1],v=!1;if(g){let x=d.positions[g];v=x!==void 0&&n>x+o*2}else{let x=(s=d.idCache[p])!=null?s:Bt(d,p);if(x){let y=d.positions[p],C=(l=d.sizes.get(x))!=null?l:mo(e,x,p,d.props.data[p]);v=y!==void 0&&n>y+C+o*3}}v&&a.push(c)}}function rN(e,t,n,o,r,a){let i=!1;return e.startNoBuffer===null&&n+o>r&&(e.startNoBuffer=t),e.firstFullyOnScreenIndex===void 0&&n>=r-10&&n<=a&&(e.firstFullyOnScreenIndex=t),e.startNoBuffer!==null&&(n<=a?e.endNoBuffer=t:i=!0),i}function aN(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let i=a;i<=t.endNoBuffer;i++){let s=(o=e.idCache[i])!=null?o:Bt(e,i);r.push(s)}return r}function fC(e,t){var n;let o=e.props.onFirstVisibleItemChanged;if(!o||t===null||t<0||t>=e.props.data.length)return;let r=(n=e.idCache[t])!=null?n:Bt(e,t),a=e.lastFirstVisibleItemCallback;a?.index===t&&a.key===r||(e.lastFirstVisibleItemCallback={index:t,key:r},o({index:t,item:e.props.data[t],key:r}))}function XV(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:i,positions:s,props:{data:l},sizes:d,startBuffered:c}=r;if(c===null||a===null||c<0||a<c)return null;for(let f=c;f<=a&&f<l.length;f++){let p=(n=i[f])!=null?n:Bt(r,f),m=(o=d.get(p))!=null?o:mo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function YV(e,t,n,o,r){var a,i;let s=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=s;if(m===null||l===null||m<0||l<m)return;let h={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let g=m;g<=l&&g<f.length;g++){let v=(a=d[g])!=null?a:Bt(s,g),x=(i=p.get(v))!=null?i:mo(e,v,g,f[g]),y=c[g];if(rN(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:aN(s,h),startNoBuffer:h.startNoBuffer}),fC(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&nN(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function Ha(e,t={}){let n=e.state;NV(()=>{var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k,S,L;let{columns:I,containerItemKeys:T,enableScrollForNextCalculateItemsInView:E,idCache:A,indexByKey:N,minIndexSizeChanged:R,positions:$,props:{alwaysRenderIndicesArr:H,alwaysRenderIndicesSet:K,getItemType:O,keyExtractor:oe,onStickyHeaderChange:ee},scrollForNextCalculateItemsInView:W,scrollLength:qe,sizes:ve,startBufferedId:fe,viewabilityConfigCallbackPairs:Ne}=n,{data:Ae}=n.props,ae=n.props.stickyHeaderIndicesArr||[],Ee=n.props.stickyHeaderIndicesSet||new Set,xe=NR(e,t.drawDistanceMode),{dataChanged:re,doMVCP:Ie,forceFullItemPositions:st}=t,dt=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,lt=!!dt,ct=de(e,"numContainers");if(!Ae||qe===0||!ct)return;let Et=po(e),ot,He=de(e,"stylePaddingTop")+de(e,"alignItemsAtEndPadding")+de(e,"headerSize"),Se=de(e,"numColumns"),ze=(r=t.scrollVelocity)!=null?r:xg(n),Je=0,{initialScroll:qt,queuedInitialLayout:X}=n,nn=lt?(a=dt?.scroll)!=null?a:n.scroll:!X&&bu(n)&&qt?Fr(e,qt):n.scroll,xt=0,mn=0,Tt=0,Yt=0,Jt=0,Mt=0,zn=nn,kn=ne=>{var Fe;zn=ne,xt=(Fe=de(e,"scrollAdjustPending"))!=null?Fe:0,mn=xt-He,Tt=Math.round(ne+Je+mn),Tt+qe>Et&&(Tt=Math.max(0,Et-qe))};kn(nn);let vn=de(e,"activeStickyIndex"),$n=()=>{let ne=ae.length>0?WV(ae,Tt,n):-1,Fe=ne>=0?ae[ne]:-1,at=vn!==Fe;(ne>=0||vn>=0)&&Pe(e,"activeStickyIndex",Fe);let je=!!ee&&ae.length>0&&at;return{currentStickyIdx:ne,finishCalculateItemsInView:je?()=>{let wn=Ae[Fe];wn!==void 0&&ee?.({index:Fe,item:wn})}:void 0}},Vt=re?void 0:$n(),Zt=xe,Sn=xe;ze>0||ze===0&&Tt<Math.max(50,xe)?(Zt=xe*.5,Sn=xe*1.5):(Zt=xe*1.5,Sn=xe*.5);let zt=!re&&!st&&!lt&&!bu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!de(e,"readyToRender")?qV(ze,Math.min(Zt,Sn)):0,D=()=>{let ne=Math.max(0,Tt),Fe=Math.max(0,-zn);Jt=Math.max(ne,Tt+qe+Fe),Yt=ne-Zt+zt,Mt=Jt+Sn+zt};if(D(),zt!==0&&VV(e),E&&!lt&&!re&&!st&&W){let{top:ne,bottom:Fe}=W;if(ne===null&&Fe===null)n.scrollForNextCalculateItemsInView=void 0;else if((ne===null||Yt>ne)&&(Fe===null||Mt<Fe)&&!Ru(n)){Ne?YV(e,Ne,qe,Tt,Jt):n.props.onFirstVisibleItemChanged&&fC(n,XV(e,Tt)),(i=Vt?.finishCalculateItemsInView)==null||i.call(Vt);return}}let Y=Ie&&!lt?Fq(e,re):void 0;re&&JR(n);let ce=st||re?0:(s=R??n.startBuffered)!=null?s:0,ie=!st&&!re&&Se>1&&R!==void 0;eN(e,re,{doMVCP:Ie,forceFullUpdate:!!st,optimizeForVisibleWindow:ie,scrollBottomBuffered:Mt,scrollVelocity:ze,startIndex:ce}),Et=po(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let pe;if(re&&Ie&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let ne=n.props.maintainVisibleContentPosition.shouldRestorePosition;pe=new Set;for(let Fe of n.idsInView){let at=N.get(Fe);at!==void 0&&(ne&&!ne(Ae[at],at,Ae)||pe.add(Fe))}}let Ze=n.scroll,pt=(l=de(e,"scrollAdjustPending"))!=null?l:0;Y?.(),Y&&(n.scroll!==Ze||((d=de(e,"scrollAdjustPending"))!=null?d:0)!==pt)&&(kn(n.scroll),D()),re&&(Vt=$n());let ht=null,en=null,tn=null,bt=(c=lt?dt?.targetIndexSeed:void 0)!=null?c:!re&&fe&&N.get(fe)||0;for(let ne=bt;ne>=0;ne--){let Fe=(f=A[ne])!=null?f:Bt(n,ne),at=$[ne],je=(p=ve.get(Fe))!=null?p:mo(e,Fe,ne,Ae[ne]);if(at+je>Yt)bt=ne;else break}if(Se>1)for(;bt>0;){let ne=I[bt];if(ne===1||ne===void 0)break;bt-=1}let yn=!1,sn,ge,Rt=0;for(let ne=0;ne<ct;ne++){let Fe=de(e,`containerItemKey${ne}`);if(Fe!==void 0){let at=N.get(Fe);Rt=Math.max(Rt,at)}}let rt={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},Lt=Ae.length;for(let ne=Math.max(0,bt);ne<Lt&&(!yn||ne<=Rt);ne++){let Fe=(m=A[ne])!=null?m:Bt(n,ne),at=(h=ve.get(Fe))!=null?h:mo(e,Fe,ne,Ae[ne]),je=$[ne];yn||(rN(rt,ne,je,at,Tt,Jt),ht===null&&je+at>Yt&&(ht=ne,en=Fe,Yt<0?sn=null:sn=je),rt.startNoBuffer!==null&&(je<=Mt?(tn=ne,Mt>Et?ge=null:ge=je+at):yn=!0))}Object.assign(n,{endBuffered:tn,endNoBuffer:rt.endNoBuffer,firstFullyOnScreenIndex:rt.firstFullyOnScreenIndex,idsInView:aN(n,rt),startBuffered:ht,startBufferedId:en,startNoBuffer:rt.startNoBuffer}),E&&sn!==void 0&&ge!==void 0&&(n.scrollForNextCalculateItemsInView=Su(sn)&&Su(ge)?void 0:{bottom:ge,top:sn});let et=ct,Nt=[];if(re)for(let ne=0;ne<et;ne++){let Fe=de(e,`containerItemKey${ne}`);(!oe||Fe&&N.get(Fe)===void 0)&&Nt.push(ne)}let ut=n.scrollTargetPinnedRange,ft=0,eo=-1;ut&&(ft=Math.max(0,Math.min(ut.start,ut.end)),eo=Math.min(Lt-1,Math.max(ut.start,ut.end)));let ln=ft<=eo,Nn=ne=>K.has(ne)||ln&&ne>=ft&&ne<=eo;if(ht!==null&&tn!==null){let ne=[],Fe=new Set,at=je=>{var wn;if(je>=0&&je<Lt){let dn=(wn=A[je])!=null?wn:Bt(n,je),Cn=T.get(dn);Cn!==void 0?n.stickyContainerPool.add(Cn):!Su(dn)&&!Fe.has(je)&&(Fe.add(je),ne.push(je))}};for(let je=ht;je<=tn;je++){let wn=(g=A[je])!=null?g:Bt(n,je);T.has(wn)||(Fe.add(je),ne.push(je))}for(let je of H)at(je);if(ln)for(let je=ft;je<=eo;je++)at(je);if(ae.length>0?jV(e,ae,(v=Vt?.currentStickyIdx)!=null?v:-1,ne,Fe,ht,tn):vn!==-1&&Pe(e,"activeStickyIndex",-1),ne.length>0){let wn=zV(e,ne,ht,tn,Nt,O?dn=>{let Cn=O(Ae[dn],dn);return Cn!==void 0?String(Cn):""}:void 0,pe);for(let dn of wn){let Cn=dn.itemIndex,$t=dn.containerIndex,Kn=(x=A[Cn])!=null?x:Bt(n,Cn),Wt=de(e,`containerItemKey${$t}`);Wt&&Wt!==Kn&&T.delete(Wt),Wt!==Kn&&(ot??(ot=new Set),ot.add($t),n.containerItemGenerations[$t]=((y=n.containerItemGenerations[$t])!=null?y:0)+1),Pe(e,`containerItemKey${$t}`,Kn),Pe(e,`containerItemIndex${$t}`,Cn),Pe(e,`containerItemData${$t}`,Ae[Cn]),n.containerItemMetadata.set($t,GR(n,Cn,Ae[Cn],dn.itemType)),T.set(Kn,$t),(C=n.userScrollAnchorReset)==null||C.keys.add(Kn);let vo=`containerSticky${$t}`,Wa=Ee.has(Cn),Ga=Nn(Cn);Wa?(Pe(e,vo,!0),n.stickyContainerPool.add($t)):(de(e,vo)&&Pe(e,vo,!1),Ga?n.stickyContainerPool.add($t):n.stickyContainerPool.delete($t)),$t>=et&&(et=$t+1)}et!==ct&&(Pe(e,"numContainers",et),et>de(e,"numContainersPooled")&&Pe(e,"numContainersPooled",BV(Lt,et)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&QV(e,ae,Tt,xe,(k=Vt?.currentStickyIdx)!=null?k:-1,Nt,Nn);let Hn=Nt.length>0?new Set(Nt):void 0,Un=!1;for(let ne=0;ne<et;ne++){let Fe=de(e,`containerItemKey${ne}`);if(Hn?.has(ne))Fe!==void 0&&(T.delete(Fe),ot??(ot=new Set),ot.add(ne),n.containerItemGenerations[ne]=((S=n.containerItemGenerations[ne])!=null?S:0)+1),n.containerItemMetadata.delete(ne),n.stickyContainerPool.has(ne)&&(Pe(e,`containerSticky${ne}`,!1),n.stickyContainerPool.delete(ne)),Pe(e,`containerItemKey${ne}`,void 0),Pe(e,`containerItemIndex${ne}`,void 0),Pe(e,`containerItemData${ne}`,void 0),Pe(e,`containerPosition${ne}`,sd),Pe(e,`containerColumn${ne}`,-1),Pe(e,`containerSpan${ne}`,1);else{let at=N.get(Fe);at!==void 0&&(Un=kV(e,ne,at,{scrollAdjustPending:xt,updateLayout:!0}).didChangePosition||Un)}}if(ot&&SC&&lg(e,ot),Un&&Pe(e,"lastPositionUpdate",Date.now()),lt){dV(e);return}fC(n,rt.startNoBuffer),!X&&!n.didContainersLayout&&(bu(n)?wu(n,n.startBuffered,n.endBuffered):wu(n,n.startNoBuffer,n.endNoBuffer)||wu(n,n.startBuffered,n.endBuffered))&&(HV(e),SV(e)),Ne&&rt.startNoBuffer!==null&&rt.endNoBuffer!==null&&nN(e.state,e,Ne,qe,rt.startNoBuffer,rt.endNoBuffer,ht??rt.startNoBuffer,tn??rt.endNoBuffer),(L=Vt?.finishCalculateItemsInView)==null||L.call(Vt)})}function dg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=de(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:g,anchorMaxSize:v,anchorOffset:x=0}=r,{data:y}=o.props;if(g>=0&&g<y.length&&o.scrollLength>0){d=Bt(o,g);let C=0,w=!1;for(let S=g;S<y.length;S++){let L=BR(e,S),I=S===g&&v!==void 0?Math.min(L||0,Math.max(0,v)):L;L===void 0&&(w=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+bC(o.props),c=!w;let k=Math.max(0,o.scrollLength-C-x);f=w?Math.min(a||0,k):k}else g>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(i!==l||s!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Gs(e),qs(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&qs(e,o.scroll,!0,{markHasScrolled:!1})),f}function JV(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(Ha(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>Ha(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),Ha(e,{doMVCP:!0}))}function rR(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=de(e,"otherAxisSize");(!a||r>a)&&Pe(e,"otherAxisSize",r)}}var za;function iN(e){let t=za===void 0;za??(za=new Map);try{e()}finally{if(t){let n=za;za=void 0;for(let[o,r]of n)_C(o,r)}}}function ZV(e,t){e.didChange||(e.didChange=t.didChange),e.didMeasureUserScrollAnchorResetItem||(e.didMeasureUserScrollAnchorResetItem=t.didMeasureUserScrollAnchorResetItem),e.needsRecalculate||(e.needsRecalculate=t.needsRecalculate),e.shouldMaintainScrollAtEnd||(e.shouldMaintainScrollAtEnd=t.shouldMaintainScrollAtEnd)}function e4(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,JV(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&dg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&cd(e)}function sN(e,t){if(za){let n=za.get(e);n?n.push(t):za.set(e,[t])}else _C(e,[t])}function _C(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||de(e,`containerItemKey${a.containerId}`)===a.itemKey){let s=o.indexByKey.get(a.itemKey),l=s===void 0||(n=o.props.data)==null?void 0:n[s],d=a.containerId!==void 0&&s!==void 0&&l!==void 0?fV(o,a.containerId,s,l):void 0,c=t4(e,a.itemKey,a.size,d);ZV(r,c)}e4(e,r)}function t4(e,t,n,o){var r,a;let i=e.state,s=i.userScrollAnchorReset,l=!!s?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:h,data:g,maintainScrollAtEnd:v}}=i;if(!g)return{didMeasureUserScrollAnchorResetItem:l};let x=i.indexByKey.get(t);if(f){if(x===void 0)return{didMeasureUserScrollAnchorResetItem:l};let I=i.props.data[x];if(I===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let E=(a=o?.itemType)!=null?a:p&&(r=p(I,x))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,x,E),itemType:E}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return rR(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,w,k=i.sizesKnown.get(t),S=n4(e,t,n,o),L=Lu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,x):x;let{startBuffered:I,endBuffered:T}=i;y||(y=x>=I&&x<=T),!y&&i.containerItemKeys.has(t)&&(y=!0),(k===void 0||Math.abs(k-L)>5)&&(C=!0),h?.({index:x,itemData:i.props.data[x],itemKey:t,previous:L-S,size:L})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),rR(e,n,m),d||wu(i,i.startBuffered,i.endBuffered)){let I=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:y,shouldMaintainScrollAtEnd:I}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function n4(e,t,n,o){var r,a;let i=e.state,{indexByKey:s,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=i;if(!c)return 0;let h=s.get(t),g=c[h],v=o?.itemType,x=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(g,h))!=null?r:"",x=m(g,h,v));let y=o?.didResolveFixedItemSize||v!==void 0||x!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:x,itemType:v}:void 0,C=mo(e,t,h,g,void 0,void 0,void 0,y),w=f?n.width:n.height,k=l.get(t),S=Math.round(w);if(l.set(t,S),x===void 0&&S>0){v??(v=p&&(a=p(g,h))!=null?a:"");let L=d[v];L||(L=d[v]={avg:0,num:0}),L.num===0?(L.avg=S,L.num++):k!==void 0&&k>0?L.avg+=(S-k)/L.num:(L.avg=(L.avg*L.num+S)/(L.num+1),L.num++)}return!C||Math.abs(C-S)>.1?(dC(e,t,S),S-C):0}function o4(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=de(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();eq(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&_C(e,n)}var lN=Wn,la=ue,r4=la(function({children:t}){let n=Br(),[o]=Wo(["containerLayoutEpoch"]);return ye(()=>{{let r=LV(n);r!==void 0&&o4(n,r)}},[n,o]),t}),og=e=>sh(e)?e:e?Te(e,null):null,a4=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),pC={contain:"paint layout style",...a4?{display:"flex",flexDirection:"column"}:{}},i4=la(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=sd]=Wo([`containerPosition${t}`]),s=hg(o)?Object.assign({},...o):o,l=n?{...pC,...s,left:i}:{...pC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Te("div",{ref:r,...m,style:l})}),s4=la(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=sd,p,m]=Wo([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),h=z(()=>{var x;return(x=hg(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=z(()=>{var x;let y={...pC,...h};delete y.transform;let C=(x=i?.offset)!=null?x:0,w=p===m;return y.position=w?"sticky":"absolute",y.zIndex=m+1e3,n?y.left=w?C:f:y.top=w?C:f,y},[h,n,f,m,p,i?.offset]),v=z(()=>i?.backdropComponent?Te("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},og(i.backdropComponent)):null,[i?.backdropComponent]);return Te("div",{ref:r,style:g,...c},v,d)}),l4=i4;function d4(e){G(()=>e())}var dN=Ht(null),c4=-1;function u4(){return fn(dN)}function f4(){var e;let t=u4(),n=(e=t?.containerId)!=null?e:c4,[o]=Wo([`containerItemKey${n}`]);return XK("lastItemKeys",a=>t&&!Su(o)&&a?.includes(o)||!1)}function p4({ItemSeparatorComponent:e,leadingItem:t}){return f4()?null:Te(e,{leadingItem:t})}var rC=null;function m4(){return rC||(rC=new ResizeObserver(e=>{iN(()=>{for(let t of e){let n=rg.get(t.target);if(n)for(let o of n)o(t)}})})),rC}var rg=new WeakMap;function g4(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=m4(),r=(n=rg.get(e))!=null?n:new Set;return r.size===0&&(rg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(rg.delete(e),o.unobserve(e))}}function DC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return ye(()=>{var i,s;let l=e.current,c=((s=(i=l?.getScrollableNode)==null?void 0:i.call(l))!=null?s:null)||l;if(!c)return;let f=(m,h)=>{m.height===0&&m.width===0||(o(m,h),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(aR(m),!0),p=m}return g4(c,m=>{var h;let g=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,x=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(h=g?.getBoundingClientRect())!=null?h:m.contentRect,y=p??ZK(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let w=!!r?.();(C||w)&&f(aR(x),!1)})},[t,...a||[]]),{}}function aR(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var ag=new Map,aC;function cN(e){ag.delete(e)}function h4(e,t){ag.set(e,t),aC===void 0&&(aC=requestAnimationFrame(()=>{let n=Array.from(ag.values());ag.clear(),aC=void 0,iN(()=>{for(let o of n)o()})}))}function v4({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,i=r.itemKey;r.didLayout=!0;let s=n,l=r.horizontal?"width":"height",d=Lu(n[l]);r.lastSize&&Lu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,sN(t,{containerId:e,itemKey:i,size:s})};!Ru(a)&&f!==void 0&&d+1<f?h4(r,()=>{var h;if(r.itemKey===i){let g=o.current,v=(h=g?.getBoundingClientRect)==null?void 0:h.call(g);v&&(s={height:v.height,width:v.width}),p()}}):(cN(r),p())}function x4({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=_({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=G(0),l=B(f=>{v4({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=B(()=>{lg(t,e)},[e,t]);ye(()=>(t.containerLayoutTriggers.set(e,d),()=>{cN(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),ye(()=>{lg(t,e)});let{onLayout:c}=DC({measureInLayoutEffect:!SC,onLayoutChange:l,ref:r,webLayoutResync:()=>Ru(t.state)},[o,i]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function y4({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:i,otherAxisSize:s}){let l;if(e){let{columnGap:d,rowGap:c,gap:f}=e;n?l={paddingBottom:a>1?(c||f||0)/2:void 0,paddingRight:d||f||void 0,paddingTop:a>1?(c||f||0)/2:void 0}:l={paddingBottom:c||f||void 0,paddingLeft:a>1?(d||f||0)/2:void 0,paddingRight:a>1?(d||f||0)/2:void 0}}return n?{bottom:t==="flex-end"&&a===1?0:void 0,boxSizing:l?"border-box":void 0,direction:r&&Ua.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:s,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:i,...l||{}}:{boxSizing:l?"border-box":void 0,left:i,position:"absolute",right:a>1?null:0,top:0,width:s,...l||{}}}var C4=la(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Br(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=qa(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[h=0,g=1,v,x=1,y,C]=Wo([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=_(null),{onLayout:k,triggerLayout:S}=x4({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),L=h>0?h:1,I=Math.min(Math.max(g||1,1),x),T=x>1?`${(L-1)/x*100}%`:0,E=x>1?`${I/x*100}%`:void 0,A=z(()=>y4({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:x,otherAxisPos:T,otherAxisSize:E}),[r,f,T,E,d,l.state.props.contentContainerAlignItems,x,i]),N=z(()=>n!==void 0?a(n):null,[n,v,y]),{renderedItem:R}=N||{},$=z(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return Te(C?m||s4:p||l4,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:k,refView:w,stickyHeaderConfig:s,style:A},Te(dN.Provider,{value:$},R,N&&i&&Te(p4,{ItemSeparatorComponent:i,leadingItem:N.item})))});function b4({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=C4}){let[s]=Wo([`containerItemKey${e}`]);return s===void 0?null:Te(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var I4=la(function(t){return Te(b4,{...t})});function S4(e,t){let n=Array.from(e.children);if(n.length<=1)return n;let o=n.map(l=>{var d;return[l,(d=t.get(l))!=null?d:null]});o.sort((l,d)=>{let c=l[1],f=d[1];return c===null?1:f===null?-1:c-f});let r=new Map;o.forEach((l,d)=>{r.set(l[0],d)});let a=n.map(l=>r.get(l)),i=w4(a),s=new Set(i);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!s.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],h=n.indexOf(m);if(s.has(h)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function w4(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let s=0;s<t;s++){let l=e[s],d=0,c=n.length;for(;d<c;){let f=Math.floor((d+c)/2);e[r[f]]<l?d=f+1:c=f}d===n.length?(n.push(l),r.push(s)):(n[d]=l,r[d]=s),d>0&&(o[s]=r[d-1])}let a=[],i=r[r.length-1];for(;i!==-1;)a.unshift(i),i=o[i];return a}function T4(e){let t=Br(),n=_(void 0);q(()=>{let o=$a(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[i,s]of t.viewRefs){let l=s.current,d=de(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}S4(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function L4(e,t){let[n,o]=G(t),r=n!==t;return ye(()=>{o(t)},[t]),e&&!r}var k4=la(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=_(null),i=Br(),s=i.columnWrapperStyle,l=qa(i.state),[d,c,f]=Wo(["otherAxisSize","readyToRender","totalSize"]),p=L4(!!c,t);T4(a);let m=n?{direction:l?"ltr":void 0,flexShrink:0,minHeight:d,opacity:p?1:0,position:"relative",width:f}:{height:f,minWidth:d,opacity:p?1:0,position:"relative"};if(p||(m.pointerEvents="none"),s&&o>1){let{columnGap:h,rowGap:g,gap:v}=s,x=h||v||0,y=g||v||0;n?(y&&(m.marginTop=m.marginBottom=-y/2),x&&(m.marginRight=-x)):y&&(m.marginBottom=-y)}return Te("div",{ref:a,style:m},Te(r4,null,r))}),P4=la(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Wo(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(Te(I4,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Te(k4,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function A4(e){return hg(e)?Object.assign({},...e.filter(Boolean)):e}var Mu={create:e=>e,flatten:e=>A4(e)};function mC(e){let t=_(e);return t.current=e,t}function E4(e){let t=mC(e),n=_(void 0),o=z(()=>({cancel(){n.current!==void 0&&(cancelAnimationFrame(n.current),n.current=void 0)},flush(){o.cancel(),t.current()},schedule(){if(n.current!==void 0)return!1;let r=requestAnimationFrame(()=>{n.current===r&&(n.current=void 0,t.current())});return n.current=r,!0}}),[]);return q(()=>()=>{o.cancel()},[o]),o}var gC="legend-list-content-container",uN="legend-list-scrollbar-x-hidden",fN="legend-list-scrollbar-y-hidden";function M4(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function hC(){var e,t,n,o;return typeof window>"u"?{x:0,y:0}:{x:(t=(e=window.scrollX)!=null?e:window.pageXOffset)!=null?t:0,y:(o=(n=window.scrollY)!=null?n:window.pageYOffset)!=null?o:0}}function iR(e,t){var n,o;let r=e?.getBoundingClientRect();return{left:((n=r?.left)!=null?n:0)+t.x,top:((o=r?.top)!=null?o:0)+t.y}}function pN(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function R4(e,t,n){return pN(n?t:e)}function sR(e,t,n){var o,r,a,i,s,l;if(t&&typeof window<"u"){let d=e?.getBoundingClientRect();return{height:n&&(r=(o=d?.height)!=null?o:e?.clientHeight)!=null?r:window.innerHeight,width:n?window.innerWidth:(i=(a=d?.width)!=null?a:e?.clientWidth)!=null?i:window.innerWidth}}return{height:(s=e?.clientHeight)!=null?s:0,width:(l=e?.clientWidth)!=null?l:0}}function lR(e,t){return Math.max(0,Math.min(e,t))}function dR(e,t){return t?e.width:e.height}function N4(e,t,n){return Math.max(0,dR(e,n)-dR(t,n))}function cR(e,t){return t&&M4()||e}function _4(e,t){return t&&typeof window<"u"?window:e}function D4(e,t,n){let o=e.getBoundingClientRect(),r=hC();return{height:t&&typeof window<"u"&&!n?window.innerHeight:o.height,width:t&&typeof window<"u"&&n?window.innerWidth:o.width,x:t?o.left+r.x:o.left,y:t?o.top+r.y:o.top}}function O4({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var uR="legend-list-scrollbar-axis-hidden-style",F4=200,B4=`.${fN}::-webkit-scrollbar:vertical{width:0;display:none;}.${uN}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function z4(){if(typeof document>"u"||document.getElementById(uR))return;let e=document.createElement("style");e.id=uR,e.textContent=B4,document.head.appendChild(e)}function $4(e){var t,n;let o=(n=(t=e.state)==null?void 0:t.props)==null?void 0:n.contentInsetEndAdjustment;return Math.max(0,o??0)}function H4(e){if(!e?.length)return[];let t=[],n=new Set;for(let o of e)Number.isFinite(o)&&!n.has(o)&&(n.add(o),t.push(o));return t}function U4(e,t){return{height:t?"100%":1,left:t?e:0,pointerEvents:"none",position:"absolute",scrollSnapAlign:"start",top:t?0:e,width:t?1:"100%"}}var fR=Wn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:i,maintainVisibleContentPosition:s,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:h=!1,onLayout:g,...v},x){var y,C,w;let k=Br(),[S]=Wo(["anchoredEndSpaceSize"]),L=_(null),I=_(null),T=h,E=B(()=>_4(L.current,T),[T]),A=B(()=>{let He=L.current,Se=R4(He,I.current,T),ze=sR(He,T,a);return N4(Se,ze,a)},[a,T]),N=B(()=>{let He=L.current;if(T){let Se=A(),ze=hC(),Je=iR(He,ze),qt=a?ze.x-Je.left:ze.y-Je.top;return lR(qt,Se)}return He?a?He.scrollLeft:He.scrollTop:0},[A,a,T]),R=B((He,Se)=>{let ze=L.current,Je=E();if(!Je||typeof Je.scrollTo!="function")return;let qt=A(),X=lR(He,qt),xt={behavior:Se?"smooth":"auto"};if(T){let mn=hC(),Tt=iR(ze,mn),{left:Yt,top:Jt}=O4({clampedOffset:X,horizontal:a,listPos:Tt,scroll:mn});xt.left=Yt,xt.top=Jt}else a?xt.left=X:xt.top=X;Je.scrollTo(xt)},[A,E,a,T]);Gr(x,()=>({getBoundingClientRect:()=>{var Se;return(Se=L.current)==null?void 0:Se.getBoundingClientRect()},getCurrentScrollOffset:N,getScrollableNode:()=>cR(L.current,T),getScrollEventTarget:()=>E(),getScrollResponder:()=>cR(L.current,T),isWindowScroll:()=>T,scrollBy:(Se,ze)=>{let Je=E();!Je||typeof Je.scrollBy!="function"||Je.scrollBy({behavior:"auto",left:Se,top:ze})},scrollTo:Se=>{let{x:ze=0,y:Je=0,animated:qt=!0}=Se;R(a?ze:Je,qt)},scrollToEnd:(Se={})=>{let{animated:ze=!0}=Se,Je=A();R(Je,ze)},scrollToOffset:Se=>{let{offset:ze,animated:Je=!0}=Se;R(ze,Je)}}),[N,A,E,a,T,R]);let $=B(()=>{if(!l||!L.current)return;let He=pN(I.current),Se=sR(L.current,T,a),ze=N(),Je={nativeEvent:{contentOffset:{x:a?ze:0,y:a?0:ze},contentSize:{height:He.height,width:He.width},layoutMeasurement:{height:Se.height,width:Se.width}}};l(Je)},[N,a,T,l]),H=E4($),K=_(void 0),O=B(()=>{let He=K.current;He!==void 0&&(clearTimeout(He),K.current=void 0),H.flush(),d?.()},[d,H]),oe=B(He=>{if(!l)return;let Se=k.state;if(!!Se?.scrollingTo||!!Se?.initialScrollSession&&!Se.didFinishInitialScroll||!!Se?.initialScroll&&!Se.didFinishInitialScroll||!!Se&&Ru(Se)?H.flush():H.schedule(),d){let Je=K.current;Je!==void 0&&clearTimeout(Je),K.current=setTimeout(O,F4)}},[k.state,O,d,l,H]);ye(()=>{let He=E();if(He)return He.addEventListener("scroll",oe,{passive:!0}),"onscrollend"in He&&He.addEventListener("scrollend",O),()=>{He.removeEventListener("scroll",oe),"onscrollend"in He&&He.removeEventListener("scrollend",O);let Se=K.current;Se!==void 0&&(clearTimeout(Se),K.current=void 0),H.cancel()}},[O,E,oe,H]),q(()=>{let He=()=>{i&&R(a?i.x||0:i.y||0,!1)};He(),requestAnimationFrame(He)},[i?.x,i?.y,a,R]),ye(()=>{if(!g||!L.current)return;let He=L.current,Se=()=>{g({nativeEvent:{layout:D4(He,T,a)}})};Se();let ze=new ResizeObserver(()=>{Se()});ze.observe(He);let Je=()=>{Se()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",Je),()=>{ze.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Je)}},[T,g]);let ee=!T&&(a?!f&&uN:!p&&fN);ye(()=>{ee&&z4()},[ee]);let W={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Mu.flatten(n),...s?{overflowAnchor:"none"}:{}},qe=$4(k),ve=(C=(y=k.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&S?S:0,fe=Math.max(0,qe-ve),Ne=fe?a?{flexShrink:0,width:fe}:{height:fe}:void 0,Ae={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...Mu.flatten(r),...s?{overflowAnchor:"none"}:{}},ae=o?`${gC} ${o}`:gC,{contentContainerClassName:Ee,contentInset:xe,scrollEventThrottle:re,ScrollComponent:Ie,snapToOffsets:st,useWindowScroll:dt,className:lt,...ct}=v,Et=T?[]:H4(st);Et.length>0&&(W.scrollSnapType=a?"x mandatory":"y mandatory",Ae.position=(w=Ae.position)!=null?w:"relative");let ot=ee?lt?`${lt} ${ee}`:ee:lt;return Vo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${lt??""}`)&&Us("className-gap","className/contentContainerClassName gap classes are not supported in LegendList because it needs to use exact values internally. Use contentContainerStyle={{ gap: ... }} or columnWrapperStyle instead."),Te("div",{className:ot,ref:L,...ct,style:W},m,Te("div",{className:ae,ref:I,style:Ae},Et.map(He=>Te("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":He,key:`snap-${He}`,style:U4(He,a)})),t,Ne?Te("div",{"aria-hidden":!0,style:Ne}):null))});function K4({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function pR(e,t){let n=Br();ye(()=>$a(n,e,r=>{t(r)}),[t,n,e])}function q4(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function V4(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,i=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,s=null;return i&&(s=t?.isConnected&&t.parentElement===i?t:i.querySelector(`:scope > .${gC}`)),i?{contentNode:s,scrollElement:i}:null}function W4(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function G4(){let e=Br(),t=_(0),n=_(0),o=_(void 0),r=_(void 0),a=_(null),i=B(()=>{let s=de(e,"scrollAdjust"),l=de(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=V4(e,a.current);if(f){let p=!!e.state.props.horizontal,m=q4(p),{contentNode:h,scrollElement:g}=f,v=p?g.scrollLeft:g.scrollTop,x=(l||0)-n.current,C=(x!==0?v+x:e.state.scroll)-v,w=Math.abs(C)>.01,k=()=>W4(g,m.x*C,m.y*C);if(a.current=h,w&&h){let S=h[m.contentSizeKey],L=g[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+L){let E=h.style[m.paddingEndProp],A=r.current,N=A?.value===E?A.baseline:E,R=(I+L-S)*2,H=`${(Number.parseFloat(window.getComputedStyle(h)[m.paddingEndProp])||0)+R}px`;h.style[m.paddingEndProp]=H,r.current={baseline:N,value:h.style[m.paddingEndProp]},h.offsetHeight,k(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let K=r.current;o.current=void 0,r.current=void 0,h.style[m.paddingEndProp]===K?.value&&(h.style[m.paddingEndProp]=K.baseline)})}else k()}else w&&k()}t.current=d,n.current=l||0}},[e]);return pR("scrollAdjust",i),pR("scrollAdjustUserOffset",i),null}var j4=Wn(function({ScrollComponent:t,...n},o){let[r]=Wo(["snapToOffsets"]);return Te(t,{...n,ref:o,snapToOffsets:r})}),vC=.1;function Q4(e,t,n){let o=de(e,t)!==n;return o&&(Pe(e,t,n),Gs(e)),o}function X4(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:i,scrollingTo:s}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!s&&i>=c-vC&&Math.abs(l)>vC}function mR(e,t){let{state:n}=e,o=de(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>vC;r&&(Pe(e,"headerSize",t),Gs(e),a&&X4(e,o,t)&&js(e,t-o)),n.didMeasureHeader=!0}function Y4(e,t){let n=Q4(e,"footerSize",t);return n&&dg(e),n}function J4(e,t){var n,o,r,a,i,s,l,d;return((n=e?.top)!=null?n:0)===((o=t?.top)!=null?o:0)&&((r=e?.bottom)!=null?r:0)===((a=t?.bottom)!=null?a:0)&&((i=e?.left)!=null?i:0)===((s=t?.left)!=null?s:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function Z4(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!J4(o,r);return n.contentInsetOverride=r,a&&Gs(e),a}function eW(e,t){let n=mC(e),o=mC(t);return z(()=>Wn((r,a)=>{var i,s;return(s=(i=n.current)==null?void 0:i.call(n,o.current(r,a)))!=null?s:null}),[o,n])}var gR=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=_(null),a=t??r;return DC({onLayoutChange:e,ref:a}),Te("div",{...o,ref:a},n)},tW=la(function({horizontal:t}){let[n=0]=Wo(["alignItemsAtEndPadding"]);return n<=0?null:Te(cg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),nW=la(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:i,recycleItems:s,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:h,ListFooterComponentStyle:g,ListEmptyComponent:v,getRenderedItem:x,refScrollView:y,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:k,onInternalScrollEnd:S,scrollAdjustHandler:L,snapToIndices:I,stickyHeaderConfig:T,stickyHeaderIndices:E,useWindowScroll:A=!1,...N}){let R=Br(),$=R.state.props.maintainVisibleContentPosition,[H=0,K=0]=Wo(["anchoredEndSpaceSize","otherAxisSize"]),O=R.state.props.alignItemsAtEndPaddingEnabled,oe=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&H>0,ee;if(oe){let Ee=a?qa(R.state)?"Left":"Right":"Bottom",xe=Mu.flatten(r);ee={[`padding${Ee}`]:Cu({},xe||{},Ee)+H}}let W=K4({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:K}),qe=eW(C,(Ee,xe)=>({...Ee,ref:xe})),ve=C?qe:fR,fe=I?j4:ve,Ne=B((Ee,xe)=>{var re;let Ie=Y4(R,Ee);xe?.(),Ie&&((re=R.state.props.maintainScrollAtEnd)!=null&&re.onFooterLayout)&&cd(R)},[R]);ye(()=>{p||mR(R,0),h||Ne(0)},[p,h,R,Ne]);let Ae=B(Ee=>{let xe=Ee[a?"width":"height"];mR(R,xe)},[R,a]),ae=B((Ee,xe)=>{let re=Ee[a?"width":"height"];Ne(re,()=>{w?.(Ee,xe)})},[a,w,Ne]);return Te(fe,{...N,...ve===fR?{onInternalScrollEnd:S,useWindowScroll:A}:{},contentContainerStyle:[a?{height:"100%"}:{},r,ee,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:$.size||$.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:y,ScrollComponent:I?ve:void 0,style:W?[W,o]:o},Te(G4,null),p&&Te(gR,{onLayoutChange:Ae,style:m},og(p)),v&&og(v),O&&Te(tW,{horizontal:a}),t&&!v&&Te(P4,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),h&&Te(gR,{onLayoutChange:ae,style:g},og(h)),Vo&&nq)}),oW=100,rW=.9,aW=.9;function iW(e){let t=Br(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;q(()=>{l&&(a??1)>1&&Us("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),q(()=>{s&&i&&Us("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),q(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Us("keyExtractor","Changing data without a keyExtractor can cause slow performance and resetting scroll. If your list data can change you should use a keyExtractor with a unique id for best performance and behavior.")},[o,t,r]),q(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<oW)return;let p=()=>{let h=de(t,"readyToRender"),g=de(t,"numContainers")||0,v=de(t,"totalSize")||0,x=t.state.scrollLength||0;if(!h||v<=0||x<=0)return;let y=g>=Math.ceil(c*rW),C=x>=v*aW;y&&C&&Us("webUnboundedOuterSize","LegendList appears to have an unbounded outer height on web, so virtualization is effectively disabled. Set a bounded height or flex: 1 on the list container, or use useWindowScroll.")};p();let m=[$a(t,"numContainers",p),$a(t,"readyToRender",p),$a(t,"totalSize",p)];return()=>{for(let h of m)h()}},[t])}function sW(e){}var lW=Vo?iW:sW;function dW(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),jR(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}Ha(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&cd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||mg(e),delete o.previousData}function cW(e,t,n){var o;if(e.pendingDataComparison=void 0,!n||!t||t.length!==n.length)return!0;let{idCache:r,props:{itemsAreEqual:a,keyExtractor:i}}=e,s;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!i)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:i(n[l],l),c=i(t[l],l);if(d!==c)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;if(!a)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(s??(s=[]),s[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:s,nextData:t,previousData:n},!0}return!1}function mN(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=NR(e),f=de(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let h=0,g=Math.min(20,a.length);for(let v=0;v<g;v++){let x=a[v];if(x!==void 0){let y=(t=s?.(x,v))!=null?t:"";h+=((n=i(x,v,y))!=null?n:d)+e.scrollAxisGap}}p=h/g}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let h=0;h<m;h++)Pe(e,`containerPosition${h}`,sd),Pe(e,`containerColumn${h}`,-1),Pe(e,`containerSpan${h}`,1);return Pe(e,"numContainers",m),Pe(e,"numContainersPooled",FV(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Ha(e,{dataChanged:!0,doMVCP:!0})}):Ha(e,{dataChanged:!0,doMVCP:!0})),!0}}function uW(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function fW(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,i=o.props.horizontal?"width":"height",s=o.props.horizontal?"height":"width",l=t;if(a){let v=uW()[i];l=v>0?{...t,[i]:v}:t}let d=l[i],c=o.scrollLength,f=d>0?d:c,p=l[s],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let h=o.otherAxisSize,g=f!==o.scrollLength||p!==h;if(g){if(o.scrollLength=f,o.otherAxisSize=p,Gs(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&mN(e),m&&Ha(e,{doMVCP:!0}),(g||p!==h)&&Pe(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&cd(e),mg(e),o){let v=o.props.horizontal?(o.props.stylePaddingTop||0)+(o.props.stylePaddingBottom||0):(o.props.stylePaddingLeft||0)+(o.props.stylePaddingRight||0);o.needsOtherAxisSize=p-v<10}Vo&&d===0&&Us("height0",`List ${o.props.horizontal?"width":"height"} is 0. You may need to set a style or \`flex: \` for the list, because children are absolutely positioned.`)}n(!0)}function pW(e,t){let n=oo.get(e);if(!!n&&oo.didReachTarget(t,n)){oo.clear(e);return}n&&(e.hasScrolled=!1,oo.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function mW(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function gW(e){return{...e,nativeEvent:{...e.nativeEvent}}}function hW(e,t){var n,o,r,a,i,s;let l=e.state,{scrollProcessingEnabled:d}=l;if(d===!1||((o=(n=t.nativeEvent)==null?void 0:n.contentSize)==null?void 0:o.height)===0&&((r=t.nativeEvent.contentSize)==null?void 0:r.width)===0)return;let c=!1;if((a=t.nativeEvent)!=null&&a.contentInset){let{contentInset:p}=t.nativeEvent,m=l.nativeContentInset;(!m||m.top!==p.top||m.bottom!==p.bottom||m.left!==p.left||m.right!==p.right)&&(l.nativeContentInset=p,c=!0)}let f=t.nativeEvent.contentOffset[l.props.horizontal?"x":"y"];if(l.props.horizontal&&(f=UK(l,f,(i=t.nativeEvent.contentSize)==null?void 0:i.width)),l.didFinishInitialScroll&&((s=l.initialScroll)==null?void 0:s.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=Mi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,yg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,qs(e,f,c,{fromNativeScrollEvent:!0}),pW(l,f),rV(e),l.scrollingTo&&RC(e),l.props.onScroll&&(mW(l)?l.deferredPublicOnScrollEvent=gW(t):l.props.onScroll(t))}var vW=class{constructor(){this.work=new Map}timeout(e,t,n){n&&this.cancel(n);let o=[void 0,clearTimeout],r=setTimeout(()=>{let a=n??r;this.work.get(a)===o&&(this.work.delete(a),e())},t);o[0]=r,this.work.set(n??r,o)}frame(e,t){this.cancel(t);let n=[void 0,cancelAnimationFrame];this.work.set(t,n),n[0]=requestAnimationFrame(()=>{this.work.get(t)===n&&(this.work.delete(t),e())})}register(e,t){this.cancel(e),this.work.set(e,[void 0,t])}cancel(e){let t=this.work.get(e);if(t){this.work.delete(e);let[n,o]=t;o(n)}}has(e){return this.work.has(e)}dispose(){for(let[e,t]of this.work.values())t(e);this.work.clear()}},xW=class{constructor(e){this.appliedAdjust=0,this.pendingAdjust=0,this.ctx=e}requestAdjust(e){let t=this.ctx.state.scrollingTo;t?.animated&&!t.isInitialScroll?(this.pendingAdjust+=e,Pe(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&RC(this.ctx)}getAdjust(){return this.appliedAdjust}commitPendingAdjust(e){{let t=this.ctx.state,n=this.pendingAdjust;if(this.pendingAdjust=0,n!==0){let o;if(e?.index!==void 0){let a=gg(this.ctx,e.index);o=vg(this.ctx,a,e),o=Mi(this.ctx,o,e)}else o=Mi(this.ctx,t.scroll+n);let r=o-t.scroll;(Math.abs(r)>.1||Math.abs(n)>.1)&&(this.appliedAdjust+=r,t.scroll=o,t.scrollForNextCalculateItemsInView=void 0,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),Pe(this.ctx,"scrollAdjustPending",0),Ha(this.ctx)}}}};function yW(e,t){let n=e.state,o=Ks(e,t),a=Ks(e)-o;if(a!==0){let i=!!de(e,"isWithinMaintainScrollAtEndThreshold");qs(e,n.scroll,!0,{markHasScrolled:!1}),!YR(e)&&i&&a>0&&js(e,a)}}function iC(e){return z(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var CW=(...e)=>B(n=>{for(let o of e)o&&(OR(o)?o(n):o.current=n)},e);function bW(e){return null}function IW(e,t,n,o){return o}function SW(e){let{gap:t,columnGap:n,rowGap:o}=e;if(t||n||o)return e.gap=void 0,e.columnGap=void 0,e.rowGap=void 0,{columnGap:n,gap:t,rowGap:o}}function wW(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=de(e,"footerSize")||0;return ng(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var TW="default";function LW(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||TW]={average:o.avg,count:o.num})}return t}function kW(e){lg(e)}function PW(e,t){let n=e.state,o=800,r=2,a=0,i=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,s=(g,v=!1)=>{var x;let y=n.props,C=y.data.length,w=(x=y.anchoredEndSpace)==null?void 0:x.anchorIndex;return g<0?v:g>=C?!1:w===void 0||w<0||w>=C||g<w?!0:Cq(e,w,C-1)},l=(g,v,x)=>{let y=Date.now(),C=0,w=()=>{if(g!==a)return;i()||!x()?C=0:C+=1;let k=Date.now()-y>=o;if(C>=r||k){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(g,v,x,y=()=>!0)=>{let C=()=>{if(g!==a)return;(!x()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!y()?l(g,C,y):C()},c=g=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return TR(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);WM(e),d(y,x,g,v)});n.runPendingScrollToEnd=()=>{let g=n.pendingScrollToEnd;g&&(n.pendingScrollToEnd=void 0,g.token===a&&d(g.token,g.resolve,()=>wW(e,g.options),()=>s(n.props.data.length-1,!0)))};let p=g=>{if(n){let{index:v,...x}=g,{startNoBuffer:y,endNoBuffer:C}=n;if(v<y||v>C){let w=v<y?0:1;return ng(e,{...x,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:g=>{var v,x;let y=(v=g?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),jR(n);for(let C in n.averageSizes)delete n.averageSizes[C];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Pe(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),kW(e),(x=n.triggerCalculateItemsInView)==null||x.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var g,v,x;return(x=(v=(g=m.current).getNativeScrollRef)==null?void 0:v.call(g))!=null?x:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:de(e,"activeStickyIndex"),contentLength:po(e),data:n.props.data,elementAtIndex:g=>{var v;return(v=e.viewRefs.get(cC(e,Bt(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>LW(n),indexByKey:g=>n.indexByKey.get(g),isAtEnd:de(e,"isAtEnd"),isAtStart:de(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:de(e,"isNearEnd"),isNearStart:de(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:de(e,"isWithinMaintainScrollAtEndThreshold"),listen:(g,v)=>$a(e,g,v),listenToPosition:(g,v)=>jK(e,g,v),positionAtIndex:g=>n.positions[g],positionByKey:g=>{let v=n.indexByKey.get(g);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:xg(n),sizeAtIndex:g=>n.sizesKnown.get(Bt(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=Z4(e,g);qs(e,n.scroll,!0,{markHasScrolled:!1}),v&&YR(e)},scrollIndexIntoView:g=>f(()=>p(g)),scrollItemIntoView:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(p({index:y,...v}),!0):!1}),scrollToEnd:g=>new Promise(v=>{var x;let y=c(v);n.pendingScrollToEnd={options:g,resolve:v,token:y},t?.(),WM(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(ng(e,g),!0),g.index>=0?()=>s(g.index):void 0),scrollToItem:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(ng(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(yg(e,g),!0)),setItemSize:(g,v)=>{sN(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=OR(g)?g(de(e,"scrollAdjustUserOffset")||0):g;Pe(e,"scrollAdjustUserOffset",v)}}}var AW=(e,t)=>e-t,hR=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,yu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function EW(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=hR(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)yu(i,s,f);let d=hR(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)yu(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&yu(i,s,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<s&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(yu(i,s,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:s;p<s;p++)yu(i,s,p)}let c=Array.from(i);return c.sort(AW),c}function MW(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:i,renderItem:s}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=de(e,"extraData"),f=a[l];if(s&&!Su(f)){let p={data:a,extraData:c,index:l,item:f,type:i&&(n=i(f,l))!=null?n:""};d=s(p)}return{index:l,item:a[l],renderedItem:d}}function vR(e,t){var n,o,r,a;return{animated:!1,onDataChange:t?(n=e?.dataChange)!=null?n:!1:!0,onFooterLayout:t?(o=e?.footerLayout)!=null?o:!1:!0,onItemLayout:t?(r=e?.itemLayout)!=null?r:!1:!0,onLayout:t?(a=e?.layout)!=null?a:!1:!0}}function RW(e){var t;return e?e===!0?{...vR(void 0,!1),animated:!1}:{...vR(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function NW(e){var t,n;return e===!0?{data:!0,size:!0}:e&&typeof e=="object"?{data:(t=e.data)!=null?t:!1,shouldRestorePosition:e.shouldRestorePosition,size:(n=e.size)!=null?n:!0}:e===!1?{data:!1,size:!1}:{data:!1,size:!0}}function _W(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=de(e,"stylePaddingTop")||0;if(t<o){let r=de(e,"totalSize")||0;Pe(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=de(e,"totalSize")||0,Pe(e,"totalSize",r-o)},16)}Pe(e,"stylePaddingTop",t)}}function DW(e){let t=_(null),n=_(0),o=_(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return B((i,s,...l)=>{{let d=Date.now();o.current=l,d-n.current>=s?(n.current=d,i(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),i(...o.current),t.current=null,o.current=null)},s-(d-n.current)))}},[e])}function OW(e,t){let n=DW("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var FW=la(lN(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(hg(o)?o:ah.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Te(VK,null,Te(BW,{...l,ref:n}))})),BW=lN(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k;let S=B($e=>{},[]);t.recycleItems===void 0&&Us("recycleItems-omitted","recycleItems was not provided, so it defaults to false. Set recycleItems explicitly to true for better performance with recycling-aware rows, or false to preserve remount-on-reuse behavior.");let{alignItemsAtEnd:L=!1,anchoredEndSpace:I,alwaysRender:T,columnWrapperStyle:E,contentContainerStyle:A,contentInset:N,data:R=[],dataKey:$,dataVersion:H,drawDistance:K=250,contentInsetEndAdjustment:O,estimatedItemSize:oe=100,estimatedListSize:ee,extraData:W,getFixedItemSize:qe,getItemType:ve,horizontal:fe,rtl:Ne,estimatedHeaderSize:Ae,initialScrollAtEnd:ae=!1,initialScrollIndex:Ee,initialScrollOffset:xe,experimental_adaptiveRender:re,itemsAreEqual:Ie,keyExtractor:st,ListEmptyComponent:dt,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Et,maintainScrollAtEnd:ot=!1,maintainScrollAtEndThreshold:He=.1,maintainVisibleContentPosition:Se,numColumns:ze=1,overrideItemLayout:Je,onEndReached:qt,onEndReachedThreshold:X=.5,onItemSizeChanged:nn,onMetricsChange:xt,onLayout:mn,onLoad:Tt,onMomentumScrollEnd:Yt,onRefresh:Jt,onScroll:Mt,onScrollBeginDrag:zn,onStartReached:kn,onStartReachedThreshold:vn=.5,onStickyHeaderChange:$n,onFirstVisibleItemChanged:Vt,onViewableItemsChanged:Zt,progressViewOffset:Sn,recycleItems:ho=!1,refreshControl:zt,refreshing:D,refScrollView:Y,renderScrollComponent:ce,renderItem:ie,scrollEventThrottle:pe,snapToIndices:Ze,stickyHeaderIndices:pt,style:xn,useWindowScroll:ht=!1,viewabilityConfig:en,viewabilityConfigCallbackPairs:tn,...bt}=t,yn=t.animatedPropsInternal,sn=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",ge=t.positionComponentInternal,Rt=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:rt,positionComponentInternal:Lt,stickyPositionComponentInternal:et,...Nt}=bt,ut=Mu.flatten(A),ft=L&&!fe&&ut?.minHeight==null&&R.length>0,eo=L&&!ft&&(fe?ut?.minWidth==null:ut?.minHeight==null),ln={...ut,...L&&!ft?{display:"flex",flexDirection:fe?"row":"column",...eo?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},Nn={...Mu.flatten(xn)},Hn=Cu(Nn,ln,"Top"),Un=Cu(Nn,ln,"Bottom"),ne=Cu(Nn,ln,"Left"),Fe=Cu(Nn,ln,"Right"),at=bC({horizontal:fe,rtl:Ne,stylePaddingBottom:Un,stylePaddingLeft:ne,stylePaddingRight:Fe}),je=RW(ot),wn=NW(Se),dn=Ee!=null,Cn=xe!=null,$t=!ae&&!dn&&!Cn&&CC({horizontal:fe,rtl:Ne}),Kn=!ae&&!dn&&(Cn||$t),Wt=ae||dn,vo=ae?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-at,viewPosition:1}:dn?typeof Ee=="object"?{index:(r=Ee.index)!=null?r:0,preserveForBottomPadding:Ee.viewOffset===void 0&&Ee.viewPosition===1?!0:void 0,viewOffset:(a=Ee.viewOffset)!=null?a:Ee.viewPosition===1?-at:0,viewPosition:(i=Ee.viewPosition)!=null?i:0}:{index:Ee??0,viewOffset:xe??0}:Kn?{contentOffset:xe??0,index:0,viewOffset:0}:void 0,[Wa,Ga]=G(!SC),[,Ni]=Za($e=>$e+1,0),he=Br();he.columnWrapperStyle=E||(ln?SW(ln):void 0);let da=fe?(d=(s=he.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=he.columnWrapperStyle)==null?void 0:l.gap:(p=(c=he.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=he.columnWrapperStyle)==null?void 0:f.gap,Go=typeof da=="number"&&Number.isFinite(da)?da:0,ja=_(null),gd=CW(ja,Y),ca=st??(($e,vt)=>vt.toString()),qn=pt,_t=O,ro=_(_t),on=z(()=>{let $e=EW(T,R,ca,I?.anchorIndex);return{arr:$e,set:new Set($e)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(h=T?.keys)==null?void 0:h.join(","),R,$,H,ca]),_i=!!ht&&!ce,It=_(void 0),xo=!!Je,bn=_(xo);if(!It.current){if(!he.state){let $e=(ee??{height:0,width:0})[fe?"width":"height"];he.values.set("adaptiveRender",(g=re?.initialMode)!=null?g:"normal"),he.state={averageSizes:{},columnSpans:[],columns:[],containerItemGenerations:[],containerItemKeys:new Map,containerItemMetadata:new Map,contentInsetOverride:void 0,dataChangeEpoch:0,dataChangeNeedsScrollUpdate:!1,didColumnsChange:!1,didDataChange:!1,didLoad:!1,enableScrollForNextCalculateItemsInView:!0,endBuffered:-1,endNoBuffer:-1,endReachedSnapshot:void 0,firstFullyOnScreenIndex:-1,freshDataTransitionEpoch:0,hasHadNonEmptyData:R.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:vo,initialScrollSession:vo?{kind:Kn?"offset":"bootstrap",previousDataLength:R.length}:void 0,isEndReached:null,isFirst:!0,isStartReached:null,lastBatchingAction:Date.now(),lastLayout:void 0,lastScrollDelta:0,loadStartTime:Date.now(),minIndexSizeChanged:0,nativeContentInset:void 0,nativeMarginTop:0,pendingDataComparison:void 0,pendingNativeMVCPAdjust:void 0,positions:[],props:{},queuedCalculateItemsInView:0,refScroller:{current:null},scheduledWork:new vW,scroll:0,scrollAdjustHandler:new xW(he),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:$e,scrollPending:0,scrollPrev:0,scrollPrevTime:0,scrollProcessingEnabled:!0,scrollTime:0,sizes:new Map,sizesKnown:new Map,startBuffered:-1,startNoBuffer:-1,startReachedSnapshot:void 0,stickyContainerPool:new Set,stickyContainers:new Map,totalSize:0,viewabilityConfigCallbackPairs:void 0};let vt=he.state;vt.triggerCalculateItemsInView=cn=>Ha(he,cn),vt.reprocessCurrentScroll=()=>qs(he,vt.scroll,!0),Pe(he,"maintainVisibleContentPosition",wn),Pe(he,"extraData",W),Ae!==void 0&&Pe(he,"headerSize",Ae)}It.current=he.state}let _e=It.current,Gt=_e.isFirst,Eo=_e.props.adaptiveRender,gr=_e.props.numColumns,Di=!Gt&&he.scrollAxisGap!==Go;he.scrollAxisGap=Go,_e.didColumnsChange=ze!==gr||Di;let yo=(x=(v=_e.props.data)==null?void 0:v.length)!=null?x:0,Hr=_e.props.data!==R,jo=_e.props.dataKey!==$,hr=_e.props.dataVersion!==H,ao=jo||hr||Hr&&cW(_e,R,_e.props.data),Ur=!Gt&&ao&&_e.hasHadNonEmptyData&&(jo||yo===0)&&R.length>0;ao&&!ae&&_e.didFinishInitialScroll&&((y=_e.initialScroll)==null?void 0:y.viewPosition)===1&&_e.props.data.length>0&&ld(_e),ao&&(_e.dataChangeEpoch+=1,_e.dataChangeNeedsScrollUpdate=!0,_e.didDataChange=!0,_e.previousData=_e.props.data),Ur&&(_e.freshDataTransitionEpoch+=1);let ua=OW(Mt??S,pe??0),Oi=pe&&Mt?ua:Mt,_n=!Gt&&!ao&&((C=_e.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;_e.props={adaptiveRender:re,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:ft,alwaysRender:T,alwaysRenderIndicesArr:on.arr,alwaysRenderIndicesSet:on.set,anchoredEndSpace:I,anchoredEndSpaceOwner:sn,animatedProps:yn,contentContainerAlignItems:ln.alignItems,contentInset:N,contentInsetEndAdjustment:_t,data:R,dataKey:$,dataVersion:H,drawDistance:K,estimatedItemSize:oe,getFixedItemSize:iC(qe),getItemType:iC(ve),horizontal:!!fe,itemsAreEqual:Ie,keyExtractor:iC(ca),maintainScrollAtEnd:je,maintainScrollAtEndThreshold:He,maintainVisibleContentPosition:wn,numColumns:ze,onEndReached:qt,onEndReachedThreshold:X,onFirstVisibleItemChanged:Vt,onItemSizeChanged:nn,onLoad:Tt,onMomentumScrollEnd:Yt,onScroll:Oi,onScrollBeginDrag:zn,onStartReached:kn,onStartReachedThreshold:vn,onStickyHeaderChange:$n,overrideItemLayout:Je,positionComponentInternal:ge,recycleItems:!!ho,renderItem:ie,rtl:Ne,snapToIndices:Ze,stickyHeaderIndicesArr:qn??[],stickyHeaderIndicesSet:z(()=>new Set(qn??[]),[qn?.join(",")]),stickyPositionComponentInternal:Rt,stylePaddingBottom:Un,stylePaddingLeft:ne,stylePaddingRight:Fe,stylePaddingTop:Hn,useWindowScroll:_i},_e.refScroller=ja,!Gt&&Eo&&!re&&wC(he);let Fi=z(()=>R.length?Array.from({length:Math.min(ze,R.length)},($e,vt)=>Bt(_e,R.length-1-vt)):[],[R,$,H,ze]),Oo=$e=>{Pe(he,"lastItemKeys",Fi),Pe(he,"numColumns",ze);let vt=de(he,"stylePaddingTop");_W(he,{stylePaddingTop:Hn}),It.current.props.stylePaddingBottom=Un,Gs(he);let cn=Hn-vt;$e&&wn.size&&cn&&vt!==void 0&&Ua.OS};Gt&&(Oo(!1),JR(_e),eN(he,!0));let Bi=z(()=>{var $e,vt;let cn=_e.initialScroll;if(!cn)return;let rn=($e=cn.contentOffset)!=null?$e:Fr(he,cn);return Wt&&((vt=_e.initialScrollSession)==null?void 0:vt.kind)==="bootstrap"&&Ua.OS==="web"?void 0:rn},[Wt]);ye(()=>{wV(he,{alwaysDispatchInitialScroll:$t,dataLength:R.length,hasFooterComponent:!!lt,initialContentOffset:Bi,initialScrollAtEnd:ae,useBootstrapInitialScroll:Wt})},[]),(Gt||ao||_e.didColumnsChange)&&(It.current.lastBatchingAction=Date.now(),!st&&!Gt&&ao&&(It.current.sizes.clear(),It.current.positions.length=0,It.current.totalSize=0,Pe(he,"totalSize",0))),Vo&&lW(t),ye(()=>{Ur&&LC(he,{resetInitialScroll:!!vo,resetLayout:!0}),TV(he,{dataLength:R.length,didDataChange:ao,didStartFreshData:Ur,initialScrollAtEnd:ae,latestInitialScroll:vo,latestInitialScrollSessionKind:Kn?"offset":"bootstrap",stylePaddingEnd:at,useBootstrapInitialScroll:Wt})},[R.length,$,ao,Ur,ae,at,Wt]),ye(()=>{var $e;_n&&(_e.scrollForNextCalculateItemsInView=void 0,($e=_e.triggerCalculateItemsInView)==null||$e.call(_e)),dg(he)},[he,R,H,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,_n,fe,ze,Ne,Un,ne,Fe]),ye(()=>{let $e=ro.current;ro.current=_t,yW(he,$e)},[he,_t]);let Fo=B($e=>{Wt&&sV(he,{dataLength:R.length,footerSize:$e[fe?"width":"height"],initialScrollAtEnd:ae,stylePaddingEnd:at})},[R.length,ae,fe,at,Wt]),vr=B(($e,vt)=>{let cn=_e.scrollLength,rn=_e.otherAxisSize;fW(he,$e,Ga),dg(he);let Qa=cn!==_e.scrollLength||rn!==_e.otherAxisSize;Wt&&!vt&&Qa&&lV(he),!Wt&&Pu(he)},[R.length,ae,at,Wt]),{onLayout:Qo}=DC({onLayoutChange:vr,onLayoutProp:mn,ref:ja});ye(()=>{Ze&&ZR(he)},[Ze]),ye(()=>Oo(!0),[$,H,Fi.join(","),ze,Go,Un,Hn,ft]),ye(()=>{let{didColumnsChange:$e,didDataChange:vt,isFirst:cn,props:{data:rn}}=_e;!(rn.length>0&&mN(he))&&!cn&&(vt||$e)&&dW(he,rn,{didColumnsChange:$e}),vt&&(_e.pendingDataComparison=void 0),_e.didColumnsChange=!1,_e.didDataChange=!1,_e.isFirst=!1},[R,$,H,ze,Go]),ye(()=>{var $e;Pe(he,"extraData",W);let vt=bn.current!==xo;bn.current=xo,(xo||vt)&&ze>1&&(($e=_e.triggerCalculateItemsInView)==null||$e.call(_e,{forceFullItemPositions:!0}))},[W,xo,ze]),q(()=>{if(!xt)return;let $e,vt=()=>{let rn={footerSize:de(he,"footerSize")||0,headerSize:de(he,"headerSize")||0};(!$e||rn.headerSize!==$e.headerSize||rn.footerSize!==$e.footerSize)&&($e=rn,xt(rn))};vt();let cn=[$a(he,"headerSize",vt),$a(he,"footerSize",vt)];return()=>{for(let rn of cn)rn()}},[he,xt]),q(()=>{let $e=MV({onViewableItemsChanged:Zt,viewabilityConfig:en,viewabilityConfigCallbackPairs:tn});_e.viewabilityConfigCallbackPairs=$e,_e.enableScrollForNextCalculateItemsInView=!0,$e&&(_e.scrollForNextCalculateItemsInView=void 0)},[en,tn,Zt]),d4(()=>{}),Gr(n,()=>PW(he,Ni),[]),q(()=>()=>{rq(_e),_e.scheduledWork.dispose()},[_e]),ye(()=>{var $e;($e=_e.runPendingScrollToEnd)==null||$e.call(_e)}),q(()=>{Wt||Pu(he)},[he,Wt]);let io=z(()=>({getRenderedItem:$e=>MW(he,$e),onMomentumScrollEnd:$e=>{IV(he),_e.props.onMomentumScrollEnd&&_e.props.onMomentumScrollEnd($e)},onScroll:$e=>hW(he,$e),onScrollBeginDrag:$e=>{var vt,cn;KM(he),(cn=(vt=_e.props).onScrollBeginDrag)==null||cn.call(vt,$e)},onScrollEnd:()=>KM(he)}),[]),zi=IW(qn,fe,he,io.onScroll),Bo=zt;return Te(Ja,null,Te(nW,{...Nt,alignItemsAtEnd:L,canRender:Wa,contentContainerStyle:ln,contentInset:N,freshDataTransitionEpoch:_e.freshDataTransitionEpoch,getRenderedItem:io.getRenderedItem,horizontal:fe,initialContentOffset:Bi,ListEmptyComponent:R.length===0?dt:void 0,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Et,onInternalScrollBeginDrag:io.onScrollBeginDrag,onInternalScrollEnd:io.onScrollEnd,onLayout:Qo,onLayoutFooter:Fo,onMomentumScrollEnd:io.onMomentumScrollEnd,onScroll:zi,recycleItems:ho,refreshControl:Bo?Hn>0?lf(Bo,{progressViewOffset:((w=Bo.props.progressViewOffset)!=null?w:0)+Hn}):Bo:Jt&&Te(bW,{onRefresh:Jt,progressViewOffset:(Sn||0)+Hn,refreshing:!!D}),refScrollView:gd,renderScrollComponent:ce,scrollAdjustHandler:(k=It.current)==null?void 0:k.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:Ze,stickyHeaderIndices:qn,style:Nn,useWindowScroll:_i}),Vo&&oq)});var zW=FW;var gN=zW;me();me();function $W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HW(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${$W(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function OC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return HW(n,e.subProvider)}function ud(e){return OC(e,{preferShortName:!0})}var FC="model:",BC="legacy-models:",zC="action:",fd="pluginActions:manage";function Nu(e,t){return`${FC}${e.length}:${e}${t}`}function HC(e){if(!e.startsWith(FC))return null;let t=e.slice(FC.length),n=t.indexOf(":");if(n===-1)return null;let o=t.slice(0,n);if(!/^\d+$/.test(o))return null;let r=Number(o),a=t.slice(n+1);return!Number.isSafeInteger(r)||r>a.length?null:{instanceId:a.slice(0,r),slug:a.slice(r)}}function UC(e){return`${BC}${e}`}function hN(e){return e.startsWith(BC)?e.slice(BC.length):null}function _u(e){return`${zC}${e}`}function vN(e){if(!e.startsWith(zC))return null;let t=e.slice(zC.length);return t.length>0?t:null}var $C="choice:";function KC(e){return`${$C}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function xN(e){if(!e.startsWith($C))return null;try{let t=JSON.parse(e.slice($C.length));if(!Array.isArray(t)||t.length!==5)return null;let[n,o,r,a,i]=t;return typeof n!="string"||typeof o!="string"||typeof r!="string"||typeof a!="string"||typeof i!="string"?null:{environmentId:n,runtimeId:o,sourceId:r,profileId:a,...i.length>0?{endpointId:i}:{}}}catch{return null}}var yN=ue(function(t){let{t:n}=De(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.sourceLabel,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(gl,{hideIndicator:!0,index:t.index,value:t.itemKey??Nu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:F("group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-colors duration-(--control-duration)","hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",t.disabledReason&&"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent"),children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"flex min-w-0 items-center gap-2",children:u("div",{className:"min-w-0 truncate text-xs font-medium leading-snug",children:t.useTriggerLabel?ud(t.model):OC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(Ia,{providerId:t.providerId,displayName:t.providerDisplayName,accentColor:t.providerAccentColor,className:"size-icon-2",iconClassName:"size-3",indicatorBackground:"var(--popover)"}),u("span",{className:"truncate text-xs font-normal leading-snug text-muted-foreground/70",children:r})]})]}),b("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(Ef,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Qe,{children:[u(Ye,{render:u(te,{size:"icon-xs",variant:"ghost",className:F("-mr-1 shrink-0 text-muted-foreground/70 opacity-64 transition-[color,opacity] hover:text-foreground hover:opacity-100 group-hover:opacity-100",t.isFavorite&&"text-foreground opacity-100"),onClick:s=>{s.stopPropagation(),t.onToggleFavorite()},onKeyDown:s=>{s.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(rs,{className:F("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Xe,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Qe,{children:[u(Ye,{render:a}),u(Xe,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});function Ig(e){return e==="ready"}function CN(e){return e==="ready"||e==="unchecked"||e==="checking"}function bN(e,t){switch(e){case"ready":return t("readiness.ready.title");case"unchecked":return t("readiness.unchecked.title");case"checking":return t("readiness.checking.title");case"disabled":return t("readiness.disabled.title");case"not-installed":return t("readiness.notInstalled.title");case"unauthenticated":return t("readiness.unauthenticated.title");case"error":return t("readiness.error.title");default:return e}}function Du(e){return e.enabled&&CN(e.readiness)}function IN(e){return e.enabled}function SN(e){let t=new Map;for(let n of e){let o=t.get(n.driverKind);o?o.push(n):t.set(n.driverKind,[n])}return[...t.values()].flat()}var Sg=e=>e.enabled;function wg(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&Sg(n))return n}return e.find(n=>n.enabled&&Ig(n.readiness))??e.find(Du)??e.find(n=>Sg(n)&&n.readiness!=="error")}function wN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}me();function UW(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(Ig(o))return n;let r=bN(o,t),a=e.snapshot.readiness.detail?.trim();return a?t("instance.statusWithDetail",{name:n,status:r,detail:a}):t("instance.status",{name:n,status:r})}var KW="pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary",qW="pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ",VW=`${qW} text-update-foreground`,TN="left",LN=8,kN="max-w-64 text-balance font-normal leading-snug",PN=ue(function(t){let{t:n}=De(),{t:o}=De(),r=Ot().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=G(null),d=_(null),[c,f]=G(null);return ye(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(h=>h.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,i]),u("div",{className:"w-11 shrink-0 overflow-hidden bg-muted/30","data-model-picker-sidebar":"true",children:u("div",{className:"h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:b("div",{ref:d,className:"relative flex min-h-full flex-col gap-1 p-1",children:[c!==null?u("div",{"data-model-picker-selected-indicator":"true",className:F(KW,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(be,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Qe,{children:[u(Ye,{render:u("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]"),onClick:()=>a("favorites"),type:"button","aria-label":n("modelPicker.favorites"),children:u(rs,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Xe,{side:TN,sideOffset:LN,align:"center",className:kN,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Du(p),h=t.disabledInstanceIds?.has(p.instanceId)??!1,g=m||h,v=t.selectedInstanceId===p.instanceId,x=s===p.instanceId,y=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?UW(p,o):h?t.getDisabledInstanceTooltip?.(p)??p.displayName:y?`${p.displayName} \u2014 ${C}`:p.displayName,k=b("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",g&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!g&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(L=>L===p.instanceId?null:L),onFocus:()=>l(p.instanceId),onBlur:()=>l(L=>L===p.instanceId?null:L),disabled:g,type:"button","aria-label":g?w:p.displayName,children:[u(Ia,{providerId:p.providerId,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:x&&!g?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),y?u("span",{className:VW,"aria-hidden":!0,children:u(vf,{className:"size-2.5"})}):null]}),S=g?u("span",{className:"relative block w-full",children:k}):k;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Qe,{children:[u(Ye,{render:S}),b(Xe,{side:TN,sideOffset:LN,align:"center",className:kN,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function go(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function WW(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let i=0;i<e.length;i+=1)if(e[i]===t[n]&&(o===-1&&(o=i),r!==-1&&(a+=i-r-1),r=i,n+=1,n===t.length)){let s=i-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+s+l}return null}function qC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function GW(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let i=a+r.length;(o===null||i<o)&&(o=i)}return o}function zr(e){let{value:t,query:n}=e;if(!t||!n)return null;if(t===n)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(n))return e.prefixBase+qC(t,n);if(e.boundaryBase!==void 0){let o=GW(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+qC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+qC(t,n)}if(e.fuzzyBase!==void 0){let o=WW(t,n);if(o!==null)return e.fuzzyBase+o}return null}function jW(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function QW(e,t){let n=0,o=e.length;for(;n<o;){let r=n+Math.floor((o-n)/2),a=e[r];if(!a)break;jW(t,a)<0?o=r:n=r+1}return n}function Tg(e,t,n){if(n<=0)return;let o=QW(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var XW=24;function YW(e){return[go(e.name),...e.shortName?[go(e.shortName)]:[],...e.subProvider?[go(e.subProvider)]:[],go(e.driverKind),go(e.providerDisplayName),...e.providerAccountEmail?[go(e.providerAccountEmail)]:[],VC(e),...e.slug?[go(e.slug)]:[]]}function JW(e,t,n){return zr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function VC(e){return go([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function AN(e,t){let n=go(t).split(/\s+/u).filter(r=>r.length>0);if(n.length===0)return 0;let o=0;for(let r of n){let a=[];for(let i=0;i<e.length;i+=1){let s=JW(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function EN(e,t){let n=AN(YW(e),t);return n===null?null:e.isFavorite?n-XW:n}function MN(e,t){return AN([go(e.title),go(e.description??"")],t)}function RN({top:e,bottom:t}){if(!(!e&&!t))return F("virtualized-scroll-fade [--fade-size:1.5rem]",e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size),black_calc(100%-var(--fade-size)),transparent)]",e&&!t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size))]",!e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,black_calc(100%-var(--fade-size)),transparent)]")}function Lg(e,t){return`${e}:${t}`}var NN=new Map,_N=[],ZW=[],eG=[];function Ou(e){return e.choiceKey??Nu(e.instanceId,e.slug)}function DN(e,t,n){return t.environmentId!==n||t.instanceId!==e.instanceId?!1:t.sourceId&&t.profileId?t.sourceId===e.sourceId&&t.profileId===e.profileId&&t.model===e.slug:e.sourceId&&e.profileId?!1:t.model===e.slug}function tG(){return u("div",{className:"h-0.5"})}function WC(e){return e?.trim()||null}function ON({label:e}){return u("div",{className:"px-2 pt-2 pb-1 text-[10px] font-medium uppercase leading-none tracking-wide text-muted-foreground/70",children:e})}var nG=ue(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=De(),i=WC(o.description);return b(be,{children:[r?u(ON,{label:a("modelPicker.plugins")}):null,b(gl,{hideIndicator:!0,index:t,value:n,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(ts,{className:"size-4 shrink-0 text-muted-foreground/70"}),b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"truncate text-xs font-medium leading-snug",children:o.title}),u("div",{className:"mt-1 truncate text-xs font-normal leading-snug text-muted-foreground/70",children:i})]})]})]})}),oG=ue(function({index:t,showSectionHeader:n}){let{t:o}=De();return b(be,{children:[n?u(ON,{label:o("modelPicker.plugins")}):null,b(gl,{hideIndicator:!0,index:t,value:fd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(kd,{className:"size-4 shrink-0 text-muted-foreground/70"}),u("span",{className:"min-w-0 flex-1 truncate text-left text-xs font-normal leading-snug text-muted-foreground",children:o("modelPicker.managePlugins")})]})]})}),FN=ue(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,getModelDisabledReason:a,getModelContinuationLabel:i,onContinueInModel:s,onInstanceModelChange:l,onChooseExecution:d,composerChoices:c,selectedExecutionSelection:f,onManagePlugins:p,onSelectPluginAction:m}=t,h=t.pluginActions??_N,g=t.selectedPluginActionKey??null,{t:v}=De(),{t:x}=De(),y=Ot(),[C,w]=G(""),[k,S]=G(!1),[L,I]=G(!1),T=_(null),E=_(null),A=_(null),N=y.environment.useActiveEnvironmentId(),R=y.settings.useClientSettings(D=>D.favorites??[]),$=z(()=>N===null?eG:R.filter(D=>D.environmentId===N),[N,R]),[H,K]=G(()=>t.lockedProvider!==null?t.activeInstanceId:$.length>0?"favorites":t.activeInstanceId),[O,oe]=G(()=>new Set(o.get(t.activeInstanceId)?.some(D=>D.slug===t.model&&D.isLegacy)?[t.activeInstanceId]:[])),ee=z(()=>n??[],[n]),W=y.settings.useUpdateClientSettings(),qe=B(()=>{T.current?.focus({preventScroll:!0})},[]),ve=B(D=>{K(D),window.requestAnimationFrame(()=>{qe()})},[qe]);ye(()=>{qe();let D=window.requestAnimationFrame(()=>{qe()}),Y=window.setTimeout(()=>{qe()},0);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(Y)}},[qe]);let fe=z(()=>new Set($.map(D=>Lg(D.instanceId,D.model))),[$]),Ne=B(D=>N===null?!1:$.some(Y=>DN(D,Y,N)),[N,$]),Ae=z(()=>new Map(r.map(D=>[D.instanceId,D])),[r]),ae=B(D=>t.lockedProvider===null?!0:D.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?D.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),Ee=z(()=>{let D=new Set;for(let Y of r)Du(Y)&&D.add(Y.instanceId);return D},[r]),xe=z(()=>{let D=[];for(let[Y,ce]of o){let ie=Ae.get(Y);if(ie&&Ee.has(Y))for(let pe of ce)D.push({slug:pe.slug,name:pe.name,...pe.shortName?{shortName:pe.shortName}:{},...pe.subProvider?{subProvider:pe.subProvider}:{},...pe.isLegacy?{isLegacy:!0}:{},instanceId:Y,driverKind:ie.driverKind,providerId:ie.providerId,instanceDisplayName:ie.displayName,...ie.accentColor?{instanceAccentColor:ie.accentColor}:{},...ie.accountEmail?{instanceAccountEmail:ie.accountEmail}:{},...ie.continuationGroupKey?{continuationGroupKey:ie.continuationGroupKey}:{}})}if(c&&c.length>0){let Y=new Set,ce=[];for(let pe of c){let Ze=pe.legacyInstanceId;if(!Ze||!Ee.has(Ze))continue;let pt=Ae.get(Ze);if(!pt)continue;let ht=o.get(Ze)?.find(tn=>tn.slug===pe.modelId),en=KC({environmentId:pe.selection.environmentId,runtimeId:pe.runtimeId,sourceId:pe.sourceId,profileId:pe.profileId,endpointId:pe.endpointId});Y.add(Lg(Ze,pe.modelId)),ce.push({slug:pe.modelId,name:ht?.name??pe.modelLabel,...ht?.shortName?{shortName:ht.shortName}:{},instanceId:Ze,driverKind:pt.driverKind,providerId:pt.providerId,instanceDisplayName:pt.displayName,...pt.accentColor?{instanceAccentColor:pt.accentColor}:{},...pt.accountEmail?{instanceAccountEmail:pt.accountEmail}:{},...pt.continuationGroupKey?{continuationGroupKey:pt.continuationGroupKey}:{},runtimeId:pe.runtimeId,sourceId:pe.sourceId,sourceLabel:pe.sourceLabel,profileId:pe.profileId,ready:pe.ready,...pe.reasonCode?{reasonCode:pe.reasonCode}:{},choiceKey:en})}let ie=D.filter(pe=>!Y.has(Lg(pe.instanceId,pe.slug)));return[...ce,...ie]}return D},[c,o,Ae,Ee]),re=t.lockedProvider!==null,Ie=C.trim().length>0,st=z(()=>{if(!re)return;let D=new Set;for(let Y of r)ae(Y)||D.add(Y.instanceId);return D},[r,re,ae]),dt=z(()=>{let D=r.filter(IN);if(!re)return D;let Y=[],ce=[];for(let ie of D)ae(ie)?Y.push(ie):ce.push(ie);return[...Y,...ce]},[r,re,ae]),lt=!Ie&&dt.length>0,ct=z(()=>r.map(D=>D.instanceId),[r]),Et=z(()=>{let D=xe;if(C.trim()){let Y=D.map(ce=>({model:ce,score:EN({name:ce.name,...ce.shortName?{shortName:ce.shortName}:{},...ce.subProvider?{subProvider:ce.subProvider}:{},driverKind:ce.driverKind,providerDisplayName:ce.instanceDisplayName,...ce.instanceAccountEmail?{providerAccountEmail:ce.instanceAccountEmail}:{},isFavorite:Ne(ce)},C),isFavorite:Ne(ce),tieBreaker:VC({name:ce.name,...ce.shortName?{shortName:ce.shortName}:{},...ce.subProvider?{subProvider:ce.subProvider}:{},driverKind:ce.driverKind,providerDisplayName:ce.instanceDisplayName,...ce.instanceAccountEmail?{providerAccountEmail:ce.instanceAccountEmail}:{}})})).filter(ce=>ce.score!==null);if(t.lockedProvider!==null){let ce=[];for(let ie of Y)ae(ie.model)&&ce.push(ie);return ce.toSorted((ie,pe)=>{let Ze=ie.score-pe.score;return Ze!==0?Ze:ie.isFavorite!==pe.isFavorite?ie.isFavorite?-1:1:ie.tieBreaker.localeCompare(pe.tieBreaker)}).map(ie=>ie.model)}return Y.toSorted((ce,ie)=>{let pe=ce.score-ie.score;return pe!==0?pe:ce.isFavorite!==ie.isFavorite?ce.isFavorite?-1:1:ce.tieBreaker.localeCompare(ie.tieBreaker)}).map(ce=>ce.model)}return t.lockedProvider!==null?(D=D.filter(Y=>ae(Y)),H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H)):H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H),y.model.sortProviderModelItems(D,{favoriteModelKeys:fe,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?ct:[]})},[fe,xe,ct,ae,t.lockedProvider,C,H,Ne]),ot=z(()=>{if(Ie||H==="favorites")return null;let D=Et.filter(ce=>!ce.isLegacy),Y=Et.filter(ce=>ce.isLegacy);return Y.length===0?null:{key:UC(H),currentModels:D,legacyModels:Y,isExpanded:O.has(H)}},[O,Et,Ie,H]),He=z(()=>ot?[...ot.currentModels,...ot.isExpanded?ot.legacyModels:[]]:Et,[Et,ot]),Se=m!==void 0,ze=z(()=>{if(!Se)return _N;let D=C.trim();return D.length===0?h:h.map(Y=>({action:Y,score:MN(Y,D)})).filter(Y=>Y.score!==null).toSorted((Y,ce)=>Y.score-ce.score||Y.action.title.localeCompare(ce.action.title)).map(Y=>Y.action)},[C,h,Se]),Je=Se&&(!Ie||ze.length>0),qt=z(()=>Je?[...ze.map(D=>_u(D.id)),fd]:ZW,[Je,ze]),X=z(()=>new Map(ze.map(D=>[_u(D.id),D])),[ze]),nn=qt[0]??null,xt=B(D=>{oe(Y=>{let ce=new Set(Y);return ce.has(D)?ce.delete(D):ce.add(D),ce})},[]),mn=B((D,Y)=>y.model.resolvePickerRowAction({disabledReason:a?.(D,Y)??null,continuationLabel:s?i?.(D,Y)??null:null}),[i,a,s]),Tt=B((D,Y)=>{let ce=mn(Y,D);if(ce.kind==="blocked")return;if(ce.kind==="continue"){s?.(Y,D);return}let ie=o.get(Y);if(!ie)return;let pe=Ae.get(Y);if(!pe)return;let Ze=y.model.resolveSelectableModel(pe.driverKind,D,ie);Ze&&l(Y,Ze)},[Ae,o,s,l,mn]),Yt=B(D=>{let Y=hN(D);if(Y){xt(Y);return}if(D===fd){p?.();return}let ce=vN(D);if(ce!==null){m?.(ce);return}let ie=xN(D);if(ie){let Ze=c?.find(pt=>pt.selection.environmentId===ie.environmentId&&pt.runtimeId===ie.runtimeId&&pt.sourceId===ie.sourceId&&pt.profileId===ie.profileId&&(pt.endpointId??void 0)===(ie.endpointId??void 0));if(!Ze||!Ze.legacyInstanceId)return;if(d){d(Ze);return}Tt(Ze.modelId,Ze.legacyInstanceId);return}let pe=HC(D);pe&&Tt(pe.slug,pe.instanceId)},[c,Tt,d,p,m,xt]),Jt=B(D=>{if(N===null)return;let Y=R.findIndex(ie=>DN(D,ie,N)),ce=[...R];Y>=0?ce.splice(Y,1):ce.push({environmentId:N,instanceId:D.instanceId,model:D.slug,...D.runtimeId?{runtimeId:D.runtimeId}:{},...D.sourceId?{sourceId:D.sourceId}:{},...D.profileId?{profileId:D.profileId}:{}}),W({favorites:ce})},[N,R,W]),Mt=z(()=>{let D=new Map,Y=0;for(let ce of He){if(ce.ready===!1||mn(ce.instanceId,ce.slug).kind==="blocked")continue;let ie=y.keybindings.modelPickerJumpCommandForIndex(Y);if(!ie)return D;D.set(Ou(ce),ie),Y+=1}return D},[mn,He]),zn=z(()=>[...Mt.keys()],[Mt]),kn=z(()=>[...xe.map(D=>Ou(D)),...new Set(xe.filter(D=>D.isLegacy).map(D=>UC(D.instanceId))),...Se?[...h.map(D=>_u(D.id)),fd]:[]],[xe,h,Se]),vn=z(()=>{let D=He.map(Y=>Ou(Y));return ot&&D.splice(ot.currentModels.length,0,ot.key),qt.length>0?[...D,...qt]:D},[ot,qt,He]),$n=z(()=>new Map(He.map(D=>[Ou(D),D])),[He]),Vt=B(()=>{let D=E.current?.getScrollableNode();if(!(D instanceof HTMLElement))return;let Y=Math.max(0,D.scrollHeight-D.clientHeight);S(D.scrollTop>1),I(Y-D.scrollTop>1)},[]),Zt=z(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Sn=z(()=>{if(Mt.size===0)return NN;let D={platform:navigator.platform,context:Zt},Y=new Map;for(let[ce,ie]of Mt){let pe=y.keybindings.shortcutLabelForCommand(ee,ie,D);pe&&Y.set(ce,pe)}return Y.size>0?Y:NN},[ee,Mt,Zt]),ho=g===null?f?KC(f):Nu(t.activeInstanceId,t.model):_u(g),zt=z(()=>({favoritesSet:fe,modelJumpLabelByKey:Sn,selectedItemKey:ho}),[fe,Sn,ho]);return y.pane.useKeydown(D=>{if(D.defaultPrevented||D.repeat)return;let Y=y.keybindings.resolveShortcutCommand(D,ee,{platform:navigator.platform,context:Zt}),ce=y.keybindings.modelPickerJumpIndexFromCommand(Y??"");if(ce===null)return;let ie=zn[ce];if(!ie)return;let pe=HC(ie);pe&&(D.preventDefault(),D.stopPropagation(),Tt(pe.slug,pe.instanceId))},{capture:!0}),ye(()=>{S(!1),I(vn.length>5);let D=0,Y=window.requestAnimationFrame(()=>{Vt(),D=window.requestAnimationFrame(Vt)});return()=>{window.cancelAnimationFrame(Y),window.cancelAnimationFrame(D)}},[vn,Vt]),u(eS,{delay:0,children:b("div",{className:"relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden","data-model-picker-content":"true",children:[lt&&u(PN,{selectedInstanceId:H,onSelectInstance:ve,instanceEntries:dt,showFavorites:!0,...st?{disabledInstanceIds:st,getDisabledInstanceTooltip:D=>x("instance.lockedToThread",{name:D.displayName})}:{}}),u(XI,{inline:!0,items:kn,filteredItems:vn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:ho,onItemHighlighted:(D,Y)=>{A.current=typeof D=="string"?D:null,Y.reason==="keyboard"&&Y.index>=0&&E.current?.scrollIndexIntoView?.({index:Y.index,animated:!1})},onValueChange:D=>{typeof D=="string"&&Yt(D)},children:b("div",{className:F("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",lt&&"border-l border-border/70"),children:[f&&t.onClearExecutionSelection?u("div",{className:"shrink-0 border-b border-border/70 px-2 py-1",children:u(te,{size:"sm",variant:"ghost-muted",className:"w-full justify-start",onClick:t.onClearExecutionSelection,children:v("modelPicker.useExecutorAccount")})}):null,u("div",{className:"px-2 pt-2",children:u("div",{className:"border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring",children:u(JI,{ref:T,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:v("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(os,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:C,onChange:D=>w(D.target.value),onKeyDown:D=>{if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),t.onRequestClose?.();return}if(D.key==="Enter"&&A.current){D.preventBaseUIHandler?.(),D.preventDefault(),D.stopPropagation(),Yt(A.current);return}D.stopPropagation()},onMouseDown:D=>D.stopPropagation(),onTouchStart:D=>D.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(ZI,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(gN,{ref:E,data:vn,extraData:zt,keyExtractor:D=>D,renderItem:({item:D,index:Y})=>{if(ot?.key===D)return b(gl,{hideIndicator:!0,index:Y,value:D,"aria-expanded":ot.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:v("modelPicker.legacyModels")}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:v("modelPicker.legacyModelCount",{count:ot.legacyModels.length})})]}),u(Uo,{className:F("size-4 transition-transform",ot.isExpanded&&"rotate-90")})]});let ce=X.get(D);if(ce)return u(nG,{index:Y,itemKey:D,action:ce,showSectionHeader:D===nn});if(D===fd)return u(oG,{index:Y,showSectionHeader:D===nn});let ie=$n.get(D);if(!ie)return null;let pe=ie.ready===!1?{kind:"blocked",reason:v("modelPicker.notReady")}:mn(ie.instanceId,ie.slug);return u(yN,{index:Y,model:ie,instanceId:ie.instanceId,itemKey:Ou(ie),sourceLabel:ie.sourceLabel,providerId:ie.providerId,providerDisplayName:ie.instanceDisplayName,providerAccentColor:ie.instanceAccentColor,providerAccountEmail:ie.instanceAccountEmail,isFavorite:Ne(ie),isSelected:D===ho,showProvider:!0,preferShortName:!re,useTriggerLabel:!1,jumpLabel:Sn.get(D)??null,disabledReason:pe.kind==="blocked"?pe.reason:null,actionLabel:pe.kind==="continue"?pe.label:null,onToggleFavorite:()=>Jt(ie)},D)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:tG,onLayout:Vt,onScroll:Vt,className:F("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",RN({top:k,bottom:L}))})})}),u(YI,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:v("modelPicker.noModelsFound")})]})})]})})});var BN="h-7 min-h-7 gap-1.5 rounded-[var(--control-radius)] px-2.5 text-secondary-label transition-none hover:text-foreground [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";function $r({className:e,size:t="sm",variant:n="ghost",...o}){return u(te,{className:F(BN,e),size:t,variant:n,...o})}function mr({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:F("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function Ri(){return u(pn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function kg({className:e,size:t="sm",variant:n="ghost",...o}){return u(_I,{className:F(BN,e),icon:u(Ri,{}),size:t,variant:n,...o})}function rG(e){let t=e.profileLabel?.trim();if(t)return t;let n=e.profileModelId?.trim();if(n)return n;let o=e.catalogOptions.find(r=>r.slug===e.model);return o?ud(o):e.model}function aG(e,t){return!e?.length||!t?null:e.find(n=>n.runtimeId===t.runtimeId&&n.sourceId===t.sourceId&&n.profileId===t.profileId&&(n.endpointId??void 0)===(t.endpointId??void 0))??null}var zN=ue(function(t){let{t:n}=De(),[o,r]=G(!1),i=ni()&&(t.open??o),s=z(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=aG(t.composerChoices,t.selectedExecutionSelection),f=rG({model:t.model,catalogOptions:d,profileLabel:c?.modelLabel,profileModelId:c?.modelId}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};q(()=>{if(!i)return;let{documentElement:C,body:w}=document,k=C.style.overscrollBehavior,S=w.style.overflow,L=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let T=N=>N instanceof Element&&N.closest("[data-model-picker-content]"),E=N=>{T(N.target)||N.preventDefault()},A=N=>{T(N.target)||N.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",A,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",A,{capture:!0}),C.style.overscrollBehavior=k,w.style.overflow=S,w.style.paddingRight=L}},[i]);let m=(C,w)=>{t.disabled||(t.onInstanceModelChange(C,w),p(!1))},h=(C,w)=>{t.disabled||(t.onContinueInModel?.(C,w),p(!1))},g=C=>{t.disabled||(t.onSelectPluginAction?.(C),p(!1))},v=()=>{t.onManagePlugins?.(),p(!1)},x=t.selectedPluginActionKey==null?null:t.pluginActions?.find(C=>C.id===t.selectedPluginActionKey)??null,y=x?WC(x.description):null;return b(fl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(ml,{render:u($r,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:F("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-42 shrink-0":"max-w-48 shrink sm:max-w-56",t.triggerClassName),disabled:t.disabled}),children:[u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:x?b(be,{children:[u(ts,{className:"size-4 shrink-0"}),b(Qe,{children:[b(Ye,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:x.title}),y?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",y]}):null]}),u(Xe,{side:"top",children:y?`${x.title} \xB7 ${y}`:x.title})]})]}):b(be,{children:[s?u(Ia,{providerId:s.providerId,displayName:s.displayName,accentColor:s.accentColor,className:F("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Qe,{children:[u(Ye,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}),u(Xe,{side:"top",children:t.executionAppliesTo==="next-message"?`${n("modelPicker.nextMessage")}: ${t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}`:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f})]}),t.executionAppliesTo==="next-message"?u("span",{className:"shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/80",children:n("modelPicker.nextMessage")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(Ri,{})})]}),u(pl,{align:"start",className:"before:hidden [--viewport-inline-padding:0]",viewportClassName:"!overflow-hidden rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]",children:u(FN,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>p(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:m,...t.composerChoices?{composerChoices:t.composerChoices}:{},selectedExecutionSelection:t.selectedExecutionSelection??null,...t.onClearExecutionSelection?{onClearExecutionSelection:()=>{t.onClearExecutionSelection?.(),p(!1)}}:{},...t.onChooseExecution?{onChooseExecution:C=>{t.disabled||(t.onChooseExecution?.(C),p(!1))}}:{},...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:g}:{},...t.onManagePlugins?{onManagePlugins:v}:{}})})]})});me();var $N=ue(function(t){let n=_(null);return ye(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Mf,{autoHighlight:!1,mode:"none",onItemHighlighted:o=>{t.onHighlightedItemChange(typeof o=="string"?o:null)},children:u("div",{ref:n,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(_f,{className:"max-h-72 scroll-pb-6",children:u(Rf,{children:t.items.map(o=>u(iG,{item:o,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===o.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},o.id))})}):u("div",{className:"px-5 pt-3.5 pb-7",children:u("p",{className:"text-secondary-label text-xs",children:t.isLoading?t.triggerKind==="skill"?"Searching workspace skills...":"Searching workspace files...":t.emptyStateText??(t.triggerKind==="skill"?"No skills found. Try / to browse provider commands.":t.triggerKind==="path"?"No matching files or folders.":"No matching command.")})})})})}),iG=ue(function(t){let n=t.item.type==="skill"?xM(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Nf,{value:t.item.id,"data-composer-item-id":t.item.id,className:F("cursor-pointer select-none gap-3 rounded-lg px-3 py-2! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",t.isActive&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{t.isActive||t.onHighlight(t.item.id)},onMouseDown:r=>{r.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Gm,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,b("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:o?b(be,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),sa(o)]}):t.item.label}),u("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),n?u(dG,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),sG={app:Ad,repo:oi,project:oi,personal:Yr,system:jd,other:qd},lG={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function dG(e){let t=sG[e.kind];return b(ul,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),lG[e.kind],e.showSkillSuffix?" Skill":null]})}me();var cG=(e,t)=>t.isResponding?e("primaryActions.submitting"):t.compact?t.isLastQuestion?e("primaryActions.submit"):e("primaryActions.next"):t.isLastQuestion?t.questionIndex>0?e("primaryActions.submitAnswers"):e("primaryActions.submitAnswer"):e("primaryActions.nextQuestion"),uG=e=>{e.preventDefault()},Fu=ue(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isConnecting:l,isEnvironmentUnavailable:d,isPreparingWorktree:c,hasSendableContent:f,preserveComposerFocusOnPointerDown:p=!1,showSendWhileRunning:m=!1,onPreviousPendingQuestion:h,onInterrupt:g,onImplementPlanInNewThread:v}){let{t:x}=De(),y=Ot(),C=p?{onPointerDown:uG}:void 0,w=y.settings.useEnvironmentIdentificationMode(),k=s!==null,S=y.devBackdrop.useVisible(w==="artwork"),L=T=>u("button",{type:"button",className:F("flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-[background-color,scale] duration-(--control-duration) hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",T?"size-8 sm:size-7":m&&f?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...C,onClick:g,"aria-label":x("primaryActions.stopGeneration"),children:u("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:u("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(n)return b("div",{className:F("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?L(!0):null,n.questionIndex>0?t?u(te,{size:"icon-sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(Wi,{})}):u(te,{size:"sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(te,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...C,disabled:d||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:cG(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(r)return a?u(te,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(te,{type:"submit",size:"sm",className:"h-9 rounded-l-full rounded-r-none bg-message-action px-4 text-message-action-foreground hover:bg-message-action-hover sm:h-8",...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(Jo,{children:[u(tr,{render:u(te,{size:"sm",variant:"default",className:"h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 bg-message-action px-2 text-message-action-foreground hover:bg-message-action-hover sm:h-8","aria-label":x("primaryActions.implementationActions"),...C,disabled:i||k||l||d}),children:u(pn,{})}),u(er,{align:"end",side:"top",children:u(Zo,{disabled:i||k||l||d,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let I=b("button",{type:"submit",className:F("relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-[background-color,filter,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",S?"bg-transparent text-white enabled:shadow-black/24 enabled:hover:brightness-110":"bg-message-action text-message-action-foreground enabled:shadow-message-action/24 hover:bg-message-action-hover"),...C,disabled:i||k||l||d||!f,"aria-label":d?x("primaryActions.environmentDisconnected"):s||x(l?"primaryActions.connecting":c?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[S?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(nS,{compact:!0})}):null,l||i?u(vf,{className:"size-3.5","aria-hidden":"true"}):u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return o?b(be,{children:[L(!1),m&&f?I:null]}):I});function HN(e){let t=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:b("div",{"data-chat-composer-mobile-pending-compact":"true",className:F("flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/90",!t&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!t&&"px-3 py-2"),onPointerDown:n=>n.preventDefault(),onClick:e.expandMobileComposer,"aria-label":"Write custom answer",children:e.activePendingProgress?.customAnswer||"Write custom answer"}),e.inlineTasksBadge,e.inlineStashBadge,t?u(Fu,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isConnecting:e.isConnecting,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function UN(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}me();function fG(e){return e!==null&&"tagName"in e&&"closest"in e}function Pg(e){return fG(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function GC(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function KN(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function qN(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return KN(t,"accept");case"Escape":return KN(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=GC(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var pG=2e3,mG="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",gG=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function hG(e,t){let n=[];return t<9&&n.push(String(t+1)),e==="accept"&&n.push("Enter"),e==="cancel"&&n.push("Escape"),n.length>0?n.join(" "):void 0}var VN=ue(function({requestId:t,isResponding:n,options:o=gG,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=De(),l=Ot(),d=a==="native"||a==="queued",[c,f]=G(""),p=_([]);q(()=>{f("")},[t]);let m=B(g=>{let v=g==="decline"?c.trim():"";i(t,g,v.length>0?v:void 0)},[c,i,t]),h=B(g=>{let v=p.current.filter(C=>C!==null);if(v.length===0)return;let x=v.findIndex(C=>C===document.activeElement),y=x===-1?g===1?0:v.length-1:(x+g+v.length)%v.length;v[y]?.focus()},[]);return l.pane.useKeydown(g=>{if(n||l.terminalFocus.getOwner()!==null||g.isComposing||g.keyCode===229)return;let v=Pg(g.target);if(r&&(!v||g.metaKey||g.ctrlKey||g.altKey)){let C=l.keybindings.approvalDecisionFromCommand(l.keybindings.resolveShortcutCommand(g,r));if(C!==null&&o.some(w=>w.decision===C)){g.preventDefault(),m(C);return}}if(v)return;let x=qN(g,o);if(x===null)return;if(g.preventDefault(),x.type==="move"){h(x.delta);return}let y=o[x.index];y&&m(y.decision)},{target:"document"}),u(be,{children:o.map((g,v)=>{let x=v<9?v+1:null,y=b(te,{ref:C=>{p.current[v]=C},size:"xs",variant:g.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":hG(g.decision,v),className:`${mG}${g.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>m(g.decision),children:[u("span",{className:"min-w-0 break-words",children:g.label}),x===null?null:u(Ef,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},g.decision);return g.decision!=="decline"||!d?y:b(Ja,{children:[u(hf,{type:"text",value:c,disabled:n,maxLength:pG,placeholder:s(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":s("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:C=>f(C.target.value),onKeyDown:C=>{if(C.key==="Enter"){C.preventDefault(),m("decline");return}C.key==="Escape"&&(C.preventDefault(),c.length>0?f(""):C.currentTarget.blur())}}),y]},g.decision)})})});me();var vG=["command","cmd"],xG=["file_path","filePath","path","notebook_path","notebookPath"],yG=["url"],CG=["query","q"],bG=["name","skill","skill_name","skillName"],WN=["toolName","tool_name"],GN=["description"],IG=[],SG=[];function Va(e,t,n){for(let o of t){let a=e.find(i=>i.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function wG(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function TG(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function QN(e){let t=e.args??IG,n=e.fileChanges??SG,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},i=null,s=a,l=null;switch(e.requestKind){case"command":{let d=Va(t,vG,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Va(t,xG,o)??TG(n);d!==null&&(i=wG(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Va(t,yG,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Va(t,CG,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Va(t,bG,o)??Va(t,WN,o),l=Va(t,GN,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Va(t,WN,o),l=Va(t,GN,o),t.length>0&&(s={shape:"none"});break}case"mcp-elicitation":{i=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:i,body:s,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var LG={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},kG={command:"approval.title.command","file-read":"approval.title.fileReadGeneric","file-change":"approval.title.fileChangeGeneric","web-fetch":"approval.title.webFetch","web-search":"approval.title.webSearch",skill:"approval.title.skillGeneric","mcp-tool":"approval.title.toolGeneric",tool:"approval.title.toolGeneric","mcp-elicitation":"approval.title.appAccessGeneric"},PG={command:"approval.commandLabel","file-read":"approval.fileReadLabel","file-change":"approval.fileChangeLabel","web-fetch":"approval.webFetchLabel","web-search":"approval.webSearchLabel",skill:"approval.skillLabel","mcp-tool":"approval.mcpToolLabel",tool:"approval.toolLabel","mcp-elicitation":"approval.appAccessLabel"},AG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function XN(e,t){let n=e.subject!==null?LG[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(kG[e.kind])}function YN(e,t){return t(PG[e])}function JN(e,t){return t(AG[e])}function ZN(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=jN(t.oldText??""),o=jN(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
|
|
3713
3716
|
+++ b/${e.path}
|
|
3714
3717
|
`,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
|
|
3715
3718
|
`,i=[...n.map(s=>`-${s}`),...o.map(s=>`+${s}`)];return`${r}${a}${i.join(`
|
|
3716
3719
|
`)}
|
|
3717
|
-
`}function
|
|
3718
|
-
`);return t.at(-1)===""?t.slice(0,-1):t}function
|
|
3720
|
+
`}function jN(e){if(e.length===0)return[];let t=e.split(`
|
|
3721
|
+
`);return t.at(-1)===""?t.slice(0,-1):t}function e_(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function t_(e){return{additions:e.additions??0,deletions:e.deletions??0}}me();me();var Yde=(()=>{try{return!1}catch{return!1}})(),n_=/(?=^From [a-f0-9]+ .+$)/m,jC=/(?=^diff --git)/gm;var o_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,r_=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,a_=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,i_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var EG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Jde={...EG,hunkLineCount:1};var Zde=Object.freeze({fromStart:0,fromEnd:0});function QC(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var MG=new TextEncoder,RG=new TextDecoder("utf-8",{ignoreBOM:!0}),NG=/[\uD800-\uDFFF]/,XC=1024,pd=new Uint8Array(XC);function s_(){pd.length!==XC&&(pd=new Uint8Array(XC))}function Rn(e){if(e.length===0)return e;if(NG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;pd.length<t&&(pd=new Uint8Array(t));let{written:n}=MG.encodeInto(e,pd);return RG.decode(pd.subarray(0,n))}function d_(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let o=t.hunkContent[n];if(o.type!=="change")continue;let r=DG(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}_G(t,e)}}function _G(e,t){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],a=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||a.type!=="context")continue;let i=r.additions>0,s=i?t.additionLines:t.deletionLines,l=i?r.additionLineIndex:r.deletionLineIndex,d=i?r.additions:r.deletions,c=s[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(s[l+v]!==c){f=!1;break}if(!f)continue;let p=0;for(;p<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-p]===c;)p++;if(p===0)continue;r.additionLineIndex-=p,r.deletionLineIndex-=p;let m=r.additionLineIndex+r.additions,h=r.deletionLineIndex+r.deletions,g=n[o+1];g?.type==="context"?(g.lines+=p,g.additionLineIndex=m,g.deletionLineIndex=h):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:h}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function DG(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,i=Math.min(n,o),s=Math.abs(o-n);if(i===0||s===0||i*(s+1)>4096)return null;let l=[];for(let g=0;g<n;g++)l.push(l_(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(l_(e.additionLines[a+g]??""));let c=o>n,f=0,p=-1;for(let g=0;g<=s;g++){let v=0;for(let x=0;x<i;x++)v+=FG(l[x+(c?0:g)],d[x+(c?g:0)]);g===0?p=v+i*.5:v>p&&(p=v,f=g)}if(f===0)return null;let m=[],h=(g,v,x,y)=>{(g>0||v>0)&&m.push({type:"change",deletions:g,additions:v,deletionLineIndex:x,additionLineIndex:y})};return c?(h(0,f,r,a),h(i,i,r,a+f),h(0,o-i-f,r+i,a+f+i)):(h(f,0,r,a),h(i,i,r+f,a),h(n-i-f,0,r+f+i,a+i)),m}var OG=/\s+/g;function l_(e){return e.replace(OG,"")}function FG(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(;r<o&&e[r]===t[r];)r++;let a=0;for(;a<o-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/n}function BG(e,t,n){try{return zG(e,t,n)}finally{s_()}}function zG(e,t,n=!1){let o=jG(e),r=o?UG(e):KG(e),a,i=[];for(let s of r){if(o&&!jC.test(s)){if(a==null)a=Rn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!qG(s)){if(a==null)a=Rn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=$G(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function $G(e,{cacheKey:t,isGitDiff:n=jC.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=x_(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=g_(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=v_(h),v=0,x=0;if(g==null||l==null){if(l!=null){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&o!=null&&r!=null?c_(r.contents):[],deletionLines:!d&&o!=null&&r!=null?c_(o.contents):[],cacheKey:p_(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let T of m){if(T.startsWith("diff --git")){let A=T.trim().match(a_),N=A?.[1]??A?.[2],R=A?.[3]??A?.[4];if(N==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",T);continue}l.name=Rn(R.trim()),N!==R&&(l.prevName=Rn(N.trim()));continue}let E=T.startsWith("---")||T.startsWith("+++")?T.match(n?r_:o_):null;if(E!=null){let[,A,N]=E;if(A==="---"&&N!=="/dev/null"){let R=Rn(N.trim());l.prevName=R,l.name=R}else A==="+++"&&N!=="/dev/null"&&(l.name=Rn(N.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=Rn(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=Rn(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=Rn(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Rn(T.slice(17).trim())),T.startsWith("similarity index")&&(T.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),T.startsWith("index ")){let[,A,N,R]=T.trim().match(i_)??[];A!=null&&(l.prevObjectId=Rn(A)),N!=null&&(l.newObjectId=Rn(N)),R!=null&&(l.mode=Rn(R))}T.startsWith("rename from ")&&(l.prevName=Rn(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=Rn(T.slice(10).trim()))}}continue}let y,C;for(;m.length>0&&(m[m.length-1]===`
|
|
3719
3722
|
`||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 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:
|
|
3721
|
-
From `)}function
|
|
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
|
|
3723
|
-
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function
|
|
3724
|
-
`,t);return n===-1?e.length:n+1}function
|
|
3725
|
-
`&&n!=="\r")return!1}return!0}function
|
|
3723
|
+
`||m[m.length-1]==="");)m.pop();let{additionStart:w,deletionStart:k}=g;c=d?c:k-1,f=d?f:w-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:w,additionLines:v,deletionCount:g.deletionCount,deletionStart:k,deletionLines:x,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:p_(g.hunkContext),hunkSpecs:Rn(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},L=0,I=0;for(let T=1;T<m.length;T++){let E=m[T];if(L>=S.additionCount&&I>=S.deletionCount&&!E.startsWith("\\")){if(a&&VG(E)&&!WG(E))throw Error("parsePatchContent: hunk has more lines than expected");break}let A=E[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${E}"`),console.error("processFile: invalid rawLine:",E);continue}let N=QG(A);if(N==="addition"){if(a&&L>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),f++,L++,d&&l.additionLines.push(R),y.additions++,v++,C="addition"}else if(N==="deletion"){if(a&&I>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),c++,I++,d&&l.deletionLines.push(R),y.deletions++,x++,C="deletion"}else if(N==="context"){if(a&&(I>=S.deletionCount||L>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=YC(E);(y==null||y.type!=="context")&&(y=JC("context",c,f),S.hunkContent.push(y)),f++,c++,L++,I++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),y.lines++,C="context"}else if(N==="metadata"&&y!=null){if(y.type==="context"?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):C==="deletion"?S.noEOFCRDeletions=!0:C==="addition"&&(S.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=QC(l.additionLines[R]))}if(d&&(C==="deletion"||C==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=QC(l.deletionLines[R]))}}}if(a&&(L!==S.additionCount||I!==S.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");S.additionLines=v,S.deletionLines=x,S.collapsedBefore=Math.max(S.additionStart-1-i,0),l.hunks.push(S),i=S.additionStart+S.additionCount-1;for(let T of S.hunkContent)T.type==="context"?(S.splitLineCount+=T.lines,S.unifiedLineCount+=T.lines):(S.splitLineCount+=Math.max(T.additions,T.deletions),S.unifiedLineCount+=T.deletions+T.additions);S.splitLineStart=l.splitLineCount+S.collapsedBefore,S.unifiedLineStart=l.unifiedLineCount+S.collapsedBefore,l.splitLineCount+=S.collapsedBefore+S.splitLineCount,l.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(l!=null){if(a&&d&&!n&&l.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(l.hunks.length>0&&!d&&l.additionLines.length>0&&l.deletionLines.length>0){let p=l.hunks[l.hunks.length-1],m=p.additionStart+p.additionCount-1,h=l.additionLines.length,g=Math.max(h-m,0);l.splitLineCount+=g,l.unifiedLineCount+=g}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":(o==null||o.contents==="")&&r!=null&&r.contents!==""?l.type="new":o!=null&&o.contents!==""&&(r==null||r.contents==="")&&(l.type="deleted")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),d_(l),l}}function m_(e,t,n=!1){let o=[],r=HG(e)?e.split(n_):[e];for(let a of r)try{o.push(BG(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function HG(e){return e.startsWith("From ")||e.includes(`
|
|
3724
|
+
From `)}function c_(e){let t=g_(e);for(let n=0;n<t.length;n++)t[n]=Rn(t[n]);return t}function g_(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
|
|
3725
|
+
`,n);if(o===-1)break;t.push(e.slice(n,o+1)),n=o+1}return n<e.length&&t.push(e.slice(n)),t}function UG(e){return x_(e,"diff --git")}function KG(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=ZC(e,o);if(r<=0&&a<=0){if(h_(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=ZC(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=v_(e.slice(o,s));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=s;continue}let l=e[o];if(l==="\\"){o=s;continue}l===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):l==="-"?r=Math.max(r-1,0):l==="+"&&(a=Math.max(a-1,0)),o=s}return t.push(e.slice(n)),t}function qG(e){return h_(e,0)}function h_(e,t){let n=ZC(e,t);return u_(e,t,"---")&&u_(e,n,"+++")}function u_(e,t,n){if(!e.startsWith(n,t))return!1;let o=e[t+n.length];if(o!==" "&&o!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){let a=e[r];if(a===`
|
|
3726
|
+
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function ZC(e,t){let n=e.indexOf(`
|
|
3727
|
+
`,t);return n===-1?e.length:n+1}function VG(e){let t=e[0];return t==="+"||t==="-"||t===" "}function WG(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
|
|
3728
|
+
`&&n!=="\r")return!1}return!0}function v_(e){if(!e.startsWith("@@ -"))return;let t=4,n=Ag(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Ag(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Ag(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=Ag(e,t+1);if(c==null)return;s=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=GG(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function Ag(e,t){let n=t,o=0;for(;n<e.length;n++){let r=e.charCodeAt(n)-48;if(r<0||r>9)break;o=o*10+r}if(n!==t)return{value:o,endIndex:n}}function GG(e){return e.endsWith(`\r
|
|
3726
3729
|
`)?e.slice(0,-2):e.endsWith(`
|
|
3727
|
-
`)?e.slice(0,-1):e}function
|
|
3728
|
-
diff --git`)}function
|
|
3729
|
-
${t}`,o=e.startsWith(t)?0:
|
|
3730
|
-
`:t)}function YC(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 m_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function h_(e){return e==="dark"?m_.dark:m_.light}var v_=2166136261,x_=16777619,HG=2654435769,UG=2246822507;function g_(e,t=v_,n=x_){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 KG(e,t="diff-panel"){let n=e.trim(),o=g_(n,v_,x_).toString(36),r=g_(n,HG,UG).toString(36);return`${t}:${n.length}:${o}:${r}`}function ZC(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 y_(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=d_(o,KG(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(ZC):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 C_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function b_({fileChange:e,onOpenDiff:t}){let{t:n}=ze(),[o,r]=G(!1),a=H(()=>jN(e),[e]),i=XN(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(qG,{path:e.path,unifiedDiff:a}):null]})}function qG({path:e,unifiedDiff:t}){let n=_t().theme.useResolvedTheme(),o=H(()=>{let r=y_(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:C_(ZC(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(ZI,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:h_(n),themeType:n,stickyHeaders:!1}})})}var VG="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",I_=ce(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=ze(),i=qN(t),{body:s}=i,l=QN(i.fileChanges);return b("div",{"aria-label":WN(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:VN(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":GN(s.shape,a),className:F(VG,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(b_,{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 eb=ce(function(t){return u(I_,{...t})});function Mg(e){return e.id??e.label}function tb(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?[Mg(o)]:[]})))}function WG(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function nb(e,t){let n=WG(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=tb(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function GG(e,t){let n={};for(let o of e){let r=nb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function jG(e,t){return e.reduce((n,o)=>nb(o,t[o.id])?n+1:n,0)}function S_(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?nb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=jG(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?tb(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:GG(e,t)!==null,canAdvance:!!i}}pe();var ob=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(QG,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),QG=ce(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=ze(),l=_t(),d=S_(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||Lg(w.target))return;let k=VC(w.key,c.options.length);if(k===null)return;let S=c.options[k];S&&(w.preventDefault(),y(c.id,Mg(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(VI,{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(GI,{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(WI,{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=Mg(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 w_=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 T_(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 L_(e){return e.description??e.name}var k_=ce(function(t){let{current:n,modes:o}=t.nativeMode,r=L_(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(hf,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[b(Je,{render:u(Tg,{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(yf,{children:n.name})]}),u(xf,{alignItemWithTrigger:!1,children:o.map(a=>u(vf,{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 rb(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 ab(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 P_(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=ab(i,r);s!==null&&Sg(a,{item:i,score:s,tieBreaker:`${da(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function XG(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?ab(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 E_(e,t){let n=ho(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=XG(r,n);a!==null&&Sg(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 YG(e){return typeof e!="string"?null:e.trim()||null}function JG(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function ZG(e,t){return e?.find(o=>o.id===t)?.value}function A_(e,t){let n=YG(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 e6(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?A_(e,t):A_(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function Rg(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(JG).map(r=>e6(r,ZG(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 ib(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 Ng(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 zu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function M_(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
|
|
3731
|
-
${n}`}pe();var t6=`Ultrathink:
|
|
3732
|
-
`;function n6(){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 R_(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 _g(e){if(!e)return null;let t=Ys(e);return typeof t=="string"?t:null}function o6(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=Rg({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&&zu(r),y=x&&zu(r.replace(/^Ultrathink:\s*/i,"")),C=(x?"ultrathink":_g(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,k=_g(m),S=_g(h),L=h?ib(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 sb(e){let t=o6(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 lb(e){return sb(e).hasAnyControls}var db=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}=sb({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{h(Ng(I))},L=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){let A=a.trim().length===0?t6:M_(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(R_(g,I.id,T))}}};return k?b(xe,{children:[v.map((I,T)=>{let A=C&&I.id===y?.id?"ultrathink":_g(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(n6,{})]}):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(R_(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 r6(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")}):ib(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 N_=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}=sb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!lb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:k}=r6(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(db,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function __(e){return zu(e)?"ultrathink":"none"}function D_(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=Rg({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:Ng(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function O_(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)||!lb({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 F_(e){return O_(db,e)}function B_(e){return O_(N_,e)}pe();var z_=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},$_=(e=>e?z_(e):z_);pe();var a6=e=>e;function i6(e,t=a6){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 H_=e=>{let t=$_(e),n=o=>i6(t,o);return Object.assign(n,t),n},U_=(e=>e?H_(e):H_);var cb=U_(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 K_(e){return cb(t=>e===null?null:t.presetIdByDraftId[e]??null)}function ub(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var fb="__none__",q_=ce(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=ze(),i=_t().presets.useThreadPresets(t),s=K_(n),l=cb(c=>c.setDraftPresetId);if(n===null){let f=ub(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=ub(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??fb,onValueChange:c=>{l(n,c===fb?null:c)},children:[u(Ir,{value:fb,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 V_(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 s6(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 W_(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function l6(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function pb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function mb(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 gb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function d6(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=pb(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 G_(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=d6(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:l6(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:gb(o,t)})}return n}function j_(e){return e.snapshot===null||e.credentialIdentity===null?null:s6(e.snapshot,e)?e.snapshot:null}function Q_(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function X_(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}pe();function Y_(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 J_(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 Z_(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=mb(e.durationMs);return o!==null?J_(o,t):f6(e.kind,t)}function c6(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 u6(e,t){let n=c6(e.display,t);if(e.kind==="quota-window")return`${Z_(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function f6(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 p6(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 $u(e){return ea(e,"locale")||e}function m6(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:$u(e.retryAt)});case"offline":return t("sourceMetrics.outcomeOffline");case"unsupported":return t("sourceMetrics.outcomeUnsupported");case"error":return t("sourceMetrics.outcomeError")}}function g6(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 hb(e,t){let n=pb(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 eD(e){let[t,n]=G(!1);return u(h6,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function h6(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=ze(),i=V_(r),{feedback:s,refreshing:l,refresh:d}=Y_(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?j_(r):null,f=c?.metrics??[],p=G_(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,h=Q_(p),g=X_(f),v=l,x=g6(r,p,a),y=W_(r),w=`${jr()}-source-metrics-details`,k=[...p.map(S=>({key:`${S.metricId}\0${S.poolKey}`,text:u6(S,a)})),...h===null?[]:[{key:"resets-at",text:a("sourceMetrics.resetsAt",{time:$u(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(v6,{metric:S,queryError:r.error,t:a},S.metricId)),g!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("sourceMetrics.collectedAt",{time:$u(g)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:m6(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 v6({metric:e,queryError:t,t:n}){let o=hb(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):hb(e,e.remaining),a=hb(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:p6(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=gb(e,t),d=e.window?.durationMs??null,c=mb(d),f=Z_({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:$u(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("sourceMetrics.resetsAt",{time:$u(e.resetsAt)})}):null,c!==null?u("div",{children:J_(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 tD(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 nD(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 x6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function oD(e){let{t}=ze(),{usage:n,modelDisplayName:o,onCompact:r,compactDisabled:a,compactDisabledReason:i}=e,s=x6(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:nD(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 vb(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 xb(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 yb(e){return e.submissionTarget==="provider-turn"?xb(e.providerInput??e.prompt,e.maxInputChars):null}function rD(e){let t=e.disabledReason??yb(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 aD({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 iD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function y6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function sD(e){let t=_t(),n=lf(),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&&y6(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 C6=['[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(","),Cb=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,b6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},I6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function S6(e){return e.closest(C6)!==null}var w6=ce(function(t){let{t:n}=ze(),o=Pg(),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(hf,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[b(Je,{render:u(Tg,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(gr,{icon:a}),u(yf,{children:r.label})]}),b(xf,{alignItemWithTrigger:!1,children:[kg.map(f=>{let p=o(f),m=p.icon;return u(vf,{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(k_,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),T6=ce(function(t){return b(xe,{children:[t.activeContextWindow?u(oD,{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(Eg,{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})]})}),lD=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:be,activeProjectDefaultModelSelection:ue,projectId:Be=null,activeThreadModelSelection:ge,selectedExecutionSelection:le,composerChoices:we,selectedExecutionReady:ye,selectedModelOptionDescriptors:te,onModelPickerOpenChange:Te,onClearExecutionSelection:dt,executionAppliesTo:ct,activeContextWindow:lt,compactDisabled:at,compactDisabledReason:Vt,resolvedTheme:it,settings:Me,keybindings:Oe,terminalOpen:Ue,gitCwd:et,promptRef:Ee,composerRef:Ce,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=>ov(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?uT({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(()=>CN(me.model.applyInstanceSettings(me.model.deriveInstanceEntries(be),Me)),[me.model,be,Me]),Js=Qt.activeProvider??null,_e=f?.session?.providerInstanceId??ge?.instanceId??ue?.instanceId??null,Go=bN(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&&bg(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 Ig(ae,void 0)?.instanceId??Ig(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:be,selectedProvider:$t,selectedInstanceId:dn,threadModelSelection:ge,projectModelSelection:ue,settings:Me}),Sn=le===void 0?yr:le,Ie=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(()=>__(Qe),[Qe]),Cr=H(()=>D_({provider:$t,model:Ht,models:Fn,promptInjectionState:Qa,modelOptions:xr?.[dn],planModeEnabled:Me.planModeEnabled},me.model),[xr,Qa,dn,Ht,$t,Fn,Me.planModeEnabled]),Xa=Cr.promptEffort,Bo=Sn?xr?.[dn]??Sn.optionOverrides:Cr.modelOptionsForDispatch,jo=Me.planModeEnabled,Qo=H(()=>({showInteractionModeToggle:jo&&me.model.getInteractionModeToggle(be,$t),runtimeModeSwitch:Uw($t)}),[jo,be,$t]),fa=Ie?.supportsNativeModeSwitch===!0,no=m&&fa?Qt.nativeModeByProvider?.[dn]??null:null,qr=H(()=>T_(Ie,m?no:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,Ie,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||!we?.length?null:we.find(P=>P.runtimeId===Sn.runtimeId&&P.sourceId===Sn.sourceId&&P.profileId===Sn.profileId&&(P.endpointId??void 0)===(Sn.endpointId??void 0))??null,[we,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(Me,V));return P},[On,Me]),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(()=>tD(ge,Ao),[ge,Ao]),an=`${String(o)}\0${String(n)}`,Dg=lr(Qe,Qe.length),ei=$a(an,Qe,{cursor:Dg,expandedCursor:Qe.length}),[Hu,Og]=G(()=>({documentKey:an,cursor:ei.cursor})),ga=Hu.documentKey===an?Hu.cursor:ei.cursor,Ro=$(P=>{Og(V=>{let ae=V.documentKey===an?V.cursor:$a(an,Ee.current).cursor,$e=typeof P=="function"?P(ae):P,Ge=Ee.current,rt=wr(Ge,$e);return xM(an,Ge,$e,rt),V.documentKey===an&&V.cursor===$e?V:{documentKey:an,cursor:$e}})},[an,Ee]),[lo,K]=G(()=>dr(Qe,Qe.length)),[fe,Re]=G(null),[It,yo]=G(null),[Vr,Co]=G(!1),[el,xd]=G(!1);q(()=>{Te?.(el)},[el,Te]);let[fD,Uu]=G(!1),[Ku,Fg]=G(null),[pD,Bg]=G(null),[bb,mD]=G(null),[zg,ha]=G(!1),[yd,tl]=G(!1),[gD,Ib]=G(null),[nl,$g]=G({key:0,active:!1}),Sb=_(an);he(()=>{Sb.current!==an&&(Sb.current=an,K(dr(Qe,ei.expandedCursor)),Re(null),yo(null),Co(!1),xd(!1),Fg(null),Bg(null),ha(!1),tl(!1),Ib(null),$g({key:nl.key,active:!1}))},[an,ei.expandedCursor,Qe,nl.key]);let br=ip("max-sm"),wn=br&&!h&&!fD,va=_(null),wb=_(null),Hg=_(null),Tb=_(null),Ug=_(!1),Kg=_(!1),qg=_(!1),Lb=_([]),kb=_(null),bo=_(null),ol=_(null),rl=_(null),qu=_(!1),Pb=_(0),al=_(null),Vg=_(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,Eb=lo?.kind==="path"?lo.query:"",Ab=sl==="path",Wg=me.pathSearch.useComposerPathSearch({environmentId:o,cwd:Ab?et:null,query:Ab?Eb:null}),$o=H(()=>{if(!lo)return[];if(lo.kind==="path")return Wg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:gu(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=pM(Ie?.skills??[],Me.showSkillsInSlashMenu),ae=mM(Ie?.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 E_(rt,$e)}return lo.kind==="skill"?P_(Ie?.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,Ie,Me.showSkillsInSlashMenu,Wg.entries]),Ui=!!lo,ti=lo?`${lo.kind}:${lo.query.trim().toLowerCase()}`:null,Mb=H(()=>{let P=rb({items:$o,highlightedItemId:fe,currentSearchKey:ti,highlightedSearchKey:It});return $o.find(V=>V.id===P)??null},[fe,It,$o,ti]);qg.current=Ui,Lb.current=$o,kb.current=Mb;let hD=H(()=>new Set(Zn),[Zn]),En=S!==null,Vu=I[0]??null,Rb=T?.activeQuestion?.allowFreeform===!1,Wu=En||I.length>0||!wn&&z&&U!==null,vD=wn&&!En&&I.length===0,xD=z||T!==null,{isComposerFooterCompact:Cd,isComposerPrimaryActionsCompact:Nb}=ST(Hg,xD),yD=sl==="path"&&Eb.length>0&&Wg.isPending,CD=H(()=>sl==="skill"?"No skills found. Try / to browse provider commands.":sl==="path"?"No matching files or folders.":"No matching command.",[sl]),_b=$(P=>{if(P===Ee.current){jt();return}Ee.current=P,Z(n,P);let V=lr(P,P.length);Ro(V),K(dr(P,P.length)),jt()},[n,Ee,jt,Z]),bD=F_({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:_b,planModeEnabled:Me.planModeEnabled}),Db=B_({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:_b,planModeEnabled:Me.planModeEnabled}),Gu=H(()=>T?{questionIndex:T.questionIndex,isLastQuestion:T.isLastQuestion,canAdvance:T.canAdvance,isResponding:E,isComplete:!!A}:null,[E,T,A]),ID=v==="running"||y||ma||x||zt||g||k!==null||!il.hasSendableContent,SD="Send message",bd=br&&!wn&&Gu!==null,ll=$(P=>{Z(n,P)},[n,Z]),wD=$(P=>{yt(n,P)},[n,yt]),TD=$(P=>{We(n,P)},[n,We]),LD=$(P=>{me.uploads.release(P),In(n,P)},[me.uploads,n,In]),kD=$(P=>{let V=Tt.findIndex(Ge=>Ge.id===P);if(V<0)return;let ae=me.terminalContext.removeInlinePlaceholder(Ee.current,V);Ee.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,Ee,vn,ll]);he(()=>{Ee.current=Qe,Ro(P=>sr(Qe,P))},[an,Qe,Ee,Ro]),q(()=>{if(Ku===null)return;let P=xb(Qe,ut.maxInputChars);P!==Ku&&Fg(P)},[Ku,ut.maxInputChars,Qe]),q(()=>{Bg(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=rb({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 ju=_(null);q(()=>{let P=T?.customAnswer;if(typeof P!="string"){ju.current=null;return}let V=Vu?.requestId??null,ae=T?.activeQuestion?.id??null,$e=ju.current?.requestId!==V||ju.current?.questionId!==ae,Ge=Ee.current!==P;if(ju.current={requestId:V,questionId:ae},!$e&&!Ge)return;Ee.current=P;let rt=lr(P,P.length);Ro(rt),K(dr(P,wr(P,rt))),Re(null)},[T?.customAnswer,T?.activeQuestion?.id,Vu?.requestId,Ee]);let PD=$((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}Ee.current=P,ll(P),I6(Tt,Ge)||Bt(n,b6(Tt,Ge)),Ro(V),K($e?null:dr(P,ae))},[T?.activeQuestion,I.length,Pt,Ee,ll,n,Tt,Bt]),ni=$((P,V,ae,$e)=>{let Ge=Ee.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=Jw(Ee.current,P,V,ae),No=lr(kt.text,kt.cursor),An=wr(kt.text,No);Ee.current=kt.text;let ya=T?.activeQuestion;return ya&&Vu?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,Vu,Pt,Ee,ll]),Qu=$(()=>{let P=va.current?.readSnapshot();return P||{value:Ee.current,cursor:ga,expandedCursor:wr(Ee.current,ga),terminalContextIds:Tt.map(V=>V.id)}},[ga,Tt,Ee]),Gg=$(()=>{let P=Qu();return{snapshot:P,trigger:dr(P.value,P.expandedCursor)}},[Qu]),Ob=$(P=>{if(Kg.current)return;Kg.current=!0,window.requestAnimationFrame(()=>{Kg.current=!1});let{snapshot:V,trigger:ae}=Gg();if(ae){if(P.type==="path"){let $e=`${Tc(P.path)} `,Ge=Cb(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=Cb(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=Cb(V.value,ae.rangeEnd,$e);ni(ae.rangeStart,Ge,$e,{expectedText:V.value.slice(ae.rangeStart,Ge)})&&Re(null);return}}},[ni,vt,Gg]),ED=$(P=>{Re(P),yo(ti)},[ti]),Fb=$(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]),Bb=$(()=>{if(!br)return;bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),Uu(!1)},[br]),zb=$(()=>!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]),jg=$((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=rD({prompt:Ee.current,submissionTarget:T?"pending-user-input":"provider-turn",maxInputChars:ut.maxInputChars,disabledReason:Xo,event:P,onSend:$e=>(Ug.current=!1,Ft($e,V),!Ug.current)});Fg(ae.validationMessage),ae.didDispatch&&zb()&&Bb()},[d,T,Bb,an,ma,ut.maxInputChars,zt,Ft,Ee,Xo,zb]),Qg=$(()=>{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]),Xu=$(()=>{bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),ol.current!==null&&window.cancelAnimationFrame(ol.current),rl.current!==null&&window.cancelAnimationFrame(rl.current),qu.current=!0,Uu(!0),ol.current=window.requestAnimationFrame(()=>{ol.current=null,va.current?.focusAtEnd(),rl.current=window.requestAnimationFrame(()=>{rl.current=null,qu.current=!1})})},[]),AD=(P,V)=>{if(P==="Tab"&&V.shiftKey)return jo?(de(),!0):!1;let{trigger:ae}=Gg();if(qg.current||ae!==null){let rt=Lb.current,Et=kb.current??rt[0];if(P==="ArrowDown"&&rt.length>0)return Fb("ArrowDown"),!0;if(P==="ArrowUp"&&rt.length>0)return Fb("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&Et)return Ob(Et),!0}let Ge=P==="Enter"?Qw({isMobileViewport:br,shiftKey:V.shiftKey,modifierKey:V.metaKey||V.ctrlKey,isDraftThread:i==="draft"}):null;return Ge?(jg(void 0,Ge),!0):!1},Yu=me.stash.useStore,dl=Yu(P=>P.entries),$b=Yu(P=>P.stashEntry),Ju=Yu(P=>P.takeEntry),Hb=Yu(P=>P.finalizeEntryImages);q(()=>()=>{al.current!==null&&window.clearTimeout(al.current)},[]);let Ub=$(()=>{Pb.current+=1,$g({key:Pb.current,active:!0}),al.current!==null&&window.clearTimeout(al.current),al.current=window.setTimeout(()=>{al.current=null,$g(P=>({...P,active:!1}))},1200)},[]),MD=$(P=>{let{entry:V,durable:ae}=Ju(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=Ee.current,Ge=P.prompt.length===0?$e:$e.trim().length?`${$e.replace(/\s+$/,"")}
|
|
3730
|
+
`)?e.slice(0,-1):e}function jG(e){return e.startsWith("diff --git")||e.includes(`
|
|
3731
|
+
diff --git`)}function x_(e,t){if(e.length===0)return[""];let n=`
|
|
3732
|
+
${t}`,o=e.startsWith(t)?0:f_(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=f_(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function f_(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function p_(e){return e==null?e:Rn(e)}function QG(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function YC(e){let t=e.slice(1);return Rn(t===""?`
|
|
3733
|
+
`:t)}function JC(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var y_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function b_(e){return e==="dark"?y_.dark:y_.light}var I_=2166136261,S_=16777619,XG=2654435769,YG=2246822507;function C_(e,t=I_,n=S_){let o=t>>>0;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,n)>>>0;return o>>>0}function JG(e,t="diff-panel"){let n=e.trim(),o=C_(n,I_,S_).toString(36),r=C_(n,XG,YG).toString(36);return`${t}:${n.length}:${o}:${r}`}function eb(e){if(!e.isPartial)return e;let t=0,n=0,o=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:n};return t+=r.splitLineCount,n+=r.unifiedLineCount,a});return{...e,hunks:o,splitLineCount:t,unifiedLineCount:n,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function w_(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=m_(o,JG(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(eb):i.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:o,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:o,reason:"Failed to parse patch. Showing raw patch."}}}function T_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function L_({fileChange:e,onOpenDiff:t}){let{t:n}=De(),[o,r]=G(!1),a=z(()=>ZN(e),[e]),i=t_(e);return b("div",{className:"min-w-0",children:[b("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[u("span",{className:"min-w-0 shrink truncate font-mono text-[11px] text-foreground/85",children:e.path}),u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:n("approval.diff.stat",{additions:i.additions,deletions:i.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):b(te,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(pn,{className:"size-3 shrink-0"}):u(Uo,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(te,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(ZG,{path:e.path,unifiedDiff:a}):null]})}function ZG({path:e,unifiedDiff:t}){let n=Ot().theme.useResolvedTheme(),o=z(()=>{let r=w_(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:T_(eb(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[n,t]);return o.length===0?u("pre",{"aria-label":e,className:"mt-1 max-h-56 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):u("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:u(tS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:b_(n),themeType:n,stickyHeaders:!1}})})}var e6="block max-h-20 min-w-0 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",k_=ue(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=De(),i=QN(t),{body:s}=i,l=e_(i.fileChanges);return b("div",{"aria-label":YN(i.kind,a),className:F("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:XN(i,a)}),n>1?b("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),s.shape==="none"?null:u("code",{"aria-label":JN(s.shape,a),className:F(e6,s.shape==="path"||s.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:s.shape==="command"?s.command:s.shape==="path"?s.path:s.shape==="url"?s.url:s.shape==="query"?s.query:s.text}),i.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:i.description}),i.fileChanges.map((d,c)=>u(L_,{fileChange:d,onOpenDiff:o},l[c])),i.args.length===0?null:b("details",{className:"min-w-0","data-approval-args":"true",children:[u("summary",{className:"cursor-pointer text-[11px] text-muted-foreground",children:a("approval.body.detailsSummary")}),u("dl",{"aria-label":a("approval.body.argumentsLabel"),className:"mt-1 grid max-h-32 min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 text-[11px] [scrollbar-width:thin]",tabIndex:0,children:i.args.map(d=>b("div",{className:"col-span-2 grid grid-cols-subgrid",children:[u("dt",{className:"font-mono text-muted-foreground",children:d.name}),u("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:d.value})]},d.name))})]})]})});var tb=ue(function(t){return u(k_,{...t})});me();var nb=ue(function(t){let{t:n}=De(),[o,r]=G(!1),[a,i]=G(!1),s=t.decision,l=s.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=s.askedBy.kind==="plugin"?s.askedBy.pluginId:null;return b("div",{className:F("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:d(s.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),s.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),s.detail===null?null:u("button",{type:"button",className:"min-w-0 truncate text-left font-mono text-[11px] text-muted-foreground",onClick:()=>r(f=>!f),children:o?s.detail.text.slice(0,4e3):s.detail.text.split(`
|
|
3734
|
+
`)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(te,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{i(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function Eg(e){return e.id??e.label}function ob(e,t){return Array.from(new Set((t??[]).flatMap(n=>{let o=e.options.find(r=>r.id!==void 0?r.id===n:r.label===n.trim());return o?[Eg(o)]:[]})))}function t6(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function rb(e,t){let n=t6(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=ob(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function n6(e,t){let n={};for(let o of e){let r=rb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function o6(e,t){return e.reduce((n,o)=>rb(o,t[o.id])?n+1:n,0)}function P_(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,i=r?rb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=o6(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?ob(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:n6(e,t)!==null,canAdvance:!!i}}me();var A_=ue(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){if(t.length===0)return null;let s=t[0];return s?u(r6,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),r6=ue(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=De(),l=Ot(),d=P_(t.questions,o,r),c=d.activeQuestion,f=_(null),p=_(i),[m,h]=G(null),[g,v]=G(null),x=g!==null&&g===c?.id;q(()=>{p.current=i},[i]),q(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){h(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&h(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),q(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=B((w,k)=>{if(c?.multiSelect){a(w,k);return}h({questionId:w,optionLabel:k}),a(w,k),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(w=>{if(!c||n||x||w.metaKey||w.ctrlKey||w.altKey||w.isComposing||w.keyCode===229||Pg(w.target))return;let k=GC(w.key,c.options.length);if(k===null)return;let S=c.options[k];S&&(w.preventDefault(),y(c.id,Eg(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(GI,{className:"py-2",open:!x,onOpenChange:w=>{v(w?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(QI,{title:s(x?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":x?"collapsed":"expanded",className:"group -my-1 flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-(--control-duration) hover:bg-muted/40",children:[u("span",{className:"text-xs font-medium text-muted-foreground group-hover:text-foreground/85",children:c.header}),t.questions.length>1?b("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,x?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(pn,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",x&&"rotate-180")})]})}),u(jI,{className:"px-3 sm:px-4",children:b("div",{className:"pt-2 pb-0.5",children:[u("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-sm text-foreground/85","data-pending-user-input-body":c.kind??"question",tabIndex:0,children:c.kind==="plan"?u(nr,{text:c.question,cwd:void 0,isStreaming:!1}):u("p",{className:"whitespace-pre-wrap",children:c.question})}),c.multiSelect?u("p",{className:"mt-1 text-secondary-label text-xs",children:s("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((w,k)=>{let S=Eg(w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),T=k<9?k+1:null,E=F("group relative flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors duration-(--control-duration) pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",I?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),A=b(be,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:w.label}),w.description&&w.description!==w.label?u("span",{className:"text-secondary-label text-[11px]",children:w.description}):null]}),I?u(Io,{className:"size-icon-2 shrink-0 text-primary"}):T!==null?u("kbd",{className:F("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:T}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{y(c.id,S)},className:E,children:A},`${c.id}:${S}`)})})]})})]})});me();var E_=ue(function({planTitle:t}){let{t:n}=De();return u("div",{className:"px-3 py-2 sm:px-4",children:b("div",{className:"flex flex-wrap items-center gap-2",children:[u("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?u("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function M_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(VN,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function R_(e){return e.occupant.kind!=="user-input"?null:u(A_,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var N_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:b("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:M_(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,className:"px-3 pt-2 sm:px-4"}),u("div",{className:"flex flex-wrap items-center justify-end gap-1 px-3 pt-2 pb-3 sm:px-4",children:M_(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:u("div",{"data-chat-composer-collapsed-controls":"true",children:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:R_,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[R_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(E_,{planTitle:UN(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function __(e,t){let n=N_[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var sue=Object.keys(N_);me();me();var Mg=["approval-required","auto-accept-edits","auto","full-access"];var a6={"approval-required":Ud,"auto-accept-edits":Xr,auto:ai,"full-access":ri},i6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Rg(){let{t:e}=De();return B(t=>{let n=i6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:a6[t]}},[e])}var D_=ue(function(t){let{t:n}=De(),o=Rg();return b(Jo,{children:[u(tr,{render:u(te,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":"More composer controls"}),children:u(Yo,{"aria-hidden":"true",className:"size-4"})}),b(er,{align:"start",children:[t.traitsMenuContent?b(be,{children:[t.traitsMenuContent,u(ii,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Mode"}),b(Sa,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Cr,{value:"default",children:"Chat"}),u(Cr,{value:"plan",children:"Plan"})]}),u(ii,{})]}):null,t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),u(Sa,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Mg.map(r=>u(Cr,{value:r,children:o(r).label},r))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?u(Sa,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Cr,{value:r.id,children:r.name},r.id))}):u("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});me();function O_(e,t){let n=e?.nativeModes??[];if(n.length===0)return null;let o=n.find(r=>r.id===t)??n.find(r=>r.id===e?.currentNativeModeId);return o?{modes:n,current:o}:null}function F_(e){return e.description??e.name}var B_=ue(function(t){let{current:n,modes:o}=t.nativeMode,r=F_(n);return!t.canSwitch||o.length<2?b(Qe,{children:[b(Ye,{render:u($r,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(mr,{icon:cl}),u("span",{children:n.name})]}),b(Xe,{side:"top",children:[u("span",{className:"block font-medium",children:r}),o.length>1?b("span",{className:"mt-1 block text-muted-foreground text-xs",children:["Agent modes: ",o.map(a=>a.name).join(", ")]}):null]})]}):b(Qe,{children:[b(xf,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[b(Ye,{render:u(kg,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(mr,{icon:cl}),u(bf,{children:n.name})]}),u(Cf,{alignItemWithTrigger:!1,children:o.map(a=>u(yf,{value:a.id,hideIndicator:!0,className:"min-w-56 py-2",children:b("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:a.name}),a.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:a.description}):null]})},a.id))})]}),u(Xe,{side:"top",children:r})]})});function ab(e){return e.items.length===0?null:e.currentSearchKey===e.highlightedSearchKey&&e.highlightedItemId&&e.items.some(t=>t.id===e.highlightedItemId)?e.highlightedItemId:e.items[0]?.id??null}function ib(e,t){let n=e.name.toLowerCase(),o=sa(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[zr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),zr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),zr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),zr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),zr({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function z_(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=go(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=ib(i,r);s!==null&&Tg(a,{item:i,score:s,tieBreaker:`${sa(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function s6(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?ib(e.skill,a):0;return i!==null?i:"skill".startsWith(t)?Number.MAX_SAFE_INTEGER:null}let n=e.type==="slash-command"?e.command.toLowerCase():e.command.name.toLowerCase(),o=e.description.toLowerCase(),r=[zr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),zr({value:o,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26})].filter(a=>a!==null);return r.length===0?null:Math.min(...r)}function $_(e,t){let n=go(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=s6(r,n);a!==null&&Tg(o,{item:r,score:a,tieBreaker:r.type==="slash-command"?`0\0${r.command}`:r.type==="provider-slash-command"?`1\0${r.command.name}\0${r.provider}`:`2\0${r.skill.name}\0${r.provider}`},Number.POSITIVE_INFINITY)}return o.map(r=>r.item)}function l6(e){return typeof e!="string"?null:e.trim()||null}function d6(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function c6(e,t){return e?.find(o=>o.id===t)?.value}function H_(e,t){let n=l6(t);return n?e.options.length===0?n:e.promptInjectedValues?.includes(n)&&e.options.some(o=>o.id===n)?e.options.find(o=>o.isDefault)?.id:e.options.some(o=>o.id===n)?n:e.currentValue??e.options.find(o=>o.isDefault)?.id:e.currentValue??e.options.find(o=>o.isDefault)?.id}function u6(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?H_(e,t):H_(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function Ng(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(d6).map(r=>u6(r,c6(n,r.id)??r.currentValue))}function Xs(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function sb(e){if(!e)return;if(e.type==="boolean")return typeof e.currentValue=="boolean"?e.currentValue?"On":"Off":void 0;let t=Xs(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function _g(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Xs(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function Bu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function U_(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
|
|
3735
|
+
${n}`}me();var f6=`Ultrathink:
|
|
3736
|
+
`;function p6(){let{t:e}=De();return u(ul,{variant:"outline",className:"inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4",children:e("traits.default")})}function K_(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function Dg(e){if(!e)return null;let t=Xs(e);return typeof t=="string"?t:null}function m6(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=Ng({caps:l,selections:a}),c=d.filter(I=>I.type==="select"),f=d.filter(I=>I.type==="boolean"),p=c[0]??null,m=c.find(I=>I.id==="contextWindow")??null,h=c.find(I=>I.id==="agent")??null,g=f.find(I=>I.id==="fastMode")??null,v=f.find(I=>I.id==="thinking")??null,x=i&&(p?.promptInjectedValues?.length??0)>0&&Bu(r),y=x&&Bu(r.replace(/^Ultrathink:\s*/i,"")),C=(x?"ultrathink":Dg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,k=Dg(m),S=Dg(h),L=h?sb(h):null;return{caps:l,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:h,fastModeDescriptor:g,thinkingDescriptor:v,effort:C,thinkingEnabled:w,contextWindow:k,ultrathinkPromptControlled:x,ultrathinkInBodyText:y,selectedAgent:S,selectedAgentLabel:L}}function lb(e){let t=m6(e.modelApi,e.provider,e.models,e.model,e.prompt,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,i=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:i,hasAnyControls:n||o||r||a||i}}function db(e){return lb(e).hasAnyControls}var cb=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=De(),p=Ot(),m=p.draft.useStore(I=>I.setProviderModelOptions),h=B(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let T=c.threadRef??c.draftId;T&&m(T,t,I,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,m]),{descriptors:g,selectDescriptors:v,booleanDescriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,hasAnyControls:k}=lb({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{h(_g(I))},L=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){let E=a.trim().length===0?f6:U_(a,"ultrathink");i(E);return}if(!(w&&I.id===y?.id)){if(C&&I.id===y?.id){let E=a.replace(/^Ultrathink:\s*/i,"");i(E)}S(K_(g,I.id,T))}}};return k?b(be,{children:[v.map((I,T)=>{let E=C&&I.id===y?.id?"ultrathink":Dg(I)??"";return b("div",{children:[T>0?u(ii,{}):null,b(ec,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:I.label}),w&&I.id===y?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Sa,{value:E,onValueChange:A=>L(I,A),children:I.options.map(A=>u(Cr,{value:A.id,hideIndicator:!0,closeOnClick:!0,disabled:w&&I.id===y?.id,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:b("span",{className:"min-w-0 truncate",children:[A.label,A.isDefault?b(be,{children:[" ",u(p6,{})]}):null]})}),A.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:A.description}):null]})},A.id))})]})]},I.id)}),x.map((I,T)=>{let E=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(ii,{}):null,b(ec,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Sa,{value:E,onValueChange:A=>{S(K_(g,I.id,A==="on"))},children:["on","off"].map(A=>u(Cr,{value:A,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:f(A==="on"?"traits.on":"traits.off")})})},A))})]})]},I.id)})]}):null});function g6(e,t){let n=null,o=!1,r=[];for(let a of t.descriptors){if(a.id==="fastMode"&&a.type==="boolean"){o=a.currentValue===!0,n=e(o?"traits.fast":"traits.normal");continue}if(t.provider==="codex"&&a.id==="serviceTier"&&a.type==="select"){let s=Xs(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(s==="default"||s===l.id)){o=s===l.id,n=a.options.find(({id:d})=>d===s)?.label??e(o?"traits.fast":"traits.normal");continue}}let i=t.ultrathinkPromptControlled&&a.id===t.primarySelectDescriptorId?e("traits.ultrathink"):a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):sb(a);typeof i=="string"&&i.length>0&&r.push(i)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var q_=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,h]=G(!1),{t:g}=De(),v=Ot().model,{descriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C}=lb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!db({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:k}=g6(g,{provider:t,descriptors:x,primarySelectDescriptorId:y?.id??null,ultrathinkPromptControlled:C}),S=k?b(be,{children:[u(mr,{icon:as,className:F("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:g("traits.fastModeOn")})]}):null,L=t==="codex";return b(Jo,{open:m,onOpenChange:I=>{h(I)},children:[u(tr,{render:u($r,{variant:c??"ghost",className:F(L?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:L?b("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[S,u("span",{className:"min-w-0 truncate",children:w}),u(Ri,{})]}):b(be,{children:[S,u("span",{children:w}),u(Ri,{})]})}),u(er,{align:"start",children:u(cb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function V_(e){return Bu(e)?"ultrathink":"none"}function W_(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,n,s),d=Ng({caps:l,selections:a}),c=d.find(h=>h.type==="select"),f=Xs(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i==="ultrathink";return{provider:n,promptEffort:p,modelOptionsForDispatch:_g(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function G_(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!db({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,prompt:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f})}function j_(e){return G_(cb,e)}function Q_(e){return G_(q_,e)}me();var X_=e=>{let t,n=new Set,o=(d,c)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let p=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,s);return s},Y_=(e=>e?X_(e):X_);me();var h6=e=>e;function v6(e,t=h6){let n=hn.useSyncExternalStore(e.subscribe,hn.useCallback(()=>t(e.getState()),[e,t]),hn.useCallback(()=>t(e.getInitialState()),[e,t]));return hn.useDebugValue(n),n}var J_=e=>{let t=Y_(e),n=o=>v6(t,o);return Object.assign(n,t),n},Z_=(e=>e?J_(e):J_);var ub=Z_(e=>({presetIdByDraftId:{},setDraftPresetId:(t,n)=>{e(o=>{if((o.presetIdByDraftId[t]??null)===n)return o;let r={...o.presetIdByDraftId};return n===null?delete r[t]:r[t]=n,{presetIdByDraftId:r}})},clearDraftPresetId:t=>{e(n=>{if(n.presetIdByDraftId[t]===void 0)return n;let o={...n.presetIdByDraftId};return delete o[t],{presetIdByDraftId:o}})}}));function eD(e){return ub(t=>e===null?null:t.presetIdByDraftId[e]??null)}function fb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var pb="__none__",tD=ue(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=De(),i=Ot().presets.useThreadPresets(t),s=eD(n),l=ub(c=>c.setDraftPresetId);if(n===null){let f=fb(i,o)?.displayName??o;return f===null?null:b($r,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(mr,{icon:Ca}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=fb(i,s);return b(Jo,{children:[u(tr,{render:u($r,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:b("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(mr,{icon:Ca}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(Ri,{})]})}),u(er,{align:"start",children:b(ec,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Sa,{value:s??pb,onValueChange:c=>{l(n,c===pb?null:c)},children:[u(Cr,{value:pb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Cr,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"min-w-0 truncate",children:c.displayName}),c.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:c.description}):null]})},c.presetId))]})]})})]})});me();function nD(e){let t=e.credentialIdentity,n=e.selection.expectedRevisions;return[e.queryKey,e.selection.environmentId,e.selection.runtimeId,e.selection.sourceId,e.selection.profileId,e.selection.endpointId??"",String(n.runtime),String(n.source),String(n.profile),String(n.endpoint??""),String(e.sourceConfigRevision),t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function x6(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.sourceId===t.sourceId&&e.sourceConfigRevision===t.sourceConfigRevision&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function oD(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function y6(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function mb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function gb(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=864e5,n=36e5,o=6e4,r=1e3;return e%t===0?{unit:"days",count:e/t}:e%n===0?{unit:"hours",count:e/n}:e%o===0?{unit:"minutes",count:e/o}:e%r===0?{unit:"seconds",count:e/r}:null}function hb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function C6(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?{kind:"money",amount:n,currency:e.unit.currency}:e.unit.kind==="percent"?{kind:"percent",amount:n,direction:e.unit.direction}:{kind:"quantity",amount:n,nativeUnit:e.unit.nativeUnit}}function rD(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=C6(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:y6(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:hb(o,t)})}return n}function aD(e){return e.snapshot===null||e.credentialIdentity===null?null:x6(e.snapshot,e)?e.snapshot:null}function iD(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function sD(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}me();function lD(e,t){let n=_(e),o=_(0),r=_(!1),[a,i]=G(e),[s,l]=G(null),[d,c]=G(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=B(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let h=await t();if(o.current!==p||n.current!==m)return;l(h)}catch{if(o.current!==p||n.current!==m)return;l({outcome:"error",retryAt:null})}finally{o.current===p&&n.current===m&&(r.current=!1,c(!1))}},[e,t]);return{feedback:s,refreshing:d,refresh:f}}function dD(e,t){switch(e.unit){case"days":return t("sourceMetrics.windowDays",{count:e.count});case"hours":return t("sourceMetrics.windowHours",{count:e.count});case"minutes":return t("sourceMetrics.windowMinutes",{count:e.count});case"seconds":return t("sourceMetrics.windowSeconds",{count:e.count})}}function cD(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=gb(e.durationMs);return o!==null?dD(o,t):S6(e.kind,t)}function b6(e,t){switch(e.kind){case"unlimited":return t("sourceMetrics.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("sourceMetrics.percentUsed",{value:e.amount}):t("sourceMetrics.percentRemaining",{value:e.amount})}}function I6(e,t){let n=b6(e.display,t);if(e.kind==="quota-window")return`${cD(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function S6(e,t){switch(e){case"balance":return t("sourceMetrics.kindBalance");case"credits":return t("sourceMetrics.kindCredits");case"quota-window":return t("sourceMetrics.kindQuotaWindow");case"spend-cap":return t("sourceMetrics.kindSpendCap");case"rate-limit":return t("sourceMetrics.kindRateLimit")}}function w6(e,t){switch(e){case"account":return t("sourceMetrics.scopeAccount");case"org":return t("sourceMetrics.scopeOrg");case"project":return t("sourceMetrics.scopeProject");case"key":return t("sourceMetrics.scopeKey");case"endpoint":return t("sourceMetrics.scopeEndpoint");case"model-group":return t("sourceMetrics.scopeModelGroup");case"model":return t("sourceMetrics.scopeModel");case"unknown":return t("sourceMetrics.scopeUnknown")}}function zu(e){return Jr(e,"locale")||e}function T6(e,t){switch(e.outcome){case"fresh":return t("sourceMetrics.outcomeFresh");case"partial":return t("sourceMetrics.outcomePartial");case"joined-inflight":return t("sourceMetrics.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("sourceMetrics.outcomeRateLimited"):t("sourceMetrics.outcomeRateLimitedUntil",{time:zu(e.retryAt)});case"offline":return t("sourceMetrics.outcomeOffline");case"unsupported":return t("sourceMetrics.outcomeUnsupported");case"error":return t("sourceMetrics.outcomeError")}}function L6(e,t,n){return e.capability.status==="unsupported"?n("sourceMetrics.unsupported"):e.credentialIdentity===null||e.capability.status==="unknown"?n("sourceMetrics.unknown"):t.length>0?null:e.loading?n("sourceMetrics.loading"):e.error!==null?n("sourceMetrics.outcomeError"):n("sourceMetrics.noData")}function vb(e,t){let n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?`${e.unit.currency} ${n}`:e.unit.kind==="percent"?`${n}%`:`${n} ${e.unit.nativeUnit}`}function uD(e){let[t,n]=G(!1);return u(k6,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function k6(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=De(),i=nD(r),{feedback:s,refreshing:l,refresh:d}=lD(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?aD(r):null,f=c?.metrics??[],p=rD(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,h=iD(p),g=sD(f),v=l,x=L6(r,p,a),y=oD(r),w=`${Wr()}-source-metrics-details`,k=[...p.map(S=>({key:`${S.metricId}\0${S.poolKey}`,text:I6(S,a)})),...h===null?[]:[{key:"resets-at",text:a("sourceMetrics.resetsAt",{time:zu(h)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-source-metrics":"true","data-source-id":r.sourceId,"data-next-message":r.isNextMessage?"true":"false","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(te,{type:"button",variant:"ghost",size:"sm",className:"h-auto min-h-control-3 min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal","aria-expanded":t,"aria-controls":w,"aria-label":a(t?"sourceMetrics.hideDetails":"sourceMetrics.showDetails"),onClick:n,children:b("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[b("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:r.sourceLabel}),r.isNextMessage?u("span",{className:"text-[11px] text-muted-foreground",children:a("modelPicker.nextMessage")}):null,m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-source-metrics-stale":"true",children:a("sourceMetrics.stale")}):null,u(pn,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label",t?"rotate-180":"rotate-0")})]}),u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] tabular-nums text-secondary-label",children:k.length>0?k.map((S,L)=>b("span",{children:[L>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):x})]})}),y?u(te,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("sourceMetrics.refreshAria",{source:r.sourceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"sourceMetrics.refreshing":"sourceMetrics.refresh")}):null]}),t?b("div",{id:w,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-source-metrics-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:x??a("sourceMetrics.noData")}):f.map(S=>u(P6,{metric:S,queryError:r.error,t:a},S.metricId)),g!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("sourceMetrics.collectedAt",{time:zu(g)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:T6(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("sourceMetrics.errorKeepLast")}):null]})}function P6({metric:e,queryError:t,t:n}){let o=vb(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):vb(e,e.remaining),a=vb(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:w6(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=hb(e,t),d=e.window?.durationMs??null,c=gb(d),f=cD({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-quota-pool":e.scope.quotaPoolId??"","data-window-ms":d===null?void 0:String(d),children:[b("div",{className:"font-medium text-foreground",children:[f,e.provenance==="estimated"?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.estimated")}):null,l?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("sourceMetrics.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("sourceMetrics.remaining")]}):null,a!==null?b("span",{children:[a," ",n("sourceMetrics.limit")]}):null]}),b("div",{className:"mt-0.5",children:[i,e.scope.identity!==null?` \xB7 ${e.scope.identity}`:null,s!==null?` \xB7 ${s}`:null]}),e.fetchedAt!==null?u("div",{children:n("sourceMetrics.collectedAt",{time:zu(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("sourceMetrics.resetsAt",{time:zu(e.resetsAt)})}):null,c!==null?u("div",{children:dD(c,n)}):null,e.window?.nativePeriod!==null&&e.window?.nativePeriod!==void 0?u("div",{children:e.window.nativePeriod}):null]})}function md(e){return e===null||!Number.isFinite(e)?"0":e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function fD(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?ud(n):e.model}function pD(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}function A6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function mD(e){let{t}=De(),{usage:n,modelDisplayName:o,onCompact:r,compactDisabled:a,compactDisabledReason:i}=e,s=A6(n.usedPercentage),l=Math.max(0,Math.min(100,n.usedPercentage??0)),d=9.75,c=2*Math.PI*d,f=c*(1-l/100),p=n.totalProcessedTokens??null,m=p!==null&&p>0,g=l>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(fl,{children:[u(ml,{openOnHover:!0,delay:150,closeDelay:r?150:0,render:u(te,{size:"icon-sm",variant:"ghost-muted",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&s?`Context window ${s} used`:`Context window ${md(n.usedTokens)} tokens used`,children:u("span",{className:"relative flex size-5 items-center justify-center",children:b("svg",{viewBox:"0 0 24 24",className:"-rotate-90 absolute inset-0 size-full transform-gpu mx-0!","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:g,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f})]})})})}),u(pl,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:b("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[b("div",{className:"flex items-center justify-between gap-3",children:[u("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&s?b("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:s}),u("span",{className:"mx-1",children:"\xB7"}),b("span",{children:[md(n.usedTokens),"/",md(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:md(n.usedTokens)})]}),n.maxTokens!==null?u("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted/60",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),"aria-label":t("contextWindow.usage"),children:u("div",{className:"h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none",style:{width:`${l}%`,backgroundColor:g}})}):null,m?b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:md(p)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:pD(t,o,n.autoCompactThreshold)}):null,r?b(be,{children:[b(te,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:a,onClick:r,children:[u(Kd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),a&&i?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:i}):null]}):null]})})]})}function xb(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function yb(e,t){let n=e.trim().length-t;if(n<=0)return null;let o=n===1?"character":"characters";return`Prompt is ${n.toLocaleString("en-US")} ${o} over the ${t.toLocaleString("en-US")}-character limit. Shorten or split it before sending.`}function Cb(e){return e.submissionTarget==="provider-turn"?yb(e.providerInput??e.prompt,e.maxInputChars):null}function gD(e){let t=e.disabledReason??Cb(e);return t?(e.event?.preventDefault(),{validationMessage:t,didDispatch:!1}):e.onSend(e.event)===!1?(e.event?.preventDefault(),{validationMessage:null,didDispatch:!1}):{validationMessage:null,didDispatch:!0}}function hD({message:e}){return e?u("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function E6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function vD(e){let t=Ot(),n=cf(),o=t.pane.useActive(),[r,a]=G(null);return ye(()=>{if(!o)return;let i=e.anchor;if(!i){a(null);return}let s=!0,l=()=>{if(!s)return;let c=i.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??i).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,g=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,x={bottom:window.innerHeight-p.top-v,left:p.left+g,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-g*2)};a(y=>y&&E6(y,x)?y:x)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(i);for(let c=i.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{s=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:F(n,"pointer-events-auto fixed z-[70]"),"data-composer-drawer-layer":"true",style:{bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var M6=['[data-composer-drawer-layer="true"]','[data-slot="popover-popup"]','[data-slot="menu-popup"]','[data-slot="select-popup"]','[data-slot="combobox-popup"]','[data-slot="autocomplete-popup"]'].join(","),bb=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,R6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},N6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function _6(e){return e.closest(M6)!==null}var D6=ue(function(t){let{t:n}=De(),o=Rg(),r=o(t.runtimeMode),a=r.icon,i=t.runtimeModeSwitch==="next-turn",s=t.interactionMode==="plan"?"Plan mode \u2014 click to return to normal build mode":"Default mode \u2014 click to enter plan mode",l=t.nativeMode!==null,d=t.showInteractionModeToggle&&!l?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Qe,{children:[b(Ye,{render:u($r,{className:F("shrink-0 whitespace-nowrap",t.interactionMode==="plan"?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:t.onToggleInteractionMode,"aria-label":s}),children:[t.interactionMode==="plan"?u(mr,{icon:Vd,className:"text-current opacity-100"}):u(mr,{icon:Vi,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t.interactionMode==="plan"?"Plan":"Build"})]}),u(Xe,{side:"top",children:s})]})]}):null,c=b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Qe,{children:[b(xf,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[b(Ye,{render:u(kg,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(mr,{icon:a}),u(bf,{children:r.label})]}),b(Cf,{alignItemWithTrigger:!1,children:[Mg.map(f=>{let p=o(f),m=p.icon;return u(yf,{value:f,hideIndicator:!0,className:"min-w-64 py-2",children:u("div",{className:"flex min-w-0 items-center gap-3",children:b("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[b("span",{className:"inline-flex items-center gap-1.5 font-medium text-foreground",children:[u(m,{className:"size-icon-2 shrink-0 text-muted-foreground"}),p.label]}),u("span",{className:"text-muted-foreground text-xs leading-4",children:p.description})]})})},f)}),i?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Xe,{side:"top",children:i?`${r.description} ${n("runtimeMode.appliesNextTurnHint")}`:r.description})]}),i?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline",children:n("runtimeMode.appliesNextTurn")}):null]});return b(be,{children:[t.nativeMode?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),u(B_,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),O6=ue(function(t){return b(be,{children:[t.activeContextWindow?u(mD,{usage:t.activeContextWindow,modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}):null,t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:"Preparing worktree..."}):null,u(Fu,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isConnecting:t.isConnecting,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,onImplementPlanInNewThread:t.onImplementPlanInNewThread})]})}),xD=ue(function(t){let{composerDraftTarget:n,environmentId:o,attachmentUploadsCapabilityKnown:r,supportsAttachmentUploads:a,routeKind:i,routeThreadRef:s,draftId:l,activeThreadId:d,activeThreadEnvironmentId:c,activeThread:f,isServerThread:p,isLocalDraftThread:m,forceExpandedOnMobile:h,projectSelectionRequired:g,phase:v,isConnecting:x,isSendBusy:y,sendDisabledReason:C,isPreparingWorktree:w,environmentUnavailable:k,activePendingApproval:S,onRespondToComposerDecision:L,pendingUserInputs:I,activePendingProgress:T,activePendingResolvedAnswers:E,activePendingIsResponding:A,activePendingDraftAnswers:N,activePendingQuestionIndex:R,respondingRequestIds:$,occupants:H,showPlanFollowUpPrompt:K,activeProposedPlan:O,activeTasksProgress:oe,activeTaskSteps:ee,runtimeMode:W,interactionMode:qe,lockedProvider:ve,providerStatuses:fe,activeProjectDefaultModelSelection:Ne,projectId:Ae=null,activeThreadModelSelection:ae,selectedExecutionSelection:Ee,composerChoices:xe,selectedExecutionReady:re,selectedModelOptionDescriptors:Ie,onModelPickerOpenChange:st,onClearExecutionSelection:dt,executionAppliesTo:lt,activeContextWindow:ct,compactDisabled:Et,compactDisabledReason:ot,resolvedTheme:He,settings:Se,keybindings:ze,terminalOpen:Je,gitCwd:qt,promptRef:X,composerRef:nn,composerImagesRef:xt,composerTerminalContextsRef:mn,composerElementContextsRef:Tt,sendContextRef:Yt,onSend:Jt,onInterrupt:Mt,onCompactContext:zn,onImplementPlanInNewThread:kn,onRespondToApproval:vn,onSelectActivePendingUserInputOption:$n,onAdvanceActivePendingUserInput:Vt,onPreviousActivePendingUserInputQuestion:Zt,onChangeActivePendingUserInputCustomAnswer:Sn,onProviderModelSelect:ho,onModelSelectionChosen:zt,onExecutionSelectionChosen:D,onSelectPluginAction:Y,onManagePlugins:ce,getModelDisabledReason:ie,getModelContinuationLabel:pe,onContinueInModel:Ze,toggleInteractionMode:pt,handleRuntimeModeChange:xn,handleInteractionModeChange:ht,handleNativeModeChange:en,focusComposer:tn,scheduleComposerFocus:bt,setThreadError:yn,onExpandImage:sn}=t,ge=t.api,{limits:Rt}=t.attachments,{t:rt}=De(),Lt=ge.draft.useThreadDraft(n),et=Lt.prompt,Nt=Lt.images,ut=z(()=>Nt.filter(P=>av(P)==="image"),[Nt]),ft=Lt.terminalContexts,eo=Lt.elementContexts,ln=Lt.previewAnnotations,Nn=Lt.reviewComments,Hn=Lt.nonPersistedImageIds,Un=ge.uploads.useStore(P=>P.uploadsByImageId),ne=a?mT({imageIds:Nt.map(P=>P.id),uploadsByImageId:Un,environmentId:o}):null,Fe=ge.draft.useStore,at=Fe(P=>P.setPrompt),je=Fe(P=>P.setNativeMode),wn=Fe(P=>P.addImage),dn=Fe(P=>P.addImages),Cn=Fe(P=>P.removeImage),$t=Fe(P=>P.insertTerminalContext),Kn=Fe(P=>P.removeTerminalContext),Wt=Fe(P=>P.setTerminalContexts),vo=Fe(P=>P.removeElementContext),Wa=Fe(P=>P.removePreviewAnnotation),Ga=Fe(P=>P.removeReviewComment),Ni=Fe(P=>P.clearComposerPromptAndImages);q(()=>{if(r){if(!a){for(let P of Nt)ge.uploads.release(P.id);return}ge.draft.restoreAttachments();for(let P of Nt)ge.uploads.start({environmentId:o,image:P})}},[r,Nt,o,a]);let he=z(()=>SN(ge.model.applyInstanceSettings(ge.model.deriveInstanceEntries(fe),Se)),[ge.model,fe,Se]),da=Lt.activeProvider??null,Go=f?.session?.providerInstanceId??ae?.instanceId??Ne?.instanceId??null,gd=wN(he,da??Go)??he[0]?.driverKind??ge.model.makeDriverKind("unconfigured"),ca=ve??gd,qn=z(()=>{if(!ve||!f)return null;let P=f.session?.providerInstanceId??ae?.instanceId;return P?he.find(V=>V.instanceId===P)?.continuationGroupKey??null:null},[f,ae?.instanceId,ve,he]),_t=z(()=>{let P=[Lt.activeProvider,f?.session?.providerInstanceId,ae?.instanceId,Ne?.instanceId];for(let Be of P){if(!Be)continue;let We=he.find(nt=>nt.instanceId===Be&&Sg(nt));if(We){if(ve&&We.driverKind!==ve||qn&&We.continuationGroupKey!==qn)continue;return We.instanceId}}let V=he.filter(Be=>(!ve||Be.driverKind===ve)&&(!qn||Be.continuationGroupKey===qn)),le=V.filter(Be=>Be.driverKind===ca);return wg(le,void 0)?.instanceId??wg(V,void 0)?.instanceId??ge.model.noProviderSelection.instanceId},[Ne?.instanceId,f?.session?.providerInstanceId,ae?.instanceId,Lt.activeProvider,qn,ve,he,ca]),ro=z(()=>he.find(P=>P.instanceId===_t),[he,_t]),on=ro===void 0,_i=ot??(on?"Compacting is unavailable right now":null),It=ro?.driverKind??ca,{modelOptions:xo,selectedModel:bn,executionSelection:_e}=ge.draft.useEffectiveModelState({threadRef:n,providers:fe,selectedProvider:It,selectedInstanceId:_t,threadModelSelection:ae,projectModelSelection:Ne,settings:Se}),Gt=Ee===void 0?_e:Ee,Eo=z(()=>ro?.snapshot??null,[ro]),gr=z(()=>{let P=ro?.models??[];if(!Gt||Ie===void 0)return P;let V=P.find(le=>le.slug===bn);return[...P.filter(le=>le.slug!==bn),{...V??{slug:bn,name:bn},capabilities:{...V?.capabilities,optionDescriptors:Ie}}]},[ro,Gt,Ie,bn]),Di=z(()=>V_(et),[et]),yo=z(()=>W_({provider:It,model:bn,models:gr,promptInjectionState:Di,modelOptions:xo?.[_t],planModeEnabled:Se.planModeEnabled},ge.model),[xo,Di,_t,bn,It,gr,Se.planModeEnabled]),Hr=yo.promptEffort,jo=Gt?xo?.[_t]??Gt.optionOverrides:yo.modelOptionsForDispatch,hr=Se.planModeEnabled,ao=z(()=>({showInteractionModeToggle:hr&&ge.model.getInteractionModeToggle(fe,It),runtimeModeSwitch:Vw(It)}),[hr,fe,It]),Ur=Eo?.supportsNativeModeSwitch===!0,ua=m&&Ur?Lt.nativeModeByProvider?.[_t]??null:null,Oi=z(()=>O_(Eo,m?ua:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,Eo,m,ua]),_n=ua&&Oi?.current.id===ua?ua:void 0,Fi=B(P=>{m&&je(n,_t,P),en(P)},[m,je,n,_t,en]),Oo=z(()=>ge.model.createSelection(_t,bn,jo),[ge.model,_t,bn,jo]),Bi=z(()=>!Gt||!xe?.length?null:xe.find(P=>P.runtimeId===Gt.runtimeId&&P.sourceId===Gt.sourceId&&P.profileId===Gt.profileId&&(P.endpointId??void 0)===(Gt.endpointId??void 0))??null,[xe,Gt]),Fo=re??Bi?.ready===!0,vr=_(null);q(()=>{let P=f?.id??null,V=vr.current;vr.current={threadId:P,selection:Oo},!(V===null||V.threadId!==P||m)&&V.selection!==Oo&&zt?.(Oo)},[f?.id,m,zt,Oo]);let Qo=bn,io=z(()=>{let P=new Map;for(let V of he)P.set(V.instanceId,ge.model.getAppModelOptionsForInstance(Se,V));return P},[he,Se]),zi=z(()=>(io.get(_t)??[]).some(V=>V.slug===Qo)?Qo:ge.model.normalizeSlug(Qo,It)??Qo,[ge.model,io,_t,Qo,It]),Bo=m&&ve===null,$e=ge.pluginComposer.useOptions(Bo?o:null,Ae),vt=$e.options,cn=Bo?Lt.selectedPluginActionKey:null,rn=z(()=>cn===null?null:vt.find(P=>P.id===cn)??null,[cn,vt]),Qa=cn!==null,fa=Qa&&rn===null?rt($e.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,zo=C??fa??(T?null:ne),Kr=zo!==null,Og=z(()=>fD(ae,io),[ae,io]),un=`${String(o)}\0${String(n)}`,Fg=sr(et,et.length),Ys=Ba(un,et,{cursor:Fg,expandedCursor:et.length}),[$u,Bg]=G(()=>({documentKey:un,cursor:Ys.cursor})),pa=$u.documentKey===un?$u.cursor:Ys.cursor,U=B(P=>{Bg(V=>{let le=V.documentKey===un?V.cursor:Ba(un,X.current).cursor,Be=typeof P=="function"?P(le):P,We=X.current,nt=Ir(We,Be);return bM(un,We,Be,nt),V.documentKey===un&&V.cursor===Be?V:{documentKey:un,cursor:Be}})},[un,X]),[se,Re]=G(()=>lr(et,et.length)),[yt,gn]=G(null),[xr,Co]=G(null),[zg,Hu]=G(!1),[Uu,Ku]=G(!1);q(()=>{st?.(Uu)},[Uu,st]);let[ID,qu]=G(!1),[Vu,$g]=G(null),[SD,Hg]=G(null),[Ib,wD]=G(null),[Ug,ma]=G(!1),[hd,Js]=G(!1),[TD,Sb]=G(null),[Zs,Kg]=G({key:0,active:!1}),wb=_(un);ye(()=>{wb.current!==un&&(wb.current=un,Re(lr(et,Ys.expandedCursor)),gn(null),Co(null),Hu(!1),Ku(!1),$g(null),Hg(null),ma(!1),Js(!1),Sb(null),Kg({key:Zs.key,active:!1}))},[un,Ys.expandedCursor,et,Zs.key]);let yr=lp("max-sm"),so=yr&&!h&&!ID,ga=_(null),Tb=_(null),qg=_(null),Lb=_(null),Vg=_(!1),Wg=_(!1),kb=_(!1),Pb=_([]),Ab=_(null),bo=_(null),el=_(null),tl=_(null),Wu=_(!1),Eb=_(0),nl=_(null),Gg=_(new Set),$i=_(new Map),ol=z(()=>ge.chat.deriveComposerSendState({prompt:et,imageCount:Nt.length,terminalContexts:ft,elementContextCount:eo.length+ln.length+Nn.length}),[eo.length,Nt.length,ln.length,Nn.length,ft,et]),rl=se?.kind??null,Mb=se?.kind==="path"?se.query:"",Rb=rl==="path",jg=ge.pathSearch.useComposerPathSearch({environmentId:o,cwd:Rb?qt:null,query:Rb?Mb:null}),$o=z(()=>{if(!se)return[];if(se.kind==="path")return jg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:pu(P.path),description:P.path.slice(0,Math.max(0,P.path.lastIndexOf("/")))}));if(se.kind==="slash-command"){let P=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:"Switch response model for this thread"},...hr?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:"Switch this thread into plan mode"},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:"Switch this thread back to normal build mode"}]:[]],V=hM(Eo?.skills??[],Se.showSkillsInSlashMenu),le=vM(Eo?.slashCommands??[],V).map(kt=>({id:`provider-slash-command:${It}:${kt.name}`,type:"provider-slash-command",provider:It,command:kt,label:`/${kt.name}`,description:kt.description??kt.input?.hint??"Run provider command"})),Be=se.query.trim().toLowerCase(),We=V.map(kt=>({id:`skill:${It}:${kt.name}`,type:"skill",provider:It,skill:kt,label:`/skill:${kt.name}`,description:kt.shortDescription??kt.description??(kt.scope?`${kt.scope} skill`:"")})),nt=[...P,...le,...We];return $_(nt,Be)}return se.kind==="skill"?z_(Eo?.skills??[],se.query).map(P=>({id:`skill:${It}:${P.name}`,type:"skill",provider:It,skill:P,label:sa(P),description:P.shortDescription??P.description??(P.scope?`${P.scope} skill`:"Run provider skill")})):[]},[se,hr,It,Eo,Se.showSkillsInSlashMenu,jg.entries]),Hi=!!se,Xa=se?`${se.kind}:${se.query.trim().toLowerCase()}`:null,Nb=z(()=>{let P=ab({items:$o,highlightedItemId:yt,currentSearchKey:Xa,highlightedSearchKey:xr});return $o.find(V=>V.id===P)??null},[yt,xr,$o,Xa]);kb.current=Hi,Pb.current=$o,Ab.current=Nb;let LD=z(()=>new Set(Hn),[Hn]),Vn=S!==null,Gu=I[0]??null,_b=T?.activeQuestion?.allowFreeform===!1,vd=H[0]??null,{showTopDrawer:ju,showCollapsedPromptRow:kD,hasBlocking:xd}=qw(vd?.kind??null,so),PD=K||T!==null,{isComposerFooterCompact:yd,isComposerPrimaryActionsCompact:Db}=LT(qg,PD),AD=rl==="path"&&Mb.length>0&&jg.isPending,ED=z(()=>rl==="skill"?"No skills found. Try / to browse provider commands.":rl==="path"?"No matching files or folders.":"No matching command.",[rl]),Ob=B(P=>{if(P===X.current){bt();return}X.current=P,at(n,P);let V=sr(P,P.length);U(V),Re(lr(P,P.length)),bt()},[n,X,bt,at]),MD=j_({modelApi:ge.model,provider:It,instanceId:_t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:bn,models:gr,modelOptions:xo?.[_t],prompt:et,onPromptChange:Ob,planModeEnabled:Se.planModeEnabled}),Fb=Q_({modelApi:ge.model,provider:It,instanceId:_t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:bn,models:gr,modelOptions:xo?.[_t],prompt:et,onPromptChange:Ob,planModeEnabled:Se.planModeEnabled}),Qu=z(()=>T?{questionIndex:T.questionIndex,isLastQuestion:T.isLastQuestion,canAdvance:T.canAdvance,isResponding:A,isComplete:!!E}:null,[A,T,E]),RD=v==="running"||y||Kr||x||on||g||k!==null||!ol.hasSendableContent,ND="Send message",Cd=yr&&!so&&Qu!==null,al=B(P=>{at(n,P)},[n,at]),_D=B(P=>{wn(n,P)},[n,wn]),DD=B(P=>{dn(n,P)},[n,dn]),OD=B(P=>{ge.uploads.release(P),Cn(n,P)},[ge.uploads,n,Cn]),FD=B(P=>{let V=ft.findIndex(We=>We.id===P);if(V<0)return;let le=ge.terminalContext.removeInlinePlaceholder(X.current,V);X.current=le.prompt,al(le.prompt),Kn(n,P);let Be=sr(le.prompt,le.cursor);U(Be),Re(lr(le.prompt,le.cursor))},[n,ft,X,Kn,al]);ye(()=>{X.current=et,U(P=>ir(et,P))},[un,et,X,U]),q(()=>{if(Vu===null)return;let P=yb(et,Rt.maxInputChars);P!==Vu&&$g(P)},[Vu,Rt.maxInputChars,et]),q(()=>{Hg(null)},[eo,ln,Nn,ft,et,bn,Hr,It]),ye(()=>{xt.current=Nt},[Nt,xt]),ye(()=>{mn.current=ft},[ft,mn]),ye(()=>{Tt.current=eo},[eo,Tt]),q(()=>{if(!Hi){gn(null),Co(null);return}let P=ab({items:$o,highlightedItemId:yt,currentSearchKey:Xa,highlightedSearchKey:xr});gn(V=>V===P?V:P),Co(V=>V===Xa?V:Xa)},[yt,xr,$o,Hi,Xa]);let Xu=_(null);q(()=>{let P=T?.customAnswer;if(typeof P!="string"){Xu.current=null;return}let V=Gu?.requestId??null,le=T?.activeQuestion?.id??null,Be=Xu.current?.requestId!==V||Xu.current?.questionId!==le,We=X.current!==P;if(Xu.current={requestId:V,questionId:le},!Be&&!We)return;X.current=P;let nt=sr(P,P.length);U(nt),Re(lr(P,Ir(P,nt))),gn(null)},[T?.customAnswer,T?.activeQuestion?.id,Gu?.requestId,X]);let BD=B((P,V,le,Be,We)=>{if(T?.activeQuestion&&I.length>0){if(T.activeQuestion.allowFreeform===!1)return;U(V),Re(Be?null:lr(P,le)),Sn(T.activeQuestion.id,P,V,le,Be);return}X.current=P,al(P),N6(ft,We)||Wt(n,R6(ft,We)),U(V),Re(Be?null:lr(P,le))},[T?.activeQuestion,I.length,Sn,X,al,n,ft,Wt]),Ya=B((P,V,le,Be)=>{let We=X.current,nt=Math.max(0,Math.min(We.length,P)),kt=Math.max(nt,Math.min(We.length,V));if(Be?.expectedText!==void 0&&We.slice(nt,kt)!==Be.expectedText)return!1;let wt=tT(X.current,P,V,le),Mo=sr(wt.text,wt.cursor),Pn=Ir(wt.text,Mo);X.current=wt.text;let va=T?.activeQuestion;return va&&Gu?Sn(va.id,wt.text,Mo,Pn,!1):al(wt.text),U(Mo),Re(lr(wt.text,Pn)),Be?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{ga.current?.focusAt(Mo)}),!0},[T?.activeQuestion,Gu,Sn,X,al]),Yu=B(()=>{let P=ga.current?.readSnapshot();return P||{value:X.current,cursor:pa,expandedCursor:Ir(X.current,pa),terminalContextIds:ft.map(V=>V.id)}},[pa,ft,X]),Qg=B(()=>{let P=Yu();return{snapshot:P,trigger:lr(P.value,P.expandedCursor)}},[Yu]),Bb=B(P=>{if(Wg.current)return;Wg.current=!0,window.requestAnimationFrame(()=>{Wg.current=!1});let{snapshot:V,trigger:le}=Qg();if(le){if(P.type==="path"){let Be=`${Sc(P.path)} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}if(P.type==="slash-command"){if(P.command==="model"){Ya(le.rangeStart,le.rangeEnd,"",{expectedText:V.value.slice(le.rangeStart,le.rangeEnd),focusEditorAfterReplace:!1})&&(gn(null),Ku(!0));return}ht(P.command==="plan"?"plan":"default"),Ya(le.rangeStart,le.rangeEnd,"",{expectedText:V.value.slice(le.rangeStart,le.rangeEnd)})&&gn(null);return}if(P.type==="provider-slash-command"){let Be=`/${P.command.name} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}if(P.type==="skill"){let Be=`$${P.skill.name} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}}},[Ya,ht,Qg]),zD=B(P=>{gn(P),Co(Xa)},[Xa]),zb=B(P=>{if($o.length===0)return;let V=$o.findIndex(kt=>kt.id===yt),We=((V>=0?V:P==="ArrowDown"?-1:0)+(P==="ArrowDown"?1:-1)+$o.length)%$o.length,nt=$o[We];gn(nt?.id??null)},[yt,$o]),$b=B(()=>{if(!yr)return;bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),qu(!1)},[yr]),Hb=B(()=>!yr||y||Kr||x||on||k!==null||v==="running"?!1:T?T.isLastQuestion&&!!E:K||ol.hasSendableContent,[T,E,ol.hasSendableContent,k,x,yr,y,Kr,on,v,K]),Xg=B((P,V="foreground")=>{if(on||Kr){P?.preventDefault();return}if(d&&($i.current.get(un)??0)>0){P?.preventDefault(),ge.notify.info("Still compressing a pasted image.","Send again once its thumbnail appears.");return}let le=gD({prompt:X.current,submissionTarget:T?"pending-user-input":"provider-turn",maxInputChars:Rt.maxInputChars,disabledReason:zo,event:P,onSend:Be=>(Vg.current=!1,Jt(Be,V),!Vg.current)});$g(le.validationMessage),le.didDispatch&&Hb()&&$b()},[d,T,$b,un,Kr,Rt.maxInputChars,on,Jt,X,zo,Hb]),$D=B(()=>{if(!(Et||on||ol.hasSendableContent||S!==null||I.length>0||v==="running"||y||x||!d)){if(($i.current.get(un)??0)>0){ge.notify.info("Still compressing a pasted image.","Compact again once its thumbnail appears.");return}zn()}},[S,d,Et,un,ol.hasSendableContent,x,y,on,zn,I.length,v]),Ju=B(()=>{bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),el.current!==null&&window.cancelAnimationFrame(el.current),tl.current!==null&&window.cancelAnimationFrame(tl.current),Wu.current=!0,qu(!0),el.current=window.requestAnimationFrame(()=>{el.current=null,ga.current?.focusAtEnd(),tl.current=window.requestAnimationFrame(()=>{tl.current=null,Wu.current=!1})})},[]),HD=(P,V)=>{if(P==="Tab"&&V.shiftKey)return hr?(pt(),!0):!1;let{trigger:le}=Qg();if(kb.current||le!==null){let nt=Pb.current,kt=Ab.current??nt[0];if(P==="ArrowDown"&&nt.length>0)return zb("ArrowDown"),!0;if(P==="ArrowUp"&&nt.length>0)return zb("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&kt)return Bb(kt),!0}let We=P==="Enter"?Jw({isMobileViewport:yr,shiftKey:V.shiftKey,modifierKey:V.metaKey||V.ctrlKey,isDraftThread:i==="draft"}):null;return We?(Xg(void 0,We),!0):!1},Zu=ge.stash.useStore,il=Zu(P=>P.entries),Ub=Zu(P=>P.stashEntry),ef=Zu(P=>P.takeEntry),Kb=Zu(P=>P.finalizeEntryImages);q(()=>()=>{nl.current!==null&&window.clearTimeout(nl.current)},[]);let qb=B(()=>{Eb.current+=1,Kg({key:Eb.current,active:!0}),nl.current!==null&&window.clearTimeout(nl.current),nl.current=window.setTimeout(()=>{nl.current=null,Kg(P=>({...P,active:!1}))},1200)},[]),UD=B(P=>{let{entry:V,durable:le}=ef(P.id);if(!V)return;le||ge.notify.warning("Restored prompt may reappear in the stash","Browser storage rejected the update, so this entry could still be there after a reload."),ma(!1);let Be=X.current,We=P.prompt.length===0?Be:Be.trim().length?`${Be.replace(/\s+$/,"")}
|
|
3733
3737
|
|
|
3734
|
-
${P.prompt}`:P.prompt,rt=Ge!==$e;rt&&(Ee.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,Ee,Z,Ju]),RD=$(P=>{let{durable:V}=Ju(P.id);V||me.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[Ju]),ND=$(async()=>{let P=Ee.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(Vg.current.has(ae))return;Vg.current.add(ae);let $e=n,Ge=mu();try{let{evicted:rt,written:Et,durable:kt}=$b({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."),Ee.current="",ua($e);for(let cl of V)me.uploads.release(cl.id);Ro(0),K(null),Ub(),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:nf}=Hb(Ge,{attachments:Ho,droppedImageNames:[...An,...Gr],unreadableImageNames:ya});co?!nf&&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{Vg.current.delete(ae)}},[ua,n,ht,Hb,Ee,Ub,$b]),Xg=$(()=>{ha(P=>!P)},[]),_D=$(()=>{if(wn){Xu(),ha(!0);return}Xg()},[Xu,wn,Xg]),Yg=$(()=>{tl(P=>!P)},[]),Id=f?.latestTurn?.turnId??null,Kb=Id!==null&&gD===Id,Wr=Kb?null:O,xa=Kb?null:ne,Sd=S!==null||I.length>0,Jg=$(()=>{Id!==null&&Ib(Id),tl(!1)},[Id]),Zu=dl.length>0&&!En&&(t.externalDrawerAttached||Wu||yd||wn)?u(dv,{count:dl.length,menuOpen:zg,placement:"inline",pulseKey:nl.key,pulsing:nl.active,onToggleMenu:_D}):null,ef=Wr!==null&&xa!==null&&!yd&&!Sd&&(t.externalDrawerAttached||Wu||wn)?u(cv,{expanded:!1,onDismiss:Jg,onToggle:Yg,placement:"inline",progress:Wr,steps:xa}):null,Zg=!t.externalDrawerAttached&&!Wu&&!yd&&!wn,DD=Zg&&(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||ND()}},{capture:!0});let tf=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)||nv(An.type))){let nf=a?ut.maxFileBytes:ut.maxImageBytes;if(An.size>nf){No=ft("attachments.tooLarge",{name:An.name,limit:rv(nf)});continue}kt.push({...av({id:mu(),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({...av({id:mu(),name:Gr.name||"image",mimeType:Gr.type,sizeBytes:Gr.size}),previewUrl:co,file:Gr})}kt.length===1&&kt[0]?wD(kt[0]):kt.length>1&&TD(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)}}},OD=P=>{LD(P)},FD=P=>{let V=Array.from(P.target.files??[]);P.target.value="",V.length!==0&&tf(V)},BD=P=>{let V=Array.from(P.clipboardData.files);V.length!==0&&(P.preventDefault(),tf(V))},qb=(P,V)=>{if(P.length===0||x||En||I.length>0||g)return!1;let ae=Ee.current,$e=(V?.ensureLeadingBoundary??!1)&&ae.length>0&&!/\s$/.test(ae);return ni(ae.length,ae.length,$e?` ${P}`:P)},eh=tT({insertMentionAtEnd:P=>qb(P,{ensureLeadingBoundary:!0}),setDragActive:Co,onInsertRejected:()=>{me.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),zD=P=>{if(!lv(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 th=$(()=>{en()},[en]),nh=$(()=>{Rt()},[Rt]),$D=$(()=>{br&&(qu.current||(bo.current!==null&&window.cancelAnimationFrame(bo.current),bo.current=window.requestAnimationFrame(()=>{if(bo.current=null,qu.current)return;let P=Tb.current,V=Hg.current,ae=document.activeElement;ae instanceof Element&&S6(ae)||ae instanceof Node&&(P&&P.contains(ae)||V&&V.contains(ae))||Uu(!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(Ce,()=>({focusAtEnd:()=>{va.current?.focusAtEnd()},focusAt:P=>{va.current?.focusAt(P)},addDroppedFiles:P=>{tf(P),xt()},insertTextAtEnd:qb,openModelPicker:()=>{xd(!0)},toggleModelPicker:()=>{xd(P=>!P)},compactContext:Qg,isModelPickerOpen:()=>el,isMentionMenuOpen:()=>qg.current,readSnapshot:()=>Qu(),resetCursorState:P=>{let V=P?.prompt??Ee.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:Ee.current,cursor:ga,expandedCursor:wr(Ee.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:mu(),threadId:f.id,createdAt:new Date().toISOString(),...P},ae.contextIndex)&&(Ee.current=ae.prompt,Ro($e),K(dr(ae.prompt,ae.cursor)),window.requestAnimationFrame(()=>{va.current?.focusAt($e)}))},getSendContext:()=>({prompt:Ee.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??yb({prompt:Ee.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:ut.maxInputChars});return Ug.current=V!==null,Bg(V),V===null}}),[f,tf,n,ga,Tt,hn,Ee,ht,Wt,fn,Lt,Jn,xt,x,En,I.length,g,ni,el,Qu,Ht,Bo,xn,Sn,pa,Bi,zt,Xa,$t,Fn,pt,rn,Qg,ut.maxInputChars]),b("form",{ref:Hg,onSubmit:jg,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),Uu(!0))},onBlurCapture:()=>{$D()},onDragEnterCapture:eh.onDragEnter,onDragOverCapture:eh.onDragOver,onDragLeaveCapture:zD,onDropCapture:eh.onDrop,className:F("mx-auto w-full min-w-0 max-w-3xl",DD&&"pt-7"),"data-chat-composer-form":"true",children:[Wu&&(!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(eb,{approval:S,pendingCount:L.length}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:u(WC,{requestId:S.requestId,isResponding:B.includes(S.requestId),options:S.options,keybindings:Oe,declineReasonRelay:S.declineReasonRelay,onRespondToApproval:Un})})]}):!wn&&I.length>0?u(ob,{pendingUserInputs:I,respondingRequestIds:B,answers:N,questionIndex:R,onToggleOption:kn,onAdvance:pn}):!wn&&z&&U?u(w_,{planTitle:iD(U.planMarkdown)??null},U.id):wn&&S?b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(eb,{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(WC,{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(ob,{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:[Rb?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:Xu,"aria-label":"Write custom answer",children:T?.customAnswer||"Write custom answer"}),ef,Zu,T?.activeQuestion?.multiSelect?u(Eg,{compact:!0,pendingAction:Gu,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:th,onImplementPlanInNewThread:nh}):null]})})]}):null}):null,yd&&!Sd&&Wr&&xa?u(cT,{onDismiss:Jg,onCollapse:Yg,progress:Wr,steps:xa}):null,b("div",{className:"relative",children:[Zg&&Wr&&xa?u(cv,{expanded:!1,hasTrailingShoulder:dl.length>0,onDismiss:Jg,onToggle:Yg,progress:Wr,steps:xa}):null,Zg?u(dv,{count:dl.length,menuOpen:zg,pulseKey:nl.key,pulsing:nl.active,onToggleMenu:Xg}):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:Tb,"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(eD,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,vD?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:Xu,"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...")}),ef,Zu,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:ID,"aria-label":SD,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),jg()},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:mD,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:[zg&&!Ui&&!En&&u(sD,{anchor:bb,children:u(sT,{entries:dl,onRestore:MD,onDelete:RD,onClose:()=>ha(!1)})}),Ui&&!En&&u(sD,{anchor:bb,children:u(FN,{items:$o,resolvedTheme:it,isLoading:yD,triggerKind:sl,emptyStateText:CD,activeItemId:Mb?.id??null,onHighlightedItemChange:ED,onSelect:Ob})}),!wn&&!En&&I.length===0&&Lt.length>0&&u(CT,{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=vb(bn,P);V&&bt(V)},className:"mb-3"}),!wn&&!En&&I.length===0&&Jn.length>0&&u(yT,{comments:Jn,onRemove:P=>xo(n,P),className:"mb-3"}),!wn&&!En&&I.length===0&&nt.length>0&&u(xT,{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=ov(P),$e=fT(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=vb(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:rv(P.sizeBytes)})]})]}),hD.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:cp(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:()=>OD(P.id),"aria-label":ft("attachments.remove",{name:P.name}),children:u(Yt,{})})]},P.id)})}),b("div",{className:"relative",children:[Rb?null:u(EM,{editorRef:va,documentKey:an,value:En?"":T?T.customAnswer:Qe,cursor:ga,terminalContexts:!En&&I.length===0?Tt:[],skills:Ie?.skills??[],...bd?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:kD,onChange:PD,onCommandKeyDown:AD,onPaste:BD,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"?Zw:"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:[ef,Zu,u(Eg,{compact:!0,pendingAction:Gu,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:th,onImplementPlanInNewThread:nh})]}):null]})]}),u(aD,{message:pD??Ku}),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:wb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:FD}),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:()=>wb.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(ON,{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,...we?{composerChoices:we}:{},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(q_,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:Cd}),Cd?u($N,{interactionMode:W,runtimeMode:ee,runtimeModeSwitch:Qo.runtimeModeSwitch,nativeMode:qr,canSwitchNativeMode:fa,showInteractionModeToggle:Qo.showInteractionModeToggle,traitsMenuContent:bD,onToggleInteractionMode:de,onRuntimeModeChange:tt,onNativeModeChange:Zs}):b(xe,{children:[Db?b(xe,{children:[u(ec,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),Db]}):null,u(w6,{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":Nb?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[bd?null:ef,bd?null:Zu,u(T6,{compact:Nb,activeContextWindow:lt,activeThreadModelDisplayName:Za,pendingAction:Gu,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:th,onImplementPlanInNewThread:nh,compactDisabled:at||zt||y||x,compactDisabledReason:vr,onCompactContext:Qg})]})]})]})})]})]})});function dD(e){let{composerRef:t,...n}=e,o=n;return u(rT,{value:o.api,children:u(lD,{...o,composerRef:t})})}function cD(e){return u(ph.Provider,{value:e.scope.active,children:u(L6,{...e})})}function L6(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(dD,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:b(xe,{children:[u(nS,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(iS,{...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(oS,{chat:u(h0,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u(C0,{...r,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(Hw,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:d,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:b(xe,{children:[u(Ow,{inputKey:t.threadKey,actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(ev,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var k6=".ycodium-conversation-ui";function P6(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function uD(e,t="conversation"){let n=P6(),o=e.replaceAll(k6,`.${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 E6(e){let t=uD(Gb);return{views:{[sh]:A6(t,e)},viewCapabilities:{[sh]:[Zb]}}}function A6(e,t){return function(o){let a=o[lh]??t,i={...o};return delete i[lh],b(Xb,{value:a,children:[u(M6,{retain:e.retain}),u(Jb,{value:e.scopeClass,children:u(cD,{...i,scopeClass:e.scopeClass})})]})}}function M6({retain:e}){return Ld(()=>e(),[e]),null}export{E6 as default};
|
|
3738
|
+
${P.prompt}`:P.prompt,nt=We!==Be;nt&&(X.current=We,at(n,We),U(sr(We,We.length)),Re(null));let kt=[];if(P.attachments.length>0){let Mo=new Set(xt.current.map(lo=>lo.id)),Pn=new Set(xt.current.map(lo=>`${lo.mimeType}\0${lo.sizeBytes}\0${lo.name}`)),va=Math.max(0,Rt.maxAttachments-xt.current.length),Ho=P.attachments.filter(lo=>!Mo.has(lo.id)&&!Pn.has(`${lo.mimeType}\0${lo.sizeBytes}\0${lo.name}`));kt=Ho.slice(va).map(lo=>lo.name);let Vr=ge.draft.hydrateImagesFromPersisted(Ho.slice(0,va));Vr.length>0&&dn(n,Vr)}let wt=[];P.droppedImageNames.length>0&&wt.push(`${P.droppedImageNames.join(", ")} exceeded the stash size limit when this prompt was saved.`),P.unreadableImageNames&&P.unreadableImageNames.length>0&&wt.push(`${P.unreadableImageNames.join(", ")} could not be read when this prompt was saved.`),kt.length>0&&wt.push(`${kt.join(", ")} could not be restored: the composer is at its ${Rt.maxAttachments}-image limit.`),wt.length>0&&ge.notify.warning("Some images were not restored",wt.join(" ")),nt&&window.requestAnimationFrame(()=>{ga.current?.focusAtEnd()})},[dn,n,xt,Rt.maxAttachments,X,at,ef]),KD=B(P=>{let{durable:V}=ef(P.id);V||ge.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[ef]),qD=B(async()=>{let P=X.current.split("\uFFFC").join("").trim(),V=[...xt.current];if(P.length===0&&V.length===0){ma(nt=>!nt);return}let le=`${String(n)}\0${P}\0${V.map(nt=>nt.id).join(",")}`;if(Gg.current.has(le))return;Gg.current.add(le);let Be=n,We=fu();try{let{evicted:nt,written:kt,durable:wt}=Ub({id:We,createdAt:new Date().toISOString(),prompt:P,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:V.length});if(!kt){ge.notify.error("Could not stash this prompt","Browser storage rejected the write, so the composer was left as-is. Free up site data and try again.");return}wt||ge.notify.warning("Stashed prompt will not survive a reload","Browser storage is unavailable, so this stash is kept in memory only for this session."),X.current="",Ni(Be);for(let sl of V)ge.uploads.release(sl.id);U(0),Re(null),qb(),nt&&ge.notify.warning("Oldest stashed prompt discarded",`The stash holds ${ge.stash.maxEntries} prompts; the oldest was removed to make room.`);let Mo=[],Pn=[],va=[];for(let sl of V){let Id=await ge.imageCompression.compressForStash(sl.file);if(!Id.ok){(Id.reason==="too-large"?Pn:va).push(sl.name);continue}Mo.push({id:sl.id,name:sl.name,mimeType:Id.image.mimeType,sizeBytes:Id.image.sizeBytes,dataUrl:Id.image.dataUrl})}let{kept:Ho,droppedNames:Vr}=ge.stash.partitionAttachments(Mo),{attached:lo,durable:rf}=Kb(We,{attachments:Ho,droppedImageNames:[...Pn,...Vr],unreadableImageNames:va});lo?!rf&&wt&&V.length>0&&ge.notify.warning("Stashed images were not saved","The prompt was stashed, but browser storage rejected its images. They will be missing if you reload."):Ho.length>0&&ge.notify.warning("Stashed images did not attach",`That prompt was restored or deleted before ${Ho.length} image${Ho.length===1?"":"s"} finished saving. Re-attach ${Ho.length===1?"it":"them"} if you still need ${Ho.length===1?"it":"them"}.`)}finally{Gg.current.delete(le)}},[Ni,n,xt,Kb,X,qb,Ub]),Yg=B(()=>{ma(P=>!P)},[]),VD=B(()=>{if(so){Ju(),ma(!0);return}Yg()},[Ju,so,Yg]),Jg=B(()=>{Js(P=>!P)},[]),bd=f?.latestTurn?.turnId??null,Vb=bd!==null&&TD===bd,qr=Vb?null:oe,ha=Vb?null:ee,Zg=B(()=>{bd!==null&&Sb(bd),Js(!1)},[bd]),tf=il.length>0&&!Vn&&(t.externalDrawerAttached||ju||hd||so)?u(uv,{count:il.length,menuOpen:Ug,placement:"inline",pulseKey:Zs.key,pulsing:Zs.active,onToggleMenu:VD}):null,nf=qr!==null&&ha!==null&&!hd&&!xd&&(t.externalDrawerAttached||ju||so)?u(fv,{expanded:!1,onDismiss:Zg,onToggle:Jg,placement:"inline",progress:qr,steps:ha}):null,eh=!t.externalDrawerAttached&&!ju&&!hd&&!so,WD=eh&&(il.length>0||qr!==null&&ha!==null&&qr.totalSteps>0);q(()=>{(qr===null||ha===null)&&Js(!1)},[ha,qr]),q(()=>{xd&&Js(!1)},[xd]),q(()=>{Js(!1)},[d]),q(()=>{Hi&&ma(!1)},[Hi]),q(()=>{ma(!1)},[et]),ge.pane.useKeydown(P=>{if(ge.keybindings.resolveShortcutCommand(P,ze,{context:{terminalFocus:ge.terminalFocus.getOwner()!==null,terminalOpen:Je,modelPickerOpen:Uu}})==="composer.stash"&&(P.preventDefault(),P.stopPropagation(),!ge.commandPalette.isOpen())){if(I.length>0&&!Vn){ma(le=>!le);return}Vn||g||T!==null||qD()}},{capture:!0});let of=async P=>{if(!d||P.length===0)return;if(I.length>0){ge.notify.error(rt("attachments.answerQuestionsFirst"));return}let V=d,le=un,Be=$i.current.get(le)??0,We=xt.current.length+Be,nt=[],kt=null;for(let wt of P){if(We>=Rt.maxAttachments){kt=rt("attachments.limitReached",{count:Rt.maxAttachments});break}if(wt.size<=0){kt=rt("attachments.empty",{name:wt.name});continue}nt.push(wt),We+=1}if(yn(V,kt),nt.length!==0){$i.current.set(le,Be+nt.length);try{let wt=[],Mo=null;for(let Pn of nt){if(!(ge.imageCompression.isHeicFile(Pn)||rv(Pn.type))){let rf=a?Rt.maxFileBytes:Rt.maxImageBytes;if(Pn.size>rf){Mo=rt("attachments.tooLarge",{name:Pn.name,limit:iv(rf)});continue}wt.push({...sv({id:fu(),name:Pn.name||"file",mimeType:Pn.type||"application/octet-stream",sizeBytes:Pn.size}),previewUrl:URL.createObjectURL(Pn),file:Pn});continue}let Ho=await ge.imageCompression.prepareForAttachment(Pn,Rt.maxImageBytes);if(!Ho.ok){Mo=Ho.reason==="unreadable"?rt("attachments.unreadableImage",{name:Pn.name}):rt("attachments.imageTooLarge",{name:Pn.name});continue}let Vr=Ho.file,lo=URL.createObjectURL(Vr);wt.push({...sv({id:fu(),name:Vr.name||"image",mimeType:Vr.type,sizeBytes:Vr.size}),previewUrl:lo,file:Vr})}wt.length===1&&wt[0]?_D(wt[0]):wt.length>1&&DD(wt),Mo!==null&&yn(V,Mo)}finally{let wt=($i.current.get(le)??0)-nt.length;wt>0?$i.current.set(le,wt):$i.current.delete(le)}}},GD=P=>{OD(P)},jD=P=>{let V=Array.from(P.target.files??[]);P.target.value="",V.length!==0&&of(V)},QD=P=>{let V=Array.from(P.clipboardData.files);V.length!==0&&(P.preventDefault(),of(V))},Wb=(P,V)=>{if(P.length===0||x||Vn||I.length>0||g)return!1;let le=X.current,Be=(V?.ensureLeadingBoundary??!1)&&le.length>0&&!/\s$/.test(le);return Ya(le.length,le.length,Be?` ${P}`:P)},th=rT({insertMentionAtEnd:P=>Wb(P,{ensureLeadingBoundary:!0}),setDragActive:Hu,onInsertRejected:()=>{ge.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),XD=P=>{if(!cv(P.dataTransfer.types))return;P.stopPropagation();let V=P.relatedTarget;V instanceof Node&&P.currentTarget.contains(V)||Hu(!1)};q(()=>{if(!zg)return;let P=()=>{Hu(!1)};return window.addEventListener("dragend",P),()=>window.removeEventListener("dragend",P)},[zg]);let nh=B(()=>{Mt()},[Mt]),oh=B(()=>{kn()},[kn]),YD=B(()=>{yr&&(Wu.current||(bo.current!==null&&window.cancelAnimationFrame(bo.current),bo.current=window.requestAnimationFrame(()=>{if(bo.current=null,Wu.current)return;let P=Lb.current,V=qg.current,le=document.activeElement;le instanceof Element&&_6(le)||le instanceof Node&&(P&&P.contains(le)||V&&V.contains(le))||qu(!1)})))},[yr]);q(()=>()=>{bo.current!==null&&window.cancelAnimationFrame(bo.current),el.current!==null&&window.cancelAnimationFrame(el.current),tl.current!==null&&window.cancelAnimationFrame(tl.current)},[]);let rh=()=>({prompt:X.current,images:xt.current,terminalContexts:mn.current,elementContexts:Tt.current,previewAnnotations:ln,reviewComments:Nn,selectedPromptEffort:Hr,selectedModelOptionsForDispatch:jo,selectedModelSelection:Oo,...Gt?{executionSelection:Gt}:{},executionReady:Fo,..._n?{selectedNativeModeId:_n}:{},providerAvailable:!on,selectedProvider:It,selectedModel:bn,selectedProviderModels:gr,selectedPluginAction:rn});return Yt.current=rh,Gr(nn,()=>({focusAtEnd:()=>{ga.current?.focusAtEnd()},focusAt:P=>{ga.current?.focusAt(P)},addDroppedFiles:P=>{of(P),tn()},insertTextAtEnd:Wb,toggleModelPicker:()=>{Ku(P=>!P)},readSnapshot:()=>Yu(),resetCursorState:P=>{let V=P?.prompt??X.current,le=ir(V,P?.cursor??0);gn(null),U(le),Re(P?.detectTrigger?lr(V,Ir(V,le)):null)},addTerminalContext:P=>{if(!f)return;let V=ga.current?.readSnapshot()??{value:X.current,cursor:pa,expandedCursor:Ir(X.current,pa),terminalContextIds:ft.map(nt=>nt.id)},le=ge.terminalContext.insertInlinePlaceholder(V.value,V.expandedCursor),Be=sr(le.prompt,le.cursor);$t(n,le.prompt,{id:fu(),threadId:f.id,createdAt:new Date().toISOString(),...P},le.contextIndex)&&(X.current=le.prompt,U(Be),Re(lr(le.prompt,le.cursor)),window.requestAnimationFrame(()=>{ga.current?.focusAt(Be)}))},readSendIdentity:()=>({pluginActionId:rn?.id??null,prompt:X.current}),getSendContext:rh,validateProviderInput:P=>{let V=fa??Cb({prompt:X.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:Rt.maxInputChars});return Vg.current=V!==null,Hg(V),V===null}}),[f,of,n,pa,ft,$t,X,xt,mn,Tt,ln,Nn,tn,x,Vn,I.length,g,Ya,Yu,bn,jo,Oo,Gt,Fo,_n,on,Hr,It,gr,rn,fa,rh,Yt,Rt.maxInputChars]),b("form",{ref:qg,onSubmit:Xg,onFocusCapture:P=>{let V=P.target;so&&V instanceof HTMLElement&&V.closest('[data-chat-composer-collapsed-controls="true"]')||(bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),qu(!0))},onBlurCapture:()=>{YD()},onDragEnterCapture:th.onDragEnter,onDragOverCapture:th.onDragOver,onDragLeaveCapture:XD,onDropCapture:th.onDrop,className:F("mx-auto w-full min-w-0 max-w-3xl",WD&&"pt-7"),"data-chat-composer-form":"true",children:[ju&&(!hd||xd)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":vd?.kind==="approval"?"warning":"info","data-occupant":vd?.kind??"none",children:vd===null?null:__({occupant:vd,respondingRequestIds:$,keybindings:ze,onRespondToApproval:vn,onRespondToDecision:L,activePendingDraftAnswers:N,activePendingQuestionIndex:R,onSelectActivePendingUserInputOption:$n,onAdvanceActivePendingUserInput:Vt,activeProposedPlan:O,collapsedPendingRow:u(HN,{activePendingProgress:T,isPendingUserInputChoiceOnly:_b,expandMobileComposer:Ju,inlineTasksBadge:nf,inlineStashBadge:tf,pendingPrimaryAction:Qu,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,onPreviousActivePendingUserInputQuestion:Zt,handleInterruptPrimaryAction:nh,handleImplementPlanInNewThreadPrimaryAction:oh})},so)}):null,hd&&!xd&&qr&&ha?u(pT,{onDismiss:Zg,onCollapse:Jg,progress:qr,steps:ha}):null,b("div",{className:"relative",children:[eh&&qr&&ha?u(fv,{expanded:!1,hasTrailingShoulder:il.length>0,onDismiss:Zg,onToggle:Jg,progress:qr,steps:ha}):null,eh?u(uv,{count:il.length,menuOpen:Ug,pulseKey:Zs.key,pulsing:Zs.active,onToggleMenu:Yg}):null,u("div",{"data-chat-composer-main-surface":"true",className:F("group relative z-10 rounded-[22px] p-px transition-colors duration-200",yo.composerFrameClassName),children:b("div",{ref:Lb,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":so?"true":"false",className:F("rounded-[20px] transition-[background-color] duration-200",zg?"bg-accent/45 ring-1 ring-primary/70":null,g?"opacity-75":null,yo.composerSurfaceClassName),children:[t.firstRow?u("div",{className:"flex items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:t.firstRow}):null,t.sourceMetrics&&!Vn?u(uD,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,kD?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(T?T.customAnswer:et.trim())?"text-foreground":"text-placeholder"),onPointerDown:P=>P.preventDefault(),onClick:Ju,"aria-label":"Expand composer",children:T?T.customAnswer||"Type your own answer, or leave this blank to use the selected option":et.trim()||(on?"Enable a provider in Settings":"Ask anything...")}),nf,tf,u("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:RD,"aria-label":ND,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),Xg()},children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):null,b("div",{ref:wD,className:F("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Vn&&"pb-3 sm:pb-4",so&&"hidden"),children:[Ug&&!Hi&&!Vn&&u(vD,{anchor:Ib,children:u(cT,{entries:il,onRestore:UD,onDelete:KD,onClose:()=>ma(!1)})}),Hi&&!Vn&&u(vD,{anchor:Ib,children:u($N,{items:$o,resolvedTheme:He,isLoading:AD,triggerKind:rl,emptyStateText:ED,activeItemId:Nb?.id??null,onHighlightedItemChange:zD,onSelect:Bb})}),!so&&!Vn&&I.length===0&&ln.length>0&&u(ST,{annotations:ln,images:Nt,...a?{uploadsByImageId:Un,onRetryUpload:P=>ge.uploads.retry({environmentId:o,image:P})}:{},onRemove:P=>{ge.uploads.release(P),Wa(n,P)},onExpandImage:P=>{let V=xb(ut,P);V&&sn(V)},className:"mb-3"}),!so&&!Vn&&I.length===0&&Nn.length>0&&u(IT,{comments:Nn,onRemove:P=>Ga(n,P),className:"mb-3"}),!so&&!Vn&&I.length===0&&eo.length>0&&u(bT,{contexts:eo,onRemove:P=>vo(n,P),className:"mb-3"}),!so&&!Vn&&I.length===0&&Nt.some(P=>!ln.some(V=>V.id===P.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:Nt.filter(P=>!ln.some(V=>V.id===P.id)).map(P=>{let V=a?Un[P.id]:void 0,le=av(P),Be=gT(le),We=le==="image"&&!!P.previewUrl;return b("div",{className:F("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",We?"w-16":"w-44 max-w-full"),children:[We?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":rt("attachments.preview",{name:P.name}),onClick:()=>{let nt=xb(ut,P.id);nt&&sn(nt)},children:u("img",{src:P.previewUrl,alt:P.name,className:"h-full w-full object-cover"})}):b("a",{href:P.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":rt("attachments.open",{name:P.name}),children:[u(Be,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:P.name}),u("span",{className:"block text-[10px] text-secondary-label",children:iv(P.sizeBytes)})]})]}),LD.has(P.id)&&b(Qe,{children:[u(Ye,{render:u("span",{role:"img","aria-label":rt("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-amber-600",children:u(So,{className:"size-3"})})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:rt("attachments.draftMayNotPersistDetail")})]}),V?.status==="uploading"&&u("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-[10px] text-foreground",children:fp(V.progress)}),V?.status==="failed"&&b(Qe,{children:[u(Ye,{render:u(te,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>ge.uploads.retry({environmentId:o,image:P}),"aria-label":rt("attachments.retryUpload",{name:P.name})}),children:u(ns,{})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:V.reason})]}),u(te,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>GD(P.id),"aria-label":rt("attachments.remove",{name:P.name}),children:u(jt,{})})]},P.id)})}),b("div",{className:"relative",children:[_b?null:u(RM,{editorRef:ga,documentKey:un,value:Vn?"":T?T.customAnswer:et,cursor:pa,terminalContexts:!Vn&&I.length===0?ft:[],skills:Eo?.skills??[],...Cd?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:FD,onChange:BD,onCommandKeyDown:HD,onPaste:QD,placeholder:Vn?S?.detail??"Resolve this approval request to continue":T?"Type your own answer, or leave this blank to use the selected option":K&&O?"Add feedback to refine the plan, or leave this blank to implement it":g?"Choose a project above to start a thread":on?"Enable a provider in Settings to send a message":v==="disconnected"?nT:"Ask anything, @tag files/folders, $use skills, or / for commands",disabled:x||Vn||g}),Cd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[nf,tf,u(Fu,{compact:!0,pendingAction:Qu,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Zt,onInterrupt:nh,onImplementPlanInNewThread:oh})]}):null]})]}),u(hD,{message:SD??Vu}),fa===null?null:u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-plugin-blocked":"true",children:fa}),so||Vn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":yd?"true":"false",className:F("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",I.length>0&&"pt-2",yd?"gap-1.5":"gap-2 sm:gap-0",Cd&&"hidden sm:flex"),children:[b("div",{className:"-m-1 -ms-3.5 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto p-1 ps-3.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[u("input",{ref:Tb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:jD}),b(Qe,{children:[u(Ye,{render:u(te,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:x||g||I.length>0,"aria-label":rt("attachments.add"),onClick:()=>Tb.current?.click()}),children:u(Ro,{})}),u(Xe,{side:"top",children:rt("attachments.add")})]}),on?b(te,{type:"button",size:"sm",variant:"ghost",disabled:!0,"data-chat-provider-unavailable":"true",className:"shrink-0 gap-2 px-2 text-secondary-label sm:px-3",children:[u(So,{className:"size-4"}),"No provider available"]}):u(zN,{compact:yd,activeInstanceId:_t,model:zi,lockedProvider:ve,lockedContinuationGroupKey:qn,instanceEntries:he,keybindings:ze,modelOptionsByInstance:io,triggerClassName:"-ms-2.5",terminalOpen:Je,open:Uu,...yo.modelPickerIconClassName?{activeProviderIconClassName:yo.modelPickerIconClassName}:{},onOpenChange:P=>{Ku(P)},getModelDisabledReason:ie,getModelContinuationLabel:pe,onContinueInModel:Ze,onInstanceModelChange:ho,...xe?{composerChoices:xe}:{},selectedExecutionSelection:Gt??null,onClearExecutionSelection:dt,executionAppliesTo:lt,sourceLabel:Bi?.sourceLabel,...D?{onChooseExecution:P=>{D(P.selection,P)}}:{},...Bo?{pluginActions:vt,selectedPluginActionKey:rn?.id??null,onSelectPluginAction:Y,onManagePlugins:ce}:{}}),Qa?null:b(be,{children:[u(tD,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:yd}),yd?u(D_,{interactionMode:qe,runtimeMode:W,runtimeModeSwitch:ao.runtimeModeSwitch,nativeMode:Oi,canSwitchNativeMode:Ur,showInteractionModeToggle:ao.showInteractionModeToggle,traitsMenuContent:MD,onToggleInteractionMode:pt,onRuntimeModeChange:xn,onNativeModeChange:Fi}):b(be,{children:[Fb?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),Fb]}):null,u(D6,{showInteractionModeToggle:ao.showInteractionModeToggle,interactionMode:qe,runtimeMode:W,runtimeModeSwitch:ao.runtimeModeSwitch,nativeMode:Oi,canSwitchNativeMode:Ur,onToggleInteractionMode:pt,onRuntimeModeChange:xn,onNativeModeChange:Fi})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":Db?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Cd?null:nf,Cd?null:tf,u(O6,{compact:Db,activeContextWindow:ct,activeThreadModelDisplayName:Og,pendingAction:Qu,isRunning:v==="running",showPlanFollowUpPrompt:I.length===0&&K,promptHasText:et.trim().length>0,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,isPreparingWorktree:w,hasSendableContent:ol.hasSendableContent,preserveComposerFocusOnPointerDown:yr,showSendWhileRunning:yr,onPreviousPendingQuestion:Zt,onInterrupt:nh,onImplementPlanInNewThread:oh,compactDisabled:Et||on||y||x,compactDisabledReason:_i,onCompactContext:$D})]})]})]})})]})]})});function yD(e){let{composerRef:t,...n}=e,o=n;return u(sT,{value:o.api,children:u(xD,{...o,composerRef:t})})}function CD(e){return u(gh.Provider,{value:e.scope.active,children:u(F6,{...e})})}function F6(e){let{scope:t,mode:n,timeline:o,trajectory:r,queue:a,composer:i}=e,[s,l]=Ln("turn-navigator",t.threadKey,null),d=u(yD,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:b(be,{children:[u(rS,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(lS,{...s,placement:"inline",onSelect:c=>{n.onModeChange("chat"),s.onSelect(c)}}):null]})});return b("div",{className:F("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(aS,{chat:u(x0,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u(I0,{...r,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(Kw,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:d,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:b(be,{children:[u(Bw,{inputKey:t.threadKey,actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(nv,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var B6=".ycodium-conversation-ui";function z6(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function bD(e,t="conversation"){let n=z6(),o=e.replaceAll(B6,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function $6(e){let t=bD(Qb);return{views:{[dh]:H6(t,e)},viewCapabilities:{[dh]:[tI]}}}function H6(e,t){return function(o){let a=o[ch]??t,i={...o};return delete i[ch],b(Jb,{value:a,children:[u(U6,{retain:e.retain}),u(eI,{value:e.scopeClass,children:u(CD,{...i,scopeClass:e.scopeClass})})]})}}function U6({retain:e}){return wd(()=>e(),[e]),null}export{$6 as default};
|